@apollo-annotation/common 0.3.10 → 0.3.11
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type AnnotationFeatureSnapshot } from '@apollo-annotation/mst';
|
|
2
|
+
import { type Feature } from '@apollo-annotation/schemas';
|
|
2
3
|
import { Change, type ChangeOptions, type SerializedChange } from './Change';
|
|
3
4
|
export interface SerializedAssemblySpecificChange extends SerializedChange {
|
|
4
5
|
assembly: string;
|
|
@@ -7,5 +8,5 @@ export declare function isAssemblySpecificChange(thing: any): thing is AssemblyS
|
|
|
7
8
|
export declare abstract class AssemblySpecificChange extends Change {
|
|
8
9
|
assembly: string;
|
|
9
10
|
constructor(json: SerializedAssemblySpecificChange, options?: ChangeOptions);
|
|
10
|
-
getIndexedIds(feature: AnnotationFeatureSnapshot, idsToIndex: string[] | undefined): string[];
|
|
11
|
+
getIndexedIds(feature: AnnotationFeatureSnapshot | Feature, idsToIndex: string[] | undefined): string[];
|
|
11
12
|
}
|
|
@@ -14,16 +14,22 @@ class AssemblySpecificChange extends Change_1.Change {
|
|
|
14
14
|
this.assembly = json.assembly;
|
|
15
15
|
}
|
|
16
16
|
getIndexedIds(feature, idsToIndex) {
|
|
17
|
-
var _a;
|
|
18
17
|
const indexedIds = [];
|
|
19
18
|
for (const additionalId of idsToIndex !== null && idsToIndex !== void 0 ? idsToIndex : []) {
|
|
20
|
-
const
|
|
19
|
+
const { attributes } = feature;
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
21
|
+
const idValue = attributes instanceof Map
|
|
22
|
+
? attributes.get(additionalId)
|
|
23
|
+
: attributes === null || attributes === void 0 ? void 0 : attributes[additionalId];
|
|
21
24
|
if (idValue) {
|
|
22
25
|
indexedIds.push(idValue[0]);
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
if (feature.children) {
|
|
26
|
-
|
|
29
|
+
const childrenIterable = feature.children instanceof Map
|
|
30
|
+
? feature.children.values()
|
|
31
|
+
: Object.values(feature.children);
|
|
32
|
+
for (const child of childrenIterable) {
|
|
27
33
|
const childIndexedIds = this.getIndexedIds(child, idsToIndex);
|
|
28
34
|
indexedIds.push(...childIndexedIds);
|
|
29
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssemblySpecificChange.js","sourceRoot":"","sources":["../src/AssemblySpecificChange.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AssemblySpecificChange.js","sourceRoot":"","sources":["../src/AssemblySpecificChange.ts"],"names":[],"mappings":";;;AAeA,4DAOC;AAlBD,qCAKiB;AAMjB,SAAgB,wBAAwB;AACtC,8DAA8D;AAC9D,KAAU;IAEV,OAAO,CACL,IAAA,iBAAQ,EAAC,KAAK,CAAC,IAAK,KAAgC,CAAC,QAAQ,KAAK,SAAS,CAC5E,CAAA;AACH,CAAC;AAED,MAAsB,sBAAuB,SAAQ,eAAM;IAGzD,YAAY,IAAsC,EAAE,OAAuB;QACzE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IAC/B,CAAC;IAED,aAAa,CACX,OAA4C,EAC5C,UAAgC;QAEhC,MAAM,UAAU,GAAa,EAAE,CAAA;QAC/B,KAAK,MAAM,YAAY,IAAI,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,EAAE,EAAE,CAAC;YAC5C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;YAC9B,mEAAmE;YACnE,MAAM,OAAO,GACX,UAAU,YAAY,GAAG;gBACvB,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,CAAC;gBAC9B,CAAC,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,YAAY,CAAC,CAAA;YAChC,IAAI,OAAO,EAAE,CAAC;gBACZ,UAAU,CAAC,IAAI,C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