@mittwald/api-models 0.0.0-development-74e1fd1-20240611 → 0.0.0-development-f311f07-20240822

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.
@@ -23,7 +23,7 @@ export class AppInstallation extends ReferenceModel {
23
23
  const data = await config.behaviors.appInstallation.list(projectId, query);
24
24
  return data.map((d) => new AppInstallationListItem(d));
25
25
  });
26
- getDetailed = provideReact(() => AppInstallation.get(this.id));
26
+ getDetailed = provideReact(() => AppInstallation.get(this.id), [this.id]);
27
27
  }
28
28
  // Common class for future extension
29
29
  class AppInstallationCommon extends classes((DataModel), AppInstallation) {
@@ -1 +1,4 @@
1
+ export * from "./assertObjectFound.js";
2
+ export * from "./DataModel.js";
3
+ export * from "./ReferenceModel.js";
1
4
  export * from "./types.js";
@@ -23,7 +23,7 @@ export class Customer extends ReferenceModel {
23
23
  assertObjectFound(customer, this, id);
24
24
  return customer;
25
25
  });
26
- getDetailed = provideReact(() => Customer.get(this.id));
26
+ getDetailed = provideReact(() => Customer.get(this.id), [this.id]);
27
27
  }
28
28
  // Common class for future extension
29
29
  class CustomerCommon extends classes((DataModel), Customer) {
@@ -27,7 +27,7 @@ export class Ingress extends ReferenceModel {
27
27
  assertObjectFound(ingress, this, id);
28
28
  return ingress;
29
29
  });
30
- getDetailed = provideReact(() => Ingress.get(this.id));
30
+ getDetailed = provideReact(() => Ingress.get(this.id), [this.id]);
31
31
  }
