Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
346c7ac
Retrieve instances of routes endpoint
xurxodev Jun 25, 2025
71176a1
Remove create local instance if not exists
xurxodev Jun 27, 2025
e773d9d
test metadata repository using routes
xurxodev Jul 2, 2025
8fea8b6
Get instance id to format the url
xurxodev Aug 7, 2025
dae48cd
Fix bug to create instance as route in dhis2
xurxodev Aug 7, 2025
f70b8c9
Fix update instance as route
xurxodev Aug 7, 2025
e73a55d
Implement delete instance using routes
xurxodev Aug 7, 2025
c9f9843
Avoid request to routes endpoint using the same repository
xurxodev Aug 8, 2025
ba884a5
Remove encryptionKey.
xurxodev Aug 8, 2025
2b5f07c
Remove non used lib to encrypt password
xurxodev Aug 8, 2025
f8840ab
Fix tests
xurxodev Aug 8, 2025
8ab7daa
Creation migration for instances from data store to routes
xurxodev Aug 19, 2025
b01d829
Fix bug to run migration
xurxodev Aug 19, 2025
70f493a
Fix test connection using routes
xurxodev Aug 19, 2025
f8de771
Avoid tu use getVersion of the repository
xurxodev Aug 20, 2025
8b9e876
Mark getVersion in the repository as deprecated
xurxodev Aug 20, 2025
2b6d3c9
Remove getVersion from instance repository
xurxodev Aug 20, 2025
f6499ff
Avoid to use api requesting directly to destination without routes
xurxodev Aug 20, 2025
16feade
Avoid to request responsibles to different instance than local
xurxodev Aug 20, 2025
a44e647
Move getOrgUnitRoots from instance repository to metadata repository
xurxodev Aug 27, 2025
0d3709e
Hide test connection button in creation mode
xurxodev Aug 27, 2025
6831bbe
move getOrgUnitRoots from instances to metadata in composition root
xurxodev Aug 27, 2025
89eb16e
Remove getBaseUrl from InstanceRepository
xurxodev Aug 27, 2025
dab46d0
getBaseUrl from InstanceRepository
xurxodev Aug 27, 2025
1da89a8
Remoce unused repository
xurxodev Aug 27, 2025
69af870
Add TODO comments
xurxodev Aug 27, 2025
42c3aa9
Use routes to invoke dataStore if required
xurxodev Sep 3, 2025
b3b856e
Use routes in events, aggregated and Teis if required
xurxodev Sep 3, 2025
6f22246
Simplify instantiation of userRepository using always localInstance
xurxodev Sep 3, 2025
9e979fc
Fix aggregated and events integration tests
xurxodev Sep 3, 2025
9d88c25
Fix bug in cache for instances
xurxodev Sep 16, 2025
5450250
Use routes in InstanceFileRepository
xurxodev Sep 16, 2025
9a8f402
Remove use of api directly
xurxodev Sep 16, 2025
cbc4d0a
Implement support for instance auth by token
xurxodev Sep 17, 2025
e6f5ee3
Update translations
xurxodev Sep 17, 2025
b0c7d4e
Set authType default
xurxodev Sep 25, 2025
cc81820
Merge remote-tracking branch 'origin/development' into feature/routes…
xurxodev Oct 8, 2025
ee96b17
Support sync values and data values of DE of image type
xurxodev Oct 14, 2025
3353896
Maintain instances array in the datastore with ids
xurxodev Oct 28, 2025
e241524
Remove unused import
xurxodev Oct 28, 2025
af67e6f
Fix test
xurxodev Oct 28, 2025
a08f930
Merge remote-tracking branch 'origin/development' into feature/routes…
xurxodev Nov 5, 2025
444c036
Format the code
xurxodev Nov 5, 2025
f22a1e8
Fix npx tsc bugs
xurxodev Nov 5, 2025
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
25 changes: 23 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2025-10-20T15:52:19.670Z\n"
"PO-Revision-Date: 2025-10-20T15:52:19.670Z\n"
"POT-Creation-Date: 2025-11-05T08:45:47.581Z\n"
"PO-Revision-Date: 2025-11-05T08:45:47.581Z\n"

msgid ""
"THIS NEW RELEASE INCLUDES SHARING SETTINGS PER INSTANCES. FOR THIS VERSION "
Expand Down Expand Up @@ -159,6 +159,9 @@ msgstr ""
msgid "Login"
msgstr ""

msgid "Error fetching instance version"
msgstr ""

msgid "An exported dhis2 file is necessary"
msgstr ""

Expand Down Expand Up @@ -1259,6 +1262,9 @@ msgstr ""
msgid "with stored user"
msgstr ""

msgid "Error fetching local instance"
msgstr ""

msgid "Destination"
msgstr ""

Expand Down Expand Up @@ -1737,6 +1743,12 @@ msgstr ""
msgid "Admin Dashboard"
msgstr ""

