mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
Merge branch 'master' into ace-diff
This commit is contained in:
+2
-1
@@ -2639,7 +2639,7 @@
|
||||
/types/nightmare/ @horiuchi @samyang-au @Bleser92
|
||||
/types/nightwatch/ @rkavalap @schlesiger
|
||||
/types/nivo-slider/ @AndersonFriaca
|
||||
/types/noble/ @swook @wind-rider @shantanubhadoria @lukel99 @bioball @keton @thegecko
|
||||
/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko
|
||||
/types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour
|
||||
/types/nodal/ @charrondev
|
||||
/types/node/v4/ @eps1lon
|
||||
@@ -3009,6 +3009,7 @@
|
||||
/types/proj4leaflet/ @BendingBender
|
||||
/types/project-oxford/ @scsouthw
|
||||
/types/promise-dag/ @OSjoerdWie
|
||||
/types/promise-map-limit/ @kohlmannj
|
||||
/types/promise-pg/ @coldacid
|
||||
/types/promise-polyfill/ @skysteve
|
||||
/types/promise-pool/ @vilic
|
||||
|
||||
@@ -87,6 +87,7 @@ Primero, haz un [fork](https://guides.github.com/activities/forking/) en este re
|
||||
|
||||
* `cd types/my-package-to-edit`
|
||||
* Haz cambios. Recuerda editar las pruebas.
|
||||
Si realiza cambios importantes, no olvide [actualizar una versión principal](#quiero-actualizar-un-paquete-a-una-nueva-versión-principal).
|
||||
* También puede que quieras añadirte la sección "Definitions by" en el encabezado del paquete.
|
||||
- Esto hará que seas notificado (a través de tu nombre de usuario en GitHub) cada vez que alguien haga un pull request o issue sobre el paquete.
|
||||
- Haz esto añadiendo tu nombre al final de la línea, así como en `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
|
||||
|
||||
@@ -87,6 +87,7 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in
|
||||
|
||||
* `cd types/my-package-to-edit`
|
||||
* Make changes. Remember to edit tests.
|
||||
If you make breaking changes, do not forget to [update a major version](#i-want-to-update-a-package-to-a-new-major-version).
|
||||
* You may also want to add yourself to "Definitions by" section of the package header.
|
||||
- This will cause you to be notified (via your GitHub username) whenever someone makes a pull request or issue about the package.
|
||||
- Do this by adding your name to the end of the line, as in `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
|
||||
|
||||
@@ -660,6 +660,12 @@
|
||||
"sourceRepoURL": "https://github.com/ashtuchkin/iconv-lite",
|
||||
"asOfVersion": "0.4.14"
|
||||
},
|
||||
{
|
||||
"libraryName": "ids",
|
||||
"typingsPackageName": "ids",
|
||||
"sourceRepoURL": "https://github.com/bpmn-io/ids",
|
||||
"asOfVersion": "0.2.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "immutability-helper",
|
||||
"typingsPackageName": "immutability-helper",
|
||||
@@ -1176,6 +1182,12 @@
|
||||
"sourceRepoURL": "https://github.com/idehub/react-native-google-analytics-bridge",
|
||||
"asOfVersion": "5.3.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-native-linear-gradient",
|
||||
"typingsPackageName": "react-native-linear-gradient",
|
||||
"sourceRepoURL": "https://github.com/react-native-community/react-native-linear-gradient",
|
||||
"asOfVersion": "2.4.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-native-modal",
|
||||
"typingsPackageName": "react-native-modal",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "definitely-typed",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.2",
|
||||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import drawTriangle = require("a-big-triangle");
|
||||
|
||||
const gl = new WebGLRenderingContext();
|
||||
|
||||
drawTriangle(gl); // $ExpectType void
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for a-big-triangle 1.0
|
||||
// Project: https://github.com/mikolalysenko/a-big-triangle
|
||||
// Definitions by: Mathias Paumgarten <https://github.com/MathiasPaumgarten>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function createABigTriangle(gl: WebGLRenderingContext): void;
|
||||
|
||||
export = createABigTriangle;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"a-big-triangle-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// https://github.com/opentable/accept-language-parser/blob/v1.4.1/index.js
|
||||
// https://github.com/opentable/accept-language-parser/blob/v1.5.0/index.js
|
||||
|
||||
import * as AcceptLanguageParser from 'accept-language-parser';
|
||||
|
||||
@@ -23,3 +23,9 @@ const l3: AcceptLanguageParser.Language = {
|
||||
const parsed1: AcceptLanguageParser.Language[] = AcceptLanguageParser.parse('');
|
||||
const pick1: string | null = AcceptLanguageParser.pick([''], '');
|
||||
const pick2: string | null = AcceptLanguageParser.pick([''], [l1, l2, l3]);
|
||||
const pick3: string | null = AcceptLanguageParser.pick([''], '', {});
|
||||
const pick4: string | null = AcceptLanguageParser.pick([''], '', { loose: true });
|
||||
|
||||
const pickOptions: AcceptLanguageParser.PickOptions = {
|
||||
loose: true
|
||||
};
|
||||
|
||||
+10
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for accept-language-parser 1.4
|
||||
// Type definitions for accept-language-parser 1.5
|
||||
// Project: https://github.com/opentable/accept-language-parser
|
||||
// Definitions by: Niklas Wulf <https://github.com/kampfgnom>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -7,7 +7,11 @@
|
||||
// https://github.com/opentable/accept-language-parser/blob/v1.4.1/index.js
|
||||
|
||||
export function parse(acceptLanguage: string): Language[];
|
||||
export function pick(supportedLanguages: string[], acceptLanguage: string | Language[]): string | null;
|
||||
export function pick(
|
||||
supportedLanguages: string[],
|
||||
acceptLanguage: string | Language[],
|
||||
options?: PickOptions
|
||||
): string | null;
|
||||
|
||||
export interface Language {
|
||||
code: string;
|
||||
@@ -15,3 +19,7 @@ export interface Language {
|
||||
region?: string;
|
||||
quality: number;
|
||||
}
|
||||
|
||||
export interface PickOptions {
|
||||
loose?: boolean;
|
||||
}
|
||||
|
||||
Vendored
+57
-23
@@ -101,6 +101,29 @@ declare namespace AceAjax {
|
||||
transformAction(state: any, action: any, editor: any, session: any, param: any): any;
|
||||
}
|
||||
|
||||
export interface OptionProvider {
|
||||
|
||||
/**
|
||||
* Sets a Configuration Option
|
||||
**/
|
||||
setOption(optionName: string, optionValue: any): void;
|
||||
|
||||
/**
|
||||
* Sets Configuration Options
|
||||
**/
|
||||
setOptions(keyValueTuples: any): void;
|
||||
|
||||
/**
|
||||
* Get a Configuration Option
|
||||
**/
|
||||
getOption(name: string):any;
|
||||
|
||||
/**
|
||||
* Get Configuration Options
|
||||
**/
|
||||
getOptions():any;
|
||||
}
|
||||
|
||||
////////////////
|
||||
/// Ace
|
||||
////////////////
|
||||
@@ -495,7 +518,7 @@ declare namespace AceAjax {
|
||||
* Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state.
|
||||
* `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s.
|
||||
**/
|
||||
export interface IEditSession {
|
||||
export interface IEditSession extends OptionProvider {
|
||||
|
||||
selection: Selection;
|
||||
|
||||
@@ -1074,7 +1097,7 @@ declare namespace AceAjax {
|
||||
* The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen.
|
||||
* Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
|
||||
**/
|
||||
export interface Editor {
|
||||
export interface Editor extends OptionProvider {
|
||||
|
||||
on(ev: string, callback: (e: any) => any): void;
|
||||
|
||||
@@ -1113,26 +1136,6 @@ declare namespace AceAjax {
|
||||
|
||||
execCommand(command:string, args?: any): void;
|
||||
|
||||
/**
|
||||
* Sets a Configuration Option
|
||||
**/
|
||||
setOption(optionName: any, optionValue: any): void;
|
||||
|
||||
/**
|
||||
* Sets Configuration Options
|
||||
**/
|
||||
setOptions(keyValueTuples: any): void;
|
||||
|
||||
/**
|
||||
* Get a Configuration Option
|
||||
**/
|
||||
getOption(name: any):any;
|
||||
|
||||
/**
|
||||
* Get Configuration Options
|
||||
**/
|
||||
getOptions():any;
|
||||
|
||||
/**
|
||||
* Get rid of console warning by setting this to Infinity
|
||||
**/
|
||||
@@ -2692,7 +2695,7 @@ declare namespace AceAjax {
|
||||
/**
|
||||
* The class that is responsible for drawing everything you see on the screen!
|
||||
**/
|
||||
export interface VirtualRenderer {
|
||||
export interface VirtualRenderer extends OptionProvider {
|
||||
|
||||
scroller: any;
|
||||
|
||||
@@ -3036,6 +3039,37 @@ declare namespace AceAjax {
|
||||
**/
|
||||
new(container: HTMLElement, theme?: string): VirtualRenderer;
|
||||
}
|
||||
|
||||
export interface Completer {
|
||||
/**
|
||||
* Provides possible completion results asynchronously using the given callback.
|
||||
* @param editor The editor to associate with
|
||||
* @param session The `EditSession` to refer to
|
||||
* @param pos An object containing the row and column
|
||||
* @param prefix The prefixing string before the current position
|
||||
* @param callback Function to provide the results or error
|
||||
*/
|
||||
getCompletions: (editor: Editor, session: IEditSession, pos: Position, prefix: string, callback: CompletionCallback) => void;
|
||||
|
||||
/**
|
||||
* Provides tooltip information about a completion result.
|
||||
* @param item The completion result
|
||||
*/
|
||||
getDocTooltip?: (item: Completion) => void;
|
||||
}
|
||||
|
||||
export interface Completion {
|
||||
value: string;
|
||||
meta: string;
|
||||
type?: string;
|
||||
caption?: string;
|
||||
snippet?: any;
|
||||
score?: number;
|
||||
exactMatch?: number;
|
||||
docHTML?: string;
|
||||
}
|
||||
|
||||
export type CompletionCallback = (error: Error, results: Completion[]) => void;
|
||||
}
|
||||
|
||||
declare var ace: AceAjax.Ace;
|
||||
|
||||
@@ -1,27 +1,48 @@
|
||||
let engine = new ActiveXObject('DAO.DBEngine.120');
|
||||
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
|
||||
const results: T[] = [];
|
||||
const enumerator = new Enumerator<T>(col);
|
||||
enumerator.moveFirst();
|
||||
while (!enumerator.atEnd()) {
|
||||
results.push(enumerator.item());
|
||||
enumerator.moveNext();
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
const dbOpenSnapshot = DAO.RecordsetTypeEnum.dbOpenSnapshot;
|
||||
|
||||
let engine = new ActiveXObject('DAO.DBEngine');
|
||||
let dbsNorthwind = engine.OpenDatabase('c:\\path\\to\\northwind.mdb');
|
||||
|
||||
// adding a record to a recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/add-a-record-to-a-dao-recordset
|
||||
let rstShippers = dbsNorthwind.OpenRecordset('Shippers');
|
||||
rstShippers.AddNew();
|
||||
rstShippers.Fields.Item('CompanyName').Value = 'Global Parcel Service';
|
||||
// Set remaining fields
|
||||
rstShippers.Update();
|
||||
rstShippers.Close();
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/add-a-record-to-a-dao-recordset
|
||||
{
|
||||
// adding a record to a recordset
|
||||
const rstShippers = dbsNorthwind.OpenRecordset('Shippers');
|
||||
rstShippers.AddNew();
|
||||
rstShippers('CompanyName').Value = 'Global Parcel Service';
|
||||
// Set remaining fields
|
||||
rstShippers.Update();
|
||||
rstShippers.Close();
|
||||
}
|
||||
|
||||
// create a QueryDef with the given SQL -- https://msdn.microsoft.com/VBA/Access-VBA/articles/build-sql-statements-that-include-variables-and-controls
|
||||
let sql = 'SELECT * FROM Orders WHERE OrderDate > #3-31-2006#';
|
||||
let qdf = dbsNorthwind.CreateQueryDef('Second quarter', sql);
|
||||
// using parameters
|
||||
sql = `
|
||||
PARAMETERS QuarterStart DATETIME
|
||||
SELECT *
|
||||
FROM Orders
|
||||
WHERE OrderDate > QuarterStart
|
||||
`;
|
||||
qdf = dbsNorthwind.CreateQueryDef('Second quarter (parameters)', sql);
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/build-sql-statements-that-include-variables-and-controls
|
||||
{
|
||||
// create a QueryDef with the given SQL
|
||||
let sql = 'SELECT * FROM Orders WHERE OrderDate > #3-31-2006#';
|
||||
let qdf = dbsNorthwind.CreateQueryDef('Second quarter', sql);
|
||||
// using parameters
|
||||
sql = `
|
||||
PARAMETERS QuarterStart DATETIME
|
||||
SELECT *
|
||||
FROM Orders
|
||||
WHERE OrderDate > QuarterStart
|
||||
`;
|
||||
qdf = dbsNorthwind.CreateQueryDef('Second quarter (parameters)', sql);
|
||||
WScript.Echo(`Field names: ${collectionToArray(qdf.Fields).map(fld => fld.Name).join(', ')}`);
|
||||
}
|
||||
|
||||
// count the number of records in a Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/count-the-number-of-records-in-a-dao-recordset
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/count-the-number-of-records-in-a-dao-recordset
|
||||
/** Count the number of records in a Recordset */
|
||||
const findRecordCount = (dbs: DAO.Database, sql: string) => {
|
||||
let count = 0;
|
||||
const rstRecords = dbs.OpenRecordset(sql);
|
||||
@@ -33,113 +54,119 @@ const findRecordCount = (dbs: DAO.Database, sql: string) => {
|
||||
return count;
|
||||
};
|
||||
|
||||
// delete records from a Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/delete-a-record-from-a-dao-recordset
|
||||
rstShippers = dbsNorthwind.OpenRecordset('SELECT * FROM Shippers ORDER BY CompanyName, ShipperID', DAO.RecordsetTypeEnum.dbOpenDynaset);
|
||||
if (!rstShippers.EOF) {
|
||||
let name = rstShippers.Fields.Item('CompanyName').Value;
|
||||
rstShippers.MoveNext();
|
||||
while (!rstShippers.EOF) {
|
||||
const recordName: string = rstShippers.Fields.Item('CompanyName').Value;
|
||||
if (recordName === name) {
|
||||
rstShippers.Delete();
|
||||
} else {
|
||||
name = recordName;
|
||||
}
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/delete-a-record-from-a-dao-recordset
|
||||
{
|
||||
// delete records from a Recordset
|
||||
const rstShippers = dbsNorthwind.OpenRecordset('SELECT * FROM Shippers ORDER BY CompanyName, ShipperID', DAO.RecordsetTypeEnum.dbOpenDynaset);
|
||||
if (!rstShippers.EOF) {
|
||||
let name = rstShippers('CompanyName').Value;
|
||||
rstShippers.MoveNext();
|
||||
while (!rstShippers.EOF) {
|
||||
const recordName: string = rstShippers('CompanyName').Value;
|
||||
if (recordName === name) {
|
||||
rstShippers.Delete();
|
||||
} else {
|
||||
name = recordName;
|
||||
}
|
||||
rstShippers.MoveNext();
|
||||
}
|
||||
}
|
||||
rstShippers.Close();
|
||||
}
|
||||
rstShippers.Close();
|
||||
|
||||
// copy entire records to an array -- https://msdn.microsoft.com/VBA/Access-VBA/articles/extract-data-from-a-record-in-a-dao-recordset
|
||||
let rstEmployees = dbsNorthwind.OpenRecordset('SELECT FirstName, LastName, Title FROM Employees', DAO.RecordsetTypeEnum.dbOpenSnapshot);
|
||||
let records = new VBArray<string>(rstEmployees.GetRows(3));
|
||||
let recordCount = records.ubound(2) + 1;
|
||||
let columnCount = records.ubound(1) + 1;
|
||||
for (let row = 0; row < recordCount; row += 1) {
|
||||
for (let column = 0; column < columnCount; column += 1) {
|
||||
WScript.Echo(records.getItem(column, row));
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/extract-data-from-a-record-in-a-dao-recordset
|
||||
{
|
||||
// copy entire records to an array
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('SELECT FirstName, LastName, Title FROM Employees', dbOpenSnapshot);
|
||||
const records = new VBArray<string>(rstEmployees.GetRows(3));
|
||||
const recordCount = records.ubound(2) + 1;
|
||||
const columnCount = records.ubound(1) + 1;
|
||||
for (let row = 0; row < recordCount; row += 1) {
|
||||
for (let column = 0; column < columnCount; column += 1) {
|
||||
WScript.Echo(records.getItem(column, row));
|
||||
}
|
||||
}
|
||||
if (rstEmployees.EOF) { WScript.Echo('At end of recordset'); }
|
||||
rstEmployees.Close();
|
||||
}
|
||||
if (rstEmployees.EOF) { WScript.Echo('At end of recordset'); }
|
||||
rstEmployees.Close();
|
||||
|
||||
// find a record in a dynaset-type or snapshot-type DAO Recordset -- https://msdn.microsoft.com/en-us/vba/access-vba/articles/find-a-record-in-a-dynaset-type-or-snapshot-type-dao-recordset
|
||||
const findOrdersWithoutDetails = () => {
|
||||
{
|
||||
const orders: number[] = [];
|
||||
const rstOrders = dbsNorthwind.OpenRecordset('SELECT * FROM Orders ORDER BY OrderID', DAO.RecordsetTypeEnum.dbOpenSnapshot);
|
||||
const rstOrderDetails = dbsNorthwind.OpenRecordset('SELECT * FROM [Order Details] ORDER BY OrderID', DAO.RecordsetTypeEnum.dbOpenSnapshot);
|
||||
const rstOrders = dbsNorthwind.OpenRecordset('SELECT * FROM Orders ORDER BY OrderID', dbOpenSnapshot);
|
||||
const rstOrderDetails = dbsNorthwind.OpenRecordset('SELECT * FROM [Order Details] ORDER BY OrderID', dbOpenSnapshot);
|
||||
|
||||
const closeRecordsets = () => {
|
||||
rstOrders.Close();
|
||||
rstOrderDetails.Close();
|
||||
};
|
||||
if (rstOrders.EOF || rstOrderDetails.EOF) {
|
||||
closeRecordsets();
|
||||
return;
|
||||
}
|
||||
|
||||
while (!rstOrders.EOF) {
|
||||
const orderID = rstOrders.Fields.Item('OrderID').Value;
|
||||
rstOrderDetails.FindFirst(`OrderID=${orderID}`);
|
||||
if (rstOrderDetails.NoMatch) {
|
||||
orders.push(orderID);
|
||||
if (!rstOrders.EOF && !rstOrderDetails.EOF) {
|
||||
while (!rstOrders.EOF) {
|
||||
const orderID = rstOrders('OrderID').Value;
|
||||
rstOrderDetails.FindFirst(`OrderID=${orderID}`);
|
||||
if (rstOrderDetails.NoMatch) {
|
||||
orders.push(orderID);
|
||||
}
|
||||
rstOrders.MoveNext();
|
||||
}
|
||||
rstOrders.MoveNext();
|
||||
}
|
||||
closeRecordsets();
|
||||
return orders;
|
||||
};
|
||||
|
||||
// find a record in a table-type DAO Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/find-a-record-in-a-table-type-dao-recordset
|
||||
rstOrders.Close();
|
||||
rstOrderDetails.Close();
|
||||
|
||||
WScript.Echo(orders.join('\n'));
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/find-a-record-in-a-table-type-dao-recordset
|
||||
/** Find a record in a table-type DAO Recordset */
|
||||
const getHireDate = (employeeID: number) => {
|
||||
let hireDate: Date | undefined;
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
rstEmployees.Index = 'PrimaryKey';
|
||||
rstEmployees.Seek('=', employeeID);
|
||||
if (!rstEmployees.NoMatch) {
|
||||
hireDate = new Date(rstEmployees.Fields.Item('HireDate').Value as VarDate);
|
||||
hireDate = new Date(rstEmployees('HireDate').Value as VarDate);
|
||||
}
|
||||
return hireDate;
|
||||
};
|
||||
|
||||
// manipulate multiple fields with DAO -- https://msdn.microsoft.com/VBA/Access-VBA/articles/manipulate-multivalued-fields-with-dao
|
||||
const browseMultiValueField = () => {
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/manipulate-multivalued-fields-with-dao
|
||||
{
|
||||
// manipulate multiple fields with DAO
|
||||
const rs = dbsNorthwind.OpenRecordset('Tasks');
|
||||
rs.MoveFirst();
|
||||
while (!rs.EOF) {
|
||||
WScript.Echo(rs.Fields.Item('TaskName').Value);
|
||||
const childRs = rs.Fields.Item('AssignedTo').Value as DAO.Recordset;
|
||||
WScript.Echo(rs('TaskName').Value);
|
||||
const childRs = rs('AssignedTo').Value as DAO.Recordset;
|
||||
if (childRs.EOF) { continue; }
|
||||
childRs.MoveFirst();
|
||||
while (!childRs.EOF) {
|
||||
WScript.Echo('\t' + childRs.Fields.Item('Value').Value);
|
||||
WScript.Echo('\t' + childRs('Value').Value);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// modifying an existing record in a DAO Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/modify-an-existing-record-in-a-dao-recordset
|
||||
const changeTitleWithoutTransaction = () => {
|
||||
rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/modify-an-existing-record-in-a-dao-recordset
|
||||
{
|
||||
// modifying an existing record in a DAO Recordset
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
while (!rstEmployees.EOF) {
|
||||
if (rstEmployees.Fields.Item('Title').Value === 'Sales Representative') {
|
||||
if (rstEmployees('Title').Value === 'Sales Representative') {
|
||||
rstEmployees.Edit();
|
||||
rstEmployees.Fields.Item('Title').Value = 'Account Executive';
|
||||
rstEmployees('Title').Value = 'Account Executive';
|
||||
rstEmployees.Update();
|
||||
}
|
||||
rstEmployees.MoveNext();
|
||||
}
|
||||
rstEmployees.Close();
|
||||
};
|
||||
}
|
||||
|
||||
// using transactions in a DAO Recordset -- https://msdn.microsoft.com/VBA/Access-VBA/articles/use-transactions-in-a-dao-recordset
|
||||
// https://msdn.microsoft.com/VBA/Access-VBA/articles/use-transactions-in-a-dao-recordset
|
||||
/** using transactions in a DAO Recordset */
|
||||
const changeTitleWithTransaction = (commitTransaction: boolean) => {
|
||||
const currentWorkspace = engine.Workspaces.Item(0);
|
||||
rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
const currentWorkspace = engine.Workspaces(0);
|
||||
const rstEmployees = dbsNorthwind.OpenRecordset('Employees');
|
||||
currentWorkspace.BeginTrans();
|
||||
while (!rstEmployees.EOF) {
|
||||
if (rstEmployees.Fields.Item('Title').Value === 'Sales Representative') {
|
||||
if (rstEmployees('Title').Value === 'Sales Representative') {
|
||||
rstEmployees.Edit();
|
||||
rstEmployees.Fields.Item('Title').Value = 'Account Executive';
|
||||
rstEmployees('Title').Value = 'Account Executive';
|
||||
rstEmployees.Update();
|
||||
}
|
||||
rstEmployees.MoveNext();
|
||||
|
||||
Vendored
+197
-207
@@ -1,8 +1,8 @@
|
||||
// Type definitions for Microsoft Office 14.0 Access Database Engine Object Library - DAO 14.0
|
||||
// Type definitions for Microsoft Office 16.0 Access Database Engine Object Library - DAO 16.0
|
||||
// Project: https://msdn.microsoft.com/en-us/library/dn124645.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
declare namespace DAO {
|
||||
const enum _DAOSuppHelp {
|
||||
@@ -56,12 +56,15 @@ declare namespace DAO {
|
||||
}
|
||||
|
||||
const enum DatabaseTypeEnum {
|
||||
/** @deprecated */
|
||||
dbDecrypt = 4,
|
||||
/** @deprecated */
|
||||
dbEncrypt = 2,
|
||||
dbVersion10 = 1,
|
||||
dbVersion11 = 8,
|
||||
dbVersion120 = 128,
|
||||
dbVersion140 = 256,
|
||||
dbVersion150 = 512,
|
||||
dbVersion20 = 16,
|
||||
dbVersion30 = 32,
|
||||
dbVersion40 = 64,
|
||||
@@ -128,6 +131,15 @@ declare namespace DAO {
|
||||
dbRefreshCache = 8,
|
||||
}
|
||||
|
||||
const enum ISAMStatsEnum {
|
||||
DiskReads = 0,
|
||||
DiskWrites = 1,
|
||||
LocksPlaced = 4,
|
||||
LocksReleased = 5,
|
||||
ReadsFromCache = 2,
|
||||
ReadsFromReadAheadCache = 3,
|
||||
}
|
||||
|
||||
const enum LanguageConstants {
|
||||
dbLangArabic = ';LANGID=0x0401;CP=1256;COUNTRY=0',
|
||||
dbLangChineseSimplified = ';LANGID=0x0804;CP=936;COUNTRY=0',
|
||||
@@ -308,18 +320,26 @@ declare namespace DAO {
|
||||
dbUseODBC = 1,
|
||||
}
|
||||
|
||||
type Bookmark = SafeArray<number>;
|
||||
|
||||
class ComplexType {
|
||||
private 'DAO.ComplexType_typekey': ComplexType;
|
||||
private constructor();
|
||||
readonly Fields: Fields;
|
||||
}
|
||||
|
||||
class Connection {
|
||||
private 'DAO.Connection_typekey': Connection;
|
||||
private constructor();
|
||||
Cancel(): void;
|
||||
Close(): void;
|
||||
readonly Connect: string;
|
||||
CreateQueryDef(Name?: any, SQLText?: any): QueryDef;
|
||||
CreateQueryDef(Name?: string, SQLText?: string): QueryDef;
|
||||
readonly Database: Database;
|
||||
Execute(Query: string, Options?: any): void;
|
||||
Execute(Query: string, Options?: RecordsetOptionEnum): void;
|
||||
readonly hDbc: number;
|
||||
readonly Name: string;
|
||||
OpenRecordset(Name: string, Type?: any, Options?: any, LockEdit?: any): Recordset;
|
||||
OpenRecordset(Name: string, Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum, LockEdit?: LockTypeEnum): Recordset;
|
||||
readonly QueryDefs: QueryDefs;
|
||||
QueryTimeout: number;
|
||||
readonly RecordsAffected: number;
|
||||
@@ -329,12 +349,11 @@ declare namespace DAO {
|
||||
readonly Updatable: boolean;
|
||||
}
|
||||
|
||||
class Connections {
|
||||
private 'DAO.Connections_typekey': Connections;
|
||||
private constructor();
|
||||
interface Connections {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Connection;
|
||||
Item(Item: number | string): Connection;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Connection;
|
||||
}
|
||||
|
||||
class Container {
|
||||
@@ -350,12 +369,11 @@ declare namespace DAO {
|
||||
UserName: string;
|
||||
}
|
||||
|
||||
class Containers {
|
||||
private 'DAO.Containers_typekey': Containers;
|
||||
private constructor();
|
||||
interface Containers {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Container;
|
||||
Item(Item: number | string): Container;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Container;
|
||||
}
|
||||
|
||||
class Database {
|
||||
@@ -366,16 +384,16 @@ declare namespace DAO {
|
||||
Connect: string;
|
||||
readonly Connection: Connection;
|
||||
readonly Containers: Containers;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
CreateQueryDef(Name?: any, SQLText?: any): QueryDef;
|
||||
CreateRelation(Name?: any, Table?: any, ForeignTable?: any, Attributes?: any): Relation;
|
||||
CreateTableDef(Name?: any, Attributes?: any, SourceTableName?: any, Connect?: any): TableDef;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
CreateQueryDef(Name?: string, SQLText?: string): QueryDef;
|
||||
CreateRelation(Name?: string, Table?: string, ForeignTable?: string, Attributes?: RelationAttributeEnum): Relation;
|
||||
CreateTableDef(Name?: string, Attributes?: TableDefAttributeEnum, SourceTableName?: string, Connect?: string): TableDef;
|
||||
DesignMasterID: string;
|
||||
Execute(Query: string, Options?: any): void;
|
||||
MakeReplica(PathName: string, Description: string, Options?: any): void;
|
||||
Execute(Query: string, Options?: RecordsetOptionEnum): void;
|
||||
MakeReplica(PathName: string, Description: string, Options?: ReplicaTypeEnum): void;
|
||||
readonly Name: string;
|
||||
NewPassword(bstrOld: string, bstrNew: string): void;
|
||||
OpenRecordset(Name: string, Type?: any, Options?: any, LockEdit?: any): Recordset;
|
||||
OpenRecordset(Name: string, Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum, LockEdit?: LockTypeEnum): Recordset;
|
||||
PopulatePartial(DbPathName: string): void;
|
||||
readonly Properties: Properties;
|
||||
readonly QueryDefs: QueryDefs;
|
||||
@@ -384,19 +402,18 @@ declare namespace DAO {
|
||||
readonly Recordsets: Recordsets;
|
||||
readonly Relations: Relations;
|
||||
readonly ReplicaID: string;
|
||||
Synchronize(DbPathName: string, ExchangeType?: any): void;
|
||||
Synchronize(DbPathName: string, ExchangeType?: SynchronizeTypeEnum): void;
|
||||
readonly TableDefs: TableDefs;
|
||||
readonly Transactions: boolean;
|
||||
readonly Updatable: boolean;
|
||||
readonly Version: string;
|
||||
}
|
||||
|
||||
class Databases {
|
||||
private 'DAO.Databases_typekey': Databases;
|
||||
private constructor();
|
||||
interface Databases {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Database;
|
||||
Item(Item: number | string): Database;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Database;
|
||||
}
|
||||
|
||||
class DBEngine {
|
||||
@@ -404,26 +421,51 @@ declare namespace DAO {
|
||||
private constructor();
|
||||
BeginTrans(): void;
|
||||
|
||||
/** @param number [Option=0] */
|
||||
/** @param Option [Option=0] */
|
||||
CommitTrans(Option?: number): void;
|
||||
CompactDatabase(SrcName: string, DstName: string, DstLocale?: any, Options?: any, SrcLocale?: any): void;
|
||||
CreateDatabase(Name: string, Locale: string, Option?: any): Database;
|
||||
CreateWorkspace(Name: string, UserName: string, Password: string, UseType?: any): Workspace;
|
||||
|
||||
/**
|
||||
* Compact a closed database
|
||||
*
|
||||
* @param DstLocale Specify one of the following:
|
||||
* * the locale, using one of the language constants
|
||||
* * the password, in the form `;pwd=MyNewPassword'`
|
||||
* * both the constant and a password, e.g. `dbLangGreek + ';pwd=MyNewPassword'`
|
||||
*
|
||||
* @param Options `dbEncrypt` and `dbDecrypt` are deprecated, and unsupported for ACCDB
|
||||
* @param password Deprecated, and unsupported for ACCDB
|
||||
*/
|
||||
CompactDatabase(SrcName: string, DstName: string, DstLocale?: LanguageConstants | string, Options?: DatabaseTypeEnum, password?: string): void;
|
||||
|
||||
/**
|
||||
* @param Locale Specify one of the following:
|
||||
* * the locale, using one of the language constants
|
||||
* * the password, in the form `;pwd=MyNewPassword'`
|
||||
* * both the constant and a password, e.g. `dbLangGreek + ';pwd=MyNewPassword'`
|
||||
*/
|
||||
CreateDatabase(Name: string, Locale: LanguageConstants | string, Option?: DatabaseTypeEnum): Database;
|
||||
CreateWorkspace(Name: string, UserName: string, Password: string, UseType?: WorkspaceTypeEnum): Workspace;
|
||||
readonly DefaultPassword: string;
|
||||
DefaultType: number;
|
||||
readonly DefaultUser: string;
|
||||
readonly Errors: Errors;
|
||||
Idle(Action?: any): void;
|
||||
Idle(Action?: IdleEnum): void;
|
||||
IniPath: string;
|
||||
ISAMStats(StatNum: number, Reset?: any): number;
|
||||
|
||||
/** Returns various statistics from the Jet engine */
|
||||
ISAMStats(StatNum: ISAMStatsEnum, Reset?: boolean): number;
|
||||
LoginTimeout: number;
|
||||
OpenConnection(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Connection;
|
||||
OpenDatabase(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Database;
|
||||
|
||||
/**
|
||||
* @param Connect ODBC connection string; prepend with `ODBC;`
|
||||
*/
|
||||
OpenConnection(Name: string, Options?: DriverPromptEnum | RecordsetOptionEnum.dbRunAsync, ReadOnly?: boolean, Connect?: string): Connection;
|
||||
OpenDatabase(Name: string, Exclusive?: boolean, ReadOnly?: boolean, Connect?: string): Database;
|
||||
readonly Properties: Properties;
|
||||
RegisterDatabase(Dsn: string, Driver: string, Silent: boolean, Attributes: string): void;
|
||||
RepairDatabase(Name: string): void;
|
||||
Rollback(): void;
|
||||
SetOption(Option: number, Value: any): void;
|
||||
SetOption(Option: SetOptionEnum, Value: any): void;
|
||||
SystemDB: string;
|
||||
readonly Version: string;
|
||||
readonly Workspaces: Workspaces;
|
||||
@@ -434,9 +476,9 @@ declare namespace DAO {
|
||||
private constructor();
|
||||
readonly AllPermissions: number;
|
||||
readonly Container: string;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly DateCreated: any;
|
||||
readonly LastUpdated: any;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DateCreated: VarDate;
|
||||
readonly LastUpdated: VarDate;
|
||||
readonly Name: string;
|
||||
Owner: string;
|
||||
Permissions: number;
|
||||
@@ -444,12 +486,11 @@ declare namespace DAO {
|
||||
UserName: string;
|
||||
}
|
||||
|
||||
class Documents {
|
||||
private 'DAO.Documents_typekey': Documents;
|
||||
private constructor();
|
||||
interface Documents {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Document;
|
||||
Item(Item: number | string): Document;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Document;
|
||||
}
|
||||
|
||||
class Error {
|
||||
@@ -462,33 +503,38 @@ declare namespace DAO {
|
||||
readonly Source: string;
|
||||
}
|
||||
|
||||
class Errors {
|
||||
private 'DAO.Errors_typekey': Errors;
|
||||
private constructor();
|
||||
interface Errors {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Error;
|
||||
Refresh(): void;
|
||||
(Item: any): Error;
|
||||
}
|
||||
|
||||
class Field {
|
||||
private 'DAO.Field_typekey': Field;
|
||||
private constructor();
|
||||
private 'DAO.Field2_typekey': Field;
|
||||
AllowZeroLength: boolean;
|
||||
AppendChunk(Val: any): void;
|
||||
AppendOnly: boolean;
|
||||
Attributes: number;
|
||||
readonly CollatingOrder: number;
|
||||
readonly CollectionIndex: number;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly ComplexType: ComplexType;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DataUpdatable: boolean;
|
||||
DefaultValue: any;
|
||||
Expression: string;
|
||||
readonly FieldSize: number;
|
||||
ForeignName: string;
|
||||
GetChunk(Offset: number, Bytes: number): any;
|
||||
readonly IsComplex: boolean;
|
||||
LoadFromFile(FileName: string): void;
|
||||
Name: string;
|
||||
OrdinalPosition: number;
|
||||
readonly OriginalValue: any;
|
||||
readonly Properties: Properties;
|
||||
Required: boolean;
|
||||
SaveToFile(FileName: string): void;
|
||||
Size: number;
|
||||
readonly SourceField: string;
|
||||
readonly SourceTable: string;
|
||||
@@ -500,44 +546,42 @@ declare namespace DAO {
|
||||
readonly VisibleValue: any;
|
||||
}
|
||||
|
||||
class Fields {
|
||||
private 'DAO.Fields_typekey': Fields;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Fields {
|
||||
Append(Field: Field): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Field;
|
||||
Item(Item: number | string): Field;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Field;
|
||||
}
|
||||
|
||||
class Group {
|
||||
private 'DAO.Group_typekey': Group;
|
||||
private constructor();
|
||||
CreateUser(Name?: any, PID?: any, Password?: any): User;
|
||||
CreateUser(Name?: string, PID?: string, Password?: string): User;
|
||||
Name: string;
|
||||
readonly PID: string;
|
||||
readonly Properties: Properties;
|
||||
readonly Users: Users;
|
||||
}
|
||||
|
||||
class Groups {
|
||||
private 'DAO.Groups_typekey': Groups;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Groups {
|
||||
Append(Group: Group): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Group;
|
||||
Item(Item: number | string): Group;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Group;
|
||||
}
|
||||
|
||||
class Index {
|
||||
private 'DAO.Index_typekey': Index;
|
||||
private constructor();
|
||||
Clustered: boolean;
|
||||
CreateField(Name?: any, Type?: any, Size?: any): Field;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
CreateField(Name?: string): Field;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DistinctCount: number;
|
||||
Fields: any;
|
||||
Fields: Fields;
|
||||
readonly Foreign: boolean;
|
||||
IgnoreNulls: boolean;
|
||||
Name: string;
|
||||
@@ -547,14 +591,14 @@ declare namespace DAO {
|
||||
Unique: boolean;
|
||||
}
|
||||
|
||||
class Indexes {
|
||||
private 'DAO.Indexes_typekey': Indexes;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface Indexes {
|
||||
Append(Index: Index): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Index;
|
||||
Item(Item: number | string): Index;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Index;
|
||||
}
|
||||
|
||||
class Parameter {
|
||||
@@ -567,53 +611,20 @@ declare namespace DAO {
|
||||
Value: any;
|
||||
}
|
||||
|
||||
class Parameters {
|
||||
private 'DAO.Parameters_typekey': Parameters;
|
||||
private constructor();
|
||||
interface Parameters {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Parameter;
|
||||
Item(Item: number | string): Parameter;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Parameter;
|
||||
}
|
||||
|
||||
/** DAO 3.0 DBEngine (private) */
|
||||
class PrivDBEngine {
|
||||
private 'DAO.PrivDBEngine_typekey': PrivDBEngine;
|
||||
private constructor();
|
||||
BeginTrans(): void;
|
||||
|
||||
/** @param number [Option=0] */
|
||||
CommitTrans(Option?: number): void;
|
||||
CompactDatabase(SrcName: string, DstName: string, DstLocale?: any, Options?: any, SrcLocale?: any): void;
|
||||
CreateDatabase(Name: string, Locale: string, Option?: any): Database;
|
||||
CreateWorkspace(Name: string, UserName: string, Password: string, UseType?: any): Workspace;
|
||||
readonly DefaultPassword: string;
|
||||
DefaultType: number;
|
||||
readonly DefaultUser: string;
|
||||
readonly Errors: Errors;
|
||||
Idle(Action?: any): void;
|
||||
IniPath: string;
|
||||
ISAMStats(StatNum: number, Reset?: any): number;
|
||||
LoginTimeout: number;
|
||||
OpenConnection(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Connection;
|
||||
OpenDatabase(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Database;
|
||||
readonly Properties: Properties;
|
||||
RegisterDatabase(Dsn: string, Driver: string, Silent: boolean, Attributes: string): void;
|
||||
RepairDatabase(Name: string): void;
|
||||
Rollback(): void;
|
||||
SetOption(Option: number, Value: any): void;
|
||||
SystemDB: string;
|
||||
readonly Version: string;
|
||||
readonly Workspaces: Workspaces;
|
||||
}
|
||||
|
||||
class Properties {
|
||||
private 'DAO.Properties_typekey': Properties;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Properties {
|
||||
Append(Property: Property): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Property;
|
||||
Item(Item: number | string): Property;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Property;
|
||||
}
|
||||
|
||||
class Property {
|
||||
@@ -633,81 +644,78 @@ declare namespace DAO {
|
||||
Cancel(): void;
|
||||
Close(): void;
|
||||
Connect: string;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly DateCreated: any;
|
||||
Execute(Options?: any): void;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DateCreated: VarDate;
|
||||
Execute(Options?: RecordsetOptionEnum): void;
|
||||
readonly Fields: Fields;
|
||||
readonly hStmt: number;
|
||||
readonly LastUpdated: any;
|
||||
readonly LastUpdated: VarDate;
|
||||
MaxRecords: number;
|
||||
Name: string;
|
||||
ODBCTimeout: number;
|
||||
OpenRecordset(Type?: any, Options?: any, LockEdit?: any): Recordset;
|
||||
OpenRecordset(Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum, LockEdit?: LockTypeEnum): Recordset;
|
||||
readonly Parameters: Parameters;
|
||||
Prepare: any;
|
||||
Prepare: QueryDefStateEnum;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordsAffected: number;
|
||||
ReturnsRecords: boolean;
|
||||
SQL: string;
|
||||
readonly StillExecuting: boolean;
|
||||
readonly Type: number;
|
||||
readonly Type: QueryDefTypeEnum;
|
||||
readonly Updatable: boolean;
|
||||
}
|
||||
|
||||
class QueryDefs {
|
||||
private 'DAO.QueryDefs_typekey': QueryDefs;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface QueryDefs {
|
||||
Append(QueryDef: QueryDef): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): QueryDef;
|
||||
Item(Item: number | string): QueryDef;
|
||||
Refresh(): void;
|
||||
(Item: number | string): QueryDef;
|
||||
}
|
||||
|
||||
class Recordset {
|
||||
private 'DAO.Recordset_typekey': Recordset;
|
||||
private constructor();
|
||||
interface Recordset {
|
||||
AbsolutePosition: number;
|
||||
AddNew(): void;
|
||||
readonly BatchCollisionCount: number;
|
||||
readonly BatchCollisions: any;
|
||||
readonly BatchCollisions: SafeArray<Bookmark>;
|
||||
BatchSize: number;
|
||||
readonly BOF: boolean;
|
||||
Bookmark: SafeArray<number>;
|
||||
Bookmark: Bookmark;
|
||||
readonly Bookmarkable: boolean;
|
||||
CacheSize: number;
|
||||
CacheStart: SafeArray<number>;
|
||||
CacheStart: Bookmark;
|
||||
Cancel(): void;
|
||||
|
||||
/** @param number [UpdateType=1] */
|
||||
/** @param UpdateType [UpdateType=1] */
|
||||
CancelUpdate(UpdateType?: number): void;
|
||||
Clone(): Recordset;
|
||||
Close(): void;
|
||||
Collect(Item: any): any;
|
||||
Connection: Connection;
|
||||
CopyQueryDef(): QueryDef;
|
||||
readonly DateCreated: any;
|
||||
readonly DateCreated: VarDate;
|
||||
Delete(): void;
|
||||
Edit(): void;
|
||||
readonly EditMode: number;
|
||||
readonly EditMode: EditModeEnum;
|
||||
readonly EOF: boolean;
|
||||
readonly Fields: Fields;
|
||||
FillCache(Rows?: any, StartBookmark?: any): void;
|
||||
FillCache(Rows?: number, StartBookmark?: string): void;
|
||||
Filter: string;
|
||||
FindFirst(Criteria: string): void;
|
||||
FindLast(Criteria: string): void;
|
||||
FindNext(Criteria: string): void;
|
||||
FindPrevious(Criteria: string): void;
|
||||
GetRows(NumRows?: any): any;
|
||||
GetRows(NumRows?: number): any;
|
||||
readonly hStmt: number;
|
||||
Index: string;
|
||||
readonly LastModified: SafeArray<number>;
|
||||
readonly LastUpdated: any;
|
||||
readonly LastModified: Bookmark;
|
||||
readonly LastUpdated: VarDate;
|
||||
LockEdits: boolean;
|
||||
Move(Rows: number, StartBookmark?: any): void;
|
||||
Move(Rows: number, StartBookmark?: Bookmark): void;
|
||||
MoveFirst(): void;
|
||||
|
||||
/** @param number [Options=0] */
|
||||
/** @param Options [Options=0] */
|
||||
MoveLast(Options?: number): void;
|
||||
MoveNext(): void;
|
||||
MovePrevious(): void;
|
||||
@@ -716,45 +724,44 @@ declare namespace DAO {
|
||||
readonly NoMatch: boolean;
|
||||
readonly ODBCFetchCount: number;
|
||||
readonly ODBCFetchDelay: number;
|
||||
OpenRecordset(Type?: any, Options?: any): Recordset;
|
||||
OpenRecordset(Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum): Recordset;
|
||||
readonly Parent: Database;
|
||||
PercentPosition: number;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordCount: number;
|
||||
readonly RecordStatus: number;
|
||||
Requery(NewQueryDef?: any): void;
|
||||
Requery(NewQueryDef?: QueryDef): void;
|
||||
readonly Restartable: boolean;
|
||||
Seek(
|
||||
Comparison: string, Key1: any, Key2?: any, Key3?: any, Key4?: any, Key5?: any, Key6?: any, Key7?: any, Key8?: any, Key9?: any, Key10?: any, Key11?: any, Key12?: any, Key13?: any): void;
|
||||
Seek(Comparison: string, Key1: any, Key2?: any, Key3?: any, Key4?: any, Key5?: any, Key6?: any, Key7?: any, Key8?: any, Key9?: any, Key10?: any, Key11?: any, Key12?: any, Key13?: any): void;
|
||||
Sort: string;
|
||||
readonly StillExecuting: boolean;
|
||||
readonly Transactions: boolean;
|
||||
readonly Type: number;
|
||||
readonly Type: RecordsetTypeEnum;
|
||||
readonly Updatable: boolean;
|
||||
|
||||
/**
|
||||
* @param number [UpdateType=1]
|
||||
* @param boolean [Force=false]
|
||||
* @param UpdateType [UpdateType=1]
|
||||
* @param Force [Force=false]
|
||||
*/
|
||||
Update(UpdateType?: number, Force?: boolean): void;
|
||||
UpdateOptions: number;
|
||||
Update(UpdateType?: UpdateTypeEnum, Force?: boolean): void;
|
||||
UpdateOptions: UpdateCriteriaEnum;
|
||||
readonly ValidationRule: string;
|
||||
readonly ValidationText: string;
|
||||
(FieldIndex: number | string): Field;
|
||||
}
|
||||
|
||||
class Recordsets {
|
||||
private 'DAO.Recordsets_typekey': Recordsets;
|
||||
private constructor();
|
||||
interface Recordsets {
|
||||
readonly Count: number;
|
||||
Item(Item: any): Recordset;
|
||||
Item(Item: number | string): Recordset;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Recordset;
|
||||
}
|
||||
|
||||
class Relation {
|
||||
private 'DAO.Relation_typekey': Relation;
|
||||
private constructor();
|
||||
Attributes: number;
|
||||
CreateField(Name?: any, Type?: any, Size?: any): Field;
|
||||
Attributes: RelationAttributeEnum;
|
||||
CreateField(Name?: string): Field;
|
||||
readonly Fields: Fields;
|
||||
ForeignTable: string;
|
||||
Name: string;
|
||||
@@ -763,55 +770,53 @@ declare namespace DAO {
|
||||
Table: string;
|
||||
}
|
||||
|
||||
class Relations {
|
||||
private 'DAO.Relations_typekey': Relations;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Relations {
|
||||
Append(Relation: Relation): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Relation;
|
||||
Item(Item: number | string): Relation;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Relation;
|
||||
}
|
||||
|
||||
class TableDef {
|
||||
private 'DAO.TableDef_typekey': TableDef;
|
||||
private constructor();
|
||||
Attributes: number;
|
||||
Attributes: TableDefAttributeEnum;
|
||||
readonly ConflictTable: string;
|
||||
Connect: string;
|
||||
CreateField(Name?: any, Type?: any, Size?: any): Field;
|
||||
CreateIndex(Name?: any): Index;
|
||||
CreateProperty(Name?: any, Type?: any, Value?: any, DDL?: any): Property;
|
||||
readonly DateCreated: any;
|
||||
CreateField(Name?: string, Type?: DataTypeEnum, Size?: number): Field;
|
||||
CreateIndex(Name?: string): Index;
|
||||
CreateProperty(Name?: string, Type?: DataTypeEnum, Value?: any, DDL?: boolean): Property;
|
||||
readonly DateCreated: VarDate;
|
||||
readonly Fields: Fields;
|
||||
readonly Indexes: Indexes;
|
||||
readonly LastUpdated: any;
|
||||
readonly LastUpdated: VarDate;
|
||||
Name: string;
|
||||
OpenRecordset(Type?: any, Options?: any): Recordset;
|
||||
OpenRecordset(Type?: RecordsetTypeEnum, Options?: RecordsetOptionEnum): Recordset;
|
||||
readonly Properties: Properties;
|
||||
readonly RecordCount: number;
|
||||
RefreshLink(): void;
|
||||
ReplicaFilter: any;
|
||||
ReplicaFilter: string | boolean;
|
||||
SourceTableName: string;
|
||||
readonly Updatable: boolean;
|
||||
ValidationRule: string;
|
||||
ValidationText: string;
|
||||
}
|
||||
|
||||
class TableDefs {
|
||||
private 'DAO.TableDefs_typekey': TableDefs;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface TableDefs {
|
||||
Append(TableDef: TableDef): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): TableDef;
|
||||
Item(Item: number | string): TableDef;
|
||||
Refresh(): void;
|
||||
(Item: number | string): TableDef;
|
||||
}
|
||||
|
||||
class User {
|
||||
private 'DAO.User_typekey': User;
|
||||
private constructor();
|
||||
CreateGroup(Name?: any, PID?: any): Group;
|
||||
CreateGroup(Name?: string, PID?: string): Group;
|
||||
readonly Groups: Groups;
|
||||
Name: string;
|
||||
NewPassword(bstrOld: string, bstrNew: string): void;
|
||||
@@ -820,14 +825,13 @@ declare namespace DAO {
|
||||
readonly Properties: Properties;
|
||||
}
|
||||
|
||||
class Users {
|
||||
private 'DAO.Users_typekey': Users;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Users {
|
||||
Append(User: User): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): User;
|
||||
Item(Item: number | string): User;
|
||||
Refresh(): void;
|
||||
(Item: number | string): User;
|
||||
}
|
||||
|
||||
class Workspace {
|
||||
@@ -836,12 +840,19 @@ declare namespace DAO {
|
||||
BeginTrans(): void;
|
||||
Close(): void;
|
||||
|
||||
/** @param number [Options=0] */
|
||||
/** @param Options [Options=0] */
|
||||
CommitTrans(Options?: number): void;
|
||||
readonly Connections: Connections;
|
||||
CreateDatabase(Name: string, Connect: string, Option?: any): Database;
|
||||
CreateGroup(Name?: any, PID?: any): Group;
|
||||
CreateUser(Name?: any, PID?: any, Password?: any): User;
|
||||
|
||||
/**
|
||||
* @param Connect Specify one of the following:
|
||||
* * the locale, using one of the language constants
|
||||
* * the password, in the form `;pwd=MyNewPassword'`
|
||||
* * both the constant and a password, e.g. `dbLangGreek + ';pwd=MyNewPassword'`
|
||||
*/
|
||||
CreateDatabase(Name: string, Connect: string, Option?: DatabaseTypeEnum): Database;
|
||||
CreateGroup(Name?: string, PID?: string): Group;
|
||||
CreateUser(Name?: string, PID?: string, Password?: string): User;
|
||||
readonly Databases: Databases;
|
||||
DefaultCursorDriver: number;
|
||||
readonly Groups: Groups;
|
||||
@@ -849,8 +860,12 @@ declare namespace DAO {
|
||||
IsolateODBCTrans: number;
|
||||
LoginTimeout: number;
|
||||
Name: string;
|
||||
OpenConnection(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Connection;
|
||||
OpenDatabase(Name: string, Options?: any, ReadOnly?: any, Connect?: any): Database;
|
||||
|
||||
/**
|
||||
* @param Connect ODBC connection string; prepend with `ODBC;`
|
||||
*/
|
||||
OpenConnection(Name: string, Options?: DriverPromptEnum | RecordsetOptionEnum.dbRunAsync, ReadOnly?: boolean, Connect?: string): Connection;
|
||||
OpenDatabase(Name: string, Exclusive?: boolean, ReadOnly?: boolean, Connect?: string): Database;
|
||||
readonly Properties: Properties;
|
||||
Rollback(): void;
|
||||
readonly Type: number;
|
||||
@@ -858,14 +873,13 @@ declare namespace DAO {
|
||||
readonly Users: Users;
|
||||
}
|
||||
|
||||
class Workspaces {
|
||||
private 'DAO.Workspaces_typekey': Workspaces;
|
||||
private constructor();
|
||||
Append(Object: any): void;
|
||||
interface Workspaces {
|
||||
Append(Workspace: Workspace): void;
|
||||
readonly Count: number;
|
||||
Delete(Name: string): void;
|
||||
Item(Item: any): Workspace;
|
||||
Item(Item: number | string): Workspace;
|
||||
Refresh(): void;
|
||||
(Item: number | string): Workspace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -875,36 +889,12 @@ interface ActiveXObject {
|
||||
|
||||
interface ActiveXObjectNameMap {
|
||||
'DAO.DBEngine': DAO.DBEngine;
|
||||
'DAO.DBEngine.120': DAO.DBEngine;
|
||||
'DAO.Field': DAO.Field;
|
||||
'DAO.Group': DAO.Group;
|
||||
'DAO.Index': DAO.Index;
|
||||
'DAO.PrivateDBEngine': DAO.PrivDBEngine;
|
||||
'DAO.PrivateDBEngine': DAO.DBEngine;
|
||||
'DAO.QueryDef': DAO.QueryDef;
|
||||
'DAO.Relation': DAO.Relation;
|
||||
'DAO.TableDef': DAO.TableDef;
|
||||
'DAO.User': DAO.User;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new(col: DAO.Connections): Enumerator<DAO.Connection>;
|
||||
new(col: DAO.Containers): Enumerator<DAO.Container>;
|
||||
new(col: DAO.Databases): Enumerator<DAO.Database>;
|
||||
new(col: DAO.Documents): Enumerator<DAO.Document>;
|
||||
new(col: DAO.Errors): Enumerator<DAO.Error>;
|
||||
new(col: DAO.Fields): Enumerator<DAO.Field>;
|
||||
new(col: DAO.Groups): Enumerator<DAO.Group>;
|
||||
new(col: DAO.Indexes): Enumerator<DAO.Index>;
|
||||
new(col: DAO.Parameters): Enumerator<DAO.Parameter>;
|
||||
new(col: DAO.Properties): Enumerator<DAO.Property>;
|
||||
new(col: DAO.QueryDefs): Enumerator<DAO.QueryDef>;
|
||||
new(col: DAO.Recordsets): Enumerator<DAO.Recordset>;
|
||||
new(col: DAO.Relations): Enumerator<DAO.Relation>;
|
||||
new(col: DAO.TableDefs): Enumerator<DAO.TableDef>;
|
||||
new(col: DAO.Users): Enumerator<DAO.User>;
|
||||
new(col: DAO.Workspaces): Enumerator<DAO.Workspace>;
|
||||
}
|
||||
|
||||
interface SafeArray<T = any> {
|
||||
_brand: SafeArray<T>;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ const setColumnVisibility = (visible: boolean) => {
|
||||
const data = sheet.Range("L2", sheet.Range('L100').End(Excel.XlDirection.xlUp)).Value() as SafeArray;
|
||||
sheet.Range('L1', sheet.Range('L100').End(Excel.XlDirection.xlUp)).ClearContents();
|
||||
|
||||
const combobox = sheet.OLEObjects('ComboBox1').Object as MSForms.ComboBox2;
|
||||
const combobox = sheet.OLEObjects('ComboBox1').Object as MSForms.ComboBox;
|
||||
combobox.Clear();
|
||||
ActiveXObject.set(combobox, 'List', [], data);
|
||||
combobox.ListIndex = -1;
|
||||
@@ -293,7 +293,7 @@ const setColumnVisibility = (visible: boolean) => {
|
||||
const dict = new ActiveXObject('Scripting.Dictionary');
|
||||
arr.forEach(x => ActiveXObject.set(dict, 'Item', [x], true));
|
||||
|
||||
const combobox = sheet.OLEObjects('ComboBox1').Object as MSForms.ComboBox2;
|
||||
const combobox = sheet.OLEObjects('ComboBox1').Object as MSForms.ComboBox;
|
||||
combobox.Clear();
|
||||
const enumerator = new Enumerator(dict.Items());
|
||||
enumerator.moveFirst();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// copied from the definitions in activex-scripting
|
||||
interface Dictionary<TKey = any, TItem = any> {
|
||||
/** Add a new key and item to the dictionary. */
|
||||
Add(Key: TKey, Item: TItem): void;
|
||||
|
||||
/** Get the number of items in the dictionary. */
|
||||
readonly Count: number;
|
||||
|
||||
/** Determine if a given key is in the dictionary. */
|
||||
Exists(Key: TKey): boolean;
|
||||
HashVal(Key: TKey): any;
|
||||
|
||||
/** Set or get the item for a given key */
|
||||
Item(Key: TKey): TItem;
|
||||
|
||||
/** Get an array containing all items in the dictionary. */
|
||||
Items(): SafeArray<TItem>;
|
||||
|
||||
/** Change a key to a different key. */
|
||||
Key(Key: TKey): TKey;
|
||||
|
||||
/** Get an array containing all keys in the dictionary. */
|
||||
Keys(): SafeArray<TKey>;
|
||||
|
||||
/** Remove a given key from the dictionary. */
|
||||
Remove(Key: TKey): void;
|
||||
|
||||
/** Remove all information from the dictionary. */
|
||||
RemoveAll(): void;
|
||||
|
||||
/** Set or get the item for a given key */
|
||||
(Key: TKey): TItem;
|
||||
}
|
||||
|
||||
interface ActiveXObjectNameMap {
|
||||
'Scripting.Dictionary': Dictionary;
|
||||
}
|
||||
|
||||
const dict: Dictionary<string, number> = new ActiveXObject('Scripting.Dictionary');
|
||||
dict.Add('one', 1);
|
||||
dict.Add('two', 2);
|
||||
dict.Add('three', 3);
|
||||
|
||||
const keyEnumerator = new Enumerator(dict.Keys());
|
||||
keyEnumerator.moveFirst();
|
||||
while (!keyEnumerator.atEnd()) {
|
||||
const item = dict(keyEnumerator.item());
|
||||
const power = Math.pow(item, 2);
|
||||
}
|
||||
Vendored
+111
@@ -0,0 +1,111 @@
|
||||
// Type definitions for Javascript Automation interop 0.0
|
||||
// Project: https://msdn.microsoft.com/en-us/library/ff521046(v=vs.85).aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
interface ActiveXObjectNameMap { }
|
||||
|
||||
interface ActiveXObject {
|
||||
new <K extends keyof ActiveXObjectNameMap>(progid: K): ActiveXObjectNameMap[K];
|
||||
new(s: string): any;
|
||||
}
|
||||
declare var ActiveXObject: ActiveXObject;
|
||||
|
||||
/**
|
||||
* Represents an Automation SAFEARRAY
|
||||
*/
|
||||
declare class SafeArray<T = any> {
|
||||
private constructor();
|
||||
private SafeArray_typekey: SafeArray<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows enumerating over a COM collection, which may not have indexed item access.
|
||||
*/
|
||||
interface Enumerator<T = any> {
|
||||
/**
|
||||
* Returns true if the current item is the last one in the collection, or the collection is empty,
|
||||
* or the current item is undefined.
|
||||
*/
|
||||
atEnd(): boolean;
|
||||
|
||||
/**
|
||||
* Returns the current item in the collection
|
||||
*/
|
||||
item(): T;
|
||||
|
||||
/**
|
||||
* Resets the current item in the collection to the first item. If there are no items in the collection,
|
||||
* the current item is set to undefined.
|
||||
*/
|
||||
moveFirst(): void;
|
||||
|
||||
/**
|
||||
* Moves the current item to the next item in the collection. If the enumerator is at the end of
|
||||
* the collection or the collection is empty, the current item is set to undefined.
|
||||
*/
|
||||
moveNext(): void;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new <T = any>(collection: SafeArray<T> | { Item(index: any): T }): Enumerator<T>;
|
||||
new (collection: any): Enumerator;
|
||||
}
|
||||
|
||||
declare var Enumerator: EnumeratorConstructor;
|
||||
|
||||
/**
|
||||
* Enables reading from a COM safe array, which might have an alternate lower bound, or multiple dimensions.
|
||||
*/
|
||||
interface VBArray<T = any> {
|
||||
/**
|
||||
* Returns the number of dimensions (1-based).
|
||||
*/
|
||||
dimensions(): number;
|
||||
|
||||
/**
|
||||
* Takes an index for each dimension in the array, and returns the item at the corresponding location.
|
||||
*/
|
||||
getItem(dimension1Index: number, ...dimensionNIndexes: number[]): T;
|
||||
|
||||
/**
|
||||
* Returns the smallest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
lbound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns the largest available index for a given dimension.
|
||||
* @param dimension 1-based dimension (defaults to 1)
|
||||
*/
|
||||
ubound(dimension?: number): number;
|
||||
|
||||
/**
|
||||
* Returns a Javascript array with all the elements in the VBArray. If there are multiple dimensions,
|
||||
* each successive dimension is appended to the end of the array.
|
||||
* Example: [[1,2,3],[4,5,6]] becomes [1,2,3,4,5,6]
|
||||
*/
|
||||
toArray(): T[];
|
||||
}
|
||||
|
||||
interface VBArrayConstructor {
|
||||
new <T = any>(safeArray: SafeArray<T>): VBArray<T>;
|
||||
}
|
||||
|
||||
declare var VBArray: VBArrayConstructor;
|
||||
|
||||
/** Automation date (VT_DATE) */
|
||||
declare class VarDate {
|
||||
private constructor();
|
||||
private VarDate_typekey: VarDate;
|
||||
}
|
||||
|
||||
interface DateConstructor {
|
||||
new(vd: VarDate): Date;
|
||||
}
|
||||
|
||||
interface Date {
|
||||
getVarDate: () => VarDate;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [ "../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"activex-interop-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+119
-2304
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-const-enum": false
|
||||
"no-const-enum": false,
|
||||
"max-line-length": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+833
-1753
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-const-enum": false
|
||||
"no-const-enum": false,
|
||||
"max-line-length": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
// https://msdn.microsoft.com/en-us/library/ms764708(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const dom = new ActiveXObject('Msxml2.DOMDocument.6.0');
|
||||
dom.async = false;
|
||||
dom.resolveExternals = false;
|
||||
dom.loadXML('<a>A</a>');
|
||||
WScript.Echo(`dom: ${dom.xml}`);
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms766390(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const doc = new ActiveXObject('Msxml2.DOMDocument.6.0');
|
||||
doc.load('test.xml');
|
||||
WScript.Echo(`doc: ${doc.xml}`);
|
||||
})();
|
||||
}
|
||||
|
||||
const MakeDOM = () => {
|
||||
try {
|
||||
@@ -37,7 +37,7 @@ const LoadDOM = (file: string) => {
|
||||
};
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms759105(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const doc = new ActiveXObject('Msxml2.DOMDocument.6.0');
|
||||
doc.async = false;
|
||||
doc.resolveExternals = false;
|
||||
@@ -60,10 +60,10 @@ const LoadDOM = (file: string) => {
|
||||
`;
|
||||
doc.loadXML(xml);
|
||||
doc.save('saved.xml');
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms764656(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const doc = LoadDOM('test.xml')!;
|
||||
const xsl = (LoadDOM('test.xsl')! as any) as MSXML2.IXMLDOMNode;
|
||||
|
||||
@@ -73,10 +73,10 @@ const LoadDOM = (file: string) => {
|
||||
const out = MakeDOM()!;
|
||||
doc.transformNodeToObject(xsl, out);
|
||||
WScript.Echo('\ndoc.transformNodeToObject:\n' + out.xml);
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms763685(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const dom = MakeDOM()!;
|
||||
|
||||
// Create a processing instruction targeted for xml.
|
||||
@@ -148,10 +148,10 @@ const LoadDOM = (file: string) => {
|
||||
|
||||
// Save the XML document to a file.
|
||||
dom.save("dynamDom.xml");
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms757050(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const dom = LoadDOM("stocks.xml")!;
|
||||
try {
|
||||
// Query a single node.
|
||||
@@ -172,17 +172,17 @@ const LoadDOM = (file: string) => {
|
||||
} catch (e) {
|
||||
WScript.Echo(e.description);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms757064(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const xhr = new ActiveXObject("Msxml2.XMLHTTP.6.0");
|
||||
xhr.open("GET", "http://localhost/sxh/contact.asp?SearchID=John Doe", false);
|
||||
xhr.send();
|
||||
|
||||
const doc = xhr.responseXML;
|
||||
WScript.Echo(doc.xml);
|
||||
})();
|
||||
}
|
||||
|
||||
const xmlValidation = (fn: (x: MSXML2.DOMDocument60) => void) => {
|
||||
// Create and initialize the DOMDocument object
|
||||
@@ -212,16 +212,16 @@ ${x.xml}
|
||||
};
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms766449(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const validateFile = (filename: string) => xmlValidation(x => x.load(filename));
|
||||
|
||||
let sOutput = validateFile("nn-valid.xml");
|
||||
sOutput = sOutput + validateFile("nn-notValid.xml");
|
||||
WScript.Echo(sOutput);
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms767542(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const validateFile = (filename: string) => xmlValidation(x => {
|
||||
// Configure DOM properties for namespace selection.
|
||||
x.setProperty("SelectionLanguage", "XPath");
|
||||
@@ -235,10 +235,10 @@ ${x.xml}
|
||||
let sOutput = validateFile("sl-valid.xml");
|
||||
sOutput = sOutput + validateFile("sl-notValid.xml");
|
||||
WScript.Echo(sOutput);
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms766439(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const validateFile = (filename: string) => xmlValidation(xd => {
|
||||
// Create a schema cache and add books.xsd to it.
|
||||
const xs = new ActiveXObject('Msxml2.XMLSchemaCache');
|
||||
@@ -253,10 +253,10 @@ ${x.xml}
|
||||
let sOutput = validateFile("sc-valid.xml");
|
||||
sOutput = sOutput + validateFile("sc-notValid.xml");
|
||||
WScript.Echo(sOutput);
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms767636(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
const validateFile = (filename: string) => xmlValidation(x => {
|
||||
x.setProperty("UseInlineSchema", true);
|
||||
x.load(filename);
|
||||
@@ -265,10 +265,10 @@ ${x.xml}
|
||||
let sOutput = validateFile("valid.xml");
|
||||
sOutput = sOutput + validateFile("notValid.xml");
|
||||
WScript.Echo(sOutput);
|
||||
})();
|
||||
}
|
||||
|
||||
// https://msdn.microsoft.com/en-us/library/ms757833(v=vs.85).aspx
|
||||
(() => {
|
||||
{
|
||||
// Load an XML document into a DOM instance.
|
||||
const oXMLDoc = LoadDOM("books.xml")!;
|
||||
|
||||
@@ -326,4 +326,4 @@ ${oError.reason}`;
|
||||
}
|
||||
WScript.Echo(msg);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
Vendored
+35
-39
@@ -424,7 +424,7 @@ declare namespace MSXML2 {
|
||||
createEntityReference(name: string): IXMLDOMEntityReference;
|
||||
|
||||
/** create a node of the specified node type and name */
|
||||
createNode(type: any, name: string, namespaceURI: string): IXMLDOMNode;
|
||||
createNode(type: DOMNodeType.NODE_ATTRIBUTE | DOMNodeType.NODE_CDATA_SECTION | DOMNodeType.NODE_COMMENT | DOMNodeType.NODE_DOCUMENT_FRAGMENT | DOMNodeType.NODE_TEXT | DOMNodeType.NODE_ELEMENT | DOMNodeType.NODE_ENTITY_REFERENCE | DOMNodeType.NODE_PROCESSING_INSTRUCTION, name: string, namespaceURI: string): IXMLDOMNode;
|
||||
|
||||
/** create a processing instruction node */
|
||||
createProcessingInstruction(target: string, data: string): IXMLDOMProcessingInstruction;
|
||||
@@ -433,7 +433,7 @@ declare namespace MSXML2 {
|
||||
createTextNode(data: string): IXMLDOMText;
|
||||
|
||||
/** the data type of the node */
|
||||
dataType: any;
|
||||
dataType: string | null;
|
||||
|
||||
/** pointer to the definition of the node in the DTD or schema */
|
||||
readonly definition: IXMLDOMNode;
|
||||
@@ -497,7 +497,7 @@ declare namespace MSXML2 {
|
||||
readonly nodeTypeString: string;
|
||||
|
||||
/** value stored in the node */
|
||||
nodeValue: any;
|
||||
nodeValue: string | null;
|
||||
|
||||
/** register an ondataavailable event handler */
|
||||
readonly ondataavailable: any;
|
||||
@@ -795,8 +795,7 @@ declare namespace MSXML2 {
|
||||
getAllResponseHeaders(ppwszHeaders: string): void;
|
||||
GetCookie(pwszUrl: string, pwszName: string, dwFlags: number, pcCookies: number, ppCookies: tagXHR_COOKIE): void;
|
||||
getResponseHeader(pwszHeader: string, ppwszValue: string): void;
|
||||
open(
|
||||
pwszMethod: string, pwszUrl: string, pStatusCallback: IXMLHTTPRequest2Callback, pwszUserName: string, pwszPassword: string, pwszProxyUserName: string, pwszProxyPassword: string): void;
|
||||
open(pwszMethod: string, pwszUrl: string, pStatusCallback: IXMLHTTPRequest2Callback, pwszUserName: string, pwszPassword: string, pwszProxyUserName: string, pwszProxyPassword: string): void;
|
||||
send(pBody: ISequentialStream, cbBody: number): void;
|
||||
SetCookie(pCookie: tagXHR_COOKIE, pdwCookieState: number): void;
|
||||
SetCustomResponseStream(pSequentialStream: ISequentialStream): void;
|
||||
@@ -805,11 +804,11 @@ declare namespace MSXML2 {
|
||||
}
|
||||
|
||||
/** IMXNamespacePrefixes interface */
|
||||
class IMXNamespacePrefixes {
|
||||
private 'MSXML2.IMXNamespacePrefixes_typekey': IMXNamespacePrefixes;
|
||||
private constructor();
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IMXNamespacePrefixes {
|
||||
item(index: number): string;
|
||||
readonly length: number;
|
||||
(index: number): string;
|
||||
}
|
||||
|
||||
/** XML Schema */
|
||||
@@ -848,21 +847,21 @@ declare namespace MSXML2 {
|
||||
}
|
||||
|
||||
/** XML Schema Item Collection */
|
||||
class ISchemaItemCollection {
|
||||
private 'MSXML2.ISchemaItemCollection_typekey': ISchemaItemCollection;
|
||||
private constructor();
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface ISchemaItemCollection {
|
||||
item(index: number): ISchemaItem;
|
||||
itemByName(name: string): ISchemaItem;
|
||||
itemByQName(name: string, namespaceURI: string): ISchemaItem;
|
||||
readonly length: number;
|
||||
(index: number): ISchemaItem;
|
||||
}
|
||||
|
||||
/** XML Schema String Collection */
|
||||
class ISchemaStringCollection {
|
||||
private 'MSXML2.ISchemaStringCollection_typekey': ISchemaStringCollection;
|
||||
private constructor();
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface ISchemaStringCollection {
|
||||
item(index: number): string;
|
||||
readonly length: number;
|
||||
(index: number): string;
|
||||
}
|
||||
|
||||
class ISequentialStream {
|
||||
@@ -1960,10 +1959,8 @@ declare namespace MSXML2 {
|
||||
hasFeature(feature: string, version: string): boolean;
|
||||
}
|
||||
|
||||
class IXMLDOMNamedNodeMap {
|
||||
private 'MSXML2.IXMLDOMNamedNodeMap_typekey': IXMLDOMNamedNodeMap;
|
||||
private constructor();
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IXMLDOMNamedNodeMap {
|
||||
/** lookup item by name */
|
||||
getNamedItem(name: string): IXMLDOMNode;
|
||||
|
||||
@@ -1990,6 +1987,9 @@ declare namespace MSXML2 {
|
||||
|
||||
/** set item by name */
|
||||
setNamedItem(newItem: IXMLDOMNode): IXMLDOMNode;
|
||||
|
||||
/** collection of nodes */
|
||||
(index: number): IXMLDOMNode;
|
||||
}
|
||||
|
||||
/** Core DOM node interface */
|
||||
@@ -2090,10 +2090,8 @@ declare namespace MSXML2 {
|
||||
readonly xml: string;
|
||||
}
|
||||
|
||||
class IXMLDOMNodeList {
|
||||
private 'MSXML2.IXMLDOMNodeList_typekey': IXMLDOMNodeList;
|
||||
private constructor();
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IXMLDOMNodeList {
|
||||
/** collection of nodes */
|
||||
item(index: number): IXMLDOMNode;
|
||||
|
||||
@@ -2105,6 +2103,9 @@ declare namespace MSXML2 {
|
||||
|
||||
/** reset the position of iterator */
|
||||
reset(): void;
|
||||
|
||||
/** collection of nodes */
|
||||
(index: number): IXMLDOMNode;
|
||||
}
|
||||
|
||||
/** structure for reporting parser errors */
|
||||
@@ -2238,10 +2239,8 @@ declare namespace MSXML2 {
|
||||
}
|
||||
|
||||
/** XML Schemas Collection */
|
||||
class IXMLDOMSchemaCollection {
|
||||
private 'MSXML2.IXMLDOMSchemaCollection_typekey': IXMLDOMSchemaCollection;
|
||||
private constructor();
|
||||
|
||||
// tslint:disable-next-line:interface-name
|
||||
interface IXMLDOMSchemaCollection {
|
||||
/** add a new schema */
|
||||
add(namespaceURI: string, var_1: any): void;
|
||||
|
||||
@@ -2259,6 +2258,9 @@ declare namespace MSXML2 {
|
||||
|
||||
/** remove schema by namespaceURI */
|
||||
remove(namespaceURI: string): void;
|
||||
|
||||
/** Get namespaceURI for schema by index */
|
||||
(index: number): string;
|
||||
}
|
||||
|
||||
class IXMLDOMText {
|
||||
@@ -2403,7 +2405,7 @@ declare namespace MSXML2 {
|
||||
|
||||
/**
|
||||
* set <xsl:param> values
|
||||
* @param string [namespaceURI='']
|
||||
* @param namespaceURI [namespaceURI='0']
|
||||
*/
|
||||
addParameter(baseName: string, parameter: any, namespaceURI?: string): void;
|
||||
|
||||
@@ -2424,7 +2426,7 @@ declare namespace MSXML2 {
|
||||
|
||||
/**
|
||||
* set XSL mode and it's namespace
|
||||
* @param string [namespaceURI='']
|
||||
* @param namespaceURI [namespaceURI='0']
|
||||
*/
|
||||
setStartMode(mode: string, namespaceURI?: string): void;
|
||||
|
||||
@@ -2487,7 +2489,7 @@ declare namespace MSXML2 {
|
||||
popContext(): void;
|
||||
pushContext(): void;
|
||||
|
||||
/** @param boolean [fDeep=true] */
|
||||
/** @param fDeep [fDeep=true] */
|
||||
pushNodeContext(contextNode: IXMLDOMNode, fDeep?: boolean): void;
|
||||
reset(): void;
|
||||
}
|
||||
@@ -2730,10 +2732,7 @@ declare namespace MSXML2 {
|
||||
}
|
||||
|
||||
/** XML Schema Cache 6.0 */
|
||||
class XMLSchemaCache60 {
|
||||
private 'MSXML2.XMLSchemaCache60_typekey': XMLSchemaCache60;
|
||||
private constructor();
|
||||
|
||||
interface XMLSchemaCache60 {
|
||||
/** add a new schema */
|
||||
add(namespaceURI: string, var_1: any): void;
|
||||
|
||||
@@ -2755,6 +2754,9 @@ declare namespace MSXML2 {
|
||||
remove(namespaceURI: string): void;
|
||||
validate(): void;
|
||||
validateOnLoad: boolean;
|
||||
|
||||
/** Get namespaceURI for schema by index */
|
||||
(index: number): string;
|
||||
}
|
||||
|
||||
/** XSL Stylesheet Cache 6.0 */
|
||||
@@ -2787,12 +2789,6 @@ interface ActiveXObjectNameMap {
|
||||
'Msxml2.SAXXMLReader': MSXML2.SAXXMLReader60;
|
||||
'Msxml2.ServerXMLHTTP': MSXML2.ServerXMLHTTP60;
|
||||
'Msxml2.XMLHTTP': MSXML2.XMLHTTP60;
|
||||
'Msxml2.XMLHTTP.6.0': MSXML2.XMLHTTP60;
|
||||
'Msxml2.XMLSchemaCache': MSXML2.XMLSchemaCache60;
|
||||
'Msxml2.XMLSchemaCache.6.0': MSXML2.XMLSchemaCache60;
|
||||
'Msxml2.XSLTemplate': MSXML2.XSLTemplate60;
|
||||
}
|
||||
|
||||
interface SafeArray<T = any> {
|
||||
_brand: SafeArray<T>;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-const-enum": false
|
||||
"no-const-enum": false,
|
||||
"max-line-length": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
/// <reference types="activex-word" />
|
||||
|
||||
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
|
||||
const results: T[] = [];
|
||||
const enumerator = new Enumerator<T>(col);
|
||||
enumerator.moveFirst();
|
||||
while (!enumerator.atEnd()) {
|
||||
results.push(enumerator.item());
|
||||
enumerator.moveNext();
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
let app = new ActiveXObject('Word.Application');
|
||||
app.Visible = true;
|
||||
let dlg = app.FileDialog(Office.MsoFileDialogType.msoFileDialogFolderPicker);
|
||||
dlg.AllowMultiSelect = true;
|
||||
dlg.Title = 'Select one or more folders';
|
||||
dlg.Execute();
|
||||
let enumerator = new Enumerator(dlg.SelectedItems);
|
||||
enumerator.moveFirst();
|
||||
while (!enumerator.atEnd()) {
|
||||
WScript.Echo(enumerator.item);
|
||||
for (const item of collectionToArray(dlg.SelectedItems)) {
|
||||
WScript.Echo(item);
|
||||
}
|
||||
|
||||
let enumerator2 = new Enumerator(app.COMAddIns);
|
||||
enumerator2.moveFirst();
|
||||
while (!enumerator2.atEnd()) {
|
||||
const item = enumerator2.item();
|
||||
for (const item of collectionToArray(app.COMAddIns)) {
|
||||
WScript.Echo(`COM Addin: ${item.Description} -- ${item.ProgId}`);
|
||||
}
|
||||
|
||||
Vendored
+602
-512
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-const-enum": false
|
||||
"no-const-enum": false,
|
||||
"max-line-length": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/vba/vba-outlook
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-stdole" />
|
||||
/// <reference types="activex-office" />
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/fp161225.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-office" />
|
||||
/// <reference types="activex-vbide" />
|
||||
|
||||
Vendored
+1
-5
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/hh272953.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
declare namespace stdole {
|
||||
type IPictureDisp = StdPicture;
|
||||
@@ -86,7 +86,3 @@ interface ActiveXObjectNameMap {
|
||||
StdFont: stdole.StdFont;
|
||||
StdPicture: stdole.StdPicture;
|
||||
}
|
||||
|
||||
interface SafeArray<T = any> {
|
||||
_brand: SafeArray<T>;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
// tslint:disable-next-line no-unnecessary-generics
|
||||
const collectionToArray = <T>(col: any): T[] => {
|
||||
/// <reference types="activex-word" />
|
||||
|
||||
const collectionToArray = <T>(col: { Item(key: any): T }): T[] => {
|
||||
const results: T[] = [];
|
||||
const enumerator = new Enumerator<T>(col);
|
||||
enumerator.moveFirst();
|
||||
while (!enumerator.atEnd()) {
|
||||
results.push(enumerator.item());
|
||||
enumerator.moveNext();
|
||||
}
|
||||
return results;
|
||||
};
|
||||
|
||||
const app = new ActiveXObject('Word.Application');
|
||||
const projects = collectionToArray<VBIDE.VBProject>(app.VBE.VBProjects);
|
||||
projects.forEach(project => {
|
||||
app.Visible = true;
|
||||
|
||||
for (const project of collectionToArray(app.VBE.VBProjects)) {
|
||||
WScript.Echo(`Name: ${project.Name}`);
|
||||
|
||||
collectionToArray<VBIDE.Reference>(project.References)
|
||||
.forEach(reference => {
|
||||
WScript.Echo(` ${reference.Name} ${reference.Major}.${reference.Minor} -- ${reference.FullPath}`);
|
||||
});
|
||||
});
|
||||
for (const reference of collectionToArray(project.References)) {
|
||||
WScript.Echo(` ${reference.Name} ${reference.Major}.${reference.Minor} -- ${reference.FullPath}`);
|
||||
}
|
||||
}
|
||||
|
||||
app.Quit();
|
||||
|
||||
Vendored
+26
-54
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/vba/language-reference-vba/articles/collections-visual-basic-add-in-model
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-office" />
|
||||
|
||||
@@ -99,14 +99,13 @@ declare namespace VBIDE {
|
||||
readonly VBE: VBE;
|
||||
}
|
||||
|
||||
class Addins {
|
||||
private 'VBIDE.Addins_typekey': Addins;
|
||||
private constructor();
|
||||
interface Addins {
|
||||
readonly Count: number;
|
||||
Item(index: any): AddIn;
|
||||
readonly Parent: any;
|
||||
Update(): void;
|
||||
readonly VBE: VBE;
|
||||
(index: any): AddIn;
|
||||
}
|
||||
|
||||
class Application {
|
||||
@@ -125,13 +124,13 @@ declare namespace VBIDE {
|
||||
readonly CountOfLines: number;
|
||||
CreateEventProc(EventName: string, ObjectName: string): number;
|
||||
|
||||
/** @param number [Count=1] */
|
||||
/** @param Count [Count=1] */
|
||||
DeleteLines(StartLine: number, Count?: number): void;
|
||||
|
||||
/**
|
||||
* @param boolean [WholeWord=false]
|
||||
* @param boolean [MatchCase=false]
|
||||
* @param boolean [PatternSearch=false]
|
||||
* @param WholeWord [WholeWord=false]
|
||||
* @param MatchCase [MatchCase=false]
|
||||
* @param PatternSearch [PatternSearch=false]
|
||||
*/
|
||||
Find(Target: string, StartLine: number, StartColumn: number, EndLine: number, EndColumn: number, WholeWord?: boolean, MatchCase?: boolean, PatternSearch?: boolean): boolean;
|
||||
InsertLines(Line: number, String: string): void;
|
||||
@@ -161,14 +160,13 @@ declare namespace VBIDE {
|
||||
readonly Window: Window;
|
||||
}
|
||||
|
||||
class CodePanes {
|
||||
private 'VBIDE.CodePanes_typekey': CodePanes;
|
||||
private constructor();
|
||||
interface CodePanes {
|
||||
readonly Count: number;
|
||||
Current: CodePane;
|
||||
Item(index: any): CodePane;
|
||||
readonly Parent: VBE;
|
||||
readonly VBE: VBE;
|
||||
(index: any): CodePane;
|
||||
}
|
||||
|
||||
class CommandBarEvents {
|
||||
@@ -185,9 +183,7 @@ declare namespace VBIDE {
|
||||
readonly Parent: Components;
|
||||
}
|
||||
|
||||
class Components {
|
||||
private 'VBIDE.Components_typekey': Components;
|
||||
private constructor();
|
||||
interface Components {
|
||||
Add(ComponentType: vbext_ComponentType): Component;
|
||||
readonly Application: Application;
|
||||
readonly Count: number;
|
||||
@@ -196,6 +192,7 @@ declare namespace VBIDE {
|
||||
readonly Parent: VBProject;
|
||||
Remove(Component: Component): void;
|
||||
readonly VBE: VBE;
|
||||
(index: any): Component;
|
||||
}
|
||||
|
||||
class Events {
|
||||
@@ -205,15 +202,14 @@ declare namespace VBIDE {
|
||||
ReferencesEvents(VBProject: VBProject): ReferencesEvents;
|
||||
}
|
||||
|
||||
class LinkedWindows {
|
||||
private 'VBIDE.LinkedWindows_typekey': LinkedWindows;
|
||||
private constructor();
|
||||
interface LinkedWindows {
|
||||
Add(Window: Window): void;
|
||||
readonly Count: number;
|
||||
Item(index: any): Window;
|
||||
readonly Parent: Window;
|
||||
Remove(Window: Window): void;
|
||||
readonly VBE: VBE;
|
||||
(index: any): Window;
|
||||
}
|
||||
|
||||
class ProjectTemplate {
|
||||
@@ -223,14 +219,13 @@ declare namespace VBIDE {
|
||||
readonly Parent: Application;
|
||||
}
|
||||
|
||||
class Properties {
|
||||
private 'VBIDE.Properties_typekey': Properties;
|
||||
private constructor();
|
||||
interface Properties {
|
||||
readonly Application: Application;
|
||||
readonly Count: number;
|
||||
Item(index: any): Property;
|
||||
readonly Parent: any;
|
||||
readonly VBE: VBE;
|
||||
(index: any): Property;
|
||||
}
|
||||
|
||||
class Property {
|
||||
@@ -263,9 +258,7 @@ declare namespace VBIDE {
|
||||
readonly VBE: VBE;
|
||||
}
|
||||
|
||||
class References {
|
||||
private 'VBIDE.References_typekey': References;
|
||||
private constructor();
|
||||
interface References {
|
||||
AddFromFile(FileName: string): Reference;
|
||||
AddFromGuid(Guid: string, Major: number, Minor: number): Reference;
|
||||
readonly Count: number;
|
||||
@@ -273,6 +266,7 @@ declare namespace VBIDE {
|
||||
readonly Parent: VBProject;
|
||||
Remove(Reference: Reference): void;
|
||||
readonly VBE: VBE;
|
||||
(index: any): Reference;
|
||||
}
|
||||
|
||||
class ReferencesEvents {
|
||||
@@ -298,13 +292,11 @@ declare namespace VBIDE {
|
||||
readonly VBE: VBE;
|
||||
}
|
||||
|
||||
class VBComponents {
|
||||
private 'VBIDE.VBComponents_typekey': VBComponents;
|
||||
private constructor();
|
||||
interface VBComponents {
|
||||
Add(ComponentType: vbext_ComponentType): VBComponent;
|
||||
AddCustom(ProgId: string): VBComponent;
|
||||
|
||||
/** @param number [index=0] */
|
||||
/** @param index [index=0] */
|
||||
AddMTDesigner(index?: number): VBComponent;
|
||||
readonly Count: number;
|
||||
Import(FileName: string): VBComponent;
|
||||
@@ -312,6 +304,7 @@ declare namespace VBIDE {
|
||||
readonly Parent: VBProject;
|
||||
Remove(VBComponent: VBComponent): void;
|
||||
readonly VBE: VBE;
|
||||
(index: any): VBComponent;
|
||||
}
|
||||
|
||||
class VBE {
|
||||
@@ -354,9 +347,7 @@ declare namespace VBIDE {
|
||||
readonly VBE: VBE;
|
||||
}
|
||||
|
||||
class VBProjects {
|
||||
private 'VBIDE.VBProjects_typekey': VBProjects;
|
||||
private constructor();
|
||||
interface VBProjects {
|
||||
Add(Type: vbext_ProjectType): VBProject;
|
||||
readonly Count: number;
|
||||
Item(index: any): VBProject;
|
||||
@@ -364,6 +355,7 @@ declare namespace VBIDE {
|
||||
readonly Parent: VBE;
|
||||
Remove(lpc: VBProject): void;
|
||||
readonly VBE: VBE;
|
||||
(index: any): VBProject;
|
||||
}
|
||||
|
||||
class Window {
|
||||
@@ -386,38 +378,18 @@ declare namespace VBIDE {
|
||||
WindowState: vbext_WindowState;
|
||||
}
|
||||
|
||||
class Windows {
|
||||
private 'VBIDE.Windows_typekey': Windows;
|
||||
private constructor();
|
||||
interface Windows {
|
||||
readonly Count: number;
|
||||
CreateToolWindow(AddInInst: AddIn, ProgId: string, Caption: string, GuidPosition: string, DocObj: any): Window;
|
||||
Item(index: any): Window;
|
||||
readonly Parent: Application;
|
||||
readonly VBE: VBE;
|
||||
(index: any): Window;
|
||||
}
|
||||
}
|
||||
|
||||
interface ActiveXObject {
|
||||
on(
|
||||
obj: VBIDE.CommandBarEvents, event: 'Click', argNames: ['CommandBarControl', 'handled', 'CancelDefault'], handler: (
|
||||
this: VBIDE.CommandBarEvents, parameter: {readonly CommandBarControl: any, readonly handled: boolean, readonly CancelDefault: boolean}) => void): void;
|
||||
on(obj: VBIDE.CommandBarEvents, event: 'Click', argNames: ['CommandBarControl', 'handled', 'CancelDefault'], handler: (this: VBIDE.CommandBarEvents, parameter: {readonly CommandBarControl: any, readonly handled: boolean, readonly CancelDefault: boolean}) => void): void;
|
||||
on(obj: VBIDE.References, event: 'ItemAdded' | 'ItemRemoved', argNames: ['Reference'], handler: (this: VBIDE.References, parameter: {readonly Reference: VBIDE.Reference}) => void): void;
|
||||
on(
|
||||
obj: VBIDE.ReferencesEvents, event: 'ItemAdded' | 'ItemRemoved', argNames: ['Reference'], handler: (
|
||||
this: VBIDE.ReferencesEvents, parameter: {readonly Reference: VBIDE.Reference}) => void): void;
|
||||
}
|
||||
|
||||
interface EnumeratorConstructor {
|
||||
new(col: VBIDE.Addins): Enumerator<VBIDE.AddIn>;
|
||||
new(col: VBIDE.CodePanes): Enumerator<VBIDE.CodePane>;
|
||||
new(col: VBIDE.Components): Enumerator<VBIDE.Component>;
|
||||
new(col: VBIDE.LinkedWindows | VBIDE.Windows): Enumerator<VBIDE.Window>;
|
||||
new(col: VBIDE.Properties): Enumerator<VBIDE.Property>;
|
||||
new(col: VBIDE.References): Enumerator<VBIDE.Reference>;
|
||||
new(col: VBIDE.VBComponents): Enumerator<VBIDE.VBComponent>;
|
||||
new(col: VBIDE.VBProjects): Enumerator<VBIDE.VBProject>;
|
||||
}
|
||||
|
||||
interface SafeArray<T = any> {
|
||||
_brand: SafeArray<T>;
|
||||
on(obj: VBIDE.ReferencesEvents, event: 'ItemAdded' | 'ItemRemoved', argNames: ['Reference'], handler: (this: VBIDE.ReferencesEvents, parameter: {readonly Reference: VBIDE.Reference}) => void): void;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-const-enum": false
|
||||
"no-const-enum": false,
|
||||
"max-line-length": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -2,7 +2,7 @@
|
||||
// Project: https://msdn.microsoft.com/en-us/library/fp179696.aspx
|
||||
// Definitions by: Zev Spitz <https://github.com/zspitz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="activex-office" />
|
||||
/// <reference types="activex-vbide" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
declare namespace adone {
|
||||
namespace application {
|
||||
namespace app {
|
||||
namespace I {
|
||||
type ArgumentType = ((x: string, index: number) => any) | RegExp;
|
||||
|
||||
@@ -12,7 +12,7 @@ declare namespace adone {
|
||||
| "append"
|
||||
| "count"
|
||||
| "set";
|
||||
nargs?: number | "+" | "*" | "?"
|
||||
nargs?: number | "+" | "*" | "?";
|
||||
type?: ArgumentType | ArgumentType[];
|
||||
verify?: (args: any, opts: any) => boolean; // TODO
|
||||
required?: boolean;
|
||||
@@ -49,7 +49,7 @@ declare namespace adone {
|
||||
name?: string;
|
||||
description?: string;
|
||||
subsystems?: SubsystemInfo[];
|
||||
commandsGroups?: Group[]
|
||||
commandsGroups?: Group[];
|
||||
}
|
||||
|
||||
interface SubsystemInfo {
|
||||
@@ -71,24 +71,24 @@ declare namespace adone {
|
||||
|
||||
namespace I {
|
||||
interface LoadSubsystemOptions {
|
||||
name?: string,
|
||||
description?: string,
|
||||
group?: string,
|
||||
transpile?: boolean
|
||||
name?: string;
|
||||
description?: string;
|
||||
group?: string;
|
||||
transpile?: boolean;
|
||||
}
|
||||
|
||||
interface CommonAddSubsystemInfo {
|
||||
name?: string,
|
||||
useFilename?: boolean
|
||||
description?: string,
|
||||
group?: string,
|
||||
configureArgs?: any[]
|
||||
transpile?: boolean,
|
||||
bind?: boolean | string
|
||||
name?: string;
|
||||
useFilename?: boolean;
|
||||
description?: string;
|
||||
group?: string;
|
||||
configureArgs?: any[];
|
||||
transpile?: boolean;
|
||||
bind?: boolean | string;
|
||||
}
|
||||
|
||||
interface AddSubsystemInfo extends CommonAddSubsystemInfo {
|
||||
subsystem: Subsystem | string,
|
||||
subsystem: Subsystem | string;
|
||||
}
|
||||
|
||||
interface SysInfo {
|
||||
@@ -109,7 +109,7 @@ declare namespace adone {
|
||||
}
|
||||
|
||||
interface AddSubsystemsFromOptions extends CommonAddSubsystemInfo {
|
||||
filter?: string[] | ((file: string) => boolean | Promise<boolean>)
|
||||
filter?: string[] | ((file: string) => boolean | Promise<boolean>);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,25 +211,22 @@ declare namespace adone {
|
||||
_rejectionHandled(p: Promise<any>): void;
|
||||
|
||||
_signalExit(sigName: string): void;
|
||||
|
||||
}
|
||||
|
||||
namespace I {
|
||||
interface Command {
|
||||
// ?
|
||||
names: string[];
|
||||
// TODO
|
||||
}
|
||||
|
||||
interface Argument {
|
||||
// ?
|
||||
names: string[];
|
||||
// TODO
|
||||
}
|
||||
|
||||
interface PositionalArgument extends Argument {
|
||||
// ?
|
||||
}
|
||||
type PositionalArgument = Argument; // TODO
|
||||
|
||||
interface OptionalArgument extends Argument {
|
||||
// ?
|
||||
}
|
||||
type OptionalArgument = Argument; // TODO
|
||||
|
||||
interface DefineCommandFromSubsystemOptions {
|
||||
name?: string;
|
||||
Vendored
+2
-2
@@ -320,12 +320,12 @@ declare namespace adone {
|
||||
/**
|
||||
* Checks whether the given object is an adone subsystem
|
||||
*/
|
||||
export function subsystem(obj: any): obj is adone.application.Subsystem;
|
||||
export function subsystem(obj: any): obj is adone.app.Subsystem;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone application
|
||||
*/
|
||||
export function application(obj: any): obj is adone.application.Application;
|
||||
export function application(obj: any): obj is adone.app.Application;
|
||||
|
||||
/**
|
||||
* Checks whether the given object is an adone logger
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference path="./adone.d.ts" />
|
||||
/// <reference path="./glosses/application.d.ts" />
|
||||
/// <reference path="./glosses/app.d.ts" />
|
||||
/// <reference path="./glosses/archives.d.ts" />
|
||||
/// <reference path="./glosses/assertion.d.ts" />
|
||||
/// <reference path="./glosses/collections/index.d.ts" />
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace applicationTests {
|
||||
Subsystem,
|
||||
runCli,
|
||||
Application
|
||||
} = adone.application;
|
||||
} = adone.app;
|
||||
|
||||
namespace DApplicationTests {
|
||||
{
|
||||
@@ -24,6 +24,7 @@
|
||||
"adone.d.ts",
|
||||
"async.d.ts",
|
||||
"benchmark.d.ts",
|
||||
"glosses/app.d.ts",
|
||||
"glosses/archives.d.ts",
|
||||
"glosses/assertion.d.ts",
|
||||
"glosses/collections/array_set.d.ts",
|
||||
@@ -95,7 +96,7 @@
|
||||
"glosses/utils.d.ts",
|
||||
"glosses/vault.d.ts",
|
||||
"index.d.ts",
|
||||
"test/glosses/application.ts",
|
||||
"test/glosses/app.ts",
|
||||
"test/glosses/archives.ts",
|
||||
"test/glosses/assertion.ts",
|
||||
"test/glosses/collections/array_set.ts",
|
||||
|
||||
@@ -21,9 +21,9 @@ type MyEntity = AFrame.Entity<{
|
||||
material: THREE.Material;
|
||||
sound: { pause(): void };
|
||||
}>;
|
||||
const camera = document.querySelector<MyEntity>('a-entity[camera]').components.camera;
|
||||
const material = document.querySelector<MyEntity>('a-entity[material]').components.material;
|
||||
document.querySelector<MyEntity>('a-entity[sound]').components.sound.pause();
|
||||
const camera = (document.querySelector('a-entity[camera]') as MyEntity).components.camera;
|
||||
const material = (document.querySelector('a-entity[material]') as MyEntity).components.material;
|
||||
(document.querySelector('a-entity[sound]') as MyEntity).components.sound.pause();
|
||||
|
||||
entity.getDOMAttribute('geometry').primitive;
|
||||
|
||||
@@ -38,21 +38,82 @@ entity.addEventListener('child-detached', (event) => {
|
||||
});
|
||||
|
||||
// Components
|
||||
const Component = AFRAME.registerComponent('test', {});
|
||||
|
||||
interface TestComponent extends AFrame.Component {
|
||||
multiply: (f: number) => number;
|
||||
|
||||
data: {
|
||||
myProperty: any[],
|
||||
string: string,
|
||||
num: number
|
||||
};
|
||||
|
||||
system: TestSystem;
|
||||
}
|
||||
|
||||
const Component = AFRAME.registerComponent<TestComponent>('test-component', {
|
||||
schema: {
|
||||
myProperty: {
|
||||
default: [],
|
||||
parse() { return [true]; },
|
||||
},
|
||||
string: { type: 'string' },
|
||||
num: 0
|
||||
},
|
||||
init() {
|
||||
this.data.num = 0;
|
||||
},
|
||||
update() {},
|
||||
tick() {},
|
||||
remove() {},
|
||||
pause() {},
|
||||
play() {},
|
||||
|
||||
multiply(this: TestComponent, f: number) {
|
||||
// Reference to system because both were registered with the same name.
|
||||
return f * this.data.num * this.system.data.counter;
|
||||
}
|
||||
});
|
||||
|
||||
// Scene
|
||||
const scene = document.querySelector('a-scene');
|
||||
scene.hasLoaded;
|
||||
|
||||
// System
|
||||
const system = scene.systems['systemName'];
|
||||
|
||||
interface TestSystem extends AFrame.System {
|
||||
data: {
|
||||
counter: number;
|
||||
};
|
||||
}
|
||||
|
||||
const testSystem: AFrame.SystemDefinition<TestSystem> = {
|
||||
schema: {
|
||||
counter: 0
|
||||
},
|
||||
|
||||
init() {
|
||||
this.data.counter = 1;
|
||||
}
|
||||
};
|
||||
|
||||
AFRAME.registerSystem('test-component', testSystem);
|
||||
|
||||
// Register Custom Geometry
|
||||
AFRAME.registerGeometry('a-test-geometry', {
|
||||
|
||||
interface TestGeometry extends AFrame.Geometry {
|
||||
schema: AFrame.MultiPropertySchema<{
|
||||
groupIndex: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
AFRAME.registerGeometry<TestGeometry>('a-test-geometry', {
|
||||
schema: {
|
||||
groupIndex: { default: 0 }
|
||||
},
|
||||
init(data) {
|
||||
this.geometry = new THREE.Geometry();
|
||||
const temp = data.groupIndex;
|
||||
temp;
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+93
-78
@@ -2,6 +2,7 @@
|
||||
// Project: https://aframe.io/
|
||||
// Definitions by: Paul Shannon <https://github.com/devpaul>
|
||||
// Roberto Ritger <https://github.com/bertoritger>
|
||||
// Trygve Wastvedt <https://github.com/twastvedt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -19,7 +20,7 @@ declare var hasNativeWebVRImplementation: boolean;
|
||||
interface Document {
|
||||
createElement(tagName: string): AFrame.Entity;
|
||||
querySelector(selectors: 'a-scene'): AFrame.Scene;
|
||||
querySelector<T extends AFrame.Entity<any>>(selectors: string): T;
|
||||
querySelector(selectors: string): AFrame.Entity<any>;
|
||||
querySelectorAll(selectors: string): NodeListOf<AFrame.Entity<any> | Element>;
|
||||
}
|
||||
|
||||
@@ -36,15 +37,15 @@ declare namespace AFrame {
|
||||
components: { [ key: string ]: ComponentDescriptor };
|
||||
geometries: { [ key: string ]: GeometryDescriptor };
|
||||
primitives: { [ key: string ]: Entity };
|
||||
registerComponent(name: string, component: ComponentDefinition): ComponentConstructor;
|
||||
registerComponent<T extends Component>(name: string, component: ComponentDefinition<T>): ComponentConstructor<T>;
|
||||
registerElement(name: string, element: ANode): void;
|
||||
registerGeometry(name: string, geometry: GeometryDefinition): Geometry;
|
||||
registerGeometry<T extends Geometry>(name: string, geometry: GeometryDefinition<T>): GeometryConstructor<T>;
|
||||
registerPrimitive(name: string, primitive: PrimitiveDefinition): void;
|
||||
registerShader(name: string, shader: any): void;
|
||||
registerSystem(name: string, definition: SystemDefinition): void;
|
||||
registerShader<T extends Shader>(name: string, shader: T): ShaderConstructor<T>;
|
||||
registerSystem<T extends System>(name: string, definition: SystemDefinition<T>): SystemConstructor<T>;
|
||||
schema: SchemaUtils;
|
||||
shaders: { [ key: string ]: ShaderDescriptor };
|
||||
systems: { [key: string]: System };
|
||||
systems: { [key: string]: SystemConstructor };
|
||||
THREE: typeof THREE;
|
||||
TWEEN: typeof TWEEN;
|
||||
utils: Utils;
|
||||
@@ -89,54 +90,39 @@ declare namespace AFrame {
|
||||
tick(): void;
|
||||
}
|
||||
|
||||
interface Component {
|
||||
interface Component<T extends { [key: string]: any } = any, S extends System = System> {
|
||||
attrName?: string;
|
||||
data?: any;
|
||||
data: T;
|
||||
dependencies?: string[];
|
||||
el: Entity;
|
||||
id: string;
|
||||
multiple?: boolean;
|
||||
name: string;
|
||||
schema: Schema;
|
||||
schema: Schema<T>;
|
||||
system: S | undefined;
|
||||
|
||||
init(data?: any): void;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
remove(): void;
|
||||
tick?(time: number, timeDelta: number): void;
|
||||
update(oldData: any): void;
|
||||
updateSchema?(): void;
|
||||
init(this: this, data?: T): void;
|
||||
pause(this: this): void;
|
||||
play(this: this): void;
|
||||
remove(this: this): void;
|
||||
tick?(this: this, time: number, timeDelta: number): void;
|
||||
update(this: this, oldData: T): void;
|
||||
updateSchema?(this: this): void;
|
||||
|
||||
extendSchema(update: Schema): void;
|
||||
flushToDOM(): void;
|
||||
extendSchema(this: this, update: Schema): void;
|
||||
flushToDOM(this: this): void;
|
||||
}
|
||||
|
||||
interface ComponentConstructor {
|
||||
new (el: Entity, name: string, id: string): Component;
|
||||
interface ComponentConstructor<T extends Component> {
|
||||
new (el: Entity, attrValue: string, id: string): T;
|
||||
}
|
||||
|
||||
interface ComponentDefinition {
|
||||
dependencies?: string[];
|
||||
el?: Entity;
|
||||
id?: string;
|
||||
multiple?: boolean;
|
||||
schema?: Schema;
|
||||
type ComponentDefinition<T extends Component = Component> = Partial<T>;
|
||||
|
||||
init?(data?: any): void;
|
||||
pause?(): void;
|
||||
play?(): void;
|
||||
remove?(): void;
|
||||
tick?(time: number, timeDelta: number): void;
|
||||
update?(oldData: any): void;
|
||||
updateSchema?(): void;
|
||||
|
||||
[ key: string ]: any;
|
||||
}
|
||||
|
||||
interface ComponentDescriptor {
|
||||
Component: Component;
|
||||
dependencies: string[] | null;
|
||||
multiple: boolean | null;
|
||||
interface ComponentDescriptor<T extends Component = Component> {
|
||||
Component: ComponentConstructor<T>;
|
||||
dependencies: string[] | undefined;
|
||||
multiple: boolean | undefined;
|
||||
|
||||
// internal APIs2
|
||||
// parse
|
||||
@@ -144,7 +130,6 @@ declare namespace AFrame {
|
||||
// schema
|
||||
// stringify
|
||||
// type
|
||||
[ key: string ]: any;
|
||||
}
|
||||
|
||||
interface Coordinate {
|
||||
@@ -153,8 +138,14 @@ declare namespace AFrame {
|
||||
z: number;
|
||||
}
|
||||
|
||||
interface DefaultComponents {
|
||||
position: Component<Coordinate>;
|
||||
rotation: Component<Coordinate>;
|
||||
scale: Component<Coordinate>;
|
||||
}
|
||||
|
||||
interface Entity<C = ObjectMap<Component>> extends ANode {
|
||||
components: C;
|
||||
components: C & DefaultComponents;
|
||||
isPlaying: boolean;
|
||||
object3D: THREE.Object3D;
|
||||
object3DMap: ObjectMap<THREE.Object3D>;
|
||||
@@ -165,8 +156,8 @@ declare namespace AFrame {
|
||||
/**
|
||||
* @deprecated since 0.4.0
|
||||
*/
|
||||
getComputedAttribute<T = Component>(attr: string): T;
|
||||
getDOMAttribute<T = any>(attr: string): T;
|
||||
getComputedAttribute(attr: string): Component;
|
||||
getDOMAttribute(attr: string): any;
|
||||
getObject3D(type: string): THREE.Object3D;
|
||||
getOrCreateObject3D(type: string, construct: any): THREE.Object3D;
|
||||
is(stateName: string): boolean;
|
||||
@@ -179,7 +170,6 @@ declare namespace AFrame {
|
||||
|
||||
// getAttribute specific usages
|
||||
getAttribute(type: string): any;
|
||||
getAttribute<T = Component>(attr: string): T;
|
||||
getAttribute(type: 'position' | 'rotation' | 'scale'): Coordinate;
|
||||
|
||||
// setAttribute specific usages
|
||||
@@ -192,12 +182,18 @@ declare namespace AFrame {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
type DetailEvent<D> = Event & { detail: D };
|
||||
type DetailEvent<D> = Event & {
|
||||
detail: D;
|
||||
target: EventTarget & Entity;
|
||||
};
|
||||
|
||||
interface EntityEventMap {
|
||||
'child-attached': DetailEvent<{ el: Element | Entity }>;
|
||||
'child-detached': DetailEvent<{ el: Element | Entity }>;
|
||||
'componentchanged': DetailEvent<{ name: string }>;
|
||||
'componentchanged': DetailEvent<{
|
||||
name: string,
|
||||
id: string
|
||||
}>;
|
||||
'componentremoved': DetailEvent<{
|
||||
name: string,
|
||||
id: string,
|
||||
@@ -215,23 +211,28 @@ declare namespace AFrame {
|
||||
interface Geometry {
|
||||
name: string;
|
||||
geometry: THREE.Geometry;
|
||||
schema: Schema;
|
||||
update(data: object): void;
|
||||
[ key: string ]: any;
|
||||
schema: Schema<any>;
|
||||
|
||||
init(this: this, data: { [P in keyof this['schema']]: any }): void;
|
||||
// Would like the above to be:
|
||||
// init?(this: this, data?: { [P in keyof T['schema']]: T['schema'][P]['default'] } ): void;
|
||||
// I think this is prevented by the following issue: https://github.com/Microsoft/TypeScript/issues/21760.
|
||||
}
|
||||
|
||||
interface GeometryDefinition extends ComponentDefinition {
|
||||
geometry?: THREE.Geometry;
|
||||
interface GeometryConstructor<T extends Geometry> {
|
||||
new (): T;
|
||||
}
|
||||
|
||||
interface GeometryDescriptor {
|
||||
Geometry: Geometry;
|
||||
type GeometryDefinition<T extends Geometry = Geometry> = Partial<T>;
|
||||
|
||||
interface GeometryDescriptor<T extends Geometry = Geometry> {
|
||||
Geometry: GeometryConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
interface MultiPropertySchema {
|
||||
[ key: string ]: SinglePropertySchema<any>;
|
||||
}
|
||||
type MultiPropertySchema<T extends { [key: string ]: any }> = {
|
||||
[P in keyof T]: SinglePropertySchema<T[P]> | T[P];
|
||||
};
|
||||
|
||||
interface PrimitiveDefinition {
|
||||
defaultComponents?: any; // TODO cleanup type
|
||||
@@ -240,8 +241,9 @@ declare namespace AFrame {
|
||||
transforms?: any; // TODO cleanup type
|
||||
}
|
||||
|
||||
type PropertyTypes = 'array' | 'boolean' | 'color' | 'int' | 'number' | 'selector' |
|
||||
'selectorAll' | 'src' | 'string' | 'vec2' | 'vec3' | 'vec4';
|
||||
type PropertyTypes = 'array' | 'asset' | 'audio' | 'boolean' | 'color' |
|
||||
'int' | 'map' | 'model' | 'number' | 'selector' | 'selectorAll' |
|
||||
'string' | 'vec2' | 'vec3' | 'vec4';
|
||||
|
||||
type SceneEvents = 'enter-vr' | 'exit-vr' | 'loaded' | 'renderstart';
|
||||
|
||||
@@ -265,7 +267,7 @@ declare namespace AFrame {
|
||||
addEventListener(type: SceneEvents, listener: EventListener, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
type Schema = SinglePropertySchema<any> | MultiPropertySchema;
|
||||
type Schema<T = { [key: string]: any }> = SinglePropertySchema<T> | MultiPropertySchema<T>;
|
||||
|
||||
interface SchemaUtils {
|
||||
isSingleProperty(schema: Schema): boolean;
|
||||
@@ -274,11 +276,25 @@ declare namespace AFrame {
|
||||
|
||||
interface Shader {
|
||||
name: string;
|
||||
schema: Schema;
|
||||
data: { [key: string]: any };
|
||||
schema: Schema<this['data']>;
|
||||
material: THREE.Material;
|
||||
vertexShader: string;
|
||||
fragmentShader: string;
|
||||
|
||||
init(this: this, data?: this['data']): void;
|
||||
tick?(this: this, time: number, timeDelta: number): void;
|
||||
update(this: this, oldData: this['data']): void;
|
||||
}
|
||||
|
||||
interface ShaderDescriptor {
|
||||
Shader: Shader;
|
||||
interface ShaderConstructor<T extends Shader> {
|
||||
new (): T;
|
||||
}
|
||||
|
||||
type ShaderDefinition<T extends Shader = Shader> = Partial<T>;
|
||||
|
||||
interface ShaderDescriptor<T extends Shader = Shader> {
|
||||
Shader: ShaderConstructor<T>;
|
||||
schema: Schema;
|
||||
}
|
||||
|
||||
@@ -287,27 +303,23 @@ declare namespace AFrame {
|
||||
'default'?: T;
|
||||
parse?(value: string): T;
|
||||
stringify?(value: T): string;
|
||||
[ key: string ]: any;
|
||||
}
|
||||
|
||||
interface System {
|
||||
data: any;
|
||||
schema: Schema;
|
||||
init(): void;
|
||||
pause(): void;
|
||||
play(): void;
|
||||
tick?(): void;
|
||||
data: { [key: string]: any };
|
||||
schema: Schema<this['data']>;
|
||||
init(this: this): void;
|
||||
pause(this: this): void;
|
||||
play(this: this): void;
|
||||
tick?(this: this, t: number, dt: number): void;
|
||||
}
|
||||
|
||||
interface SystemDefinition {
|
||||
schema?: Schema;
|
||||
init?(): void;
|
||||
pause?(): void;
|
||||
play?(): void;
|
||||
tick?(): void;
|
||||
[ key: string ]: any;
|
||||
interface SystemConstructor<T extends System = System> {
|
||||
new (scene: Scene): T;
|
||||
}
|
||||
|
||||
type SystemDefinition<T extends System = System> = Partial<T>;
|
||||
|
||||
interface Utils {
|
||||
coordinates: {
|
||||
isCoordinate(value: string): boolean;
|
||||
@@ -326,5 +338,8 @@ declare namespace AFrame {
|
||||
diff(a: object, b: object): object;
|
||||
extend(target: object, ... source: object[]): object;
|
||||
extendDeep(target: object, ... source: object[]): object;
|
||||
|
||||
throttle(tickFunction: () => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
|
||||
throttleTick(tickFunction: (t: number, dt: number) => void, minimumInterval: number, optionalContext?: {}): (t: number, dt: number) => void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,17 @@ import * as algoliasearch from 'algoliasearch';
|
||||
import {
|
||||
ClientOptions,
|
||||
SynonymOption,
|
||||
AlgoliaApiKeyOptions,
|
||||
ApiKeyOptions,
|
||||
SearchSynonymOptions,
|
||||
AlgoliaResponse,
|
||||
AlgoliaSecuredApiOptions,
|
||||
AlgoliaIndexSettings,
|
||||
AlgoliaQueryParameters,
|
||||
AlgoliaIndex,
|
||||
SecuredApiOptions,
|
||||
Index,
|
||||
Response,
|
||||
IndexSettings,
|
||||
QueryParameters,
|
||||
Client
|
||||
} from 'algoliasearch';
|
||||
|
||||
let _algoliaResponse: AlgoliaResponse = {
|
||||
let _algoliaResponse: Response = {
|
||||
hits: [{}, {}],
|
||||
page: 0,
|
||||
nbHits: 12,
|
||||
@@ -33,7 +34,7 @@ let _synonymOption: SynonymOption = {
|
||||
replaceExistingSynonyms: false,
|
||||
};
|
||||
|
||||
let _algoliaApiKeyOptions: AlgoliaApiKeyOptions = {
|
||||
let _algoliaApiKeyOptions: ApiKeyOptions = {
|
||||
validity: 0,
|
||||
maxQueriesPerIPPerHour: 0,
|
||||
indexes: [''],
|
||||
@@ -48,14 +49,14 @@ let _searchSynonymOptions: SearchSynonymOptions = {
|
||||
hitsPerPage: 0,
|
||||
};
|
||||
|
||||
let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
|
||||
let _algoliaSecuredApiOptions: SecuredApiOptions = {
|
||||
filters: '',
|
||||
validUntil: 0,
|
||||
restrictIndices: '',
|
||||
userToken: '',
|
||||
};
|
||||
|
||||
let _algoliaIndexSettings: AlgoliaIndexSettings = {
|
||||
let _algoliaIndexSettings: IndexSettings = {
|
||||
attributesToIndex: [''],
|
||||
attributesForFaceting: [''],
|
||||
unretrievableAttributes: [''],
|
||||
@@ -63,7 +64,7 @@ let _algoliaIndexSettings: AlgoliaIndexSettings = {
|
||||
ranking: [''],
|
||||
customRanking: [''],
|
||||
replicas: [''],
|
||||
maxValuesPerFacet: '',
|
||||
maxValuesPerFacet: 100,
|
||||
attributesToHighlight: [''],
|
||||
attributesToSnippet: [''],
|
||||
highlightPreTag: '',
|
||||
@@ -78,7 +79,7 @@ let _algoliaIndexSettings: AlgoliaIndexSettings = {
|
||||
ignorePlurals: false,
|
||||
disableTypoToleranceOnAttributes: '',
|
||||
separatorsToIndex: '',
|
||||
queryType: '',
|
||||
queryType: 'prefixAll',
|
||||
removeWordsIfNoResults: '',
|
||||
advancedSyntax: false,
|
||||
optionalWords: [''],
|
||||
@@ -86,7 +87,7 @@ let _algoliaIndexSettings: AlgoliaIndexSettings = {
|
||||
disablePrefixOnAttributes: [''],
|
||||
disableExactOnAttributes: [''],
|
||||
exactOnSingleWordQuery: '',
|
||||
alternativesAsExact: false,
|
||||
alternativesAsExact: ['ignorePlurals'],
|
||||
attributeForDistinct: '',
|
||||
distinct: false,
|
||||
numericAttributesToIndex: [''],
|
||||
@@ -96,13 +97,13 @@ let _algoliaIndexSettings: AlgoliaIndexSettings = {
|
||||
placeholders: '',
|
||||
};
|
||||
|
||||
let _algoliaQueryParameters: AlgoliaQueryParameters = {
|
||||
let _algoliaQueryParameters: QueryParameters = {
|
||||
query: '',
|
||||
filters: '',
|
||||
attributesToRetrieve: [''],
|
||||
restrictSearchableAttributes: [''],
|
||||
facets: '',
|
||||
maxValuesPerFacet: '',
|
||||
maxValuesPerFacet: 2,
|
||||
attributesToHighlight: [''],
|
||||
attributesToSnippet: [''],
|
||||
highlightPreTag: '',
|
||||
@@ -147,7 +148,30 @@ let _algoliaQueryParameters: AlgoliaQueryParameters = {
|
||||
minProximity: 0,
|
||||
};
|
||||
|
||||
let index: AlgoliaIndex = algoliasearch('', '').initIndex('');
|
||||
let client: Client = algoliasearch('', '');
|
||||
let index: Index = client.initIndex('');
|
||||
|
||||
let search = index.search({ query: '' });
|
||||
|
||||
index.search({ query: '' }, (err, res) => {});
|
||||
|
||||
// partialUpdateObject
|
||||
index.partialUpdateObject({}, () => {});
|
||||
index.partialUpdateObject({}, false, () => {});
|
||||
index.partialUpdateObject({}).then(() => {});
|
||||
index.partialUpdateObject({}, false).then(() => {});
|
||||
|
||||
// partialUpdateObjects
|
||||
index.partialUpdateObjects([{}], () => {});
|
||||
index.partialUpdateObjects([{}], false, () => {});
|
||||
index.partialUpdateObjects([{}]).then(() => {});
|
||||
index.partialUpdateObjects([{}], false).then(() => {});
|
||||
|
||||
let indexName : string = index.indexName;
|
||||
|
||||
// complete copy
|
||||
client.copyIndex('from', 'to').then(()=>{})
|
||||
client.copyIndex('from', 'to', ()=> {})
|
||||
// with scope
|
||||
client.copyIndex('from', 'to', ['settings']).then(()=>{})
|
||||
client.copyIndex('from', 'to', ['synonyms', 'rules'], ()=> {})
|
||||
|
||||
Vendored
+598
-707
File diff suppressed because it is too large
Load Diff
Vendored
+626
@@ -0,0 +1,626 @@
|
||||
// Type definitions for algoliasearch-client-js 3.27.0
|
||||
// Project: https://github.com/algolia/algoliasearch-client-js
|
||||
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
|
||||
// Haroen Viaene <https://github.com/haroenv>
|
||||
// Aurélien Hervé <https://github.com/aherve>
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare namespace algoliasearch {
|
||||
/*
|
||||
Interface for the algolia client object
|
||||
*/
|
||||
interface Client {
|
||||
/**
|
||||
* Initialization of the index
|
||||
* https://github.com/algolia/algoliasearch-client-js#init-index---initindex
|
||||
*/
|
||||
initIndex(indexName: string): Index;
|
||||
/**
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[],
|
||||
cb: (err: Error, res: MultiResponse) => void
|
||||
): void;
|
||||
/**
|
||||
* Query on multiple index
|
||||
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
|
||||
*/
|
||||
search(
|
||||
queries: {
|
||||
indexName: string;
|
||||
query: string;
|
||||
params: QueryParameters;
|
||||
}[]
|
||||
): Promise<MultiResponse>;
|
||||
/**
|
||||
* Query for facet values of a specific facet
|
||||
*/
|
||||
searchForFacetValues(
|
||||
queries: [{ indexName: string; params: SearchForFacetValues.Parameters }]
|
||||
): Promise<SearchForFacetValues.Response[]>;
|
||||
/**
|
||||
* clear browser cache
|
||||
* https://github.com/algolia/algoliasearch-client-js#cache
|
||||
*/
|
||||
clearCache(): void;
|
||||
/**
|
||||
* Add a header to be sent with all upcoming requests
|
||||
*/
|
||||
setExtraHeader(name: string, value: string): void;
|
||||
/**
|
||||
* Get the value of an extra header
|
||||
*/
|
||||
getExtraHeader(name: string): string;
|
||||
/**
|
||||
* remove an extra header for all upcoming requests
|
||||
*/
|
||||
unsetExtraHeader(name: string): void;
|
||||
}
|
||||
/**
|
||||
* Interface for the index algolia object
|
||||
*/
|
||||
interface Index {
|
||||
indexName: string;
|
||||
/**
|
||||
* Gets a specific object
|
||||
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
|
||||
*/
|
||||
getObject(objectID: string, cb: (err: Error, res: {}) => void): void;
|
||||
/**
|
||||
* Gets specific attributes from an object
|
||||
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
|
||||
*/
|
||||
getObject(
|
||||
objectID: string,
|
||||
attributes: string[],
|
||||
cb: (err: Error, res: {}) => void
|
||||
): void;
|
||||
/**
|
||||
* Gets a list of objects
|
||||
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
|
||||
*/
|
||||
getObjects(
|
||||
objectIDs: string[],
|
||||
cb: (err: Error, res: { results: {}[] }) => void
|
||||
): void;
|
||||
/**
|
||||
* Gets a list of objects
|
||||
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
|
||||
*/
|
||||
getObjects(objectIDs: string[]): Promise<{ results: {}[] }>;
|
||||
/**
|
||||
* Clear cache of an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#cache
|
||||
*/
|
||||
clearCache(): void;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(
|
||||
params: QueryParameters,
|
||||
cb: (err: Error, res: Response) => void
|
||||
): void;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
|
||||
*/
|
||||
search(params: QueryParameters): Promise<Response>;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
|
||||
*/
|
||||
searchForFacetValues(
|
||||
options: SearchForFacetValues.Parameters
|
||||
): Promise<SearchForFacetValues.Response>;
|
||||
/**
|
||||
* Search in an index
|
||||
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
|
||||
*/
|
||||
searchForFacetValues(
|
||||
options: SearchForFacetValues.Parameters,
|
||||
cb: (err: Error, res: SearchForFacetValues.Response) => void
|
||||
): void;
|
||||
/**
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browse(query: string, cb: (err: Error, res: BrowseResponse) => void): void;
|
||||
/**
|
||||
* Browse an index
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browse(query: string): Promise<BrowseResponse>;
|
||||
/**
|
||||
* Browse an index from a cursor
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browseFrom(
|
||||
cursor: string,
|
||||
cb: (err: Error, res: BrowseResponse) => void
|
||||
): void;
|
||||
/**
|
||||
* Browse an index from a cursor
|
||||
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
|
||||
*/
|
||||
browseFrom(cursor: string): Promise<BrowseResponse>;
|
||||
}
|
||||
/**
|
||||
* Interface describing available options when initializing a client
|
||||
*/
|
||||
interface ClientOptions {
|
||||
/**
|
||||
* Timeout for requests to our servers, in milliseconds
|
||||
* default: 15s (node), 2s (browser)
|
||||
* https://github.com/algolia/algoliasearch-client-js#client-options
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Protocol to use when communicating with algolia
|
||||
* default: current protocol(browser), https(node)
|
||||
* https://github.com/algolia/algoliasearch-client-js#client-options
|
||||
*/
|
||||
protocol?: string;
|
||||
/**
|
||||
* (node only) httpAgent instance to use when communicating with servers.
|
||||
* https://github.com/algolia/algoliasearch-client-js#client-options
|
||||
*/
|
||||
httpAgent?: any;
|
||||
/**
|
||||
* read: array of read hosts to use to call servers, computed automatically
|
||||
* write: array of read hosts to use to call servers, computed automatically
|
||||
* https://github.com/algolia/algoliasearch-client-js#client-options
|
||||
*/
|
||||
hosts?: { read?: string[]; write?: string[] };
|
||||
}
|
||||
interface BrowseResponse {
|
||||
cursor?: string;
|
||||
hits: {}[];
|
||||
params: string;
|
||||
query: string;
|
||||
processingTimeMS: number;
|
||||
}
|
||||
|
||||
interface QueryParameters {
|
||||
/**
|
||||
* Query string used to perform the search
|
||||
* default: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#query
|
||||
*/
|
||||
query?: string;
|
||||
/**
|
||||
* Filter the query with numeric, facet or/and tag filters
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#filters
|
||||
*/
|
||||
filters?: string;
|
||||
/**
|
||||
* A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer.
|
||||
* default: *
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestoretrieve
|
||||
*/
|
||||
attributesToRetrieve?: string[];
|
||||
/**
|
||||
* List of attributes you want to use for textual search
|
||||
* default: attributeToIndex
|
||||
* https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes
|
||||
*/
|
||||
restrictSearchableAttributes?: string[];
|
||||
/**
|
||||
* You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#facets
|
||||
*/
|
||||
facets?: string;
|
||||
/**
|
||||
* Limit the number of facet values returned for each facet.
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet
|
||||
*/
|
||||
maxValuesPerFacet?: number;
|
||||
/**
|
||||
* Default list of attributes to highlight. If set to null, all indexed attributes are highlighted.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestohighlight
|
||||
*/
|
||||
attributesToHighlight?: string[];
|
||||
/**
|
||||
* Default list of attributes to snippet alongside the number of words to return
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributestosnippet
|
||||
*/
|
||||
attributesToSnippet?: string[];
|
||||
/**
|
||||
* Specify the string that is inserted before the highlighted parts in the query result
|
||||
* default: <em>
|
||||
* https://github.com/algolia/algoliasearch-client-js#highlightpretag
|
||||
*/
|
||||
highlightPreTag?: string;
|
||||
/**
|
||||
* Specify the string that is inserted after the highlighted parts in the query result
|
||||
* default: </em>
|
||||
* https://github.com/algolia/algoliasearch-client-js#highlightposttag
|
||||
*/
|
||||
highlightPostTag?: string;
|
||||
/**
|
||||
* String used as an ellipsis indicator when a snippet is truncated.
|
||||
* default: …
|
||||
* https://github.com/algolia/algoliasearch-client-js#snippetellipsistext
|
||||
*/
|
||||
snippetEllipsisText?: string;
|
||||
/**
|
||||
* If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays
|
||||
*/
|
||||
restrictHighlightAndSnippetArrays?: boolean;
|
||||
/**
|
||||
* Pagination parameter used to select the number of hits per page
|
||||
* default: 20
|
||||
* https://github.com/algolia/algoliasearch-client-js#hitsperpage
|
||||
*/
|
||||
hitsPerPage?: number;
|
||||
/**
|
||||
* Pagination parameter used to select the page to retrieve.
|
||||
* default: 0
|
||||
* https://github.com/algolia/algoliasearch-client-js#page
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* Offset of the first hit to return
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#offset
|
||||
*/
|
||||
offset?: number;
|
||||
/**
|
||||
* Number of hits to return.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#length
|
||||
*/
|
||||
length?: number;
|
||||
/**
|
||||
* The minimum number of characters needed to accept one typo.
|
||||
* default: 4
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo
|
||||
*/
|
||||
minWordSizefor1Typo?: number;
|
||||
/**
|
||||
* The minimum number of characters needed to accept two typo.
|
||||
* fault: 8
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
|
||||
*/
|
||||
minWordSizefor2Typos?: number;
|
||||
/**
|
||||
* This option allows you to control the number of typos allowed in the result set:
|
||||
* default: true
|
||||
* 'true' The typo tolerance is enabled and all matching hits are retrieved
|
||||
* 'false' The typo tolerance is disabled. All results with typos will be hidden.
|
||||
* 'min' Only keep results with the minimum number of typos
|
||||
* 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos.
|
||||
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
|
||||
*/
|
||||
typoTolerance?: boolean;
|
||||
/**
|
||||
* If set to false, disables typo tolerance on numeric tokens (numbers).
|
||||
* default:
|
||||
* https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens
|
||||
*/
|
||||
allowTyposOnNumericTokens?: boolean;
|
||||
/**
|
||||
* If set to true, plural won't be considered as a typo
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#ignoreplurals
|
||||
*/
|
||||
ignorePlurals?: boolean;
|
||||
/**
|
||||
* List of attributes on which you want to disable typo tolerance
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes
|
||||
*/
|
||||
disableTypoToleranceOnAttributes?: string;
|
||||
/**
|
||||
* Search for entries around a given location
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundlatlng
|
||||
*/
|
||||
aroundLatLng?: string;
|
||||
/**
|
||||
* Search for entries around a given latitude/longitude automatically computed from user IP address.
|
||||
* default: ""
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip
|
||||
*/
|
||||
aroundLatLngViaIP?: string;
|
||||
/**
|
||||
* Control the radius associated with a geo search. Defined in meters.
|
||||
* default: null
|
||||
* You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundradius
|
||||
*/
|
||||
aroundRadius?: number | 'all';
|
||||
/**
|
||||
* Control the precision of a geo search
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#aroundprecision
|
||||
*/
|
||||
aroundPrecision?: number;
|
||||
/**
|
||||
* Define the minimum radius used for a geo search when aroundRadius is not set.
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#minimumaroundradius
|
||||
*/
|
||||
minimumAroundRadius?: number;
|
||||
/**
|
||||
* Search entries inside a given area defined by the two extreme points of a rectangle
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#insideboundingbox
|
||||
*/
|
||||
insideBoundingBox?: number[][];
|
||||
/**
|
||||
* Selects how the query words are interpreted
|
||||
* default: 'prefixLast'
|
||||
* 'prefixAll' All query words are interpreted as prefixes. This option is not recommended.
|
||||
* 'prefixLast' Only the last word is interpreted as a prefix (default behavior).
|
||||
* 'prefixNone' No query word is interpreted as a prefix. This option is not recommended.
|
||||
* https://github.com/algolia/algoliasearch-client-js#querytype
|
||||
*/
|
||||
queryType?: any;
|
||||
/**
|
||||
* Search entries inside a given area defined by a set of points
|
||||
* defauly: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#insidepolygon
|
||||
*/
|
||||
insidePolygon?: number[][];
|
||||
/**
|
||||
* This option is used to select a strategy in order to avoid having an empty result page
|
||||
* default: 'none'
|
||||
* 'lastWords' When a query does not return any results, the last word will be added as optional
|
||||
* 'firstWords' When a query does not return any results, the first word will be added as optional
|
||||
* 'allOptional' When a query does not return any results, a second trial will be made with all words as optional
|
||||
* 'none' No specific processing is done when a query does not return any results
|
||||
* https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults
|
||||
*/
|
||||
removeWordsIfNoResults?: string;
|
||||
/**
|
||||
* Enables the advanced query syntax
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#advancedsyntax
|
||||
*/
|
||||
advancedSyntax?: boolean;
|
||||
/**
|
||||
* A string that contains the comma separated list of words that should be considered as optional when found in the query
|
||||
* default: []
|
||||
* https://github.com/algolia/algoliasearch-client-js#optionalwords
|
||||
*/
|
||||
optionalWords?: string[];
|
||||
/**
|
||||
* Remove stop words from the query before executing it
|
||||
* default: false
|
||||
* true|false: enable or disable stop words for all 41 supported languages; or
|
||||
* a list of language ISO codes (as a comma-separated string) for which stop words should be enable
|
||||
* https://github.com/algolia/algoliasearch-client-js#removestopwords
|
||||
*/
|
||||
removeStopWords?: string[];
|
||||
/**
|
||||
* List of attributes on which you want to disable the computation of exact criteria
|
||||
* default: []
|
||||
* https://github.com/algolia/algoliasearch-client-js#disableexactonattributes
|
||||
*/
|
||||
disableExactOnAttributes?: string[];
|
||||
/**
|
||||
* This parameter control how the exact ranking criterion is computed when the query contains one word
|
||||
* default: attribute
|
||||
* 'none': no exact on single word query
|
||||
* 'word': exact set to 1 if the query word is found in the record
|
||||
* 'attribute': exact set to 1 if there is an attribute containing a string equals to the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery
|
||||
*/
|
||||
exactOnSingleWordQuery?: string;
|
||||
/**
|
||||
* Specify the list of approximation that should be considered as an exact match in the ranking formula
|
||||
* default: ['ignorePlurals', 'singleWordSynonym']
|
||||
* 'ignorePlurals': alternative words added by the ignorePlurals feature
|
||||
* 'singleWordSynonym': single-word synonym (For example "NY" = "NYC")
|
||||
* 'multiWordsSynonym': multiple-words synonym
|
||||
* https://github.com/algolia/algoliasearch-client-js#alternativesasexact
|
||||
*/
|
||||
alternativesAsExact?: any;
|
||||
/**
|
||||
* If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set.
|
||||
* https://github.com/algolia/algoliasearch-client-js#distinct
|
||||
*/
|
||||
distinct?: any;
|
||||
/**
|
||||
* If set to true, the result hits will contain ranking information in the _rankingInfo attribute.
|
||||
* default: false
|
||||
* https://github.com/algolia/algoliasearch-client-js#getrankinginfo
|
||||
*/
|
||||
getRankingInfo?: boolean;
|
||||
/**
|
||||
* All numerical attributes are automatically indexed as numerical filters
|
||||
* default: ''
|
||||
* https://github.com/algolia/algoliasearch-client-js#numericattributestoindex
|
||||
*/
|
||||
numericAttributesToIndex?: string[];
|
||||
/**
|
||||
* @deprecated please use filters instead
|
||||
* A string that contains the comma separated list of numeric filters you want to apply.
|
||||
* https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated
|
||||
*/
|
||||
numericFilters?: string[];
|
||||
/**
|
||||
* @deprecated
|
||||
* Filter the query by a set of tags.
|
||||
* https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated
|
||||
*/
|
||||
tagFilters?: string;
|
||||
/**
|
||||
* @deprecated
|
||||
* Filter the query by a set of facets.
|
||||
* https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated
|
||||
*/
|
||||
facetFilters?: string;
|
||||
/**
|
||||
* If set to false, this query will not be taken into account in the analytics feature.
|
||||
* default true
|
||||
* https://github.com/algolia/algoliasearch-client-js#analytics
|
||||
*/
|
||||
analytics?: boolean;
|
||||
/**
|
||||
* If set, tag your query with the specified identifiers
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#analyticstags
|
||||
*/
|
||||
analyticsTags?: string[];
|
||||
/**
|
||||
* If set to false, the search will not use the synonyms defined for the targeted index.
|
||||
* default: true
|
||||
* https://github.com/algolia/algoliasearch-client-js#synonyms
|
||||
*/
|
||||
synonyms?: boolean;
|
||||
/**
|
||||
* If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result.
|
||||
* default: true
|
||||
* https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight
|
||||
*/
|
||||
replaceSynonymsInHighlight?: boolean;
|
||||
/**
|
||||
* Configure the precision of the proximity ranking criterion
|
||||
* default: 1
|
||||
* https://github.com/algolia/algoliasearch-client-js#minproximity
|
||||
*/
|
||||
minProximity?: number;
|
||||
|
||||
nbShards?: number;
|
||||
userData?: string | object;
|
||||
}
|
||||
|
||||
interface AlgoliaResponse {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
hits: any[];
|
||||
/**
|
||||
* Current page
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
page: number;
|
||||
/**
|
||||
* Number of total hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
nbHits: number;
|
||||
/**
|
||||
* Number of pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
nbPage: number;
|
||||
/**
|
||||
* Number of hits per pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
hitsPerPage: number;
|
||||
/**
|
||||
* Engine processing time (excluding network transfer)
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
processingTimeMS: number;
|
||||
/**
|
||||
* Query used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* GET parameters used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
params: string;
|
||||
facets: {
|
||||
[facetName: string]: { [facetValue: string]: number };
|
||||
};
|
||||
}
|
||||
|
||||
namespace SearchForFacetValues {
|
||||
interface Parameters extends QueryParameters {
|
||||
/**
|
||||
* The facet to search in
|
||||
*/
|
||||
facetName: string;
|
||||
/**
|
||||
* The query for the search in this facet
|
||||
*/
|
||||
facetQuery: string;
|
||||
}
|
||||
|
||||
interface Response {
|
||||
facetHits: { value: string; highlighted: string; count: number }[];
|
||||
exhaustiveFacetsCount: boolean;
|
||||
processingTimeMS: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface Response {
|
||||
/**
|
||||
* Contains all the hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
hits: any[];
|
||||
/**
|
||||
* Current page
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
page: number;
|
||||
/**
|
||||
* Number of total hits matching the query
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
nbHits: number;
|
||||
/**
|
||||
* Number of pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
nbPages: number;
|
||||
/**
|
||||
* Number of hits per pages
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
hitsPerPage: number;
|
||||
/**
|
||||
* Engine processing time (excluding network transfer)
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
processingTimeMS: number;
|
||||
/**
|
||||
* Query used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
query: string;
|
||||
/**
|
||||
* GET parameters used to perform the search
|
||||
* https://github.com/algolia/algoliasearch-client-js#response-format
|
||||
*/
|
||||
params: string;
|
||||
facets?: {
|
||||
[facetName: string]: { [facetValue: string]: number };
|
||||
};
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
results: Response[];
|
||||
}
|
||||
}
|
||||
|
||||
declare function algoliasearch(
|
||||
applicationId: string,
|
||||
apiKey: string,
|
||||
options?: algoliasearch.ClientOptions
|
||||
): algoliasearch.Client;
|
||||
export = algoliasearch;
|
||||
@@ -18,6 +18,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"lite/index.d.ts",
|
||||
"algoliasearch-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+577
@@ -0,0 +1,577 @@
|
||||
// Type definitions for amazon-cognito-auth-js 1.2
|
||||
// Project: https://github.com/aws/amazon-cognito-auth-js
|
||||
// Definitions by: Scott Escue <https://github.com/scottescue>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/*
|
||||
* Create global variable to provide access to types when used without module
|
||||
* loading.
|
||||
*/
|
||||
export as namespace AmazonCognitoIdentity;
|
||||
|
||||
// Stubs the XDomainRequest built-in from older IE browsers, does not follow the project's interface naming convention
|
||||
export interface XDomainRequest {
|
||||
readonly responseText: string;
|
||||
timeout: number;
|
||||
onprogress: () => void;
|
||||
ontimeout: () => void;
|
||||
onerror: () => void;
|
||||
onload: () => void;
|
||||
|
||||
open(method: string, url: string): void;
|
||||
send(data: string): void;
|
||||
abort(): void;
|
||||
}
|
||||
|
||||
export interface CognitoSessionData {
|
||||
/**
|
||||
* The session's Id token.
|
||||
*/
|
||||
IdToken?: CognitoIdToken;
|
||||
|
||||
/**
|
||||
* The session's refresh token.
|
||||
*/
|
||||
RefreshToken?: CognitoRefreshToken;
|
||||
|
||||
/**
|
||||
* The session's access token.
|
||||
*/
|
||||
AccessToken?: CognitoAccessToken;
|
||||
|
||||
/**
|
||||
* The session's token scopes.
|
||||
*/
|
||||
TokenScopes?: CognitoTokenScopes;
|
||||
|
||||
/**
|
||||
* The session's state.
|
||||
*/
|
||||
State?: string;
|
||||
}
|
||||
|
||||
export interface CognitoAuthOptions {
|
||||
/**
|
||||
* Required: User pool application client id.
|
||||
*/
|
||||
ClientId: string;
|
||||
|
||||
/**
|
||||
* Required: The application/user-pools Cognito web hostname,this is set at the Cognito console.
|
||||
*/
|
||||
AppWebDomain: string;
|
||||
|
||||
/**
|
||||
* Optional: The token scopes
|
||||
*/
|
||||
TokenScopesArray?: ReadonlyArray<string>;
|
||||
|
||||
/**
|
||||
* Required: Required: The redirect Uri, which will be launched after authentication as signed in.
|
||||
*/
|
||||
RedirectUriSignIn: string;
|
||||
|
||||
/**
|
||||
* Required: The redirect Uri, which will be launched when signed out.
|
||||
*/
|
||||
RedirectUriSignOut: string;
|
||||
|
||||
/**
|
||||
* Optional: Pre-selected identity provider (this allows to automatically trigger social provider authentication flow).
|
||||
*/
|
||||
IdentityProvider?: string;
|
||||
|
||||
/**
|
||||
* Optional: UserPoolId for the configured cognito userPool.
|
||||
*/
|
||||
UserPoolId?: string;
|
||||
|
||||
/**
|
||||
* Optional: boolean flag indicating if the data collection is enabled to support cognito advanced security features. By default, this flag is set to true.
|
||||
*/
|
||||
AdvancedSecurityDataCollectionFlag?: boolean;
|
||||
}
|
||||
|
||||
export interface CognitoAuthUserHandler {
|
||||
onSuccess: (authSession: CognitoAuthSession) => void;
|
||||
onFailure: (err: any) => void;
|
||||
}
|
||||
|
||||
export interface CognitoConstants {
|
||||
DOMAIN_SCHEME: string;
|
||||
DOMAIN_PATH_SIGNIN: string;
|
||||
DOMAIN_PATH_TOKEN: string;
|
||||
DOMAIN_PATH_SIGNOUT: string;
|
||||
DOMAIN_QUERY_PARAM_REDIRECT_URI: string;
|
||||
DOMAIN_QUERY_PARAM_SIGNOUT_URI: string;
|
||||
DOMAIN_QUERY_PARAM_RESPONSE_TYPE: string;
|
||||
DOMAIN_QUERY_PARAM_IDENTITY_PROVIDER: string;
|
||||
DOMAIN_QUERY_PARAM_USERCONTEXTDATA: string;
|
||||
CLIENT_ID: string;
|
||||
STATE: string;
|
||||
SCOPE: string;
|
||||
TOKEN: string;
|
||||
CODE: string;
|
||||
POST: string;
|
||||
PARAMETERERROR: string;
|
||||
SCOPETYPEERROR: string;
|
||||
QUESTIONMARK: string;
|
||||
POUNDSIGN: string;
|
||||
COLONDOUBLESLASH: string;
|
||||
SLASH: string;
|
||||
AMPERSAND: string;
|
||||
EQUALSIGN: string;
|
||||
SPACE: string;
|
||||
CONTENTTYPE: string;
|
||||
CONTENTTYPEVALUE: string;
|
||||
AUTHORIZATIONCODE: string;
|
||||
IDTOKEN: string;
|
||||
ACCESSTOKEN: string;
|
||||
REFRESHTOKEN: string;
|
||||
ERROR: string;
|
||||
ERROR_DESCRIPTION: string;
|
||||
STRINGTYPE: string;
|
||||
STATELENGTH: number;
|
||||
STATEORIGINSTRING: string;
|
||||
WITHCREDENTIALS: string;
|
||||
UNDEFINED: string;
|
||||
SELF: string;
|
||||
HOSTNAMEREGEX: RegExp;
|
||||
QUERYPARAMETERREGEX1: RegExp;
|
||||
QUERYPARAMETERREGEX2: RegExp;
|
||||
HEADER: { 'Content-Type': string };
|
||||
}
|
||||
|
||||
export class CognitoIdToken {
|
||||
/**
|
||||
* Constructs a new CognitoIdToken object
|
||||
* @param IdToken The JWT Id token
|
||||
*/
|
||||
constructor(IdToken: string);
|
||||
|
||||
/**
|
||||
* @returns the record's token.
|
||||
*/
|
||||
getJwtToken(): string;
|
||||
|
||||
/**
|
||||
* Sets new value for id token.
|
||||
* @param idToken The JWT Id token
|
||||
*/
|
||||
setJwtToken(idToken: string): void;
|
||||
|
||||
/**
|
||||
* @returns the token's expiration (exp member).
|
||||
*/
|
||||
getExpiration(): number;
|
||||
|
||||
/**
|
||||
* @returns the token's payload.
|
||||
*/
|
||||
decodePayload(): object;
|
||||
}
|
||||
|
||||
export class CognitoRefreshToken {
|
||||
/**
|
||||
* Constructs a new CognitoRefreshToken object
|
||||
* @param RefreshToken The JWT refresh token.
|
||||
*/
|
||||
constructor(RefreshToken: string);
|
||||
|
||||
/**
|
||||
* @returns the record's token.
|
||||
*/
|
||||
getToken(): string;
|
||||
|
||||
/**
|
||||
* Sets new value for refresh token.
|
||||
* @param refreshToken The JWT refresh token.
|
||||
*/
|
||||
setToken(refreshToken: string): void;
|
||||
}
|
||||
|
||||
export class CognitoAccessToken {
|
||||
/**
|
||||
* Constructs a new CognitoAccessToken object
|
||||
* @param AccessToken The JWT access token.
|
||||
*/
|
||||
constructor(AccessToken: string);
|
||||
|
||||
/**
|
||||
* @returns the record's token.
|
||||
*/
|
||||
getJwtToken(): string;
|
||||
|
||||
/**
|
||||
* Sets new value for access token.
|
||||
* @param accessToken The JWT access token.
|
||||
*/
|
||||
setJwtToken(accessToken: string): void;
|
||||
|
||||
/**
|
||||
* @returns the token's expiration (exp member).
|
||||
*/
|
||||
getExpiration(): number;
|
||||
|
||||
/**
|
||||
* @returns the username from payload.
|
||||
*/
|
||||
getUsername(): string;
|
||||
|
||||
/**
|
||||
* @returns the token's payload.
|
||||
*/
|
||||
decodePayload(): object;
|
||||
}
|
||||
|
||||
export class CognitoTokenScopes {
|
||||
/**
|
||||
* Constructs a new CognitoTokenScopes object
|
||||
* @param TokenScopesArray The token scopes
|
||||
*/
|
||||
constructor(TokenScopesArray: ReadonlyArray<string>);
|
||||
|
||||
/**
|
||||
* @returns the token scopes.
|
||||
*/
|
||||
getScopes(): string[];
|
||||
|
||||
/**
|
||||
* Sets new value for token scopes.
|
||||
* @param tokenScopes The token scopes
|
||||
*/
|
||||
setTokenScopes(tokenScopes: ReadonlyArray<string>): void;
|
||||
}
|
||||
|
||||
export class CognitoAuthSession {
|
||||
/**
|
||||
* Constructs a new CognitoUserSession object
|
||||
* @param sessionData The session's tokens, scopes, and state.
|
||||
*/
|
||||
constructor(sessionData: CognitoSessionData);
|
||||
|
||||
/**
|
||||
* @returns the session's Id token
|
||||
*/
|
||||
getIdToken(): CognitoIdToken;
|
||||
|
||||
/**
|
||||
* Set a new Id token
|
||||
* @param IdToken The session's Id token.
|
||||
*/
|
||||
setIdToken(IdToken: CognitoIdToken): void;
|
||||
|
||||
/**
|
||||
* @returns the session's refresh token
|
||||
*/
|
||||
getRefreshToken(): CognitoRefreshToken;
|
||||
|
||||
/**
|
||||
* Set a new Refresh token
|
||||
* @param RefreshToken The session's refresh token.
|
||||
*/
|
||||
setRefreshToken(RefreshToken: CognitoRefreshToken): void;
|
||||
|
||||
/**
|
||||
* @returns the session's access token
|
||||
*/
|
||||
getAccessToken(): CognitoAccessToken;
|
||||
|
||||
/**
|
||||
* Set a new Access token
|
||||
* @param AccessToken The session's access token.
|
||||
*/
|
||||
setAccessToken(AccessToken: CognitoAccessToken): void;
|
||||
|
||||
/**
|
||||
* @returns the session's token scopes
|
||||
*/
|
||||
getTokenScopes(): CognitoTokenScopes;
|
||||
|
||||
/**
|
||||
* Set new token scopes
|
||||
* @param tokenScopes The session's token scopes.
|
||||
*/
|
||||
setTokenScopes(tokenScopes: CognitoTokenScopes): void;
|
||||
|
||||
/**
|
||||
* @returns the session's state
|
||||
*/
|
||||
getState(): string;
|
||||
|
||||
/**
|
||||
* Set new state
|
||||
* @param state The session's state.
|
||||
*/
|
||||
setState(State: string): void;
|
||||
|
||||
/**
|
||||
* Checks to see if the session is still valid based on session expiry information found
|
||||
* in Access and Id Tokens and the current time
|
||||
* @returns if the session is still valid
|
||||
*/
|
||||
isValid(): boolean;
|
||||
}
|
||||
|
||||
export class CognitoAuth {
|
||||
/**
|
||||
* Called on success or error.
|
||||
*/
|
||||
userhandler: CognitoAuthUserHandler;
|
||||
|
||||
/**
|
||||
* Constructs a new CognitoAuth object
|
||||
* @param options Creation options
|
||||
*/
|
||||
constructor(options: CognitoAuthOptions);
|
||||
|
||||
/**
|
||||
* @returns the constants
|
||||
*/
|
||||
getCognitoConstants(): CognitoConstants;
|
||||
|
||||
/**
|
||||
* @returns the client id
|
||||
*/
|
||||
getClientId(): string;
|
||||
|
||||
/**
|
||||
* @returns the app web domain
|
||||
*/
|
||||
getAppWebDomain(): string;
|
||||
|
||||
/**
|
||||
* method for getting the current user of the application from the local storage
|
||||
*
|
||||
* @returns the user retrieved from storage
|
||||
*/
|
||||
getCurrentUser(): string;
|
||||
|
||||
/**
|
||||
* method for setting the current user's name
|
||||
* @param Username the user's name
|
||||
*/
|
||||
setUser(Username: string): void;
|
||||
|
||||
/**
|
||||
* sets response type to 'code'
|
||||
*/
|
||||
useCodeGrantFlow(): void;
|
||||
|
||||
/**
|
||||
* sets response type to 'token'
|
||||
*/
|
||||
useImplicitFlow(): void;
|
||||
|
||||
/**
|
||||
* @returns the current session for this user
|
||||
*/
|
||||
getSignInUserSession(): CognitoAuthSession;
|
||||
|
||||
/**
|
||||
* @returns the user's username
|
||||
*/
|
||||
getUsername(): string;
|
||||
|
||||
/**
|
||||
* @param Username the user's username
|
||||
*/
|
||||
setUsername(Username: string): void;
|
||||
|
||||
/**
|
||||
* @returns the user's state
|
||||
*/
|
||||
getState(): string;
|
||||
|
||||
/**
|
||||
* @param State the user's state
|
||||
*/
|
||||
setState(State: string): void;
|
||||
|
||||
/**
|
||||
* This is used to get a session, either from the session object or from the local storage, or by using a refresh token
|
||||
* @param RedirectUriSignIn Required: The redirect Uri, which will be launched after authentication.
|
||||
* @param TokenScopesArray Required: The token scopes, it is an array of strings specifying all scopes for the tokens.
|
||||
*/
|
||||
getSession(): void;
|
||||
|
||||
/**
|
||||
* Parse the http request response and proceed according to different response types.
|
||||
* @param httpRequestResponse the http request response
|
||||
*/
|
||||
parseCognitoWebResponse(httpRequestResponse: string): void;
|
||||
|
||||
/**
|
||||
* Get the query parameter map and proceed according to code response type.
|
||||
* @param Query parameter map
|
||||
*/
|
||||
getCodeQueryParameter(map: ReadonlyMap<string, string>): void;
|
||||
|
||||
/**
|
||||
* Get the query parameter map and proceed according to token response type.
|
||||
* @param Query parameter map
|
||||
*/
|
||||
getTokenQueryParameter(map: ReadonlyMap<string, string>): void;
|
||||
|
||||
/**
|
||||
* Get cached tokens and scopes and return a new session using all the cached data.
|
||||
* @returns the auth session
|
||||
*/
|
||||
getCachedSession(): CognitoAuthSession;
|
||||
|
||||
/**
|
||||
* This is used to get last signed in user from local storage
|
||||
* @returns the last user name
|
||||
*/
|
||||
getLastUser(): string;
|
||||
|
||||
/**
|
||||
* This is used to save the session tokens and scopes to local storage.
|
||||
*/
|
||||
cacheTokensScopes(): void;
|
||||
|
||||
/**
|
||||
* Compare two sets if they are identical.
|
||||
* @param set1 one set
|
||||
* @param set2 the other set
|
||||
* @returns boolean value is true if two sets are identical
|
||||
*/
|
||||
compareSets(set1: ReadonlySet<any>, set2: ReadonlySet<any>): boolean;
|
||||
|
||||
/**
|
||||
* Get the hostname from url.
|
||||
* @param url the url string
|
||||
* @returns hostname string
|
||||
*/
|
||||
getHostName(url: string): string;
|
||||
|
||||
/**
|
||||
* Get http query parameters and return them as a map.
|
||||
* @param url the url string
|
||||
* @param splitMark query parameters split mark (prefix)
|
||||
* @returns map
|
||||
*/
|
||||
getQueryParameters(url: string, splitMark: string): Map<string, string>;
|
||||
|
||||
/**
|
||||
* helper function to generate a random string
|
||||
* @param length the length of string
|
||||
* @param chars a original string
|
||||
* @returns a random value.
|
||||
*/
|
||||
generateRandomString(length: number, chars: string): string;
|
||||
|
||||
/**
|
||||
* This is used to clear the session tokens and scopes from local storage
|
||||
*/
|
||||
clearCachedTokensScopes(): void;
|
||||
|
||||
/**
|
||||
* This is used to build a user session from tokens retrieved in the authentication result
|
||||
* @param refreshToken Successful auth response from server.
|
||||
*/
|
||||
refreshSession(refreshToken: string): void;
|
||||
|
||||
/**
|
||||
* Make the http POST request.
|
||||
* @param header header JSON object
|
||||
* @param body body JSON object
|
||||
* @param url string
|
||||
* @param onSuccess callback
|
||||
* @param onFailure callback
|
||||
*/
|
||||
makePOSTRequest(header: object, body: object, url: string,
|
||||
onSuccess: (responseText: string) => void,
|
||||
onFailure: (responseText: string) => void): void;
|
||||
|
||||
/**
|
||||
* Create the XHR object
|
||||
* @param method which method to call
|
||||
* @param url the url string
|
||||
* @returns xhr
|
||||
*/
|
||||
createCORSRequest(method: string, url: string): XMLHttpRequest | XDomainRequest;
|
||||
|
||||
/**
|
||||
* The http POST request onFailure callback.
|
||||
* @param err the error object
|
||||
*/
|
||||
onFailure(err: any): void;
|
||||
|
||||
/**
|
||||
* The http POST request onSuccess callback when refreshing tokens.
|
||||
* @param jsonData tokens
|
||||
*/
|
||||
onSuccessRefreshToken(jsonData: string): void;
|
||||
|
||||
/**
|
||||
* The http POST request onSuccess callback when exchanging code for tokens.
|
||||
* @param jsonData tokens
|
||||
*/
|
||||
onSuccessExchangeForToken(jsonData: string): void;
|
||||
|
||||
/**
|
||||
* Launch Cognito Auth UI page.
|
||||
* @param URL the url to launch
|
||||
*/
|
||||
launchUri(URL: string): void;
|
||||
|
||||
/**
|
||||
* @returns scopes string
|
||||
*/
|
||||
getSpaceSeperatedScopeString(): string;
|
||||
|
||||
/**
|
||||
* Create the FQDN(fully qualified domain name) for authorization endpoint.
|
||||
* @returns url
|
||||
*/
|
||||
getFQDNSignIn(): string;
|
||||
|
||||
/**
|
||||
* Sign out the user.
|
||||
*/
|
||||
signOut(): void;
|
||||
|
||||
/**
|
||||
* Create the FQDN(fully qualified domain name) for signout endpoint.
|
||||
* @returns url
|
||||
*/
|
||||
getFQDNSignOut(): string;
|
||||
|
||||
/**
|
||||
* This method returns the encoded data string used for cognito advanced security feature.
|
||||
* This would be generated only when developer has included the JS used for collecting the
|
||||
* data on their client. Please refer to documentation to know more about using AdvancedSecurity
|
||||
* features
|
||||
*/
|
||||
getUserContextData(): string;
|
||||
|
||||
/**
|
||||
* Helper method to let the user know if he has either a valid cached session
|
||||
* or a valid authenticated session from the app integration callback.
|
||||
* @returns userSignedIn
|
||||
*/
|
||||
isUserSignedIn(): boolean;
|
||||
}
|
||||
|
||||
export class DateHelper {
|
||||
/**
|
||||
* @returns The current time in "ddd MMM D HH:mm:ss UTC YYYY" format.
|
||||
*/
|
||||
getNowString(): string;
|
||||
}
|
||||
|
||||
export class StorageHelper {
|
||||
/**
|
||||
* This is used to get a storage object
|
||||
* @returns the storage
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* This is used to return the storage
|
||||
* @returns the storage
|
||||
*/
|
||||
getStorage(): Storage;
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
import * as lib from 'amazon-cognito-auth-js';
|
||||
|
||||
const idToken: lib.CognitoIdToken = new lib.CognitoIdToken('fak3T0ken1==');
|
||||
idToken.decodePayload(); // $ExpectType object
|
||||
idToken.setJwtToken('fak3T0ken2=='); // $ExpectType void
|
||||
idToken.getJwtToken(); // $ExpectType string
|
||||
idToken.getExpiration(); // $ExpectType number
|
||||
|
||||
const refreshToken: lib.CognitoRefreshToken = new lib.CognitoRefreshToken('refreshplease==');
|
||||
refreshToken.setToken('refreshagainplease=='); // $ExpectType void
|
||||
refreshToken.getToken(); // $ExpectType string
|
||||
|
||||
const accessToken: lib.CognitoAccessToken = new lib.CognitoAccessToken('fak3T0ken3==');
|
||||
accessToken.decodePayload(); // $ExpectType object
|
||||
accessToken.setJwtToken('fak3T0ken4=='); // $ExpectType void
|
||||
accessToken.getJwtToken(); // $ExpectType string
|
||||
accessToken.getExpiration(); // $ExpectType number
|
||||
accessToken.getUsername(); // $ExpectType string
|
||||
|
||||
const tokenScopes: lib.CognitoTokenScopes = new lib.CognitoTokenScopes(['email', 'custom1']);
|
||||
tokenScopes.setTokenScopes(['openid']); // $ExpectType void
|
||||
tokenScopes.getScopes(); // $ExpectType string[]
|
||||
|
||||
let sessionData: lib.CognitoSessionData = {};
|
||||
let authSession: lib.CognitoAuthSession = new lib.CognitoAuthSession(sessionData);
|
||||
|
||||
sessionData = {
|
||||
IdToken: idToken,
|
||||
RefreshToken: refreshToken,
|
||||
AccessToken: accessToken,
|
||||
TokenScopes: tokenScopes,
|
||||
State: '/myapp/home'
|
||||
};
|
||||
authSession = new lib.CognitoAuthSession(sessionData);
|
||||
|
||||
authSession.setIdToken(new lib.CognitoIdToken('fak3T0ken5==')); // $ExpectType void
|
||||
authSession.setRefreshToken(new lib.CognitoRefreshToken('refreshmeyetagain==')); // $ExpectType void
|
||||
authSession.setAccessToken(new lib.CognitoAccessToken('fak3T0ken6==')); // $ExpectType void
|
||||
authSession.setTokenScopes(new lib.CognitoTokenScopes(['email'])); // $ExpectType void
|
||||
authSession.setState('/myapp/login'); // $ExpectType void
|
||||
authSession.getIdToken(); // $ExpectType CognitoIdToken
|
||||
authSession.getRefreshToken(); // $ExpectType CognitoRefreshToken
|
||||
authSession.getAccessToken(); // $ExpectType CognitoAccessToken
|
||||
authSession.getTokenScopes(); // $ExpectType CognitoTokenScopes
|
||||
authSession.getState(); // $ExpectType string
|
||||
|
||||
let authOptions: lib.CognitoAuthOptions = {
|
||||
ClientId: '1a2b3c4d5e6f7g',
|
||||
AppWebDomain: 'myapp.auth.us-east-1.amazoncognito.com',
|
||||
RedirectUriSignIn: 'https://myapp.com/login',
|
||||
RedirectUriSignOut: 'https://myapp.com/logout'
|
||||
};
|
||||
let auth: lib.CognitoAuth = new lib.CognitoAuth(authOptions);
|
||||
|
||||
authOptions = {
|
||||
ClientId: '1a2b3c4d5e6f7g',
|
||||
AppWebDomain: 'myapp.auth.us-east-1.amazoncognito.com',
|
||||
TokenScopesArray: ['email', 'openid'],
|
||||
RedirectUriSignIn: 'https://myapp.com/login',
|
||||
RedirectUriSignOut: 'https://myapp.com/logout',
|
||||
IdentityProvider: 'Facebook',
|
||||
UserPoolId: 'us-east-1_faKE4ReAl',
|
||||
AdvancedSecurityDataCollectionFlag: true
|
||||
};
|
||||
auth = new lib.CognitoAuth(authOptions);
|
||||
|
||||
auth.getClientId(); // $ExpectType string
|
||||
auth.getAppWebDomain(); // $ExpectType string
|
||||
auth.getCurrentUser(); // $ExpectType string
|
||||
auth.setUser('jane.doe'); // $ExpectType void
|
||||
auth.useCodeGrantFlow(); // $ExpectType void
|
||||
auth.useImplicitFlow(); // $ExpectType void
|
||||
auth.getSignInUserSession(); // $ExpectType CognitoAuthSession
|
||||
auth.getUsername(); // $ExpectType string
|
||||
auth.setUsername('john.doe'); // $ExpectType void
|
||||
auth.getState(); // $ExpectType string
|
||||
auth.setState('/myhost/default.htm'); // $ExpectType void
|
||||
auth.getSession(); // $ExpectType void
|
||||
auth.parseCognitoWebResponse('url&stuff=true'); // $ExpectType void
|
||||
auth.getCodeQueryParameter(new Map()); // $ExpectType void
|
||||
auth.getTokenQueryParameter(new Map()); // $ExpectType void
|
||||
auth.getCachedSession(); // $ExpectType CognitoAuthSession
|
||||
auth.getLastUser(); // $ExpectType string
|
||||
auth.cacheTokensScopes(); // $ExpectType void
|
||||
auth.compareSets(new Set(['1']), new Set(['1'])); // $ExpectType boolean
|
||||
auth.getHostName('https://site.com/page?size=10'); // $ExpectType string
|
||||
auth.getQueryParameters('http://site.com?1=1&2=2', '?'); // $ExpectType Map<string, string>
|
||||
auth.generateRandomString(5, '159erf'); // $ExpectType string
|
||||
auth.clearCachedTokensScopes(); // $ExpectType void
|
||||
auth.refreshSession('refreshToken=='); // $ExpectType void
|
||||
// $ExpectType void
|
||||
auth.makePOSTRequest({ 'Content-Type': 'application/json' }, { pool: '2' },
|
||||
'https://auth.com/signin',
|
||||
(data) => console.log(data),
|
||||
(error) => console.log(error));
|
||||
auth.createCORSRequest('POST', '/myapp/login'); // $ExpectType XMLHttpRequest | XDomainRequest
|
||||
auth.onFailure('request failed'); // $ExpectType void
|
||||
auth.onSuccessRefreshToken('{"name":"John", "age":31}'); // $ExpectType void
|
||||
auth.onSuccessExchangeForToken('{"name":"Jane", "age":30}'); // $ExpectType void
|
||||
auth.launchUri('https://auth.com/login'); // $ExpectType void
|
||||
auth.getSpaceSeperatedScopeString(); // $ExpectType string
|
||||
auth.getFQDNSignIn(); // $ExpectType string
|
||||
auth.signOut(); // $ExpectType void
|
||||
auth.getFQDNSignOut(); // $ExpectType string
|
||||
auth.getUserContextData(); // $ExpectType string
|
||||
auth.isUserSignedIn(); // $ExpectType boolean
|
||||
|
||||
const userHandler: lib.CognitoAuthUserHandler = {
|
||||
onSuccess: (authSession: lib.CognitoAuthSession) => console.log(authSession),
|
||||
onFailure: (error: any) => console.log(error)
|
||||
};
|
||||
auth.userhandler = userHandler;
|
||||
|
||||
const constants: lib.CognitoConstants = auth.getCognitoConstants();
|
||||
constants.DOMAIN_SCHEME; // $ExpectType string
|
||||
constants.DOMAIN_PATH_SIGNIN; // $ExpectType string
|
||||
constants.DOMAIN_PATH_TOKEN; // $ExpectType string
|
||||
constants.DOMAIN_PATH_SIGNOUT; // $ExpectType string
|
||||
constants.DOMAIN_QUERY_PARAM_REDIRECT_URI; // $ExpectType string
|
||||
constants.DOMAIN_QUERY_PARAM_SIGNOUT_URI; // $ExpectType string
|
||||
constants.DOMAIN_QUERY_PARAM_RESPONSE_TYPE; // $ExpectType string
|
||||
constants.DOMAIN_QUERY_PARAM_IDENTITY_PROVIDER; // $ExpectType string
|
||||
constants.DOMAIN_QUERY_PARAM_USERCONTEXTDATA; // $ExpectType string
|
||||
constants.CLIENT_ID; // $ExpectType string
|
||||
constants.STATE; // $ExpectType string
|
||||
constants.SCOPE; // $ExpectType string
|
||||
constants.TOKEN; // $ExpectType string
|
||||
constants.CODE; // $ExpectType string
|
||||
constants.POST; // $ExpectType string
|
||||
constants.PARAMETERERROR; // $ExpectType string
|
||||
constants.SCOPETYPEERROR; // $ExpectType string
|
||||
constants.QUESTIONMARK; // $ExpectType string
|
||||
constants.POUNDSIGN; // $ExpectType string
|
||||
constants.COLONDOUBLESLASH; // $ExpectType string
|
||||
constants.SLASH; // $ExpectType string
|
||||
constants.AMPERSAND; // $ExpectType string
|
||||
constants.EQUALSIGN; // $ExpectType string
|
||||
constants.SPACE; // $ExpectType string
|
||||
constants.CONTENTTYPE; // $ExpectType string
|
||||
constants.CONTENTTYPEVALUE; // $ExpectType string
|
||||
constants.AUTHORIZATIONCODE; // $ExpectType string
|
||||
constants.IDTOKEN; // $ExpectType string
|
||||
constants.ACCESSTOKEN; // $ExpectType string
|
||||
constants.REFRESHTOKEN; // $ExpectType string
|
||||
constants.ERROR; // $ExpectType string
|
||||
constants.ERROR_DESCRIPTION; // $ExpectType string
|
||||
constants.STRINGTYPE; // $ExpectType string
|
||||
constants.STATELENGTH; // $ExpectType number
|
||||
constants.STATEORIGINSTRING; // $ExpectType string
|
||||
constants.WITHCREDENTIALS; // $ExpectType string
|
||||
constants.UNDEFINED; // $ExpectType string
|
||||
constants.SELF; // $ExpectType string
|
||||
constants.HOSTNAMEREGEX; // $ExpectType RegExp
|
||||
constants.QUERYPARAMETERREGEX1; // $ExpectType RegExp
|
||||
constants.QUERYPARAMETERREGEX2; // $ExpectType RegExp
|
||||
constants.HEADER['Content-Type']; // $ExpectType string
|
||||
|
||||
const dateHelper: lib.DateHelper = new lib.DateHelper();
|
||||
dateHelper.getNowString(); // $ExpectType string
|
||||
|
||||
const storageHelper: lib.StorageHelper = new lib.StorageHelper();
|
||||
storageHelper.getStorage(); // $ExpectType Storage
|
||||
@@ -0,0 +1,22 @@
|
||||
AmazonCognitoIdentity.CognitoIdToken; // $ExpectType typeof CognitoIdToken
|
||||
AmazonCognitoIdentity.CognitoRefreshToken; // $ExpectType typeof CognitoRefreshToken
|
||||
AmazonCognitoIdentity.CognitoAccessToken; // $ExpectType typeof CognitoAccessToken
|
||||
AmazonCognitoIdentity.CognitoTokenScopes; // $ExpectType typeof CognitoTokenScopes
|
||||
AmazonCognitoIdentity.CognitoAuthSession; // $ExpectType typeof CognitoAuthSession
|
||||
AmazonCognitoIdentity.CognitoAuth; // $ExpectType typeof CognitoAuth
|
||||
AmazonCognitoIdentity.DateHelper; // $ExpectType typeof DateHelper
|
||||
AmazonCognitoIdentity.StorageHelper; // $ExpectType typeof StorageHelper
|
||||
|
||||
const sessionData: AmazonCognitoIdentity.CognitoSessionData = {};
|
||||
new AmazonCognitoIdentity.CognitoAuthSession(sessionData);
|
||||
|
||||
const authOptions: AmazonCognitoIdentity.CognitoAuthOptions = {
|
||||
ClientId: '1a2b3c4d5e6f7g',
|
||||
AppWebDomain: 'myapp.auth.us-east-1.amazoncognito.com',
|
||||
RedirectUriSignIn: 'https://myapp.com/login',
|
||||
RedirectUriSignOut: 'https://myapp.com/logout'
|
||||
};
|
||||
const auth = new AmazonCognitoIdentity.CognitoAuth(authOptions);
|
||||
auth.userhandler; // $ExpectType CognitoAuthUserHandler
|
||||
auth.getCognitoConstants(); // $ExpectType CognitoConstants
|
||||
auth.createCORSRequest('', ''); // $ExpectType XMLHttpRequest | XDomainRequest
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"dom",
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"test/amazon-cognito-auth-js-tests.ts",
|
||||
"test/amazon-cognito-auth-js-umd-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -4,7 +4,9 @@ var analytics: Analytics;
|
||||
function testConfig(): void {
|
||||
analytics = new Analytics('YOUR_WRITE_KEY', {
|
||||
flushAt: 20,
|
||||
flushAfter: 10000
|
||||
flushAfter: 10000,
|
||||
host: "http://example.com",
|
||||
enable: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -39,7 +39,9 @@ declare namespace AnalyticsNode {
|
||||
export class Analytics {
|
||||
constructor(writeKey: string, opts?: {
|
||||
flushAt?: number,
|
||||
flushAfter?: number
|
||||
flushAfter?: number,
|
||||
host?: string,
|
||||
enable?: boolean
|
||||
});
|
||||
|
||||
/* The identify method lets you tie a user to their actions and record
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/Urigo/angular-meteor
|
||||
// Definitions by: Peter Grman <https://github.com/pgrm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
/// <reference types="meteor" />
|
||||
|
||||
@@ -101,7 +101,7 @@ declare module 'angular' {
|
||||
* @param [autoClientSave=true] - By default, changes in the Angular object will automatically update the Meteor object.
|
||||
* - However if set to false, changes in the client won't be automatically propagated back to the Meteor object.
|
||||
*/
|
||||
object<T>(collection: Mongo.Collection<T>, selector: Mongo.Selector|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject<T>;
|
||||
object<T>(collection: Mongo.Collection<T>, selector: Mongo.Selector<T>|Mongo.ObjectID|string, autoClientSave?: boolean): AngularMeteorObject<T>;
|
||||
|
||||
/**
|
||||
* A service which is a wrapper for Meteor.subscribe. It subscribes to a Meteor.publish method in the client and returns a AngularJS promise when ready.
|
||||
|
||||
Vendored
+2
-4
@@ -1,11 +1,9 @@
|
||||
// Type definitions for Angular Translate (pascalprecht.translate module) 2.15
|
||||
// Project: https://github.com/PascalPrecht/angular-translate
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Gabriel Gil <https://github.com/GabrielGil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
declare var _: string;
|
||||
export = _;
|
||||
|
||||
@@ -69,7 +67,7 @@ declare module 'angular' {
|
||||
versionInfo(): string;
|
||||
loaderCache(): any;
|
||||
isReady(): boolean;
|
||||
onReady(): angular.IPromise<void>;
|
||||
onReady(fn?: () => void): angular.IPromise<void>;
|
||||
resolveClientLocale(): string;
|
||||
getAvailableLanguageKeys(): string[];
|
||||
}
|
||||
|
||||
@@ -1138,7 +1138,8 @@ angular.module('multiSlotTranscludeExample', [])
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('componentExample', [])
|
||||
// $ExpectType IModule
|
||||
const componentModule = angular.module('componentExample', [])
|
||||
.component('counter', {
|
||||
require: {ctrl: '^ctrl'},
|
||||
bindings: {
|
||||
@@ -1160,6 +1161,16 @@ angular.module('componentExample', [])
|
||||
},
|
||||
template: '',
|
||||
transclude: true
|
||||
})
|
||||
.component({
|
||||
aThirdComponent: {
|
||||
controller: class AThirdComponentController {
|
||||
count: number;
|
||||
},
|
||||
bindings: {
|
||||
count: '='
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
interface ICopyExampleUser {
|
||||
|
||||
Vendored
+8
-1
@@ -196,6 +196,12 @@ declare namespace angular {
|
||||
* @param options A definition object passed into the component.
|
||||
*/
|
||||
component(name: string, options: IComponentOptions): IModule;
|
||||
/**
|
||||
* Use this method to register a component.
|
||||
*
|
||||
* @param object Object map of components where the keys are the names and the values are the component definition objects
|
||||
*/
|
||||
component(object: {[componentName: string]: IComponentOptions}): IModule;
|
||||
/**
|
||||
* Use this method to register work which needs to be performed on module loading.
|
||||
*
|
||||
@@ -1028,7 +1034,7 @@ declare namespace angular {
|
||||
all<T1, T2, T3, T4>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>]): IPromise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>]): IPromise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>]): IPromise<[T1, T2]>;
|
||||
all<TAll>(promises: Array<IPromise<TAll>>): IPromise<TAll[]>;
|
||||
all<TAll>(promises: Array<TAll | IPromise<TAll>>): IPromise<TAll[]>;
|
||||
/**
|
||||
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
|
||||
*
|
||||
@@ -1273,6 +1279,7 @@ declare namespace angular {
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
|
||||
|
||||
component(name: string, options: IComponentOptions): ICompileProvider;
|
||||
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
|
||||
|
||||
aHrefSanitizationWhitelist(): RegExp;
|
||||
aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider;
|
||||
|
||||
@@ -1,53 +1,52 @@
|
||||
import { EscapeCode } from './escape-code';
|
||||
import AnsiStyles = require('ansi-styles');
|
||||
|
||||
import ansi = require('ansi-styles');
|
||||
let ansiStyles = AnsiStyles as any,
|
||||
nsNames = ['modifier', 'color', 'bgColor'],
|
||||
namespaces = {
|
||||
modifier: ['reset', 'bold', 'dim', 'italic', 'underline', 'inverse', 'hidden', 'strikethrough'],
|
||||
color: ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'gray',
|
||||
'redBright', 'greenBright', 'yellowBright', 'blueBright', 'magentaBright', 'cyanBright', 'whiteBright'],
|
||||
bgColor: ['bgBlack', 'bgRed', 'bgGreen', 'bgYellow', 'bgBlue', 'bgMagenta', 'bgCyan',
|
||||
'bgBlackBright', 'bgRedBright', 'bgGreenBright', 'bgYellowBright', 'bgBlueBright', 'bgMagentaBright', 'bgCyanBright', 'bgWhiteBright'],
|
||||
} as any,
|
||||
styles = [...namespaces.modifier, ...namespaces.color, ...namespaces.bgColor],
|
||||
codePair = ['open', 'close'],
|
||||
codeTypes = ['ansi', 'ansi256', 'ansi16m'],
|
||||
colorFormats = ['ansi', 'rgb', 'hsl', 'hsv', 'hwb', 'cmyk', 'xyz', 'lab', 'lch', 'hex', 'keyword', 'ansi256', 'hcg', 'apple', 'gray'],
|
||||
codesMap = 'codes';
|
||||
|
||||
|
||||
var styles = [
|
||||
ansi.reset,
|
||||
checkStyle(ansiStyles, styles);
|
||||
nsNames.forEach(ns => checkStyle(ansiStyles[ns], namespaces[ns]));
|
||||
|
||||
ansi.bold,
|
||||
ansi.dim,
|
||||
ansi.italic,
|
||||
ansi.underline,
|
||||
ansi.inverse,
|
||||
ansi.hidden,
|
||||
ansi.strikethrough,
|
||||
checkIsMap(ansiStyles[codesMap], `ansiStyles.${codesMap} not a Map.`);
|
||||
nsNames.forEach(ns => checkExist(ansiStyles[ns], `ansiStyles.${ns} is not exist.`));
|
||||
|
||||
ansi.black,
|
||||
ansi.red,
|
||||
ansi.green,
|
||||
ansi.yellow,
|
||||
ansi.blue,
|
||||
ansi.magenta,
|
||||
ansi.cyan,
|
||||
ansi.white,
|
||||
ansi.gray,
|
||||
['color', 'bgColor'].forEach(ns => checkConverter(ns, ansiStyles[ns], colorFormats));
|
||||
|
||||
ansi.bgBlack,
|
||||
ansi.bgRed,
|
||||
ansi.bgGreen,
|
||||
ansi.bgYellow,
|
||||
ansi.bgBlue,
|
||||
ansi.bgMagenta,
|
||||
ansi.bgCyan,
|
||||
ansi.bgWhite
|
||||
]
|
||||
|
||||
for (var key in styles) {
|
||||
check(key, styles[key])
|
||||
function checkStyle(namespace: any, styles: string[]) {
|
||||
styles.forEach(s => checkCodePair(s, namespace[s]));
|
||||
}
|
||||
function checkCodePair(styleName: string, pair: any): void {
|
||||
codePair.forEach(p => checkIsString(pair[p], `${styleName}.${p} is not a string.`));
|
||||
}
|
||||
|
||||
function check(key:string, escapeCodes:ansi.EscapeCodePair): void {
|
||||
if (uninitialized(escapeCodes.open)) {
|
||||
throw new Error('key not found ~> ' + key + '.open')
|
||||
}
|
||||
if (uninitialized(escapeCodes.close)) {
|
||||
throw new Error('key not found ~> ' + key + '.close')
|
||||
}
|
||||
function checkConverter(nsName: string, namespace: any, formats: string[]) {
|
||||
formats.forEach(f => codeTypes.forEach(t => checkIsFunction(namespace[t][f], `ansiStyles.${nsName}.${t}.${f} is not a function.`)));
|
||||
checkIsString(namespace.close, `${namespace}.close is not a string.`);
|
||||
}
|
||||
|
||||
function uninitialized(val:any): boolean {
|
||||
return val === null || val === undefined
|
||||
function checkExist(val: any, failMsg: string): void {
|
||||
if (val == null) throw new Error(failMsg);
|
||||
}
|
||||
function checkIsString(val: any, failMsg: string): void {
|
||||
if(typeof val != 'string') throw new Error(failMsg);
|
||||
}
|
||||
function checkIsFunction(fn: any, failMsg: string): void {
|
||||
if (typeof fn != 'function') throw new Error(failMsg);
|
||||
}
|
||||
function checkIsMap(map: any, failMsg: string): void {
|
||||
if (!(map instanceof Map)) throw new Error(failMsg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Vendored
+106
@@ -0,0 +1,106 @@
|
||||
import * as cssKeywords from 'color-name';
|
||||
|
||||
|
||||
export namespace EscapeCode {
|
||||
export interface CodePair {
|
||||
open: string;
|
||||
close: string;
|
||||
}
|
||||
|
||||
interface Modifier {
|
||||
reset: CodePair;
|
||||
bold: CodePair;
|
||||
dim: CodePair;
|
||||
/**
|
||||
* Not widely supported
|
||||
*/
|
||||
italic: CodePair;
|
||||
underline: CodePair;
|
||||
inverse: CodePair;
|
||||
hidden: CodePair;
|
||||
/**
|
||||
* Not widely supported
|
||||
*/
|
||||
strikethrough: CodePair;
|
||||
}
|
||||
interface Color {
|
||||
black: CodePair;
|
||||
red: CodePair;
|
||||
green: CodePair;
|
||||
yellow: CodePair;
|
||||
blue: CodePair;
|
||||
magenta: CodePair;
|
||||
cyan: CodePair;
|
||||
white: CodePair;
|
||||
/**
|
||||
* bright black
|
||||
*/
|
||||
gray: CodePair;
|
||||
grey: CodePair;
|
||||
|
||||
redBright: CodePair;
|
||||
greenBright: CodePair;
|
||||
yellowBright: CodePair;
|
||||
blueBright: CodePair;
|
||||
magentaBright: CodePair;
|
||||
cyanBright: CodePair;
|
||||
whiteBright: CodePair;
|
||||
}
|
||||
interface BackgroundColor {
|
||||
bgBlack: CodePair;
|
||||
bgRed: CodePair;
|
||||
bgGreen: CodePair;
|
||||
bgYellow: CodePair;
|
||||
bgBlue: CodePair;
|
||||
bgMagenta: CodePair;
|
||||
bgCyan: CodePair;
|
||||
bgWhite: CodePair;
|
||||
|
||||
bgBlackBright: CodePair;
|
||||
bgRedBright: CodePair;
|
||||
bgGreenBright: CodePair;
|
||||
bgYellowBright: CodePair;
|
||||
bgBlueBright: CodePair;
|
||||
bgMagentaBright: CodePair;
|
||||
bgCyanBright: CodePair;
|
||||
bgWhiteBright: CodePair;
|
||||
}
|
||||
|
||||
interface Conversions {
|
||||
ansi: (ansi: number) => string
|
||||
rgb: (r: number, g: number, b: number) => string
|
||||
hsl: (h: number, s: number, l: number) => string
|
||||
hsv: (h: number, s: number, v: number) => string
|
||||
hwb: (h: number, w: number, b: number) => string
|
||||
cmyk: (c: number, m: number, y: number, k: number) => string
|
||||
xyz: (x: number, y: number, z: number) => string
|
||||
lab: (l: number, a: number, b: number) => string
|
||||
lch: (l: number, c: number, h: number) => string
|
||||
hex: (hex: string) => string
|
||||
/**
|
||||
* color keyword in css to ansi code
|
||||
*/
|
||||
keyword: (keyword: keyof typeof cssKeywords) => string
|
||||
ansi256: (ansi256: number) => string
|
||||
hcg: (h: number, c: number, g: number) => string
|
||||
/**
|
||||
* apple RGB to ansi code
|
||||
*/
|
||||
apple: (r: number, g: number, b: number) => string
|
||||
gray: (grayscale: number) => string
|
||||
}
|
||||
interface ColorType {
|
||||
/**
|
||||
* 16 color ansi code
|
||||
*/
|
||||
ansi: Conversions
|
||||
/**
|
||||
* 256 color ansi code
|
||||
*/
|
||||
ansi256: Conversions
|
||||
/**
|
||||
* truecolor(16 million color) ansi code
|
||||
*/
|
||||
ansi16m: Conversions
|
||||
}
|
||||
}
|
||||
Vendored
+64
-30
@@ -1,40 +1,74 @@
|
||||
// Type definitions for ansi-styles 2.0.1
|
||||
// Type definitions for ansi-styles 3.2.1
|
||||
// Project: https://github.com/sindresorhus/ansi-styles
|
||||
// Definitions by: bryn austin bellomy <https://github.com/brynbellomy>
|
||||
// plylrnsdy <https://github.com/plylrnsdy>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
import { EscapeCode } from './escape-code';
|
||||
|
||||
export interface EscapeCodePair {
|
||||
open: string;
|
||||
close: string;
|
||||
}
|
||||
|
||||
export declare var reset: EscapeCodePair;
|
||||
export const reset: EscapeCode.CodePair;
|
||||
export const bold: EscapeCode.CodePair;
|
||||
export const dim: EscapeCode.CodePair;
|
||||
/**
|
||||
* Not widely supported
|
||||
*/
|
||||
export const italic: EscapeCode.CodePair;
|
||||
export const underline: EscapeCode.CodePair;
|
||||
export const inverse: EscapeCode.CodePair;
|
||||
export const hidden: EscapeCode.CodePair;
|
||||
/**
|
||||
* Not widely supported
|
||||
*/
|
||||
export const strikethrough: EscapeCode.CodePair;
|
||||
|
||||
export declare var bold: EscapeCodePair;
|
||||
export declare var dim: EscapeCodePair;
|
||||
export declare var italic: EscapeCodePair;
|
||||
export declare var underline: EscapeCodePair;
|
||||
export declare var inverse: EscapeCodePair;
|
||||
export declare var hidden: EscapeCodePair;
|
||||
export declare var strikethrough: EscapeCodePair;
|
||||
export const black: EscapeCode.CodePair;
|
||||
export const red: EscapeCode.CodePair;
|
||||
export const green: EscapeCode.CodePair;
|
||||
export const yellow: EscapeCode.CodePair;
|
||||
export const blue: EscapeCode.CodePair;
|
||||
export const magenta: EscapeCode.CodePair;
|
||||
export const cyan: EscapeCode.CodePair;
|
||||
export const white: EscapeCode.CodePair;
|
||||
/**
|
||||
* bright black
|
||||
*/
|
||||
export const gray: EscapeCode.CodePair;
|
||||
export const grey: EscapeCode.CodePair;
|
||||
|
||||
export declare var black: EscapeCodePair;
|
||||
export declare var red: EscapeCodePair;
|
||||
export declare var green: EscapeCodePair;
|
||||
export declare var yellow: EscapeCodePair;
|
||||
export declare var blue: EscapeCodePair;
|
||||
export declare var magenta: EscapeCodePair;
|
||||
export declare var cyan: EscapeCodePair;
|
||||
export declare var white: EscapeCodePair;
|
||||
export declare var gray: EscapeCodePair;
|
||||
export const redBright: EscapeCode.CodePair;
|
||||
export const greenBright: EscapeCode.CodePair;
|
||||
export const yellowBright: EscapeCode.CodePair;
|
||||
export const blueBright: EscapeCode.CodePair;
|
||||
export const magentaBright: EscapeCode.CodePair;
|
||||
export const cyanBright: EscapeCode.CodePair;
|
||||
export const whiteBright: EscapeCode.CodePair;
|
||||
|
||||
export declare var bgBlack: EscapeCodePair;
|
||||
export declare var bgRed: EscapeCodePair;
|
||||
export declare var bgGreen: EscapeCodePair;
|
||||
export declare var bgYellow: EscapeCodePair;
|
||||
export declare var bgBlue: EscapeCodePair;
|
||||
export declare var bgMagenta: EscapeCodePair;
|
||||
export declare var bgCyan: EscapeCodePair;
|
||||
export declare var bgWhite: EscapeCodePair;
|
||||
export const bgBlack: EscapeCode.CodePair;
|
||||
export const bgRed: EscapeCode.CodePair;
|
||||
export const bgGreen: EscapeCode.CodePair;
|
||||
export const bgYellow: EscapeCode.CodePair;
|
||||
export const bgBlue: EscapeCode.CodePair;
|
||||
export const bgMagenta: EscapeCode.CodePair;
|
||||
export const bgCyan: EscapeCode.CodePair;
|
||||
export const bgWhite: EscapeCode.CodePair;
|
||||
|
||||
export const bgBlackBright: EscapeCode.CodePair;
|
||||
export const bgRedBright: EscapeCode.CodePair;
|
||||
export const bgGreenBright: EscapeCode.CodePair;
|
||||
export const bgYellowBright: EscapeCode.CodePair;
|
||||
export const bgBlueBright: EscapeCode.CodePair;
|
||||
export const bgMagentaBright: EscapeCode.CodePair;
|
||||
export const bgCyanBright: EscapeCode.CodePair;
|
||||
export const bgWhiteBright: EscapeCode.CodePair;
|
||||
|
||||
/**
|
||||
* Raw escape codes (i.e. without the CSI escape prefix \u001B[ and render mode postfix m) are available.
|
||||
*
|
||||
* This is a Map with the open codes as keys and close codes as values.
|
||||
*/
|
||||
export const codes: Map<number, number>
|
||||
export const modifier: EscapeCode.Modifier
|
||||
export const color: EscapeCode.Color & EscapeCode.ColorType & { close: string }
|
||||
export const bgColor: EscapeCode.BackgroundColor & EscapeCode.ColorType & { close: string }
|
||||
|
||||
Vendored
+1
-7
@@ -12,13 +12,7 @@ type FontFamily =
|
||||
| BaseCSSProperties['fontFamily']
|
||||
| CSS.FontFace;
|
||||
|
||||
// Replace with Exclude once on 2.8+
|
||||
type Diff<T extends string, U extends string> = (
|
||||
& { [P in T]: P }
|
||||
& { [P in U]: never }
|
||||
& { [x: string]: never }
|
||||
)[T];
|
||||
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
|
||||
type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;
|
||||
|
||||
type CSSProperties = Omit<BaseCSSProperties, 'fontFamily'> & {
|
||||
fontFamily?: FontFamily | FontFamily[];
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { middleware, newInstance, options } from 'apicache';
|
||||
|
||||
let cache = middleware;
|
||||
|
||||
options({
|
||||
statusCodes: {
|
||||
exclude: [404, 429, 500],
|
||||
include: [200, 304]
|
||||
}
|
||||
});
|
||||
|
||||
cache = newInstance({
|
||||
statusCodes: {
|
||||
exclude: [404, 429, 500],
|
||||
include: [200, 304]
|
||||
}
|
||||
});
|
||||
Vendored
+77
@@ -0,0 +1,77 @@
|
||||
// Type definitions for apicache 1.2
|
||||
// Project: https://github.com/kwhitley/apicache
|
||||
// Definitions by: Daniel Sogl <https://github.com/danielsogl>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { RedisClient } from 'redis';
|
||||
|
||||
export const id: number;
|
||||
|
||||
/**
|
||||
* clears cache target (key or group), or entire cache if no value passed, returns new index.
|
||||
*/
|
||||
export function clear(target: string | any[]): any;
|
||||
|
||||
/** used to create a new ApiCache instance with the same options as the current one */
|
||||
export function clone(): any;
|
||||
|
||||
export function getDuration(duration: string): any;
|
||||
|
||||
/**
|
||||
* returns current cache index [of keys]
|
||||
*/
|
||||
export function getIndex(): any;
|
||||
|
||||
/**
|
||||
* the actual middleware that will be used in your routes. duration is in the following format
|
||||
* "[length] [unit]", as in "10 minutes" or "1 day". A second param is a middleware toggle function,
|
||||
* accepting request and response params, and must return truthy to enable cache for the request.
|
||||
* Third param is the options that will override global ones and affect this middleware only.
|
||||
*/
|
||||
export function middleware(
|
||||
duration?: string,
|
||||
toggleMiddleware?: any,
|
||||
localOptions?: Options
|
||||
): any;
|
||||
|
||||
/**
|
||||
* used to create a new ApiCache instance (by default, simply requiring this library shares a common instance)
|
||||
*/
|
||||
export function newInstance(config: Options): any;
|
||||
|
||||
/**
|
||||
* getter/setter for global options. If used as a setter, this function is
|
||||
* chainable, allowing you to do things such as... say... return the middleware.
|
||||
*/
|
||||
export function options(options: Options): any;
|
||||
|
||||
export function resetIndex(): void;
|
||||
|
||||
export interface Options {
|
||||
/** if true, enables console output */
|
||||
debug?: boolean;
|
||||
/** should be either a number (in ms) or a string, defaults to 1 hour */
|
||||
defaultDuration?: string;
|
||||
/** if false, turns off caching globally (useful on dev) */
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* if provided, uses the [node-redis](https://github.com/NodeRedis/node_redis) client instead of [memory-cache](https://github.com/ptarjan/node-cache)
|
||||
*/
|
||||
redisClient?: RedisClient;
|
||||
/** appendKey takes the req/res objects and returns a custom value to extend the cache key */
|
||||
appendKey?: any;
|
||||
/** list of headers that should never be cached */
|
||||
headerBlacklist?: string[];
|
||||
statusCodes?: {
|
||||
/** list status codes to specifically exclude (e.g. [404, 403] cache all responses unless they had a 404 or 403 status) */
|
||||
exclude?: number[];
|
||||
/** list status codes to require (e.g. [200] caches ONLY responses with a success/200 code) */
|
||||
include?: number[];
|
||||
};
|
||||
/**
|
||||
* 'cache-control': 'no-cache' // example of header overwrite
|
||||
*/
|
||||
headers?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "apicache-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,98 @@
|
||||
import { aql, db, query } from "@arangodb";
|
||||
import { md5 } from "@arangodb/crypto";
|
||||
import { createRouter } from "@arangodb/foxx";
|
||||
import sessionsMiddleware = require("@arangodb/foxx/sessions");
|
||||
import jwtStorage = require("@arangodb/foxx/sessions/storages/jwt");
|
||||
import cookieTransport = require("@arangodb/foxx/sessions/transports/cookie");
|
||||
|
||||
console.warnStack(new Error(), "something went wrong");
|
||||
|
||||
interface User {
|
||||
username: string;
|
||||
password?: string;
|
||||
}
|
||||
const coll = module.context.collection("users")!;
|
||||
coll.save({ username: "user" });
|
||||
const doc = coll.any();
|
||||
console.log(doc.username);
|
||||
|
||||
const users = coll as ArangoDB.Collection<User>;
|
||||
const admin = users.firstExample({ username: "admin" })!;
|
||||
users.update(admin, { password: md5("hunter2") });
|
||||
console.logLines("user", admin._key, admin.username);
|
||||
|
||||
db._query(aql`
|
||||
FOR u IN ${users}
|
||||
RETURN u
|
||||
`);
|
||||
|
||||
interface Banana {
|
||||
color: string;
|
||||
shape: {
|
||||
type: string;
|
||||
coords: string[];
|
||||
};
|
||||
}
|
||||
|
||||
const bananas = db._createDocumentCollection("bananas", {
|
||||
waitForSync: false,
|
||||
keyOptions: {
|
||||
type: "autoincrement",
|
||||
increment: 11,
|
||||
offset: 23
|
||||
}
|
||||
}) as ArangoDB.Collection<Banana>;
|
||||
bananas.ensureIndex({
|
||||
type: "hash",
|
||||
unique: true,
|
||||
fields: ["color", "shape.type"]
|
||||
});
|
||||
bananas.updateByExample(
|
||||
bananas.any(),
|
||||
{ shape: { type: "round" } },
|
||||
{ mergeObjects: true }
|
||||
);
|
||||
bananas.ensureIndex({
|
||||
type: "geo",
|
||||
fields: ["latLng"]
|
||||
});
|
||||
|
||||
const router = createRouter();
|
||||
module.context.use(router);
|
||||
|
||||
router.get("/", (req, res) => {
|
||||
if (req.cookie("sid", { secret: "keyboardcat" })) {
|
||||
res.set("content-type", "text/plain");
|
||||
res.write("Welcome back, Commander");
|
||||
} else {
|
||||
res.json({ success: false });
|
||||
}
|
||||
});
|
||||
|
||||
router.use((req, res, next) => {
|
||||
if (req.is("json")) res.throw("too many requests");
|
||||
next();
|
||||
});
|
||||
|
||||
router.use(
|
||||
sessionsMiddleware({
|
||||
storage: jwtStorage({ algorithm: "none" }),
|
||||
transport: "header"
|
||||
})
|
||||
);
|
||||
router.use(
|
||||
sessionsMiddleware({
|
||||
storage: jwtStorage({ algorithm: "HS512", secret: "tacocat" }),
|
||||
transport: cookieTransport({ secret: "banana", algorithm: "sha256" })
|
||||
})
|
||||
);
|
||||
|
||||
console.log(
|
||||
query`
|
||||
FOR u IN users
|
||||
${aql.literal(
|
||||
Math.random() < 0.5 ? "FILTER u.admin" : "FILTER !u.admin"
|
||||
)}
|
||||
RETURN u
|
||||
`.toArray()
|
||||
);
|
||||
Vendored
+1896
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "arangodb-tests.ts"]
|
||||
}
|
||||
Vendored
+5776
-926
File diff suppressed because it is too large
Load Diff
Vendored
+312
-14
@@ -1,6 +1,7 @@
|
||||
// Type definitions for ArcGIS API for JavaScript 3.23
|
||||
// Type definitions for ArcGIS API for JavaScript 3.24
|
||||
// Project: https://developers.arcgis.com/javascript/3/
|
||||
// Definitions by: Esri <https://github.com/Esri>
|
||||
// Bjorn Svensson <https://github.com/bsvensson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "esri" {
|
||||
@@ -30,6 +31,7 @@ declare module "esri" {
|
||||
import LayerSource = require("esri/layers/LayerSource");
|
||||
import GraphicsLayer = require("esri/layers/GraphicsLayer");
|
||||
import SpatialReference = require("esri/SpatialReference");
|
||||
import GeographicTransformationStep = require("esri/geometry/GeographicTransformationStep");
|
||||
import Layer = require("esri/layers/layer");
|
||||
import SimpleFillSymbol = require("esri/symbols/SimpleFillSymbol");
|
||||
import ArcGISImageServiceLayer = require("esri/layers/ArcGISImageServiceLayer");
|
||||
@@ -42,6 +44,9 @@ declare module "esri" {
|
||||
import FillSymbol = require("esri/symbols/FillSymbol");
|
||||
import PrintTemplate = require("esri/tasks/PrintTemplate");
|
||||
import QueryTask = require("esri/tasks/QueryTask");
|
||||
import DataProviderGE = require("esri/dijit/geoenrichment/ReportPlayer/DataProviderGE");
|
||||
import PlayerResizeModes = require("esri/dijit/geoenrichment/ReportPlayer/PlayerResizeModes");
|
||||
import PlayerThemes = require("esri/dijit/geoenrichment/ReportPlayer/PlayerThemes");
|
||||
import TextSymbol = require("esri/symbols/TextSymbol");
|
||||
import StandardGeographyQueryTask = require("esri/tasks/geoenrichment/StandardGeographyQueryTask");
|
||||
import WCSConnection = require("esri/layers/WCSConnection");
|
||||
@@ -943,6 +948,8 @@ declare module "esri" {
|
||||
useMapTime?: boolean;
|
||||
/** Initial visibility of the layer. */
|
||||
visible?: boolean;
|
||||
/** Indicates if the layer will enable WebGL for rendering. */
|
||||
webglEnabled?: boolean;
|
||||
}
|
||||
export interface FeatureLayerStatisticsOptions {
|
||||
/** The feature layer that will be the source for calculating statistics. */
|
||||
@@ -1152,6 +1159,16 @@ declare module "esri" {
|
||||
/** Scale to zoom to when geocoder does not return an extent. */
|
||||
zoomScale?: number;
|
||||
}
|
||||
export interface GeographicTransformationOptions {
|
||||
/** Geographic transformation steps. */
|
||||
steps?: GeographicTransformationStep[];
|
||||
}
|
||||
export interface GeographicTransformationStepOptions {
|
||||
/** The well-known id (wkid) that represents a known geographic transformation. */
|
||||
wkid?: number;
|
||||
/** The well-known text (wkt) that represents a known geographic transformation. */
|
||||
wkt?: string;
|
||||
}
|
||||
export interface GeometryLocationProviderOptions {
|
||||
/** The attribute field in the graphic object that contains the JSON string representing the geometry. */
|
||||
geometryField: string;
|
||||
@@ -1475,6 +1492,8 @@ declare module "esri" {
|
||||
sliderStyle?: string;
|
||||
/** When true, for Apple computers with a trackpad or magic mouse use, swipe pans instead of zooming. */
|
||||
smartNavigation?: boolean;
|
||||
/** Indicates whether to enable WebGL rendering for FeatureLayers in the map. */
|
||||
webglEnabled?: boolean;
|
||||
/** When true, supports continuous pan across the dateline. */
|
||||
wrapAround180?: boolean;
|
||||
/** Initial zoom level of the map. */
|
||||
@@ -1876,6 +1895,16 @@ declare module "esri" {
|
||||
/** Stores positions represented as numbers that fall between minimum and maximum. */
|
||||
values: number[];
|
||||
}
|
||||
export interface ReportPlayerOptions {
|
||||
/** Specifies which export options are available for the report. */
|
||||
dataProvider?: DataProviderGE;
|
||||
/** Indicate whether to display the report in slide view or full screen, defaults to false which is full view. */
|
||||
isSlidesView?: boolean;
|
||||
/** Specifies the resize mode of the ReportPlayer. */
|
||||
resizeMode?: PlayerResizeModes;
|
||||
/** Specifies the theme of the ReportPlayer. */
|
||||
theme?: PlayerThemes;
|
||||
}
|
||||
export interface RingBufferOptions {
|
||||
/** The radii to use to create ring buffers */
|
||||
radii: number[];
|
||||
@@ -2553,6 +2582,8 @@ declare module "esri/IdentityManagerBase" {
|
||||
class IdentityManagerBase {
|
||||
/** The suggested lifetime of the token in minutes. */
|
||||
tokenValidity: number;
|
||||
/** If your application is on the same domain as *.arcgis.com or ArcGIS Enterprise Server, the IdentityManager will redirect the user to its sign-in page. */
|
||||
useSignInPage: boolean;
|
||||
/**
|
||||
* Returns the credential (via Deferred) if the user has already signed in to access the given resource.
|
||||
* @param resUrl The resource URL.
|
||||
@@ -2625,7 +2656,7 @@ declare module "esri/IdentityManagerBase" {
|
||||
*/
|
||||
setProtocolErrorHandler(handlerFunction: Function): void;
|
||||
/**
|
||||
* When accessing secure resources from ArcGIS.com or one of its sub-domains the IdentityManager redirects the user to the ArcGIS.com sign-in page.
|
||||
* If your application is on the same domain as *.arcgis.com or ArcGIS Enterprise Server, the IdentityManager will redirect the user to its sign-in page.
|
||||
* @param handlerFunction When called, the function passed to setRedirectionHandler receives an object containing redirection properties.
|
||||
*/
|
||||
setRedirectionHandler(handlerFunction: Function): void;
|
||||
@@ -3736,9 +3767,11 @@ declare module "esri/dijit/ClassedColorSlider" {
|
||||
startup(): void;
|
||||
/** Fires when the ClassedColorSlider widget properties change. */
|
||||
on(type: "change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue of the ClassedColorSlider changes. */
|
||||
/** Fires during slide and slide stop, and when a handle or the minValue or maxValue of the slider are updated via text box. */
|
||||
on(type: "data-change", listener: (event: { breakInfos: any[]; maxValue: number; minValue: number; target: ClassedColorSlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue are updated via textbox. */
|
||||
on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedColorSlider }) => void): esri.Handle;
|
||||
/** Fires when a ClassedColorSlider handle is moved. */
|
||||
/** Fires on slide stop and when a handle is updated via textbox. */
|
||||
on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedColorSlider }) => void): esri.Handle;
|
||||
on(type: string, listener: (event: any) => void): esri.Handle;
|
||||
}
|
||||
@@ -3789,9 +3822,11 @@ declare module "esri/dijit/ClassedSizeSlider" {
|
||||
constructor(params: esri.ClassedSizeSliderOptions, srcNodeRef: Node | string);
|
||||
/** Fires when ClassedSizeSlider changes. */
|
||||
on(type: "change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue of the ClassedSizeSlider changes. */
|
||||
/** Fires during slide and slide stop, and when a handle or the minValue or maxValue of the slider are updated via text box. */
|
||||
on(type: "data-change", listener: (event: { breakInfos: any[]; maxValue: number; minValue: number; target: ClassedSizeSlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue are updated via textbox. */
|
||||
on(type: "data-value-change", listener: (event: { breakInfos: any; maxValue: number; minValue: number; target: ClassedSizeSlider }) => void): esri.Handle;
|
||||
/** Fires when a ClassedSizeSlider handle is moved. */
|
||||
/** Fires on slide stop and when a handle is updated via textbox. */
|
||||
on(type: "handle-value-change", listener: (event: { breakInfos: any; target: ClassedSizeSlider }) => void): esri.Handle;
|
||||
on(type: string, listener: (event: any) => void): esri.Handle;
|
||||
}
|
||||
@@ -3850,9 +3885,11 @@ declare module "esri/dijit/ColorInfoSlider" {
|
||||
startup(): void;
|
||||
/** Fires when ColorInfoSlider changes. */
|
||||
on(type: "change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue of the ColorInfoSlider changes. */
|
||||
/** Fires during slide and slide stop, and when a handle or the minValue or maxValue of the ColorInfoSlider are updated via text box. */
|
||||
on(type: "data-change", listener: (event: { colorInfo: any; maxValue: number; minValue: number; target: ColorInfoSlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue of the ColorInfoSlider are updated via text box. */
|
||||
on(type: "data-value-change", listener: (event: { colorInfo: any; maxValue: number; minValue: number; target: ColorInfoSlider }) => void): esri.Handle;
|
||||
/** Fires when a ColorInfoSlider handle is moved. */
|
||||
/** Fires on slide stop and when a handle is updated via textbox. */
|
||||
on(type: "handle-value-change", listener: (event: { colorInfo: any; target: ColorInfoSlider }) => void): esri.Handle;
|
||||
/** Fires when the zoom state changes. */
|
||||
on(type: "zoomed", listener: (event: { zoomed: boolean; target: ColorInfoSlider }) => void): esri.Handle;
|
||||
@@ -4069,7 +4106,7 @@ declare module "esri/dijit/ElevationProfile" {
|
||||
import esri = require("esri");
|
||||
import Geometry = require("esri/geometry/Geometry");
|
||||
|
||||
/** (Currently in beta)The Elevation Profile widget allows a user to create an elevation profile based on a polyline geometry input parameter or existing features.NOTE: Currently there is a known issue when creating an elevation profile that crosses the international dateline multiple times. */
|
||||
/** (Currently in beta)The Elevation Profile widget allows a user to create an elevation profile based on a polyline geometry input parameter or existing features. */
|
||||
class ElevationProfile {
|
||||
/** The measurement unit of the polyline geometry. */
|
||||
measureUnits: string;
|
||||
@@ -4452,7 +4489,7 @@ declare module "esri/dijit/HeatmapSlider" {
|
||||
constructor(params: esri.HeatmapSliderOptions, srcNodeRef: Node | string);
|
||||
/** Fires when HeatmapSlider changes. */
|
||||
on(type: "change", listener: (event: { colorStops: any; target: HeatmapSlider }) => void): esri.Handle;
|
||||
/** Fires when HeatmapSlider handle is moved. */
|
||||
/** Fires on slide stop and when a handle is updated via textbox. */
|
||||
on(type: "handle-value-change", listener: (event: { colorStops: any; target: HeatmapSlider }) => void): esri.Handle;
|
||||
on(type: string, listener: (event: any) => void): esri.Handle;
|
||||
}
|
||||
@@ -5112,7 +5149,7 @@ declare module "esri/dijit/OpacitySlider" {
|
||||
on(type: "change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue of the OpacitySlider changes. */
|
||||
on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; opacityInfo: any; target: OpacitySlider }) => void): esri.Handle;
|
||||
/** Fires when an OpacitySlider handle is moved. */
|
||||
/** Fires on slide stop and when a handle is updated via textbox. */
|
||||
on(type: "handle-value-change", listener: (event: { opacityInfo: any; target: OpacitySlider }) => void): esri.Handle;
|
||||
/** Fires when the zoom state changes. */
|
||||
on(type: "zoomed", listener: (event: { zoomed: boolean; target: OpacitySlider }) => void): esri.Handle;
|
||||
@@ -5159,7 +5196,7 @@ declare module "esri/dijit/Popup" {
|
||||
import Graphic = require("esri/graphic");
|
||||
import LineSymbol = require("esri/symbols/LineSymbol");
|
||||
import Point = require("esri/geometry/Point");
|
||||
import MarkerSymbol = require("esri/symbols/MarkerSymbol");
|
||||
import SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol");
|
||||
|
||||
/** The Popup class is an implementation of InfoWindow that inherits from InfoWindowBase to provide additional capabilities. */
|
||||
class Popup extends InfoWindowBase {
|
||||
@@ -5194,7 +5231,7 @@ declare module "esri/dijit/Popup" {
|
||||
/** Specify the margin (in pixels) to leave at the top of the popup window when it is maximized. */
|
||||
marginTop: number;
|
||||
/** Define the marker symbol used to highlight point features. */
|
||||
markerSymbol: MarkerSymbol;
|
||||
markerSymbol: SimpleMarkerSymbol;
|
||||
/** Specify the x-offset (in pixels) used when positioning the popup. */
|
||||
offsetX: number;
|
||||
/** Specify the y-offset (in pixels) used when positioning the popup. */
|
||||
@@ -5700,9 +5737,11 @@ declare module "esri/dijit/SizeInfoSlider" {
|
||||
startup(): void;
|
||||
/** Fires when the SizeInfoSlider properties change. */
|
||||
on(type: "change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle;
|
||||
/** Fires during slide and slide stop, and when a handle or the minValue or maxValue of the SizeInfoSlider are updated via text box. */
|
||||
on(type: "data-change", listener: (event: { maxValue: number; minValue: number; sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle;
|
||||
/** Fires when minValue or maxValue of the SizeInfoSlider changes. */
|
||||
on(type: "data-value-change", listener: (event: { maxValue: number; minValue: number; sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle;
|
||||
/** Fires when a SizeInfoSlider handle is moved. */
|
||||
/** Fires on slide stop and when a handle is updated via textbox. */
|
||||
on(type: "handle-value-change", listener: (event: { sizeInfo: any; target: SizeInfoSlider }) => void): esri.Handle;
|
||||
/** Fires when the zoom state changes. */
|
||||
on(type: "zoomed", listener: (event: { zoomed: boolean; target: SizeInfoSlider }) => void): esri.Handle;
|
||||
@@ -7454,6 +7493,94 @@ declare module "esri/dijit/geoenrichment/InfographicsOptionsItem" {
|
||||
export = InfographicsOptionsItem;
|
||||
}
|
||||
|
||||
declare module "esri/dijit/geoenrichment/ReportPlayer/DataProviderGE" {
|
||||
import PlayerCommands = require("esri/dijit/geoenrichment/ReportPlayer/PlayerCommands");
|
||||
|
||||
/** Data Provider for the ReportPlayer which allows you to specify which export options are available when running the report. */
|
||||
class DataProviderGE {
|
||||
/**
|
||||
* Registers a export option which can be performed.
|
||||
* @param playerCommand The export option to register to make available to the Report Player.
|
||||
* @param label The display name of the export option.
|
||||
*/
|
||||
registerCommand(playerCommand: PlayerCommands, label?: string): void;
|
||||
}
|
||||
export = DataProviderGE;
|
||||
}
|
||||
|
||||
declare module "esri/dijit/geoenrichment/ReportPlayer/PlayerCommands" {
|
||||
/** Enumerator of available export options that are available for the Report Player. */
|
||||
class PlayerCommands {
|
||||
/** Generates a stand-alone HTML file which displays dynamic content, including interactive map and infographic panels for the run infographic report. */
|
||||
static DYNAMIC_HTML: any;
|
||||
/** Generates a stand-alone HTML file without the dynamic interactivity of the DYNAMIC_HTML option for the run infographic report. */
|
||||
static HTML: any;
|
||||
/** Generates an image of the run infographic report. */
|
||||
static IMAGE: any;
|
||||
/** Generates a PDF file of the run infographic report. */
|
||||
static PDF: any;
|
||||
/** Displays a print dialog for the run infographic report for printing directly from the web browser. */
|
||||
static PRINT: any;
|
||||
}
|
||||
export = PlayerCommands;
|
||||
}
|
||||
|
||||
declare module "esri/dijit/geoenrichment/ReportPlayer/PlayerResizeModes" {
|
||||
/** Enumerator of available player resize mode options for the Report Player widget. */
|
||||
class PlayerResizeModes {
|
||||
/** The Report Player will be auto-resizable for the pagination view, the size of the player will change to fit the content. */
|
||||
static AUTO: any;
|
||||
/** The Report Player will be stretched and constrained to the browser window size. */
|
||||
static FIT_WINDOW: any;
|
||||
/** The Report Player dimensions (height and width) will need to be set manually in CSS. */
|
||||
static MANUAL: any;
|
||||
}
|
||||
export = PlayerResizeModes;
|
||||
}
|
||||
|
||||
declare module "esri/dijit/geoenrichment/ReportPlayer/PlayerThemes" {
|
||||
/** Enumerator of available theme options for displaying the Report Player. */
|
||||
class PlayerThemes {
|
||||
/** Report Player will display in a dark theme. */
|
||||
static DARK: any;
|
||||
/** Report Player will display in a light theme. */
|
||||
static LIGHT: any;
|
||||
}
|
||||
export = PlayerThemes;
|
||||
}
|
||||
|
||||
declare module "esri/dijit/geoenrichment/ReportPlayer/ReportPlayer" {
|
||||
import esri = require("esri");
|
||||
import DataProviderGE = require("esri/dijit/geoenrichment/ReportPlayer/DataProviderGE");
|
||||
import PlayerResizeModes = require("esri/dijit/geoenrichment/ReportPlayer/PlayerResizeModes");
|
||||
import PlayerThemes = require("esri/dijit/geoenrichment/ReportPlayer/PlayerThemes");
|
||||
|
||||
/** The ReportPlayer widget runs infographic report templates for a provided analysis area. */
|
||||
class ReportPlayer {
|
||||
/** Data Provider for the ReportPlayer which allows you to specify which export options are available when running the report. */
|
||||
dataProvider: DataProviderGE;
|
||||
/** Indicate whether to display the report in slide view or full screen, defaults to false which is full view. */
|
||||
isSlidesView: boolean;
|
||||
/** Specifies the resize mode of the ReportPlayer. */
|
||||
resizeModes: PlayerResizeModes;
|
||||
/** Specifies the theme of the ReportPlayer. */
|
||||
theme: PlayerThemes;
|
||||
/**
|
||||
* Creates a new ReportPlayer dijit using the given DOM node.
|
||||
* @param params Various parameters that can be used to configure the ReportPlayer.
|
||||
* @param srcNode Reference or id of the HTML element where the widget should be rendered.
|
||||
*/
|
||||
constructor(params: esri.ReportPlayerOptions, srcNode?: Node | string);
|
||||
/**
|
||||
* Generates the report for the supplied parameters.
|
||||
* @param dataProviderParams See the object specifications table below for the structure of the dataProviderParams object.
|
||||
* @param playParams See the object specifications table below for the structure of the playParams object.
|
||||
*/
|
||||
playReport(dataProviderParams: any, playParams?: any): any;
|
||||
}
|
||||
export = ReportPlayer;
|
||||
}
|
||||
|
||||
declare module "esri/dijit/util/busyIndicator" {
|
||||
/** This module provides the ability to create a busy indicator for a target. */
|
||||
var busyIndicator: {
|
||||
@@ -7612,6 +7739,47 @@ declare module "esri/geometry/Extent" {
|
||||
export = Extent;
|
||||
}
|
||||
|
||||
declare module "esri/geometry/GeographicTransformation" {
|
||||
import esri = require("esri");
|
||||
import GeographicTransformationStep = require("esri/geometry/GeographicTransformationStep");
|
||||
|
||||
/** Projecting your data between coordinate systems sometimes requires transforming between geographic coordinate systems. */
|
||||
class GeographicTransformation {
|
||||
/** Geographic transformation steps. */
|
||||
steps: GeographicTransformationStep[];
|
||||
/**
|
||||
* Creates a new GeographicTransformation object.
|
||||
* @param params See options descriptions for further information.
|
||||
*/
|
||||
constructor(params?: esri.GeographicTransformationOptions);
|
||||
/** Returns the inverse of the geographic transformation, calling this method or null if the transformation is not invertible. */
|
||||
getInverse(): GeographicTransformation;
|
||||
}
|
||||
export = GeographicTransformation;
|
||||
}
|
||||
|
||||
declare module "esri/geometry/GeographicTransformationStep" {
|
||||
import esri = require("esri");
|
||||
|
||||
/** Represents a step in the process of transforming coordinates from one geographic coordinate system to another. */
|
||||
class GeographicTransformationStep {
|
||||
/** Indicates whether the geographic transformation is inverted. */
|
||||
isInverse: boolean;
|
||||
/** The well-known id (wkid) that represents a known geographic transformation. */
|
||||
wkid: number;
|
||||
/** The well-known text (wkt) hat represents a known geographic transformation. */
|
||||
wkt: string;
|
||||
/**
|
||||
* Creates a new GeographicTransformationStep object.
|
||||
* @param params See the params table for additional information.
|
||||
*/
|
||||
constructor(params?: esri.GeographicTransformationStepOptions);
|
||||
/** Returns the inverse of the geographic transformation calling this method or null if the transformation is not invertible. */
|
||||
getInverse(): GeographicTransformationStep;
|
||||
}
|
||||
export = GeographicTransformationStep;
|
||||
}
|
||||
|
||||
declare module "esri/geometry/Geometry" {
|
||||
import SpatialReference = require("esri/SpatialReference");
|
||||
|
||||
@@ -7987,6 +8155,77 @@ declare module "esri/geometry/ScreenPoint" {
|
||||
export = ScreenPoint;
|
||||
}
|
||||
|
||||
declare module "esri/geometry/coordinateFormatter" {
|
||||
import SpatialReference = require("esri/SpatialReference");
|
||||
import Point = require("esri/geometry/Point");
|
||||
|
||||
/** This module converts between points and formatted coordinate notation strings such as: decimal degrees degrees, minutes, and secondsU.S. */
|
||||
var coordinateFormatter: {
|
||||
/**
|
||||
* Parses coordinates in latitude/longitude notation, and returns a Point representing that location.
|
||||
* @param coordinates The latitude/longitude notation string for the coordinates.
|
||||
* @param spatialReference A spatial reference for a geographic coordinate system that defines the datum and ellipsoid referenced by the latitude-longitude coordinates.
|
||||
*/
|
||||
fromLatitudeLongitude(coordinates: string, spatialReference?: SpatialReference): Point;
|
||||
/**
|
||||
* Parses coordinates in Military Grid Reference System (MGRS) notation, and returns a Point representing that location.
|
||||
* @param coordinates The MGRS notation string for the coordinates.
|
||||
* @param spatialReference A spatial reference for a geographic coordinate system that defines the datum and ellipsoid referenced by the MGRS coordinates.
|
||||
* @param conversionMode The mode used by the given MGRS coordinates.
|
||||
*/
|
||||
fromMgrs(coordinates: string, spatialReference: SpatialReference, conversionMode: string): Point;
|
||||
/**
|
||||
* Parses coordinates in United States National Grid (USNG) notation, and returns a Point representing that location.
|
||||
* @param coordinates The USNG notation string for the coordinates.
|
||||
* @param spatialReference A spatial reference for a geographic coordinate system that defines the datum and ellipsoid referenced by the USNG coordinates.
|
||||
*/
|
||||
fromUsng(coordinates: string, spatialReference?: SpatialReference): Point;
|
||||
/**
|
||||
* Parses coordinates in Universal Transverse Mercator (UTM) notation, and returns a Point representing that location.
|
||||
* @param coordinates The UTM notation string for the coordinates.
|
||||
* @param spatialReference A spatial reference for a geographic coordinate system that defines the datum and ellipsoid referenced by the UTM coordinates.
|
||||
* @param conversionMode The latitude notation scheme used by the given UTM coordinates, either a latitudinal band, or a hemisphere designator.
|
||||
*/
|
||||
fromUtm(coordinates: string, spatialReference: SpatialReference, conversionMode: string): Point;
|
||||
/** Indicates if all dependencies of this module have been loaded. */
|
||||
isLoaded(): boolean;
|
||||
/** Indicates if this module is supported in the current browser. */
|
||||
isSupported(): boolean;
|
||||
/** Loads this module's dependencies. */
|
||||
load(): any;
|
||||
/**
|
||||
* Returns formatted coordinates in latitude/longitude notation representing the given point's location.
|
||||
* @param point The location to be represented as a formatted latitude/longitude string.
|
||||
* @param format The mode to use when formatting the latitude/longitude string.
|
||||
* @param decimalPlaces The number of decimal places to use, it should be an integer from 0 to 16.
|
||||
*/
|
||||
toLatitudeLongitude(point: Point, format: string, decimalPlaces?: number): string;
|
||||
/**
|
||||
* Returns formatted coordinates in Military Grid Reference System (MGRS) notation representing the given point's location.
|
||||
* @param point The location to be represented in MGRS notation.
|
||||
* @param conversionMode The mode to use for the returned MGRS notation string.
|
||||
* @param precision The precision with which to represent the coordinates.
|
||||
* @param addSpaces Indicates whether the generated strings contain no spaces.
|
||||
*/
|
||||
toMgrs(point: Point, conversionMode: string, precision?: number, addSpaces?: boolean): string;
|
||||
/**
|
||||
* Returns formatted coordinates in United States National Grid (USNG) notation representing the given point's location.
|
||||
* @param point The location to be represented in USNG notation.
|
||||
* @param precision The precision with which to represent the coordinates.
|
||||
* @param addSpaces Indicates whether the generated strings contain no spaces.
|
||||
*/
|
||||
toUsng(point: Point, precision?: number, addSpaces?: boolean): string;
|
||||
/**
|
||||
* Returns formatted coordinates in Universal Transverse Mercator (UTM) notation representing the given point's location.
|
||||
* @param point The location to be represented in UTM notation.
|
||||
* @param conversionMode The latitude notation scheme to use in the returned UTM notation string, either a latitudinal band, or a hemisphere designator.
|
||||
* @param addSpaces Indicates whether the generated strings contain no spaces.
|
||||
*/
|
||||
toUtm(point: Point, conversionMode: string, addSpaces?: boolean): string;
|
||||
};
|
||||
export = coordinateFormatter;
|
||||
}
|
||||
|
||||
declare module "esri/geometry/geodesicUtils" {
|
||||
import Polygon = require("esri/geometry/Polygon");
|
||||
import Geometry = require("esri/geometry/Geometry");
|
||||
@@ -8562,6 +8801,45 @@ declare module "esri/geometry/normalizeUtils" {
|
||||
export = normalizeUtils;
|
||||
}
|
||||
|
||||
declare module "esri/geometry/projection" {
|
||||
import SpatialReference = require("esri/SpatialReference");
|
||||
import Extent = require("esri/geometry/Extent");
|
||||
import GeographicTransformation = require("esri/geometry/GeographicTransformation");
|
||||
import Geometry = require("esri/geometry/Geometry");
|
||||
|
||||
/** A client-side projection engine for converting geometries from one SpatialReference to another. */
|
||||
var projection: {
|
||||
/**
|
||||
* Gets the default geographic transformation used to convert the geometry from the input spatial reference to the output spatial reference.
|
||||
* @param inSpatialReference The input spatial reference from which to project geometries.
|
||||
* @param outSpatialReference The spatial reference to which you are converting the geometries.
|
||||
* @param extent An extent used to determine the suitability of the returned transformation.
|
||||
*/
|
||||
getTransformation(inSpatialReference: SpatialReference, outSpatialReference: SpatialReference, extent?: Extent): GeographicTransformation;
|
||||
/**
|
||||
* Returns a list of all geographic transformations suitable to convert geometries from the input spatial reference to the specified output spatial reference.
|
||||
* @param inSpatialReference The spatial reference that the geometries are currently using.
|
||||
* @param outSpatialReference The spatial reference to which you are converting the geometries to.
|
||||
* @param extent An extent used to determine the suitability of the returned transformations.
|
||||
*/
|
||||
getTransformations(inSpatialReference: SpatialReference, outSpatialReference: SpatialReference, extent?: Extent): GeographicTransformation[];
|
||||
/** Indicates if all dependencies of this module have been loaded. */
|
||||
isLoaded(): boolean;
|
||||
/** Indicates if this module is supported in the browser. */
|
||||
isSupported(): boolean;
|
||||
/** Load this module's dependencies. */
|
||||
load(): any;
|
||||
/**
|
||||
* Projects a geometry or an array of geometries to the specified output spatial reference.
|
||||
* @param geometry The geometry or geometries to project.
|
||||
* @param outSpatialReference The spatial reference to which you are converting the geometries' coordinates.
|
||||
* @param geographicTransformation The geographic transformation used to transform the geometries.
|
||||
*/
|
||||
project(geometry: Geometry | Geometry[], outSpatialReference: SpatialReference, geographicTransformation?: GeographicTransformation): Geometry | Geometry[];
|
||||
};
|
||||
export = projection;
|
||||
}
|
||||
|
||||
declare module "esri/geometry/scaleUtils" {
|
||||
import Map = require("esri/map");
|
||||
import Extent = require("esri/geometry/Extent");
|
||||
@@ -9677,6 +9955,8 @@ declare module "esri/layers/FeatureLayer" {
|
||||
version: number;
|
||||
/** When true, the layer is visible at the current map scale. */
|
||||
visibleAtMapScale: boolean;
|
||||
/** Indicates if WebGL is enabled on the layer. */
|
||||
webglEnabled: boolean;
|
||||
/**
|
||||
* Creates a new instance of a feature layer object from the ArcGIS Server REST resource identified by the input URL.
|
||||
* @param url URL to the ArcGIS Server REST resource that represents a feature service.
|
||||
@@ -9773,6 +10053,10 @@ declare module "esri/layers/FeatureLayer" {
|
||||
* @param feature A feature from this layer.
|
||||
*/
|
||||
getType(feature: Graphic): FeatureType;
|
||||
/** Indicates whether an error is thrown after the layer updates. */
|
||||
hasUpdateError(): void;
|
||||
/** Indicates if the layer is rendered in WebGL. */
|
||||
hasWebGLSurface(): boolean;
|
||||
/** Returns true if geometryType is esriGeometryMultipatch and multipatchOption is xyFootprint. */
|
||||
hasXYFootprint(): boolean;
|
||||
/** Returns true if the FeatureLayer is editable. */
|
||||
@@ -9934,6 +10218,11 @@ declare module "esri/layers/FeatureLayer" {
|
||||
* @param update When false the layer will not update its content based on the map's time extent.
|
||||
*/
|
||||
setUseMapTime(update: boolean): void;
|
||||
/**
|
||||
* Toggles WebGL rendering on/off on the layer.
|
||||
* @param enable Indicates whether to enable WebGL on the layer.
|
||||
*/
|
||||
setWebGLEnabled(enable: boolean): void;
|
||||
/** Suspends layer drawing. */
|
||||
suspend(): void;
|
||||
/** Returns an easily serializable object representation of the layer. */
|
||||
@@ -11961,6 +12250,8 @@ declare module "esri/map" {
|
||||
timeExtent: TimeExtent;
|
||||
/** Indicates whether map is visible. */
|
||||
visible: boolean;
|
||||
/** Indicates if WebGL is enabled for rendering FeatureLayers in the map. */
|
||||
webglEnabled: boolean;
|
||||
/** Current width of the map in screen pixels. */
|
||||
width: number;
|
||||
/**
|
||||
@@ -12164,6 +12455,11 @@ declare module "esri/map" {
|
||||
* @param visible If true, map will be visible.
|
||||
*/
|
||||
setVisibility(visible: boolean): Map;
|
||||
/**
|
||||
* Toggles WebGL rendering on/off for all FeatureLayers in the map.
|
||||
* @param enable Indicates whether to enable WebGL rendering on the FeatureLayers in the map.
|
||||
*/
|
||||
setWebGLEnabled(enable: boolean): void;
|
||||
/**
|
||||
* Set the map zoom level to the given value.
|
||||
* @param zoom A valid zoom level value.
|
||||
@@ -15860,6 +16156,8 @@ declare module "esri/tasks/PrintTemplate" {
|
||||
class PrintTemplate {
|
||||
/** Define the map width, height and dpi. */
|
||||
exportOptions: any;
|
||||
/** When true, the feature's attributes are included in feature collection layers even when they are not needed for rendering. */
|
||||
forceFeatureAttributes: boolean;
|
||||
/** The print output format. */
|
||||
format: string;
|
||||
/** The text that appears on the Print widget's print button. */
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as arrify from 'arrify';
|
||||
|
||||
/***************** arrify<T> *****************/
|
||||
arrify(null);
|
||||
arrify<number>(null);
|
||||
|
||||
@@ -12,3 +13,74 @@ arrify([2, 3]);
|
||||
function test(val?: string | string[]) {
|
||||
arrify(val);
|
||||
}
|
||||
/***************** arrify<T> *****************/
|
||||
|
||||
/***************** arrify<T1, T2> *****************/
|
||||
arrify<number, string>(undefined); // returns []
|
||||
|
||||
arrify<number, string>(null); // returns []
|
||||
|
||||
{
|
||||
const value: number | string[] = 2018;
|
||||
arrify<number, string>(value); // returns [2018]
|
||||
}
|
||||
|
||||
{
|
||||
const value: number[] | string | string[] = ['a', 'b'];
|
||||
arrify<number, string>(value); // returns ['a', 'b']
|
||||
}
|
||||
/***************** arrify<T1, T2> *****************/
|
||||
|
||||
/***************** arrify<T1, T2, T3> *****************/
|
||||
arrify<boolean, number, string>(undefined);
|
||||
|
||||
arrify<boolean, number, string>(null);
|
||||
|
||||
{
|
||||
const value: boolean | number[] | string[] = true;
|
||||
// returns [true]
|
||||
arrify<boolean, number, string>(value);
|
||||
}
|
||||
|
||||
{
|
||||
const value: boolean[] | number | string[] = ['a', 'b'];
|
||||
// returns ['a', 'b']
|
||||
arrify<boolean, number, string>(value);
|
||||
}
|
||||
/***************** arrify<T1, T2, T3> *****************/
|
||||
|
||||
/***************** arrify<T1, T2, T3, T4> *****************/
|
||||
arrify<boolean, Date, number, string>(undefined);
|
||||
|
||||
arrify<boolean, Date, number, string>(null);
|
||||
|
||||
{
|
||||
const value: boolean | Date | number[] | string[] = new Date(2018);
|
||||
// returns [ new Date(2018) ]
|
||||
arrify<boolean, Date, number, string>(value);
|
||||
}
|
||||
|
||||
{
|
||||
const value: boolean[] | Date[] | number | string = [true, false];
|
||||
// returns [true, false]
|
||||
arrify<boolean, Date, number, string>(value);
|
||||
}
|
||||
/***************** arrify<T1, T2, T3, T4> *****************/
|
||||
|
||||
/***************** arrify<T1, T2, T3, T4, T5> *****************/
|
||||
arrify<boolean, Date, number, RegExp, string>(undefined);
|
||||
|
||||
arrify<boolean, Date, number, RegExp, string>(null);
|
||||
|
||||
{
|
||||
const value: boolean | Date | number[] | RegExp | string[] = /test/;
|
||||
// returns [ /test/ ]
|
||||
arrify<boolean, Date, number, RegExp, string>(value);
|
||||
}
|
||||
|
||||
{
|
||||
const value: boolean[] | Date[] | number | RegExp[] | string = [/test1/, /test2/];
|
||||
// returns [/test1/, /test2/]
|
||||
arrify<boolean, Date, number, RegExp, string>(value);
|
||||
}
|
||||
/***************** arrify<T1, T2, T3, T4, T5> *****************/
|
||||
|
||||
Vendored
+73
@@ -14,5 +14,78 @@
|
||||
* arrify([2, 3]) // returns [2, 3]
|
||||
*/
|
||||
declare function arrify<T>(val: undefined | null | T | T[]): T[];
|
||||
|
||||
/**
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<number, string>(undefined);
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<number, string>(null);
|
||||
* @example
|
||||
* let value: number | string[] = 2018;
|
||||
* // returns [2018]
|
||||
* arrify<number, string>(value);
|
||||
* @example
|
||||
* let value: number[] | string | string[] = ['a', 'b'];
|
||||
* // returns ['a', 'b']
|
||||
* arrify<number, string>(value);
|
||||
*/
|
||||
declare function arrify<T1, T2>(val: undefined | null | T1 | T2 | T1[] | T2[]): T1[] | T2[];
|
||||
|
||||
/**
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<boolean, number, string>(undefined);
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<boolean, number, string>(null);
|
||||
* @example
|
||||
* let value: boolean | number[] | string[] = true;
|
||||
* // returns [true]
|
||||
* arrify<boolean, number, string>(value);
|
||||
* @example
|
||||
* let value: boolean[] | number | string[] = ['a', 'b'];
|
||||
* // returns ['a', 'b']
|
||||
* arrify<boolean, number, string>(value);
|
||||
*/
|
||||
declare function arrify<T1, T2, T3>(val: undefined | null | T1 | T2 | T3 | T1[] | T2[] | T3[]): T1[] | T2[] | T3[];
|
||||
|
||||
/**
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<boolean, Date, number, string>(undefined);
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<boolean, Date, number, string>(null);
|
||||
* @example
|
||||
* let value: boolean | Date | number[] | string[] = new Date(2018);
|
||||
* // returns [ new Date(2018) ]
|
||||
* arrify<boolean, Date, number, string>(value);
|
||||
* @example
|
||||
* let value: boolean[] | Date[] | number | string = [true, false];
|
||||
* // returns [true, false]
|
||||
* arrify<boolean, Date, number, string>(value);
|
||||
*/
|
||||
declare function arrify<T1, T2, T3, T4>(val: undefined | null | T1 | T2 | T3 | T4 | T1[] | T2[] | T3[] | T4[]): T1[] | T2[] | T3[] | T4[];
|
||||
|
||||
/**
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<boolean, Date, number, RegExp, string>(undefined);
|
||||
* @example
|
||||
* // returns []
|
||||
* arrify<boolean, Date, number, RegExp, string>(null);
|
||||
* @example
|
||||
* let value: boolean | Date | number[] | RegExp | string[] = /test/;
|
||||
* // returns [ /test/ ]
|
||||
* arrify<boolean, Date, number, RegExp, string>(value);
|
||||
* @example
|
||||
* let value: boolean[] | Date[] | number | RegExp[] | string = [/test1/, /test2/];
|
||||
* // returns [/test1/, /test2/]
|
||||
* arrify<boolean, Date, number, RegExp, string>(value);
|
||||
*/
|
||||
declare function arrify<T1, T2, T3, T4, T5>(val: undefined | null | T1 | T2 | T3 | T4 | T5 | T1[] | T2[] | T3[] | T4[] | T5[]): T1[] | T2[] | T3[] | T4[] | T5[];
|
||||
|
||||
declare namespace arrify {}
|
||||
export = arrify;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import Calendar from '@atlaskit/calendar';
|
||||
|
||||
import * as React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
|
||||
declare const container: Element;
|
||||
|
||||
render(<Calendar onChange={() => {}} month={1} year={2000} />, container);
|
||||
Vendored
+81
@@ -0,0 +1,81 @@
|
||||
// Type definitions for atlaskit__calendar 5.0
|
||||
// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/src/master/
|
||||
// Definitions by: Lee Standen <https://github.com/lstanden>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { Component, HTMLAttributes, FocusEvent } from 'react';
|
||||
|
||||
export type ArrowKeys = 'left' | 'up' | 'right' | 'down';
|
||||
|
||||
export interface DateObj {
|
||||
day: number;
|
||||
month: number;
|
||||
year: number;
|
||||
}
|
||||
|
||||
export interface ChangeEvent extends DateObj {
|
||||
iso: string;
|
||||
type: 'left' | 'up' | 'right' | 'down' | 'prev' | 'next';
|
||||
}
|
||||
|
||||
export interface SelectEvent extends DateObj {
|
||||
iso: string;
|
||||
}
|
||||
|
||||
export interface Props {
|
||||
/** The number of the day currently focused. Places border around the date. 0 highlights no date. */
|
||||
day?: number;
|
||||
/** Default for `day`. */
|
||||
defaultDay?: number;
|
||||
/** Default for `disabled`. */
|
||||
defaultDisabled?: string[];
|
||||
/** Default for `month`. */
|
||||
defaultMonth?: number;
|
||||
/** Default for `previouslySelected`. */
|
||||
defaultPreviouslySelected?: string[];
|
||||
/** Default for `selected`. */
|
||||
defaultSelected?: string[];
|
||||
/** Default for `year`. */
|
||||
defaultYear?: number;
|
||||
/**
|
||||
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates provided are greyed out.
|
||||
* This does not prevent these dates being selected.
|
||||
*/
|
||||
disabled?: string[];
|
||||
/** Props to apply to the container. */
|
||||
innerProps?: HTMLAttributes<HTMLDivElement>;
|
||||
/** The number of the month (from 1 to 12) which the calendar should be on. */
|
||||
month?: number;
|
||||
/** Function which is called when the calendar is no longer focused. */
|
||||
onBlur?: (e?: FocusEvent<HTMLDivElement>) => void;
|
||||
/**
|
||||
* Called when the calendar is navigated. This can be triggered by the keyboard, or by clicking the navigational buttons.
|
||||
* The 'type' property indicates the the direction the calendar was navigated whereas the 'iso' property is a string of the format YYYY-MM-DD.
|
||||
*/
|
||||
onChange?: (e: ChangeEvent) => void;
|
||||
/** Called when the calendar receives focus. This could be from a mouse event on the container by tabbing into it. */
|
||||
onFocus?: (e?: FocusEvent<HTMLDivElement>) => void;
|
||||
/**
|
||||
* Function called when a day is clicked on. Calls with an object that has
|
||||
* a day, month and week property as numbers, representing the date just clicked.
|
||||
* It also has an 'iso' property, which is a string of the selected date in the
|
||||
* format YYYY-MM-DD.
|
||||
*/
|
||||
onSelect?: (e: SelectEvent) => void;
|
||||
/**
|
||||
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
||||
* provided are given a background color.
|
||||
*/
|
||||
previouslySelected?: string[];
|
||||
/**
|
||||
* Takes an array of dates as string in the format 'YYYY-MM-DD'. All dates
|
||||
* provided are given a background color.
|
||||
*/
|
||||
selected?: string[];
|
||||
/** Value of current day, as a string in the format 'YYYY-MM-DD'. */
|
||||
today?: string;
|
||||
/** Year to display the calendar for. */
|
||||
year?: number;
|
||||
}
|
||||
export default class Calendar extends Component<Props> {}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"paths": {
|
||||
"@atlaskit/calendar": ["atlaskit__calendar"]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "atlaskit__calendar-tests.tsx"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,15 @@
|
||||
import InlineEdit from '@atlaskit/inline-edit';
|
||||
|
||||
import * as React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
|
||||
declare const container: Element;
|
||||
|
||||
render(
|
||||
<InlineEdit
|
||||
readView={<div>Hello</div>}
|
||||
onConfirm={() => {}}
|
||||
onCancel={() => {}}
|
||||
/>,
|
||||
container,
|
||||
);
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
// Type definitions for @atlaskit/inline-edit 5.0
|
||||
// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/
|
||||
// Definitions by: Lee Standen <https://github.com/lstanden>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { ReactElement, Component } from 'react';
|
||||
export default class InlineEdit extends Component<StatefulProps> {}
|
||||
export class InlineEditStateless extends Component<StatelessProps> {}
|
||||
|
||||
export interface BaseProps {
|
||||
/** Label above the input. */
|
||||
label?: string;
|
||||
/** Component to be shown when reading only */
|
||||
readView: ReactElement<any>;
|
||||
/** Component to be shown when editing. Should be an @atlaskit/input. */
|
||||
editView?: ReactElement<any>;
|
||||
/** Set whether the read view should fit width, most obvious when hovered. */
|
||||
isFitContainerWidthReadView?: boolean;
|
||||
/** Greys out text and shows spinner. Does not disable input. */
|
||||
isWaiting?: boolean;
|
||||
/** Sets yellow border with warning symbol at end of input. Removes confirm and cancel buttons. */
|
||||
isInvalid?: boolean;
|
||||
/** Determine whether the label is shown. */
|
||||
isLabelHidden?: boolean;
|
||||
/** Sets whether the checkmark and cross are displayed in the bottom right fo the field. */
|
||||
areActionButtonsHidden?: boolean;
|
||||
/** Sets whether the confirm function is called when the input loses focus. */
|
||||
isConfirmOnBlurDisabled?: boolean;
|
||||
/** Handler called when checkmark is clicked. Also by default called when the input loses focus. */
|
||||
onConfirm: () => void;
|
||||
/** Handler called when the cross is clicked on. */
|
||||
onCancel: () => void;
|
||||
/** html to pass down to the label htmlFor prop. */
|
||||
labelHtmlFor?: string;
|
||||
/** Set whether onConfirm is called on pressing enter. */
|
||||
shouldConfirmOnEnter?: boolean;
|
||||
/** Set whether default stylings should be disabled when editing. */
|
||||
disableEditViewFieldBase?: boolean;
|
||||
/** Component to be shown in an @atlaskit/inline-dialog when edit view is open. */
|
||||
invalidMessage?: ReactElement<any>;
|
||||
}
|
||||
|
||||
export interface StatelessProps extends BaseProps {
|
||||
/** Whether the component shows the readView or the editView. */
|
||||
isEditing: boolean;
|
||||
/** Handler called when the wrapper or the label are clicked. */
|
||||
onEditRequested: () => void;
|
||||
}
|
||||
|
||||
export type StatefulProps = BaseProps;
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"paths": {
|
||||
"@atlaskit/inline-edit": ["atlaskit__inline-edit"]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "atlaskit__inline-edit-tests.tsx"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,15 @@
|
||||
import Layer from '@atlaskit/layer';
|
||||
|
||||
import * as React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
|
||||
declare const container: Element;
|
||||
|
||||
render(
|
||||
<Layer
|
||||
position="bottom left"
|
||||
content={<h1>Hello, world!</h1>}
|
||||
autoFlip={false}
|
||||
/>,
|
||||
container,
|
||||
);
|
||||
Vendored
+72
@@ -0,0 +1,72 @@
|
||||
// Type definitions for @atlaskit/layer 3.1
|
||||
// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/src/master/
|
||||
// Definitions by: Lee Standen <https://github.com/lstanden>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { Component, ReactNode } from 'react';
|
||||
|
||||
export default class Layer extends Component<Props> {}
|
||||
|
||||
export interface Props {
|
||||
/**
|
||||
* Sets whether the content auto flip when it reaches the border set it as true for default flip
|
||||
* or set the custom flip positions
|
||||
*/
|
||||
autoFlip?: boolean | FlipPositionType | FlipPositionType[];
|
||||
/**
|
||||
* Element to act as a boundary for the Layer. The Layer will not sit outside this element if it
|
||||
* can help it. If, through it's normal positoning, it would end up outside the boundary the
|
||||
* layer will flip positions if the autoPosition prop is set.
|
||||
*/
|
||||
boundariesElement?: BoundariesElementType;
|
||||
/** Target to which layer is attached */
|
||||
children?: ReactNode;
|
||||
/** HTML content to display in the layer. Will be aligned to the target according to the position prop. */
|
||||
content?: ReactNode;
|
||||
/**
|
||||
* String representing the offsets from the target element in the format "[x-offset][y-offset]",
|
||||
* measured in pixels.
|
||||
*/
|
||||
offset?: string;
|
||||
/**
|
||||
* Callback that is used to know when the flipped state of Layer changes. This occurs when placing a
|
||||
* Layered element in the requested position would cause Layer to be rendered outside of the
|
||||
* boundariesElement (usually viewport).
|
||||
*/
|
||||
onFlippedChange?: (
|
||||
flipped: boolean,
|
||||
actualPosition: CSSPositionType,
|
||||
originalPosition: CSSPositionType,
|
||||
) => void;
|
||||
/**
|
||||
* Position of a layer relative to its target. The position attribute takes two positional arguments in
|
||||
* the format position="edge edge-position", where edge specifies what edge to align the layer to, and
|
||||
* edge-position specifies where on that edge the layer should appear.
|
||||
*/
|
||||
position?: PositionType;
|
||||
/** z-index for the layer component */
|
||||
zIndex?: number;
|
||||
/** Lock scrolling behind the layer */
|
||||
lockScroll?: boolean;
|
||||
}
|
||||
|
||||
export type FlipPositionType = 'top' | 'right' | 'bottom' | 'left';
|
||||
|
||||
export type PositionType =
|
||||
| 'top left'
|
||||
| 'top center'
|
||||
| 'top right'
|
||||
| 'right top'
|
||||
| 'right middle'
|
||||
| 'right bottom'
|
||||
| 'bottom left'
|
||||
| 'bottom center'
|
||||
| 'bottom right'
|
||||
| 'left top'
|
||||
| 'left middle'
|
||||
| 'left bottom';
|
||||
|
||||
export type BoundariesElementType = 'viewport' | 'window' | 'scrollParent';
|
||||
|
||||
export type CSSPositionType = 'absolute' | 'fixed';
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"paths": {
|
||||
"@atlaskit/layer": ["atlaskit__layer"]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "atlaskit__layer-tests.tsx"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,14 @@
|
||||
import SingleSelect, { StatelessSelect } from '@atlaskit/single-select';
|
||||
|
||||
import * as React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
|
||||
declare const container: Element;
|
||||
|
||||
render(
|
||||
<div>
|
||||
<SingleSelect />
|
||||
<StatelessSelect />
|
||||
</div>,
|
||||
container,
|
||||
);
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
// Type definitions for @atlaskit/single-select 4.0
|
||||
// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/src/master/
|
||||
// Definitions by: Lee Standen <https://github.com/lstanden>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { Component, ReactNode, SyntheticEvent } from 'react';
|
||||
|
||||
export default class SingleSelect extends Component<Props> {}
|
||||
export class StatelessSelect extends Component<StatelessProps> {}
|
||||
|
||||
export interface Props {
|
||||
/** Subtle items do not have a background color. */
|
||||
appearance?: 'default' | 'subtle';
|
||||
/** Item to be selected on component mount. */
|
||||
defaultSelected?: ItemType;
|
||||
/** Sets whether the dropdown should be constrained to the width of its trigger */
|
||||
droplistShouldFitContainer?: boolean;
|
||||
/**
|
||||
* Sets whether the field should be selectable. If it is, the field will be
|
||||
* a text box, which will filter the items.
|
||||
*/
|
||||
hasAutocomplete?: boolean;
|
||||
/** id property to be passed down to the html select component. */
|
||||
id?: string;
|
||||
/** message to show on the dialog when isInvalid is true */
|
||||
invalidMessage?: ReactNode;
|
||||
/** controls the top margin of the label component rendered. */
|
||||
isFirstChild?: boolean;
|
||||
/** Sets whether the select is selectable. Changes hover state. */
|
||||
isDisabled?: boolean;
|
||||
/** Sets whether the component should be open on mount. */
|
||||
isDefaultOpen?: boolean;
|
||||
/**
|
||||
* Sets whether form including select can be submitted without an option
|
||||
* being made.
|
||||
*/
|
||||
isRequired?: boolean;
|
||||
/**
|
||||
* Set whether there is an error with the selection. Sets an orange border
|
||||
* and shows the warning icon.
|
||||
*/
|
||||
isInvalid?: boolean;
|
||||
/**
|
||||
* An array of objects, each one of which must have an array of items, and
|
||||
* may have a heading. All items should have content and value properties, with
|
||||
* content being the displayed text.
|
||||
*/
|
||||
items?: GroupType[];
|
||||
/** Label to be displayed above select. */
|
||||
label?: string;
|
||||
/** name property to be passed to the html select element. */
|
||||
name?: string;
|
||||
/**
|
||||
* Message to display in any group in items if there are no items in it,
|
||||
* including if there is one item that has been selected.
|
||||
*/
|
||||
noMatchesFound?: string;
|
||||
/** Handler to be called when the filtered items changes. */
|
||||
onFilterChange?: (filter: string) => void;
|
||||
/**
|
||||
* Handler to be called when an item is selected. Called with an object that
|
||||
* has the item selected as a property on the object.
|
||||
*/
|
||||
onSelected?: (item: ItemType) => void;
|
||||
/**
|
||||
* Handler called when the select is opened or closed. Called with an object
|
||||
* that has both the event, and the new isOpen state.
|
||||
*/
|
||||
onOpenChange?: (
|
||||
change: { event: SyntheticEvent<any>; isOpen: boolean },
|
||||
) => void;
|
||||
/** Text to be shown within the select when no item is selected. */
|
||||
placeholder?: string;
|
||||
/** Where the select dropdown should be displayed relative to the field position. */
|
||||
position?: string;
|
||||
/** Sets whether the field will become focused. */
|
||||
shouldFocus?: boolean;
|
||||
/** Sets whether the field should be constrained to the width of its trigger */
|
||||
shouldFitContainer?: boolean;
|
||||
/** Sets whether the droplist should flip its position when there is not enough space. */
|
||||
shouldFlip?: boolean;
|
||||
/** Set the max height of the dropdown list in pixels. */
|
||||
maxHeight?: number;
|
||||
}
|
||||
|
||||
export interface StatelessProps extends Props {
|
||||
/** Value to be used when filtering the items. Compared against 'content'. */
|
||||
filterValue?: string;
|
||||
/** Sets whether the Select dropdown is open. */
|
||||
isOpen?: boolean;
|
||||
/**
|
||||
* Sets whether the field is loading data. The same property is used
|
||||
* for either initial fetch (when no options are available) as well for
|
||||
* subsequent loading of more options. The component reacts accordingly
|
||||
* based on the `items` provided.
|
||||
*/
|
||||
isLoading?: boolean;
|
||||
/**
|
||||
* Message to be displayed when the component is set to its loading state.
|
||||
* The message might be displayed differently depending on whether or not
|
||||
* there are items already being rendered.
|
||||
*/
|
||||
loadingMessage?: string;
|
||||
/** The selected item data */
|
||||
selectedItem?: ItemType;
|
||||
}
|
||||
|
||||
export interface GroupType {
|
||||
heading?: string;
|
||||
items: ItemType[];
|
||||
}
|
||||
|
||||
export interface ItemType {
|
||||
content?: ReactNode;
|
||||
description?: string;
|
||||
label?: string;
|
||||
tooltipDescription?: string;
|
||||
tooltipPosition?: 'top' | 'bottom' | 'left';
|
||||
value?: string | number;
|
||||
filterValues?: string[];
|
||||
isDisabled?: boolean;
|
||||
isSelected?: boolean;
|
||||
elemBefore?: ReactNode;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"paths": {
|
||||
"@atlaskit/single-select": ["atlaskit__single-select"]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "atlaskit__single-select-tests.tsx"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,3 @@
|
||||
import atob from 'atob';
|
||||
|
||||
atob('foo');
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for atob 2.1
|
||||
// Project: https://git.coolaj86.com/coolaj86/atob.js.git
|
||||
// Definitions by: John Wright <https://github.com/johngeorgewright>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
export default function(str: string): string;
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"lib": ["es6"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"atob-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -258,6 +258,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, avatarOptions);
|
||||
|
||||
const authResult : AuthResult = {
|
||||
accessToken: 'fake_access_token',
|
||||
expiresIn: 7200,
|
||||
idToken: 'fake_id_token',
|
||||
idTokenPayload: {
|
||||
aud: "EaQzyHt1Dy57l-r5iHcMeT-lh1fFZntg",
|
||||
@@ -267,5 +268,6 @@ const authResult : AuthResult = {
|
||||
sub: "auth0|aksjfkladsf"
|
||||
},
|
||||
refreshToken: undefined,
|
||||
state: "923jf092j3.FFSDJFDSKLDF"
|
||||
state: "923jf092j3.FFSDJFDSKLDF",
|
||||
tokenType: 'Bearer'
|
||||
};
|
||||
|
||||
Vendored
+5
-1
@@ -165,6 +165,8 @@ interface Auth0LockShowOptions {
|
||||
|
||||
interface AuthResult {
|
||||
accessToken: string;
|
||||
appState?: any;
|
||||
expiresIn: number;
|
||||
idToken: string;
|
||||
idTokenPayload: {
|
||||
aud: string;
|
||||
@@ -174,8 +176,10 @@ interface AuthResult {
|
||||
sub: string;
|
||||
};
|
||||
refreshToken?: string;
|
||||
scope?: string;
|
||||
state: string;
|
||||
}
|
||||
tokenType: string;
|
||||
}
|
||||
|
||||
interface Auth0LockStatic {
|
||||
new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
|
||||
|
||||
@@ -75,6 +75,25 @@ management
|
||||
// Handle the error.
|
||||
});
|
||||
|
||||
// Link users
|
||||
management
|
||||
.createUser({ connection: 'email', email: 'hi@me.co' })
|
||||
.catch(err => console.error('Cannot create E-mail user', err))
|
||||
.then((emailUser) => {
|
||||
if (!emailUser) return;
|
||||
management
|
||||
.createUser({ connection: 'sms', phone_number: '+1234567890' })
|
||||
.catch(err => console.error('Cannot create SMS user', err))
|
||||
.then((smsUser) => {
|
||||
if (!smsUser) return;
|
||||
const userId = emailUser.user_id;
|
||||
const params = { user_id: smsUser.user_id, provider: 'sms' };
|
||||
management.linkUsers(userId, params)
|
||||
.catch(err => console.error('Cannot link E-mail and SMS users', err))
|
||||
.then((linkedUsers) => console.log(linkedUsers))
|
||||
})
|
||||
});
|
||||
|
||||
auth
|
||||
.requestChangePasswordEmail({
|
||||
connection: 'My-Connection',
|
||||
@@ -141,3 +160,12 @@ management.createPasswordChangeTicket({
|
||||
}, (err: Error, data) => {
|
||||
console.log(data.ticket);
|
||||
});
|
||||
|
||||
// Link users
|
||||
management.linkUsers('primaryId', { user_id: 'secondaryId' })
|
||||
.then((result: any) => console.log(result));
|
||||
|
||||
// Link users with callback
|
||||
management.linkUsers('primaryId', { user_id: 'secondaryId' },
|
||||
(err: Error, result: any) => {});
|
||||
|
||||
|
||||
Vendored
+142
-6
@@ -1,4 +1,4 @@
|
||||
// Type definitions for auth0 2.7
|
||||
// Type definitions for auth0 2.9.1
|
||||
// Project: https://github.com/auth0/node-auth0
|
||||
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>, Amiram Korach <https://github.com/amiram>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -33,8 +33,13 @@ export interface RetryOptions {
|
||||
maxRetries?: number;
|
||||
}
|
||||
|
||||
export interface UserMetadata { }
|
||||
export interface AppMetadata { }
|
||||
export interface UserMetadata {
|
||||
[propName: string]: string
|
||||
}
|
||||
|
||||
export interface AppMetadata {
|
||||
[propName: string]: any
|
||||
}
|
||||
|
||||
export interface UserData {
|
||||
email?: string;
|
||||
@@ -345,6 +350,14 @@ export interface Identity {
|
||||
user_id: string;
|
||||
provider: string;
|
||||
isSocial: boolean;
|
||||
profileData?: {
|
||||
email?: string;
|
||||
email_verified?: boolean;
|
||||
name?: string;
|
||||
phone_number?: string;
|
||||
phone_verified?: boolean;
|
||||
request_language?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export interface AuthenticationClientOptions {
|
||||
@@ -462,7 +475,7 @@ export interface UnlinkAccountsResponse {
|
||||
profileData?: UnlinkAccountsResponseProfile
|
||||
}
|
||||
|
||||
export interface LinkAccountsData {
|
||||
export interface LinkAccountsParams {
|
||||
user_id: string;
|
||||
connection_id?: string;
|
||||
provider?: string;
|
||||
@@ -505,9 +518,72 @@ export interface EmailVerificationTicketOptions {
|
||||
result_url: string;
|
||||
}
|
||||
|
||||
export interface BaseClientOptions {
|
||||
baseUrl: string;
|
||||
clientId?: string;
|
||||
}
|
||||
|
||||
export interface OAuthClientOptions extends BaseClientOptions {
|
||||
clientSecret?: string;
|
||||
}
|
||||
|
||||
export interface DatabaseClientOptions extends BaseClientOptions {
|
||||
}
|
||||
|
||||
export interface PasswordLessClientOptions extends BaseClientOptions {
|
||||
}
|
||||
|
||||
export interface TokenManagerOptions extends BaseClientOptions {
|
||||
headers?: any;
|
||||
}
|
||||
export interface UsersOptions extends BaseClientOptions {
|
||||
headers?: any;
|
||||
}
|
||||
|
||||
export interface SignInOptions extends VerifyOptions {
|
||||
connection?: string;
|
||||
}
|
||||
|
||||
export interface SocialSignInOptions {
|
||||
access_token: string;
|
||||
connection: string;
|
||||
}
|
||||
|
||||
export interface SignInToken {
|
||||
access_token: string;
|
||||
id_token?: string;
|
||||
token_type?: string;
|
||||
expiry: number;
|
||||
}
|
||||
|
||||
export interface RequestSMSCodeOptions extends RequestSMSOptions {
|
||||
client_id: string;
|
||||
}
|
||||
|
||||
export type SendType = 'link' | 'code';
|
||||
export interface RequestEmailCodeOrLinkOptions {
|
||||
email: string;
|
||||
send: SendType
|
||||
}
|
||||
|
||||
export interface ImpersonateSettingOptions {
|
||||
impersonator_id: string;
|
||||
protocol: string;
|
||||
token: string;
|
||||
clientId?: string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
export class AuthenticationClient {
|
||||
|
||||
// Members
|
||||
database?: DatabaseAuthenticator;
|
||||
oauth?: OAuthAuthenticator;
|
||||
passwordless?: PasswordlessAuthenticator;
|
||||
tokens?: TokenManager;
|
||||
users?: UsersManager;
|
||||
|
||||
constructor(options: AuthenticationClientOptions);
|
||||
getClientInfo(): ClientInfo;
|
||||
|
||||
@@ -664,8 +740,8 @@ export class ManagementClient {
|
||||
unlinkUsers(params: UnlinkAccountsParams): Promise<UnlinkAccountsResponse>;
|
||||
unlinkUsers(params: UnlinkAccountsParams, cb: (err: Error, data: UnlinkAccountsResponse) => void): void;
|
||||
|
||||
linkUsers(params: ObjectWithId, data: LinkAccountsData): Promise<any>;
|
||||
linkUsers(params: ObjectWithId, data: LinkAccountsData, cb: (err: Error, data: any) => void): void;
|
||||
linkUsers(userId: string, params: LinkAccountsParams): Promise<any>;
|
||||
linkUsers(userId: string, params: LinkAccountsParams, cb: (err: Error, data: any) => void): void;
|
||||
|
||||
|
||||
// Tokens
|
||||
@@ -747,3 +823,63 @@ export class ManagementClient {
|
||||
updateResourceServer(params: ObjectWithId, data: ResourceServer): Promise<ResourceServer>;
|
||||
updateResourceServer(params: ObjectWithId, data: ResourceServer, cb?: (err: Error, data: ResourceServer) => void): void;
|
||||
}
|
||||
|
||||
|
||||
export class DatabaseAuthenticator {
|
||||
constructor(options: DatabaseClientOptions, oauth: OAuthAuthenticator);
|
||||
|
||||
changePassword(data: ResetPasswordOptions): Promise<any>;
|
||||
changePassword(data: ResetPasswordOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
requestChangePasswordEmail(data: ResetPasswordEmailOptions): Promise<any>;
|
||||
requestChangePasswordEmail(data: ResetPasswordEmailOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
signIn(data: SignInOptions): Promise<SignInToken>;
|
||||
signIn(data: SignInOptions, cb: (err: Error, data: SignInToken) => void): void;
|
||||
|
||||
signUp(data: CreateUserData): Promise<User>;
|
||||
signIn(data: CreateUserData, cb: (err: Error, data: User) => void): void;
|
||||
|
||||
}
|
||||
|
||||
export class OAuthAuthenticator {
|
||||
constructor(options: OAuthClientOptions);
|
||||
|
||||
passwordGrant(options: PasswordGrantOptions): Promise<SignInToken>;
|
||||
passwordGrant(options: PasswordGrantOptions, cb: (err: Error, response: SignInToken) => void): void;
|
||||
|
||||
signIn(data: SignInOptions): Promise<SignInToken>;
|
||||
signIn(data: SignInOptions, cb: (err: Error, data: SignInToken) => void): void;
|
||||
|
||||
|
||||
socialSignIn(data: SocialSignInOptions): Promise<SignInToken>;
|
||||
socialSignIn(data: SocialSignInOptions, cb: (err: Error, data: SignInToken) => void): void;
|
||||
}
|
||||
|
||||
export class PasswordlessAuthenticator {
|
||||
constructor(options: PasswordLessClientOptions, oauth: OAuthAuthenticator);
|
||||
|
||||
signIn(data: SignInOptions): Promise<SignInToken>;
|
||||
signIn(data: SignInOptions, cb: (err: Error, data: SignInToken) => void): void;
|
||||
|
||||
sendEmail(data: RequestEmailCodeOrLinkOptions): Promise<any>;
|
||||
sendEmail(data: RequestEmailCodeOrLinkOptions, cb: (err: Error, message: string) => void): void;
|
||||
|
||||
sendSMS(data: RequestSMSCodeOptions): Promise<any>;
|
||||
sendSMS(data: RequestSMSCodeOptions, cb: (err: Error, message: string) => void): void;
|
||||
}
|
||||
|
||||
export class TokenManager {
|
||||
constructor(options: TokenManagerOptions);
|
||||
|
||||
}
|
||||
|
||||
export class UsersManager {
|
||||
constructor(options: UsersOptions);
|
||||
|
||||
getInfo(accessToken: string): Promise<User>;
|
||||
getInfo(accessToken: string, cb: (err: Error, user: User) => void): void;
|
||||
|
||||
impersonate(userId: string, settings: ImpersonateSettingOptions): Promise<any>;
|
||||
impersonate(userId: string, settings: ImpersonateSettingOptions, cb: (err: Error, data: any) => void): void;
|
||||
}
|
||||
@@ -11,6 +11,7 @@ new Awesomplete(input, {
|
||||
|
||||
const awesomplete = new Awesomplete(input);
|
||||
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
|
||||
awesomplete.destroy();
|
||||
|
||||
new Awesomplete(input, {
|
||||
list: [
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user