Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Directus Sync

![Directus 11.8.0](https://img.shields.io/badge/Directus-11.8.0-64f?style=for-the-badge&logo=directus)
![Directus 11.9.0](https://img.shields.io/badge/Directus-11.9.0-64f?style=for-the-badge&logo=directus)
[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/Directus-Sync/donate)
[![Discord](https://img.shields.io/badge/Discord-Join-5865F2?style=for-the-badge&logo=discord)](https://discord.gg/4vGzHPQmud)

Expand Down
2 changes: 1 addition & 1 deletion docker/build-and-push.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env zx

const latestDirectusVersion = '11.8.0';
const latestDirectusVersion = '11.9.0';
const [major, minor, patch] = latestDirectusVersion.split('.');
const directusVersions = [
'latest',
Expand Down
4,351 changes: 2,397 additions & 1,954 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,19 @@ import { FoldersIdMapperClient } from '../folders';

@Service()
export class SettingsDataMapper extends DataMapper<DirectusSettings> {
protected fieldsToIgnore: Field<DirectusSettings, 'public_favicon'>[] = [
protected fieldsToIgnore: Field<
DirectusSettings,
'public_favicon' | 'project_id'
>[] = [
// These fields are not relevant meanwhile assets are not supported
'project_logo',
'public_foreground',
'public_background',
'public_favicon',
// Not relevant for migrations. URL are different for each environment. Can be set with env variables.
'project_url',
// Not relevant for migrations. ID is different for each environment.
'project_id',
];
protected idMappers: IdMappers<DirectusSettings, 'public_registration_role'> =
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,61 @@
import { IdMapperClient } from '../base';
import { IdMap, IdMapperClient } from '../base';
import { Service } from 'typedi';
import { SETTINGS_COLLECTION } from './constants';
import { MigrationClient } from '../../migration-client';
import { LoggerService } from '../../logger';
import { readSettings } from '@directus/sdk';

@Service()
export class SettingsIdMapperClient extends IdMapperClient {
/**
* This placeholder is used to represent the settings in the id map.
*/
protected readonly settingsPlaceholder = '_sync_default_settings';

constructor(migrationClient: MigrationClient, loggerService: LoggerService) {
super(
migrationClient,
loggerService.getChild(SETTINGS_COLLECTION),
SETTINGS_COLLECTION,
);
}

/**
* This method return the id of the settings.
* It should be 1, but we
*/
async getSettingsId() {
const directus = await this.migrationClient.get();
const { id } = await directus.request(
readSettings({
fields: ['id'],
}),
);
return id ?? 1;
}

/**
* Force settings placeholder for singleton.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async create(localId: string | number, _syncId?: string): Promise<string> {
return await super.create(localId, this.settingsPlaceholder);
}

/**
* Create the sync id of the admin role on the fly, as it already has been synced.
*/
async getBySyncId(syncId: string): Promise<IdMap | undefined> {
// Automatically create the default admin role id map if it doesn't exist
if (syncId === this.settingsPlaceholder) {
const idMap = await super.getBySyncId(syncId);
if (idMap) {
return idMap;
}
const adminRoleId = await this.getSettingsId();
await super.create(adminRoleId, this.settingsPlaceholder);
this.logger.debug(`Created settings id map with local id ${adminRoleId}`);
}
return await super.getBySyncId(syncId);
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
[]
[
{
"project_name": "Directus",
"project_color": "#6644FF",
"public_note": null,
"auth_login_attempts": 25,
"auth_password_policy": null,
"storage_asset_transform": "all",
"storage_asset_presets": null,
"custom_css": null,
"storage_default_folder": null,
"basemaps": null,
"mapbox_key": null,
"module_bar": null,
"project_descriptor": null,
"default_language": "en-US",
"custom_aspect_ratios": null,
"default_appearance": "auto",
"default_theme_light": null,
"theme_light_overrides": null,
"default_theme_dark": null,
"theme_dark_overrides": null,
"report_error_url": null,
"report_bug_url": null,
"report_feature_url": null,
"public_registration": false,
"public_registration_verify_email": true,
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
[]
[
{
"project_name": "Directus",
"project_color": "#6644FF",
"public_note": null,
"auth_login_attempts": 25,
"auth_password_policy": null,
"storage_asset_transform": "all",
"storage_asset_presets": null,
"custom_css": null,
"storage_default_folder": null,
"basemaps": null,
"mapbox_key": null,
"module_bar": null,
"project_descriptor": null,
"default_language": "en-US",
"custom_aspect_ratios": null,
"default_appearance": "auto",
"default_theme_light": null,
"theme_light_overrides": null,
"default_theme_dark": null,
"theme_dark_overrides": null,
"report_error_url": null,
"report_bug_url": null,
"report_feature_url": null,
"public_registration": false,
"public_registration_verify_email": true,
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
[]
[
{
"project_name": "Directus",
"project_color": "#6644FF",
"public_note": null,
"auth_login_attempts": 25,
"auth_password_policy": null,
"storage_asset_transform": "all",
"storage_asset_presets": null,
"custom_css": null,
"storage_default_folder": null,
"basemaps": null,
"mapbox_key": null,
"module_bar": null,
"project_descriptor": null,
"default_language": "en-US",
"custom_aspect_ratios": null,
"default_appearance": "auto",
"default_theme_light": null,
"theme_light_overrides": null,
"default_theme_dark": null,
"theme_dark_overrides": null,
"report_error_url": null,
"report_bug_url": null,
"report_feature_url": null,
"public_registration": false,
"public_registration_verify_email": true,
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"_syncId": "26aa9eb5-11af-44cb-9f5b-073c55b57974"
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"public_registration_role": "52183adc-3e8e-4746-abd2-ee8dfc58efd5",
"public_registration_email_filter": null,
"visual_editor_urls": null,
"_syncId": "26aa9eb5-11af-44cb-9f5b-073c55b57974"
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
[]
[
{
"project_name": "Directus",
"project_color": "#6644FF",
"public_note": null,
"auth_login_attempts": 25,
"auth_password_policy": null,
"storage_asset_transform": "all",
"storage_asset_presets": null,
"custom_css": null,
"storage_default_folder": null,
"basemaps": null,
"mapbox_key": null,
"module_bar": null,
"project_descriptor": null,
"default_language": "en-US",
"custom_aspect_ratios": null,
"default_appearance": "auto",
"default_theme_light": null,
"theme_light_overrides": null,
"default_theme_dark": null,
"theme_dark_overrides": null,
"report_error_url": null,
"report_bug_url": null,
"report_feature_url": null,
"public_registration": false,
"public_registration_verify_email": true,
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
[]
[
{
"project_name": "Directus",
"project_color": "#6644FF",
"public_note": null,
"auth_login_attempts": 25,
"auth_password_policy": null,
"storage_asset_transform": "all",
"storage_asset_presets": null,
"custom_css": null,
"storage_default_folder": null,
"basemaps": null,
"mapbox_key": null,
"module_bar": null,
"project_descriptor": null,
"default_language": "en-US",
"custom_aspect_ratios": null,
"default_appearance": "auto",
"default_theme_light": null,
"theme_light_overrides": null,
"default_theme_dark": null,
"theme_dark_overrides": null,
"report_error_url": null,
"report_bug_url": null,
"report_feature_url": null,
"public_registration": false,
"public_registration_verify_email": true,
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"_syncId": "26aa9eb5-11af-44cb-9f5b-073c55b57974"
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"public_registration_role": null,
"public_registration_email_filter": null,
"visual_editor_urls": null,
"_syncId": "26aa9eb5-11af-44cb-9f5b-073c55b57974"
"accepted_terms": false,
"_syncId": "_sync_default_settings"
}
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"directus": "11.8.0",
"directus": "11.9.0",
"vendor": "sqlite"
}
Loading