Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
var exports = module.exports;
/**
* Table client exports.
* @ignore
*/
var storage = require('azure-storage');
var TableService = storage.TableService;
exports.TableService = TableService;
exports.TableQuery = storage.TableQuery;
/**
* Creates a new {@link TableService} object.
* If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables will be used.
*
* @param {string} [storageAccountOrConnectionString] The storage account or the connection string.
* @param {string} [storageAccessKey] The storage access key.
* @param {string} [host] The host address.
* @param {object} [authenticationProvider] The authentication provider.
* @return {TableService} A new TableService object.
*
*/
exports.createTableService = function (storageAccountOrConnectionString, storageAccessKey, host, authenticationProvider) {
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
var exports = module.exports;
/**
* Table client exports.
* @ignore
*/
var storage = require('azure-storage');
var TableService = storage.TableService;
exports.TableService = TableService;
exports.TableUtilities = storage.TableUtilities;
exports.TableQuery = storage.TableQuery;
exports.TableBatch = storage.TableBatch;
/**
* Creates a new {@link TableService} object.
* If no storageaccount or storageaccesskey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables will be used.
*
* @method
* @param {string} [storageAccountOrConnectionString] The storage account or the connection string.
* @param {string} [storageAccessKey] The storage access key.
* @param {string} [host] The host address.
* @param {object} [authenticationProvider] The authentication provider.
* @return {TableService} A new TableService object.
* @tutorial getting-started
import 'dotenv/config'
import * as az from 'azure-storage'
import bluebird from 'bluebird'
export interface IAsyncTableService {
replaceEntityAsync (table: string, entity: any): Promise
queryEntitiesAsync (table: string, tableQuery: az.TableQuery, currentToken?: az.TableService.TableContinuationToken): Promise
deleteEntityAsync (table: string, entityDescriptor: any): Promise
insertEntityAsync (table: string, entityDescriptor: unknown, options?: az.TableService.InsertEntityRequestOptions): Promise
}
export class AsyncTableService extends az.TableService implements IAsyncTableService {
replaceEntityAsync (table: string, entity: any): Promise {
return this.replaceEntityAsync(table, entity)
}
queryEntitiesAsync (table: string, tableQuery: az.TableQuery, currentToken?: az.TableService.TableContinuationToken | undefined): Promise {
return this.queryEntitiesAsync(table, tableQuery, currentToken)
}
deleteEntityAsync (table: string, entityDescriptor: any): Promise {
return this.deleteEntityAsync(table, entityDescriptor)
}
insertEntityAsync (table: string, entityDescriptor: unknown, options?: az.TableService.InsertEntityRequestOptions | undefined): Promise {
return this.insertEntityAsync(table, entityDescriptor, options)
}
constructor () {
super()
bluebird.promisifyAll(this, {
promisifier: (originalFunction) => function (this: any, ...args) {
providers: [
{
provide: 'IMenteeRepository',
useClass: MenteeRepository,
},
{
provide: 'IMentorRepository',
useClass: MentorRepository,
},
{
provide: 'IUserRepository',
useClass: UserRepository,
},
{
provide: 'TableService',
useValue: new azurestorage.TableService('UseDevelopmentStorage=true'),
},
],
});
export { BoundaryModule };
import 'dotenv/config'
import * as az from 'azure-storage'
export interface IAsyncTableService {
replaceEntityAsync (table: string, entity: any): Promise
queryEntitiesAsync (table: string, tableQuery: az.TableQuery, currentToken: az.TableService.TableContinuationToken): Promise
deleteEntityAsync (table: string, entityDescriptor: any): Promise
insertEntityAsync (table: string, entityDescriptor: unknown, options?: az.TableService.InsertEntityRequestOptions): Promise
}
export class AsyncTableService extends az.TableService implements IAsyncTableService {
replaceEntityAsync (table: string, entity: any): Promise {
return new Promise((resolve, reject) => {
this.replaceEntity(table, entity, (error, result) => {
if (error) {
reject(error)
} else {
resolve(result)
}
})
})
}
queryEntitiesAsync (table: string, tableQuery: az.TableQuery, currentToken: az.TableService.TableContinuationToken): Promise {
return new Promise((resolve, reject) => {
this.queryEntities(table, tableQuery, currentToken, (error, result) => {
if (error) {