Skip to content

Commit 946333f

Browse files
npm run format
1 parent d9319ad commit 946333f

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

src/control/__tests__/configureIndex.test.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ describe('getIndexSpecType', () => {
291291
},
292292
byoc: undefined,
293293
};
294-
expect(getIndexSpecType(spec as Parameters<typeof getIndexSpecType>[0])).toBe(
295-
'serverless',
296-
);
294+
expect(
295+
getIndexSpecType(spec as Parameters<typeof getIndexSpecType>[0]),
296+
).toBe('serverless');
297297
});
298298

299299
test('returns pod when only pod has a defined value (merged FromJSON shape)', () => {
@@ -308,9 +308,9 @@ describe('getIndexSpecType', () => {
308308
serverless: undefined,
309309
byoc: undefined,
310310
};
311-
expect(getIndexSpecType(spec as Parameters<typeof getIndexSpecType>[0])).toBe(
312-
'pod',
313-
);
311+
expect(
312+
getIndexSpecType(spec as Parameters<typeof getIndexSpecType>[0]),
313+
).toBe('pod');
314314
});
315315

316316
test('returns byoc when only byoc has a defined value (merged FromJSON shape)', () => {
@@ -322,14 +322,16 @@ describe('getIndexSpecType', () => {
322322
readCapacity: { mode: 'OnDemand', status: { state: 'Ready' } },
323323
},
324324
};
325-
expect(getIndexSpecType(spec as Parameters<typeof getIndexSpecType>[0])).toBe(
326-
'byoc',
327-
);
325+
expect(
326+
getIndexSpecType(spec as Parameters<typeof getIndexSpecType>[0]),
327+
).toBe('byoc');
328328
});
329329

330330
test('returns unknown for null or non-object', () => {
331331
expect(
332-
getIndexSpecType(null as unknown as Parameters<typeof getIndexSpecType>[0]),
332+
getIndexSpecType(
333+
null as unknown as Parameters<typeof getIndexSpecType>[0],
334+
),
333335
).toBe('unknown');
334336
expect(
335337
getIndexSpecType(

src/control/configureIndex.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
ManageIndexesApi,
33
IndexModel,
4-
type IndexModelSpec,
4+
IndexModelSpec,
55
ConfigureIndexRequest,
66
ConfigureIndexRequestEmbed,
77
ConfigureIndexRequestSpec,
@@ -144,11 +144,7 @@ export const getIndexSpecType = (
144144
) {
145145
return 'serverless';
146146
}
147-
if (
148-
'byoc' in spec &&
149-
spec.byoc != null &&
150-
typeof spec.byoc === 'object'
151-
) {
147+
if ('byoc' in spec && spec.byoc != null && typeof spec.byoc === 'object') {
152148
return 'byoc';
153149
}
154150
if ('pod' in spec && spec.pod != null && typeof spec.pod === 'object') {
@@ -167,7 +163,7 @@ const buildConfigureSpec = (
167163

168164
if (hasPod && hasReadCapacity) {
169165
throw new PineconeArgumentError(
170-
'Cannot configure both readCapacity values for a pod index.',
166+
'Cannot configure both pod (podReplicas/podType) and readCapacity in the same request; these parameters are mutually exclusive.',
171167
);
172168
}
173169

0 commit comments

Comments
 (0)