Skip to content

Commit 7ee3679

Browse files
Create saved search name
1 parent 41ae34e commit 7ee3679

9 files changed

Lines changed: 73 additions & 36 deletions

‎src/operations/__tests__/nv-backlog.test.ts‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ name: 'Prospects' },
8989
customSearchUrl: SEARCH_URL },
9090
data: CREATED,
9191
},
92+
{
93+
operationName: 'nvCreateSavedSearch',
94+
actionType: 'nv.createSavedSearch',
95+
params: { type: 'lead',
96+
customSearchUrl: SEARCH_URL,
97+
name: 'Heads of Sales' },
98+
data: { ...CREATED,
99+
name: 'Heads of Sales' },
100+
},
92101
{
93102
operationName: 'nvDeleteSavedSearch',
94103
actionType: 'nv.deleteSavedSearch',
@@ -159,6 +168,38 @@ name: 'Prospects' },
159168
type: 'savedSearchNotFound',
160169
params: { savedSearchId: CREATED.id },
161170
},
171+
{
172+
operationName: 'nvCreateSavedSearch',
173+
actionType: 'nv.createSavedSearch',
174+
type: 'savedSearchAlreadyExists',
175+
params: { type: 'lead',
176+
customSearchUrl: SEARCH_URL,
177+
name: 'Heads of Sales' },
178+
},
179+
{
180+
operationName: 'nvCreateSavedSearch',
181+
actionType: 'nv.createSavedSearch',
182+
type: 'savedSearchLimitReached',
183+
params: { type: 'lead',
184+
customSearchUrl: SEARCH_URL,
185+
name: 'Heads of Sales' },
186+
},
187+
{
188+
operationName: 'nvCreateSavedSearch',
189+
actionType: 'nv.createSavedSearch',
190+
type: 'savedSearchRenameUnconfirmed',
191+
params: { type: 'lead',
192+
customSearchUrl: SEARCH_URL,
193+
name: 'Heads of Sales' },
194+
},
195+
{
196+
operationName: 'nvCreateSavedSearch',
197+
actionType: 'nv.createSavedSearch',
198+
type: 'savedSearchQueryMismatch',
199+
params: { type: 'lead',
200+
customSearchUrl: SEARCH_URL,
201+
name: 'Heads of Sales' },
202+
},
162203
] as const)(
163204
'preserves %s action errors',
164205
async ({ operationName, actionType, type, params }): Promise<void> => {

‎src/operations/__tests__/nv-list-management.test.ts‎

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,7 @@ describe('Sales Navigator list management contract', (): void => {
116116
});
117117
});
118118

119-
it.each([
120-
'listAlreadyExists',
121-
'interfaceLanguageNotSupported',
122-
'noSalesNavigator',
123-
'unexpectedError',
124-
] as const)(
119+
it.each(['listAlreadyExists', 'noSalesNavigator', 'unexpectedError'] as const)(
125120
'preserves create error %s without created-list data',
126121
async (type): Promise<void> => {
127122
const error = {
@@ -145,27 +140,24 @@ describe('Sales Navigator list management contract', (): void => {
145140
},
146141
);
147142

148-
it.each([
149-
'listNotFound',
150-
'listNotDeletable',
151-
'interfaceLanguageNotSupported',
152-
'noSalesNavigator',
153-
'unexpectedError',
154-
] as const)('preserves delete error %s', async (type): Promise<void> => {
155-
const error = {
156-
type,
157-
message: 'Fixture error',
158-
};
159-
queueWorkflow({
160-
actionType: 'nv.deleteList',
161-
success: false,
162-
error,
163-
});
164-
const started = await linkedApi.nvDeleteList.execute({ listId: LIST_ID });
165-
expect(await linkedApi.nvDeleteList.result(started.workflowId)).toEqual({
166-
data: undefined,
167-
errors: [error],
168-
});
169-
expect(LINKED_API_ACTION_ERROR[type]).toBe(type);
170-
});
143+
it.each(['listNotFound', 'listNotDeletable', 'noSalesNavigator', 'unexpectedError'] as const)(
144+
'preserves delete error %s',
145+
async (type): Promise<void> => {
146+
const error = {
147+
type,
148+
message: 'Fixture error',
149+
};
150+
queueWorkflow({
151+
actionType: 'nv.deleteList',
152+
success: false,
153+
error,
154+
});
155+
const started = await linkedApi.nvDeleteList.execute({ listId: LIST_ID });
156+
expect(await linkedApi.nvDeleteList.result(started.workflowId)).toEqual({
157+
data: undefined,
158+
errors: [error],
159+
});
160+
expect(LINKED_API_ACTION_ERROR[type]).toBe(type);
161+
},
162+
);
171163
});

‎src/operations/nv-create-saved-search.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Operation, TOperationName } from '../core';
22
import { SimpleWorkflowMapper } from '../mappers';
33
import { TNvCreatedSavedSearch, TNvCreateSavedSearchParams } from '../types';
44

5-
/** Save a Sales Navigator search URL matching the requested type. Returns its id, name, type and URL. English interface only. */
5+
/** Save a Sales Navigator search URL matching the requested type. Optional name: trimmed, single line, 1–256 characters, unique per type (savedSearchAlreadyExists). Returns its id, name, type and URL. */
66
export class NvCreateSavedSearch extends Operation<
77
TNvCreateSavedSearchParams,
88
TNvCreatedSavedSearch

‎src/operations/nv-delete-saved-search.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Operation, TOperationName } from '../core';
22
import { VoidWorkflowMapper } from '../mappers';
33
import { TNvDeleteSavedSearchParams } from '../types';
44

