documentdb-typescript
Advanced tools
Comparing version
// export all transpiled code | ||
module.exports = require("./js"); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -131,2 +131,4 @@ "use strict"; | ||
} | ||
/** Global concurrency limit for all server requests */ | ||
Client.concurrencyLimit = 25; | ||
exports.Client = Client; |
@@ -158,7 +158,11 @@ "use strict"; | ||
case StoreMode.CreateOnly: | ||
tryStore = (callback) => this.database.client.log("Creating document: " + data.id) && | ||
tryStore = (callback) => this.database.client.log("Creating document: " + | ||
(data.id !== undefined && data.id !== "" ? data.id : | ||
"(auto generated ID)")) && | ||
this.database.client.documentClient.createDocument(this._self, data, undefined, callback); | ||
break; | ||
default: | ||
tryStore = (callback) => this.database.client.log("Upserting document: " + data.id) && | ||
tryStore = (callback) => this.database.client.log("Upserting document: " + | ||
(data.id !== undefined && data.id !== "" ? data.id : | ||
"(auto generated ID)")) && | ||
this.database.client.documentClient.upsertDocument(this._self, data, undefined, callback); | ||
@@ -165,0 +169,0 @@ } |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -5,6 +5,4 @@ "use strict"; | ||
} | ||
var Util_1 = require("./Util"); | ||
exports.concurrencyLimit = Util_1.concurrencyLimit; | ||
__export(require("./Client")); | ||
__export(require("./Database")); | ||
__export(require("./Collection")); |
"use strict"; | ||
/** Maximum number of concurrent pending requests */ | ||
exports.concurrencyLimit = 25; | ||
const Client_1 = require("./Client"); | ||
/** Current number of pending requests */ | ||
@@ -16,3 +15,3 @@ var _pending = 0; | ||
if (!started) { | ||
if (_pending >= exports.concurrencyLimit) { | ||
if (_pending >= Client_1.Client.concurrencyLimit) { | ||
setTimeout(exec, retryTimer || 100, resolve, reject); | ||
@@ -19,0 +18,0 @@ return; |
{ | ||
"name": "documentdb-typescript", | ||
"version": "0.0.3", | ||
"version": "0.1.0", | ||
"description": "TypeScript API for Microsoft DocumentDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,2 +21,4 @@ # DocumentDB TypeScript API | ||
Tests are sorely needed as well. Perhaps some of the tests can be ported over from DocumentDB itself. | ||
## Installation | ||
@@ -52,3 +54,2 @@ Use `npm` to install this module (TypeScript optional): | ||
- `StoreMode` enum: lists different modes of storing documents in a collection. | ||
- `concurrencyLimit` (number): controls how many requests should be outstanding *globally* at any time; defaults to 25. | ||
@@ -65,2 +66,4 @@ *Where is Document?* — | ||
var client = new Client(url, masterKey); | ||
// enable logging of all operations to the console | ||
client.enableConsoleLog = true; | ||
@@ -82,4 +85,6 @@ | ||
The original DocumentClient from the `documentdb` module is kept in the `documentClient` property, after the `openAsync` method is called. | ||
The original DocumentClient from the `documentdb` module is kept in the `documentClient` property, after the `openAsync` method is called: | ||
A static property `Client.concurrencyLimit` (number) controls how many requests may be outstanding *globally* at any time; this defaults to 25. Further requests are held internally (without timing out) until a pending request completes. You may want to increase this number if you are performing a high volume of low-cost operations such as deletions. | ||
## `Database` | ||
@@ -86,0 +91,0 @@ Start here if you need to list all collections in a database, or delete it from the account. Nothing else here. |
@@ -0,0 +0,0 @@ export declare namespace _DocumentDB { |
@@ -6,2 +6,4 @@ import { _DocumentDB } from "./_DocumentDB"; | ||
constructor(url?: string, masterKey?: string); | ||
/** Global concurrency limit for all server requests */ | ||
static concurrencyLimit: number; | ||
/** Set to true to log all requests to the console */ | ||
@@ -8,0 +10,0 @@ enableConsoleLog: boolean; |
@@ -0,0 +0,0 @@ import { _DocumentDB } from "./_DocumentDB"; |
@@ -0,0 +0,0 @@ import { Client } from "./Client"; |
@@ -0,0 +0,0 @@ import { _DocumentDB } from "./_DocumentDB"; |
@@ -1,4 +0,3 @@ | ||
export { concurrencyLimit } from "./Util"; | ||
export * from "./Client"; | ||
export * from "./Database"; | ||
export * from "./Collection"; |
@@ -1,3 +0,1 @@ | ||
/** Maximum number of concurrent pending requests */ | ||
export declare var concurrencyLimit: number; | ||
/** Return a curried version of given function that appends a callback as a last parameter, which rejects or resolves a promise; the promise is returned immediately; also handles DocumentDB errors when possible */ | ||
@@ -4,0 +2,0 @@ export declare function curryPromise<T>(f: Function, timeout?: number, maxRetries?: number, retryTimer?: number): (...args: any[]) => PromiseLike<T>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1021
0.2%280
1.82%61829
-1.22%