@mittwald/api-models 0.1.0-alpha.1 → 4.10.0

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.
Files changed (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -10
  3. package/dist/esm/app/AppInstallation/AppInstallation.js +43 -0
  4. package/dist/esm/app/AppInstallation/behaviors/api.js +21 -0
  5. package/dist/esm/app/AppInstallation/behaviors/index.js +2 -0
  6. package/dist/esm/app/AppInstallation/behaviors/types.js +1 -0
  7. package/dist/esm/app/AppInstallation/index.js +2 -0
  8. package/dist/esm/app/AppInstallation/types.js +1 -0
  9. package/dist/esm/app/index.js +1 -0
  10. package/dist/esm/base/DataModel.js +7 -0
  11. package/dist/esm/base/ReferenceModel.js +9 -0
  12. package/dist/esm/base/assertObjectFound.js +9 -0
  13. package/dist/esm/base/index.js +1 -0
  14. package/dist/esm/base/types.js +1 -0
  15. package/dist/esm/config/behaviors/api.js +40 -0
  16. package/dist/esm/config/behaviors/index.js +1 -0
  17. package/dist/esm/config/config.js +9 -0
  18. package/dist/esm/config/index.js +1 -0
  19. package/dist/esm/customer/Customer/Customer.js +43 -0
  20. package/dist/esm/customer/Customer/behaviors/api.js +20 -0
  21. package/dist/esm/customer/Customer/behaviors/index.js +2 -0
  22. package/dist/esm/customer/Customer/behaviors/types.js +1 -0
  23. package/dist/esm/customer/Customer/index.js +2 -0
  24. package/dist/esm/customer/Customer/types.js +1 -0
  25. package/dist/esm/customer/index.js +1 -0
  26. package/dist/esm/domain/Ingress/Ingress.js +56 -0
  27. package/dist/esm/domain/Ingress/behaviors/api.js +23 -0
  28. package/dist/esm/domain/Ingress/behaviors/index.js +2 -0
  29. package/dist/esm/domain/Ingress/behaviors/types.js +1 -0
  30. package/dist/esm/domain/Ingress/index.js +2 -0
  31. package/dist/esm/domain/Ingress/types.js +1 -0
  32. package/dist/esm/domain/IngressPath/IngressPath.js +15 -0
  33. package/dist/esm/domain/IngressPath/IngressPath.test.js +16 -0
  34. package/dist/esm/domain/IngressPath/index.js +2 -0
  35. package/dist/esm/domain/IngressPath/types.js +1 -0
  36. package/dist/esm/domain/IngressTarget/IngressTarget.js +51 -0
  37. package/dist/esm/domain/IngressTarget/IngressTarget.test-types.js +13 -0
  38. package/dist/esm/domain/IngressTarget/index.js +2 -0
  39. package/dist/esm/domain/IngressTarget/types.js +1 -0
  40. package/dist/esm/domain/index.js +1 -0
  41. package/dist/esm/errors/ObjectNotFoundError.js +7 -0
  42. package/dist/esm/index.js +7 -0
  43. package/dist/esm/lib/deepFreeze.js +3 -0
  44. package/dist/esm/lib/provideReact.js +5 -0
  45. package/dist/esm/lib/types.js +1 -0
  46. package/dist/esm/project/Project/Project.js +69 -0
  47. package/dist/esm/project/Project/behaviors/api.js +51 -0
  48. package/dist/esm/project/Project/behaviors/inMem.js +23 -0
  49. package/dist/esm/project/Project/behaviors/index.js +3 -0
  50. package/dist/esm/project/Project/behaviors/types.js +1 -0
  51. package/dist/esm/project/Project/index.js +2 -0
  52. package/dist/esm/project/Project/types.js +1 -0
  53. package/dist/esm/project/index.js +1 -0
  54. package/dist/esm/react/MittwaldApiModelProvider.js +12 -0
  55. package/dist/esm/react/index.js +3 -0
  56. package/dist/esm/react/reactUsePromise.js +17 -0
  57. package/dist/esm/react.js +1 -0
  58. package/dist/esm/server/Server/Server.js +47 -0
  59. package/dist/esm/server/Server/behaviors/api.js +19 -0
  60. package/dist/esm/server/Server/behaviors/index.js +2 -0
  61. package/dist/esm/server/Server/behaviors/types.js +1 -0
  62. package/dist/esm/server/Server/index.js +1 -0
  63. package/dist/esm/server/Server/types.js +1 -0
  64. package/dist/esm/server/index.js +1 -0
  65. package/dist/types/app/AppInstallation/AppInstallation.d.ts +109 -0
  66. package/dist/types/app/AppInstallation/behaviors/api.d.ts +3 -0
  67. package/dist/types/app/AppInstallation/behaviors/index.d.ts +2 -0
  68. package/dist/types/app/AppInstallation/behaviors/types.d.ts +5 -0
  69. package/dist/types/app/AppInstallation/index.d.ts +2 -0
  70. package/dist/types/app/AppInstallation/types.d.ts +4 -0
  71. package/dist/types/app/index.d.ts +1 -0
  72. package/dist/types/base/DataModel.d.ts +5 -0
  73. package/dist/types/base/ReferenceModel.d.ts +5 -0
  74. package/dist/types/base/assertObjectFound.d.ts +3 -0
  75. package/dist/types/base/index.d.ts +1 -0
  76. package/dist/types/base/types.d.ts +2 -0
  77. package/dist/types/config/behaviors/api.d.ts +12 -0
  78. package/dist/types/config/behaviors/index.d.ts +1 -0
  79. package/dist/types/config/config.d.ts +16 -0
  80. package/dist/types/config/index.d.ts +1 -0
  81. package/dist/types/customer/Customer/Customer.d.ts +113 -0
  82. package/dist/types/customer/Customer/behaviors/api.d.ts +3 -0
  83. package/dist/types/customer/Customer/behaviors/index.d.ts +2 -0
  84. package/dist/types/customer/Customer/behaviors/types.d.ts +5 -0
  85. package/dist/types/customer/Customer/index.d.ts +2 -0
  86. package/dist/types/customer/Customer/types.d.ts +4 -0
  87. package/dist/types/customer/index.d.ts +1 -0
  88. package/dist/types/domain/Ingress/Ingress.d.ts +102 -0
  89. package/dist/types/domain/Ingress/behaviors/api.d.ts +3 -0
  90. package/dist/types/domain/Ingress/behaviors/index.d.ts +2 -0
  91. package/dist/types/domain/Ingress/behaviors/types.d.ts +5 -0
  92. package/dist/types/domain/Ingress/index.d.ts +2 -0
  93. package/dist/types/domain/Ingress/types.d.ts +6 -0
  94. package/dist/types/domain/IngressPath/IngressPath.d.ts +11 -0
  95. package/dist/types/domain/IngressPath/IngressPath.test.d.ts +1 -0
  96. package/dist/types/domain/IngressPath/index.d.ts +2 -0
  97. package/dist/types/domain/IngressPath/types.d.ts +2 -0
  98. package/dist/types/domain/IngressTarget/IngressTarget.d.ts +29 -0
  99. package/dist/types/domain/IngressTarget/IngressTarget.test-types.d.ts +1 -0
  100. package/dist/types/domain/IngressTarget/index.d.ts +2 -0
  101. package/dist/types/domain/IngressTarget/types.d.ts +6 -0
  102. package/dist/types/domain/index.d.ts +1 -0
  103. package/dist/types/errors/ObjectNotFoundError.d.ts +3 -0
  104. package/dist/types/index.d.ts +7 -0
  105. package/dist/types/lib/deepFreeze.d.ts +5 -0
  106. package/dist/types/lib/provideReact.d.ts +11 -0
  107. package/dist/types/lib/types.d.ts +2 -0
  108. package/dist/types/project/Project/Project.d.ts +230 -0
  109. package/dist/types/project/Project/behaviors/api.d.ts +3 -0
  110. package/dist/types/project/Project/behaviors/inMem.d.ts +3 -0
  111. package/dist/types/project/Project/behaviors/index.d.ts +3 -0
  112. package/dist/types/project/Project/behaviors/types.d.ts +11 -0
  113. package/dist/types/project/Project/index.d.ts +2 -0
  114. package/dist/types/project/Project/types.d.ts +4 -0
  115. package/dist/types/project/index.d.ts +1 -0
  116. package/dist/types/react/MittwaldApiModelProvider.d.ts +2 -0
  117. package/dist/types/react/index.d.ts +4 -0
  118. package/dist/types/react/reactUsePromise.d.ts +1 -0
  119. package/dist/types/react.d.ts +1 -0
  120. package/dist/types/server/Server/Server.d.ts +72 -0
  121. package/dist/types/server/Server/behaviors/api.d.ts +3 -0
  122. package/dist/types/server/Server/behaviors/index.d.ts +2 -0
  123. package/dist/types/server/Server/behaviors/types.d.ts +5 -0
  124. package/dist/types/server/Server/index.d.ts +1 -0
  125. package/dist/types/server/Server/types.d.ts +4 -0
  126. package/dist/types/server/index.d.ts +1 -0
  127. package/package.json +24 -30
  128. package/dist/index.d.mts +0 -16601
  129. package/dist/index.d.ts +0 -16601
  130. package/dist/index.mjs +0 -704
  131. package/dist/index.mjs.map +0 -1
  132. package/dist/react.d.mts +0 -17
  133. package/dist/react.d.ts +0 -17
  134. package/dist/react.mjs +0 -17
  135. package/dist/react.mjs.map +0 -1
  136. package/dist/shared/api-models.54184fa2.mjs +0 -25
  137. package/dist/shared/api-models.54184fa2.mjs.map +0 -1
@@ -0,0 +1,5 @@
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
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,69 @@
1
+ import { config } from "../../config/config.js";
2
+ import { classes } from "polytype";
3
+ import { DataModel } from "../../base/DataModel.js";
4
+ import assertObjectFound from "../../base/assertObjectFound.js";
5
+ import { Server } from "../../server/index.js";
6
+ import { provideReact, } from "../../lib/provideReact.js";
7
+ import { Customer } from "../../customer/Customer/Customer.js";
8
+ import { ReferenceModel } from "../../base/ReferenceModel.js";
9
+ import { Ingress, IngressListItem } from "../../domain/index.js";
10
+ export class Project extends ReferenceModel {
11
+ static ofId(id) {
12
+ return new Project(id);
13
+ }
14
+ static find = provideReact(async (id) => {
15
+ const data = await config.behaviors.project.find(id);
16
+ if (data !== undefined) {
17
+ return new ProjectDetailed(data);
18
+ }
19
+ });
20
+ static get = provideReact(async (id) => {
21
+ const project = await this.find(id);
22
+ assertObjectFound(project, this, id);
23
+ return project;
24
+ });
25
+ static list = provideReact(async (query = {}) => {
26
+ const data = await config.behaviors.project.list(query);
27
+ return Object.freeze(data.map((d) => new ProjectListItem(d)));
28
+ });
29
+ static async create(serverId, description) {
30
+ const { id } = await config.behaviors.project.create(serverId, description);
31
+ return new Project(id);
32
+ }
33
+ getDetailed = provideReact(() => Project.get(this.id));
34
+ listIngresses = provideReact(() => Ingress.list({ projectId: this.id }));
35
+ getDefaultIngress = provideReact(async () => {
36
+ const ingresses = await Project.ofId(this.id).listIngresses();
37
+ const defaultIngress = ingresses.find((i) => i.data.isDefault);
38
+ assertObjectFound(defaultIngress, IngressListItem, this);
39
+ return defaultIngress;
40
+ });
41
+ async updateDescription(description) {
42
+ await config.behaviors.project.updateDescription(this.id, description);
43
+ }
44
+ async leave() {
45
+ await config.behaviors.project.leave(this.id);
46
+ }
47
+ async delete() {
48
+ await config.behaviors.project.delete(this.id);
49
+ }
50
+ }
51
+ class ProjectCommon extends classes((DataModel), Project) {
52
+ server;
53
+ customer;
54
+ constructor(data) {
55
+ super([data], [data.id]);
56
+ this.server = data.serverId ? Server.ofId(data.serverId) : undefined;
57
+ this.customer = Customer.ofId(data.customerId);
58
+ }
59
+ }
60
+ export class ProjectDetailed extends classes(ProjectCommon, (DataModel)) {
61
+ constructor(data) {
62
+ super([data], [data]);
63
+ }
64
+ }
65
+ export class ProjectListItem extends classes(ProjectCommon, (DataModel)) {
66
+ constructor(data) {
67
+ super([data], [data]);
68
+ }
69
+ }
@@ -0,0 +1,51 @@
1
+ import { assertStatus } from "@mittwald/api-client";
2
+ import { assertOneOfStatus } from "@mittwald/api-client";
3
+ export const apiProjectBehaviors = (client) => ({
4
+ find: async (id) => {
5
+ const response = await client.project.getProject({
6
+ projectId: id,
7
+ });
8
+ if (response.status === 200) {
9
+ return response.data;
10
+ }
11
+ assertOneOfStatus(response, [403]);
12
+ },
13
+ list: async (query) => {
14
+ const response = await client.project.listProjects({
15
+ queryParameters: query,
16
+ });
17
+ assertStatus(response, 200);
18
+ return response.data;
19
+ },
20
+ create: async (serverId, description) => {
21
+ const response = await client.project.createProject({
22
+ serverId,
23
+ data: {
24
+ description,
25
+ },
26
+ });
27
+ assertStatus(response, 201);
28
+ return response.data;
29
+ },
30
+ leave: async (id) => {
31
+ const response = await client.project.leaveProject({
32
+ projectId: id,
33
+ });
34
+ assertStatus(response, 204);
35
+ },
36
+ delete: async (id) => {
37
+ const response = await client.project.deleteProject({
38
+ projectId: id,
39
+ });
40
+ assertStatus(response, 204);
41
+ },
42
+ updateDescription: async (id, description) => {
43
+ const response = await client.project.updateProjectDescription({
44
+ projectId: id,
45
+ data: {
46
+ description,
47
+ },
48
+ });
49
+ assertStatus(response, 204);
50
+ },
51
+ });
@@ -0,0 +1,23 @@
1
+ export const inMemProjectBehaviors = (store) => ({
2
+ find: async (id) => store.get(id),
3
+ list: async () => {
4
+ return Array.from(store.values()).map((detailedProject) => ({
5
+ ...detailedProject,
6
+ customerMeta: {
7
+ id: detailedProject.customerId,
8
+ },
9
+ }));
10
+ },
11
+ create: async () => {
12
+ throw new Error("Not implemented");
13
+ },
14
+ leave: async () => {
15
+ throw new Error("Not implemented");
16
+ },
17
+ delete: async () => {
18
+ throw new Error("Not implemented");
19
+ },
20
+ updateDescription: async () => {
21
+ throw new Error("Not implemented");
22
+ },
23
+ });
@@ -0,0 +1,3 @@
1
+ export * from "./api.js";
2
+ export * from "./inMem.js";
3
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./Project.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Project/index.js";
@@ -0,0 +1,12 @@
1
+ import React, { createElement } from "react";
2
+ import { setModule } from "./reactUsePromise.js";
3
+ let loadingPromise = undefined;
4
+ export const MittwaldApiModelProvider = (props) => {
5
+ if (loadingPromise === undefined) {
6
+ loadingPromise = import("@mittwald/react-use-promise").then((m) => {
7
+ setModule(m);
8
+ });
9
+ throw loadingPromise;
10
+ }
11
+ return createElement(React.Fragment, undefined, props.children);
12
+ };
@@ -0,0 +1,3 @@
1
+ export * from "./MittwaldApiModelProvider.js";
2
+ export * from "./reactUsePromise.js";
3
+ export { provideReact } from "../lib/provideReact.js";
@@ -0,0 +1,17 @@
1
+ let module = undefined;
2
+ /** @internal */
3
+ export const reactUsePromise = new Proxy({}, {
4
+ get: (_, prop) => {
5
+ if (module === undefined) {
6
+ // @todo Provide better error message
7
+ throw new Error("ModelProvider not found");
8
+ }
9
+ if (prop in module) {
10
+ return module[prop];
11
+ }
12
+ },
13
+ });
14
+ /** @internal */
15
+ export const setModule = (theModule) => {
16
+ module = theModule;
17
+ };
@@ -0,0 +1 @@
1
+ export * from "./react/index.js";
@@ -0,0 +1,47 @@
1
+ import { ReferenceModel } from "../../base/ReferenceModel.js";
2
+ import { config } from "../../config/config.js";
3
+ import { classes } from "polytype";
4
+ import { DataModel } from "../../base/DataModel.js";
5
+ import assertObjectFound from "../../base/assertObjectFound.js";
6
+ import { Project } from "../../project/index.js";
7
+ import { provideReact } from "../../lib/provideReact.js";
8
+ export class Server extends ReferenceModel {
9
+ static find = provideReact(async (id) => {
10
+ const serverData = await config.behaviors.server.find(id);
11
+ if (serverData !== undefined) {
12
+ return new ServerDetailed([serverData]);
13
+ }
14
+ });
15
+ static get = provideReact(async (id) => {
16
+ const server = await ServerDetailed.find(id);
17
+ assertObjectFound(server, this, id);
18
+ return server;
19
+ });
20
+ static list = provideReact(async (query = {}) => {
21
+ const projectListData = await config.behaviors.server.list(query);
22
+ return projectListData.map((d) => new ServerListItem([d]));
23
+ });
24
+ static ofId(id) {
25
+ return new Server(id);
26
+ }
27
+ async createProject(...parameters) {
28
+ return Project.create(this.id, ...parameters);
29
+ }
30
+ listProjects = provideReact(async (query = {}) => {
31
+ return Project.list({
32
+ ...query,
33
+ serverId: this.id,
34
+ });
35
+ });
36
+ getDetailed = provideReact(() => ServerDetailed.get(this.id));
37
+ }
38
+ // Common class for future extension
39
+ class ServerCommon extends classes((DataModel), Server) {
40
+ constructor(data) {
41
+ super([data], [data.id]);
42
+ }
43
+ }
44
+ export class ServerListItem extends classes(ServerCommon, (DataModel)) {
45
+ }
46
+ export class ServerDetailed extends classes(ServerCommon, (DataModel)) {
47
+ }
@@ -0,0 +1,19 @@
1
+ import { assertStatus, assertOneOfStatus, } from "@mittwald/api-client";
2
+ export const apiServerBehaviors = (client) => ({
3
+ find: async (id) => {
4
+ const response = await client.project.getServer({
5
+ serverId: id,
6
+ });
7
+ if (response.status === 200) {
8
+ return response.data;
9
+ }
10
+ assertOneOfStatus(response, [403, 404]);
11
+ },
12
+ list: async (query) => {
13
+ const response = await client.project.listServers({
14
+ queryParameters: query,
15
+ });
16
+ assertStatus(response, 200);
17
+ return response.data;
18
+ },
19
+ });
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Server.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Server/index.js";
@@ -0,0 +1,109 @@
1
+ import { DataModel } from "../../base/DataModel.js";
2
+ import { ReferenceModel } from "../../base/ReferenceModel.js";
3
+ import { AppInstallationListItemData, AppInstallationData } from "./types.js";
4
+ export declare class AppInstallation extends ReferenceModel {
5
+ static find: ((id: string) => Promise<AppInstallationDetailed | undefined>) & {
6
+ asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<AppInstallationDetailed | undefined>;
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
+ };
13
+ static ofId(id: string): AppInstallation;
14
+ static list: ((projectId: string, query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2ProjectsProjectIdAppInstallations.Get.Parameters.Query | undefined) => Promise<AppInstallationListItem[]>) & {
15
+ asResource: (projectId: string, query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2ProjectsProjectIdAppInstallations.Get.Parameters.Query | undefined) => import("@mittwald/react-use-promise").AsyncResource<AppInstallationListItem[]>;
16
+ use: (projectId: string, query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2ProjectsProjectIdAppInstallations.Get.Parameters.Query | undefined) => AppInstallationListItem[];
17
+ };
18
+ getDetailed: (() => Promise<AppInstallationDetailed>) & {
19
+ asResource: () => import("@mittwald/react-use-promise").AsyncResource<AppInstallationDetailed>;
20
+ use: () => AppInstallationDetailed;
21
+ };
22
+ }
23
+ declare const AppInstallationCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
24
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation | {
25
+ appId: string;
26
+ appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
27
+ customDocumentRoot?: string | undefined;
28
+ description: string;
29
+ disabled: boolean;
30
+ id: string;
31
+ installationPath: string;
32
+ linkedDatabases?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppLinkedDatabase[] | undefined;
33
+ processes?: string[] | undefined;
34
+ projectId?: string | undefined;
35
+ screenshotId?: string | undefined;
36
+ screenshotRef?: string | undefined;
37
+ shortId: string;
38
+ systemSoftware?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppInstalledSystemSoftware[] | undefined;
39
+ updatePolicy?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppUpdatePolicy | undefined;
40
+ userInputs?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppSavedUserInput[] | undefined;
41
+ }): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation | {
42
+ appId: string;
43
+ appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
44
+ customDocumentRoot?: string | undefined;
45
+ description: string;
46
+ disabled: boolean;
47
+ id: string;
48
+ installationPath: string;
49
+ linkedDatabases?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppLinkedDatabase[] | undefined;
50
+ processes?: string[] | undefined;
51
+ projectId?: string | undefined;
52
+ screenshotId?: string | undefined;
53
+ screenshotRef?: string | undefined;
54
+ shortId: string;
55
+ systemSoftware?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppInstalledSystemSoftware[] | undefined;
56
+ updatePolicy?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppUpdatePolicy | undefined;
57
+ userInputs?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppSavedUserInput[] | undefined;
58
+ }>;
59
+ }, typeof AppInstallation]>;
60
+ declare class AppInstallationCommon extends AppInstallationCommon_base {
61
+ constructor(data: AppInstallationListItemData | AppInstallationData);
62
+ }
63
+ declare const AppInstallationDetailed_base: import("polytype").Polytype.ClusteredConstructor<[typeof AppInstallationCommon, {
64
+ new (data: {
65
+ appId: string;
66
+ appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
67
+ customDocumentRoot?: string | undefined;
68
+ description: string;
69
+ disabled: boolean;
70
+ id: string;
71
+ installationPath: string;
72
+ linkedDatabases?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppLinkedDatabase[] | undefined;
73
+ processes?: string[] | undefined;
74
+ projectId?: string | undefined;
75
+ screenshotId?: string | undefined;
76
+ screenshotRef?: string | undefined;
77
+ shortId: string;
78
+ systemSoftware?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppInstalledSystemSoftware[] | undefined;
79
+ updatePolicy?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppUpdatePolicy | undefined;
80
+ userInputs?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppSavedUserInput[] | undefined;
81
+ }): DataModel<{
82
+ appId: string;
83
+ appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
84
+ customDocumentRoot?: string | undefined;
85
+ description: string;
86
+ disabled: boolean;
87
+ id: string;
88
+ installationPath: string;
89
+ linkedDatabases?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppLinkedDatabase[] | undefined;
90
+ processes?: string[] | undefined;
91
+ projectId?: string | undefined;
92
+ screenshotId?: string | undefined;
93
+ screenshotRef?: string | undefined;
94
+ shortId: string;
95
+ systemSoftware?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppInstalledSystemSoftware[] | undefined;
96
+ updatePolicy?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppUpdatePolicy | undefined;
97
+ userInputs?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppSavedUserInput[] | undefined;
98
+ }>;
99
+ }]>;
100
+ export declare class AppInstallationDetailed extends AppInstallationDetailed_base {
101
+ constructor(data: AppInstallationData);
102
+ }
103
+ declare const AppInstallationListItem_base: import("polytype").Polytype.ClusteredConstructor<[typeof AppInstallationCommon, {
104
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation>;
105
+ }]>;
106
+ export declare class AppInstallationListItem extends AppInstallationListItem_base {
107
+ constructor(data: AppInstallationListItemData);
108
+ }
109
+ export {};
@@ -0,0 +1,3 @@
1
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
2
+ import { AppInstallationBehaviors } from "./types.js";
3
+ export declare const apiAppInstallationBehaviors: (client: MittwaldAPIV2Client) => AppInstallationBehaviors;
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1,5 @@
1
+ import { AppInstallationListItemData, AppInstallationData, AppInstallationListQuery } from "../types.js";
2
+ export interface AppInstallationBehaviors {
3
+ find: (id: string) => Promise<AppInstallationData | undefined>;
4
+ list: (projectId: string, query?: AppInstallationListQuery) => Promise<AppInstallationListItemData[]>;
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./AppInstallation.js";
2
+ export * from "./types.js";
@@ -0,0 +1,4 @@
1
+ import { MittwaldAPIV2 } from "@mittwald/api-client";
2
+ export type AppInstallationListQuery = MittwaldAPIV2.Paths.V2ProjectsProjectIdAppInstallations.Get.Parameters.Query;
3
+ export type AppInstallationData = MittwaldAPIV2.Operations.AppGetAppinstallation.ResponseData;
4
+ export type AppInstallationListItemData = MittwaldAPIV2.Operations.AppListAppinstallations.ResponseData[number];
@@ -0,0 +1 @@
1
+ export * from "./AppInstallation/index.js";
@@ -0,0 +1,5 @@
1
+ import { ReadonlyDeep } from "type-fest";
2
+ export declare class DataModel<T> {
3
+ readonly data: ReadonlyDeep<T>;
4
+ constructor(data: T);
5
+ }
@@ -0,0 +1,5 @@
1
+ export declare abstract class ReferenceModel {
2
+ readonly id: string;
3
+ constructor(id: string);
4
+ describe(): string;
5
+ }
@@ -0,0 +1,3 @@
1
+ import { Constructor } from "type-fest";
2
+ import { ReferenceModel } from "./ReferenceModel.js";
3
+ export default function assertObjectFound<T>(obj: T | undefined, theClass: Constructor<unknown>, refIdOrObject: string | ReferenceModel): asserts obj is T;
@@ -0,0 +1 @@
1
+ export * from "./types.js";
@@ -0,0 +1,2 @@
1
+ import { DataModel } from "./DataModel.js";
2
+ export type DataType<T> = T extends DataModel<infer TData> ? TData : never;
@@ -0,0 +1,12 @@
1
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
2
+ declare class ApiSetupState {
3
+ private _client;
4
+ setupWithClient(client: MittwaldAPIV2Client): void;
5
+ setupWithApiToken(apiToken: string): void;
6
+ setupUnauthenticated(): void;
7
+ get client(): MittwaldAPIV2Client;
8
+ get defaults(): (typeof this.client)["axios"]["defaults"];
9
+ get interceptors(): (typeof this.client)["axios"]["interceptors"];
10
+ }
11
+ export declare const api: ApiSetupState;
12
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./api.js";
@@ -0,0 +1,16 @@
1
+ import { ProjectBehaviors } from "../project/Project/behaviors/index.js";
2
+ import { ServerBehaviors } from "../server/Server/behaviors/index.js";
3
+ import { CustomerBehaviors } from "../customer/Customer/behaviors/index.js";
4
+ import { IngressBehaviors } from "../domain/Ingress/behaviors/index.js";
5
+ import { AppInstallationBehaviors } from "../app/AppInstallation/behaviors/index.js";
6
+ interface Config {
7
+ behaviors: {
8
+ project: ProjectBehaviors;
9
+ server: ServerBehaviors;
10
+ customer: CustomerBehaviors;
11
+ ingress: IngressBehaviors;
12
+ appInstallation: AppInstallationBehaviors;
13
+ };
14
+ }
15
+ export declare const config: Config;
16
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./behaviors/index.js";
@@ -0,0 +1,113 @@
1
+ import { DataModel } from "../../base/DataModel.js";
2
+ import { ReferenceModel } from "../../base/ReferenceModel.js";
3
+ import { CustomerListItemData, CustomerData } from "./types.js";
4
+ export declare class Customer extends ReferenceModel {
5
+ static ofId(id: string): Customer;
6
+ static find: ((id: string) => Promise<CustomerDetailed | undefined>) & {
7
+ asResource: (id: string) => import("@mittwald/react-use-promise").AsyncResource<CustomerDetailed | undefined>;
8
+ use: (id: string) => CustomerDetailed | undefined;
9
+ };
10
+ static list: ((query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Customers.Get.Parameters.Query | undefined) => Promise<readonly CustomerListItem[]>) & {
11
+ asResource: (query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Customers.Get.Parameters.Query | undefined) => import("@mittwald/react-use-promise").AsyncResource<readonly CustomerListItem[]>;
12
+ use: (query?: import("@mittwald/api-client").MittwaldAPIV2.Paths.V2Customers.Get.Parameters.Query | undefined) => readonly CustomerListItem[];
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
+ };
22
+ }
23
+ declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
24
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
25
+ activeSuspension?: {
26
+ createdAt: string;
27
+ } | undefined;
28
+ avatarRefId?: string | undefined;
29
+ categoryId?: string | undefined;
30
+ creationDate: string;
31
+ customerId: string;
32
+ customerNumber: string;
33
+ executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
34
+ isBanned?: boolean | undefined;
35
+ isInDefaultOfPayment?: boolean | undefined;
36
+ memberCount: number;
37
+ name: string;
38
+ owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
39
+ projectCount: number;
40
+ vatId?: string | undefined;
41
+ vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
42
+ }): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
43
+ activeSuspension?: {
44
+ createdAt: string;
45
+ } | undefined;
46
+ avatarRefId?: string | undefined;
47
+ categoryId?: string | undefined;
48
+ creationDate: string;
49
+ customerId: string;
50
+ customerNumber: string;
51
+ executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
52
+ isBanned?: boolean | undefined;
53
+ isInDefaultOfPayment?: boolean | undefined;
54
+ memberCount: number;
55
+ name: string;
56
+ owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
57
+ projectCount: number;
58
+ vatId?: string | undefined;
59
+ vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
60
+ }>;
61
+ }, typeof Customer]>;
62
+ declare class CustomerCommon extends CustomerCommon_base {
63
+ constructor(data: CustomerListItemData | CustomerData);
64
+ }
65
+ declare const CustomerDetailed_base: import("polytype").Polytype.ClusteredConstructor<[typeof CustomerCommon, {
66
+ new (data: {
67
+ activeSuspension?: {
68
+ createdAt: string;
69
+ } | undefined;
70
+ avatarRefId?: string | undefined;
71
+ categoryId?: string | undefined;
72
+ creationDate: string;
73
+ customerId: string;
74
+ customerNumber: string;
75
+ executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
76
+ isBanned?: boolean | undefined;
77
+ isInDefaultOfPayment?: boolean | undefined;
78
+ memberCount: number;
79
+ name: string;
80
+ owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
81
+ projectCount: number;
82
+ vatId?: string | undefined;
83
+ vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
84
+ }): DataModel<{
85
+ activeSuspension?: {
86
+ createdAt: string;
87
+ } | undefined;
88
+ avatarRefId?: string | undefined;
89
+ categoryId?: string | undefined;
90
+ creationDate: string;
91
+ customerId: string;
92
+ customerNumber: string;
93
+ executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
94
+ isBanned?: boolean | undefined;
95
+ isInDefaultOfPayment?: boolean | undefined;
96
+ memberCount: number;
97
+ name: string;
98
+ owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
99
+ projectCount: number;
100
+ vatId?: string | undefined;
101
+ vatIdValidationState?: "pending" | "unspecified" | "valid" | "invalid" | undefined;
102
+ }>;
103
+ }]>;
104
+ export declare class CustomerDetailed extends CustomerDetailed_base {
105
+ constructor(data: CustomerData);
106
+ }
107
+ declare const CustomerListItem_base: import("polytype").Polytype.ClusteredConstructor<[typeof CustomerCommon, {
108
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer>;
109
+ }]>;
110
+ export declare class CustomerListItem extends CustomerListItem_base {
111
+ constructor(data: CustomerListItemData);
112
+ }
113
+ export {};
@@ -0,0 +1,3 @@
1
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
2
+ import { CustomerBehaviors } from "./types.js";
3
+ export declare const apiCustomerBehaviors: (client: MittwaldAPIV2Client) => CustomerBehaviors;
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1,5 @@
1
+ import { CustomerListItemData, CustomerData, CustomerListQuery } from "../types.js";
2
+ export interface CustomerBehaviors {
3
+ find: (id: string) => Promise<CustomerData | undefined>;
4
+ list: (query?: CustomerListQuery) => Promise<CustomerListItemData[]>;
5
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Customer.js";
2
+ export * from "./types.js";
@@ -0,0 +1,4 @@
1
+ import { MittwaldAPIV2 } from "@mittwald/api-client";
2
+ export type CustomerListQuery = MittwaldAPIV2.Paths.V2Customers.Get.Parameters.Query;
3
+ export type CustomerData = MittwaldAPIV2.Operations.CustomerGetCustomer.ResponseData;
4
+ export type CustomerListItemData = MittwaldAPIV2.Operations.CustomerListCustomers.ResponseData[number];