Skip to content

Commit bdf9b15

Browse files
authored
fix(mongodb-constants): fix property name in types and filter function (#170)
1 parent 4bdafc6 commit bdf9b15

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/mongodb-constants/src/filter.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,23 @@ describe('completer', function () {
9797
version: '0.0.0',
9898
meta: 'stage',
9999
env: ['adl'],
100-
namespace: ['database'],
100+
namespaces: ['database'],
101101
apiVersions: [],
102102
},
103103
{
104104
value: '$b',
105105
version: '0.0.0',
106106
meta: 'stage',
107107
env: ['on-prem'],
108-
namespace: ['collection'],
108+
namespaces: ['collection'],
109109
apiVersions: [],
110110
},
111111
{
112112
value: '$c',
113113
version: '0.0.0',
114114
meta: 'stage',
115115
env: ['atlas'],
116-
namespace: ['timeseries'],
116+
namespaces: ['timeseries'],
117117
apiVersions: [1],
118118
},
119119
];

packages/mongodb-constants/src/filter.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export type Completion = {
4242
snippet?: string;
4343
score?: number;
4444
env?: string[];
45-
namespace?: string[];
45+
namespaces?: string[];
4646
apiVersions?: number[];
4747
outputStage?: boolean;
4848
fullScan?: boolean;
@@ -127,11 +127,17 @@ export function createConstantFilter({
127127
// Fallback to default server version if provided version doesn't match
128128
// regex so that semver doesn't throw when checking
129129
DEFAULT_SERVER_VERSION;
130-
return ({ version: minServerVersion, meta, env, namespace, apiVersions }) => {
130+
return ({
131+
version: minServerVersion,
132+
meta,
133+
env,
134+
namespaces,
135+
apiVersions,
136+
}) => {
131137
return (
132138
satisfiesVersion(currentServerVersion, minServerVersion) &&
133139
isIn(filterStage.env, env) &&
134-
isIn(filterStage.namespace, namespace) &&
140+
isIn(filterStage.namespace, namespaces) &&
135141
isIn(filterStage.apiVersion, apiVersions) &&
136142
(!filterMeta || matchesMeta(filterMeta, meta))
137143
);

0 commit comments

Comments
 (0)