32
32
  export class IngressCommon extends classes((DataModel), Ingress) {
33
33
  baseUrl;
@@ -1,5 +1,12 @@
1
1
  import { reactUsePromise } from "../react/reactUsePromise.js";
2
- export const provideReact = (loader) => Object.assign(loader, {
3
- asResource: (...params) => reactUsePromise.getAsyncResource(loader, params),
4
- use: (...params) => reactUsePromise.getAsyncResource(loader, params).use(),
5
- });
2
+ export const provideReact = (loader, dependencies) => {
3
+ const getAsyncResource = (params) => reactUsePromise.getAsyncResource(loader, params, {
4
+ // "stringify" dependencies to be used as loaderId
5
+ // see https://github.com/mittwald/react-use-promise?tab=readme-ov-file#loaderid
6
+ loaderId: dependencies ? dependencies.join("|") : undefined,
7
+ });
8
+ return Object.assign(loader, {
9
+ asResource: (...params) => getAsyncResource(params),
10
+ use: (...params) => getAsyncResource(params).use(),
11
+ });
12
+ };
@@ -30,7 +30,7 @@ export class Project extends ReferenceModel {
30
30
  const { id } = await config.behaviors.project.create(serverId, description);
31
31
  return new Project(id);
32
32
  }
33
- getDetailed = provideReact(() => Project.get(this.id));
33
+ getDetailed = provideReact(() => Project.get(this.id), [this.id]);
34
34
  listIngresses = provideReact(() => Ingress.list({ projectId: this.id }));
35
35
  getDefaultIngress = provideReact(async () => {
36
36
  const ingresses = await Project.ofId(this.id).listIngresses();
@@ -6,24 +6,24 @@ import assertObjectFound from "../../base/assertObjectFound.js";
6
6
  import { Project } from "../../project/index.js";
7
7
  import { provideReact } from "../../lib/provideReact.js";
8
8
  export class Server extends ReferenceModel {
9
+ static ofId(id) {
10
+ return new Server(id);
11
+ }
9
12
  static find = provideReact(async (id) => {
10
- const serverData = await config.behaviors.server.find(id);
11
- if (serverData !== undefined) {
12
- return new ServerDetailed([serverData]);
13
+ const data = await config.behaviors.server.find(id);
14
+ if (data !== undefined) {
15
+ return new ServerDetailed(data);
13
16
  }
14
17
  });
15
18
  static get = provideReact(async (id) => {
16
- const server = await ServerDetailed.find(id);
19
+ const server = await this.find(id);
17
20
  assertObjectFound(server, this, id);
18
21
  return server;
19
22
  });
20
23
  static list = provideReact(async (query = {}) => {
21
24
  const projectListData = await config.behaviors.server.list(query);
22
- return projectListData.map((d) => new ServerListItem([d]));
25
+ return projectListData.map((d) => new ServerListItem(d));
23
26
  });
24
- static ofId(id) {
25
- return new Server(id);
26
- }
27
27
  async createProject(...parameters) {
28
28
  return Project.create(this.id, ...parameters);
29
29
  }
@@ -33,7 +33,7 @@ export class Server extends ReferenceModel {
33
33
  serverId: this.id,
34
34
  });
35
35
  });
36
- getDetailed = provideReact(() => ServerDetailed.get(this.id));
36
+ getDetailed = provideReact(() => Server.get(this.id), [this.id]);
37
37
  }
38
38
  // Common class for future extension
39
39
  class ServerCommon extends classes((DataModel), Server) {
@@ -41,7 +41,13 @@ class ServerCommon extends classes((DataModel), Server) {
41
41
  super([data], [data.id]);
42
42
  }
43
43
  }
44
- export class ServerListItem extends classes(ServerCommon, (DataModel)) {
45
- }
46
44
  export class ServerDetailed extends classes(ServerCommon, (DataModel)) {
45
+ constructor(data) {
46
+ super([data], [data]);
47
+ }
48
+ }
49
+ export class ServerListItem extends classes(ServerCommon, (DataModel)) {
50
+ constructor(data) {
51
+ super([data], [data]);
52
+ }
47
53
  }
@@ -1,5 +1,6 @@
1
1
  import { DataModel } from "../../base/DataModel.js";
2
2
  import { ReferenceModel } from "../../base/ReferenceModel.js";
3
+ import type { AsyncResourceVariant } from "../../lib/provideReact.js";
3
4
  import { AppInstallationListItemData, AppInstallationData } from "./types.js";
4
5
  export declare class AppInstallation extends ReferenceModel {
5
6
  static find: ((id: string) => Promise<AppInstallationDetailed | undefined>) & {
@@ -15,10 +16,7 @@ export declare class AppInstallation extends ReferenceModel {
15
16
  asResource: (projectId: string, query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2ProjectsProjectIdAppInstallations.Get.Parameters.Query | undefined) => import("@mittwald/react-use-promise").AsyncResource<AppInstallationListItem[]>;
16
17
  use: (projectId: string, query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2ProjectsProjectIdAppInstallations.Get.Parameters.Query | undefined) => AppInstallationListItem[];
17
18
  };
18
- getDetailed: (() => Promise<AppInstallationDetailed>) & {
19
- asResource: () => import("@mittwald/react-use-promise").AsyncResource<AppInstallationDetailed>;
20
- use: () => AppInstallationDetailed;
21
- };
19
+ getDetailed: AsyncResourceVariant<AppInstallationDetailed, []>;
22
20
  }
23
21
  declare const AppInstallationCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
24
22
  new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation | {
@@ -1 +1,4 @@
1
+ export * from "./assertObjectFound.js";
2
+ export * from "./DataModel.js";
3
+ export * from "./ReferenceModel.js";
1
4
  export * from "./types.js";
@@ -1,5 +1,6 @@
1
1
  import { DataModel } from "../../base/DataModel.js";
2
2
  import { ReferenceModel } from "../../base/ReferenceModel.js";
3
+ import type { AsyncResourceVariant } from "../../lib/provideReact.js";
3
4
  import { CustomerListItemData, CustomerData } from "./types.js";
4
5
  export declare class Customer extends ReferenceModel {
5
6
  static ofId(id: string): Customer;
@@ -15,10 +16,7 @@ export declare class Customer extends ReferenceModel {
15
16
  asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<CustomerDetailed>;
16
17
  use: (id: string) => CustomerDetailed;
17
18
  };
18
- getDetailed: (() => Promise<CustomerDetailed>) & {
19
- asResource: () => import("@mittwald/react-use-promise").AsyncResource<CustomerDetailed>;
20
- use: () => CustomerDetailed;
21
- };
19
+ getDetailed: AsyncResourceVariant<CustomerDetailed, []>;
22
20
  }
23
21
  declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
24
22
  new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
@@ -38,7 +36,7 @@ declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstruc
38
36
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
39
37
  projectCount: number;
40
38
  vatId?: string | undefined;
41
- vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
39
+ vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
42
40
  }): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
43
41
  activeSuspension?: {
44
42
  createdAt: string;
@@ -56,7 +54,7 @@ declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstruc
56
54
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
57
55
  projectCount: number;
58
56
  vatId?: string | undefined;
59
- vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
57
+ vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
60
58
  }>;
61
59
  }, typeof Customer]>;
