• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-js / 5133612036

31 May 2023 01:41PM UTC coverage: 85.686%. First build
5133612036

push

github

takameyer
Fix warning for deprecated namespace setting method in Android

* Fixes #5646

829 of 1032 branches covered (80.33%)

Branch coverage included in aggregate %.

2218 of 2524 relevant lines covered (87.88%)

744.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
/packages/realm/src/decorators.ts
1
////////////////////////////////////////////////////////////////////////////
2
//
3
// Copyright 2023 Realm Inc.
4
//
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing, software
12
// distributed under the License is distributed on an "AS IS" BASIS,
13
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
16
//
17
////////////////////////////////////////////////////////////////////////////
18

19
/**
20
 * Decorators are not intended to be used at runtime and are removed from the source
21
 * by @realm/babel-plugin. Therefore, if a decorator is called, this means it is being
22
 * used outside of @realm/babel-plugin (or the plugin is incorrectly configured), so
23
 * we should throw
24
 */
25
class DecoratorError extends Error {
26
  constructor(name: string) {
27
    super(
×
28
      `The @${name} decorator cannot be used without the \`@realm/babel-plugin\` Babel plugin. Please check that you have installed and configured the Babel plugin.`,
29
    );
30
  }
31
}
32

33
export type IndexDecorator = (target: unknown, memberName: string) => void;
34

35
/**
36
 * Specify that the decorated field should be indexed by Realm.
37
 * See: [documentation](https://www.mongodb.com/docs/realm/sdk/react-native/examples/define-a-realm-object-model/#index-a-property)
38
 */
39
export const index: IndexDecorator = () => {
1✔
40
  throw new DecoratorError("index");
×
41
};
42

43
export type MapToDecorator = (realmPropertyName: string) => (target: unknown, memberName: string) => void;
44

45
/**
46
 * Specify that the decorated field should be remapped to a different property name in the Realm database.
47
 * See: [documentation](https://www.mongodb.com/docs/realm/sdk/react-native/examples/define-a-realm-object-model/#remap-a-property)
48
 *
49
 * @param realmPropertyName The name of the property in the Realm database
50
 */
51
export const mapTo = () => {
1✔
52
  throw new DecoratorError("mapTo");
×
53
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc