@react-native-ohos/realm
Version:
Realm by MongoDB is an offline-first mobile database: an alternative to SQLite and key-value stores
50 lines • 2.23 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.mapTo = exports.index = void 0;
/**
* Decorators are not intended to be used at runtime and are removed from the source
* by @realm/babel-plugin. Therefore, if a decorator is called, this means it is being
* used outside of @realm/babel-plugin (or the plugin is incorrectly configured), so
* we should throw
*/
class DecoratorError extends Error {
constructor(name) {
super(`The @${name} decorator cannot be used without the \`@realm/babel-plugin\` Babel plugin. Please check that you have installed and configured the Babel plugin.`);
}
}
/**
* Specify that the decorated field should be indexed by Realm.
* See: [documentation](https://www.mongodb.com/docs/realm/sdk/react-native/examples/define-a-realm-object-model/#index-a-property)
*/
const index = () => {
throw new DecoratorError("index");
};
exports.index = index;
/**
* Specify that the decorated field should be remapped to a different property name in the Realm database.
* See: [documentation](https://www.mongodb.com/docs/realm/sdk/react-native/examples/define-a-realm-object-model/#remap-a-property)
* @param propertyName The name of the property in the Realm database
*/
/* eslint-disable-next-line @typescript-eslint/no-unused-vars -- We don't read this at runtime */
const mapTo = (propertyName) => {
throw new DecoratorError("mapTo");
};
exports.mapTo = mapTo;
//# sourceMappingURL=decorators.js.map