@mittwald/api-models 0.0.0-development-e096ee7-20240924 → 0.0.0-development-84e90b6-20250514

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 (62) hide show
  1. package/dist/esm/app/AppInstallation/AppInstallation.js +3 -1
  2. package/dist/esm/article/Article/Article.js +79 -0
  3. package/dist/esm/article/Article/behaviors/api.js +22 -0
  4. package/dist/esm/article/Article/behaviors/index.js +2 -0
  5. package/dist/esm/article/Article/behaviors/types.js +1 -0
  6. package/dist/esm/article/Article/index.js +2 -0
  7. package/dist/esm/article/Article/types.js +1 -0
  8. package/dist/esm/article/index.js +1 -0
  9. package/dist/esm/base/ListQueryModel.js +4 -2
  10. package/dist/esm/base/Money.js +5 -0
  11. package/dist/esm/config/behaviors/api.js +6 -0
  12. package/dist/esm/config/config.js +3 -0
  13. package/dist/esm/contract/Contract/Contract.js +78 -0
  14. package/dist/esm/contract/Contract/behaviors/api.js +20 -0
  15. package/dist/esm/contract/Contract/behaviors/index.js +2 -0
  16. package/dist/esm/contract/Contract/behaviors/types.js +1 -0
  17. package/dist/esm/contract/Contract/index.js +2 -0
  18. package/dist/esm/contract/Contract/types.js +1 -0
  19. package/dist/esm/contract/ContractItem/ContractItem.js +31 -0
  20. package/dist/esm/contract/ContractItem/behaviors/api.js +13 -0
  21. package/dist/esm/contract/ContractItem/behaviors/index.js +2 -0
  22. package/dist/esm/contract/ContractItem/behaviors/types.js +1 -0
  23. package/dist/esm/contract/ContractItem/index.js +2 -0
  24. package/dist/esm/contract/ContractItem/types.js +1 -0
  25. package/dist/esm/contract/index.js +2 -0
  26. package/dist/esm/domain/IngressTarget/IngressTarget.js +0 -11
  27. package/dist/esm/domain/IngressTarget/IngressTarget.test-types.js +0 -3
  28. package/dist/esm/lib/joinedId.js +1 -0
  29. package/dist/esm/project/Project/behaviors/api.js +5 -1
  30. package/dist/esm/react/provideReact.js +10 -7
  31. package/dist/types/app/AppInstallation/AppInstallation.d.ts +4 -0
  32. package/dist/types/app/AppInstallation/behaviors/types.d.ts +1 -1
  33. package/dist/types/article/Article/Article.d.ts +133 -0
  34. package/dist/types/article/Article/behaviors/api.d.ts +3 -0
  35. package/dist/types/article/Article/behaviors/index.d.ts +2 -0
  36. package/dist/types/article/Article/behaviors/types.d.ts +6 -0
  37. package/dist/types/article/Article/index.d.ts +2 -0
  38. package/dist/types/article/Article/types.d.ts +5 -0
  39. package/dist/types/article/index.d.ts +1 -0
  40. package/dist/types/base/ListQueryModel.d.ts +5 -1
  41. package/dist/types/base/Money.d.ts +3 -0
  42. package/dist/types/config/config.d.ts +6 -0
  43. package/dist/types/contract/Contract/Contract.d.ts +68 -0
  44. package/dist/types/contract/Contract/behaviors/api.d.ts +3 -0
  45. package/dist/types/contract/Contract/behaviors/index.d.ts +2 -0
  46. package/dist/types/contract/Contract/behaviors/types.d.ts +9 -0
  47. package/dist/types/contract/Contract/index.d.ts +2 -0
  48. package/dist/types/contract/Contract/types.d.ts +8 -0
  49. package/dist/types/contract/ContractItem/ContractItem.d.ts +64 -0
  50. package/dist/types/contract/ContractItem/behaviors/api.d.ts +3 -0
  51. package/dist/types/contract/ContractItem/behaviors/index.d.ts +2 -0
  52. package/dist/types/contract/ContractItem/behaviors/types.d.ts +4 -0
  53. package/dist/types/contract/ContractItem/index.d.ts +2 -0
  54. package/dist/types/contract/ContractItem/types.d.ts +2 -0
  55. package/dist/types/contract/index.d.ts +2 -0
  56. package/dist/types/customer/Customer/Customer.d.ts +16 -4
  57. package/dist/types/domain/IngressTarget/IngressTarget.d.ts +2 -7
  58. package/dist/types/domain/IngressTarget/types.d.ts +1 -2
  59. package/dist/types/lib/joinedId.d.ts +1 -0
  60. package/dist/types/project/Project/Project.d.ts +16 -0
  61. package/dist/types/react/provideReact.d.ts +4 -1
  62. package/package.json +17 -15