msgid "Basic"
msgstr ""

msgid "API Token"
msgstr ""

msgid "Please fix the issues before testing the connection"
msgstr ""

Expand All @@ -1749,6 +1761,12 @@ msgstr ""
msgid "URL endpoint (*)"
msgstr ""

msgid "Authentication Scheme (*)"
msgstr ""

msgid "Token (*)"
msgstr ""

msgid "Username (*)"
msgstr ""

Expand Down Expand Up @@ -1791,6 +1809,9 @@ msgstr ""
msgid "URL endpoint"
msgstr ""

msgid "Authentication Scheme"
msgstr ""

msgid "Username"
msgstr ""

Expand Down
21 changes: 21 additions & 0 deletions i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ msgstr ""
msgid "Login"
msgstr ""

msgid "Error fetching instance version"
msgstr ""

msgid "An exported dhis2 file is necessary"
msgstr ""

Expand Down Expand Up @@ -1262,6 +1265,9 @@ msgstr ""
msgid "with stored user"
msgstr ""

msgid "Error fetching local instance"
msgstr ""

msgid "Destination"
msgstr ""

Expand Down Expand Up @@ -1739,6 +1745,12 @@ msgstr ""
msgid "Admin Dashboard"
msgstr ""

msgid "Basic"
msgstr ""

msgid "API Token"
msgstr ""

msgid "Please fix the issues before testing the connection"
msgstr ""

Expand All @@ -1751,6 +1763,12 @@ msgstr ""
msgid "URL endpoint (*)"
msgstr ""

msgid "Authentication Scheme (*)"
msgstr ""

msgid "Token (*)"
msgstr ""

msgid "Username (*)"
msgstr ""

Expand Down Expand Up @@ -1793,6 +1811,9 @@ msgstr ""
msgid "URL endpoint"
msgstr ""

msgid "Authentication Scheme"
msgstr ""

msgid "Username"
msgstr ""

Expand Down
21 changes: 21 additions & 0 deletions i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ msgstr ""
msgid "Login"
msgstr ""

msgid "Error fetching instance version"
msgstr ""

msgid "An exported dhis2 file is necessary"
msgstr ""

Expand Down Expand Up @@ -1262,6 +1265,9 @@ msgstr ""
msgid "with stored user"
msgstr ""

msgid "Error fetching local instance"
msgstr ""

msgid "Destination"
msgstr ""

Expand Down Expand Up @@ -1739,6 +1745,12 @@ msgstr ""
msgid "Admin Dashboard"
msgstr ""

msgid "Basic"
msgstr ""

msgid "API Token"
msgstr ""

msgid "Please fix the issues before testing the connection"
msgstr ""

Expand All @@ -1751,6 +1763,12 @@ msgstr ""
msgid "URL endpoint (*)"
msgstr ""

msgid "Authentication Scheme (*)"
msgstr ""

msgid "Token (*)"
msgstr ""

msgid "Username (*)"
msgstr ""

Expand Down Expand Up @@ -1793,6 +1811,9 @@ msgstr ""
msgid "URL endpoint"
msgstr ""

msgid "Authentication Scheme"
msgstr ""

msgid "Username"
msgstr ""

Expand Down
21 changes: 21 additions & 0 deletions i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ msgstr ""
msgid "Login"
msgstr ""

msgid "Error fetching instance version"
msgstr ""

msgid "An exported dhis2 file is necessary"
msgstr ""

Expand Down Expand Up @@ -1262,6 +1265,9 @@ msgstr ""
msgid "with stored user"
msgstr ""

msgid "Error fetching local instance"
msgstr ""

msgid "Destination"
msgstr ""

Expand Down Expand Up @@ -1739,6 +1745,12 @@ msgstr ""
msgid "Admin Dashboard"
msgstr ""

msgid "Basic"
msgstr ""

msgid "API Token"
msgstr ""

msgid "Please fix the issues before testing the connection"
msgstr ""

Expand All @@ -1751,6 +1763,12 @@ msgstr ""
msgid "URL endpoint (*)"
msgstr ""

msgid "Authentication Scheme (*)"
msgstr ""

msgid "Token (*)"
msgstr ""

msgid "Username (*)"
msgstr ""

Expand Down Expand Up @@ -1793,6 +1811,9 @@ msgstr ""
msgid "URL endpoint"
msgstr ""

msgid "Authentication Scheme"
msgstr ""

msgid "Username"
msgstr ""