62
60
  declare class CustomerCommon extends CustomerCommon_base {
@@ -80,7 +78,7 @@ declare const CustomerDetailed_base: import("polytype").Polytype.ClusteredConstr
80
78
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
81
79
  projectCount: number;
82
80
  vatId?: string | undefined;
83
- vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
81
+ vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
84
82
  }): DataModel<{
85
83
  activeSuspension?: {
86
84
  createdAt: string;
@@ -98,7 +96,7 @@ declare const CustomerDetailed_base: import("polytype").Polytype.ClusteredConstr
98
96
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
99
97
  projectCount: number;
100
98
  vatId?: string | undefined;
101
- vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
99
+ vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
102
100
  }>;
103
101
  }]>;
104
102
  export declare class CustomerDetailed extends CustomerDetailed_base {
@@ -1,5 +1,6 @@
1
1
  import { DataModel } from "../../base/DataModel.js";
2
2
  import { ReferenceModel } from "../../base/ReferenceModel.js";
3
+ import type { AsyncResourceVariant } from "../../lib/provideReact.js";
3
4
  import { IngressListItemData, IngressData, IngressListQuery } from "./types.js";
4
5
  import { IngressPath } from "../IngressPath/IngressPath.js";
5
6
  export declare class Ingress extends ReferenceModel {
@@ -17,10 +18,7 @@ export declare class Ingress extends ReferenceModel {
17
18
  asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<IngressDetailed>;
18
19
  use: (id: string) => IngressDetailed;
19
20
  };
20
- getDetailed: (() => Promise<IngressDetailed>) & {
21
- asResource: () => import("@mittwald/react-use-promise").AsyncResource<IngressDetailed>;
22
- use: () => IngressDetailed;
23
- };
21
+ getDetailed: AsyncResourceVariant<IngressDetailed, []>;
24
22
  }
25
23
  declare const IngressCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
26
24
  new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.IngressIngress | {
@@ -1,7 +1,7 @@
1
1
  import { AsyncResource } from "../react/reactUsePromise.js";
2
2
  type FnParameters = unknown[];
3
3
  type AsyncFn<TResult, TParams extends FnParameters> = (...args: TParams) => Promise<TResult>;
4
- export declare const provideReact: <TValue, TParams extends FnParameters>(loader: AsyncFn<TValue, TParams>) => AsyncResourceVariant<TValue, TParams>;
4
+ export declare const provideReact: <TValue, TParams extends FnParameters>(loader: AsyncFn<TValue, TParams>, dependencies?: string[]) => AsyncResourceVariant<TValue, TParams>;
5
5
  export type AsyncResourceVariant<TValue, TParams extends FnParameters> = TParams extends null ? AsyncFn<TValue, TParams> & {
6
6
  asResource: () => AsyncResource<TValue>;
7
7
  } : AsyncFn<TValue, TParams> & {
@@ -1,6 +1,7 @@
1
1
  import { ProjectListItemData, ProjectData } from "./types.js";
2
2
  import { DataModel } from "../../base/DataModel.js";
3
3
  import { Server } from "../../server/index.js";
4
+ import { type AsyncResourceVariant } from "../../lib/provideReact.js";
4
5
  import { Customer } from "../../customer/Customer/Customer.js";
5
6
  import { ReferenceModel } from "../../base/ReferenceModel.js";
6
7
  import { IngressListItem } from "../../domain/index.js";
@@ -19,18 +20,9 @@ export declare class Project extends ReferenceModel {
19
20
  use: (query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query | undefined) => readonly ProjectListItem[];
20
21
  };
21
22
  static create(serverId: string, description: string): Promise<Project>;
22
- getDetailed: (() => Promise<ProjectDetailed>) & {
23
- asResource: () => import("@mittwald/react-use-promise").AsyncResource<ProjectDetailed>;
24
- use: () => ProjectDetailed;
25
- };
26
- listIngresses: (() => Promise<IngressListItem[]>) & {
27
- asResource: () => import("@mittwald/react-use-promise").AsyncResource<IngressListItem[]>;
28
- use: () => IngressListItem[];
29
- };
30
- getDefaultIngress: (() => Promise<IngressListItem>) & {
31
- asResource: () => import("@mittwald/react-use-promise").AsyncResource<IngressListItem>;
32
- use: () => IngressListItem;
33
- };
23
+ getDetailed: AsyncResourceVariant<ProjectDetailed, []>;
24
+ listIngresses: AsyncResourceVariant<IngressListItem[], []>;
25
+ getDefaultIngress: AsyncResourceVariant<IngressListItem, []>;
34
26
  updateDescription(description: string): Promise<void>;
35
27
  leave(): Promise<void>;
36
28
  delete(): Promise<void>;
@@ -56,7 +48,7 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
56
48
  serverId?: string | undefined;
57
49
  serverShortId?: string | undefined;
58
50
  shortId: string;
59
- spec?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | undefined;
51
+ spec?: (import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec) | undefined;
60
52
  statisticsBaseDomain?: string | undefined;
61
53
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
62
54
  statusSetAt: string;
@@ -69,15 +61,15 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
69
61
  id: string;
70
62
  };
71
63
  description: string;
72
- disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason | undefined;
73
- disabledAt?: string | undefined;
64
+ disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason;
65
+ disabledAt?: string;
74
66
  enabled: boolean;
75
67
  id: string;
76
- imageRefId?: string | undefined;
68
+ imageRefId?: string;
77
69
  isReady: boolean;
78
- projectHostingId?: string | undefined;
70
+ projectHostingId?: string;
79
71
  readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedProjectReadinessStatus;
80
- serverId?: string | undefined;
72
+ serverId?: string;
81
73
  shortId: string;
82
74
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
83
75
  statusSetAt: string;
@@ -103,7 +95,7 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
103
95
  serverId?: string | undefined;
104
96
  serverShortId?: string | undefined;
105
97
  shortId: string;
106
- spec?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | undefined;
98
+ spec?: (import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec) | undefined;
107
99
  statisticsBaseDomain?: string | undefined;
108
100
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
109
101
  statusSetAt: string;
@@ -116,15 +108,15 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
116
108
  id: string;
117
109
  };
118
110
  description: string;
119
- disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason | undefined;
120
- disabledAt?: string | undefined;
111
+ disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason;
112
+ disabledAt?: string;
121
113
  enabled: boolean;
122
114
  id: string;
123
- imageRefId?: string | undefined;
115
+ imageRefId?: string;
124
116
  isReady: boolean;
125
- projectHostingId?: string | undefined;
117
+ projectHostingId?: string;
126
118
  readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedProjectReadinessStatus;
127
- serverId?: string | undefined;
119
+ serverId?: string;
128
120
  shortId: string;
129
121
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
130
122
  statusSetAt: string;
@@ -158,7 +150,7 @@ declare const ProjectDetailed_base: import("polytype").Polytype.ClusteredConstru
158
150
  serverId?: string | undefined;
159
151
  serverShortId?: string | undefined;
160
152
  shortId: string;
161
- spec?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | undefined;
153
+ spec?: (import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec) | undefined;
162
154
  statisticsBaseDomain?: string | undefined;
163
155
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
164
156
  statusSetAt: string;
@@ -184,7 +176,7 @@ declare const ProjectDetailed_base: import("polytype").Polytype.ClusteredConstru
184
176
  serverId?: string | undefined;
185
177
  serverShortId?: string | undefined;
186
178
  shortId: string;
187
- spec?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | undefined;
179
+ spec?: (import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectVisitorSpec | import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectHardwareSpec) | undefined;
188
180
  statisticsBaseDomain?: string | undefined;
189
181
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
190
182
  statusSetAt: string;
@@ -203,15 +195,15 @@ declare const ProjectListItem_base: import("polytype").Polytype.ClusteredConstru
203
195
  id: string;
204
196
  };