@@ -53,7 +53,9 @@ export class AppInstallationListItem extends classes(AppInstallationCommon, (Dat
53
53
  export class AppInstallationListQuery extends ListQueryModel {
54
54
  project;
55
55
  constructor(project, query = {}) {
56
- super(query);
56
+ super(query, {
57
+ dependencies: [project.id],
58
+ });
57
59
  this.project = project;
58
60
  }
59
61
  refine(query) {
@@ -0,0 +1,79 @@
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 { provideReact } from "../../react/provideReact.js";
7
+ import { ListQueryModel } from "../../base/ListQueryModel.js";
8
+ import { ListDataModel } from "../../base/ListDataModel.js";
9
+ import { Money } from "../../base/Money.js";
10
+ export class Article extends ReferenceModel {
11
+ static ofId(id) {
12
+ return new Article(id);
13
+ }
14
+ static find = provideReact(async (id) => {
15
+ const data = await config.behaviors.article.find(id);
16
+ if (data !== undefined) {
17
+ return new ArticleDetailed(data);
18
+ }
19
+ });
20
+ static get = provideReact(async (id) => {
21
+ const article = await this.find(id);
22
+ assertObjectFound(article, this, id);
23
+ return article;
24
+ });
25
+ static query(query = {}) {
26
+ return new ArticleListQuery(query);
27
+ }
28
+ }
29
+ class ArticleCommon extends classes((DataModel), Article) {
30
+ price;
31
+ constructor(data) {
32
+ super([data]);
33
+ this.price = Money({ amount: data.price, currency: "EUR" });
34
+ }
35
+ }
36
+ export class ArticleDetailed extends classes(ArticleCommon, (DataModel)) {
37
+ constructor(data) {
38
+ super([data], [data]);
39
+ }
40
+ }
41
+ export class ArticleListItem extends classes(ArticleCommon, (DataModel)) {
42
+ constructor(data) {
43
+ super([data]);
44
+ }
45
+ }
46
+ export class ArticleListQuery extends ListQueryModel {
47
+ constructor(query = {}) {
48
+ super(query);
49
+ }
50
+ refine(query) {
51
+ return new ArticleListQuery({
52
+ ...this.query,
53
+ ...query,
54
+ });
55
+ }
56
+ execute = provideReact(async () => {
57
+ const { ...query } = this.query;
58
+ const { items, totalCount } = await config.behaviors.article.list({
59
+ limit: config.defaultPaginationLimit,
60
+ ...query,
61
+ });
62
+ return new ArticleList(this.query, items.map((d) => new ArticleListItem(d)), totalCount);
63
+ }, [this.queryId]);
64
+ getTotalCount = provideReact(async () => {
65
+ const { totalCount } = await this.refine({ limit: 1 }).execute();
66
+ return totalCount;
67
+ }, [this.queryId]);
68
+ findOneAndOnly = provideReact(async () => {
69
+ const { items, totalCount } = await this.refine({ limit: 1 }).execute();
70
+ if (totalCount === 1) {
71
+ return items[0];
72
+ }
73
+ }, [this.queryId]);
74
+ }
75
+ export class ArticleList extends classes(ArticleListQuery, (ListDataModel)) {
76
+ constructor(query, articles, totalCount) {
77
+ super([query], [articles, totalCount]);
78
+ }
79
+ }
@@ -0,0 +1,22 @@
1
+ import { assertStatus, extractTotalCountHeader, } from "@mittwald/api-client";
2
+ export const apiArticleBehaviors = (client) => ({
3
+ find: async (id) => {
4
+ const response = await client.article.getArticle({
5
+ articleId: id,
6
+ });
7
+ if (response.status === 200) {
8
+ return response.data;
9
+ }
10
+ assertStatus(response, 404);
11
+ },
12
+ list: async (query) => {
13
+ const response = await client.article.listArticles({
14
+ queryParameters: query,
15
+ });
16
+ assertStatus(response, 200);
17
+ return {
18
+ items: response.data,
19
+ totalCount: extractTotalCountHeader(response),
20
+ };
21
+ },
22
+ });
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./Article.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./Article/index.js";
@@ -1,9 +1,11 @@
1
1
  import { hash } from "object-code";
2
+ import { joinedId } from "../lib/joinedId.js";
2
3
  export class ListQueryModel {
3
4
  query;
4
5
  queryId;
5
- constructor(query) {
6
+ constructor(query, opts = {}) {
7
+ const { dependencies = [] } = opts;
6
8
  this.query = query;
7
- this.queryId = hash(query).toString();
9
+ this.queryId = joinedId(hash(query), ...dependencies);
8
10
  }
9
11
  }
@@ -0,0 +1,5 @@
1
+ import Dinero from "dinero.js";
2
+ export const Money = Dinero;
3
+ Money.defaultCurrency = "EUR";
4
+ Money.defaultPrecision = 2;
5
+ Money.globalLocale = "de-DE";
@@ -6,6 +6,9 @@ import { apiCustomerBehaviors } from "../../customer/Customer/behaviors/index.js
6
6
  import { apiIngressBehaviors } from "../../domain/Ingress/behaviors/index.js";
7
7
  import { apiAppInstallationBehaviors } from "../../app/AppInstallation/behaviors/index.js";
8
8
  import { addUrlTagToProvideReactCache } from "../../react/asyncResourceInvalidation.js";
9
+ import { apiArticleBehaviors } from "../../article/Article/behaviors/index.js";
10
+ import { apiContractBehaviors } from "../../contract/Contract/behaviors/index.js";
11
+ import { apiContractItemBehaviors } from "../../contract/ContractItem/behaviors/index.js";
9
12
  class ApiSetupState {
10
13
  _client;
11
14
  setupWithClient(client) {
@@ -15,11 +18,14 @@ class ApiSetupState {
15
18
  this._client = client;
16
19
  this._client.defaultRequestOptions.onBeforeRequest =
17
20
  addUrlTagToProvideReactCache;
21
+ config.behaviors.article = apiArticleBehaviors(client);
18
22
  config.behaviors.project = apiProjectBehaviors(client);
19
23
  config.behaviors.server = apiServerBehaviors(client);
20
24
  config.behaviors.customer = apiCustomerBehaviors(client);
21
25
  config.behaviors.ingress = apiIngressBehaviors(client);
22
26
  config.behaviors.appInstallation = apiAppInstallationBehaviors(client);
27
+ config.behaviors.contract = apiContractBehaviors(client);
28
+ config.behaviors.contractItem = apiContractItemBehaviors(client);
23
29
  }
24
30
  setupWithApiToken(apiToken) {
25
31
  return this.setupWithClient(MittwaldAPIV2Client.newWithToken(apiToken));
@@ -1,6 +1,9 @@
1
1
  export const config = {
2
2
  defaultPaginationLimit: 50,
3
3
  behaviors: {
4
+ contract: undefined,
5
+ contractItem: undefined,
6
+ article: undefined,
4
7
  project: undefined,
5
8
  server: undefined,
6
9
  customer: undefined,
@@ -0,0 +1,78 @@
1
+ import { DataModel, ListDataModel, ListQueryModel, ReferenceModel, } from "../../base/index.js";
2
+ import { provideReact } from "../../react/index.js";
3
+ import { config } from "../../config/config.js";
4
+ import { classes } from "polytype";
5
+ import assertObjectFound from "../../base/assertObjectFound.js";
6
+ export class Contract extends ReferenceModel {
7
+ static ofId(id) {
8
+ return new Contract(id);
9
+ }
10
+ static find = provideReact(async (id) => {
11
+ const data = await config.behaviors.contract.find(id);
12
+ if (data !== undefined) {
13
+ return new ContractDetailed(data);
14
+ }
15
+ });
16
+ static query(query) {
17
+ return new ContractListQuery(query);
18
+ }
19
+ static get = provideReact(async (id) => {
20
+ const customer = await this.find(id);
21
+ assertObjectFound(customer, this, id);
22
+ return customer;
23
+ });
24
+ }
25
+ class ContractCommon extends classes((DataModel), Contract) {
26
+ constructor(data) {
27
+ super([data], [data.customerId]);
28
+ }
29
+ }
30
+ export class ContractDetailed extends classes(ContractCommon, (DataModel)) {
31
+ constructor(data) {
32
+ super([data], [data]);
33
+ }
34
+ }
35
+ export class ContractListItem extends classes(ContractCommon, (DataModel)) {
36
+ constructor(data) {
37
+ super([data], [data]);
38
+ }
39
+ }
40
+ export class ContractListQuery extends ListQueryModel {
41
+ constructor(query) {
42
+ super(query);
43
+ }
44
+ refine(query) {
45
+ return new ContractListQuery({
46
+ ...this.query,
47
+ ...query,
48
+ });
49
+ }
50
+ execute = provideReact(async () => {
51
+ const { customer, ...query } = this.query;
52
+ const customerId = customer.id;
53
+ const request = {
54
+ customerId: customerId,
55
+ queryParameters: {
56
+ limit: config.defaultPaginationLimit,
57
+ ...query,
58
+ },
59
+ };
60
+ const { items, totalCount } = await config.behaviors.contract.list(request);
61
+ return new ContractList(this.query, items.map((d) => new ContractListItem(d)), totalCount);
62
+ }, [this.queryId]);
63
+ getTotalCount = provideReact(async () => {
64
+ const { totalCount } = await this.refine({ limit: 1 }).execute();
65
+ return totalCount;
66
+ }, [this.queryId]);
67
+ findOneAndOnly = provideReact(async () => {
68
+ const { items, totalCount } = await this.refine({ limit: 1 }).execute();
69
+ if (totalCount === 1) {
70
+ return items[0];
71
+ }
72
+ }, [this.queryId]);
73
+ }
74
+ export class ContractList extends classes(ContractListQuery, (ListDataModel)) {
75
+ constructor(query, contracts, totalCount) {
76
+ super([query], [contracts, totalCount]);
77
+ }
78
+ }
@@ -0,0 +1,20 @@
1
+ import { assertStatus, extractTotalCountHeader, } from "@mittwald/api-client";
2
+ export const apiContractBehaviors = (client) => ({
3
+ find: async (id) => {
4
+ const response = await client.contract.getDetailOfContract({
5
+ contractId: id,
6
+ });
7
+ if (response.status === 200) {
8
+ return response.data;
9
+ }
10
+ assertStatus(response, 404);
11
+ },
12
+ list: async (request) => {
13
+ const response = await client.contract.listContracts(request);
14
+ assertStatus(response, 200);
15
+ return {
16
+ items: response.data,
17
+ totalCount: extractTotalCountHeader(response),
18
+ };
19
+ },
20
+ });
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./Contract.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import { classes } from "polytype";
2
+ import { DataModel, ReferenceModel } from "../../base/index.js";
3
+ import { provideReact } from "../../react/index.js";
4
+ import { config } from "../../config/config.js";
5
+ import assertObjectFound from "../../base/assertObjectFound.js";
6
+ export class ContractItem extends ReferenceModel {
7
+ static ofId(contractId, id) {
8
+ return new ContractItem(contractId, id);
9
+ }
10
+ static find = provideReact(async (contractId, contractItemId) => {
11
+ const data = await config.behaviors.contractItem.find(contractId, contractItemId);
12
+ if (data !== undefined) {
13
+ return new ContractItemDetailed(contractId, data);
14
+ }
15
+ });
16
+ static get = provideReact(async (contractId, contractItemId) => {
17
+ const item = await this.find(contractId, contractItemId);
18
+ assertObjectFound(item, this, contractItemId);
19
+ return item;
20
+ });
21
+ contractId;
22
+ constructor(contractId, id) {
23
+ super(id);
24
+ this.contractId = contractId;
25
+ }
26
+ }
27
+ export class ContractItemDetailed extends classes((DataModel), ContractItem) {
28
+ constructor(contractId, data) {
29
+ super([data], [contractId, data.itemId]);
30
+ }
31
+ }
@@ -0,0 +1,13 @@
1
+ import { assertStatus } from "@mittwald/api-client";
2
+ export const apiContractItemBehaviors = (client) => ({
3
+ find: async (contractId, contractItemId) => {
4
+ const response = await client.contract.getDetailOfContractItem({
5
+ contractId,
6
+ contractItemId,
7
+ });
8
+ if (response.status === 200) {
9
+ return response.data;
10
+ }
11
+ assertStatus(response, 404);
12
+ },
13
+ });
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./ContractItem.js";
2
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./Contract/index.js";
2
+ export * from "./ContractItem/index.js";
@@ -15,14 +15,6 @@ export class IngressRedirectTarget extends IngressTargetBase {
15
15
  this.url = new URL(data.url);
16
16
  }
17
17
  }
18
- export class IngressDirectoryTarget extends IngressTargetBase {
19
- type = "directory";
20
- directory;
21
- constructor(path, data) {
22
- super(path, data);
23
- this.directory = data.directory;
24
- }
25
- }
26
18
  export class IngressAppInstallationTarget extends IngressTargetBase {
27
19
  type = "appInstallation";
28
20
  appInstallation;
@@ -35,9 +27,6 @@ export class IngressUndefinedTarget extends IngressTargetBase {
35
27
  type = "undefined";
36
28
  }
37
29
  export const ingressTargetFactory = (path, data) => {
38
- if ("directory" in data) {
39
- return new IngressDirectoryTarget(path, data);
40
- }
41
30
  if ("url" in data) {
42
31
  return new IngressRedirectTarget(path, data);
43
32
  }
@@ -4,9 +4,6 @@ void target.url;
4
4
  if (target.type === "redirect") {
5
5
  void target.url;
6
6
  }
7
- if (target.type === "directory") {
8
- void target.directory;
9
- }
10
7
  if (target.type === "appInstallation") {
11
8
  void target.appInstallation.id;
12
9
  }
@@ -0,0 +1 @@
1
+ export const joinedId = (...parts) => parts.join(" | ");
@@ -31,9 +31,13 @@ export const apiProjectBehaviors = (client) => ({
31
31
  return response.data;
32
32
  },
33
33
  leave: async (id) => {
34
- const response = await client.project.leaveProject({
34
+ const selfMembershipResponse = await client.project.getSelfMembershipForProject({
35
35
  projectId: id,
36
36
  });
37
+ assertStatus(selfMembershipResponse, 200);
38
+ const response = await client.project.deleteProjectMembership({
39
+ projectMembershipId: selfMembershipResponse.data.id,
40
+ });
37
41
  assertStatus(response, 204);
38
42
  },
39
43
  delete: async (id) => {
@@ -1,14 +1,17 @@
1
1
  import { reactUsePromise } from "./reactUsePromise.js";
2
2
  import { hash } from "object-code";
3
3
  import { reactProvisionContext } from "./reactProvisionContext.js";
4
- export const provideReact = (loader, dependencies) => {
5
- const provisionId = String(hash({
6
- loader,
7
- dependencies,
8
- }));
4
+ import { joinedId } from "../lib/joinedId.js";
5
+ export const provideReact = (loader, dependencies = []) => {
6
+ const loaderHash = hash(loader);
7
+ let cachedProvisionId;
9
8
  const getAsyncResource = (params) => {
10
- const paramsHash = params && params.length > 0 ? String(hash(params)) : "";
11
- const contextId = provisionId + paramsHash;
9
+ const provisionId = cachedProvisionId ??
10
+ joinedId(loaderHash, ...dependencies
11
+ .map((d) => (typeof d === "function" ? d() : d))
12
+ .map((d) => hash(d)));
13
+ cachedProvisionId = provisionId;
14
+ const contextId = joinedId(provisionId, hash(params));
12
15
  const loaderWithContext = reactProvisionContext.bind({
13
16
  id: contextId,
14
17
  }, loader);
@@ -19,6 +19,7 @@ declare const AppInstallationCommon_base: import("polytype").Polytype.ClusteredC
19
19
  new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation | {
20
20
  appId: string;
21
21
  appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
22
+ createdAt: string;
22
23
  customDocumentRoot?: string | undefined;
23
24
  description: string;
24
25
  disabled: boolean;
@@ -36,6 +37,7 @@ declare const AppInstallationCommon_base: import("polytype").Polytype.ClusteredC
36
37
  }): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppAppInstallation | {
37
38
  appId: string;
38
39
  appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
40
+ createdAt: string;
39
41
  customDocumentRoot?: string | undefined;
40
42
  description: string;
41
43
  disabled: boolean;
@@ -59,6 +61,7 @@ declare const AppInstallationDetailed_base: import("polytype").Polytype.Clustere
59
61
  new (data: {
60
62
  appId: string;
61
63
  appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
64
+ createdAt: string;
62
65
  customDocumentRoot?: string | undefined;
63
66
  description: string;
64
67
  disabled: boolean;
@@ -76,6 +79,7 @@ declare const AppInstallationDetailed_base: import("polytype").Polytype.Clustere
76
79
  }): DataModel<{
77
80
  appId: string;
78
81
  appVersion: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.AppVersionStatus;
82
+ createdAt: string;
79
83
  customDocumentRoot?: string | undefined;
80
84
  description: string;
81
85
  disabled: boolean;
@@ -1,4 +1,4 @@
1
- import { AppInstallationListItemData, AppInstallationData, AppInstallationListQueryData } from "../types.js";
1
+ import { AppInstallationData, AppInstallationListItemData, AppInstallationListQueryData } from "../types.js";
2
2
  import { QueryResponseData } from "../../../base/index.js";
3
3
  export interface AppInstallationBehaviors {
4
4
  find: (id: string) => Promise<AppInstallationData | undefined>;
@@ -0,0 +1,133 @@
1
+ import { ReferenceModel } from "../../base/ReferenceModel.js";
2
+ import { ArticleData, ArticleListItemData, ArticleListQueryData, ArticleListQueryModelData } from "./types.js";
3
+ import { DataModel } from "../../base/DataModel.js";
4
+ import { ListQueryModel } from "../../base/ListQueryModel.js";
5
+ import { ListDataModel } from "../../base/ListDataModel.js";
6
+ import { Money } from "../../base/Money.js";
7
+ export declare class Article extends ReferenceModel {
8
+ static ofId(id: string): Article;
9
+ static find: import("../../react/provideReact.js").AsyncResourceVariant<(id: string) => Promise<ArticleDetailed | undefined>>;
10
+ static get: import("../../react/provideReact.js").AsyncResourceVariant<(id: string) => Promise<ArticleDetailed>>;
11
+ static query(query?: ArticleListQueryModelData): ArticleListQuery;
12
+ }
13
+ declare const ArticleCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
14
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableArticle | {
15
+ addons?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAddons[] | undefined;
16
+ articleId: string;
17
+ attributes?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAttributes[] | undefined;
18
+ balanceAddonKey?: string | undefined;
19
+ contractDurationInMonth: number;
20
+ description?: string | undefined;
21
+ forcedInvoicingPeriodInMonth?: number | undefined;
22
+ hasIndependentContractPeriod?: boolean | undefined;
23
+ hideOnInvoice?: boolean | undefined;
24
+ machineType?: {
25
+ cpu: string;
26
+ memory: string;
27
+ name: string;
28
+ } | undefined;
29
+ modifierArticles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableModifierArticleOptions[] | undefined;
30
+ name: string;
31
+ orderable: "forbidden" | "internal" | "beta_testing" | "full" | "deprecated";
32
+ possibleArticleChanges?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableChangeArticleOptions[] | undefined;
33
+ price?: number | undefined;
34
+ tags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTag[] | undefined;
35
+ template: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTemplate;
36
+ }): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableArticle | {
37
+ addons?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAddons[] | undefined;
38
+ articleId: string;
39
+ attributes?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAttributes[] | undefined;
40
+ balanceAddonKey?: string | undefined;
41
+ contractDurationInMonth: number;
42
+ description?: string | undefined;
43
+ forcedInvoicingPeriodInMonth?: number | undefined;
44
+ hasIndependentContractPeriod?: boolean | undefined;
45
+ hideOnInvoice?: boolean | undefined;
46
+ machineType?: {
47
+ cpu: string;
48
+ memory: string;
49
+ name: string;
50
+ } | undefined;
51
+ modifierArticles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableModifierArticleOptions[] | undefined;
52
+ name: string;
53
+ orderable: "forbidden" | "internal" | "beta_testing" | "full" | "deprecated";
54
+ possibleArticleChanges?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableChangeArticleOptions[] | undefined;
55
+ price?: number | undefined;
56
+ tags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTag[] | undefined;
57
+ template: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTemplate;
58
+ }>;
59
+ }, typeof Article]>;
60
+ declare class ArticleCommon extends ArticleCommon_base {
61
+ readonly price: Money;
62
+ constructor(data: ArticleListItemData | ArticleData);
63
+ }
64
+ declare const ArticleDetailed_base: import("polytype").Polytype.ClusteredConstructor<[typeof ArticleCommon, {
65
+ new (data: {
66
+ addons?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAddons[] | undefined;
67
+ articleId: string;
68
+ attributes?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAttributes[] | undefined;
69
+ balanceAddonKey?: string | undefined;
70
+ contractDurationInMonth: number;
71
+ description?: string | undefined;
72
+ forcedInvoicingPeriodInMonth?: number | undefined;
73
+ hasIndependentContractPeriod?: boolean | undefined;
74
+ hideOnInvoice?: boolean | undefined;
75
+ machineType?: {
76
+ cpu: string;
77
+ memory: string;
78
+ name: string;
79
+ } | undefined;
80
+ modifierArticles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableModifierArticleOptions[] | undefined;
81
+ name: string;
82
+ orderable: "forbidden" | "internal" | "beta_testing" | "full" | "deprecated";
83
+ possibleArticleChanges?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableChangeArticleOptions[] | undefined;
84
+ price?: number | undefined;
85
+ tags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTag[] | undefined;
86
+ template: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTemplate;
87
+ }): DataModel<{
88
+ addons?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAddons[] | undefined;
89
+ articleId: string;
90
+ attributes?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleAttributes[] | undefined;
91
+ balanceAddonKey?: string | undefined;
92
+ contractDurationInMonth: number;
93
+ description?: string | undefined;
94
+ forcedInvoicingPeriodInMonth?: number | undefined;
95
+ hasIndependentContractPeriod?: boolean | undefined;
96
+ hideOnInvoice?: boolean | undefined;
97
+ machineType?: {
98
+ cpu: string;
99
+ memory: string;
100
+ name: string;
101
+ } | undefined;
102
+ modifierArticles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableModifierArticleOptions[] | undefined;
103
+ name: string;
104
+ orderable: "forbidden" | "internal" | "beta_testing" | "full" | "deprecated";
105
+ possibleArticleChanges?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableChangeArticleOptions[] | undefined;
106
+ price?: number | undefined;
107
+ tags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTag[] | undefined;
108
+ template: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleArticleTemplate;
109
+ }>;
110
+ }]>;
111
+ export declare class ArticleDetailed extends ArticleDetailed_base {
112
+ constructor(data: ArticleData);
113
+ }
114
+ declare const ArticleListItem_base: import("polytype").Polytype.ClusteredConstructor<[typeof ArticleCommon, {
115
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableArticle): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ArticleReadableArticle>;
116
+ }]>;
117
+ export declare class ArticleListItem extends ArticleListItem_base {
118
+ constructor(data: ArticleListItemData);
119
+ }
120
+ export declare class ArticleListQuery extends ListQueryModel<ArticleListQueryModelData> {
121
+ constructor(query?: ArticleListQueryModelData);
122
+ refine(query: ArticleListQueryModelData): ArticleListQuery;
123
+ execute: import("../../react/provideReact.js").AsyncResourceVariant<() => Promise<ArticleList>>;
124
+ getTotalCount: import("../../react/provideReact.js").AsyncResourceVariant<() => Promise<number>>;
125
+ findOneAndOnly: import("../../react/provideReact.js").AsyncResourceVariant<() => Promise<ArticleListItem | undefined>>;
126
+ }
127
+ declare const ArticleList_base: import("polytype").Polytype.ClusteredConstructor<[typeof ArticleListQuery, {
128
+ new (items: ArticleListItem[], totalCount: number): ListDataModel<ArticleListItem>;
129
+ }]>;
130
+ export declare class ArticleList extends ArticleList_base {
131
+ constructor(query: ArticleListQueryData, articles: ArticleListItem[], totalCount: number);
132
+ }
133
+ export {};
@@ -0,0 +1,3 @@
1
+ import { ArticleBehaviors } from "./types.js";
2
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
3
+ export declare const apiArticleBehaviors: (client: MittwaldAPIV2Client) => ArticleBehaviors;
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1,6 @@
1
+ import { ArticleData, ArticleListItemData, ArticleListQueryData } from "../types.js";
2
+ import { QueryResponseData } from "../../../base/index.js";
3
+ export interface ArticleBehaviors {
4
+ find: (id: string) => Promise<ArticleData | undefined>;
5
+ list: (query?: ArticleListQueryData) => Promise<QueryResponseData<ArticleListItemData>>;
6
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Article.js";
2
+ export * from "./types.js";
@@ -0,0 +1,5 @@
1
+ import { MittwaldAPIV2 } from "@mittwald/api-client";
2
+ export type ArticleListQueryData = MittwaldAPIV2.Paths.V2Articles.Get.Parameters.Query;
3
+ export type ArticleData = MittwaldAPIV2.Operations.ArticleGetArticle.ResponseData;
4
+ export type ArticleListItemData = MittwaldAPIV2.Operations.ArticleListArticles.ResponseData[number];
5
+ export type ArticleListQueryModelData = ArticleListQueryData;
@@ -0,0 +1 @@
1
+ export * from "./Article/index.js";
@@ -1,5 +1,9 @@
1
+ interface Options {
2
+ dependencies?: string[];
3
+ }
1
4
  export declare abstract class ListQueryModel<TQuery> {
2
5
  protected readonly query: TQuery;
3
6
  readonly queryId: string;
4
- constructor(query: TQuery);
7
+ constructor(query: TQuery, opts?: Options);
5
8
  }
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import Dinero from "dinero.js";
2
+ export declare const Money: typeof Dinero;
3
+ export type Money = ReturnType<typeof Money>;
@@ -2,10 +2,16 @@ import { ProjectBehaviors } from "../project/Project/behaviors/index.js";
2
2
  import { ServerBehaviors } from "../server/Server/behaviors/index.js";
3
3
  import { CustomerBehaviors } from "../customer/Customer/behaviors/index.js";
4
4
  import { IngressBehaviors } from "../domain/Ingress/behaviors/index.js";
5
+ import { ContractBehaviors } from "../contract/Contract/behaviors/index.js";
5
6
  import { AppInstallationBehaviors } from "../app/AppInstallation/behaviors/index.js";
7
+ import { ContractItemBehaviors } from "../contract/ContractItem/behaviors/index.js";
8
+ import { ArticleBehaviors } from "../article/Article/behaviors/index.js";
6
9
  interface Config {
7
10
  defaultPaginationLimit: number;
8
11
  behaviors: {
12
+ contract: ContractBehaviors;
13
+ contractItem: ContractItemBehaviors;
14
+ article: ArticleBehaviors;
9
15
  project: ProjectBehaviors;
10
16
  server: ServerBehaviors;
11
17
  customer: CustomerBehaviors;
@@ -0,0 +1,68 @@
1
+ import { DataModel, ListDataModel, ListQueryModel, ReferenceModel } from "../../base/index.js";
2
+ import { ContractData, ContractListItemData, ContractListQueryData, ContractListQueryModelData } from "./types.js";
3
+ export declare class Contract extends ReferenceModel {
4
+ static ofId(id: string): Contract;
5
+ static find: import("../../react/provideReact.js").AsyncResourceVariant<(id: string) => Promise<ContractDetailed | undefined>>;
6
+ static query(query: ContractListQueryModelData): ContractListQuery;
7
+ static get: import("../../react/provideReact.js").AsyncResourceVariant<(id: string) => Promise<ContractDetailed>>;
8
+ }
9
+ declare const ContractCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
10
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContract | {
11
+ additionalItems?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem[] | undefined;
12
+ baseItem: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem;
13
+ contractId: string;
14
+ contractNumber: string;
15
+ customerId: string;
16
+ termination?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTermination | undefined;
17
+ }): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContract | {
18
+ additionalItems?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem[] | undefined;
19
+ baseItem: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem;
20
+ contractId: string;
21
+ contractNumber: string;
22
+ customerId: string;
23
+ termination?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTermination | undefined;
24
+ }>;
25
+ }, typeof Contract]>;
26
+ declare class ContractCommon extends ContractCommon_base {
27
+ constructor(data: ContractListItemData | ContractData);
28
+ }
29
+ declare const ContractDetailed_base: import("polytype").Polytype.ClusteredConstructor<[typeof ContractCommon, {
30
+ new (data: {
31
+ additionalItems?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem[] | undefined;
32
+ baseItem: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem;
33
+ contractId: string;
34
+ contractNumber: string;
35
+ customerId: string;
36
+ termination?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTermination | undefined;
37
+ }): DataModel<{
38
+ additionalItems?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem[] | undefined;
39
+ baseItem: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContractItem;
40
+ contractId: string;
41
+ contractNumber: string;
42
+ customerId: string;
43
+ termination?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTermination | undefined;
44
+ }>;
45
+ }]>;
46
+ export declare class ContractDetailed extends ContractDetailed_base {
47
+ constructor(data: ContractData);
48
+ }
49
+ declare const ContractListItem_base: import("polytype").Polytype.ClusteredConstructor<[typeof ContractCommon, {
50
+ new (data: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContract): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractContract>;
51
+ }]>;
52
+ export declare class ContractListItem extends ContractListItem_base {
53
+ constructor(data: ContractListItemData);
54
+ }
55
+ export declare class ContractListQuery extends ListQueryModel<ContractListQueryModelData> {
56
+ constructor(query: ContractListQueryModelData);
57
+ refine(query: ContractListQueryData): ContractListQuery;
58
+ execute: import("../../react/provideReact.js").AsyncResourceVariant<() => Promise<ContractList>>;
59
+ getTotalCount: import("../../react/provideReact.js").AsyncResourceVariant<() => Promise<number>>;
60
+ findOneAndOnly: import("../../react/provideReact.js").AsyncResourceVariant<() => Promise<ContractListItem | undefined>>;
61
+ }
62
+ declare const ContractList_base: import("polytype").Polytype.ClusteredConstructor<[typeof ContractListQuery, {
63
+ new (items: ContractListItem[], totalCount: number): ListDataModel<ContractListItem>;
64
+ }]>;
65
+ export declare class ContractList extends ContractList_base {
66
+ constructor(query: ContractListQueryModelData, contracts: ContractListItem[], totalCount: number);
67
+ }
68
+ export {};
@@ -0,0 +1,3 @@
1
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
2
+ import { ContractBehaviors } from "./types.js";
3
+ export declare const apiContractBehaviors: (client: MittwaldAPIV2Client) => ContractBehaviors;
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1,9 @@
1
+ import { ContractData, ContractListItemData, ContractListQueryData } from "../types.js";
2
+ import { QueryResponseData } from "../../../base/index.js";
3
+ export interface ContractBehaviors {
4
+ find: (id: string) => Promise<ContractData | undefined>;
5
+ list: (request: {
6
+ customerId: string;
7
+ queryParameters?: ContractListQueryData;
8
+ }) => Promise<QueryResponseData<ContractListItemData>>;
9
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Contract.js";
2
+ export * from "./types.js";
@@ -0,0 +1,8 @@
1
+ import { MittwaldAPIV2 } from "@mittwald/api-client";
2
+ import { Customer } from "../../customer/index.js";
3
+ export type ContractListQueryData = MittwaldAPIV2.Paths.V2ContractsContractId.Get.Parameters.Query;
4
+ export type ContractListQueryModelData = Omit<ContractListQueryData, "customerId"> & {
5
+ customer: Customer;
6
+ };
7
+ export type ContractData = MittwaldAPIV2.Operations.ContractGetDetailOfContract.ResponseData;
8
+ export type ContractListItemData = MittwaldAPIV2.Operations.ContractListContracts.ResponseData[number];
@@ -0,0 +1,64 @@
1
+ import { ContractItemData } from "./types.js";
2
+ import { DataModel, ReferenceModel } from "../../base/index.js";
3
+ export declare class ContractItem extends ReferenceModel {
4
+ static ofId(contractId: string, id: string): ContractItem;
5
+ static find: import("../../react/provideReact.js").AsyncResourceVariant<(contractId: string, contractItemId: string) => Promise<ContractItemDetailed | undefined>>;
6
+ static get: import("../../react/provideReact.js").AsyncResourceVariant<(contractId: string, contractItemId: string) => Promise<ContractItemDetailed>>;
7
+ readonly contractId: string;
8
+ constructor(contractId: string, id: string);
9
+ }
10
+ declare const ContractItemDetailed_base: import("polytype").Polytype.ClusteredConstructor<[{
11
+ new (data: {
12
+ activationDate?: string | undefined;
13
+ aggregateReference?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractAggregateReference | undefined;
14
+ articles: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractArticle[];
15
+ contractPeriod: number;
16
+ description: string;
17
+ freeTrialDays?: number | undefined;
18
+ groupByProjectId?: string | undefined;
19
+ invoiceStop?: string | undefined;
20
+ invoicingPeriod?: number | undefined;
21
+ isActivated: boolean;
22
+ isBaseItem: boolean;
23
+ isInFreeTrial?: boolean | undefined;
24
+ isInclusive?: boolean | undefined;
25
+ itemId: string;
26
+ nextPossibleDowngradeDate?: string | undefined;
27
+ nextPossibleTerminationDate?: string | undefined;
28
+ nextPossibleUpgradeDate?: string | undefined;
29
+ orderDate?: string | undefined;
30
+ orderId?: string | undefined;
31
+ replacedByItem?: string | undefined;
32
+ tariffChange?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTariffChange | undefined;
33
+ termination?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTermination | undefined;
34
+ totalPrice: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractPrice;
35
+ }): DataModel<{
36
+ activationDate?: string | undefined;
37
+ aggregateReference?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractAggregateReference | undefined;
38
+ articles: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractArticle[];
39
+ contractPeriod: number;
40
+ description: string;
41
+ freeTrialDays?: number | undefined;
42
+ groupByProjectId?: string | undefined;
43
+ invoiceStop?: string | undefined;
44
+ invoicingPeriod?: number | undefined;
45
+ isActivated: boolean;
46
+ isBaseItem: boolean;
47
+ isInFreeTrial?: boolean | undefined;
48
+ isInclusive?: boolean | undefined;
49
+ itemId: string;
50
+ nextPossibleDowngradeDate?: string | undefined;
51
+ nextPossibleTerminationDate?: string | undefined;
52
+ nextPossibleUpgradeDate?: string | undefined;
53
+ orderDate?: string | undefined;
54
+ orderId?: string | undefined;
55
+ replacedByItem?: string | undefined;
56
+ tariffChange?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTariffChange | undefined;
57
+ termination?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractTermination | undefined;
58
+ totalPrice: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.ContractPrice;
59
+ }>;
60
+ }, typeof ContractItem]>;
61
+ export declare class ContractItemDetailed extends ContractItemDetailed_base {
62
+ constructor(contractId: string, data: ContractItemData);
63
+ }
64
+ export {};
@@ -0,0 +1,3 @@
1
+ import { MittwaldAPIV2Client } from "@mittwald/api-client";
2
+ import { ContractItemBehaviors } from "./types.js";
3
+ export declare const apiContractItemBehaviors: (client: MittwaldAPIV2Client) => ContractItemBehaviors;
@@ -0,0 +1,2 @@
1
+ export * from "./api.js";
2
+ export * from "./types.js";
@@ -0,0 +1,4 @@
1
+ import { ContractItemData } from "../types.js";
2
+ export interface ContractItemBehaviors {
3
+ find: (contractId: string, contractItemId: string) => Promise<ContractItemData | undefined>;
4
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./ContractItem.js";
2
+ export * from "./types.js";
@@ -0,0 +1,2 @@
1
+ import { MittwaldAPIV2 } from "@mittwald/api-client";
2
+ export type ContractItemData = MittwaldAPIV2.Operations.ContractGetDetailOfContractItem.ResponseData;
@@ -0,0 +1,2 @@
1
+ export * from "./Contract/index.js";
2
+ export * from "./ContractItem/index.js";
@@ -31,14 +31,17 @@ declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstruc
31
31
  customerId: string;
32
32
  customerNumber: string;
33
33
  executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
34
+ flags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomerFlag[] | undefined;
35
+ isAllowedToPlaceOrders?: boolean | undefined;
34
36
  isBanned?: boolean | undefined;
35
37
  isInDefaultOfPayment?: boolean | undefined;
38
+ levelOfUndeliverableDunningNotice?: "first" | "second" | undefined;
36
39
  memberCount: number;
37
40
  name: string;
38
41
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
39
42
  projectCount: number;
40
43
  vatId?: string | undefined;
41
- vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
44
+ vatIdValidationState?: "valid" | "invalid" | "pending" | "unspecified" | undefined;
42
45
  }): DataModel<import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomer | {
43
46
  activeSuspension?: {
44
47
  createdAt: string;
@@ -49,14 +52,17 @@ declare const CustomerCommon_base: import("polytype").Polytype.ClusteredConstruc
49
52
  customerId: string;
50
53
  customerNumber: string;
51
54
  executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
55
+ flags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomerFlag[] | undefined;
56
+ isAllowedToPlaceOrders?: boolean | undefined;
52
57
  isBanned?: boolean | undefined;
53
58
  isInDefaultOfPayment?: boolean | undefined;
59
+ levelOfUndeliverableDunningNotice?: "first" | "second" | undefined;
54
60
  memberCount: number;
55
61
  name: string;
56
62
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
57
63
  projectCount: number;
58
64
  vatId?: string | undefined;
59
- vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
65
+ vatIdValidationState?: "valid" | "invalid" | "pending" | "unspecified" | undefined;
60
66
  }>;
61
67
  }, typeof Customer]>;
62
68
  declare class CustomerCommon extends CustomerCommon_base {
@@ -73,14 +79,17 @@ declare const CustomerDetailed_base: import("polytype").Polytype.ClusteredConstr
73
79
  customerId: string;
74
80
  customerNumber: string;
75
81
  executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
82
+ flags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomerFlag[] | undefined;
83
+ isAllowedToPlaceOrders?: boolean | undefined;
76
84
  isBanned?: boolean | undefined;
77
85
  isInDefaultOfPayment?: boolean | undefined;
86
+ levelOfUndeliverableDunningNotice?: "first" | "second" | undefined;
78
87
  memberCount: number;
79
88
  name: string;
80
89
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
81
90
  projectCount: number;
82
91
  vatId?: string | undefined;
83
- vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
92
+ vatIdValidationState?: "valid" | "invalid" | "pending" | "unspecified" | undefined;
84
93
  }): DataModel<{
85
94
  activeSuspension?: {
86
95
  createdAt: string;
@@ -91,14 +100,17 @@ declare const CustomerDetailed_base: import("polytype").Polytype.ClusteredConstr
91
100
  customerId: string;
92
101
  customerNumber: string;
93
102
  executingUserRoles?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerRole[] | undefined;
103
+ flags?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerCustomerFlag[] | undefined;
104
+ isAllowedToPlaceOrders?: boolean | undefined;
94
105
  isBanned?: boolean | undefined;
95
106
  isInDefaultOfPayment?: boolean | undefined;
107
+ levelOfUndeliverableDunningNotice?: "first" | "second" | undefined;
96
108
  memberCount: number;
97
109
  name: string;
98
110
  owner?: import("@mittwald/api-client").MittwaldAPIV2.Components.Schemas.CustomerContact | undefined;
99
111
  projectCount: number;
100
112
  vatId?: string | undefined;
101
- vatIdValidationState?: ("valid" | "invalid" | "pending" | "unspecified") | undefined;
113
+ vatIdValidationState?: "valid" | "invalid" | "pending" | "unspecified" | undefined;
102
114
  }>;
103
115
  }]>;
104
116
  export declare class CustomerDetailed extends CustomerDetailed_base {
@@ -1,5 +1,5 @@
1
1
  import { DataModel } from "../../base/DataModel.js";
2
- import { IngressUndefinedTargetData, IngressDirectoryTargetData, IngressAppInstallationTargetData, IngressRedirectTargetData, IngressTargetData } from "./types.js";
2
+ import { IngressUndefinedTargetData, IngressAppInstallationTargetData, IngressRedirectTargetData, IngressTargetData } from "./types.js";
3
3
  import { IngressPath } from "../IngressPath/IngressPath.js";
4
4
  import { AppInstallation } from "../../app/AppInstallation/index.js";
5
5
  declare abstract class IngressTargetBase<T extends IngressTargetData> extends DataModel<T> {
@@ -11,11 +11,6 @@ export declare class IngressRedirectTarget extends IngressTargetBase<IngressRedi
11
11
  readonly url: URL;
12
12
  constructor(path: IngressPath, data: IngressRedirectTargetData);
13
13
  }
14
- export declare class IngressDirectoryTarget extends IngressTargetBase<IngressDirectoryTargetData> {
15
- readonly type = "directory";
16
- readonly directory: string;
17
- constructor(path: IngressPath, data: IngressDirectoryTargetData);
18
- }
19
14
  export declare class IngressAppInstallationTarget extends IngressTargetBase<IngressAppInstallationTargetData> {
20
15
  readonly type = "appInstallation";
21
16
  readonly appInstallation: AppInstallation;
@@ -24,6 +19,6 @@ export declare class IngressAppInstallationTarget extends IngressTargetBase<Ingr
24
19
  export declare class IngressUndefinedTarget extends IngressTargetBase<IngressUndefinedTargetData> {
25
20
  readonly type = "undefined";
26
21
  }
27
- export type IngressTarget = IngressRedirectTarget | IngressDirectoryTarget | IngressAppInstallationTarget | IngressUndefinedTarget;
22
+ export type IngressTarget = IngressRedirectTarget | IngressAppInstallationTarget | IngressUndefinedTarget;
28
23
  export declare const ingressTargetFactory: (path: IngressPath, data: IngressTargetData) => IngressTarget;
29
24
  export {};
@@ -1,7 +1,6 @@
1
1
  import { MittwaldAPIV2 } from "@mittwald/api-client";
2
2
  export type IngressRedirectTargetData = MittwaldAPIV2.Components.Schemas.IngressTargetUrl;
3
- export type IngressDirectoryTargetData = MittwaldAPIV2.Components.Schemas.IngressTargetDirectory;
4
3
  export type IngressAppInstallationTargetData = MittwaldAPIV2.Components.Schemas.IngressTargetInstallation;
5
4
  export type IngressContainerTargetData = MittwaldAPIV2.Components.Schemas.IngressTargetContainer;
6
5
  export type IngressUndefinedTargetData = MittwaldAPIV2.Components.Schemas.IngressTargetUseDefaultPage;
7
- export type IngressTargetData = IngressRedirectTargetData | IngressDirectoryTargetData | IngressAppInstallationTargetData | IngressUndefinedTargetData | IngressContainerTargetData;
6
+ export type IngressTargetData = IngressRedirectTargetData | IngressAppInstallationTargetData | IngressUndefinedTargetData | IngressContainerTargetData;
@@ -0,0 +1 @@
1
+ export declare const joinedId: (...parts: Array<number | string>) => string;
@@ -30,6 +30,8 @@ export declare class Project extends ReferenceModel {
30
30
  }
31
31
  declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstructor<[{
32
32
  new (data: {
33
+ backupStorageUsageInBytes: number;
34
+ backupStorageUsageInBytesSetAt: string;
33
35
  createdAt: string;
34
36
  customerId: string;
35
37
  customerMeta: {
@@ -51,6 +53,8 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
51
53
  webStorageUsageInBytes: number;
52
54
  webStorageUsageInBytesSetAt: string;
53
55
  } | {
56
+ backupStorageUsageInBytes: number;
57
+ backupStorageUsageInBytesSetAt: string;
54
58
  clusterDomain?: string | undefined;
55
59
  clusterID?: string | undefined;
56
60
  clusterId?: string | undefined;
@@ -78,6 +82,8 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
78
82
  webStorageUsageInBytes: number;
79
83
  webStorageUsageInBytesSetAt: string;
80
84
  }): DataModel<{
85
+ backupStorageUsageInBytes: number;
86
+ backupStorageUsageInBytesSetAt: string;
81
87
  createdAt: string;
82
88
  customerId: string;
83
89
  customerMeta: {
@@ -99,6 +105,8 @@ declare const ProjectCommon_base: import("polytype").Polytype.ClusteredConstruct
99
105
  webStorageUsageInBytes: number;
100
106
  webStorageUsageInBytesSetAt: string;
101
107
  } | {
108
+ backupStorageUsageInBytes: number;
109
+ backupStorageUsageInBytesSetAt: string;
102
110
  clusterDomain?: string | undefined;
103
111
  clusterID?: string | undefined;
104
112
  clusterId?: string | undefined;
@@ -134,6 +142,8 @@ declare class ProjectCommon extends ProjectCommon_base {
134
142
  }
135
143
  declare const ProjectDetailed_base: import("polytype").Polytype.ClusteredConstructor<[typeof ProjectCommon, {
136
144
  new (data: {
145
+ backupStorageUsageInBytes: number;
146
+ backupStorageUsageInBytesSetAt: string;
137
147
  clusterDomain?: string | undefined;
138
148
  clusterID?: string | undefined;
139
149
  clusterId?: string | undefined;
@@ -161,6 +171,8 @@ declare const ProjectDetailed_base: import("polytype").Polytype.ClusteredConstru
161
171
  webStorageUsageInBytes: number;
162
172
  webStorageUsageInBytesSetAt: string;
163
173
  }): DataModel<{
174
+ backupStorageUsageInBytes: number;
175
+ backupStorageUsageInBytesSetAt: string;
164
176
  clusterDomain?: string | undefined;
165
177
  clusterID?: string | undefined;
166
178
  clusterId?: string | undefined;
@@ -194,6 +206,8 @@ export declare class ProjectDetailed extends ProjectDetailed_base {
194
206
  }
195
207
  declare const ProjectListItem_base: import("polytype").Polytype.ClusteredConstructor<[typeof ProjectCommon, {
196
208
  new (data: {
209
+ backupStorageUsageInBytes: number;
210
+ backupStorageUsageInBytesSetAt: string;
197
211
  createdAt: string;
198
212
  customerId: string;
199
213
  customerMeta: {
@@ -215,6 +229,8 @@ declare const ProjectListItem_base: import("polytype").Polytype.ClusteredConstru
215
229
  webStorageUsageInBytes: number;
216
230
  webStorageUsageInBytesSetAt: string;
217
231
  }): DataModel<{
232
+ backupStorageUsageInBytes: number;
233
+ backupStorageUsageInBytesSetAt: string;
218
234
  createdAt: string;
219
235
  customerId: string;
220
236
  customerMeta: {
@@ -1,7 +1,10 @@
1
1
  import { AsyncResource } from "./reactUsePromise.js";
2
2
  import { AsyncReturnType } from "type-fest";
3
3
  type AsyncFn = (...args: any[]) => Promise<unknown>;
4
- export declare const provideReact: <T extends AsyncFn>(loader: T, dependencies?: string[]) => AsyncResourceVariant<T>;
4
+ type ReactProvisionDep = string | number;
5
+ type LazyReactProvisionDep = () => ReactProvisionDep;
6
+ type ReactProvisionDeps = Array<ReactProvisionDep | LazyReactProvisionDep>;
7
+ export declare const provideReact: <T extends AsyncFn>(loader: T, dependencies?: ReactProvisionDeps) => AsyncResourceVariant<T>;
5
8
  export type AsyncResourceVariant<T extends AsyncFn> = T & {
6
9
  asResource: (...params: Parameters<T>) => AsyncResource<AsyncReturnType<T>>;
7
10
  use: (...params: Parameters<T>) => AsyncReturnType<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/api-models",
3
- "version": "0.0.0-development-e096ee7-20240924",
3
+ "version": "0.0.0-development-84e90b6-20250514",
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",
@@ -39,40 +39,42 @@
39
39
  "test:unit": "node --experimental-vm-modules $(yarn bin jest)"
40
40
  },
41
41
  "dependencies": {
42
- "@mittwald/api-client": "^0.0.0-development-e096ee7-20240924",
42
+ "@mittwald/api-client": "^0.0.0-development-84e90b6-20250514",
43
43
  "another-deep-freeze": "^1.0.0",
44
- "context": "^3.0.31",
44
+ "context": "^3.0.33",
45
+ "dinero.js": "^1.9.1",
45
46
  "object-code": "^1.3.3",
46
47
  "polytype": "^0.17.0",
47
48
  "tsd": "^0.31.2",
48
- "type-fest": "^4.23.0"
49
+ "type-fest": "^4.30.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@jest/globals": "^29.7.0",
52
- "@mittwald/react-use-promise": "^2.5.0",
53
+ "@mittwald/react-use-promise": "^2.6.0",
53
54
  "@testing-library/dom": "^10.4.0",
54
- "@testing-library/jest-dom": "^6.5.0",
55
- "@testing-library/react": "^16.0.1",
56
- "@types/jest": "^29.5.12",
57
- "@types/react": "^18.3.3",
55
+ "@testing-library/jest-dom": "^6.6.3",
56
+ "@testing-library/react": "^16.1.0",
57
+ "@types/dinero.js": "^1",
58
+ "@types/jest": "^29.5.14",
59
+ "@types/react": "^18.3.14",
58
60
  "@types/react-dom": "^18",
59
61
  "@typescript-eslint/eslint-plugin": "^7.18.0",
60
62
  "@typescript-eslint/parser": "^7.18.0",
61
- "eslint": "^8.57.0",
63
+ "eslint": "^8.57.1",
62
64
  "eslint-config-prettier": "^9.1.0",
63
65
  "eslint-plugin-json": "^3.1.0",
64
66
  "eslint-plugin-prettier": "^5.2.1",
65
67
  "jest": "^29.7.0",
66
68
  "jest-environment-jsdom": "^29.7.0",
67
- "prettier": "^3.3.3",
69
+ "prettier": "^3.4.2",
68
70
  "react": "^18.3.1",
69
71
  "react-dom": "^18.3.1",
70
72
  "rimraf": "^5.0.10",
71
- "ts-jest": "^29.2.4",
72
- "typescript": "^5.5.4"
73
+ "ts-jest": "^29.2.5",
74
+ "typescript": "^5.7.2"
73
75
  },
74
76
  "peerDependencies": {
75
- "@mittwald/react-use-promise": "^2.3.12"
77
+ "@mittwald/react-use-promise": "^2.6.0"
76
78
  },
77
79
  "peerDependenciesMeta": {
78
80
  "@mittwald/react-use-promise": {
@@ -82,5 +84,5 @@
82
84
  "optional": true
83
85
  }
84
86
  },
85
- "gitHead": "e93211612e230da1167088de10ad01bde7ede483"
87
+ "gitHead": "32a7c7cf1f2ea2a96fa9c6471030a02e7ad834e2"
86
88
  }