@kommerz/ts-client 1.167.3 → 1.167.5
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/dist/models/AcceptancePortalSendConfigDto.d.ts +1 -1
- package/dist/models/AcceptancePortalSendConfigDto.js +1 -3
- package/dist/models/InternalWorkflowProcessLogDto.d.ts +6 -0
- package/dist/models/InternalWorkflowProcessLogDto.js +2 -0
- package/dist/models/InvoiceDto.d.ts +1 -1
- package/dist/models/InvoiceDto.js +1 -3
- package/dist/models/OfferDto.d.ts +4 -4
- package/dist/models/OfferDto.js +4 -12
- package/dist/models/TextModuleType.d.ts +2 -0
- package/dist/models/TextModuleType.js +3 -1
- package/dist/models/WorkflowProcessLogDto.d.ts +6 -0
- package/dist/models/WorkflowProcessLogDto.js +2 -0
- package/dist/src/context.d.ts +5 -0
- package/package.json +1 -1
- package/src/comm.ts +39 -39
- package/src/context.ts +28 -22
|
@@ -37,7 +37,7 @@ export interface AcceptancePortalSendConfigDto {
|
|
|
37
37
|
* @type {string}
|
|
38
38
|
* @memberof AcceptancePortalSendConfigDto
|
|
39
39
|
*/
|
|
40
|
-
designTemplateId
|
|
40
|
+
designTemplateId?: string;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Check if a given object implements the AcceptancePortalSendConfigDto interface.
|
|
@@ -21,8 +21,6 @@ exports.AcceptancePortalSendConfigDtoToJSONTyped = AcceptancePortalSendConfigDto
|
|
|
21
21
|
* Check if a given object implements the AcceptancePortalSendConfigDto interface.
|
|
22
22
|
*/
|
|
23
23
|
function instanceOfAcceptancePortalSendConfigDto(value) {
|
|
24
|
-
if (!('designTemplateId' in value) || value['designTemplateId'] === undefined)
|
|
25
|
-
return false;
|
|
26
24
|
return true;
|
|
27
25
|
}
|
|
28
26
|
function AcceptancePortalSendConfigDtoFromJSON(json) {
|
|
@@ -36,7 +34,7 @@ function AcceptancePortalSendConfigDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
36
34
|
'subject': json['subject'] == null ? undefined : json['subject'],
|
|
37
35
|
'bodyTemplate': json['bodyTemplate'] == null ? undefined : json['bodyTemplate'],
|
|
38
36
|
'contextMap': json['contextMap'] == null ? undefined : json['contextMap'],
|
|
39
|
-
'designTemplateId': json['designTemplateId'],
|
|
37
|
+
'designTemplateId': json['designTemplateId'] == null ? undefined : json['designTemplateId'],
|
|
40
38
|
};
|
|
41
39
|
}
|
|
42
40
|
function AcceptancePortalSendConfigDtoToJSON(json) {
|
|
@@ -26,6 +26,12 @@ export interface InternalWorkflowProcessLogDto {
|
|
|
26
26
|
* @memberof InternalWorkflowProcessLogDto
|
|
27
27
|
*/
|
|
28
28
|
message: string;
|
|
29
|
+
/**
|
|
30
|
+
* Name/Id of the activity that generated the log entry
|
|
31
|
+
* @type {string}
|
|
32
|
+
* @memberof InternalWorkflowProcessLogDto
|
|
33
|
+
*/
|
|
34
|
+
task?: string;
|
|
29
35
|
}
|
|
30
36
|
/**
|
|
31
37
|
* @export
|
|
@@ -47,6 +47,7 @@ function InternalWorkflowProcessLogDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
47
47
|
return {
|
|
48
48
|
'type': json['type'],
|
|
49
49
|
'message': json['message'],
|
|
50
|
+
'task': json['task'] == null ? undefined : json['task'],
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
function InternalWorkflowProcessLogDtoToJSON(json) {
|
|
@@ -60,5 +61,6 @@ function InternalWorkflowProcessLogDtoToJSONTyped(value, ignoreDiscriminator) {
|
|
|
60
61
|
return {
|
|
61
62
|
'type': value['type'],
|
|
62
63
|
'message': value['message'],
|
|
64
|
+
'task': value['task'],
|
|
63
65
|
};
|
|
64
66
|
}
|
|
@@ -29,8 +29,6 @@ var InvoiceType_1 = require("./InvoiceType");
|
|
|
29
29
|
function instanceOfInvoiceDto(value) {
|
|
30
30
|
if (!('daysOfGrace' in value) || value['daysOfGrace'] === undefined)
|
|
31
31
|
return false;
|
|
32
|
-
if (!('invoiceAddress' in value) || value['invoiceAddress'] === undefined)
|
|
33
|
-
return false;
|
|
34
32
|
if (!('deliveryEndDate' in value) || value['deliveryEndDate'] === undefined)
|
|
35
33
|
return false;
|
|
36
34
|
if (!('invoiceItems' in value) || value['invoiceItems'] === undefined)
|
|
@@ -53,7 +51,7 @@ function InvoiceDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
53
51
|
'daysOfGrace': json['daysOfGrace'],
|
|
54
52
|
'dueDate': json['dueDate'] == null ? undefined : json['dueDate'],
|
|
55
53
|
'invoiceEmail': json['invoiceEmail'] == null ? undefined : json['invoiceEmail'],
|
|
56
|
-
'invoiceAddress': (0, AddressDto_1.AddressDtoFromJSON)(json['invoiceAddress']),
|
|
54
|
+
'invoiceAddress': json['invoiceAddress'] == null ? undefined : (0, AddressDto_1.AddressDtoFromJSON)(json['invoiceAddress']),
|
|
57
55
|
'invoiceDate': json['invoiceDate'] == null ? undefined : json['invoiceDate'],
|
|
58
56
|
'deliveryStartDate': json['deliveryStartDate'] == null ? undefined : json['deliveryStartDate'],
|
|
59
57
|
'deliveryEndDate': json['deliveryEndDate'],
|
|
@@ -60,7 +60,7 @@ export interface OfferDto {
|
|
|
60
60
|
* @type {AddressDto}
|
|
61
61
|
* @memberof OfferDto
|
|
62
62
|
*/
|
|
63
|
-
offerAddress
|
|
63
|
+
offerAddress?: AddressDto;
|
|
64
64
|
/**
|
|
65
65
|
*
|
|
66
66
|
* @type {string}
|
|
@@ -78,7 +78,7 @@ export interface OfferDto {
|
|
|
78
78
|
* @type {string}
|
|
79
79
|
* @memberof OfferDto
|
|
80
80
|
*/
|
|
81
|
-
subject
|
|
81
|
+
subject?: string;
|
|
82
82
|
/**
|
|
83
83
|
*
|
|
84
84
|
* @type {string}
|
|
@@ -114,13 +114,13 @@ export interface OfferDto {
|
|
|
114
114
|
* @type {InvoiceTextFieldsDto}
|
|
115
115
|
* @memberof OfferDto
|
|
116
116
|
*/
|
|
117
|
-
textFields
|
|
117
|
+
textFields?: InvoiceTextFieldsDto;
|
|
118
118
|
/**
|
|
119
119
|
*
|
|
120
120
|
* @type {string}
|
|
121
121
|
* @memberof OfferDto
|
|
122
122
|
*/
|
|
123
|
-
designTemplateId
|
|
123
|
+
designTemplateId?: string;
|
|
124
124
|
/**
|
|
125
125
|
*
|
|
126
126
|
* @type {string}
|
package/dist/models/OfferDto.js
CHANGED
|
@@ -28,14 +28,6 @@ var InvoiceTaxItemDto_1 = require("./InvoiceTaxItemDto");
|
|
|
28
28
|
function instanceOfOfferDto(value) {
|
|
29
29
|
if (!('daysOfGrace' in value) || value['daysOfGrace'] === undefined)
|
|
30
30
|
return false;
|
|
31
|
-
if (!('offerAddress' in value) || value['offerAddress'] === undefined)
|
|
32
|
-
return false;
|
|
33
|
-
if (!('subject' in value) || value['subject'] === undefined)
|
|
34
|
-
return false;
|
|
35
|
-
if (!('textFields' in value) || value['textFields'] === undefined)
|
|
36
|
-
return false;
|
|
37
|
-
if (!('designTemplateId' in value) || value['designTemplateId'] === undefined)
|
|
38
|
-
return false;
|
|
39
31
|
return true;
|
|
40
32
|
}
|
|
41
33
|
function OfferDtoFromJSON(json) {
|
|
@@ -52,17 +44,17 @@ function OfferDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
52
44
|
'daysOfGrace': json['daysOfGrace'],
|
|
53
45
|
'dueDate': json['dueDate'] == null ? undefined : json['dueDate'],
|
|
54
46
|
'offerEmail': json['offerEmail'] == null ? undefined : json['offerEmail'],
|
|
55
|
-
'offerAddress': (0, AddressDto_1.AddressDtoFromJSON)(json['offerAddress']),
|
|
47
|
+
'offerAddress': json['offerAddress'] == null ? undefined : (0, AddressDto_1.AddressDtoFromJSON)(json['offerAddress']),
|
|
56
48
|
'offerDate': json['offerDate'] == null ? undefined : json['offerDate'],
|
|
57
49
|
'offerNumber': json['offerNumber'] == null ? undefined : json['offerNumber'],
|
|
58
|
-
'subject': json['subject'],
|
|
50
|
+
'subject': json['subject'] == null ? undefined : json['subject'],
|
|
59
51
|
'notes': json['notes'] == null ? undefined : json['notes'],
|
|
60
52
|
'total': json['total'] == null ? undefined : (0, AmountDto_1.AmountDtoFromJSON)(json['total']),
|
|
61
53
|
'customerId': json['customerId'] == null ? undefined : json['customerId'],
|
|
62
54
|
'offerItems': json['offerItems'] == null ? undefined : (json['offerItems'].map(InvoiceItemDto_1.InvoiceItemDtoFromJSON)),
|
|
63
55
|
'offerTaxItems': json['offerTaxItems'] == null ? undefined : (json['offerTaxItems'].map(InvoiceTaxItemDto_1.InvoiceTaxItemDtoFromJSON)),
|
|
64
|
-
'textFields': (0, InvoiceTextFieldsDto_1.InvoiceTextFieldsDtoFromJSON)(json['textFields']),
|
|
65
|
-
'designTemplateId': json['designTemplateId'],
|
|
56
|
+
'textFields': json['textFields'] == null ? undefined : (0, InvoiceTextFieldsDto_1.InvoiceTextFieldsDtoFromJSON)(json['textFields']),
|
|
57
|
+
'designTemplateId': json['designTemplateId'] == null ? undefined : json['designTemplateId'],
|
|
66
58
|
'fileId': json['fileId'] == null ? undefined : json['fileId'],
|
|
67
59
|
'showGross': json['showGross'] == null ? undefined : json['showGross'],
|
|
68
60
|
};
|
|
@@ -31,6 +31,8 @@ export declare const TextModuleType: {
|
|
|
31
31
|
readonly DunningLetterOutro: "DUNNING_LETTER_OUTRO";
|
|
32
32
|
readonly WritingSubject: "WRITING_SUBJECT";
|
|
33
33
|
readonly WritingBody: "WRITING_BODY";
|
|
34
|
+
readonly AcceptanceDocumentEmailSubject: "ACCEPTANCE_DOCUMENT_EMAIL_SUBJECT";
|
|
35
|
+
readonly AcceptanceDocumentEmailBody: "ACCEPTANCE_DOCUMENT_EMAIL_BODY";
|
|
34
36
|
};
|
|
35
37
|
export type TextModuleType = typeof TextModuleType[keyof typeof TextModuleType];
|
|
36
38
|
export declare function instanceOfTextModuleType(value: any): boolean;
|
|
@@ -40,7 +40,9 @@ exports.TextModuleType = {
|
|
|
40
40
|
DunningLetterIntro: 'DUNNING_LETTER_INTRO',
|
|
41
41
|
DunningLetterOutro: 'DUNNING_LETTER_OUTRO',
|
|
42
42
|
WritingSubject: 'WRITING_SUBJECT',
|
|
43
|
-
WritingBody: 'WRITING_BODY'
|
|
43
|
+
WritingBody: 'WRITING_BODY',
|
|
44
|
+
AcceptanceDocumentEmailSubject: 'ACCEPTANCE_DOCUMENT_EMAIL_SUBJECT',
|
|
45
|
+
AcceptanceDocumentEmailBody: 'ACCEPTANCE_DOCUMENT_EMAIL_BODY'
|
|
44
46
|
};
|
|
45
47
|
function instanceOfTextModuleType(value) {
|
|
46
48
|
for (var key in exports.TextModuleType) {
|
|
@@ -45,6 +45,12 @@ export interface WorkflowProcessLogDto {
|
|
|
45
45
|
* @memberof WorkflowProcessLogDto
|
|
46
46
|
*/
|
|
47
47
|
message: string;
|
|
48
|
+
/**
|
|
49
|
+
* Name/Id of the activity that generated the log entry
|
|
50
|
+
* @type {string}
|
|
51
|
+
* @memberof WorkflowProcessLogDto
|
|
52
|
+
*/
|
|
53
|
+
task?: string;
|
|
48
54
|
/**
|
|
49
55
|
*
|
|
50
56
|
* @type {Date}
|
|
@@ -47,6 +47,7 @@ function WorkflowProcessLogDtoFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
47
47
|
'workflowProcessId': json['workflowProcessId'],
|
|
48
48
|
'type': (0, WorkflowProcessLogType_1.WorkflowProcessLogTypeFromJSON)(json['type']),
|
|
49
49
|
'message': json['message'],
|
|
50
|
+
'task': json['task'] == null ? undefined : json['task'],
|
|
50
51
|
'creationTime': json['creationTime'] == null ? undefined : (new Date(json['creationTime'])),
|
|
51
52
|
};
|
|
52
53
|
}
|
|
@@ -64,6 +65,7 @@ function WorkflowProcessLogDtoToJSONTyped(value, ignoreDiscriminator) {
|
|
|
64
65
|
'workflowProcessId': value['workflowProcessId'],
|
|
65
66
|
'type': (0, WorkflowProcessLogType_1.WorkflowProcessLogTypeToJSON)(value['type']),
|
|
66
67
|
'message': value['message'],
|
|
68
|
+
'task': value['task'],
|
|
67
69
|
'creationTime': value['creationTime'] == null ? value['creationTime'] : value['creationTime'].toISOString(),
|
|
68
70
|
};
|
|
69
71
|
}
|
package/dist/src/context.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
export interface BusinessError {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
1
5
|
export interface Variables {
|
|
2
6
|
variables?: Record<string, unknown>;
|
|
7
|
+
error?: BusinessError;
|
|
3
8
|
}
|
|
4
9
|
export declare function getContext(): Record<string, unknown>;
|
|
5
10
|
export declare function returnResult(result: Variables): void;
|
package/package.json
CHANGED
package/src/comm.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Configuration, Middleware} from "../runtime";
|
|
2
2
|
|
|
3
3
|
export const backendConfig = new Configuration({
|
|
4
|
-
|
|
4
|
+
basePath: Deno.env.get("KOMMERZ_BASE_PATH") ?? "https://my.kommerz.app/api",
|
|
5
5
|
});
|
|
6
6
|
|
|
7
7
|
export const preMiddleware: Middleware["pre"] = (context) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
return Promise.resolve({
|
|
9
|
+
url: context.url,
|
|
10
|
+
init: {
|
|
11
|
+
...context.init,
|
|
12
|
+
headers: {
|
|
13
|
+
...context.init.headers,
|
|
14
|
+
"X-API-Token": Deno.env.get("ACCESS_TOKEN") ?? "",
|
|
15
|
+
"X-KOMMERZ-TRANSACTION-ID": Deno.env.get("TRANSACTION_ID") ?? "",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const errorMiddleware: Middleware["onError"] = (context) => {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
console.error(context.error);
|
|
23
|
+
return Promise.resolve();
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export const postMiddleware: Middleware["post"] = (context) => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const response = context.response;
|
|
28
|
+
const status = response.status;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
if (!(status >= 200 && status < 300)) {
|
|
31
|
+
return response
|
|
32
|
+
.text()
|
|
33
|
+
.catch(() => undefined)
|
|
34
|
+
.then((body) => {
|
|
35
|
+
console.error(
|
|
36
|
+
`Request to <${response.url}> failed with http status <${response.status}>`,
|
|
37
|
+
body,
|
|
38
|
+
);
|
|
39
|
+
})
|
|
40
|
+
.then(() => response);
|
|
41
|
+
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
return Promise.resolve(response);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export const middlewares: Middleware[] = [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
{
|
|
48
|
+
pre: preMiddleware,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
onError: errorMiddleware,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
post: postMiddleware,
|
|
55
|
+
},
|
|
56
56
|
];
|
package/src/context.ts
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
|
+
export interface BusinessError {
|
|
2
|
+
code: string;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
export interface Variables {
|
|
2
|
-
|
|
7
|
+
variables?: Record<string, unknown>;
|
|
8
|
+
error?: BusinessError
|
|
3
9
|
}
|
|
4
10
|
|
|
5
11
|
export function getContext(): Record<string, unknown> {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
const ctxFile = Deno.env.get("CONTEXT_FILE") ?? "";
|
|
13
|
+
if (ctxFile === "") {
|
|
14
|
+
console.error("did not get context file");
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
11
17
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(Deno.readTextFileSync(ctxFile));
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.error("Error reading context file", e);
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
export function returnResult(result: Variables): void {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const outFile = Deno.env.get("OUTPUT_FILE") ?? "";
|
|
28
|
+
if (outFile === "") {
|
|
29
|
+
console.error("did not get output filename to store result", result);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
26
32
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
try {
|
|
34
|
+
Deno.writeTextFileSync(outFile, JSON.stringify(result));
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error("Error writing output file", e);
|
|
37
|
+
}
|
|
32
38
|
}
|