205
197
  description: string;
206
- disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason | undefined;
207
- disabledAt?: string | undefined;
198
+ disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason;
199
+ disabledAt?: string;
208
200
  enabled: boolean;
209
201
  id: string;
210
- imageRefId?: string | undefined;
202
+ imageRefId?: string;
211
203
  isReady: boolean;
212
- projectHostingId?: string | undefined;
204
+ projectHostingId?: string;
213
205
  readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedProjectReadinessStatus;
214
- serverId?: string | undefined;
206
+ serverId?: string;
215
207
  shortId: string;
216
208
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
217
209
  statusSetAt: string;
@@ -224,15 +216,15 @@ declare const ProjectListItem_base: import("polytype").Polytype.ClusteredConstru
224
216
  id: string;
225
217
  };
226
218
  description: string;
227
- disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason | undefined;
228
- disabledAt?: string | undefined;
219
+ disableReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDisableReason;
220
+ disabledAt?: string;
229
221
  enabled: boolean;
230
222
  id: string;
231
- imageRefId?: string | undefined;
223
+ imageRefId?: string;
232
224
  isReady: boolean;
233
- projectHostingId?: string | undefined;
225
+ projectHostingId?: string;
234
226
  readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedProjectReadinessStatus;
235
- serverId?: string | undefined;
227
+ serverId?: string;
236
228
  shortId: string;
