@awhere/api
Version:
The awesome aWhere API for JavaScript.
59 lines • 2.54 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var interfaces_1 = require("@awhere/interfaces");
var DbAdapter_1 = require("./DbAdapter");
var DbWatcher_1 = require("../DbWatcher");
var utils_1 = require("../utils");
var UnstructuredCollection = /** @class */ (function (_super) {
__extends(UnstructuredCollection, _super);
function UnstructuredCollection() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(UnstructuredCollection.prototype, "type", {
get: function () {
return interfaces_1.ItemType.databaseItem;
},
enumerable: false,
configurable: true
});
Object.defineProperty(UnstructuredCollection.prototype, "subtype", {
get: function () {
return this._subtype;
},
enumerable: false,
configurable: true
});
UnstructuredCollection.prototype.watchDb = function () {
var _this = this;
return new Promise(function (resolve, reject) {
_this.socket.open();
_this.socket.emit('call', "sub:/item/database", _this._id, function (err) {
if (err) {
return reject(err);
}
resolve(new DbWatcher_1.DbWatcher(_this.socket, _this._id));
});
});
};
UnstructuredCollection.generateDocumentId = utils_1.generateDocumentId;
UnstructuredCollection.generateHistoryDocumentId = utils_1.generateHistoryDocumentId;
UnstructuredCollection.generateAttachmentId = utils_1.generateAttachmentId;
return UnstructuredCollection;
}(DbAdapter_1.ReadWriteAdapter));
exports.default = UnstructuredCollection;
//# sourceMappingURL=UnstructuredCollection.js.map