Twenty sdk cli oauth (#18638)
<img width="1418" height="804" alt="image" src="https://github.com/user-attachments/assets/de6c8222-6496-4a71-bc21-7e5e1269d5cb" /> --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
+32
-10
@@ -1,5 +1,10 @@
|
||||
import { type Manifest } from 'twenty-shared/application';
|
||||
|
||||
const sortById = <T extends { universalIdentifier: string }>(items: T[]): T[] =>
|
||||
[...items].sort((a, b) =>
|
||||
a.universalIdentifier.localeCompare(b.universalIdentifier),
|
||||
);
|
||||
|
||||
export const normalizeManifestForComparison = <T extends Manifest>(
|
||||
manifest: T,
|
||||
): T => ({
|
||||
@@ -16,14 +21,31 @@ export const normalizeManifestForComparison = <T extends Manifest>(
|
||||
? '[checksum]'
|
||||
: null,
|
||||
},
|
||||
logicFunctions: manifest.logicFunctions?.map((fn) => ({
|
||||
...fn,
|
||||
builtHandlerChecksum: fn.builtHandlerChecksum ? '[checksum]' : null,
|
||||
})),
|
||||
frontComponents: manifest.frontComponents?.map((component) => ({
|
||||
...component,
|
||||
builtComponentChecksum: component.builtComponentChecksum
|
||||
? '[checksum]'
|
||||
: '',
|
||||
})),
|
||||
objects: sortById(
|
||||
manifest.objects.map((object) => ({
|
||||
...object,
|
||||
fields: sortById(object.fields),
|
||||
})),
|
||||
),
|
||||
fields: sortById(manifest.fields),
|
||||
roles: sortById(manifest.roles),
|
||||
skills: sortById(manifest.skills),
|
||||
agents: sortById(manifest.agents),
|
||||
views: sortById(manifest.views),
|
||||
navigationMenuItems: sortById(manifest.navigationMenuItems),
|
||||
pageLayouts: sortById(manifest.pageLayouts),
|
||||
logicFunctions: sortById(
|
||||
manifest.logicFunctions?.map((fn) => ({
|
||||
...fn,
|
||||
builtHandlerChecksum: fn.builtHandlerChecksum ? '[checksum]' : null,
|
||||
})),
|
||||
),
|
||||
frontComponents: sortById(
|
||||
manifest.frontComponents?.map((component) => ({
|
||||
...component,
|
||||
builtComponentChecksum: component.builtComponentChecksum
|
||||
? '[checksum]'
|
||||
: '',
|
||||
})),
|
||||
),
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import { join } from 'path';
|
||||
import { OUTPUT_DIR } from 'twenty-shared/application';
|
||||
|
||||
import { AppDevCommand } from '@/cli/commands/app/app-dev';
|
||||
import { AppDevCommand } from '@/cli/commands/dev';
|
||||
import { pathExists } from '@/cli/utilities/file/fs-utils';
|
||||
|
||||
export type RunAppDevResult = {
|
||||
|
||||
@@ -5,23 +5,11 @@ const mockApiService = {
|
||||
generateApplicationToken: vi.fn().mockResolvedValue({
|
||||
success: true,
|
||||
data: {
|
||||
applicationAccessToken: { token: 'mock-access-token', expiresAt: '' },
|
||||
applicationRefreshToken: { token: 'mock-refresh-token', expiresAt: '' },
|
||||
},
|
||||
}),
|
||||
renewApplicationToken: vi.fn().mockResolvedValue({
|
||||
success: true,
|
||||
data: {
|
||||
applicationAccessToken: {
|
||||
token: 'mock-renewed-access-token',
|
||||
expiresAt: '',
|
||||
},
|
||||
applicationRefreshToken: {
|
||||
token: 'mock-renewed-refresh-token',
|
||||
expiresAt: '',
|
||||
},
|
||||
accessToken: { token: 'mock-access-token', expiresAt: '' },
|
||||
refreshToken: { token: 'mock-refresh-token', expiresAt: '' },
|
||||
},
|
||||
}),
|
||||
refreshToken: vi.fn().mockResolvedValue('mock-renewed-access-token'),
|
||||
findApplicationRegistrationByUniversalIdentifier: vi
|
||||
.fn()
|
||||
.mockResolvedValue({ success: true, data: null }),
|
||||
@@ -47,7 +35,7 @@ vi.mock('@/cli/utilities/api/api-service', () => ({
|
||||
ApiService: class {
|
||||
validateAuth = mockApiService.validateAuth;
|
||||
generateApplicationToken = mockApiService.generateApplicationToken;
|
||||
renewApplicationToken = mockApiService.renewApplicationToken;
|
||||
refreshToken = mockApiService.refreshToken;
|
||||
findApplicationRegistrationByUniversalIdentifier =
|
||||
mockApiService.findApplicationRegistrationByUniversalIdentifier;
|
||||
createApplicationRegistration =
|
||||
|
||||
Reference in New Issue
Block a user