ord-schema 0.3.40 → 0.3.41-rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -15,5 +15,7 @@
15
15
  */
16
16
 
17
17
  "use strict";
18
- exports.dataset_pb = require('./proto/dataset_pb');
19
- exports.reaction_pb = require('./proto/reaction_pb');
18
+ module.exports = {
19
+ ...require('./proto/dataset_pb'),
20
+ ...require('./proto/reaction_pb'),
21
+ };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ord-schema",
3
- "version": "0.3.40",
3
+ "version": "0.3.41-rc2",
4
4
  "description": "Schema for the Open Reaction Database",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,7 +17,9 @@
17
17
  },
18
18
  "homepage": "https://open-reaction-database.org",
19
19
  "dependencies": {
20
- "google-protobuf": "<3.20",
20
+ "google-protobuf": "<3.20"
21
+ },
22
+ "devDependencies": {
21
23
  "jest": "^29.3.1"
22
24
  }
23
25
  }
@@ -14,28 +14,28 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- const ord_schema = require('..');
17
+ const ord = require('..');
18
18
 
19
19
  test('round-trip', () => {
20
- const dataset = new ord_schema.dataset_pb.Dataset();
20
+ const dataset = new ord.Dataset();
21
21
  dataset.setName('test');
22
22
  dataset.setDescription('test dataset');
23
23
  // Add a reaction directly to the dataset.
24
24
  const reaction1 = dataset.addReactions();
25
25
  const identifier1 = reaction1.addIdentifiers();
26
26
  identifier1.setValue('C(C)Cl.Br>>C(C)Br.Cl');
27
- identifier1.setType(ord_schema.reaction_pb.ReactionIdentifier.ReactionIdentifierType.REACTION_SMILES);
27
+ identifier1.setType(ord.ReactionIdentifier.ReactionIdentifierType.REACTION_SMILES);
28
28
  // Copy a reaction created elsewhere.
29
- const reaction2 = new ord_schema.reaction_pb.Reaction();
29
+ const reaction2 = new ord.Reaction();
30
30
  const identifier2 = reaction2.addIdentifiers();
31
31
  identifier2.setValue('amide coupling');
32
- identifier2.setType(ord_schema.reaction_pb.ReactionIdentifier.ReactionIdentifierType.NAME);
32
+ identifier2.setType(ord.ReactionIdentifier.ReactionIdentifierType.NAME);
33
33
  dataset.addReactions(reaction2);
34
34
  const serialized = dataset.serializeBinary();
35
- const other = ord_schema.dataset_pb.Dataset.deserializeBinary(serialized);
35
+ const other = ord.Dataset.deserializeBinary(serialized);
36
36
  expect(other.getName()).toBe('test');
37
37
  expect(other.getDescription()).toBe('test dataset');
38
38
  expect(other.getReactionsList()).toHaveLength(2);
39
- expect(other.getReactionsList()[0].getIdentifiersList()[0].getType()).toBe(ord_schema.reaction_pb.ReactionIdentifier.ReactionIdentifierType.REACTION_SMILES);
40
- expect(other.getReactionsList()[1].getIdentifiersList()[0].getType()).toBe(ord_schema.reaction_pb.ReactionIdentifier.ReactionIdentifierType.NAME);
39
+ expect(other.getReactionsList()[0].getIdentifiersList()[0].getType()).toBe(ord.ReactionIdentifier.ReactionIdentifierType.REACTION_SMILES);
40
+ expect(other.getReactionsList()[1].getIdentifiersList()[0].getType()).toBe(ord.ReactionIdentifier.ReactionIdentifierType.NAME);
41
41
  });
@@ -14,13 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- const ord_schema = require('..');
17
+ const ord = require('..');
18
18
 
19
19
  test('simple', () => {
20
- const reaction = new ord_schema.reaction_pb.Reaction();
20
+ const reaction = new ord.Reaction();
21
21
  const identifier = reaction.addIdentifiers();
22
22
  identifier.setValue('C(C)Cl.Br>>C(C)Br.Cl');
23
- identifier.setType(ord_schema.reaction_pb.ReactionIdentifier.ReactionIdentifierType.REACTION_SMILES);
23
+ identifier.setType(ord.ReactionIdentifier.ReactionIdentifierType.REACTION_SMILES);
24
24
  expect(reaction.getIdentifiersList()).toHaveLength(1);
25
25
  expect(reaction.getSetup()).toBeUndefined();
26
26
  });