Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
fe944ea
chore: scaffold @mittwald/api-models-react package
mfal Sep 22, 2026
6d78042
chore: prepare @mittwald/api-models for the new implementation
mfal Sep 22, 2026
4e8dee9
chore: restore lint toolchain and workspace peers
mfal Sep 22, 2026
c33855d
feat: replace api-models with the mstudio-next implementation
mfal Sep 22, 2026
3206643
docs: move api-drift.md into the package docs folder
mfal Sep 22, 2026
c87d0c3
chore: add codemod for NodeNext import extensions
mfal Sep 22, 2026
5e490ce
refactor: add .js extensions to relative imports for NodeNext
mfal Sep 22, 2026
2be2dca
docs: fix import examples in the testing readme
mfal Sep 22, 2026
b17c00c
refactor: remove UI dependency from the agnostic core
mfal Sep 22, 2026
011895f
chore: add vitest configs for the models packages
mfal Sep 22, 2026
1ed443d
fix: declare the missing yaml dependency of @mittwald/api-models
mfal Sep 22, 2026
c6ce822
fix: restore the retryCache request option via its own package
mfal Sep 22, 2026
b01ab37
fix: enable DOM.Iterable for @mittwald/api-models
mfal Sep 22, 2026
150eec6
fix: import AxiosRequestConfig from axios in the customer behaviors
mfal Sep 22, 2026
5b081e6
fix: treat an extension's marketplace context as optional
mfal Sep 22, 2026
60e1450
fix: make the scoped AI model classes emittable as declarations
mfal Sep 22, 2026
6fb49ba
feat(models): guard the internal.ts barrels and ghost names with lint…
mfal Sep 22, 2026
fa157a0
chore(models): add the missing format scripts
mfal Sep 22, 2026
16441df
style(models): run prettier over the migrated sources
mfal Sep 22, 2026
f603963
refactor(models): import QueryResponseData from base, not the root ba…
mfal Sep 22, 2026
563b891
refactor(models): drop internal helper types from the public barrel
mfal Sep 22, 2026
78152f5
feat(models): catch up with the latest mstudio-next master
mfal Sep 22, 2026
c5aff07
test(models): pin the public API surface with an export snapshot
mfal Sep 22, 2026
49f0100
chore(models): require every ghost model to reach the root barrel
mfal Sep 22, 2026
cb5df78
docs: document the api-models rewrite and add a readme for api-models…
mfal Sep 22, 2026
b66af1a
chore(models): guard the core against React, UI and DOM access
mfal Sep 25, 2026
0ebe73d
fix(models): accept any array-like of files in conversation uploads
mfal Sep 25, 2026
a05bcf1
docs(models): drop stale references from the package docs
mfal Sep 25, 2026
6185f96
docs(models): restore the lerna changelog and announce the rewrite
mfal Sep 25, 2026
9696fe1
refactor(models): narrow container template alert status without a cast
mfal Sep 25, 2026
0fdf25e
refactor(models): assert the marketplace context with required()
mfal Sep 25, 2026
5c93f62
build(models-react): declare the inherited peers and align the react …
mfal Sep 25, 2026
6b0ef6f
chore(models): share the lint rules' parsers and check deep re-exports
mfal Sep 25, 2026
ff5f140
chore: remove the one-off js-extension codemod
mfal Sep 25, 2026
86b0af2
test(models,models-react): name the public API tests in English
mfal Sep 25, 2026
578d6f0
fix(models): drop double slashes from barrel import specifiers
mfal Sep 25, 2026
9ac9d09
feat(models): load ghostmaker through its React-free entry
mfal Sep 28, 2026
65fcbf6
docs(models): update the ADR-0005 friction note for the React-free entry
mfal Sep 28, 2026
92f7743
docs(models): word the rewrite note independently of the version
mfal Sep 28, 2026
bbf72d8
chore(models-react): align the version with the lockstep
mfal Sep 28, 2026
2a52768
feat(models): create DNS zones through the project endpoint
mfal Sep 28, 2026
9b622bb
Merge remote-tracking branch 'refs/remotes/origin/master' into HEAD
mfal Oct 12, 2026
fc1276d
chore(models-react): align the version with the lockstep
mfal Oct 12, 2026
bec8ade
Merge remote-tracking branch 'refs/remotes/origin/master' into HEAD
mfal Oct 15, 2026
288934f
fix(models): handle the activity actions added to the generated schema
mfal Oct 15, 2026
bb6f72a
Merge branch 'master' of github.com:mittwald/api-client-js into HEAD
mfal Oct 16, 2026
b1bf789
Merge branch 'master' of github.com:mittwald/api-client-js into HEAD
mfal Oct 16, 2026
cf75a63
Merge branch 'master' of github.com:mittwald/api-client-js into HEAD
mfal Oct 16, 2026
435a198
Merge branch 'master' of github.com:mittwald/api-client-js into HEAD
mfal Oct 16, 2026
4757a9e
Merge branch 'master' of github.com:mittwald/api-client-js into HEAD
mfal Oct 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions packages/models-react/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
CHANGELOG.md
3 changes: 3 additions & 0 deletions packages/models-react/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from "../../config/.prettierrc.js";

export default config;
39 changes: 39 additions & 0 deletions packages/models-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# @mittwald/api-models-react

React bindings for [`@mittwald/api-models`](../models), the domain-model layer
over `@mittwald/api-client`.

The core package is framework-agnostic and SSR-safe; everything React-specific
lives here. The dependency runs one way, react → core
([ADR-0002](../models/docs/adr/0002-agnostic-core-two-packages.md)).

## Usage

Every model has a matching Ghost — a Suspense-integrated, lazily resolving proxy
built with
[`@mittwald/react-ghostmaker`](https://github.com/mittwald/react-ghostmaker):

```tsx
import { CustomerGhost, ProjectGhost } from "@mittwald/api-models-react";

const customer = CustomerGhost.ofId(customerId).use();
const projects = ProjectGhost.query({ customer }).execute().use().items;
```

Call `.getCommon().use()` or `.getDetailed().use()` inside a component to get a
live instance. A resolved Ghost supports the underlying model's own instance
methods directly — there is nothing to unwrap.

## Initialization

Initialize the core package once at startup, as described in its
[README](../models/README.md#initialization). This package needs no separate
setup.

## Peer dependencies

`react` (`>=19.2`, as required by `@mittwald/react-ghostmaker`),
`@tanstack/react-query`, `@mittwald/api-client` and
`@mittwald/api-client-commons` are peers — the consumer provides them. The last
two are passed through from `@mittwald/api-models`, which declares them as peers
itself.
3 changes: 3 additions & 0 deletions packages/models-react/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import baseConfig from "../../config/eslint.config.base.js";

export default baseConfig;
69 changes: 69 additions & 0 deletions packages/models-react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "@mittwald/api-models-react",
"version": "4.493.1",
"author": "Mittwald CM Service GmbH & Co. KG <opensource@mittwald.de>",
"type": "module",
"description": "React bindings for the mittwald API domain models",
"keywords": [
"api",
"client",
"mittwald",
"models",
"react"
],
"homepage": "https://developer.mittwald.de",
"repository": "github:mittwald/api-client-js",
"bugs": {
"url": "https://github.com/mittwald/api-client-js/issues"
},
"license": "MIT",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/esm/index.js"
}
},
"files": [
"dist"
],
"scripts": {
"build": "run build:clean && run tsc",
"build:clean": "rimraf dist",
"format": "run prettier --write '**/*.{ts,tsx,yaml,yml,json,md,mdx,js}'",
"lint": "run eslint .",
"test": "",
"test:compile": "run tsc --noEmit",
"test:unit": "run vitest run"
},
"dependencies": {
"@mittwald/api-models": "workspace:^",
"@mittwald/react-async-proxy": "^0.0.12",
"@mittwald/react-ghostmaker": "^1.6.0",
"@sindresorhus/is": "^8.1.0",
"minimatch": "^10.2.5"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@mittwald/api-client": "workspace:^",
"@mittwald/api-client-commons": "workspace:^",
"@tanstack/react-query": "^5.102.8",
"@types/react": "^19.2.17",
"eslint": "^10.9.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-json": "^5.0.0",
"eslint-plugin-prettier": "^5.5.6",
"globals": "^17.11.0",
"prettier": "^3.9.6",
"react": "^19.2.7",
"rimraf": "^6.1.3",
"typescript": "^5.9.3",
"typescript-eslint": "^8.68.0",
"vitest": "^4.1.8"
},
"peerDependencies": {
"@mittwald/api-client": "workspace:^",
"@mittwald/api-client-commons": "workspace:^",
"@tanstack/react-query": "^5",
"react": ">=19.2"
}
}
91 changes: 91 additions & 0 deletions packages/models-react/src/ReactCacheManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { getQueryContext } from "@mittwald/react-ghostmaker";
import type { Query, QueryClient } from "@tanstack/react-query";
import { Minimatch } from "minimatch";

