tanss-api 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/dist/erp/client.d.ts +36 -0
- package/dist/erp/errors.d.ts +41 -0
- package/dist/erp/index.d.ts +63 -0
- package/dist/erp/resources/accountingTypes.d.ts +29 -0
- package/dist/erp/resources/catalog.d.ts +18 -0
- package/dist/erp/resources/categories.d.ts +59 -0
- package/dist/erp/resources/checklists.d.ts +22 -0
- package/dist/erp/resources/companies.d.ts +46 -0
- package/dist/erp/resources/customers.d.ts +24 -0
- package/dist/erp/resources/departments.d.ts +17 -0
- package/dist/erp/resources/employees.d.ts +26 -0
- package/dist/erp/resources/offers.d.ts +40 -0
- package/dist/erp/resources/tickets.d.ts +27 -0
- package/dist/generated/types.gen.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -5
- package/package.json +10 -7
- package/dist/src/generated/client/client.gen.d.ts +0 -2
- package/dist/src/generated/client/index.d.ts +0 -10
- package/dist/src/generated/client/types.gen.d.ts +0 -120
- package/dist/src/generated/client/utils.gen.d.ts +0 -37
- package/dist/src/generated/client.gen.d.ts +0 -12
- package/dist/src/generated/core/auth.gen.d.ts +0 -25
- package/dist/src/generated/core/bodySerializer.gen.d.ts +0 -25
- package/dist/src/generated/core/params.gen.d.ts +0 -43
- package/dist/src/generated/core/pathSerializer.gen.d.ts +0 -33
- package/dist/src/generated/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/src/generated/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/src/generated/core/types.gen.d.ts +0 -83
- package/dist/src/generated/core/utils.gen.d.ts +0 -19
- package/dist/src/generated/index.d.ts +0 -2
- package/dist/src/generated/sdk.gen.d.ts +0 -6388
- package/dist/src/generated/types.gen.d.ts +0 -37287
- package/dist/src/index.d.ts +0 -2
package/README.md
CHANGED
|
@@ -77,6 +77,73 @@ await putApiV1TicketsTicketId({
|
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
|
|
80
|
+
## 🏭 ERP integrations
|
|
81
|
+
For the `/api/erp/v1/...` and `/api/v1/erp/...` endpoints, use the namespaced
|
|
82
|
+
ERP client instead of the raw generated functions. It groups all 40+ ERP
|
|
83
|
+
operations into resources (`companies`, `employees`, `tickets`, ...), returns
|
|
84
|
+
response bodies directly, and throws an `ErpApiError` on non-2xx responses.
|
|
85
|
+
|
|
86
|
+
> Requires a dedicated API token bound to an external API role of `ERP`,
|
|
87
|
+
> `CENTRON`, or `SYSTEMHAUS_ONE` — a normal user login token will NOT work.
|
|
88
|
+
> The token already includes the literal `Bearer ` prefix, send it verbatim.
|
|
89
|
+
|
|
90
|
+
### Configure the ERP client
|
|
91
|
+
```ts
|
|
92
|
+
import { createErpClient } from 'tanss-api'
|
|
93
|
+
|
|
94
|
+
const erp = createErpClient({
|
|
95
|
+
baseUrl: 'https://tanssserver.example.com',
|
|
96
|
+
token: process.env.TANSS_ERP_TOKEN!,
|
|
97
|
+
})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Unlike the shared `client` singleton, each ERP client owns an isolated
|
|
101
|
+
instance, so auth from other API areas can't leak into ERP requests.
|
|
102
|
+
Rotate the token later with `erp.setToken(nextToken)`.
|
|
103
|
+
|
|
104
|
+
### Make requests
|
|
105
|
+
```ts
|
|
106
|
+
import { createErpClient, ErpApiError } from 'tanss-api'
|
|
107
|
+
|
|
108
|
+
const erp = createErpClient({
|
|
109
|
+
baseUrl: 'https://tanssserver.example.com',
|
|
110
|
+
token: process.env.TANSS_ERP_TOKEN!,
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
// GET /api/erp/v1/companies/{id}
|
|
115
|
+
const company = await erp.companies.get(42)
|
|
116
|
+
console.log(company.content)
|
|
117
|
+
|
|
118
|
+
// Find a customer by its external ERP customer number
|
|
119
|
+
const matches = await erp.companies.searchByDisplayId('C-10042')
|
|
120
|
+
|
|
121
|
+
// Map ticket states/types before creating tickets via the sync
|
|
122
|
+
const statuses = await erp.tickets.statuses()
|
|
123
|
+
const types = await erp.tickets.types()
|
|
124
|
+
|
|
125
|
+
// POST /api/erp/v1/tickets
|
|
126
|
+
const ticket = await erp.tickets.create({
|
|
127
|
+
// ... TicketSaveWritable fields
|
|
128
|
+
})
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (error instanceof ErpApiError) {
|
|
131
|
+
console.error(error.message, error.status, error.body)
|
|
132
|
+
} else {
|
|
133
|
+
throw error
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Available resources: `companies`, `employees`, `departments`, `categories`,
|
|
139
|
+
`types`, `tickets`, `customers` (incl. `invoices`), `accountingTypes`,
|
|
140
|
+
`checklists`, `catalog` (`projects`, `stocks`), and `offers` (ERP selections).
|
|
141
|
+
|
|
142
|
+
> `erp.offers` (`/api/v1/offers/erpSelections*`) is the exception: those routes
|
|
143
|
+
> authenticate with a normal user session token, not the ERP-role token. Pass
|
|
144
|
+
> a user token to `createErpClient` when using that resource.
|
|
145
|
+
|
|
146
|
+
|
|
80
147
|
## 📜 License
|
|
81
148
|
TANSS API and specification are licensed under a proprietary license by [HUCK IT GmbH][huck-imprint].
|
|
82
149
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Client, Config } from '../generated/client/types.gen';
|
|
2
|
+
export interface CreateErpClientOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Hostname of the TANSS instance, e.g. `https://tanss.example.com`.
|
|
5
|
+
*/
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
/**
|
|
8
|
+
* ERP integration token, sent verbatim in the `apiToken` header
|
|
9
|
+
* (including the `Bearer ` prefix).
|
|
10
|
+
*
|
|
11
|
+
* Must belong to an external API role of `ERP`, `CENTRON` or
|
|
12
|
+
* `SYSTEMHAUS_ONE`. A normal user login token will NOT work for the
|
|
13
|
+
* `/api/erp/v1/...` routes.
|
|
14
|
+
*/
|
|
15
|
+
token: string;
|
|
16
|
+
/**
|
|
17
|
+
* Custom fetch implementation. Defaults to `globalThis.fetch`.
|
|
18
|
+
*/
|
|
19
|
+
fetch?: typeof fetch;
|
|
20
|
+
/**
|
|
21
|
+
* Extra hey-api client config merged over the defaults.
|
|
22
|
+
*/
|
|
23
|
+
config?: Omit<Config, 'baseUrl' | 'auth' | 'fetch'>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create an isolated hey-api client pre-configured for the ERP endpoints.
|
|
27
|
+
*
|
|
28
|
+
* Unlike the generated `client` singleton, the returned instance is not
|
|
29
|
+
* shared with other API areas, so `setConfig` calls elsewhere cannot leak a
|
|
30
|
+
* user token into ERP requests (or vice versa).
|
|
31
|
+
*/
|
|
32
|
+
export declare function createErpClientInstance(options: CreateErpClientOptions): Client;
|
|
33
|
+
/**
|
|
34
|
+
* Update the token of an ERP client instance (e.g. after rotation).
|
|
35
|
+
*/
|
|
36
|
+
export declare function setErpClientToken(client: Client, token: string): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface ErpApiErrorDetails {
|
|
2
|
+
status?: number;
|
|
3
|
+
body: unknown;
|
|
4
|
+
request?: Request;
|
|
5
|
+
response?: Response;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Error thrown by the ERP facade when TANSS answers with a non-2xx status.
|
|
9
|
+
*
|
|
10
|
+
* The generated SDK returns `{ data } | { error }` unions; the facade
|
|
11
|
+
* converts the error branch into this exception so callers can use plain
|
|
12
|
+
* `try/catch` instead of checking every response.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ErpApiError extends Error {
|
|
15
|
+
readonly status?: number;
|
|
16
|
+
readonly body: unknown;
|
|
17
|
+
readonly request?: Request;
|
|
18
|
+
readonly response?: Response;
|
|
19
|
+
constructor(message: string, details: ErpApiErrorDetails);
|
|
20
|
+
}
|
|
21
|
+
type ErpResult<TData, TError> = {
|
|
22
|
+
data: TData | undefined;
|
|
23
|
+
error: TError | undefined;
|
|
24
|
+
request?: Request;
|
|
25
|
+
response?: Response;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Unwrap a generated-SDK result: return `data` on success, throw an
|
|
29
|
+
* `ErpApiError` (with HTTP status when available) otherwise.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ensureErpData<TData, TError>(result: ErpResult<TData, TError>, context: string): TData;
|
|
32
|
+
/**
|
|
33
|
+
* Assert a generated-SDK call without a response body succeeded,
|
|
34
|
+
* throwing an `ErpApiError` otherwise (for 204 No Content endpoints).
|
|
35
|
+
*/
|
|
36
|
+
export declare function ensureErpSuccess<TError>(result: {
|
|
37
|
+
error: TError | undefined;
|
|
38
|
+
request?: Request;
|
|
39
|
+
response?: Response;
|
|
40
|
+
}, context: string): void;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Client } from '../generated/client/types.gen';
|
|
2
|
+
import { type CreateErpClientOptions } from './client';
|
|
3
|
+
import { type AccountingTypesResource } from './resources/accountingTypes';
|
|
4
|
+
import { type CatalogResource } from './resources/catalog';
|
|
5
|
+
import { type CategoriesResource, type CompanyTypesResource } from './resources/categories';
|
|
6
|
+
import { type ChecklistsResource } from './resources/checklists';
|
|
7
|
+
import { type CompaniesResource } from './resources/companies';
|
|
8
|
+
import { type CustomersResource } from './resources/customers';
|
|
9
|
+
import { type DepartmentsResource } from './resources/departments';
|
|
10
|
+
import { type EmployeesResource } from './resources/employees';
|
|
11
|
+
import { type OffersResource } from './resources/offers';
|
|
12
|
+
import { type TicketsResource } from './resources/tickets';
|
|
13
|
+
export type { CreateErpClientOptions } from './client';
|
|
14
|
+
export { createErpClientInstance, setErpClientToken } from './client';
|
|
15
|
+
export { ErpApiError } from './errors';
|
|
16
|
+
/**
|
|
17
|
+
* Namespaced facade over the generated `/api/erp/v1/...`,
|
|
18
|
+
* `/api/v1/erp/...` and offer `erpSelections` endpoints.
|
|
19
|
+
*
|
|
20
|
+
* Obtain an instance via `createErpClient({ baseUrl, token })`.
|
|
21
|
+
*
|
|
22
|
+
* All methods return the success body directly and throw an `ErpApiError`
|
|
23
|
+
* on non-2xx responses — no `{ data, error }` union handling required.
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { createErpClient } from 'tanss-api'
|
|
27
|
+
*
|
|
28
|
+
* const erp = createErpClient({
|
|
29
|
+
* baseUrl: 'https://tanss.example.com',
|
|
30
|
+
* token: process.env.TANSS_ERP_TOKEN!,
|
|
31
|
+
* })
|
|
32
|
+
*
|
|
33
|
+
* const company = await erp.companies.get(42)
|
|
34
|
+
* console.log(company.content)
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare class TanssErpClient {
|
|
38
|
+
readonly companies: CompaniesResource;
|
|
39
|
+
readonly employees: EmployeesResource;
|
|
40
|
+
readonly departments: DepartmentsResource;
|
|
41
|
+
readonly categories: CategoriesResource;
|
|
42
|
+
readonly types: CompanyTypesResource;
|
|
43
|
+
readonly tickets: TicketsResource;
|
|
44
|
+
readonly customers: CustomersResource;
|
|
45
|
+
readonly accountingTypes: AccountingTypesResource;
|
|
46
|
+
readonly checklists: ChecklistsResource;
|
|
47
|
+
readonly offers: OffersResource;
|
|
48
|
+
readonly catalog: CatalogResource;
|
|
49
|
+
/**
|
|
50
|
+
* The underlying isolated hey-api client. Useful for interceptors or
|
|
51
|
+
* escaping to raw generated SDK functions via `{ client }`.
|
|
52
|
+
*/
|
|
53
|
+
readonly instance: Client;
|
|
54
|
+
constructor(client: Client);
|
|
55
|
+
/**
|
|
56
|
+
* Update the ERP token (e.g. after rotation) without rebuilding the client.
|
|
57
|
+
*/
|
|
58
|
+
setToken(token: string): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a {@link TanssErpClient} with its own isolated hey-api instance.
|
|
62
|
+
*/
|
|
63
|
+
export declare function createErpClient(options: CreateErpClientOptions): TanssErpClient;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1AccountingtypesPricesResponse, GetApiErpV1AccountingtypesResponse, PostApiErpV1AccountingtypesData, PostApiErpV1AccountingtypesPricesData, PostApiErpV1AccountingtypesPricesResponse, PostApiErpV1AccountingtypesResponse } from '../../generated/types.gen';
|
|
3
|
+
export type CreateAccountingTypeBody = PostApiErpV1AccountingtypesData['body'];
|
|
4
|
+
export type CreateAccountingTypePriceBody = PostApiErpV1AccountingtypesPricesData['body'];
|
|
5
|
+
/**
|
|
6
|
+
* Accounting types (Leistungsarten) and their default prices.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createAccountingTypesResource(client: Client): {
|
|
9
|
+
/**
|
|
10
|
+
* List the accounting types configured in TANSS.
|
|
11
|
+
*/
|
|
12
|
+
list(): Promise<GetApiErpV1AccountingtypesResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new accounting type (Leistungsart).
|
|
15
|
+
*/
|
|
16
|
+
create(body: CreateAccountingTypeBody): Promise<PostApiErpV1AccountingtypesResponse>;
|
|
17
|
+
prices: {
|
|
18
|
+
/**
|
|
19
|
+
* List the default (system-wide) accounting type prices.
|
|
20
|
+
*/
|
|
21
|
+
list(): Promise<GetApiErpV1AccountingtypesPricesResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Save a new default price entry for an accounting type,
|
|
24
|
+
* optionally scoped to a linked entity.
|
|
25
|
+
*/
|
|
26
|
+
create(body: CreateAccountingTypePriceBody): Promise<PostApiErpV1AccountingtypesPricesResponse>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type AccountingTypesResource = ReturnType<typeof createAccountingTypesResource>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiV1ErpProjectsResponse, GetApiV1ErpStocksResponse } from '../../generated/types.gen';
|
|
3
|
+
/**
|
|
4
|
+
* ERP backend catalog (`/api/v1/erp/...`): projects and stocks resolved
|
|
5
|
+
* through the factory-configured ERP service. Returns an empty list when no
|
|
6
|
+
* ERP service is configured.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCatalogResource(client: Client): {
|
|
9
|
+
/**
|
|
10
|
+
* List projects from the configured ERP backend.
|
|
11
|
+
*/
|
|
12
|
+
projects(): Promise<GetApiV1ErpProjectsResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* List stocks (warehouses/inventories) from the configured ERP backend.
|
|
15
|
+
*/
|
|
16
|
+
stocks(): Promise<GetApiV1ErpStocksResponse>;
|
|
17
|
+
};
|
|
18
|
+
export type CatalogResource = ReturnType<typeof createCatalogResource>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1CompanyCategoriesCategoryIdResponse, GetApiErpV1CompanyCategoriesResponse, GetApiErpV1TypesResponse, GetApiErpV1TypesTypeIdResponse, PostApiErpV1CompanyCategoriesCategoryIdData, PostApiErpV1CompanyCategoriesCategoryIdResponse, PostApiErpV1TypesData, PostApiErpV1TypesResponse, PutApiErpV1CompanyCategoriesCategoryIdData, PutApiErpV1CompanyCategoriesCategoryIdResponse, PutApiErpV1TypesTypeIdData, PutApiErpV1TypesTypeIdResponse } from '../../generated/types.gen';
|
|
3
|
+
export type CreateCompanyCategoryBody = PostApiErpV1CompanyCategoriesCategoryIdData['body'];
|
|
4
|
+
export type UpdateCompanyCategoryBody = PutApiErpV1CompanyCategoriesCategoryIdData['body'];
|
|
5
|
+
export type CreateCompanyTypeBody = PostApiErpV1TypesData['body'];
|
|
6
|
+
export type UpdateCompanyTypeBody = PutApiErpV1TypesTypeIdData['body'];
|
|
7
|
+
/**
|
|
8
|
+
* Company classifications: categories (Firmen-Kategorien) each grouping
|
|
9
|
+
* company types (Firmen-Typen).
|
|
10
|
+
*/
|
|
11
|
+
export declare function createCategoriesResource(client: Client): {
|
|
12
|
+
/**
|
|
13
|
+
* List all company categories with their associated company types.
|
|
14
|
+
*/
|
|
15
|
+
list(): Promise<GetApiErpV1CompanyCategoriesResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Read the single company category identified by `categoryId`.
|
|
18
|
+
*/
|
|
19
|
+
get(categoryId: number): Promise<GetApiErpV1CompanyCategoriesCategoryIdResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new company category.
|
|
22
|
+
*/
|
|
23
|
+
create(categoryId: string, body: CreateCompanyCategoryBody): Promise<PostApiErpV1CompanyCategoriesCategoryIdResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Update the company category identified by `categoryId`.
|
|
26
|
+
*/
|
|
27
|
+
update(categoryId: number, body: UpdateCompanyCategoryBody): Promise<PutApiErpV1CompanyCategoriesCategoryIdResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* Delete the company category identified by `categoryId`.
|
|
30
|
+
*/
|
|
31
|
+
remove(categoryId: number): Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
export type CategoriesResource = ReturnType<typeof createCategoriesResource>;
|
|
34
|
+
/**
|
|
35
|
+
* Company types (Firmen-Typen) belonging to a category.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createCompanyTypesResource(client: Client): {
|
|
38
|
+
/**
|
|
39
|
+
* List all company types configured in TANSS.
|
|
40
|
+
*/
|
|
41
|
+
list(): Promise<GetApiErpV1TypesResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* Read the single company type identified by `typeId`.
|
|
44
|
+
*/
|
|
45
|
+
get(typeId: number): Promise<GetApiErpV1TypesTypeIdResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Create a new company type and assign it to a category.
|
|
48
|
+
*/
|
|
49
|
+
create(body: CreateCompanyTypeBody): Promise<PostApiErpV1TypesResponse>;
|
|
50
|
+
/**
|
|
51
|
+
* Update the company type identified by `typeId`.
|
|
52
|
+
*/
|
|
53
|
+
update(typeId: number, body: UpdateCompanyTypeBody): Promise<PutApiErpV1TypesTypeIdResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Delete the company type identified by `typeId`.
|
|
56
|
+
*/
|
|
57
|
+
remove(typeId: number): Promise<void>;
|
|
58
|
+
};
|
|
59
|
+
export type CompanyTypesResource = ReturnType<typeof createCompanyTypesResource>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1ChecklistsData, GetApiErpV1ChecklistsResponse, PostApiErpV1ChecklistsAssignmentLinkTypeIdLinkIdChecklistIdResponse } from '../../generated/types.gen';
|
|
3
|
+
export type ChecklistsQuery = GetApiErpV1ChecklistsData['query'];
|
|
4
|
+
export interface AssignChecklistArgs {
|
|
5
|
+
linkTypeId: number;
|
|
6
|
+
linkId: number;
|
|
7
|
+
checklistId: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checklists: pick a checklist and assign it to a ticket (or other entity).
|
|
11
|
+
*/
|
|
12
|
+
export declare function createChecklistsResource(client: Client): {
|
|
13
|
+
/**
|
|
14
|
+
* List checklists, optionally filtered by company and/or department.
|
|
15
|
+
*/
|
|
16
|
+
list(query?: ChecklistsQuery): Promise<GetApiErpV1ChecklistsResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Assign a checklist to a ticket (`linkTypeId: 11`).
|
|
19
|
+
*/
|
|
20
|
+
assign(args: AssignChecklistArgs): Promise<PostApiErpV1ChecklistsAssignmentLinkTypeIdLinkIdChecklistIdResponse>;
|
|
21
|
+
};
|
|
22
|
+
export type ChecklistsResource = ReturnType<typeof createChecklistsResource>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1CompaniesDepartmentsResponse, GetApiErpV1CompaniesEmployeesData, GetApiErpV1CompaniesEmployeesDepartmentsResponse, GetApiErpV1CompaniesEmployeesResponse, GetApiErpV1CompaniesIdResponse, GetApiErpV1CompaniesSearchIdDisplayIdResponse, PostApiErpV1CompaniesData, PostApiErpV1CompaniesResponse, PutApiErpV1CompaniesIdData, PutApiErpV1CompaniesIdResponse } from '../../generated/types.gen';
|
|
3
|
+
export type CreateCompanyBody = PostApiErpV1CompaniesData['body'];
|
|
4
|
+
export type UpdateCompanyBody = PutApiErpV1CompaniesIdData['body'];
|
|
5
|
+
export type CompaniesEmployeesQuery = GetApiErpV1CompaniesEmployeesData['query'];
|
|
6
|
+
/**
|
|
7
|
+
* Company (customer) master data: CRUD plus the ERP lookup and
|
|
8
|
+
* employee/department views scoped to companies.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createCompaniesResource(client: Client): {
|
|
11
|
+
/**
|
|
12
|
+
* Create a new company (customer) record from ERP master data.
|
|
13
|
+
*/
|
|
14
|
+
create(body: CreateCompanyBody): Promise<PostApiErpV1CompaniesResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* Read the company record identified by `id`.
|
|
17
|
+
*/
|
|
18
|
+
get(id: number): Promise<GetApiErpV1CompaniesIdResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Update the company identified by `id` with ERP master-data changes.
|
|
21
|
+
*/
|
|
22
|
+
update(id: number, body: UpdateCompanyBody): Promise<PutApiErpV1CompaniesIdResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Delete the company identified by `id` with its dependent data.
|
|
25
|
+
*/
|
|
26
|
+
remove(id: number): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Search customers by the external ERP customer number (`displayId`).
|
|
29
|
+
*/
|
|
30
|
+
searchByDisplayId(displayId: string): Promise<GetApiErpV1CompaniesSearchIdDisplayIdResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* List employees of the own company (or filter by `companyId` /
|
|
33
|
+
* `companyNumber`).
|
|
34
|
+
*/
|
|
35
|
+
employees(query?: CompaniesEmployeesQuery): Promise<GetApiErpV1CompaniesEmployeesResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* List the company departments (Abteilungen) configured in TANSS.
|
|
38
|
+
*/
|
|
39
|
+
departments(): Promise<GetApiErpV1CompaniesDepartmentsResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Map of department lists keyed by employee ID for all active
|
|
42
|
+
* employees of the own company.
|
|
43
|
+
*/
|
|
44
|
+
employeesDepartments(): Promise<GetApiErpV1CompaniesEmployeesDepartmentsResponse>;
|
|
45
|
+
};
|
|
46
|
+
export type CompaniesResource = ReturnType<typeof createCompaniesResource>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1CustomersResponse, GetApiErpV1InvoicesData, GetApiErpV1InvoicesResponse, PostApiErpV1CustomersData, PostApiErpV1CustomersResponse } from '../../generated/types.gen';
|
|
3
|
+
export type UpsertCustomersBody = PostApiErpV1CustomersData['body'];
|
|
4
|
+
export type InvoicesQuery = GetApiErpV1InvoicesData['query'];
|
|
5
|
+
/**
|
|
6
|
+
* Legacy PHP ERP bridge: customer master data sync and invoice reads.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCustomersResource(client: Client): {
|
|
9
|
+
/**
|
|
10
|
+
* Read the customer list through the legacy ERP backend bridge.
|
|
11
|
+
*/
|
|
12
|
+
list(): Promise<GetApiErpV1CustomersResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Create or update customer data via the legacy ERP backend bridge.
|
|
15
|
+
*
|
|
16
|
+
* The endpoint takes a raw string body (no JSON wrapping).
|
|
17
|
+
*/
|
|
18
|
+
upsert(body: UpsertCustomersBody): Promise<PostApiErpV1CustomersResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Read invoices for the given customer from the legacy ERP backend.
|
|
21
|
+
*/
|
|
22
|
+
invoices(query?: InvoicesQuery): Promise<GetApiErpV1InvoicesResponse>;
|
|
23
|
+
};
|
|
24
|
+
export type CustomersResource = ReturnType<typeof createCustomersResource>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1CompaniesDepartmentsResponse, GetApiErpV1DepartmentsDepartmentIdEmployeesResponse } from '../../generated/types.gen';
|
|
3
|
+
/**
|
|
4
|
+
* Departments (Abteilungen): company-wide list plus the employees assigned
|
|
5
|
+
* to a single department.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createDepartmentsResource(client: Client): {
|
|
8
|
+
/**
|
|
9
|
+
* List the company departments configured in TANSS.
|
|
10
|
+
*/
|
|
11
|
+
list(): Promise<GetApiErpV1CompaniesDepartmentsResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* List all employees of the given department.
|
|
14
|
+
*/
|
|
15
|
+
employees(departmentId: number): Promise<GetApiErpV1DepartmentsDepartmentIdEmployeesResponse>;
|
|
16
|
+
};
|
|
17
|
+
export type DepartmentsResource = ReturnType<typeof createDepartmentsResource>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1EmployeesEmployeeIdDepartmentsResponse, GetApiErpV1EmployeesIdResponse, PostApiErpV1EmployeesData, PostApiErpV1EmployeesResponse, PutApiErpV1EmployeesIdData, PutApiErpV1EmployeesIdResponse } from '../../generated/types.gen';
|
|
3
|
+
export type CreateEmployeeBody = PostApiErpV1EmployeesData['body'];
|
|
4
|
+
export type UpdateEmployeeBody = PutApiErpV1EmployeesIdData['body'];
|
|
5
|
+
/**
|
|
6
|
+
* Employee master data: CRUD plus the departments an employee belongs to.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createEmployeesResource(client: Client): {
|
|
9
|
+
/**
|
|
10
|
+
* Create a new employee record from the ERP payload.
|
|
11
|
+
*/
|
|
12
|
+
create(body: CreateEmployeeBody): Promise<PostApiErpV1EmployeesResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Read the single employee record identified by `id`.
|
|
15
|
+
*/
|
|
16
|
+
get(id: number): Promise<GetApiErpV1EmployeesIdResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Update the employee record identified by `id`.
|
|
19
|
+
*/
|
|
20
|
+
update(id: number, body: UpdateEmployeeBody): Promise<PutApiErpV1EmployeesIdResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* List all departments associated with the given employee.
|
|
23
|
+
*/
|
|
24
|
+
departments(employeeId: number): Promise<GetApiErpV1EmployeesEmployeeIdDepartmentsResponse>;
|
|
25
|
+
};
|
|
26
|
+
export type EmployeesResource = ReturnType<typeof createEmployeesResource>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { DeleteApiV1OffersErpSelectionsErpSelectionIdResponse, GetApiV1OffersErpSelectionsErpSelectionIdResponse, GetApiV1OffersErpSelectionsMatPickerData, GetApiV1OffersErpSelectionsMatPickerErpSelectionIdResponse, GetApiV1OffersErpSelectionsMatPickerResponse, PostApiV1OffersErpSelectionsData, PostApiV1OffersErpSelectionsResponse, PutApiV1OffersErpSelectionsErpSelectionIdData, PutApiV1OffersErpSelectionsErpSelectionIdResponse } from '../../generated/types.gen';
|
|
3
|
+
export type CreateErpSelectionBody = PostApiV1OffersErpSelectionsData['body'];
|
|
4
|
+
export type UpdateErpSelectionBody = PutApiV1OffersErpSelectionsErpSelectionIdData['body'];
|
|
5
|
+
export type MatPickerQuery = GetApiV1OffersErpSelectionsMatPickerData['query'];
|
|
6
|
+
/**
|
|
7
|
+
* Offer ERP selections (`/api/v1/offers/erpSelections*`): material
|
|
8
|
+
* selections used in offer templates.
|
|
9
|
+
*
|
|
10
|
+
* Note: unlike `/api/erp/v1/...`, these routes authenticate with a normal
|
|
11
|
+
* user session token (`ApiTokenAuth`), not the ERP-role token. Pass a user
|
|
12
|
+
* token to `createErpClient` when using this resource.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createOffersResource(client: Client): {
|
|
15
|
+
/**
|
|
16
|
+
* Create a new ERP selection including its materials.
|
|
17
|
+
*/
|
|
18
|
+
create(body: CreateErpSelectionBody): Promise<PostApiV1OffersErpSelectionsResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Fetch an ERP selection (including material) by id.
|
|
21
|
+
*/
|
|
22
|
+
get(erpSelectionId: number): Promise<GetApiV1OffersErpSelectionsErpSelectionIdResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Update an ERP selection and save all attached materials.
|
|
25
|
+
*/
|
|
26
|
+
update(erpSelectionId: number, body: UpdateErpSelectionBody): Promise<PutApiV1OffersErpSelectionsErpSelectionIdResponse>;
|
|
27
|
+
/**
|
|
28
|
+
* Delete an ERP selection.
|
|
29
|
+
*/
|
|
30
|
+
remove(erpSelectionId: number): Promise<DeleteApiV1OffersErpSelectionsErpSelectionIdResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* List materials for the "material picker".
|
|
33
|
+
*/
|
|
34
|
+
matPicker(query: MatPickerQuery): Promise<GetApiV1OffersErpSelectionsMatPickerResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* List materials of the picker scoped to a given ERP selection.
|
|
37
|
+
*/
|
|
38
|
+
matPickerBySelection(erpSelectionId: number): Promise<GetApiV1OffersErpSelectionsMatPickerErpSelectionIdResponse>;
|
|
39
|
+
};
|
|
40
|
+
export type OffersResource = ReturnType<typeof createOffersResource>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Client } from '../../generated/client/types.gen';
|
|
2
|
+
import type { GetApiErpV1TicketsStatusResponse, GetApiErpV1TicketsTypesResponse, PostApiErpV1TicketsData, PostApiErpV1TicketsResponse, PostApiErpV1TicketsTicketIdUploadData, PostApiErpV1TicketsTicketIdUploadResponse } from '../../generated/types.gen';
|
|
3
|
+
export type CreateErpTicketBody = PostApiErpV1TicketsData['body'];
|
|
4
|
+
export type UploadTicketFileBody = NonNullable<PostApiErpV1TicketsTicketIdUploadData['body']>;
|
|
5
|
+
/**
|
|
6
|
+
* Tickets as seen by ERP integrations: create tickets, resolve status/type
|
|
7
|
+
* mappings, and upload documents or images into a ticket.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createTicketsResource(client: Client): {
|
|
10
|
+
/**
|
|
11
|
+
* Create a new ticket in the database.
|
|
12
|
+
*/
|
|
13
|
+
create(body: CreateErpTicketBody): Promise<PostApiErpV1TicketsResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* List all ticket states configured in TANSS (for status mapping).
|
|
16
|
+
*/
|
|
17
|
+
statuses(): Promise<GetApiErpV1TicketsStatusResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* List all active ticket types configured in TANSS.
|
|
20
|
+
*/
|
|
21
|
+
types(): Promise<GetApiErpV1TicketsTypesResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Upload a document or image into the given ticket.
|
|
24
|
+
*/
|
|
25
|
+
upload(ticketId: number, files: UploadTicketFileBody): Promise<PostApiErpV1TicketsTicketIdUploadResponse>;
|
|
26
|
+
};
|
|
27
|
+
export type TicketsResource = ReturnType<typeof createTicketsResource>;
|
|
@@ -1069,7 +1069,7 @@ export type TnsPhoneNumberFoundItem = {
|
|
|
1069
1069
|
* * A company has the phone number 06154/6006-0
|
|
1070
1070
|
* * You search for a number 06154/6006-123
|
|
1071
1071
|
* * The system will try to replace the last 3 chars of the company, so that the number could be found as well,
|
|
1072
|
-
*
|
|
1072
|
+
* because 06154/6006-123 is an extension to 06154/6006-0
|
|
1073
1073
|
*
|
|
1074
1074
|
*/
|
|
1075
1075
|
charsLeftOut?: number;
|
package/dist/index.d.ts
CHANGED