@mittwald/api-models 0.0.0-development-74e1fd1-20240611 → 0.0.0-development-e096ee7-20240924
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -11
- package/dist/esm/app/AppInstallation/AppInstallation.js +48 -4
- package/dist/esm/app/AppInstallation/behaviors/api.js +5 -2
- package/dist/esm/base/ListDataModel.js +8 -0
- package/dist/esm/base/ListQueryModel.js +9 -0
- package/dist/esm/base/index.js +5 -0
- package/dist/esm/config/behaviors/api.js +3 -0
- package/dist/esm/config/config.js +1 -0
- package/dist/esm/customer/Customer/Customer.js +59 -6
- package/dist/esm/customer/Customer/behaviors/api.js +12 -2
- package/dist/esm/domain/Ingress/Ingress.js +56 -6
- package/dist/esm/domain/Ingress/behaviors/api.js +7 -5
- package/dist/esm/project/Project/Project.js +57 -5
- package/dist/esm/project/Project/behaviors/api.js +5 -2
- package/dist/esm/project/Project/behaviors/inMem.js +5 -1
- package/dist/esm/react/MittwaldApiModelProvider.js +8 -8
- package/dist/esm/react/asyncResourceInvalidation.js +29 -0
- package/dist/esm/react/index.js +2 -1
- package/dist/esm/react/provideReact.js +24 -0
- package/dist/esm/react/provideReact.test-types.js +21 -0
- package/dist/esm/react/reactProvisionContext.js +2 -0
- package/dist/esm/server/Server/Server.js +68 -13
- package/dist/esm/server/Server/behaviors/api.js +5 -2
- package/dist/types/app/AppInstallation/AppInstallation.d.ts +26 -17
- package/dist/types/app/AppInstallation/behaviors/types.d.ts +3 -2
- package/dist/types/app/AppInstallation/types.d.ts +1 -1
- package/dist/types/base/ListDataModel.d.ts +5 -0
- package/dist/types/base/ListQueryModel.d.ts +5 -0
- package/dist/types/base/index.d.ts +5 -0
- package/dist/types/base/types.d.ts +4 -0
- package/dist/types/config/config.d.ts +1 -0
- package/dist/types/customer/Customer/Customer.d.ts +34 -21
- package/dist/types/customer/Customer/behaviors/types.d.ts +4 -2
- package/dist/types/customer/Customer/types.d.ts +2 -1
- package/dist/types/domain/Ingress/Ingress.d.ts +24 -17
- package/dist/types/domain/Ingress/behaviors/types.d.ts +3 -2
- package/dist/types/domain/Ingress/types.d.ts +5 -3
- package/dist/types/project/Project/Project.d.ts +78 -68
- package/dist/types/project/Project/behaviors/types.d.ts +3 -2
- package/dist/types/project/Project/types.d.ts +7 -1
- package/dist/types/react/MittwaldApiModelProvider.d.ts +6 -2
- package/dist/types/react/asyncResourceInvalidation.d.ts +4 -0
- package/dist/types/react/index.d.ts +3 -2
- package/dist/types/react/provideReact.d.ts +9 -0
- package/dist/types/react/provideReact.test-types.d.ts +1 -0
- package/dist/types/react/reactProvisionContext.d.ts +3 -0
- package/dist/types/react/reactUsePromise.d.ts +1 -0
- package/dist/types/server/Server/Server.d.ts +71 -28
- package/dist/types/server/Server/behaviors/types.d.ts +3 -2
- package/dist/types/server/Server/types.d.ts +5 -1
- package/package.json +26 -15
- package/dist/esm/lib/provideReact.js +0 -5
- package/dist/types/lib/provideReact.d.ts +0 -11
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { reactUsePromise } from "./reactUsePromise.js";
|
|
2
|
+
import { hash } from "object-code";
|
|
3
|
+
import { reactProvisionContext } from "./reactProvisionContext.js";
|
|
4
|
+
export const provideReact = (loader, dependencies) => {
|
|
5
|
+
const provisionId = String(hash({
|
|
6
|
+
loader,
|
|
7
|
+
dependencies,
|
|
8
|
+
}));
|
|
9
|
+
const getAsyncResource = (params) => {
|
|
10
|
+
const paramsHash = params && params.length > 0 ? String(hash(params)) : "";
|
|
11
|
+
const contextId = provisionId + paramsHash;
|
|
12
|
+
const loaderWithContext = reactProvisionContext.bind({
|
|
13
|
+
id: contextId,
|
|
14
|
+
}, loader);
|
|
15
|
+
return reactUsePromise.getAsyncResource(loaderWithContext, params, {
|
|
16
|
+
loaderId: provisionId,
|
|
17
|
+
tags: [contextId],
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return Object.assign(loader, {
|
|
21
|
+
asResource: (...params) => getAsyncResource(params),
|
|
22
|
+
use: (...params) => getAsyncResource(params).use(),
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { provideReact } from "./provideReact.js";
|
|
2
|
+
import { expectType } from "tsd";
|
|
3
|
+
const reactProvided = provideReact(async (ignoredP1, ignoredP2) => Promise.resolve("foo"));
|
|
4
|
+
function ignoredTestReturnTypesOfProvideReact() {
|
|
5
|
+
const usedValue = reactProvided.use("foo");
|
|
6
|
+
const asAsyncResource = reactProvided.asResource("foo");
|
|
7
|
+
expectType(usedValue);
|
|
8
|
+
expectType(asAsyncResource.use());
|
|
9
|
+
}
|
|
10
|
+
function ignoredTestParameterTypesOfProvideReact() {
|
|
11
|
+
reactProvided.use("foo", true);
|
|
12
|
+
reactProvided.asResource("foo", true);
|
|
13
|
+
reactProvided.use("foo");
|
|
14
|
+
reactProvided.asResource("foo");
|
|
15
|
+
// @ts-expect-error Not assignable
|
|
16
|
+
reactProvided.asResource(42);
|
|
17
|
+
// @ts-expect-error Not assignable
|
|
18
|
+
reactProvided.asResource("foo", 42);
|
|
19
|
+
// @ts-expect-error Not assignable
|
|
20
|
+
reactProvided.asResource("foo", true, 42);
|
|
21
|
+
}
|
|
@@ -3,37 +3,51 @@ import { config } from "../../config/config.js";
|
|
|
3
3
|
import { classes } from "polytype";
|
|
4
4
|
import { DataModel } from "../../base/DataModel.js";
|
|
5
5
|
import assertObjectFound from "../../base/assertObjectFound.js";
|
|
6
|
-
import { Project } from "../../project/index.js";
|
|
7
|
-
import { provideReact } from "../../
|
|
6
|
+
import { Project, ProjectListQuery } from "../../project/index.js";
|
|
7
|
+
import { provideReact, } from "../../react/provideReact.js";
|
|
8
|
+
import { ListQueryModel } from "../../base/ListQueryModel.js";
|
|
9
|
+
import { ListDataModel } from "../../base/ListDataModel.js";
|
|
8
10
|
export class Server extends ReferenceModel {
|
|
11
|
+
projects;
|
|
12
|
+
constructor(id) {
|
|
13
|
+
super(id);
|
|
14
|
+
this.projects = new ProjectListQuery({
|
|
15
|
+
server: this,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
static ofId(id) {
|
|
19
|
+
return new Server(id);
|
|
20
|
+
}
|
|
9
21
|
static find = provideReact(async (id) => {
|
|
10
|
-
const
|
|
11
|
-
if (
|
|
12
|
-
return new ServerDetailed(
|
|
22
|
+
const data = await config.behaviors.server.find(id);
|
|
23
|
+
if (data !== undefined) {
|
|
24
|
+
return new ServerDetailed(data);
|
|
13
25
|
}
|
|
14
26
|
});
|
|
15
27
|
static get = provideReact(async (id) => {
|
|
16
|
-
const server = await
|
|
28
|
+
const server = await this.find(id);
|
|
17
29
|
assertObjectFound(server, this, id);
|
|
18
30
|
return server;
|
|
19
31
|
});
|
|
32
|
+
static query(query = {}) {
|
|
33
|
+
return new ServerListQuery(query);
|
|
34
|
+
}
|
|
35
|
+
/** @deprecated: use query() or customer.servers */
|
|
20
36
|
static list = provideReact(async (query = {}) => {
|
|
21
|
-
|
|
22
|
-
return projectListData.map((d) => new ServerListItem([d]));
|
|
37
|
+
return new ServerListQuery(query).execute().then((r) => r.items);
|
|
23
38
|
});
|
|
24
|
-
static ofId(id) {
|
|
25
|
-
return new Server(id);
|
|
26
|
-
}
|
|
27
39
|
async createProject(...parameters) {
|
|
28
40
|
return Project.create(this.id, ...parameters);
|
|
29
41
|
}
|
|
42
|
+
/** @deprecated Use Server.projects property */
|
|
30
43
|
listProjects = provideReact(async (query = {}) => {
|
|
31
44
|
return Project.list({
|
|
32
45
|
...query,
|
|
33
46
|
serverId: this.id,
|
|
34
47
|
});
|
|
35
48
|
});
|
|
36
|
-
getDetailed = provideReact(() =>
|
|
49
|
+
getDetailed = provideReact(() => Server.get(this.id), [this.id]);
|
|
50
|
+
findDetailed = provideReact(() => Server.find(this.id), [this.id]);
|
|
37
51
|
}
|
|
38
52
|
// Common class for future extension
|
|
39
53
|
class ServerCommon extends classes((DataModel), Server) {
|
|
@@ -41,7 +55,48 @@ class ServerCommon extends classes((DataModel), Server) {
|
|
|
41
55
|
super([data], [data.id]);
|
|
42
56
|
}
|
|
43
57
|
}
|
|
58
|
+
export class ServerDetailed extends classes(ServerCommon, (DataModel)) {
|
|
59
|
+
constructor(data) {
|
|
60
|
+
super([data], [data]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
44
63
|
export class ServerListItem extends classes(ServerCommon, (DataModel)) {
|
|
64
|
+
constructor(data) {
|
|
65
|
+
super([data], [data]);
|
|
66
|
+
}
|
|
45
67
|
}
|
|
46
|
-
export class
|
|
68
|
+
export class ServerListQuery extends ListQueryModel {
|
|
69
|
+
constructor(query = {}) {
|
|
70
|
+
super(query);
|
|
71
|
+
}
|
|
72
|
+
refine(query) {
|
|
73
|
+
return new ServerListQuery({
|
|
74
|
+
...this.query,
|
|
75
|
+
...query,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
execute = provideReact(async () => {
|
|
79
|
+
const { customer, ...query } = this.query;
|
|
80
|
+
const { items, totalCount } = await config.behaviors.server.list({
|
|
81
|
+
limit: config.defaultPaginationLimit,
|
|
82
|
+
customerId: customer?.id,
|
|
83
|
+
...query,
|
|
84
|
+
});
|
|
85
|
+
return new ServerList(this.query, items.map((d) => new ServerListItem(d)), totalCount);
|
|
86
|
+
}, [this.queryId]);
|
|
87
|
+
getTotalCount = provideReact(async () => {
|
|
88
|
+
const { totalCount } = await this.refine({ limit: 1 }).execute();
|
|
89
|
+
return totalCount;
|
|
90
|
+
}, [this.queryId]);
|
|
91
|
+
findOneAndOnly = provideReact(async () => {
|
|
92
|
+
const { items, totalCount } = await this.refine({ limit: 2 }).execute();
|
|
93
|
+
if (totalCount === 1) {
|
|
94
|
+
return items[0];
|
|
95
|
+
}
|
|
96
|
+
}, [this.queryId]);
|
|
97
|
+
}
|
|
98
|
+
export class ServerList extends classes(ServerListQuery, (ListDataModel)) {
|
|
99
|
+
constructor(query, servers, totalCount) {
|
|
100
|
+
super([query], [servers, totalCount]);
|
|
101
|
+
}
|
|
47
102
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertStatus, assertOneOfStatus, } from "@mittwald/api-client";
|
|
1
|
+
import { assertStatus, assertOneOfStatus, extractTotalCountHeader, } from "@mittwald/api-client";
|
|
2
2
|
export const apiServerBehaviors = (client) => ({
|
|
3
3
|
find: async (id) => {
|
|
4
4
|
const response = await client.project.getServer({
|
|
@@ -14,6 +14,9 @@ export const apiServerBehaviors = (client) => ({
|
|
|
14
14
|
queryParameters: query,
|
|
15
15
|
});
|
|
16
16
|
assertStatus(response, 200);
|
|
17
|
-
return
|
|
17
|
+
return {
|
|
18
|
+
items: response.data,
|
|
19
|
+
totalCount: extractTotalCountHeader(response),
|
|
20
|
+
};
|
|
18
21
|
},
|
|
19
22
|
});
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { DataModel } from "../../base/DataModel.js";
|
|
2
2
|
import { ReferenceModel } from "../../base/ReferenceModel.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AsyncResourceVariant } from "../../react/provideReact.js";
|
|
4
|
+
import { AppInstallationData, AppInstallationListItemData, AppInstallationListQueryData } from "./types.js";
|
|
5
|
+
import { ListQueryModel } from "../../base/ListQueryModel.js";
|
|
6
|
+
import { ListDataModel } from "../../base/ListDataModel.js";
|
|
7
|
+
import { Project } from "../../project/index.js";
|
|
4
8
|
export declare class AppInstallation extends ReferenceModel {
|
|
5
|
-
static find: (
|
|
6
|
-
|
|
7
|
-
use: (id: string) => AppInstallationDetailed | undefined;
|
|
8
|
-
};
|
|
9
|
-
static get: ((id: string) => Promise<AppInstallationDetailed>) & {
|
|
10
|
-
asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<AppInstallationDetailed>;
|
|
11
|
-
use: (id: string) => AppInstallationDetailed;
|
|
12
|
-
};
|
|
9
|
+
static find: AsyncResourceVariant<(id: string) => Promise<AppInstallationDetailed | undefined>>;
|
|
10
|
+
static get: AsyncResourceVariant<(id: string) => Promise<AppInstallationDetailed>>;
|
|
13
11
|
static ofId(id: string): AppInstallation;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
asResource: () => import("@mittwald/react-use-promise").AsyncResource<AppInstallationDetailed>;
|
|
20
|
-
use: () => AppInstallationDetailed;
|
|
21
|
-
};
|
|
12
|
+
query(project: Project, query?: AppInstallationListQueryData): AppInstallationListQuery;
|
|
13
|
+
/** @deprecated: use query() or project.appInstallations */
|
|
14
|
+
static list: AsyncResourceVariant<(projectId: string, query?: AppInstallationListQueryData) => Promise<Readonly<Array<AppInstallationListItem>>>>;
|
|
15
|
+
getDetailed: AsyncResourceVariant<() => Promise<AppInstallationDetailed>>;
|
|
16
|
+
findDetailed: AsyncResourceVariant<() => Promise<AppInstallationDetailed | undefined>>;
|
|
22
17
|
}
|
|
23
18
|
declare const AppInstallationCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
|
|
24
19
|
new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation | {
|
|
@@ -106,4 +101,18 @@ declare const AppInstallationListItem_base: import("polytype").Polytype.Clustere
|
|
|
106
101
|
export declare class AppInstallationListItem extends AppInstallationListItem_base {
|
|
107
102
|
constructor(data: AppInstallationListItemData);
|
|
108
103
|
}
|
|
104
|
+
export declare class AppInstallationListQuery extends ListQueryModel<AppInstallationListQueryData> {
|
|
105
|
+
readonly project: Project;
|
|
106
|
+
constructor(project: Project, query?: AppInstallationListQueryData);
|
|
107
|
+
refine(query: AppInstallationListQueryData): AppInstallationListQuery;
|
|
108
|
+
execute: AsyncResourceVariant<() => Promise<AppInstallationList>>;
|
|
109
|
+
getTotalCount: AsyncResourceVariant<() => Promise<number>>;
|
|
110
|
+
findOneAndOnly: AsyncResourceVariant<() => Promise<AppInstallationListItem | undefined>>;
|
|
111
|
+
}
|
|
112
|
+
declare const AppInstallationList_base: import("polytype").Polytype.ClusteredConstructor<[typeof AppInstallationListQuery, {
|
|
113
|
+
new (items: AppInstallationListItem[], totalCount: number): ListDataModel<AppInstallationListItem>;
|
|
114
|
+
}]>;
|
|
115
|
+
export declare class AppInstallationList extends AppInstallationList_base {
|
|
116
|
+
constructor(project: Project, query: AppInstallationListQueryData, appInstallations: AppInstallationListItem[], totalCount: number);
|
|
117
|
+
}
|
|
109
118
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AppInstallationListItemData, AppInstallationData,
|
|
1
|
+
import { AppInstallationListItemData, AppInstallationData, AppInstallationListQueryData } from "../types.js";
|
|
2
|
+
import { QueryResponseData } from "../../../base/index.js";
|
|
2
3
|
export interface AppInstallationBehaviors {
|
|
3
4
|
find: (id: string) => Promise<AppInstallationData | undefined>;
|
|
4
|
-
list: (projectId: string, query?:
|
|
5
|
+
list: (projectId: string, query?: AppInstallationListQueryData) => Promise<QueryResponseData<AppInstallationListItemData>>;
|
|
5
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
-
export type
|
|
2
|
+
export type AppInstallationListQueryData = MittwaldAPIV2.Paths.V2ProjectsProjectIdAppInstallations.Get.Parameters.Query;
|
|
3
3
|
export type AppInstallationData = MittwaldAPIV2.Operations.AppGetAppinstallation.ResponseData;
|
|
4
4
|
export type AppInstallationListItemData = MittwaldAPIV2.Operations.AppListAppinstallations.ResponseData[number];
|
|
@@ -4,6 +4,7 @@ import { CustomerBehaviors } from "../customer/Customer/behaviors/index.js";
|
|
|
4
4
|
import { IngressBehaviors } from "../domain/Ingress/behaviors/index.js";
|
|
5
5
|
import { AppInstallationBehaviors } from "../app/AppInstallation/behaviors/index.js";
|
|
6
6
|
interface Config {
|
|
7
|
+
defaultPaginationLimit: number;
|
|
7
8
|
behaviors: {
|
|
8
9
|
project: ProjectBehaviors;
|
|
9
10
|
server: ServerBehaviors;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { DataModel } from "../../base/DataModel.js";
|
|
2
2
|
import { ReferenceModel } from "../../base/ReferenceModel.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AsyncResourceVariant } from "../../react/provideReact.js";
|
|
4
|
+
import { CustomerData, CustomerListItemData, CustomerListQueryData, CustomerUpdateRequestData } from "./types.js";
|
|
5
|
+
import { ListQueryModel } from "../../base/ListQueryModel.js";
|
|
6
|
+
import { ListDataModel } from "../../base/ListDataModel.js";
|
|
7
|
+
import { ServerListQuery } from "../../server/index.js";
|
|
8
|
+
import { ProjectListQuery } from "../../project/index.js";
|
|
4
9
|
export declare class Customer extends ReferenceModel {
|
|
10
|
+
readonly servers: ServerListQuery;
|
|
11
|
+
readonly projects: ProjectListQuery;
|
|
12
|
+
constructor(id: string);
|
|
5
13
|
static ofId(id: string): Customer;
|
|
6
|
-
static find: (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
static
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static get: ((id: string) => Promise<CustomerDetailed>) & {
|
|
15
|
-
asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<CustomerDetailed>;
|
|
16
|
-
use: (id: string) => CustomerDetailed;
|
|
17
|
-
};
|
|
18
|
-
getDetailed: (() => Promise<CustomerDetailed>) & {
|
|
19
|
-
asResource: () => import("@mittwald/react-use-promise").AsyncResource<CustomerDetailed>;
|
|
20
|
-
use: () => CustomerDetailed;
|
|
21
|
-
};
|
|
14
|
+
static find: AsyncResourceVariant<(id: string) => Promise<CustomerDetailed | undefined>>;
|
|
15
|
+
static query(query?: CustomerListQueryData): CustomerListQuery;
|
|
16
|
+
/** @deprecated Use query() */
|
|
17
|
+
static list: AsyncResourceVariant<(query?: CustomerListQueryData) => Promise<Readonly<Array<CustomerListItem>>>>;
|
|
18
|
+
static get: AsyncResourceVariant<(id: string) => Promise<CustomerDetailed>>;
|
|
19
|
+
getDetailed: AsyncResourceVariant<() => Promise<CustomerDetailed>>;
|
|
20
|
+
findDetailed: AsyncResourceVariant<() => Promise<CustomerDetailed | undefined>>;
|
|
21
|
+
update(data: CustomerUpdateRequestData): Promise<void>;
|
|
22
22
|
}
|
|
23
23
|
declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
|
|
24
24
|
new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
|
|
@@ -38,7 +38,7 @@ declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstruc
|
|
|
38
38
|
owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
|
|
39
39
|
projectCount: number;
|
|
40
40
|
vatId?: string | undefined;
|
|
41
|
-
vatIdValidationState?: "
|
|
41
|
+
vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
|
|
42
42
|
}): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
|
|
43
43
|
activeSuspension?: {
|
|
44
44
|
createdAt: string;
|
|
@@ -56,7 +56,7 @@ declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstruc
|
|
|
56
56
|
owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
|
|
57
57
|
projectCount: number;
|
|
58
58
|
vatId?: string | undefined;
|
|
59
|
-
vatIdValidationState?: "
|
|
59
|
+
vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
|
|
60
60
|
}>;
|
|
61
61
|
}, typeof Customer]>;
|
|
62
62
|
declare class CustomerCommon extends CustomerCommon_base {
|
|
@@ -80,7 +80,7 @@ declare const CustomerDetailed_base: import("polytype").Polytype.ClusteredConstr
|
|
|
80
80
|
owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
|
|
81
81
|
projectCount: number;
|
|
82
82
|
vatId?: string | undefined;
|
|
83
|
-
vatIdValidationState?: "
|
|
83
|
+
vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
|
|
84
84
|
}): DataModel<{
|
|
85
85
|
activeSuspension?: {
|
|
86
86
|
createdAt: string;
|
|
@@ -98,7 +98,7 @@ declare const CustomerDetailed_base: import("polytype").Polytype.ClusteredConstr
|
|
|
98
98
|
owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
|
|
99
99
|
projectCount: number;
|
|
100
100
|
vatId?: string | undefined;
|
|
101
|
-
vatIdValidationState?: "
|
|
101
|
+
vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
|
|
102
102
|
}>;
|
|
103
103
|
}]>;
|
|
104
104
|
export declare class CustomerDetailed extends CustomerDetailed_base {
|
|
@@ -110,4 +110,17 @@ declare const CustomerListItem_base: import("polytype").Polytype.ClusteredConstr
|
|
|
110
110
|
export declare class CustomerListItem extends CustomerListItem_base {
|
|
111
111
|
constructor(data: CustomerListItemData);
|
|
112
112
|
}
|
|
113
|
+
export declare class CustomerListQuery extends ListQueryModel<CustomerListQueryData> {
|
|
114
|
+
constructor(query?: CustomerListQueryData);
|
|
115
|
+
refine(query: CustomerListQueryData): CustomerListQuery;
|
|
116
|
+
execute: AsyncResourceVariant<() => Promise<CustomerList>>;
|
|
117
|
+
getTotalCount: AsyncResourceVariant<() => Promise<number>>;
|
|
118
|
+
findOneAndOnly: AsyncResourceVariant<() => Promise<CustomerListItem | undefined>>;
|
|
119
|
+
}
|
|
120
|
+
declare const CustomerList_base: import("polytype").Polytype.ClusteredConstructor<[typeof CustomerListQuery, {
|
|
121
|
+
new (items: CustomerListItem[], totalCount: number): ListDataModel<CustomerListItem>;
|
|
122
|
+
}]>;
|
|
123
|
+
export declare class CustomerList extends CustomerList_base {
|
|
124
|
+
constructor(query: CustomerListQueryData, customers: CustomerListItem[], totalCount: number);
|
|
125
|
+
}
|
|
113
126
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { CustomerListItemData, CustomerData,
|
|
1
|
+
import { CustomerListItemData, CustomerData, CustomerListQueryData, CustomerUpdateRequestData } from "../types.js";
|
|
2
|
+
import { QueryResponseData } from "../../../base/index.js";
|
|
2
3
|
export interface CustomerBehaviors {
|
|
3
4
|
find: (id: string) => Promise<CustomerData | undefined>;
|
|
4
|
-
list: (query?:
|
|
5
|
+
list: (query?: CustomerListQueryData) => Promise<QueryResponseData<CustomerListItemData>>;
|
|
6
|
+
update: (id: string, data: CustomerUpdateRequestData) => Promise<void>;
|
|
5
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
-
export type
|
|
2
|
+
export type CustomerListQueryData = MittwaldAPIV2.Paths.V2Customers.Get.Parameters.Query;
|
|
3
3
|
export type CustomerData = MittwaldAPIV2.Operations.CustomerGetCustomer.ResponseData;
|
|
4
4
|
export type CustomerListItemData = MittwaldAPIV2.Operations.CustomerListCustomers.ResponseData[number];
|
|
5
|
+
export type CustomerUpdateRequestData = MittwaldAPIV2.Paths.V2CustomersCustomerId.Put.Parameters.RequestBody;
|
|
@@ -1,26 +1,19 @@
|
|
|
1
1
|
import { DataModel } from "../../base/DataModel.js";
|
|
2
2
|
import { ReferenceModel } from "../../base/ReferenceModel.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AsyncResourceVariant } from "../../react/provideReact.js";
|
|
4
|
+
import { IngressData, IngressListItemData, IngressListQueryData, IngressListQueryModelData } from "./types.js";
|
|
4
5
|
import { IngressPath } from "../IngressPath/IngressPath.js";
|
|
6
|
+
import { ListQueryModel } from "../../base/ListQueryModel.js";
|
|
7
|
+
import { ListDataModel } from "../../base/ListDataModel.js";
|
|
5
8
|
export declare class Ingress extends ReferenceModel {
|
|
6
9
|
static ofId(id: string): Ingress;
|
|
7
10
|
static ofHostname(hostname: string): Ingress;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
use: (id: string) => IngressDetailed | undefined;
|
|
15
|
-
};
|
|
16
|
-
static get: ((id: string) => Promise<IngressDetailed>) & {
|
|
17
|
-
asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<IngressDetailed>;
|
|
18
|
-
use: (id: string) => IngressDetailed;
|
|
19
|
-
};
|
|
20
|
-
getDetailed: (() => Promise<IngressDetailed>) & {
|
|
21
|
-
asResource: () => import("@mittwald/react-use-promise").AsyncResource<IngressDetailed>;
|
|
22
|
-
use: () => IngressDetailed;
|
|
23
|
-
};
|
|
11
|
+
/** @deprecated: use query() or project.ingresses */
|
|
12
|
+
static list: AsyncResourceVariant<(query?: IngressListQueryData) => Promise<Readonly<Array<IngressListItem>>>>;
|
|
13
|
+
static find: AsyncResourceVariant<(id: string) => Promise<IngressDetailed | undefined>>;
|
|
14
|
+
static get: AsyncResourceVariant<(id: string) => Promise<IngressDetailed>>;
|
|
15
|
+
getDetailed: AsyncResourceVariant<() => Promise<IngressDetailed>>;
|
|
16
|
+
findDetailed: AsyncResourceVariant<() => Promise<IngressDetailed | undefined>>;
|
|
24
17
|
}
|
|
25
18
|
declare const IngressCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
|
|
26
19
|
new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.IngressIngress | {
|
|
@@ -99,4 +92,18 @@ declare const IngressListItem_base: import("polytype").Polytype.ClusteredConstru
|
|
|
99
92
|
export declare class IngressListItem extends IngressListItem_base {
|
|
100
93
|
constructor(data: IngressListItemData);
|
|
101
94
|
}
|
|
95
|
+
export declare class IngressListQuery extends ListQueryModel<IngressListQueryModelData> {
|
|
96
|
+
constructor(query?: IngressListQueryModelData);
|
|
97
|
+
refine(query?: IngressListQueryModelData): IngressListQuery;
|
|
98
|
+
execute: AsyncResourceVariant<() => Promise<IngressList>>;
|
|
99
|
+
getTotalCount: AsyncResourceVariant<() => Promise<number>>;
|
|
100
|
+
findOneAndOnly: AsyncResourceVariant<() => Promise<IngressListItem | undefined>>;
|
|
101
|
+
}
|
|
102
|
+
declare const IngressList_base: import("polytype").Polytype.ClusteredConstructor<[typeof IngressListQuery, {
|
|
103
|
+
new (items: IngressListItem[], totalCount: number): ListDataModel<IngressListItem>;
|
|
104
|
+
}]>;
|
|
105
|
+
export declare class IngressList extends IngressList_base {
|
|
106
|
+
constructor(query: IngressListQueryModelData, ingresses: IngressListItem[], totalCount: number);
|
|
107
|
+
getDefault(): IngressListItem;
|
|
108
|
+
}
|
|
102
109
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IngressListItemData, IngressData,
|
|
1
|
+
import { IngressListItemData, IngressData, IngressListQueryData } from "../types.js";
|
|
2
|
+
import { QueryResponseData } from "../../../base/index.js";
|
|
2
3
|
export interface IngressBehaviors {
|
|
3
4
|
find: (id: string) => Promise<IngressData | undefined>;
|
|
4
|
-
list: (query?:
|
|
5
|
+
list: (query?: IngressListQueryData) => Promise<QueryResponseData<IngressListItemData>>;
|
|
5
6
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { Project } from "../../project/index.js";
|
|
3
|
+
export type IngressListQueryData = MittwaldAPIV2.Paths.V2Ingresses.Get.Parameters.Query;
|
|
4
|
+
export type IngressListQueryModelData = Omit<IngressListQueryData, "projectId"> & {
|
|
5
|
+
project?: Project;
|
|
6
|
+
};
|
|
5
7
|
export type IngressData = MittwaldAPIV2.Operations.IngressGetIngress.ResponseData;
|
|
6
8
|
export type IngressListItemData = MittwaldAPIV2.Operations.IngressListIngresses.ResponseData[number];
|