type PathInvalidationHandler = (path: string) => void;

export class ReactCacheManager {
public readonly queryClient: QueryClient;

private readonly matcherCache = new Map<string, Minimatch>();

private readonly idsOfPath = new Map<string, Set<string>>();
private readonly pathsOfId = new Map<string, Set<string>>();
private readonly onPathInvalidatedHandler =
new Set<PathInvalidationHandler>();

public constructor(queryClient: QueryClient) {
this.queryClient = queryClient;
this.subscribeToCacheEvents();
}

private subscribeToCacheEvents() {
this.queryClient.getQueryCache().subscribe((event) => {
if (event.type !== "updated") {
return;
}
const actionType = event.action.type;
if (actionType === "invalidate" || actionType === "fetch") {
this.handleQueryInvalidated(event.query);
}
});
}

private handleQueryInvalidated(query: Query) {
this.pathsOfId
.get(JSON.stringify(query.queryKey))
?.forEach((url) => this.callPathInvalidationHandlers(url));
}

private callPathInvalidationHandlers(path: string) {
this.onPathInvalidatedHandler.forEach((handler) => handler(path));
}

public onPathInvalidated(handler: PathInvalidationHandler) {
this.onPathInvalidatedHandler.add(handler);
return () => {
this.onPathInvalidatedHandler.delete(handler);
};
}

public refresh(path?: string) {
if (path) {
const minimatch = this.matcherCache.get(path) ?? new Minimatch(path);
this.matcherCache.set(path, minimatch);

this.idsOfPath.forEach((ids, path) => {
if (minimatch.match(path)) {
ids.forEach((id) => {
if (id.includes("react-ghostmaker")) {
this.queryClient.invalidateQueries({
queryKey: JSON.parse(id),
});
}
});
}
});
} else {
this.queryClient.getQueryCache().clear();
}
}

public registerPath(path: string) {
const queryContext = getQueryContext();

const queryId = queryContext?.queryKey
? JSON.stringify(queryContext.queryKey)
: undefined;

if (!queryId) {
return;
}

const thisUrlIds = this.idsOfPath.get(path) ?? new Set<string>();
thisUrlIds.add(queryId);
this.idsOfPath.set(path, thisUrlIds);

const thisPathsOfId = this.pathsOfId.get(queryId) ?? new Set<string>();
thisPathsOfId.add(path);
this.pathsOfId.set(queryId, thisPathsOfId);
}
}
157 changes: 157 additions & 0 deletions packages/models-react/src/__snapshots__/publicApi.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
ActivityGhost
ActivityListQueryGhost
AIModelGhost
AIModelListQueryGhost
AITokenStatisticsGhost
type AnyLeadGhost
ApiTokenGhost
ApiTokenListQueryGhost
AppGhost
AppInstallationGhost
AppInstallationListQueryGhost
AppListQueryGhost
AppVersionGhost
AppVersionListQueryGhost
ArticleGhost
ArticleListQueryGhost
AuthGhost
BackupGhost
BackupListQueryGhost
BackupScheduleGhost
BackupScheduleListQueryGhost
CertificateGhost
CertificateListQueryGhost
CertificateRequestGhost
CertificateRequestListQueryGhost
CityGhost
CityListQueryGhost
ContactVerificationGhost
ContactVerificationListQueryGhost
ContainerGhost
ContainerListQueryGhost
ContainerStackGhost
ContainerTemplateGhost
ContainerTemplateListQueryGhost
ContractArticleGhost
ContractGhost
ContractItemGhost
ContractListQueryGhost
ContributorExtensionGhost
ContributorExtensionListQueryGhost
ContributorGhost
ContributorIncomingInvoiceGhost
ContributorIncomingInvoiceListQueryGhost
ContributorListQueryGhost
ConversationGhost
ConversationListQueryGhost
ConversationMessageGhost
ConversationUserGhost
ConversationUserListQueryGhost
CronjobExecutionGhost
CronjobExecutionListQueryGhost
CronjobGhost
CronjobListQueryGhost
CustomerAIApiKeyGhost
CustomerAIPlanGhost
CustomerGhost
CustomerInviteGhost
CustomerInviteListQueryGhost
CustomerListQueryGhost
CustomerMembershipGhost
CustomerMembershipListQueryGhost
DeliveryBoxGhost
DeliveryBoxListQueryGhost
DnsZoneGhost
DnsZoneListQueryGhost
DomainGhost
DomainListQueryGhost
DomainMigrationGhost
DomainMigrationListQueryGhost
DomainOrderRequestGhost
ExtensionGhost
ExtensionInstanceContextGhost
ExtensionInstanceGhost
ExtensionInstanceListQueryGhost
ExtensionListQueryGhost
ExternalCertificateOrderRequestGhost
FeedbackGhost
FileGhost
FinderProfileGhost
FinderProfileListQueryGhost
FinderProfileRequestGhost
FinderProfileRequestListQueryGhost
HostingArticleGhost
HostingContractItemGhost
HostingOrderRequestGhost
IngressDomainListGhost
IngressDomainListItemGhost
IngressGhost
IngressListQueryGhost
InvoiceGhost
InvoiceListQueryGhost
InvoiceSettingsGhost
LeadFyndrGhost
LeadGhost
LeadListQueryGhost
LeadsExportGhost
LeadsExportListQueryGhost
LicenseGhost
LicenseListQueryGhost
LicenseOrderRequestGhost
MailAddressGhost
MailAddressListQueryGhost
MailRateLimitGhost
MailRateLimitListQueryGhost
MailSettingsGhost
MfaGhost
MySqlCharsetGhost
MySqlCharsetListQueryGhost
MySqlGhost
MySqlListQueryGhost
MySqlUserGhost
MySqlUserListQueryGhost
NewsletterGhost
NotificationsGhost
OrderGhost
OrderListQueryGhost
PerformanceGhost
PerformanceListQueryGhost
ProjectAIApiKeyGhost
ProjectAIPlanGhost
ProjectGhost
ProjectInviteGhost
ProjectInviteListQueryGhost
ProjectListQueryGhost
ProjectMembershipGhost
ProjectMembershipListQueryGhost
ProjectUsageMetricsGhost
RedisGhost
RedisListQueryGhost
RegistryGhost
RegistryListQueryGhost
ServerGhost
ServerListQueryGhost
ServerUsageMetricsGhost
SessionGhost
SessionListQueryGhost
SftpUserGhost
SftpUserListQueryGhost
SpotlightGhost
SshKeyGhost
SshKeyListQueryGhost
SshUserGhost
SshUserListQueryGhost
StorageMetricsGhost
SupportCodeGhost
SystemSoftwareGhost
SystemSoftwareListQueryGhost
SystemSoftwareVersionGhost
SystemSoftwareVersionListQueryGhost
TldGhost
TldListQueryGhost
TldPriceGhost
UnlockedLeadGhost
UnlockedLeadListQueryGhost
UserGhost
VolumeGhost
VolumeListQueryGhost
1 change: 1 addition & 0 deletions packages/models-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./models/index.js";
17 changes: 17 additions & 0 deletions packages/models-react/src/models/AIApiKey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as Models from "@mittwald/api-models";
import { makeGhost, type MaybeReactGhost } from "@mittwald/react-ghostmaker";

export const ProjectAIApiKeyGhost = makeGhost(Models.ProjectAIApiKey);
export type ProjectAIApiKeyGhost = MaybeReactGhost<Models.ProjectAIApiKey>;

export const ProjectAIPlanGhost = makeGhost(Models.ProjectAIPlan);
export type ProjectAIPlanGhost = MaybeReactGhost<Models.ProjectAIPlan>;

export const CustomerAIApiKeyGhost = makeGhost(Models.CustomerAIApiKey);
export type CustomerAIApiKeyGhost = MaybeReactGhost<Models.CustomerAIApiKey>;

export const CustomerAIPlanGhost = makeGhost(Models.CustomerAIPlan);
export type CustomerAIPlanGhost = MaybeReactGhost<Models.CustomerAIPlan>;

export const AITokenStatisticsGhost = makeGhost(Models.AITokenStatistics);
export type AITokenStatisticsGhost = MaybeReactGhost<Models.AITokenStatistics>;
Loading
Loading