-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): check directus-extension-sync is installed before push (#97)
* feat(cli): test that directus extension is installed before inserting * fix(e2e): better log filtering
- Loading branch information
1 parent
97f4b15
commit f78fac7
Showing
6 changed files
with
56 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ExtensionClient, NO_ID_MAP_MESSAGE } from './extension-client'; | ||
import { MigrationClient } from './migration-client'; | ||
import { Service } from 'typedi'; | ||
|
||
@Service() | ||
export class PingClient extends ExtensionClient { | ||
constructor(migrationClient: MigrationClient) { | ||
super(migrationClient); | ||
} | ||
|
||
/** Try to get a fake id map in order to check if the server is up and the extension is installed */ | ||
async test() { | ||
const response = await this.fetch<unknown>( | ||
`/table/__ping_test__/sync_id/__ping_test__`, | ||
'GET', | ||
) | ||
.then(() => ({ success: true })) | ||
.catch((error: Error) => ({ error })); | ||
|
||
if ('success' in response) { | ||
return; // Should not happen | ||
} | ||
|
||
if (response.error.message === NO_ID_MAP_MESSAGE) { | ||
return; | ||
} | ||
|
||
throw response.error; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters