@apollo-annotation/shared 0.1.17 → 0.1.19

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.
@@ -30,7 +30,7 @@ interface SerializedLocationEndChangeMultiple
30
30
  changes: LocationEndChangeDetails[]
31
31
  }
32
32
 
33
- type SerializedLocationEndChange =
33
+ export type SerializedLocationEndChange =
34
34
  | SerializedLocationEndChangeSingle
35
35
  | SerializedLocationEndChangeMultiple
36
36
 
@@ -80,7 +80,9 @@ export class LocationEndChange extends FeatureChange {
80
80
  throw new Error(errMsg)
81
81
  // throw new NotFoundException(errMsg) -- This is causing runtime error because Exception comes from @nestjs/common!!!
82
82
  }
83
- logger.debug?.(`*** Feature found: ${JSON.stringify(topLevelFeature)}`)
83
+ logger.debug?.(
84
+ `*** TOP level feature found: ${JSON.stringify(topLevelFeature)}`,
85
+ )
84
86
 
85
87
  const foundFeature = this.getFeatureFromId(topLevelFeature, featureId)
86
88
  if (!foundFeature) {
@@ -89,28 +91,33 @@ export class LocationEndChange extends FeatureChange {
89
91
  throw new Error(errMsg)
90
92
  }
91
93
  logger.debug?.(`*** Found feature: ${JSON.stringify(foundFeature)}`)
92
- if (
93
- foundFeature.discontinuousLocations &&
94
- foundFeature.discontinuousLocations.length > 0
95
- ) {
96
- const errMsg =
97
- 'Must use "DiscontinuousLocationEndChange" to change a feature end that has discontinuous locations'
98
- logger.error(errMsg)
99
- throw new Error(errMsg)
100
- }
101
- if (foundFeature.end !== oldEnd) {
102
- const errMsg = `*** ERROR: Feature's current end value ${foundFeature.end} doesn't match with expected value ${oldEnd}`
103
- logger.error(errMsg)
104
- throw new Error(errMsg)
94
+ if (foundFeature.max === oldEnd) {
95
+ featuresForChanges.push({ feature: foundFeature, topLevelFeature })
96
+ } else {
97
+ if (foundFeature.children) {
98
+ for (const [, childFeature] of foundFeature.children) {
99
+ if (childFeature.max === oldEnd) {
100
+ logger.debug?.(
101
+ `*************** UPDATE CHILD FEATURE ID= ${featureId}, CHILD: ${JSON.stringify(
102
+ childFeature,
103
+ )}`,
104
+ )
105
+ featuresForChanges.push({
106
+ feature: childFeature,
107
+ topLevelFeature,
108
+ })
109
+ break
110
+ }
111
+ }
112
+ }
105
113
  }
106
- featuresForChanges.push({ feature: foundFeature, topLevelFeature })
107
114
  }
108
115
 
109
116
  // Let's update objects.
110
117
  for (const [idx, change] of changes.entries()) {
111
118
  const { newEnd } = change
112
119
  const { feature, topLevelFeature } = featuresForChanges[idx]
113
- feature.end = newEnd
120
+ feature.max = newEnd
114
121
  if (topLevelFeature._id.equals(feature._id)) {
115
122
  topLevelFeature.markModified('end') // Mark as modified. Without this save() -method is not updating data in database
116
123
  } else {
@@ -144,7 +151,7 @@ export class LocationEndChange extends FeatureChange {
144
151
  if (!feature) {
145
152
  throw new Error(`Could not find feature with identifier "${changedId}"`)
146
153
  }
147
- feature.setEnd(this.changes[idx].newEnd)
154
+ feature.setMax(this.changes[idx].newEnd)
148
155
  }
149
156
  }
150
157
 
@@ -30,7 +30,7 @@ interface SerializedLocationStartChangeMultiple
30
30
  changes: LocationStartChangeDetails[]
31
31
  }
32
32
 
33
- type SerializedLocationStartChange =
33
+ export type SerializedLocationStartChange =
34
34
  | SerializedLocationStartChangeSingle
35
35
  | SerializedLocationStartChangeMultiple
36
36
 
@@ -80,7 +80,9 @@ export class LocationStartChange extends FeatureChange {
80
80
  throw new Error(errMsg)
81
81
  // throw new NotFoundException(errMsg) -- This is causing runtime error because Exception comes from @nestjs/common!!!
82
82
  }
83
- logger.debug?.(`*** Feature found: ${JSON.stringify(topLevelFeature)}`)
83
+ logger.debug?.(
84
+ `*** TOP level feature found: ${JSON.stringify(topLevelFeature)}`,
85
+ )
84
86
 
85
87
  const foundFeature = this.getFeatureFromId(topLevelFeature, featureId)
86
88
  if (!foundFeature) {
@@ -89,28 +91,33 @@ export class LocationStartChange extends FeatureChange {
89
91
  throw new Error(errMsg)
90
92
  }
91
93
  logger.debug?.(`*** Found feature: ${JSON.stringify(foundFeature)}`)
92
- if (
93
- foundFeature.discontinuousLocations &&
94
- foundFeature.discontinuousLocations.length > 0
95
- ) {
96
- const errMsg =
97
- 'Must use "DiscontinuousLocationStartChange" to change a feature start that has discontinuous locations'
98
- logger.error(errMsg)
99
- throw new Error(errMsg)
100
- }
101
- if (foundFeature.start !== oldStart) {
102
- const errMsg = `*** ERROR: Feature's current start value ${foundFeature.start} doesn't match with expected value ${oldStart}`
103
- logger.error(errMsg)
104
- throw new Error(errMsg)
94
+ if (foundFeature.min === oldStart) {
95
+ featuresForChanges.push({ feature: foundFeature, topLevelFeature })
96
+ } else {
97
+ if (foundFeature.children) {
98
+ for (const [, childFeature] of foundFeature.children) {
99
+ if (childFeature.min === oldStart) {
100
+ logger.debug?.(
101
+ `*** UPDATE CHILD FEATURE ID= ${featureId}, CHILD: ${JSON.stringify(
102
+ childFeature,
103
+ )}`,
104
+ )
105
+ featuresForChanges.push({
106
+ feature: childFeature,
107
+ topLevelFeature,
108
+ })
109
+ break
110
+ }
111
+ }
112
+ }
105
113
  }
106
- featuresForChanges.push({ feature: foundFeature, topLevelFeature })
107
114
  }
108
115
 
109
116
  // Let's update objects.
110
117
  for (const [idx, change] of changes.entries()) {
111
118
  const { newStart } = change
112
119
  const { feature, topLevelFeature } = featuresForChanges[idx]
113
- feature.start = newStart
120
+ feature.min = newStart
114
121
  if (topLevelFeature._id.equals(feature._id)) {
115
122
  topLevelFeature.markModified('start') // Mark as modified. Without this save() -method is not updating data in database
116
123
  } else {
@@ -144,7 +151,7 @@ export class LocationStartChange extends FeatureChange {
144
151
  if (!feature) {
145
152
  throw new Error(`Could not find feature with identifier "${changedId}"`)
146
153
  }
147
- feature.setStart(this.changes[idx].newStart)
154
+ feature.setMin(this.changes[idx].newStart)
148
155
  }
149
156
  }
150
157
 
@@ -29,7 +29,7 @@ interface SerializedTypeChangeMultiple extends SerializedTypeChangeBase {
29
29
  changes: TypeChangeDetails[]
30
30
  }
31
31
 
32
- type SerializedTypeChange =
32
+ export type SerializedTypeChange =
33
33
  | SerializedTypeChangeSingle
34
34
  | SerializedTypeChangeMultiple
35
35
 
@@ -3,12 +3,12 @@ import { AddAssemblyFromExternalChange } from './AddAssemblyFromExternalChange'
3
3
  import { AddAssemblyFromFileChange } from './AddAssemblyFromFileChange'
4
4
  import { AddFeatureChange } from './AddFeatureChange'
5
5
  import { AddFeaturesFromFileChange } from './AddFeaturesFromFileChange'
6
+ import { AddRefSeqAliasesChange } from './AddRefSeqAliasesChange'
6
7
  import { DeleteAssemblyChange } from './DeleteAssemblyChange'
7
8
  import { DeleteFeatureChange } from './DeleteFeatureChange'
8
9
  import { DeleteUserChange } from './DeleteUserChange'
9
- import { DiscontinuousLocationEndChange } from './DiscontinuousLocationEndChange'
10
- import { DiscontinuousLocationStartChange } from './DiscontinuousLocationStartChange'
11
10
  import { FeatureAttributeChange } from './FeatureAttributeChange'
11
+ import { ImportJBrowseConfigChange } from './ImportJBrowseConfigChange'
12
12
  import { LocationEndChange } from './LocationEndChange'
13
13
  import { LocationStartChange } from './LocationStartChange'
14
14
  import { StrandChange } from './StrandChange'
@@ -24,14 +24,14 @@ export const changes = {
24
24
  DeleteAssemblyChange,
25
25
  DeleteFeatureChange,
26
26
  DeleteUserChange,
27
- DiscontinuousLocationEndChange,
28
- DiscontinuousLocationStartChange,
29
27
  FeatureAttributeChange,
28
+ ImportJBrowseConfigChange,
30
29
  LocationEndChange,
31
30
  LocationStartChange,
32
31
  StrandChange,
33
32
  TypeChange,
34
33
  UserChange,
34
+ AddRefSeqAliasesChange,
35
35
  }
36
36
 
37
37
  export * from './AddAssemblyAndFeaturesFromFileChange'
@@ -42,11 +42,11 @@ export * from './AddFeaturesFromFileChange'
42
42
  export * from './DeleteAssemblyChange'
43
43
  export * from './DeleteFeatureChange'
44
44
  export * from './DeleteUserChange'
45
- export * from './DiscontinuousLocationEndChange'
46
- export * from './DiscontinuousLocationStartChange'
47
45
  export * from './FeatureAttributeChange'
46
+ export * from './ImportJBrowseConfigChange'
48
47
  export * from './LocationEndChange'
49
48
  export * from './LocationStartChange'
50
49
  export * from './StrandChange'
51
50
  export * from './TypeChange'
52
51
  export * from './UserChange'
52
+ export * from './AddRefSeqAliasesChange'