Expand Down
10 changes: 5 additions & 5 deletions src/data/aggregated/AggregatedD2ApiRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import mime from "mime-types";
export class AggregatedD2ApiRepository implements AggregatedRepository {
private api: D2Api;

constructor(private instance: Instance) {
this.api = getD2APiFromInstance(instance);
constructor(localInstance: Instance, private targetInstance: Instance) {
this.api = getD2APiFromInstance(localInstance, targetInstance);
}

public async getAggregated(
Expand Down Expand Up @@ -310,7 +310,7 @@ export class AggregatedD2ApiRepository implements AggregatedRepository {
if (!result) {
return {
status: "ERROR",
instance: this.instance.toPublicObject(),
instance: this.targetInstance.toPublicObject(),
date: new Date(),
type: "aggregated",
};
Expand All @@ -324,7 +324,7 @@ export class AggregatedD2ApiRepository implements AggregatedRepository {

return {
status: "NETWORK ERROR",
instance: this.instance.toPublicObject(),
instance: this.targetInstance.toPublicObject(),
date: new Date(),
type: "aggregated",
};
Expand Down Expand Up @@ -377,7 +377,7 @@ export class AggregatedD2ApiRepository implements AggregatedRepository {
status,
message: description,
stats: importCount,
instance: this.instance.toPublicObject(),
instance: this.targetInstance.toPublicObject(),
errors,
date: new Date(),
type: "aggregated",
Expand Down
14 changes: 7 additions & 7 deletions src/data/common/InmemoryCache.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
export class InmemoryCache {
private cache: Record<string, unknown> = {};
private cache: Map<string, unknown> = new Map();

getKeys(): string[] {
return Object.keys(this.cache);
return Array.from(this.cache.keys());
}

get<T>(cacheKey: string): T {
return this.cache[cacheKey] as T;
return this.cache.get(cacheKey) as T;
}

async getOrPromise<T>(cacheKey: string, promise: () => Promise<T>): Promise<T> {
if (this.cache[cacheKey]) {
const data = this.cache[cacheKey] as T;
if (this.cache.has(cacheKey)) {
const data = this.cache.get(cacheKey) as T;
return Promise.resolve(data);
} else {
const data = await promise();
this.cache[cacheKey] = data;
this.cache.set(cacheKey, data);
return data;
}
}

clear(): void {
this.cache = {};
this.cache.clear();
}
}
10 changes: 6 additions & 4 deletions src/data/config/StorageClientD2Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export class StorageClientD2Repository implements StorageClientRepository, Stora
private dataStoreClient: StorageDataStoreClient;
private constantClient: StorageConstantClient;

constructor(private instance: Instance) {
this.dataStoreClient = new StorageDataStoreClient(this.instance);
this.constantClient = new StorageConstantClient(this.instance);
constructor(private localInstance: Instance, private targetInstance?: Instance) {
this.dataStoreClient = new StorageDataStoreClient(localInstance, this.targetInstance);
this.constantClient = new StorageConstantClient(localInstance, this.targetInstance);
}

@cache()
Expand Down Expand Up @@ -49,7 +49,9 @@ export class StorageClientD2Repository implements StorageClientRepository, Stora

@cache()
public getUserStorageClient(): FutureData<StorageClient> {
const dataStoreClient = new StorageDataStoreClient(this.instance, undefined, { storageType: "user" });
const dataStoreClient = new StorageDataStoreClient(this.localInstance, this.targetInstance, undefined, {
storageType: "user",
});

return this.constantClient.getObjectFuture(Namespace.CONFIG).map(constantConfig => {
return constantConfig ? this.constantClient : dataStoreClient;
Expand Down
25 changes: 22 additions & 3 deletions src/data/config/StorageClientTestRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,42 @@ export class StorageClientTestRepository implements StorageClientRepository {
name: "Testing",
version: "2.36",
});
return Future.success(new StorageDataStoreClient(localInstance, undefined, { storageType: "user" }));
const destinationInstance = Instance.build({
url: "http://destination.test",
name: "Testing",
version: "2.36",
});
return Future.success(
new StorageDataStoreClient(localInstance, destinationInstance, undefined, { storageType: "user" })
);
}
getStorageClientPromise(): Promise<StorageClient> {
const localInstance = Instance.build({
url: "http://origin.test",
name: "Testing",
version: "2.36",
});
return Promise.resolve(new StorageDataStoreClient(localInstance));
const destinationInstance = Instance.build({
url: "http://destination.test",
name: "Testing",
version: "2.36",
});
return Promise.resolve(new StorageDataStoreClient(localInstance, destinationInstance));
}
getStorageClient(): FutureData<StorageClient> {
const localInstance = Instance.build({
url: "http://origin.test",
name: "Testing",
version: "2.36",
});
return Future.success(new StorageDataStoreClient(localInstance, undefined, { storageType: "user" }));
const destinationInstance = Instance.build({
url: "http://origin.test",
name: "Testing",
version: "2.36",
});
return Future.success(
new StorageDataStoreClient(localInstance, destinationInstance, undefined, { storageType: "user" })
);
}
changeStorageClient(_client: AppStorageType): FutureData<void> {
return Future.success(undefined);
Expand Down
Loading