noxctl 0.7.4 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -4
- package/dist/auth.d.ts +18 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +129 -15
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +144 -33
- package/dist/cli.js.map +1 -1
- package/dist/credentials-store.d.ts +3 -0
- package/dist/credentials-store.d.ts.map +1 -1
- package/dist/credentials-store.js +54 -10
- package/dist/credentials-store.js.map +1 -1
- package/dist/embedded.d.ts +15 -0
- package/dist/embedded.d.ts.map +1 -0
- package/dist/embedded.js +11 -0
- package/dist/embedded.js.map +1 -0
- package/dist/fortnox-client.d.ts +40 -25
- package/dist/fortnox-client.d.ts.map +1 -1
- package/dist/fortnox-client.js +165 -51
- package/dist/fortnox-client.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -35
- package/dist/index.js.map +1 -1
- package/dist/keychain-target.d.ts +3 -0
- package/dist/keychain-target.d.ts.map +1 -1
- package/dist/keychain-target.js +28 -7
- package/dist/keychain-target.js.map +1 -1
- package/dist/operations/absencetransactions.d.ts +9 -6
- package/dist/operations/absencetransactions.d.ts.map +1 -1
- package/dist/operations/absencetransactions.js +42 -33
- package/dist/operations/absencetransactions.js.map +1 -1
- package/dist/operations/accounts.d.ts +6 -3
- package/dist/operations/accounts.d.ts.map +1 -1
- package/dist/operations/accounts.js +28 -24
- package/dist/operations/accounts.js.map +1 -1
- package/dist/operations/analytics.d.ts +35 -0
- package/dist/operations/analytics.d.ts.map +1 -1
- package/dist/operations/analytics.js +59 -35
- package/dist/operations/analytics.js.map +1 -1
- package/dist/operations/articles.d.ts +9 -6
- package/dist/operations/articles.d.ts.map +1 -1
- package/dist/operations/articles.js +36 -32
- package/dist/operations/articles.js.map +1 -1
- package/dist/operations/attendancetransactions.d.ts +9 -6
- package/dist/operations/attendancetransactions.d.ts.map +1 -1
- package/dist/operations/attendancetransactions.js +45 -36
- package/dist/operations/attendancetransactions.js.map +1 -1
- package/dist/operations/company.d.ts +5 -1
- package/dist/operations/company.d.ts.map +1 -1
- package/dist/operations/company.js +8 -4
- package/dist/operations/company.js.map +1 -1
- package/dist/operations/contracts.d.ts +12 -9
- package/dist/operations/contracts.d.ts.map +1 -1
- package/dist/operations/contracts.js +59 -47
- package/dist/operations/contracts.js.map +1 -1
- package/dist/operations/costcenters.d.ts +10 -7
- package/dist/operations/costcenters.d.ts.map +1 -1
- package/dist/operations/costcenters.js +39 -35
- package/dist/operations/costcenters.js.map +1 -1
- package/dist/operations/customers.d.ts +9 -6
- package/dist/operations/customers.d.ts.map +1 -1
- package/dist/operations/customers.js +46 -42
- package/dist/operations/customers.js.map +1 -1
- package/dist/operations/employees.d.ts +9 -6
- package/dist/operations/employees.d.ts.map +1 -1
- package/dist/operations/employees.js +35 -31
- package/dist/operations/employees.js.map +1 -1
- package/dist/operations/financial-reports.d.ts +7 -2
- package/dist/operations/financial-reports.d.ts.map +1 -1
- package/dist/operations/financial-reports.js +169 -165
- package/dist/operations/financial-reports.js.map +1 -1
- package/dist/operations/financial-years.d.ts +8 -5
- package/dist/operations/financial-years.d.ts.map +1 -1
- package/dist/operations/financial-years.js +33 -29
- package/dist/operations/financial-years.js.map +1 -1
- package/dist/operations/index.d.ts +311 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +64 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/operations/invoice-payments.d.ts +10 -7
- package/dist/operations/invoice-payments.d.ts.map +1 -1
- package/dist/operations/invoice-payments.js +45 -35
- package/dist/operations/invoice-payments.js.map +1 -1
- package/dist/operations/invoices.d.ts +34 -30
- package/dist/operations/invoices.d.ts.map +1 -1
- package/dist/operations/invoices.js +225 -113
- package/dist/operations/invoices.js.map +1 -1
- package/dist/operations/offers.d.ts +11 -8
- package/dist/operations/offers.d.ts.map +1 -1
- package/dist/operations/offers.js +54 -43
- package/dist/operations/offers.js.map +1 -1
- package/dist/operations/orders.d.ts +10 -7
- package/dist/operations/orders.d.ts.map +1 -1
- package/dist/operations/orders.js +43 -39
- package/dist/operations/orders.js.map +1 -1
- package/dist/operations/pricelists.d.ts +16 -10
- package/dist/operations/pricelists.d.ts.map +1 -1
- package/dist/operations/pricelists.js +56 -48
- package/dist/operations/pricelists.js.map +1 -1
- package/dist/operations/projects.d.ts +9 -6
- package/dist/operations/projects.d.ts.map +1 -1
- package/dist/operations/projects.js +34 -30
- package/dist/operations/projects.js.map +1 -1
- package/dist/operations/recurrings.d.ts +14 -10
- package/dist/operations/recurrings.d.ts.map +1 -1
- package/dist/operations/recurrings.js +74 -59
- package/dist/operations/recurrings.js.map +1 -1
- package/dist/operations/salarytransactions.d.ts +9 -6
- package/dist/operations/salarytransactions.d.ts.map +1 -1
- package/dist/operations/salarytransactions.js +41 -32
- package/dist/operations/salarytransactions.js.map +1 -1
- package/dist/operations/scheduletimes.d.ts +7 -3
- package/dist/operations/scheduletimes.d.ts.map +1 -1
- package/dist/operations/scheduletimes.js +26 -22
- package/dist/operations/scheduletimes.js.map +1 -1
- package/dist/operations/supplier-invoice-payments.d.ts +9 -6
- package/dist/operations/supplier-invoice-payments.d.ts.map +1 -1
- package/dist/operations/supplier-invoice-payments.js +38 -29
- package/dist/operations/supplier-invoice-payments.js.map +1 -1
- package/dist/operations/supplier-invoices.d.ts +9 -6
- package/dist/operations/supplier-invoices.d.ts.map +1 -1
- package/dist/operations/supplier-invoices.js +41 -32
- package/dist/operations/supplier-invoices.js.map +1 -1
- package/dist/operations/suppliers.d.ts +9 -6
- package/dist/operations/suppliers.d.ts.map +1 -1
- package/dist/operations/suppliers.js +36 -32
- package/dist/operations/suppliers.js.map +1 -1
- package/dist/operations/tax.d.ts +5 -1
- package/dist/operations/tax.d.ts.map +1 -1
- package/dist/operations/tax.js +43 -39
- package/dist/operations/tax.js.map +1 -1
- package/dist/operations/taxreductions.d.ts +8 -5
- package/dist/operations/taxreductions.d.ts.map +1 -1
- package/dist/operations/taxreductions.js +28 -24
- package/dist/operations/taxreductions.js.map +1 -1
- package/dist/operations/vouchers.d.ts +26 -8
- package/dist/operations/vouchers.d.ts.map +1 -1
- package/dist/operations/vouchers.js +174 -122
- package/dist/operations/vouchers.js.map +1 -1
- package/dist/schema-audit-mappings.d.ts +9 -0
- package/dist/schema-audit-mappings.d.ts.map +1 -0
- package/dist/schema-audit-mappings.js +45 -0
- package/dist/schema-audit-mappings.js.map +1 -0
- package/dist/schema-audit.d.ts +45 -0
- package/dist/schema-audit.d.ts.map +1 -0
- package/dist/schema-audit.js +132 -0
- package/dist/schema-audit.js.map +1 -0
- package/dist/scope-probes.d.ts.map +1 -1
- package/dist/scope-probes.js +1 -0
- package/dist/scope-probes.js.map +1 -1
- package/dist/strict-mcp-server.d.ts +17 -0
- package/dist/strict-mcp-server.d.ts.map +1 -0
- package/dist/strict-mcp-server.js +35 -0
- package/dist/strict-mcp-server.js.map +1 -0
- package/dist/tools/absencetransactions.d.ts +2 -1
- package/dist/tools/absencetransactions.d.ts.map +1 -1
- package/dist/tools/absencetransactions.js +3 -2
- package/dist/tools/absencetransactions.js.map +1 -1
- package/dist/tools/analytics.d.ts +2 -1
- package/dist/tools/analytics.d.ts.map +1 -1
- package/dist/tools/analytics.js +3 -2
- package/dist/tools/analytics.js.map +1 -1
- package/dist/tools/articles.d.ts +2 -1
- package/dist/tools/articles.d.ts.map +1 -1
- package/dist/tools/articles.js +3 -2
- package/dist/tools/articles.js.map +1 -1
- package/dist/tools/attendancetransactions.d.ts +2 -1
- package/dist/tools/attendancetransactions.d.ts.map +1 -1
- package/dist/tools/attendancetransactions.js +3 -2
- package/dist/tools/attendancetransactions.js.map +1 -1
- package/dist/tools/bookkeeping.d.ts +2 -1
- package/dist/tools/bookkeeping.d.ts.map +1 -1
- package/dist/tools/bookkeeping.js +83 -5
- package/dist/tools/bookkeeping.js.map +1 -1
- package/dist/tools/company.d.ts +2 -1
- package/dist/tools/company.d.ts.map +1 -1
- package/dist/tools/company.js +3 -2
- package/dist/tools/company.js.map +1 -1
- package/dist/tools/contracts.d.ts +2 -1
- package/dist/tools/contracts.d.ts.map +1 -1
- package/dist/tools/contracts.js +3 -2
- package/dist/tools/contracts.js.map +1 -1
- package/dist/tools/costcenters.d.ts +2 -1
- package/dist/tools/costcenters.d.ts.map +1 -1
- package/dist/tools/costcenters.js +3 -2
- package/dist/tools/costcenters.js.map +1 -1
- package/dist/tools/customers.d.ts +2 -1
- package/dist/tools/customers.d.ts.map +1 -1
- package/dist/tools/customers.js +3 -2
- package/dist/tools/customers.js.map +1 -1
- package/dist/tools/employees.d.ts +2 -1
- package/dist/tools/employees.d.ts.map +1 -1
- package/dist/tools/employees.js +3 -2
- package/dist/tools/employees.js.map +1 -1
- package/dist/tools/financial-reports.d.ts +2 -1
- package/dist/tools/financial-reports.d.ts.map +1 -1
- package/dist/tools/financial-reports.js +3 -2
- package/dist/tools/financial-reports.js.map +1 -1
- package/dist/tools/financial-years.d.ts +2 -1
- package/dist/tools/financial-years.d.ts.map +1 -1
- package/dist/tools/financial-years.js +3 -2
- package/dist/tools/financial-years.js.map +1 -1
- package/dist/tools/invoice-payments.d.ts +2 -1
- package/dist/tools/invoice-payments.d.ts.map +1 -1
- package/dist/tools/invoice-payments.js +3 -2
- package/dist/tools/invoice-payments.js.map +1 -1
- package/dist/tools/invoices.d.ts +2 -1
- package/dist/tools/invoices.d.ts.map +1 -1
- package/dist/tools/invoices.js +100 -21
- package/dist/tools/invoices.js.map +1 -1
- package/dist/tools/offers.d.ts +2 -1
- package/dist/tools/offers.d.ts.map +1 -1
- package/dist/tools/offers.js +50 -19
- package/dist/tools/offers.js.map +1 -1
- package/dist/tools/orders.d.ts +2 -1
- package/dist/tools/orders.d.ts.map +1 -1
- package/dist/tools/orders.js +58 -18
- package/dist/tools/orders.js.map +1 -1
- package/dist/tools/pricelists.d.ts +2 -1
- package/dist/tools/pricelists.d.ts.map +1 -1
- package/dist/tools/pricelists.js +3 -2
- package/dist/tools/pricelists.js.map +1 -1
- package/dist/tools/projects.d.ts +2 -1
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +3 -2
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/recurrings.d.ts +2 -1
- package/dist/tools/recurrings.d.ts.map +1 -1
- package/dist/tools/recurrings.js +3 -2
- package/dist/tools/recurrings.js.map +1 -1
- package/dist/tools/salarytransactions.d.ts +2 -1
- package/dist/tools/salarytransactions.d.ts.map +1 -1
- package/dist/tools/salarytransactions.js +3 -2
- package/dist/tools/salarytransactions.js.map +1 -1
- package/dist/tools/scheduletimes.d.ts +2 -1
- package/dist/tools/scheduletimes.d.ts.map +1 -1
- package/dist/tools/scheduletimes.js +3 -2
- package/dist/tools/scheduletimes.js.map +1 -1
- package/dist/tools/status.d.ts.map +1 -1
- package/dist/tools/status.js +5 -4
- package/dist/tools/status.js.map +1 -1
- package/dist/tools/supplier-invoice-payments.d.ts +2 -1
- package/dist/tools/supplier-invoice-payments.d.ts.map +1 -1
- package/dist/tools/supplier-invoice-payments.js +3 -2
- package/dist/tools/supplier-invoice-payments.js.map +1 -1
- package/dist/tools/supplier-invoices.d.ts +2 -1
- package/dist/tools/supplier-invoices.d.ts.map +1 -1
- package/dist/tools/supplier-invoices.js +47 -6
- package/dist/tools/supplier-invoices.js.map +1 -1
- package/dist/tools/suppliers.d.ts +2 -1
- package/dist/tools/suppliers.d.ts.map +1 -1
- package/dist/tools/suppliers.js +3 -2
- package/dist/tools/suppliers.js.map +1 -1
- package/dist/tools/tax.d.ts +2 -1
- package/dist/tools/tax.d.ts.map +1 -1
- package/dist/tools/tax.js +3 -2
- package/dist/tools/tax.js.map +1 -1
- package/dist/tools/taxreductions.d.ts +2 -1
- package/dist/tools/taxreductions.d.ts.map +1 -1
- package/dist/tools/taxreductions.js +3 -2
- package/dist/tools/taxreductions.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/dist/views.d.ts +2 -0
- package/dist/views.d.ts.map +1 -1
- package/dist/views.js +11 -0
- package/dist/views.js.map +1 -1
- package/docs/embedded.md +60 -0
- package/package.json +23 -4
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type FortnoxTransport } from '../fortnox-client.js';
|
|
2
|
+
export interface InvoicesResponse {
|
|
2
3
|
Invoices: Record<string, unknown>[];
|
|
3
4
|
MetaInformation?: {
|
|
4
5
|
'@TotalResources': number;
|
|
@@ -15,27 +16,12 @@ export interface ListInvoicesParams {
|
|
|
15
16
|
limit?: number;
|
|
16
17
|
all?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export declare function listInvoices(params?: ListInvoicesParams): Promise<InvoicesResponse>;
|
|
19
|
-
export declare function getInvoice(documentNumber: string): Promise<Record<string, unknown>>;
|
|
20
|
-
export declare function createInvoice(params: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
21
|
-
export declare function updateInvoice(documentNumber: string, fields: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
22
19
|
export type SendMethod = 'email' | 'print' | 'einvoice';
|
|
23
20
|
export interface SendEmailOptions {
|
|
24
21
|
subject?: string;
|
|
25
22
|
body?: string;
|
|
26
23
|
bcc?: string;
|
|
27
24
|
}
|
|
28
|
-
export declare function sendInvoice(documentNumber: string, method?: SendMethod, emailOptions?: SendEmailOptions): Promise<Record<string, unknown>>;
|
|
29
|
-
/**
|
|
30
|
-
* Fetch an invoice as a PDF. Always uses /preview, which returns the same
|
|
31
|
-
* document as /print but leaves the invoice untouched.
|
|
32
|
-
*
|
|
33
|
-
* Marking the invoice as sent is deliberately NOT folded in here: callers that
|
|
34
|
-
* want both run this first, write the bytes out, and only then call
|
|
35
|
-
* `markInvoicePrinted`. Doing it the other way round means a full disk or a bad
|
|
36
|
-
* path leaves an invoice flagged as sent with no PDF to show for it.
|
|
37
|
-
*/
|
|
38
|
-
export declare function getInvoicePdf(documentNumber: string): Promise<Buffer>;
|
|
39
25
|
export interface MarkInvoicePrintedResult {
|
|
40
26
|
/** The invoice's state after printing. */
|
|
41
27
|
invoice: Record<string, unknown>;
|
|
@@ -53,18 +39,36 @@ export interface MarkInvoicePrintedResult {
|
|
|
53
39
|
*/
|
|
54
40
|
pdf?: Buffer;
|
|
55
41
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
export
|
|
69
|
-
|
|
42
|
+
export interface InvoiceAttachment {
|
|
43
|
+
id: string;
|
|
44
|
+
entityId: number;
|
|
45
|
+
entityType: 'F';
|
|
46
|
+
fileId: string;
|
|
47
|
+
includeOnSend: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface AttachInvoiceFilesParams {
|
|
50
|
+
documentNumber: string;
|
|
51
|
+
filePaths: string[];
|
|
52
|
+
includeOnSend?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface AttachInvoiceFileResult {
|
|
55
|
+
fileName: string;
|
|
56
|
+
fileId: string;
|
|
57
|
+
attachmentId: string;
|
|
58
|
+
includeOnSend: boolean;
|
|
59
|
+
}
|
|
60
|
+
export declare function createInvoiceOperations(transport: FortnoxTransport): {
|
|
61
|
+
listInvoices: (params?: ListInvoicesParams) => Promise<InvoicesResponse>;
|
|
62
|
+
getInvoice: (documentNumber: string) => Promise<Record<string, unknown>>;
|
|
63
|
+
createInvoice: (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
64
|
+
updateInvoice: (documentNumber: string, fields: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
65
|
+
sendInvoice: (documentNumber: string, method?: SendMethod, emailOptions?: SendEmailOptions) => Promise<Record<string, unknown>>;
|
|
66
|
+
getInvoicePdf: (documentNumber: string) => Promise<Buffer>;
|
|
67
|
+
markInvoicePrinted: (documentNumber: string) => Promise<MarkInvoicePrintedResult>;
|
|
68
|
+
bookkeepInvoice: (documentNumber: string) => Promise<Record<string, unknown>>;
|
|
69
|
+
creditInvoice: (documentNumber: string) => Promise<Record<string, unknown>>;
|
|
70
|
+
attachInvoiceFiles: (params: AttachInvoiceFilesParams) => Promise<AttachInvoiceFileResult[]>;
|
|
71
|
+
listInvoiceAttachments: (documentNumber: string) => Promise<InvoiceAttachment[]>;
|
|
72
|
+
};
|
|
73
|
+
export declare const listInvoices: (params?: ListInvoicesParams) => Promise<InvoicesResponse>, getInvoice: (documentNumber: string) => Promise<Record<string, unknown>>, createInvoice: (params: Record<string, unknown>) => Promise<Record<string, unknown>>, updateInvoice: (documentNumber: string, fields: Record<string, unknown>) => Promise<Record<string, unknown>>, sendInvoice: (documentNumber: string, method?: SendMethod, emailOptions?: SendEmailOptions) => Promise<Record<string, unknown>>, getInvoicePdf: (documentNumber: string) => Promise<Buffer>, markInvoicePrinted: (documentNumber: string) => Promise<MarkInvoicePrintedResult>, bookkeepInvoice: (documentNumber: string) => Promise<Record<string, unknown>>, creditInvoice: (documentNumber: string) => Promise<Record<string, unknown>>, attachInvoiceFiles: (params: AttachInvoiceFilesParams) => Promise<AttachInvoiceFileResult[]>, listInvoiceAttachments: (documentNumber: string) => Promise<InvoiceAttachment[]>;
|
|
70
74
|
//# sourceMappingURL=invoices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../../src/operations/invoices.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../../src/operations/invoices.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAOtF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE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UACd,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAmQnC,WAAW,mBAtPO,MAAM,WACd,UAAU,iBACH,gBAAgB,KAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAoPnC,aAAa,mBAvMgC,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,EAwMrE,kBAAkB,mBA1LgC,MAAM,KAAG,OAAO,CAAC,wBAAwB,CAAC,EA2L5F,eAAe,mBAlKgC,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAmKxF,aAAa,mBAzJgC,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EA0JtF,kBAAkB,WA1DR,wBAAwB,KAC/B,OAAO,CAAC,uBAAuB,EAAE,CAAC,EA0DrC,sBAAsB,mBAtFgC,MAAM,KAAG,OAAO,CAAC,iBAAiB,EAAE,CAuFxC,CAAC"}
|
|
@@ -1,125 +1,237 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { basename, extname } from 'node:path';
|
|
3
|
+
import { defaultFortnoxTransport } from '../fortnox-client.js';
|
|
2
4
|
import { documentSegment } from '../identifiers.js';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (params.all) {
|
|
11
|
-
const { items, totalResources } = await fetchAllPages('invoices', 'Invoices', queryParams);
|
|
12
|
-
return {
|
|
13
|
-
Invoices: items,
|
|
14
|
-
MetaInformation: { '@TotalResources': totalResources, '@TotalPages': 1, '@CurrentPage': 1 },
|
|
5
|
+
export function createInvoiceOperations(transport) {
|
|
6
|
+
async function listInvoices(params = {}) {
|
|
7
|
+
const queryParams = {
|
|
8
|
+
filter: params.filter,
|
|
9
|
+
customernumber: params.customerNumber,
|
|
10
|
+
fromdate: params.fromDate,
|
|
11
|
+
todate: params.toDate,
|
|
15
12
|
};
|
|
13
|
+
if (params.all) {
|
|
14
|
+
const { items, totalResources } = await transport.fetchAllPages('invoices', 'Invoices', queryParams);
|
|
15
|
+
return {
|
|
16
|
+
Invoices: items,
|
|
17
|
+
MetaInformation: { '@TotalResources': totalResources, '@TotalPages': 1, '@CurrentPage': 1 },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return transport.request('invoices', {
|
|
21
|
+
params: { ...queryParams, page: params.page || 1, limit: params.limit || 100 },
|
|
22
|
+
});
|
|
16
23
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
export async function updateInvoice(documentNumber, fields) {
|
|
33
|
-
const { documentNumber: _, ...body } = fields;
|
|
34
|
-
const data = await fortnoxRequest(`invoices/${documentSegment(documentNumber)}`, {
|
|
35
|
-
method: 'PUT',
|
|
36
|
-
body: { Invoice: body },
|
|
37
|
-
});
|
|
38
|
-
return data.Invoice;
|
|
39
|
-
}
|
|
40
|
-
export async function sendInvoice(documentNumber, method = 'email', emailOptions) {
|
|
41
|
-
const documentId = documentSegment(documentNumber);
|
|
42
|
-
// Update EmailInformation before sending if any email options are provided
|
|
43
|
-
if (emailOptions && (emailOptions.subject || emailOptions.body || emailOptions.bcc)) {
|
|
44
|
-
const current = await fortnoxRequest(`invoices/${documentId}`);
|
|
45
|
-
const existing = current.Invoice?.EmailInformation || {};
|
|
46
|
-
const emailInfo = { ...existing };
|
|
47
|
-
if (emailOptions.subject)
|
|
48
|
-
emailInfo.EmailSubject = emailOptions.subject;
|
|
49
|
-
if (emailOptions.body)
|
|
50
|
-
emailInfo.EmailBody = emailOptions.body;
|
|
51
|
-
if (emailOptions.bcc)
|
|
52
|
-
emailInfo.EmailAddressBCC = emailOptions.bcc;
|
|
53
|
-
await fortnoxRequest(`invoices/${documentId}`, {
|
|
24
|
+
async function getInvoice(documentNumber) {
|
|
25
|
+
const data = await transport.request(`invoices/${documentSegment(documentNumber)}`);
|
|
26
|
+
return data.Invoice;
|
|
27
|
+
}
|
|
28
|
+
async function createInvoice(params) {
|
|
29
|
+
const data = await transport.request('invoices', {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
body: { Invoice: params },
|
|
32
|
+
});
|
|
33
|
+
return data.Invoice;
|
|
34
|
+
}
|
|
35
|
+
async function updateInvoice(documentNumber, fields) {
|
|
36
|
+
const { documentNumber: _, ...body } = fields;
|
|
37
|
+
const data = await transport.request(`invoices/${documentSegment(documentNumber)}`, {
|
|
54
38
|
method: 'PUT',
|
|
55
|
-
body: { Invoice:
|
|
39
|
+
body: { Invoice: body },
|
|
56
40
|
});
|
|
41
|
+
return data.Invoice;
|
|
57
42
|
}
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
async function sendInvoice(documentNumber, method = 'email', emailOptions) {
|
|
44
|
+
const documentId = documentSegment(documentNumber);
|
|
45
|
+
// Update EmailInformation before sending if any email options are provided
|
|
46
|
+
if (emailOptions && (emailOptions.subject || emailOptions.body || emailOptions.bcc)) {
|
|
47
|
+
const current = await transport.request(`invoices/${documentId}`);
|
|
48
|
+
const existing = current.Invoice?.EmailInformation || {};
|
|
49
|
+
const emailInfo = { ...existing };
|
|
50
|
+
if (emailOptions.subject)
|
|
51
|
+
emailInfo.EmailSubject = emailOptions.subject;
|
|
52
|
+
if (emailOptions.body)
|
|
53
|
+
emailInfo.EmailBody = emailOptions.body;
|
|
54
|
+
if (emailOptions.bcc)
|
|
55
|
+
emailInfo.EmailAddressBCC = emailOptions.bcc;
|
|
56
|
+
await transport.request(`invoices/${documentId}`, {
|
|
57
|
+
method: 'PUT',
|
|
58
|
+
body: { Invoice: { EmailInformation: emailInfo } },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (method === 'print') {
|
|
62
|
+
return (await markInvoicePrinted(documentNumber)).invoice;
|
|
63
|
+
}
|
|
64
|
+
// Exhaustive on purpose: no silent fallback. 'email' and 'einvoice' both send
|
|
65
|
+
// the invoice to the customer, so an unrecognised method must fail loudly
|
|
66
|
+
// rather than pick one of them.
|
|
67
|
+
if (method !== 'email' && method !== 'einvoice') {
|
|
68
|
+
throw new Error(`Unsupported send method: ${String(method)}`);
|
|
69
|
+
}
|
|
70
|
+
const data = await transport.request(`invoices/${documentId}/${method}`, {
|
|
71
|
+
// Fortnox models these delivery actions as GET, but they send an invoice
|
|
72
|
+
// to a customer. Never retry them automatically after an ambiguous error.
|
|
73
|
+
mutation: true,
|
|
74
|
+
});
|
|
75
|
+
return data?.Invoice || {};
|
|
60
76
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Fetch an invoice as a PDF. Always uses /preview, which returns the same
|
|
79
|
+
* document as /print but leaves the invoice untouched.
|
|
80
|
+
*
|
|
81
|
+
* Marking the invoice as sent is deliberately NOT folded in here: callers that
|
|
82
|
+
* want both run this first, write the bytes out, and only then call
|
|
83
|
+
* `markInvoicePrinted`. Doing it the other way round means a full disk or a bad
|
|
84
|
+
* path leaves an invoice flagged as sent with no PDF to show for it.
|
|
85
|
+
*/
|
|
86
|
+
async function getInvoicePdf(documentNumber) {
|
|
87
|
+
return transport.requestPdf(`invoices/${documentSegment(documentNumber)}/preview`);
|
|
66
88
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Mark an invoice as sent via Fortnox's /print action, and report its resulting
|
|
91
|
+
* state. /print is a GET that changes data, so it is flagged as a mutation to
|
|
92
|
+
* keep it out of the automatic retry path.
|
|
93
|
+
*
|
|
94
|
+
* Once the /print request succeeds the invoice has been changed, so from that
|
|
95
|
+
* point on this function does not throw: neither a malformed PDF body nor a
|
|
96
|
+
* failed read-back may turn a completed accounting change into a reported
|
|
97
|
+
* failure.
|
|
98
|
+
*/
|
|
99
|
+
async function markInvoicePrinted(documentNumber) {
|
|
100
|
+
const documentId = documentSegment(documentNumber);
|
|
101
|
+
const pdf = await transport.requestPdfFromMutation(`invoices/${documentId}/print`);
|
|
102
|
+
try {
|
|
103
|
+
return { invoice: await getInvoice(documentNumber), confirmed: true, pdf };
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// Fortnox accepted the print request, so the change has most likely been
|
|
107
|
+
// applied — but "most likely" is not "confirmed". Deliberately no
|
|
108
|
+
// `Sent: true` here: synthesizing it would present an unverified outcome as
|
|
109
|
+
// established fact about someone's accounting records.
|
|
110
|
+
return {
|
|
111
|
+
invoice: {
|
|
112
|
+
DocumentNumber: documentNumber,
|
|
113
|
+
Note: `Fortnox accepted the print request, but reading the invoice back failed, so its sent status could not be confirmed: ${err instanceof Error ? err.message : String(err)}`,
|
|
114
|
+
},
|
|
115
|
+
confirmed: false,
|
|
116
|
+
pdf,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
97
119
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return {
|
|
104
|
-
invoice: {
|
|
105
|
-
DocumentNumber: documentNumber,
|
|
106
|
-
Note: `Fortnox accepted the print request, but reading the invoice back failed, so its sent status could not be confirmed: ${err instanceof Error ? err.message : String(err)}`,
|
|
107
|
-
},
|
|
108
|
-
confirmed: false,
|
|
109
|
-
pdf,
|
|
110
|
-
};
|
|
120
|
+
async function bookkeepInvoice(documentNumber) {
|
|
121
|
+
const data = await transport.request(`invoices/${documentSegment(documentNumber)}/bookkeep`, {
|
|
122
|
+
method: 'PUT',
|
|
123
|
+
});
|
|
124
|
+
return data?.Invoice || {};
|
|
111
125
|
}
|
|
126
|
+
async function creditInvoice(documentNumber) {
|
|
127
|
+
const data = await transport.request(`invoices/${documentSegment(documentNumber)}/credit`, {
|
|
128
|
+
method: 'PUT',
|
|
129
|
+
});
|
|
130
|
+
return data?.Invoice || {};
|
|
131
|
+
}
|
|
132
|
+
const MIME_BY_EXT = {
|
|
133
|
+
'.pdf': 'application/pdf',
|
|
134
|
+
'.png': 'image/png',
|
|
135
|
+
'.jpg': 'image/jpeg',
|
|
136
|
+
'.jpeg': 'image/jpeg',
|
|
137
|
+
'.gif': 'image/gif',
|
|
138
|
+
'.webp': 'image/webp',
|
|
139
|
+
'.heic': 'image/heic',
|
|
140
|
+
'.tif': 'image/tiff',
|
|
141
|
+
'.tiff': 'image/tiff',
|
|
142
|
+
'.txt': 'text/plain',
|
|
143
|
+
'.csv': 'text/csv',
|
|
144
|
+
'.xml': 'application/xml',
|
|
145
|
+
};
|
|
146
|
+
function mimeForFile(filePath) {
|
|
147
|
+
return MIME_BY_EXT[extname(filePath).toLowerCase()] ?? 'application/octet-stream';
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Upload a file for later attachment to a customer invoice.
|
|
151
|
+
*
|
|
152
|
+
* Two details here are not in Fortnox's published OpenAPI spec and were only
|
|
153
|
+
* found by inspecting the Fortnox web app's own network traffic:
|
|
154
|
+
* 1. The upload must go to `/3/archive?folderid=inbox_kf` — not `/3/inbox`
|
|
155
|
+
* (file_not_found on attach) and not a default-folder `/3/archive`
|
|
156
|
+
* (wrong_file_location on attach).
|
|
157
|
+
* 2. The attach call (createInvoiceAttachment below) needs this response's
|
|
158
|
+
* `ArchiveFileId` field, not `Id` — the latter also produces
|
|
159
|
+
* wrong_file_location.
|
|
160
|
+
* Customer invoices have no `invoicefileconnections` — the per-entity
|
|
161
|
+
* connection pattern used by vouchers/supplier invoices/articles/assets never
|
|
162
|
+
* covered Faktura — so this goes through the archive plus the separate,
|
|
163
|
+
* mostly undocumented `/api/fileattachments/attachments-v1` product API
|
|
164
|
+
* instead.
|
|
165
|
+
*/
|
|
166
|
+
async function uploadForInvoiceAttachment(filePath) {
|
|
167
|
+
const buf = readFileSync(filePath);
|
|
168
|
+
const form = new FormData();
|
|
169
|
+
form.append('file', new Blob([buf], { type: mimeForFile(filePath) }), basename(filePath));
|
|
170
|
+
const data = await transport.request('/3/archive', {
|
|
171
|
+
method: 'POST',
|
|
172
|
+
params: { folderid: 'inbox_kf' },
|
|
173
|
+
rawBody: form,
|
|
174
|
+
});
|
|
175
|
+
return data.File;
|
|
176
|
+
}
|
|
177
|
+
async function listInvoiceAttachments(documentNumber) {
|
|
178
|
+
return transport.request('/api/fileattachments/attachments-v1', {
|
|
179
|
+
params: { entityid: documentNumber, entitytype: 'F' },
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async function createInvoiceAttachment(documentNumber, fileId, includeOnSend) {
|
|
183
|
+
const data = await transport.request('/api/fileattachments/attachments-v1', {
|
|
184
|
+
method: 'POST',
|
|
185
|
+
body: [{ entityId: Number(documentNumber), entityType: 'F', fileId, includeOnSend }],
|
|
186
|
+
});
|
|
187
|
+
const attachment = data[0];
|
|
188
|
+
if (!attachment) {
|
|
189
|
+
throw new Error(`Fortnox did not return an attachment record for invoice ${documentNumber}.`);
|
|
190
|
+
}
|
|
191
|
+
return attachment;
|
|
192
|
+
}
|
|
193
|
+
// Orchestrate: upload each file to the archive, then attach it in order.
|
|
194
|
+
async function attachInvoiceFiles(params) {
|
|
195
|
+
for (const filePath of params.filePaths) {
|
|
196
|
+
if (!existsSync(filePath))
|
|
197
|
+
throw new Error(`File not found: ${filePath}`);
|
|
198
|
+
if (!statSync(filePath).isFile())
|
|
199
|
+
throw new Error(`Not a file: ${filePath}`);
|
|
200
|
+
}
|
|
201
|
+
const includeOnSend = params.includeOnSend ?? true;
|
|
202
|
+
const results = [];
|
|
203
|
+
for (const filePath of params.filePaths) {
|
|
204
|
+
try {
|
|
205
|
+
const file = await uploadForInvoiceAttachment(filePath);
|
|
206
|
+
const attachment = await createInvoiceAttachment(params.documentNumber, file.ArchiveFileId, includeOnSend);
|
|
207
|
+
results.push({
|
|
208
|
+
fileName: file.Name,
|
|
209
|
+
fileId: attachment.fileId,
|
|
210
|
+
attachmentId: attachment.id,
|
|
211
|
+
includeOnSend: attachment.includeOnSend,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
const done = results.map((r) => r.fileName).join(', ') || 'none';
|
|
216
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
217
|
+
throw new Error(`Failed attaching "${basename(filePath)}" to invoice ${params.documentNumber}: ${detail}. Files already attached this run: ${done}.`);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return results;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
listInvoices,
|
|
224
|
+
getInvoice,
|
|
225
|
+
createInvoice,
|
|
226
|
+
updateInvoice,
|
|
227
|
+
sendInvoice,
|
|
228
|
+
getInvoicePdf,
|
|
229
|
+
markInvoicePrinted,
|
|
230
|
+
bookkeepInvoice,
|
|
231
|
+
creditInvoice,
|
|
232
|
+
attachInvoiceFiles,
|
|
233
|
+
listInvoiceAttachments,
|
|
234
|
+
};
|
|
112
235
|
}
|
|
113
|
-
export
|
|
114
|
-
const data = await fortnoxRequest(`invoices/${documentSegment(documentNumber)}/bookkeep`, {
|
|
115
|
-
method: 'PUT',
|
|
116
|
-
});
|
|
117
|
-
return data?.Invoice || {};
|
|
118
|
-
}
|
|
119
|
-
export async function creditInvoice(documentNumber) {
|
|
120
|
-
const data = await fortnoxRequest(`invoices/${documentSegment(documentNumber)}/credit`, {
|
|
121
|
-
method: 'PUT',
|
|
122
|
-
});
|
|
123
|
-
return data?.Invoice || {};
|
|
124
|
-
}
|
|
236
|
+
export const { listInvoices, getInvoice, createInvoice, updateInvoice, sendInvoice, getInvoicePdf, markInvoicePrinted, bookkeepInvoice, creditInvoice, attachInvoiceFiles, listInvoiceAttachments, } = createInvoiceOperations(defaultFortnoxTransport);
|
|
125
237
|
//# sourceMappingURL=invoices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoices.js","sourceRoot":"","sources":["../../src/operations/invoices.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"invoices.js","sourceRoot":"","sources":["../../src/operations/invoices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAyB,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAoEpD,MAAM,UAAU,uBAAuB,CAAC,SAA2B;IACjE,KAAK,UAAU,YAAY,CAAC,SAA6B,EAAE;QACzD,MAAM,WAAW,GAAgD;YAC/D,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,cAAc,EAAE,MAAM,CAAC,cAAc;YACrC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;QAEF,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;YACf,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,SAAS,CAAC,aAAa,CAC7D,UAAU,EACV,UAAU,EACV,WAAW,CACZ,CAAC;YACF,OAAO;gB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Ae,EACf,aAAa,EACb,kBAAkB,EAClB,sBAAsB,GACvB,GAAG,uBAAuB,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type FortnoxTransport } from '../fortnox-client.js';
|
|
2
|
+
export interface OffersResponse {
|
|
2
3
|
Offers: Record<string, unknown>[];
|
|
3
4
|
MetaInformation?: {
|
|
4
5
|
'@TotalResources': number;
|
|
@@ -15,11 +16,13 @@ export interface ListOffersParams {
|
|
|
15
16
|
limit?: number;
|
|
16
17
|
all?: boolean;
|
|
17
18
|
}
|
|
18
|
-
export declare function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
export declare function createOfferOperations(transport: FortnoxTransport): {
|
|
20
|
+
listOffers: (params?: ListOffersParams) => Promise<OffersResponse>;
|
|
21
|
+
getOffer: (documentNumber: string) => Promise<Record<string, unknown>>;
|
|
22
|
+
createOffer: (params: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
23
|
+
updateOffer: (documentNumber: string, fields: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
24
|
+
createInvoiceFromOffer: (documentNumber: string) => Promise<Record<string, unknown>>;
|
|
25
|
+
createOrderFromOffer: (documentNumber: string) => Promise<Record<string, unknown>>;
|
|
26
|
+
};
|
|
27
|
+
export declare const listOffers: (params?: ListOffersParams) => Promise<OffersResponse>, getOffer: (documentNumber: string) => Promise<Record<string, unknown>>, createOffer: (params: Record<string, unknown>) => Promise<Record<string, unknown>>, updateOffer: (documentNumber: string, fields: Record<string, unknown>) => Promise<Record<string, unknown>>, createInvoiceFromOffer: (documentNumber: string) => Promise<Record<string, unknown>>, createOrderFromOffer: (documentNumber: string) => Promise<Record<string, unknown>>;
|
|
25
28
|
//# sourceMappingURL=offers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["../../src/operations/offers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"offers.d.ts","sourceRoot":"","sources":["../../src/operations/offers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAOtF,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,eAAe,CAAC,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;CAChG;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,gBAAgB;0BAC7B,gBAAgB,KAAQ,OAAO,CAAC,cAAc,CAAC;+BAyBzC,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;0BAO9C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;kCAS3E,MAAM,UACd,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;6CAYmB,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;2CAQ3C,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;EAgB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