realm
Version:
Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores
81 lines • 2.84 kB
JavaScript
"use strict";
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2023 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.
//
////////////////////////////////////////////////////////////////////////////
Object.defineProperty(exports, "__esModule", { value: true });
exports.Subscription = void 0;
/**
* Class representing a single query subscription in a set of flexible sync
* {@link SubscriptionSet}. This class contains readonly information about the
* subscription – any changes to the set of subscriptions must be carried out
* in a {@link SubscriptionSet.update} callback.
*/
class Subscription {
internal;
/** @internal */
constructor(/** @internal */ internal) {
this.internal = internal;
this.internal = internal;
}
/**
* The ObjectId of the subscription.
* @returns The ObjectId of the subscription.
*/
get id() {
return this.internal.id;
}
/**
* The date when this subscription was created.
* @returns The date when this subscription was created.
*/
get createdAt() {
return this.internal.createdAt.toDate();
}
/**
* The date when this subscription was last updated.
* @returns The date when this subscription was last updated.
*/
get updatedAt() {
return this.internal.updatedAt.toDate();
}
/**
* The name given to this subscription when it was created.
* If no name was set, this will be `null`.
* @returns The name of the subscription or `null` if unnamed.
*/
get name() {
const result = this.internal.name;
return result === undefined ? null : result;
}
/**
* The type of objects the subscription refers to.
* @returns The type of objects the subscription refers to.
*/
get objectType() {
return this.internal.objectClassName;
}
/**
* The string representation of the query the subscription was created with.
* If no filter or sort was specified, this will be `"TRUEPREDICATE"`.
* @returns The string representation of the query the subscription was created with.
*/
get queryString() {
return this.internal.queryString;
}
}
exports.Subscription = Subscription;
//# sourceMappingURL=Subscription.js.map