237
229
  status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectProjectStatus;
238
230
  statusSetAt: string;
@@ -1,31 +1,29 @@
1
1
  import { ReferenceModel } from "../../base/ReferenceModel.js";
2
- import { ServerListItemData, ServerData } from "./types.js";
2
+ import { ServerData, ServerListItemData } from "./types.js";
3
3
  import { DataModel } from "../../base/DataModel.js";
4
4
  import { Project } from "../../project/index.js";
5
5
  import { ParamsExceptFirst } from "../../lib/types.js";
6
+ import { AsyncResourceVariant } from "../../lib/provideReact.js";
6
7
  export declare class Server extends ReferenceModel {
7
- static find: ((id: string) => Promise<Server | undefined>) & {
8
- asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<Server | undefined>;
9
- use: (id: string) => Server | undefined;
8
+ static ofId(id: string): Server;
9
+ static find: ((id: string) => Promise<ServerDetailed | undefined>) & {
10
+ asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<ServerDetailed | undefined>;
11
+ use: (id: string) => ServerDetailed | undefined;
10
12
  };
11
- static get: ((id: string) => Promise<Server>) & {
12
- asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<Server>;
13
- use: (id: string) => Server;
13
+ static get: ((id: string) => Promise<ServerDetailed>) & {
14
+ asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<ServerDetailed>;
15
+ use: (id: string) => ServerDetailed;
14
16
  };
15
17
  static list: ((query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Servers.Get.Parameters.Query | undefined) => Promise<ServerListItem[]>) & {
16
18
  asResource: (query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Servers.Get.Parameters.Query | undefined) => import("@mittwald/react-use-promise").AsyncResource<ServerListItem[]>;
17
19
  use: (query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Servers.Get.Parameters.Query | undefined) => ServerListItem[];
18
20
  };
19
- static ofId(id: string): Server;
20
21
  createProject(...parameters: ParamsExceptFirst<typeof Project.create>): ReturnType<typeof Project.create>;
21
22
  listProjects: ((query?: Omit<import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query | undefined, "serverId"> | undefined) => Promise<readonly import("../../project/index.js").ProjectListItem[]>) & {
22
23
  asResource: (query?: Omit<import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query | undefined, "serverId"> | undefined) => import("@mittwald/react-use-promise").AsyncResource<readonly import("../../project/index.js").ProjectListItem[]>;
23
24
  use: (query?: Omit<import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Projects.Get.Parameters.Query | undefined, "serverId"> | undefined) => readonly import("../../project/index.js").ProjectListItem[];
24
25
  };
25
- getDetailed: (() => Promise<ServerDetailed>) & {
26
- asResource: () => import("@mittwald/react-use-promise").AsyncResource<ServerDetailed>;
27
- use: () => ServerDetailed;
28
- };
26
+ getDetailed: AsyncResourceVariant<ServerDetailed, []>;
29
27
  }
30
28
  declare const ServerCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
31
29
  new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServer | {
@@ -33,7 +31,7 @@ declare const ServerCommon_base: import("polytype").Polytype.ClusteredConstructo
33
31
  createdAt: string;
34
32
  customerId: string;
35
33
  description: string;
36
- disabledReason?: "suspended" | undefined;
34
+ disabledReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServerDisableReason | undefined;
37
35
  id: string;
38
36
  imageRefId?: string | undefined;
39
37
  isReady: boolean;
@@ -48,7 +46,7 @@ declare const ServerCommon_base: import("polytype").Polytype.ClusteredConstructo
48
46
  createdAt: string;
49
47
  customerId: string;
50
48
  description: string;
51
- disabledReason?: "suspended" | undefined;
49
+ disabledReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServerDisableReason | undefined;
52
50
  id: string;
53
51
  imageRefId?: string | undefined;
54
52
  isReady: boolean;
@@ -63,10 +61,46 @@ declare const ServerCommon_base: import("polytype").Polytype.ClusteredConstructo
63
61
  declare class ServerCommon extends ServerCommon_base {
64
62
  constructor(data: ServerListItemData | ServerData);
65
63
  }
66
- declare const ServerListItem_base: import("polytype").Polytype.ClusteredConstructor<[typeof ServerCommon, typeof DataModel<ServerListItemData>]>;
67
- export declare class ServerListItem extends ServerListItem_base {
68
- }
69
- declare const ServerDetailed_base: import("polytype").Polytype.ClusteredConstructor<[typeof ServerCommon, typeof DataModel<ServerData>]>;
64
+ declare const ServerDetailed_base: import("polytype").Polytype.ClusteredConstructor<[typeof ServerCommon, {
65
+ new (data: {
66
+ clusterName: string;
67
+ createdAt: string;
68
+ customerId: string;
69
+ description: string;
70
+ disabledReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServerDisableReason | undefined;
71
+ id: string;
72
+ imageRefId?: string | undefined;
73
+ isReady: boolean;
74
+ machineType: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectMachineType;
75
+ readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedServerReadinessStatus;
76
+ shortId: string;
77
+ statisticsBaseDomain?: string | undefined;
78
+ status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServerStatus;
79
+ storage: string;
80
+ }): DataModel<{
81
+ clusterName: string;
82
+ createdAt: string;
83
+ customerId: string;
84
+ description: string;
85
+ disabledReason?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServerDisableReason | undefined;
86
+ id: string;
87
+ imageRefId?: string | undefined;
88
+ isReady: boolean;
89
+ machineType: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectMachineType;
90
+ readiness: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectDeprecatedServerReadinessStatus;
91
+ shortId: string;
92
+ statisticsBaseDomain?: string | undefined;
93
+ status: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServerStatus;
94
+ storage: string;
95
+ }>;
96
+ }]>;
70
97
  export declare class ServerDetailed extends ServerDetailed_base {
98
+ constructor(data: ServerData);
99
+ }
100
+ declare const ServerListItem_base: import("polytype").Polytype.ClusteredConstructor<[typeof ServerCommon, {
101
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServer): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ProjectServer>;
102
+ }]>;
103
+ export declare class ServerListItem extends ServerListItem_base {
104
+ constructor(data: ServerListItemData);
71
105
  }
72
106
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/api-models",
3
- "version": "0.0.0-development-74e1fd1-20240611",
3
+ "version": "0.0.0-development-f311f07-20240822",
4
4
  "author": "Mittwald CM Service GmbH & Co. KG <opensource@mittwald.de>",
5
5
  "type": "module",
6
6
  "description": "Collection of domain models for coherent interaction with the API",
@@ -34,31 +34,33 @@
34
34
  "build": "run build:clean && run tsc",
35
35
  "build:clean": "rimraf dist",
36
36
  "lint": "run eslint .",
37
- "test": "node --experimental-vm-modules $(yarn bin jest)"
37
+ "test": "",
38
+ "test:compile": "run tsc --noEmit",
39
+ "test:unit": "node --experimental-vm-modules $(yarn bin jest)"
38
40
  },
39
41
  "dependencies": {
40
- "@mittwald/api-client": "^0.0.0-development-74e1fd1-20240611",
42
+ "@mittwald/api-client": "^0.0.0-development-f311f07-20240822",
41
43
  "another-deep-freeze": "^1.0.0",
42
44
  "polytype": "^0.17.0",
43
- "type-fest": "^4.12.0"
45
+ "type-fest": "^4.23.0"
44
46
  },
45
47
  "devDependencies": {
46
48
  "@jest/globals": "^29.7.0",
47
- "@mittwald/react-use-promise": "^2.3.12",
49
+ "@mittwald/react-use-promise": "^2.3.13",
48
50
  "@types/jest": "^29.5.12",
49
- "@types/react": "^18.2.64",
50
- "@typescript-eslint/eslint-plugin": "^7.1.1",
51
- "@typescript-eslint/parser": "^7.1.1",
51
+ "@types/react": "^18.3.3",
52
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
53
+ "@typescript-eslint/parser": "^7.18.0",
52
54
  "eslint": "^8.57.0",
53
55
  "eslint-config-prettier": "^9.1.0",
54
56
  "eslint-plugin-json": "^3.1.0",
55
- "eslint-plugin-prettier": "^5.1.3",
57
+ "eslint-plugin-prettier": "^5.2.1",
56
58
  "jest": "^29.7.0",
57
- "prettier": "^3.2.5",
58
- "react": "^18.2.0",
59
- "rimraf": "^5.0.5",
60
- "ts-jest": "^29.1.2",
61
- "typescript": "^5.4.2"
59
+ "prettier": "^3.3.3",
60
+ "react": "^18.3.1",
61
+ "rimraf": "^5.0.10",
62
+ "ts-jest": "^29.2.4",
63
+ "typescript": "^5.5.4"
62
64
  },
63
65
  "peerDependencies": {
64
66
  "@mittwald/react-use-promise": "^2.3.12"
@@ -71,5 +73,5 @@
71
73
  "optional": true
72
74
  }
73
75
  },
74
- "gitHead": "1cf903cbfe7720456fdf81dfe0cfed006debe130"
76
+ "gitHead": "030ac6e74067e5f4f8ab2452bad60b4476e23045"
75
77
  }