Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Always return ids as strings #5011

Merged
merged 2 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/cli/src/credentials/credentials.controller.ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ EECredentialsController.get(
});

// eslint-disable-next-line @typescript-eslint/unbound-method
return allCredentials.map(EECredentials.addOwnerAndSharings);
return allCredentials
.map((credential: CredentialsEntity & CredentialWithSharings) =>
EECredentials.addOwnerAndSharings(credential),
)
.map(
(credential): CredentialWithSharings => ({ ...credential, id: credential.id.toString() }),
);
} catch (error) {
LoggerProxy.error('Request to list credentials failed', error as Error);
throw error;
Expand Down
4 changes: 0 additions & 4 deletions packages/cli/src/credentials/credentials.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import express from 'express';
import {
deepCopy,
ICredentialType,
INodeCredentialTestResult,
LoggerProxy,
NodeHelpers,
} from 'n8n-workflow';
import { Credentials } from 'n8n-core';

import * as GenericHelpers from '@/GenericHelpers';
import { InternalHooksManager } from '@/InternalHooksManager';
Expand All @@ -17,7 +14,6 @@ import config from '@/config';
import { getLogger } from '@/Logger';
import { EECredentialsController } from './credentials.controller.ee';
import { CredentialsService } from './credentials.service';
import { CredentialTypes } from '@/CredentialTypes';

import type { ICredentialsResponse } from '@/Interfaces';
import type { CredentialRequest } from '@/requests';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/workflows/workflows.controller.ee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ EEWorkflowController.get(

EEWorkflows.addOwnerAndSharings(workflow);
await EEWorkflows.addCredentialsToWorkflow(workflow, req.user);
return workflow;
return { ...workflow, id: workflow.id.toString() };
}),
);

Expand Down Expand Up @@ -214,7 +214,7 @@ EEWorkflowController.get(
EEWorkflows.addOwnerAndSharings(workflow);
await EEWorkflows.addCredentialsToWorkflow(workflow, req.user);
workflow.nodes = [];
return workflow;
return { ...workflow, id: workflow.id.toString() };
}),
);
}),
Expand Down