diff --git a/notNeededPackages.json b/notNeededPackages.json index 9e0b2cd2aa..8e4292e091 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -54,6 +54,12 @@ "sourceRepoURL": "http://www.babylonjs.com/", "asOfVersion": "2.4.1" }, + { + "libraryName": "azure-mobile-apps", + "typingsPackageName": "azure-mobile-apps", + "sourceRepoURL": "https://github.com/Azure/azure-mobile-apps-node/", + "asOfVersion": "3.0.0" + }, { "libraryName": "camel-case", "typingsPackageName": "camel-case", diff --git a/types/azure-mobile-apps/azure-mobile-apps-tests.ts b/types/azure-mobile-apps/azure-mobile-apps-tests.ts deleted file mode 100644 index d653e0ae95..0000000000 --- a/types/azure-mobile-apps/azure-mobile-apps-tests.ts +++ /dev/null @@ -1,125 +0,0 @@ - - -import express = require('express'); -import mobileApps = require('azure-mobile-apps'); -import logger = require('azure-mobile-apps/src/logger'); -import queries = require('azure-mobile-apps/src/query'); - -var app = express(), - mobileApp = mobileApps(); - -// various configuration permutations -mobileApps({ - debug: true, - data: { - provider: 'mssql', - server: '', - user: '', - database: '', - password: '' - }, - webhook: { url: 'http://localhost/' } -}); - -mobileApps({ - data: { - provider: 'memory' - } -}) - -// it would be nice to integrate with winston -mobileApps({ logging: { level: 'silly', transports: [{}] } }) - -// various custom middleware syntaxes -mobileApp.use(function (req: any, res: any, next: any) { next(); }); -mobileApp.use([function () {}, function () {}]); -mobileApp.use(function () {}, function () {}); -mobileApp.use(function () {}).use(function () {}); - -// basic syntax for tables and api -mobileApp.tables.add('todoitem'); -mobileApp.tables.add('todoitem', { authorize: true }); -mobileApp.tables.add('todoitem', mobileApps.table()); -mobileApp.tables.import('tables'); -mobileApp.api.add('api', { authorize: true, get: function () {}, delete: function () {} }); -mobileApp.api.import('api'); - -// ensure the mobile app instance can be correctly mounted as an express router -app.use(mobileApp); - -// Express.Table, instantiated from the mobile app -var table = mobileApp.table() -table.use(function (req: Express.Request, res: Express.Response, next: any) { - next(new Error()); -}); -table.use([function () {}, function () {}]); -table.read(function (context: Azure.MobileApps.Context) { - context.query.where({ p1: 'test' }); - return context.execute() - .then(function (result: any) { - return result; - }) - .catch(function (error: any) { }) - .then(function () {}); -}); -table.insert(function (context: Azure.MobileApps.Context) { - context.query.id = 'anotherId'; - context.query.single = true; - context.item.userId = context.user.id; - context.push.send('tag', {}, function (error, result) {}); - context.push.gcm.send('tag', {}, function (error, result) {}); - context.push.apns.send('tag', { payload: { } }, function (error, result) {}); - context.push.wns.sendToastText01('tag', '', { headers: { } }, function (error, result) {}); - context.next(new Error()); - context.next('An error occurred'); -}); -table.read.use(function () {}); -table.read.use([function () {}, function () {}]); -table.read.use(function () {}, function () {}); -table.use(function () {}).use(function () {}).read(function () {}).use(function () {}); - -table.access = undefined; -table.access = 'authenticated'; -table.read.access = 'anonymous'; -table.update.access = 'disabled'; -table.delete.access = 'authenticated'; -table.insert.access = 'authenticated'; - -table.filters = [function (query, context) { }]; -table.transforms = [function (item, context) { }]; -table.hooks = [function (results, context) { }]; - -table.perUser = true; -table.recordsExpire = { milliseconds: 1, seconds: 1, minutes: 1, hours: 1, days: 1, weeks: 1, months: 1, years: 1 }; -table.webhook = { url: 'http://localhost/' } -table.webhook = true; - -// Express.Table, instantiated from the static require('azure-mobile-apps').table() -// This is going to be interesting if we ever support more than one provider -var table2 = mobileApps.table(); -table2.read(function (context: Azure.MobileApps.Context) {}); - -// ApiDefinition, from the static require('azure-mobile-apps').api() -var api2 = mobileApps.api({ - get: function (req, res, next) { } -}); -api2.post = function (req, res, next) {}; - -// Logger -logger.silly('test', 'message'); -logger.error('Something happened', new Error()); -mobileApps.logger.debug('a debug message') - -// Query -queries.create('table').where({ x: 10 }).select('col1,col2').includeDeleted().includeTotalCount(); -mobileApps.query.create('table'); - -// Custom SQL query -mobileApp.api.add('query', { authorize: true, get: (req, res, next) => { - req.azureMobile.data.execute({ - sql: "SELECT * FROM TODOITEM WHERE COMPLETE = :complete", - parameters: [ - { name: 'complete', value: 1 } - ] - }).then(x => {}); -}, delete: function () {} }); diff --git a/types/azure-mobile-apps/index.d.ts b/types/azure-mobile-apps/index.d.ts deleted file mode 100644 index 53dd5edae3..0000000000 --- a/types/azure-mobile-apps/index.d.ts +++ /dev/null @@ -1,326 +0,0 @@ -// Type definitions for azure-mobile-apps v2.1.7 -// Project: https://github.com/Azure/azure-mobile-apps-node/ -// Definitions by: Microsoft Azure -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - -/// - -declare module "azure-mobile-apps" { - interface AzureMobileApps { - (configuration?: Azure.MobileApps.Configuration): Azure.MobileApps.Platforms.Express.MobileApp; - table(): Azure.MobileApps.Platforms.Express.Table; - api(definition?: Azure.MobileApps.ApiDefinition): Azure.MobileApps.ApiDefinition; - logger: Azure.MobileApps.Logger; - query: Azure.MobileApps.Query; - } - - var out: AzureMobileApps; - export = out; -} -declare module "azure-mobile-apps/src/logger" { - var logger: Azure.MobileApps.Logger; - export = logger; -} - -declare module "azure-mobile-apps/src/query" { - var query: Azure.MobileApps.Query; - export = query; -} - -declare namespace Azure.MobileApps { - // the additional Platforms namespace is required to avoid collisions with the main Express namespace - export module Platforms { - export module Express { - interface MobileApp extends Middleware { - configuration: Configuration; - tables: Tables; - table(): Table; - api: Api; - use(...middleware: Middleware[]): MobileApp; - use(middleware: Middleware[]): MobileApp; - } - - interface Api { - add(name: string, definition: ApiDefinition): void; - import(fileOrFolder: string): void; - } - - interface Table extends TableDefinition { - use(...middleware: Middleware[]): Table; - use(middleware: Middleware[]): Table; - read: TableOperation; - update: TableOperation; - insert: TableOperation; - delete: TableOperation; - undelete: TableOperation; - } - - interface TableOperation { - (operationHandler: (context: Context) => void): Table; - use(...middleware: Middleware[]): Table; - use(middleware: Middleware[]): Table; - access?: AccessType; - } - - interface Tables { - configuration: Configuration; - add(name: string, definition?: Table | TableDefinition): void; - import(fileOrFolder: string): void; - initialize(): Thenable; - } - } - } - - export module Data { - interface Table { - read(query: QueryJs): Thenable; - update(item: any, query: QueryJs): Thenable; - insert(item: any): Thenable; - delete(query: QueryJs, version: string): Thenable; - undelete(query: QueryJs, version: string): Thenable; - truncate(): Thenable; - initialize(): Thenable; - schema(): Thenable; - } - - interface Column { - name: string; - type: string; - } - } - - // auth - interface User { - id: string; - claims: any[]; - token: string; - getIdentity(provider: string): Thenable; - } - - interface Auth { - validate(token: string): Thenable; - decode(token: string): User; - sign(payload: any): string; - } - - // configuration - interface Configuration { - platform?: string; - basePath?: string; - configFile?: string; - promiseConstructor?: (resolve: (result: any) => void, reject: (error: any) => void) => Thenable; - apiRootPath?: string; - tableRootPath?: string; - notificationRootPath?: string; - swaggerPath?: string; - authStubRoute?: string; - debug?: boolean; - version?: string; - apiVersion?: string; - homePage?: boolean; - swagger?: boolean; - maxTop?: number; - pageSize?: number; - logging?: Configuration.Logging; - data?: Configuration.Data; - auth?: Configuration.Auth; - cors?: Configuration.Cors; - notifications?: Configuration.Notifications; - webhook?: Webhook; - } - - export module Configuration { - // it would be nice to have the config for various providers in separate interfaces, - // but this is the simplest solution to support variations of the current setup - interface Data { - provider: string; - user?: string; - password?: string; - server?: string; - port?: number; - database?: string; - connectionTimeout?: string; - options?: { encrypt: boolean }; - schema?: string; - dynamicSchema?: boolean; - filename?: string; - } - - interface Auth { - secret: string; - validateTokens?: boolean; - } - - interface Logging { - level?: string; - transports?: LoggingTransport[]; - } - - interface LoggingTransport { } - - interface Cors { - exposeHeaders: string; - maxAge?: number; - hostnames: string[]; - } - - interface Notifications { - hubName: string; - connectionString?: string; - endpoint?: string; - sharedAccessKeyName?: string; - sharedAccessKeyValue?: string; - } - } - - // query - interface Query { - create(tableName: string): QueryJs; - fromRequest(req: Express.Request): QueryJs; - toOData(query: QueryJs): OData; - } - - interface QueryJs { - includeTotalCount(): QueryJs; - includeDeleted(): QueryJs; - orderBy(properties: string): QueryJs; - orderByDescending(properties: string): QueryJs; - select(properties: string): QueryJs; - skip(count: number): QueryJs; - take(count: number): QueryJs; - where(filter: any): QueryJs; - // these are properties added by the SDK - id?: string | number; - single?: boolean; - } - - interface OData { - table: string; - filters?: string; - ordering?: string; - orderClauses?: string; - skip?: number; - take?: number; - selections?: string; - includeTotalCount?: boolean; - } - - // general - var nh: Azure.ServiceBus.NotificationHubService; - - interface Context { - query: QueryJs; - id: string | number; - item: any; - req: Express.Request; - res: Express.Response; - data: ContextData; - tables: (tableName: string) => Data.Table; - user: User; - push: typeof nh; - logger: Logger; - execute(): Thenable; - next(error: string|Error): any; - } - - interface ContextData { - (table: TableDefinition): Data.Table; - execute(q: SqlQueryDefinition): Thenable; - } - - interface SqlQueryDefinition { - sql: string; - parameters?: SqlParameterDefinition[]; - } - - interface SqlParameterDefinition { - name: string; - value: any; - } - - interface TableDefinition { - access?: AccessType; - authorize?: boolean; - autoIncrement?: boolean; - columns?: any; - databaseTableName?: string; - dynamicSchema?: boolean; - maxTop?: number; - name?: string; - pageSize?: number; - schema?: string; - softDelete?: boolean; - userIdColumn?: string; - - filters?: [(query: QueryJs, context: Context) => void | QueryJs]; - transforms?: [(item: any, context: Context) => void | any]; - hooks?: [(results: any, context: Context) => void]; - - perUser?: boolean; - recordsExpire?: Duration; - webhook?: Webhook | boolean; - } - - type AccessType = 'anonymous' | 'authenticated' | 'disabled'; - - interface Duration { - milliseconds?: number; - seconds?: number; - minutes?: number; - hours?: number; - days?: number; - weeks?: number; - months?: number; - years?: number; - } - - interface Webhook { - url: string; - } - - interface ApiDefinition { - authorize?: boolean; - get?: Middleware | Middleware[]; - post?: Middleware | Middleware[]; - patch?: Middleware | Middleware[]; - put?: Middleware | Middleware[]; - delete?: Middleware | Middleware[]; - } - - interface Thenable { - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => U | Thenable): Thenable; - then(onFulfilled?: (value: R) => U | Thenable, onRejected?: (error: any) => void): Thenable; - catch(onRejected?: (error: any) => U | Thenable): Thenable; - catch(onRejected?: (error: any) => void): Thenable; - } - - interface Logger { - log(level: string, ...message: any[]): void; - silly(...message: any[]): void; - debug(...message: any[]): void; - verbose(...message: any[]): void; - info(...message: any[]): void; - warn(...message: any[]): void; - error(...message: any[]): void; - } - - interface Middleware { - (req: Express.Request, res: Express.Response, next: NextMiddleware): void; - } - - interface NextMiddleware { - (error?: any): void; - } -} - -// additions to the Express modules -declare namespace Express { - interface Request { - azureMobile: Azure.MobileApps.Context - } - - interface Response { - results?: any; - } -} diff --git a/types/azure-mobile-apps/tsconfig.json b/types/azure-mobile-apps/tsconfig.json deleted file mode 100644 index ae1ae9db7b..0000000000 --- a/types/azure-mobile-apps/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "azure-mobile-apps-tests.ts" - ] -} \ No newline at end of file