@mittwald/api-models 0.0.0-development-f311f07-20240822 → 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 +47 -3
- 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 +2 -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 +58 -5
- package/dist/esm/customer/Customer/behaviors/api.js +12 -2
- package/dist/esm/domain/Ingress/Ingress.js +55 -5
- package/dist/esm/domain/Ingress/behaviors/api.js +7 -5
- package/dist/esm/project/Project/Project.js +56 -4
- 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 +53 -4
- package/dist/esm/server/Server/behaviors/api.js +5 -2
- package/dist/types/app/AppInstallation/AppInstallation.d.ts +26 -15
- 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 +2 -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 +30 -15
- 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 -15
- 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 +59 -41
- 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 +30 -21
- package/dist/types/server/Server/behaviors/types.d.ts +3 -2
- package/dist/types/server/Server/types.d.ts +5 -1
- package/package.json +13 -4
- package/dist/esm/lib/provideReact.js +0 -12
- 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,9 +3,18 @@ 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
|
+
}
|
|
9
18
|
static ofId(id) {
|
|
10
19
|
return new Server(id);
|
|
11
20
|
}
|
|
@@ -20,13 +29,17 @@ export class Server extends ReferenceModel {
|
|
|
20
29
|
assertObjectFound(server, this, id);
|
|
21
30
|
return server;
|
|
22
31
|
});
|
|
32
|
+
static query(query = {}) {
|
|
33
|
+
return new ServerListQuery(query);
|
|
34
|
+
}
|
|
35
|
+
/** @deprecated: use query() or customer.servers */
|
|
23
36
|
static list = provideReact(async (query = {}) => {
|
|
24
|
-
|
|
25
|
-
return projectListData.map((d) => new ServerListItem(d));
|
|
37
|
+
return new ServerListQuery(query).execute().then((r) => r.items);
|
|
26
38
|
});
|
|
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,
|
|
@@ -34,6 +47,7 @@ export class Server extends ReferenceModel {
|
|
|
34
47
|
});
|
|
35
48
|
});
|
|
36
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) {
|
|
@@ -51,3 +65,38 @@ export class ServerListItem extends classes(ServerCommon, (DataModel)) {
|
|
|
51
65
|
super([data], [data]);
|
|
52
66
|
}
|
|
53
67
|
}
|
|
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
|
+
}
|
|
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,22 +1,19 @@
|
|
|
1
1
|
import { DataModel } from "../../base/DataModel.js";
|
|
2
2
|
import { ReferenceModel } from "../../base/ReferenceModel.js";
|
|
3
|
-
import
|
|
4
|
-
import { AppInstallationListItemData,
|
|
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";
|
|
5
8
|
export declare class AppInstallation extends ReferenceModel {
|
|
6
|
-
static find: (
|
|
7
|
-
|
|
8
|
-
use: (id: string) => AppInstallationDetailed | undefined;
|
|
9
|
-
};
|
|
10
|
-
static get: ((id: string) => Promise<AppInstallationDetailed>) & {
|
|
11
|
-
asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<AppInstallationDetailed>;
|
|
12
|
-
use: (id: string) => AppInstallationDetailed;
|
|
13
|
-
};
|
|
9
|
+
static find: AsyncResourceVariant<(id: string) => Promise<AppInstallationDetailed | undefined>>;
|
|
10
|
+
static get: AsyncResourceVariant<(id: string) => Promise<AppInstallationDetailed>>;
|
|
14
11
|
static ofId(id: string): AppInstallation;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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>>;
|
|
20
17
|
}
|
|
21
18
|
declare const AppInstallationCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
|
|
22
19
|
new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation | {
|
|
@@ -104,4 +101,18 @@ declare const AppInstallationListItem_base: import("polytype").Polytype.Clustere
|
|
|
104
101
|
export declare class AppInstallationListItem extends AppInstallationListItem_base {
|
|
105
102
|
constructor(data: AppInstallationListItemData);
|
|
106
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
|
+
}
|
|
107
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,22 +1,24 @@
|
|
|
1
1
|
import { DataModel } from "../../base/DataModel.js";
|
|
2
2
|
import { ReferenceModel } from "../../base/ReferenceModel.js";
|
|
3
|
-
import
|
|
4
|
-
import { CustomerListItemData,
|
|
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";
|
|
5
9
|
export declare class Customer extends ReferenceModel {
|
|
10
|
+
readonly servers: ServerListQuery;
|
|
11
|
+
readonly projects: ProjectListQuery;
|
|
12
|
+
constructor(id: string);
|
|
6
13
|
static ofId(id: string): Customer;
|
|
7
|
-
static find: (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
static
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
static get: ((id: string) => Promise<CustomerDetailed>) & {
|
|
16
|
-
asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<CustomerDetailed>;
|
|
17
|
-
use: (id: string) => CustomerDetailed;
|
|
18
|
-
};
|
|
19
|
-
getDetailed: AsyncResourceVariant<CustomerDetailed, []>;
|
|
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>;
|
|
20
22
|
}
|
|
21
23
|
declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
|
|
22
24
|
new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
|
|
@@ -108,4 +110,17 @@ declare const CustomerListItem_base: import("polytype").Polytype.ClusteredConstr
|
|
|
108
110
|
export declare class CustomerListItem extends CustomerListItem_base {
|
|
109
111
|
constructor(data: CustomerListItemData);
|
|
110
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
|
+
}
|
|
111
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,24 +1,19 @@
|
|
|
1
1
|
import { DataModel } from "../../base/DataModel.js";
|
|
2
2
|
import { ReferenceModel } from "../../base/ReferenceModel.js";
|
|
3
|
-
import
|
|
4
|
-
import { IngressListItemData,
|
|
3
|
+
import { AsyncResourceVariant } from "../../react/provideReact.js";
|
|
4
|
+
import { IngressData, IngressListItemData, IngressListQueryData, IngressListQueryModelData } from "./types.js";
|
|
5
5
|
import { IngressPath } from "../IngressPath/IngressPath.js";
|
|
6
|
+
import { ListQueryModel } from "../../base/ListQueryModel.js";
|
|
7
|
+
import { ListDataModel } from "../../base/ListDataModel.js";
|
|
6
8
|
export declare class Ingress extends ReferenceModel {
|
|
7
9
|
static ofId(id: string): Ingress;
|
|
8
10
|
static ofHostname(hostname: string): Ingress;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
use: (id: string) => IngressDetailed | undefined;
|
|
16
|
-
};
|
|
17
|
-
static get: ((id: string) => Promise<IngressDetailed>) & {
|
|
18
|
-
asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<IngressDetailed>;
|
|
19
|
-
use: (id: string) => IngressDetailed;
|
|
20
|
-
};
|
|
21
|
-
getDetailed: AsyncResourceVariant<IngressDetailed, []>;
|
|
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>>;
|
|
22
17
|
}
|
|
23
18
|
declare const IngressCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
|
|
24
19
|
new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.IngressIngress | {
|
|
@@ -97,4 +92,18 @@ declare const IngressListItem_base: import("polytype").Polytype.ClusteredConstru
|
|
|
97
92
|
export declare class IngressListItem extends IngressListItem_base {
|
|
98
93
|
constructor(data: IngressListItemData);
|
|
99
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
|
+
}
|
|
100
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];
|
|
@@ -1,36 +1,59 @@
|
|
|
1
|
-
import { ProjectListItemData,
|
|
1
|
+
import { ProjectData, ProjectListItemData, ProjectListQueryData, ProjectListQueryModelData } from "./types.js";
|
|
2
2
|
import { DataModel } from "../../base/DataModel.js";
|
|
3
3
|
import { Server } from "../../server/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { AsyncResourceVariant } from "../../react/provideReact.js";
|
|
5
5
|
import { Customer } from "../../customer/Customer/Customer.js";
|
|
6
6
|
import { ReferenceModel } from "../../base/ReferenceModel.js";
|
|
7
|
-
import { IngressListItem } from "../../domain/index.js";
|
|
7
|
+
import { IngressListItem, IngressListQuery } from "../../domain/index.js";
|
|
8
|
+
import { ListQueryModel } from "../../base/ListQueryModel.js";
|
|
9
|
+
import { ListDataModel } from "../../base/ListDataModel.js";
|
|
10
|
+
import { AppInstallationListQuery } from "../../app/index.js";
|
|
8
11
|
export declare class Project extends ReferenceModel {
|
|
12
|
+
readonly ingresses: IngressListQuery;
|
|
13
|
+
readonly appInstallations: AppInstallationListQuery;
|
|
14
|
+
constructor(id: string);
|
|
9
15
|
static ofId(id: string): Project;
|
|
10
|
-
static find: (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static
|
|
15
|
-
asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<ProjectDetailed>;
|
|
16
|
-
use: (id: string) => ProjectDetailed;
|
|
17
|
-
};
|
|
18
|
-
static list: ((query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query | undefined) => Promise<readonly ProjectListItem[]>) & {
|
|
19
|
-
asResource: (query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query | undefined) => import("@mittwald/react-use-promise").AsyncResource<readonly ProjectListItem[]>;
|
|
20
|
-
use: (query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query | undefined) => readonly ProjectListItem[];
|
|
21
|
-
};
|
|
16
|
+
static find: AsyncResourceVariant<(id: string) => Promise<ProjectDetailed | undefined>>;
|
|
17
|
+
static get: AsyncResourceVariant<(id: string) => Promise<ProjectDetailed>>;
|
|
18
|
+
static query(query?: ProjectListQueryModelData): ProjectListQuery;
|
|
19
|
+
/** @deprecated: use query(), Customer.projects or Server.projects */
|
|
20
|
+
static list: AsyncResourceVariant<(query?: ProjectListQueryData) => Promise<Readonly<Array<ProjectListItem>>>>;
|
|
22
21
|
static create(serverId: string, description: string): Promise<Project>;
|
|
23
|
-
getDetailed: AsyncResourceVariant<ProjectDetailed
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
getDetailed: AsyncResourceVariant<() => Promise<ProjectDetailed>>;
|
|
23
|
+
findDetailed: AsyncResourceVariant<() => Promise<ProjectDetailed | undefined>>;
|
|
24
|
+
/** @deprecated: use ingresses property */
|
|
25
|
+
listIngresses: AsyncResourceVariant<() => Promise<readonly IngressListItem[]>>;
|
|
26
|
+
getDefaultIngress: AsyncResourceVariant<() => Promise<IngressListItem>>;
|
|
26
27
|
updateDescription(description: string): Promise<void>;
|
|
27
28
|
leave(): Promise<void>;
|
|
28
29
|
delete(): Promise<void>;
|
|
29
30
|
}
|
|
30
31
|
declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
|
|
31
32
|
new (data: {
|
|
33
|
+
createdAt: string;
|
|
34
|
+
customerId: string;
|
|
35
|
+
customerMeta: {
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
description: string;
|
|
39
|
+
disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason;
|
|
40
|
+
disabledAt?: string;
|
|
41
|
+
enabled: boolean;
|
|
42
|
+
id: string;
|
|
43
|
+
imageRefId?: string;
|
|
44
|
+
isReady: boolean;
|
|
45
|
+
projectHostingId?: string;
|
|
46
|
+
readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedProjectReadinessStatus;
|
|
47
|
+
serverId?: string;
|
|
48
|
+
shortId: string;
|
|
49
|
+
status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
|
|
50
|
+
statusSetAt: string;
|
|
51
|
+
webStorageUsageInBytes: number;
|
|
52
|
+
webStorageUsageInBytesSetAt: string;
|
|
53
|
+
} | {
|
|
32
54
|
clusterDomain?: string | undefined;
|
|
33
55
|
clusterID?: string | undefined;
|
|
56
|
+
clusterId?: string | undefined;
|
|
34
57
|
createdAt: string;
|
|
35
58
|
customerId: string;
|
|
36
59
|
description: string;
|
|
@@ -54,7 +77,7 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
|
|
|
54
77
|
statusSetAt: string;
|
|
55
78
|
webStorageUsageInBytes: number;
|
|
56
79
|
webStorageUsageInBytesSetAt: string;
|
|
57
|
-
}
|
|
80
|
+
}): DataModel<{
|
|
58
81
|
createdAt: string;
|
|
59
82
|
customerId: string;
|
|
60
83
|
customerMeta: {
|
|
@@ -75,9 +98,10 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
|
|
|
75
98
|
statusSetAt: string;
|
|
76
99
|
webStorageUsageInBytes: number;
|
|
77
100
|
webStorageUsageInBytesSetAt: string;
|
|
78
|
-
}
|
|
101
|
+
} | {
|
|
79
102
|
clusterDomain?: string | undefined;
|
|
80
103
|
clusterID?: string | undefined;
|
|
104
|
+
clusterId?: string | undefined;
|
|
81
105
|
createdAt: string;
|
|
82
106
|
customerId: string;
|
|
83
107
|
description: string;
|
|
@@ -101,27 +125,6 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
|
|
|
101
125
|
statusSetAt: string;
|
|
102
126
|
webStorageUsageInBytes: number;
|
|
103
127
|
webStorageUsageInBytesSetAt: string;
|
|
104
|
-
} | {
|
|
105
|
-
createdAt: string;
|
|
106
|
-
customerId: string;
|
|
107
|
-
customerMeta: {
|
|
108
|
-
id: string;
|
|
109
|
-
};
|
|
110
|
-
description: string;
|
|
111
|
-
disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason;
|
|
112
|
-
disabledAt?: string;
|
|
113
|
-
enabled: boolean;
|
|
114
|
-
id: string;
|
|
115
|
-
imageRefId?: string;
|
|
116
|
-
isReady: boolean;
|
|
117
|
-
projectHostingId?: string;
|
|
118
|
-
readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedProjectReadinessStatus;
|
|
119
|
-
serverId?: string;
|
|
120
|
-
shortId: string;
|
|
121
|
-
status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
|
|
122
|
-
statusSetAt: string;
|
|
123
|
-
webStorageUsageInBytes: number;
|
|
124
|
-
webStorageUsageInBytesSetAt: string;
|
|
125
128
|
}>;
|
|
126
129
|
}, typeof Project]>;
|
|
127
130
|
declare class ProjectCommon extends ProjectCommon_base {
|
|
@@ -133,6 +136,7 @@ declare const ProjectDetailed_base: import("polytype").Polytype.ClusteredConstru
|
|
|
133
136
|
new (data: {
|
|
134
137
|
clusterDomain?: string | undefined;
|
|
135
138
|
clusterID?: string | undefined;
|
|
139
|
+
clusterId?: string | undefined;
|
|
136
140
|
createdAt: string;
|
|
137
141
|
customerId: string;
|
|
138
142
|
description: string;
|
|
@@ -159,6 +163,7 @@ declare const ProjectDetailed_base: import("polytype").Polytype.ClusteredConstru
|
|
|
159
163
|
}): DataModel<{
|
|
160
164
|
clusterDomain?: string | undefined;
|
|
161
165
|
clusterID?: string | undefined;
|
|
166
|
+
clusterId?: string | undefined;
|
|
162
167
|
createdAt: string;
|
|
163
168
|
customerId: string;
|
|
164
169
|
description: string;
|
|
@@ -235,4 +240,17 @@ declare const ProjectListItem_base: import("polytype").Polytype.ClusteredConstru
|
|
|
235
240
|
export declare class ProjectListItem extends ProjectListItem_base {
|
|
236
241
|
constructor(data: ProjectListItemData);
|
|
237
242
|
}
|
|
243
|
+
export declare class ProjectListQuery extends ListQueryModel<ProjectListQueryModelData> {
|
|
244
|
+
constructor(query?: ProjectListQueryModelData);
|
|
245
|
+
refine(query: ProjectListQueryModelData): ProjectListQuery;
|
|
246
|
+
execute: AsyncResourceVariant<() => Promise<ProjectList>>;
|
|
247
|
+
getTotalCount: AsyncResourceVariant<() => Promise<number>>;
|
|
248
|
+
findOneAndOnly: AsyncResourceVariant<() => Promise<ProjectListItem | undefined>>;
|
|
249
|
+
}
|
|
250
|
+
declare const ProjectList_base: import("polytype").Polytype.ClusteredConstructor<[typeof ProjectListQuery, {
|
|
251
|
+
new (items: ProjectListItem[], totalCount: number): ListDataModel<ProjectListItem>;
|
|
252
|
+
}]>;
|
|
253
|
+
export declare class ProjectList extends ProjectList_base {
|
|
254
|
+
constructor(query: ProjectListQueryModelData, projects: ProjectListItem[], totalCount: number);
|
|
255
|
+
}
|
|
238
256
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ProjectListItemData, ProjectData,
|
|
1
|
+
import { ProjectListItemData, ProjectData, ProjectListQueryData } from "../types.js";
|
|
2
|
+
import { QueryResponseData } from "../../../base/index.js";
|
|
2
3
|
export interface ProjectBehaviors {
|
|
3
4
|
find: (id: string) => Promise<ProjectData | undefined>;
|
|
4
|
-
list: (query?:
|
|
5
|
+
list: (query?: ProjectListQueryData) => Promise<QueryResponseData<ProjectListItemData>>;
|
|
5
6
|
create: (serverId: string, description: string) => Promise<{
|
|
6
7
|
id: string;
|
|
7
8
|
}>;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { MittwaldAPIV2 } from "@mittwald/api-client";
|
|
2
|
-
|
|
2
|
+
import { Server } from "../../server/index.js";
|
|
3
|
+
import { Customer } from "../../customer/index.js";
|
|
4
|
+
export type ProjectListQueryData = MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query;
|
|
5
|
+
export type ProjectListQueryModelData = Omit<ProjectListQueryData, "serverId" | "customerId"> & {
|
|
6
|
+
server?: Server;
|
|
7
|
+
customer?: Customer;
|
|
8
|
+
};
|
|
3
9
|
export type ProjectData = MittwaldAPIV2.Operations.ProjectGetProject.ResponseData;
|
|
4
10
|
export type ProjectListItemData = MittwaldAPIV2.Operations.ProjectListProjects.ResponseData[number];
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from "react";
|
|
2
|
-
|
|
1
|
+
import { FC, PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
interface Props extends PropsWithChildren {
|
|
3
|
+
fallback?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare const MittwaldApiModelProvider: FC<Props>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Commons } from "@mittwald/api-client";
|
|
2
|
+
export declare const refreshProvideReactCache: (tag: string) => void;
|
|
3
|
+
export declare const addTagToProvideReactCache: (tag: string) => void;
|
|
4
|
+
export declare const addUrlTagToProvideReactCache: Commons.RequestOptions["onBeforeRequest"];
|