5-
/** Delete an owned saved search by its string ID. An absent search returns savedSearchNotFound. English interface only. */
5+
/** Delete an owned saved search by its string ID. An absent search returns savedSearchNotFound. */
66
export class NvDeleteSavedSearch extends Operation<TNvDeleteSavedSearchParams, void> {
77
public override readonly operationName: TOperationName = 'nvDeleteSavedSearch';
88
protected override readonly mapper = new VoidWorkflowMapper<TNvDeleteSavedSearchParams>(

‎src/operations/nv-remove-account-from-list.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Operation, TOperationName } from '../core';
22
import { VoidWorkflowMapper } from '../mappers';
33
import { TNvRemoveAccountFromListParams } from '../types';
44

5-
/** Remove an account from exactly one owned custom list, keeping it saved even after its last list. Repeating an absent membership succeeds. English interface only. */
5+
/** Remove an account from exactly one owned custom list, keeping it saved even after its last list. Repeating an absent membership succeeds. */
66
export class NvRemoveAccountFromList extends Operation<TNvRemoveAccountFromListParams, void> {
77
public override readonly operationName: TOperationName = 'nvRemoveAccountFromList';
88
protected override readonly mapper = new VoidWorkflowMapper<TNvRemoveAccountFromListParams>(

‎src/operations/nv-remove-lead-from-list.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Operation, TOperationName } from '../core';
22
import { VoidWorkflowMapper } from '../mappers';
33
import { TNvRemoveLeadFromListParams } from '../types';
44

5-
/** Remove a lead from exactly one owned custom list, keeping it saved and in its other lists. Repeating an absent membership succeeds. English interface only. */
5+
/** Remove a lead from exactly one owned custom list, keeping it saved and in its other lists. Repeating an absent membership succeeds. */
66
export class NvRemoveLeadFromList extends Operation<TNvRemoveLeadFromListParams, void> {
77
public override readonly operationName: TOperationName = 'nvRemoveLeadFromList';
88
protected override readonly mapper = new VoidWorkflowMapper<TNvRemoveLeadFromListParams>(

‎src/operations/nv-rename-list.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Operation, TOperationName } from '../core';
22
import { SimpleWorkflowMapper } from '../mappers';
33
import { TNvCreatedList, TNvRenameListParams } from '../types';
44

5-
/** Rename an owned custom list. Trimmed name: 1–75 characters, no line breaks. Same name succeeds; duplicates return listAlreadyExists and system lists return listNotRenamable. English interface only. */
5+
/** Rename an owned custom list. Trimmed name: 1–75 characters, no line breaks. Same name succeeds; duplicates return listAlreadyExists and system lists return listNotRenamable. */
66
export class NvRenameList extends Operation<TNvRenameListParams, TNvCreatedList> {
77
public override readonly operationName: TOperationName = 'nvRenameList';
88
protected override readonly mapper = new SimpleWorkflowMapper<

‎src/types/actions/nv-create-saved-search-params.type.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import type { TBaseActionParams } from '../params';
33
export interface TNvCreateSavedSearchParams extends TBaseActionParams {
44
type: 'lead' | 'account';
55
customSearchUrl: string;
6+
name?: string;
67
}

‎src/types/errors.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { TOperationName } from '../core';
3333
* - listNotDeletable (nvDeleteList)
3434
* - listNotRenamable (nvRenameList)
3535
* - savedSearchNotFound (nvDeleteSavedSearch)
36-
* - interfaceLanguageNotSupported (nvSaveLead, nvSaveAccount, nvUnsaveLead, nvUnsaveAccount, nvCreateList, nvDeleteList, nvRemoveLeadFromList, nvRemoveAccountFromList, nvRenameList, nvCreateSavedSearch, nvDeleteSavedSearch)
36+
* - savedSearchAlreadyExists, savedSearchLimitReached, savedSearchRenameUnconfirmed, savedSearchQueryMismatch (nvCreateSavedSearch)
3737
* - postNotFound (fetchPost, reactToPost, commentOnPost, createRepost)
3838
* - jobNotFound (fetchJob)
3939
* - commentingNotAllowed (commentOnPost)
@@ -82,7 +82,10 @@ export const LINKED_API_ACTION_ERROR = {
8282
listNotDeletable: 'listNotDeletable',
8383
listNotRenamable: 'listNotRenamable',
8484
savedSearchNotFound: 'savedSearchNotFound',
85-
interfaceLanguageNotSupported: 'interfaceLanguageNotSupported',
85+
savedSearchAlreadyExists: 'savedSearchAlreadyExists',
86+
savedSearchLimitReached: 'savedSearchLimitReached',
87+
savedSearchRenameUnconfirmed: 'savedSearchRenameUnconfirmed',
88+
savedSearchQueryMismatch: 'savedSearchQueryMismatch',
8689
postNotFound: 'postNotFound',
8790
jobNotFound: 'jobNotFound',
8891
commentingNotAllowed: 'commentingNotAllowed',

0 commit comments

Comments
 (0)