@substrat-run/connector-fortnox 0.2.0 → 0.3.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/LICENSE +661 -0
- package/README.md +33 -19
- package/dist/api.d.ts +12 -17
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +38 -10
- package/dist/api.js.map +1 -1
- package/dist/mock.d.ts +15 -4
- package/dist/mock.d.ts.map +1 -1
- package/dist/mock.js +29 -9
- package/dist/mock.js.map +1 -1
- package/dist/sie4.d.ts +35 -1
- package/dist/sie4.d.ts.map +1 -1
- package/dist/sie4.js +61 -1
- package/dist/sie4.js.map +1 -1
- package/package.json +13 -13
package/LICENSE
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 19 November 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
Preamble
|
|
9
|
+
|
|
10
|
+
The GNU Affero General Public License is a free, copyleft license for
|
|
11
|
+
software and other kinds of works, specifically designed to ensure
|
|
12
|
+
cooperation with the community in the case of network server software.
|
|
13
|
+
|
|
14
|
+
The licenses for most software and other practical works are designed
|
|
15
|
+
to take away your freedom to share and change the works. By contrast,
|
|
16
|
+
our General Public Licenses are intended to guarantee your freedom to
|
|
17
|
+
share and change all versions of a program--to make sure it remains free
|
|
18
|
+
software for all its users.
|
|
19
|
+
|
|
20
|
+
When we speak of free software, we are referring to freedom, not
|
|
21
|
+
price. Our General Public Licenses are designed to make sure that you
|
|
22
|
+
have the freedom to distribute copies of free software (and charge for
|
|
23
|
+
them if you wish), that you receive source code or can get it if you
|
|
24
|
+
want it, that you can change the software or use pieces of it in new
|
|
25
|
+
free programs, and that you know you can do these things.
|
|
26
|
+
|
|
27
|
+
Developers that use our General Public Licenses protect your rights
|
|
28
|
+
with two steps: (1) assert copyright on the software, and (2) offer
|
|
29
|
+
you this License which gives you legal permission to copy, distribute
|
|
30
|
+
and/or modify the software.
|
|
31
|
+
|
|
32
|
+
A secondary benefit of defending all users' freedom is that
|
|
33
|
+
improvements made in alternate versions of the program, if they
|
|
34
|
+
receive widespread use, become available for other developers to
|
|
35
|
+
incorporate. Many developers of free software are heartened and
|
|
36
|
+
encouraged by the resulting cooperation. However, in the case of
|
|
37
|
+
software used on network servers, this result may fail to come about.
|
|
38
|
+
The GNU General Public License permits making a modified version and
|
|
39
|
+
letting the public access it on a server without ever releasing its
|
|
40
|
+
source code to the public.
|
|
41
|
+
|
|
42
|
+
The GNU Affero General Public License is designed specifically to
|
|
43
|
+
ensure that, in such cases, the modified source code becomes available
|
|
44
|
+
to the community. It requires the operator of a network server to
|
|
45
|
+
provide the source code of the modified version running there to the
|
|
46
|
+
users of that server. Therefore, public use of a modified version, on
|
|
47
|
+
a publicly accessible server, gives the public access to the source
|
|
48
|
+
code of the modified version.
|
|
49
|
+
|
|
50
|
+
An older license, called the Affero General Public License and
|
|
51
|
+
published by Affero, was designed to accomplish similar goals. This is
|
|
52
|
+
a different license, not a version of the Affero GPL, but Affero has
|
|
53
|
+
released a new version of the Affero GPL which permits relicensing under
|
|
54
|
+
this license.
|
|
55
|
+
|
|
56
|
+
The precise terms and conditions for copying, distribution and
|
|
57
|
+
modification follow.
|
|
58
|
+
|
|
59
|
+
TERMS AND CONDITIONS
|
|
60
|
+
|
|
61
|
+
0. Definitions.
|
|
62
|
+
|
|
63
|
+
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
64
|
+
|
|
65
|
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
66
|
+
works, such as semiconductor masks.
|
|
67
|
+
|
|
68
|
+
"The Program" refers to any copyrightable work licensed under this
|
|
69
|
+
License. Each licensee is addressed as "you". "Licensees" and
|
|
70
|
+
"recipients" may be individuals or organizations.
|
|
71
|
+
|
|
72
|
+
To "modify" a work means to copy from or adapt all or part of the work
|
|
73
|
+
in a fashion requiring copyright permission, other than the making of an
|
|
74
|
+
exact copy. The resulting work is called a "modified version" of the
|
|
75
|
+
earlier work or a work "based on" the earlier work.
|
|
76
|
+
|
|
77
|
+
A "covered work" means either the unmodified Program or a work based
|
|
78
|
+
on the Program.
|
|
79
|
+
|
|
80
|
+
To "propagate" a work means to do anything with it that, without
|
|
81
|
+
permission, would make you directly or secondarily liable for
|
|
82
|
+
infringement under applicable copyright law, except executing it on a
|
|
83
|
+
computer or modifying a private copy. Propagation includes copying,
|
|
84
|
+
distribution (with or without modification), making available to the
|
|
85
|
+
public, and in some countries other activities as well.
|
|
86
|
+
|
|
87
|
+
To "convey" a work means any kind of propagation that enables other
|
|
88
|
+
parties to make or receive copies. Mere interaction with a user through
|
|
89
|
+
a computer network, with no transfer of a copy, is not conveying.
|
|
90
|
+
|
|
91
|
+
An interactive user interface displays "Appropriate Legal Notices"
|
|
92
|
+
to the extent that it includes a convenient and prominently visible
|
|
93
|
+
feature that (1) displays an appropriate copyright notice, and (2)
|
|
94
|
+
tells the user that there is no warranty for the work (except to the
|
|
95
|
+
extent that warranties are provided), that licensees may convey the
|
|
96
|
+
work under this License, and how to view a copy of this License. If
|
|
97
|
+
the interface presents a list of user commands or options, such as a
|
|
98
|
+
menu, a prominent item in the list meets this criterion.
|
|
99
|
+
|
|
100
|
+
1. Source Code.
|
|
101
|
+
|
|
102
|
+
The "source code" for a work means the preferred form of the work
|
|
103
|
+
for making modifications to it. "Object code" means any non-source
|
|
104
|
+
form of a work.
|
|
105
|
+
|
|
106
|
+
A "Standard Interface" means an interface that either is an official
|
|
107
|
+
standard defined by a recognized standards body, or, in the case of
|
|
108
|
+
interfaces specified for a particular programming language, one that
|
|
109
|
+
is widely used among developers working in that language.
|
|
110
|
+
|
|
111
|
+
The "System Libraries" of an executable work include anything, other
|
|
112
|
+
than the work as a whole, that (a) is included in the normal form of
|
|
113
|
+
packaging a Major Component, but which is not part of that Major
|
|
114
|
+
Component, and (b) serves only to enable use of the work with that
|
|
115
|
+
Major Component, or to implement a Standard Interface for which an
|
|
116
|
+
implementation is available to the public in source code form. A
|
|
117
|
+
"Major Component", in this context, means a major essential component
|
|
118
|
+
(kernel, window system, and so on) of the specific operating system
|
|
119
|
+
(if any) on which the executable work runs, or a compiler used to
|
|
120
|
+
produce the work, or an object code interpreter used to run it.
|
|
121
|
+
|
|
122
|
+
The "Corresponding Source" for a work in object code form means all
|
|
123
|
+
the source code needed to generate, install, and (for an executable
|
|
124
|
+
work) run the object code and to modify the work, including scripts to
|
|
125
|
+
control those activities. However, it does not include the work's
|
|
126
|
+
System Libraries, or general-purpose tools or generally available free
|
|
127
|
+
programs which are used unmodified in performing those activities but
|
|
128
|
+
which are not part of the work. For example, Corresponding Source
|
|
129
|
+
includes interface definition files associated with source files for
|
|
130
|
+
the work, and the source code for shared libraries and dynamically
|
|
131
|
+
linked subprograms that the work is specifically designed to require,
|
|
132
|
+
such as by intimate data communication or control flow between those
|
|
133
|
+
subprograms and other parts of the work.
|
|
134
|
+
|
|
135
|
+
The Corresponding Source need not include anything that users
|
|
136
|
+
can regenerate automatically from other parts of the Corresponding
|
|
137
|
+
Source.
|
|
138
|
+
|
|
139
|
+
The Corresponding Source for a work in source code form is that
|
|
140
|
+
same work.
|
|
141
|
+
|
|
142
|
+
2. Basic Permissions.
|
|
143
|
+
|
|
144
|
+
All rights granted under this License are granted for the term of
|
|
145
|
+
copyright on the Program, and are irrevocable provided the stated
|
|
146
|
+
conditions are met. This License explicitly affirms your unlimited
|
|
147
|
+
permission to run the unmodified Program. The output from running a
|
|
148
|
+
covered work is covered by this License only if the output, given its
|
|
149
|
+
content, constitutes a covered work. This License acknowledges your
|
|
150
|
+
rights of fair use or other equivalent, as provided by copyright law.
|
|
151
|
+
|
|
152
|
+
You may make, run and propagate covered works that you do not
|
|
153
|
+
convey, without conditions so long as your license otherwise remains
|
|
154
|
+
in force. You may convey covered works to others for the sole purpose
|
|
155
|
+
of having them make modifications exclusively for you, or provide you
|
|
156
|
+
with facilities for running those works, provided that you comply with
|
|
157
|
+
the terms of this License in conveying all material for which you do
|
|
158
|
+
not control copyright. Those thus making or running the covered works
|
|
159
|
+
for you must do so exclusively on your behalf, under your direction
|
|
160
|
+
and control, on terms that prohibit them from making any copies of
|
|
161
|
+
your copyrighted material outside their relationship with you.
|
|
162
|
+
|
|
163
|
+
Conveying under any other circumstances is permitted solely under
|
|
164
|
+
the conditions stated below. Sublicensing is not allowed; section 10
|
|
165
|
+
makes it unnecessary.
|
|
166
|
+
|
|
167
|
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
168
|
+
|
|
169
|
+
No covered work shall be deemed part of an effective technological
|
|
170
|
+
measure under any applicable law fulfilling obligations under article
|
|
171
|
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
172
|
+
similar laws prohibiting or restricting circumvention of such
|
|
173
|
+
measures.
|
|
174
|
+
|
|
175
|
+
When you convey a covered work, you waive any legal power to forbid
|
|
176
|
+
circumvention of technological measures to the extent such circumvention
|
|
177
|
+
is effected by exercising rights under this License with respect to
|
|
178
|
+
the covered work, and you disclaim any intention to limit operation or
|
|
179
|
+
modification of the work as a means of enforcing, against the work's
|
|
180
|
+
users, your or third parties' legal rights to forbid circumvention of
|
|
181
|
+
technological measures.
|
|
182
|
+
|
|
183
|
+
4. Conveying Verbatim Copies.
|
|
184
|
+
|
|
185
|
+
You may convey verbatim copies of the Program's source code as you
|
|
186
|
+
receive it, in any medium, provided that you conspicuously and
|
|
187
|
+
appropriately publish on each copy an appropriate copyright notice;
|
|
188
|
+
keep intact all notices stating that this License and any
|
|
189
|
+
non-permissive terms added in accord with section 7 apply to the code;
|
|
190
|
+
keep intact all notices of the absence of any warranty; and give all
|
|
191
|
+
recipients a copy of this License along with the Program.
|
|
192
|
+
|
|
193
|
+
You may charge any price or no price for each copy that you convey,
|
|
194
|
+
and you may offer support or warranty protection for a fee.
|
|
195
|
+
|
|
196
|
+
5. Conveying Modified Source Versions.
|
|
197
|
+
|
|
198
|
+
You may convey a work based on the Program, or the modifications to
|
|
199
|
+
produce it from the Program, in the form of source code under the
|
|
200
|
+
terms of section 4, provided that you also meet all of these conditions:
|
|
201
|
+
|
|
202
|
+
a) The work must carry prominent notices stating that you modified
|
|
203
|
+
it, and giving a relevant date.
|
|
204
|
+
|
|
205
|
+
b) The work must carry prominent notices stating that it is
|
|
206
|
+
released under this License and any conditions added under section
|
|
207
|
+
7. This requirement modifies the requirement in section 4 to
|
|
208
|
+
"keep intact all notices".
|
|
209
|
+
|
|
210
|
+
c) You must license the entire work, as a whole, under this
|
|
211
|
+
License to anyone who comes into possession of a copy. This
|
|
212
|
+
License will therefore apply, along with any applicable section 7
|
|
213
|
+
additional terms, to the whole of the work, and all its parts,
|
|
214
|
+
regardless of how they are packaged. This License gives no
|
|
215
|
+
permission to license the work in any other way, but it does not
|
|
216
|
+
invalidate such permission if you have separately received it.
|
|
217
|
+
|
|
218
|
+
d) If the work has interactive user interfaces, each must display
|
|
219
|
+
Appropriate Legal Notices; however, if the Program has interactive
|
|
220
|
+
interfaces that do not display Appropriate Legal Notices, your
|
|
221
|
+
work need not make them do so.
|
|
222
|
+
|
|
223
|
+
A compilation of a covered work with other separate and independent
|
|
224
|
+
works, which are not by their nature extensions of the covered work,
|
|
225
|
+
and which are not combined with it such as to form a larger program,
|
|
226
|
+
in or on a volume of a storage or distribution medium, is called an
|
|
227
|
+
"aggregate" if the compilation and its resulting copyright are not
|
|
228
|
+
used to limit the access or legal rights of the compilation's users
|
|
229
|
+
beyond what the individual works permit. Inclusion of a covered work
|
|
230
|
+
in an aggregate does not cause this License to apply to the other
|
|
231
|
+
parts of the aggregate.
|
|
232
|
+
|
|
233
|
+
6. Conveying Non-Source Forms.
|
|
234
|
+
|
|
235
|
+
You may convey a covered work in object code form under the terms
|
|
236
|
+
of sections 4 and 5, provided that you also convey the
|
|
237
|
+
machine-readable Corresponding Source under the terms of this License,
|
|
238
|
+
in one of these ways:
|
|
239
|
+
|
|
240
|
+
a) Convey the object code in, or embodied in, a physical product
|
|
241
|
+
(including a physical distribution medium), accompanied by the
|
|
242
|
+
Corresponding Source fixed on a durable physical medium
|
|
243
|
+
customarily used for software interchange.
|
|
244
|
+
|
|
245
|
+
b) Convey the object code in, or embodied in, a physical product
|
|
246
|
+
(including a physical distribution medium), accompanied by a
|
|
247
|
+
written offer, valid for at least three years and valid for as
|
|
248
|
+
long as you offer spare parts or customer support for that product
|
|
249
|
+
model, to give anyone who possesses the object code either (1) a
|
|
250
|
+
copy of the Corresponding Source for all the software in the
|
|
251
|
+
product that is covered by this License, on a durable physical
|
|
252
|
+
medium customarily used for software interchange, for a price no
|
|
253
|
+
more than your reasonable cost of physically performing this
|
|
254
|
+
conveying of source, or (2) access to copy the
|
|
255
|
+
Corresponding Source from a network server at no charge.
|
|
256
|
+
|
|
257
|
+
c) Convey individual copies of the object code with a copy of the
|
|
258
|
+
written offer to provide the Corresponding Source. This
|
|
259
|
+
alternative is allowed only occasionally and noncommercially, and
|
|
260
|
+
only if you received the object code with such an offer, in accord
|
|
261
|
+
with subsection 6b.
|
|
262
|
+
|
|
263
|
+
d) Convey the object code by offering access from a designated
|
|
264
|
+
place (gratis or for a charge), and offer equivalent access to the
|
|
265
|
+
Corresponding Source in the same way through the same place at no
|
|
266
|
+
further charge. You need not require recipients to copy the
|
|
267
|
+
Corresponding Source along with the object code. If the place to
|
|
268
|
+
copy the object code is a network server, the Corresponding Source
|
|
269
|
+
may be on a different server (operated by you or a third party)
|
|
270
|
+
that supports equivalent copying facilities, provided you maintain
|
|
271
|
+
clear directions next to the object code saying where to find the
|
|
272
|
+
Corresponding Source. Regardless of what server hosts the
|
|
273
|
+
Corresponding Source, you remain obligated to ensure that it is
|
|
274
|
+
available for as long as needed to satisfy these requirements.
|
|
275
|
+
|
|
276
|
+
e) Convey the object code using peer-to-peer transmission, provided
|
|
277
|
+
you inform other peers where the object code and Corresponding
|
|
278
|
+
Source of the work are being offered to the general public at no
|
|
279
|
+
charge under subsection 6d.
|
|
280
|
+
|
|
281
|
+
A separable portion of the object code, whose source code is excluded
|
|
282
|
+
from the Corresponding Source as a System Library, need not be
|
|
283
|
+
included in conveying the object code work.
|
|
284
|
+
|
|
285
|
+
A "User Product" is either (1) a "consumer product", which means any
|
|
286
|
+
tangible personal property which is normally used for personal, family,
|
|
287
|
+
or household purposes, or (2) anything designed or sold for incorporation
|
|
288
|
+
into a dwelling. In determining whether a product is a consumer product,
|
|
289
|
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
290
|
+
product received by a particular user, "normally used" refers to a
|
|
291
|
+
typical or common use of that class of product, regardless of the status
|
|
292
|
+
of the particular user or of the way in which the particular user
|
|
293
|
+
actually uses, or expects or is expected to use, the product. A product
|
|
294
|
+
is a consumer product regardless of whether the product has substantial
|
|
295
|
+
commercial, industrial or non-consumer uses, unless such uses represent
|
|
296
|
+
the only significant mode of use of the product.
|
|
297
|
+
|
|
298
|
+
"Installation Information" for a User Product means any methods,
|
|
299
|
+
procedures, authorization keys, or other information required to install
|
|
300
|
+
and execute modified versions of a covered work in that User Product from
|
|
301
|
+
a modified version of its Corresponding Source. The information must
|
|
302
|
+
suffice to ensure that the continued functioning of the modified object
|
|
303
|
+
code is in no case prevented or interfered with solely because
|
|
304
|
+
modification has been made.
|
|
305
|
+
|
|
306
|
+
If you convey an object code work under this section in, or with, or
|
|
307
|
+
specifically for use in, a User Product, and the conveying occurs as
|
|
308
|
+
part of a transaction in which the right of possession and use of the
|
|
309
|
+
User Product is transferred to the recipient in perpetuity or for a
|
|
310
|
+
fixed term (regardless of how the transaction is characterized), the
|
|
311
|
+
Corresponding Source conveyed under this section must be accompanied
|
|
312
|
+
by the Installation Information. But this requirement does not apply
|
|
313
|
+
if neither you nor any third party retains the ability to install
|
|
314
|
+
modified object code on the User Product (for example, the work has
|
|
315
|
+
been installed in ROM).
|
|
316
|
+
|
|
317
|
+
The requirement to provide Installation Information does not include a
|
|
318
|
+
requirement to continue to provide support service, warranty, or updates
|
|
319
|
+
for a work that has been modified or installed by the recipient, or for
|
|
320
|
+
the User Product in which it has been modified or installed. Access to a
|
|
321
|
+
network may be denied when the modification itself materially and
|
|
322
|
+
adversely affects the operation of the network or violates the rules and
|
|
323
|
+
protocols for communication across the network.
|
|
324
|
+
|
|
325
|
+
Corresponding Source conveyed, and Installation Information provided,
|
|
326
|
+
in accord with this section must be in a format that is publicly
|
|
327
|
+
documented (and with an implementation available to the public in
|
|
328
|
+
source code form), and must require no special password or key for
|
|
329
|
+
unpacking, reading or copying.
|
|
330
|
+
|
|
331
|
+
7. Additional Terms.
|
|
332
|
+
|
|
333
|
+
"Additional permissions" are terms that supplement the terms of this
|
|
334
|
+
License by making exceptions from one or more of its conditions.
|
|
335
|
+
Additional permissions that are applicable to the entire Program shall
|
|
336
|
+
be treated as though they were included in this License, to the extent
|
|
337
|
+
that they are valid under applicable law. If additional permissions
|
|
338
|
+
apply only to part of the Program, that part may be used separately
|
|
339
|
+
under those permissions, but the entire Program remains governed by
|
|
340
|
+
this License without regard to the additional permissions.
|
|
341
|
+
|
|
342
|
+
When you convey a copy of a covered work, you may at your option
|
|
343
|
+
remove any additional permissions from that copy, or from any part of
|
|
344
|
+
it. (Additional permissions may be written to require their own
|
|
345
|
+
removal in certain cases when you modify the work.) You may place
|
|
346
|
+
additional permissions on material, added by you to a covered work,
|
|
347
|
+
for which you have or can give appropriate copyright permission.
|
|
348
|
+
|
|
349
|
+
Notwithstanding any other provision of this License, for material you
|
|
350
|
+
add to a covered work, you may (if authorized by the copyright holders of
|
|
351
|
+
that material) supplement the terms of this License with terms:
|
|
352
|
+
|
|
353
|
+
a) Disclaiming warranty or limiting liability differently from the
|
|
354
|
+
terms of sections 15 and 16 of this License; or
|
|
355
|
+
|
|
356
|
+
b) Requiring preservation of specified reasonable legal notices or
|
|
357
|
+
author attributions in that material or in the Appropriate Legal
|
|
358
|
+
Notices displayed by works containing it; or
|
|
359
|
+
|
|
360
|
+
c) Prohibiting misrepresentation of the origin of that material, or
|
|
361
|
+
requiring that modified versions of such material be marked in
|
|
362
|
+
reasonable ways as different from the original version; or
|
|
363
|
+
|
|
364
|
+
d) Limiting the use for publicity purposes of names of licensors or
|
|
365
|
+
authors of the material; or
|
|
366
|
+
|
|
367
|
+
e) Declining to grant rights under trademark law for use of some
|
|
368
|
+
trade names, trademarks, or service marks; or
|
|
369
|
+
|
|
370
|
+
f) Requiring indemnification of licensors and authors of that
|
|
371
|
+
material by anyone who conveys the material (or modified versions of
|
|
372
|
+
it) with contractual assumptions of liability to the recipient, for
|
|
373
|
+
any liability that these contractual assumptions directly impose on
|
|
374
|
+
those licensors and authors.
|
|
375
|
+
|
|
376
|
+
All other non-permissive additional terms are considered "further
|
|
377
|
+
restrictions" within the meaning of section 10. If the Program as you
|
|
378
|
+
received it, or any part of it, contains a notice stating that it is
|
|
379
|
+
governed by this License along with a term that is a further
|
|
380
|
+
restriction, you may remove that term. If a license document contains
|
|
381
|
+
a further restriction but permits relicensing or conveying under this
|
|
382
|
+
License, you may add to a covered work material governed by the terms
|
|
383
|
+
of that license document, provided that the further restriction does
|
|
384
|
+
not survive such relicensing or conveying.
|
|
385
|
+
|
|
386
|
+
If you add terms to a covered work in accord with this section, you
|
|
387
|
+
must place, in the relevant source files, a statement of the
|
|
388
|
+
additional terms that apply to those files, or a notice indicating
|
|
389
|
+
where to find the applicable terms.
|
|
390
|
+
|
|
391
|
+
Additional terms, permissive or non-permissive, may be stated in the
|
|
392
|
+
form of a separately written license, or stated as exceptions;
|
|
393
|
+
the above requirements apply either way.
|
|
394
|
+
|
|
395
|
+
8. Termination.
|
|
396
|
+
|
|
397
|
+
You may not propagate or modify a covered work except as expressly
|
|
398
|
+
provided under this License. Any attempt otherwise to propagate or
|
|
399
|
+
modify it is void, and will automatically terminate your rights under
|
|
400
|
+
this License (including any patent licenses granted under the third
|
|
401
|
+
paragraph of section 11).
|
|
402
|
+
|
|
403
|
+
However, if you cease all violation of this License, then your
|
|
404
|
+
license from a particular copyright holder is reinstated (a)
|
|
405
|
+
provisionally, unless and until the copyright holder explicitly and
|
|
406
|
+
finally terminates your license, and (b) permanently, if the copyright
|
|
407
|
+
holder fails to notify you of the violation by some reasonable means
|
|
408
|
+
prior to 60 days after the cessation.
|
|
409
|
+
|
|
410
|
+
Moreover, your license from a particular copyright holder is
|
|
411
|
+
reinstated permanently if the copyright holder notifies you of the
|
|
412
|
+
violation by some reasonable means, this is the first time you have
|
|
413
|
+
received notice of violation of this License (for any work) from that
|
|
414
|
+
copyright holder, and you cure the violation prior to 30 days after
|
|
415
|
+
your receipt of the notice.
|
|
416
|
+
|
|
417
|
+
Termination of your rights under this section does not terminate the
|
|
418
|
+
licenses of parties who have received copies or rights from you under
|
|
419
|
+
this License. If your rights have been terminated and not permanently
|
|
420
|
+
reinstated, you do not qualify to receive new licenses for the same
|
|
421
|
+
material under section 10.
|
|
422
|
+
|
|
423
|
+
9. Acceptance Not Required for Having Copies.
|
|
424
|
+
|
|
425
|
+
You are not required to accept this License in order to receive or
|
|
426
|
+
run a copy of the Program. Ancillary propagation of a covered work
|
|
427
|
+
occurring solely as a consequence of using peer-to-peer transmission
|
|
428
|
+
to receive a copy likewise does not require acceptance. However,
|
|
429
|
+
nothing other than this License grants you permission to propagate or
|
|
430
|
+
modify any covered work. These actions infringe copyright if you do
|
|
431
|
+
not accept this License. Therefore, by modifying or propagating a
|
|
432
|
+
covered work, you indicate your acceptance of this License to do so.
|
|
433
|
+
|
|
434
|
+
10. Automatic Licensing of Downstream Recipients.
|
|
435
|
+
|
|
436
|
+
Each time you convey a covered work, the recipient automatically
|
|
437
|
+
receives a license from the original licensors, to run, modify and
|
|
438
|
+
propagate that work, subject to this License. You are not responsible
|
|
439
|
+
for enforcing compliance by third parties with this License.
|
|
440
|
+
|
|
441
|
+
An "entity transaction" is a transaction transferring control of an
|
|
442
|
+
organization, or substantially all assets of one, or subdividing an
|
|
443
|
+
organization, or merging organizations. If propagation of a covered
|
|
444
|
+
work results from an entity transaction, each party to that
|
|
445
|
+
transaction who receives a copy of the work also receives whatever
|
|
446
|
+
licenses to the work the party's predecessor in interest had or could
|
|
447
|
+
give under the previous paragraph, plus a right to possession of the
|
|
448
|
+
Corresponding Source of the work from the predecessor in interest, if
|
|
449
|
+
the predecessor has it or can get it with reasonable efforts.
|
|
450
|
+
|
|
451
|
+
You may not impose any further restrictions on the exercise of the
|
|
452
|
+
rights granted or affirmed under this License. For example, you may
|
|
453
|
+
not impose a license fee, royalty, or other charge for exercise of
|
|
454
|
+
rights granted under this License, and you may not initiate litigation
|
|
455
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
456
|
+
any patent claim is infringed by making, using, selling, offering for
|
|
457
|
+
sale, or importing the Program or any portion of it.
|
|
458
|
+
|
|
459
|
+
11. Patents.
|
|
460
|
+
|
|
461
|
+
A "contributor" is a copyright holder who authorizes use under this
|
|
462
|
+
License of the Program or a work on which the Program is based. The
|
|
463
|
+
work thus licensed is called the contributor's "contributor version".
|
|
464
|
+
|
|
465
|
+
A contributor's "essential patent claims" are all patent claims
|
|
466
|
+
owned or controlled by the contributor, whether already acquired or
|
|
467
|
+
hereafter acquired, that would be infringed by some manner, permitted
|
|
468
|
+
by this License, of making, using, or selling its contributor version,
|
|
469
|
+
but do not include claims that would be infringed only as a
|
|
470
|
+
consequence of further modification of the contributor version. For
|
|
471
|
+
purposes of this definition, "control" includes the right to grant
|
|
472
|
+
patent sublicenses in a manner consistent with the requirements of
|
|
473
|
+
this License.
|
|
474
|
+
|
|
475
|
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
476
|
+
patent license under the contributor's essential patent claims, to
|
|
477
|
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
478
|
+
propagate the contents of its contributor version.
|
|
479
|
+
|
|
480
|
+
In the following three paragraphs, a "patent license" is any express
|
|
481
|
+
agreement or commitment, however denominated, not to enforce a patent
|
|
482
|
+
(such as an express permission to practice a patent or covenant not to
|
|
483
|
+
sue for patent infringement). To "grant" such a patent license to a
|
|
484
|
+
party means to make such an agreement or commitment not to enforce a
|
|
485
|
+
patent against the party.
|
|
486
|
+
|
|
487
|
+
If you convey a covered work, knowingly relying on a patent license,
|
|
488
|
+
and the Corresponding Source of the work is not available for anyone
|
|
489
|
+
to copy, free of charge and under the terms of this License, through a
|
|
490
|
+
publicly available network server or other readily accessible means,
|
|
491
|
+
then you must either (1) cause the Corresponding Source to be so
|
|
492
|
+
available, or (2) arrange to deprive yourself of the benefit of the
|
|
493
|
+
patent license for this particular work, or (3) arrange, in a manner
|
|
494
|
+
consistent with the requirements of this License, to extend the patent
|
|
495
|
+
license to downstream recipients. "Knowingly relying" means you have
|
|
496
|
+
actual knowledge that, but for the patent license, your conveying the
|
|
497
|
+
covered work in a country, or your recipient's use of the covered work
|
|
498
|
+
in a country, would infringe one or more identifiable patents in that
|
|
499
|
+
country that you have reason to believe are valid.
|
|
500
|
+
|
|
501
|
+
If, pursuant to or in connection with a single transaction or
|
|
502
|
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
503
|
+
covered work, and grant a patent license to some of the parties
|
|
504
|
+
receiving the covered work authorizing them to use, propagate, modify
|
|
505
|
+
or convey a specific copy of the covered work, then the patent license
|
|
506
|
+
you grant is automatically extended to all recipients of the covered
|
|
507
|
+
work and works based on it.
|
|
508
|
+
|
|
509
|
+
A patent license is "discriminatory" if it does not include within
|
|
510
|
+
the scope of its coverage, prohibits the exercise of, or is
|
|
511
|
+
conditioned on the non-exercise of one or more of the rights that are
|
|
512
|
+
specifically granted under this License. You may not convey a covered
|
|
513
|
+
work if you are a party to an arrangement with a third party that is
|
|
514
|
+
in the business of distributing software, under which you make payment
|
|
515
|
+
to the third party based on the extent of your activity of conveying
|
|
516
|
+
the work, and under which the third party grants, to any of the
|
|
517
|
+
parties who would receive the covered work from you, a discriminatory
|
|
518
|
+
patent license (a) in connection with copies of the covered work
|
|
519
|
+
conveyed by you (or copies made from those copies), or (b) primarily
|
|
520
|
+
for and in connection with specific products or compilations that
|
|
521
|
+
contain the covered work, unless you entered into that arrangement,
|
|
522
|
+
or that patent license was granted, prior to 28 March 2007.
|
|
523
|
+
|
|
524
|
+
Nothing in this License shall be construed as excluding or limiting
|
|
525
|
+
any implied license or other defenses to infringement that may
|
|
526
|
+
otherwise be available to you under applicable patent law.
|
|
527
|
+
|
|
528
|
+
12. No Surrender of Others' Freedom.
|
|
529
|
+
|
|
530
|
+
If conditions are imposed on you (whether by court order, agreement or
|
|
531
|
+
otherwise) that contradict the conditions of this License, they do not
|
|
532
|
+
excuse you from the conditions of this License. If you cannot convey a
|
|
533
|
+
covered work so as to satisfy simultaneously your obligations under this
|
|
534
|
+
License and any other pertinent obligations, then as a consequence you may
|
|
535
|
+
not convey it at all. For example, if you agree to terms that obligate you
|
|
536
|
+
to collect a royalty for further conveying from those to whom you convey
|
|
537
|
+
the Program, the only way you could satisfy both those terms and this
|
|
538
|
+
License would be to refrain entirely from conveying the Program.
|
|
539
|
+
|
|
540
|
+
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
541
|
+
|
|
542
|
+
Notwithstanding any other provision of this License, if you modify the
|
|
543
|
+
Program, your modified version must prominently offer all users
|
|
544
|
+
interacting with it remotely through a computer network (if your version
|
|
545
|
+
supports such interaction) an opportunity to receive the Corresponding
|
|
546
|
+
Source of your version by providing access to the Corresponding Source
|
|
547
|
+
from a network server at no charge, through some standard or customary
|
|
548
|
+
means of facilitating copying of software. This Corresponding Source
|
|
549
|
+
shall include the Corresponding Source for any work covered by version 3
|
|
550
|
+
of the GNU General Public License that is incorporated pursuant to the
|
|
551
|
+
following paragraph.
|
|
552
|
+
|
|
553
|
+
Notwithstanding any other provision of this License, you have
|
|
554
|
+
permission to link or combine any covered work with a work licensed
|
|
555
|
+
under version 3 of the GNU General Public License into a single
|
|
556
|
+
combined work, and to convey the resulting work. The terms of this
|
|
557
|
+
License will continue to apply to the part which is the covered work,
|
|
558
|
+
but the work with which it is combined will remain governed by version
|
|
559
|
+
3 of the GNU General Public License.
|
|
560
|
+
|
|
561
|
+
14. Revised Versions of this License.
|
|
562
|
+
|
|
563
|
+
The Free Software Foundation may publish revised and/or new versions of
|
|
564
|
+
the GNU Affero General Public License from time to time. Such new versions
|
|
565
|
+
will be similar in spirit to the present version, but may differ in detail to
|
|
566
|
+
address new problems or concerns.
|
|
567
|
+
|
|
568
|
+
Each version is given a distinguishing version number. If the
|
|
569
|
+
Program specifies that a certain numbered version of the GNU Affero General
|
|
570
|
+
Public License "or any later version" applies to it, you have the
|
|
571
|
+
option of following the terms and conditions either of that numbered
|
|
572
|
+
version or of any later version published by the Free Software
|
|
573
|
+
Foundation. If the Program does not specify a version number of the
|
|
574
|
+
GNU Affero General Public License, you may choose any version ever published
|
|
575
|
+
by the Free Software Foundation.
|
|
576
|
+
|
|
577
|
+
If the Program specifies that a proxy can decide which future
|
|
578
|
+
versions of the GNU Affero General Public License can be used, that proxy's
|
|
579
|
+
public statement of acceptance of a version permanently authorizes you
|
|
580
|
+
to choose that version for the Program.
|
|
581
|
+
|
|
582
|
+
Later license versions may give you additional or different
|
|
583
|
+
permissions. However, no additional obligations are imposed on any
|
|
584
|
+
author or copyright holder as a result of your choosing to follow a
|
|
585
|
+
later version.
|
|
586
|
+
|
|
587
|
+
15. Disclaimer of Warranty.
|
|
588
|
+
|
|
589
|
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
590
|
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
591
|
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
592
|
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
593
|
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
594
|
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
595
|
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
596
|
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
597
|
+
|
|
598
|
+
16. Limitation of Liability.
|
|
599
|
+
|
|
600
|
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
601
|
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
602
|
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
603
|
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
604
|
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
605
|
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
606
|
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
607
|
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
608
|
+
SUCH DAMAGES.
|
|
609
|
+
|
|
610
|
+
17. Interpretation of Sections 15 and 16.
|
|
611
|
+
|
|
612
|
+
If the disclaimer of warranty and limitation of liability provided
|
|
613
|
+
above cannot be given local legal effect according to their terms,
|
|
614
|
+
reviewing courts shall apply local law that most closely approximates
|
|
615
|
+
an absolute waiver of all civil liability in connection with the
|
|
616
|
+
Program, unless a warranty or assumption of liability accompanies a
|
|
617
|
+
copy of the Program in return for a fee.
|
|
618
|
+
|
|
619
|
+
END OF TERMS AND CONDITIONS
|
|
620
|
+
|
|
621
|
+
How to Apply These Terms to Your New Programs
|
|
622
|
+
|
|
623
|
+
If you develop a new program, and you want it to be of the greatest
|
|
624
|
+
possible use to the public, the best way to achieve this is to make it
|
|
625
|
+
free software which everyone can redistribute and change under these terms.
|
|
626
|
+
|
|
627
|
+
To do so, attach the following notices to the program. It is safest
|
|
628
|
+
to attach them to the start of each source file to most effectively
|
|
629
|
+
state the exclusion of warranty; and each file should have at least
|
|
630
|
+
the "copyright" line and a pointer to where the full notice is found.
|
|
631
|
+
|
|
632
|
+
<one line to give the program's name and a brief idea of what it does.>
|
|
633
|
+
Copyright (C) <year> <name of author>
|
|
634
|
+
|
|
635
|
+
This program is free software: you can redistribute it and/or modify
|
|
636
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
637
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
638
|
+
(at your option) any later version.
|
|
639
|
+
|
|
640
|
+
This program is distributed in the hope that it will be useful,
|
|
641
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
642
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
643
|
+
GNU Affero General Public License for more details.
|
|
644
|
+
|
|
645
|
+
You should have received a copy of the GNU Affero General Public License
|
|
646
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
647
|
+
|
|
648
|
+
Also add information on how to contact you by electronic and paper mail.
|
|
649
|
+
|
|
650
|
+
If your software can interact with users remotely through a computer
|
|
651
|
+
network, you should also make sure that it provides a way for users to
|
|
652
|
+
get its source. For example, if your program is a web application, its
|
|
653
|
+
interface could display a "Source" link that leads users to an archive
|
|
654
|
+
of the code. There are many ways you could offer source, and different
|
|
655
|
+
solutions will be better for different programs; see section 13 for the
|
|
656
|
+
specific requirements.
|
|
657
|
+
|
|
658
|
+
You should also get your employer (if you work as a programmer) or school,
|
|
659
|
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
660
|
+
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
661
|
+
<https://www.gnu.org/licenses/>.
|
package/README.md
CHANGED
|
@@ -158,25 +158,37 @@ to bind time rather than disappearing.
|
|
|
158
158
|
1. **Your deployment must schedule the poll** (step 4). The connector provides the driver; it
|
|
159
159
|
cannot hold a timer — that is a deployment concern. Without one wired, a binding is inert.
|
|
160
160
|
|
|
161
|
-
2. **The live round-trip is
|
|
162
|
-
|
|
163
|
-
`financialyears`, `sie/4` —
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
2. **The live round-trip is verified**, against a Fortnox test company (2026-09-03), and it
|
|
162
|
+
found two real bugs — see caveat 3. `test/live.test.ts` runs the real API — mint,
|
|
163
|
+
`companyinformation`, `financialyears`, `sie/4` — whenever `secrets/connectors.env` (shared
|
|
164
|
+
by every connector) holds a complete credential, and skips otherwise, so CI without secrets
|
|
165
|
+
stays green. `pnpm fortnox:connect` is what fills that file; `DatabaseNumber` is shown nowhere
|
|
166
|
+
in the Developer Portal, so it cannot be typed by hand.
|
|
167
|
+
|
|
168
|
+
What the live run settled: `grant_type=client_credentials` with a `TenantId` header really does
|
|
169
|
+
mint with no refresh token in the response, and the envelopes really are `FinancialYears` /
|
|
170
|
+
`CompanyInformation`. What it disproved is in caveat 3.
|
|
170
171
|
|
|
171
172
|
`test/live.test.ts` reads only: the data calls are GETs, and the one POST is the token mint,
|
|
172
173
|
which creates no Fortnox record. This connector has no write path to Fortnox at all, so
|
|
173
|
-
running it against a production company cannot damage anything.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
running it against a production company cannot damage anything. Putting test data INTO a
|
|
175
|
+
sandbox is therefore a separate script — `pnpm fortnox:seed` — which refuses any company whose
|
|
176
|
+
organisation number is not Fortnox's sandbox marker `555555-5555`. Note that an empty sandbox
|
|
177
|
+
makes the charset and double-entry assertions silently not run at all, so seed before judging
|
|
178
|
+
a red.
|
|
179
|
+
|
|
180
|
+
3. **SIE4 is PC8 (code page 437) — not latin1, and not UTF-8.** The file says so in `#FORMAT`;
|
|
181
|
+
the HTTP response does not. Decoding as UTF-8 throws on the first Swedish letter, which is the
|
|
182
|
+
*good* failure. Decoding as latin1 is the bad one: every byte 0x00–0xFF is a valid latin1 code
|
|
183
|
+
point, so nothing throws and no replacement character appears — you simply get account names
|
|
184
|
+
with the wrong letters. **This connector shipped that way**, and the whole package stayed green,
|
|
185
|
+
because `FortnoxMock` encoded latin1 too: the reader and the fixture agreed with each other
|
|
186
|
+
while both disagreed with Fortnox. Only the live suite could see it.
|
|
187
|
+
|
|
188
|
+
`decodeSie` (`src/sie4.ts`) owns the charset, reads `#FORMAT`, and refuses one it does not
|
|
189
|
+
implement rather than guessing. `TextDecoder` is no help — CP437 is not in the WHATWG registry,
|
|
190
|
+
and `TextDecoder('iso-8859-1')` is really windows-1252 — so it carries a mapping table for
|
|
191
|
+
0x80–0xFF. `FortnoxMock` now encodes CP437 the way Fortnox does.
|
|
180
192
|
|
|
181
193
|
4. **Pick the financial year by OVERLAP, never containment.** A newly-acquired company's first
|
|
182
194
|
financial year can start mid-month (24 April, say). A search for "the year containing 1 January"
|
|
@@ -196,9 +208,11 @@ to bind time rather than disappearing.
|
|
|
196
208
|
## Testing
|
|
197
209
|
|
|
198
210
|
`FortnoxMock` implements the token endpoint and the three REST reads in memory, so the whole sweep
|
|
199
|
-
runs without a Fortnox account — credential minting,
|
|
211
|
+
runs without a Fortnox account — credential minting, PC8/CP437 decoding, year selection, paging,
|
|
200
212
|
the unchanged-hash skip, and the bind-time grant refusal.
|
|
201
213
|
|
|
202
214
|
**What a mock proves:** that our shape works. **What it cannot prove:** that our reading of
|
|
203
|
-
Fortnox's API is correct — the mock *is* our reading.
|
|
204
|
-
|
|
215
|
+
Fortnox's API is correct — the mock *is* our reading. That is not a hypothetical here: the mock
|
|
216
|
+
encoded the wrong charset for as long as the reader decoded it, and they agreed with each other
|
|
217
|
+
right up until a real call disagreed with both. Green here means *ready to check against a real
|
|
218
|
+
company*, and the checking is `test/live.test.ts`.
|
package/dist/api.d.ts
CHANGED
|
@@ -76,19 +76,11 @@ export declare const fortnoxFinancialYear: z.ZodObject<{
|
|
|
76
76
|
AccountingMethod: z.ZodOptional<z.ZodString>;
|
|
77
77
|
}, z.core.$strip>;
|
|
78
78
|
export type FortnoxFinancialYear = z.infer<typeof fortnoxFinancialYear>;
|
|
79
|
-
/**
|
|
80
|
-
* The company, as `GET /3/companyinformation` returns it.
|
|
81
|
-
*
|
|
82
|
-
* `DatabaseNumber` is the whole reason this endpoint is called: it IS the `TenantId`
|
|
83
|
-
* header value, and it is how a connect flow learns which company the consent it just
|
|
84
|
-
* received belongs to. It is also the cheapest authenticated read Fortnox offers, so
|
|
85
|
-
* it doubles as the credential probe.
|
|
86
|
-
*/
|
|
87
79
|
export declare const fortnoxCompany: z.ZodObject<{
|
|
88
|
-
CompanyName: z.
|
|
89
|
-
OrganizationNumber: z.
|
|
90
|
-
DatabaseNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
91
|
-
CountryCode: z.ZodOptional<z.ZodString
|
|
80
|
+
CompanyName: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>, z.ZodTransform<string, string | null | undefined>>;
|
|
81
|
+
OrganizationNumber: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>, z.ZodTransform<string, string | null | undefined>>;
|
|
82
|
+
DatabaseNumber: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString, z.ZodNull]>>, z.ZodTransform<string | number | undefined, string | number | null | undefined>>;
|
|
83
|
+
CountryCode: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNull]>>, z.ZodTransform<string, string | null | undefined>>;
|
|
92
84
|
}, z.core.$strip>;
|
|
93
85
|
export type FortnoxCompany = z.infer<typeof fortnoxCompany>;
|
|
94
86
|
/**
|
|
@@ -143,11 +135,14 @@ export declare class FortnoxApi {
|
|
|
143
135
|
/**
|
|
144
136
|
* The whole year's bookkeeping as one SIE4 file — the read this connector exists for.
|
|
145
137
|
*
|
|
146
|
-
* **The response is
|
|
147
|
-
*
|
|
148
|
-
* account name, cost-centre label and verification
|
|
149
|
-
* ledger that looks like a working one.
|
|
150
|
-
*
|
|
138
|
+
* **The response is PC8 (code page 437), not UTF-8 and not latin1**, and nothing in
|
|
139
|
+
* the HTTP response says so — only the file's own `#FORMAT` post does. Decoding it
|
|
140
|
+
* wrong mangles every å/ä/ö in every account name, cost-centre label and verification
|
|
141
|
+
* text, which is a corrupted ledger that looks like a working one. Decoding as latin1
|
|
142
|
+
* does not even fail loudly: every byte is a valid latin1 code point, so it produces
|
|
143
|
+
* no replacement character and no throw. That is what shipped here until a live call
|
|
144
|
+
* disproved it. So the bytes are taken as an ArrayBuffer and handed to `decodeSie`,
|
|
145
|
+
* which owns the charset decision for the whole connector.
|
|
151
146
|
*/
|
|
152
147
|
sieFile(financialYearId: number): Promise<string>;
|
|
153
148
|
}
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAShE;;;;;;;;;;;;;GAaG;AAEH,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,qCAAqC,CAAC;AACrE,sDAAsD;AACtD,eAAO,MAAM,gBAAgB,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa;;;;iBAcxB,CAAC;AACH,MAAM,MAAM,aAA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AG,CAAC,EAAE,MAAM,MAAM,CAAA;KAAE,EAMvE;IAED,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IAEnC,OAAO,CAAC,MAAM;IAYd;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC,CA+BnC;IAED,oFAAoF;YACtE,OAAO;IAgBrB,sFAAsF;IAChF,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC,CAKlD;IAED,4FAA4F;IACtF,cAAc,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAGtD;IAED;;;;;;;;;;;OAWG;IACG,OAAO,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBtD;CACF"}
|
package/dist/api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { decodeSie } from './sie4.js';
|
|
2
3
|
/**
|
|
3
4
|
* A thin, typed client over the Fortnox REST API and its OAuth2 token endpoint.
|
|
4
5
|
*
|
|
@@ -93,11 +94,34 @@ export const fortnoxFinancialYear = z.object({
|
|
|
93
94
|
* received belongs to. It is also the cheapest authenticated read Fortnox offers, so
|
|
94
95
|
* it doubles as the credential probe.
|
|
95
96
|
*/
|
|
97
|
+
/**
|
|
98
|
+
* A text field Fortnox may send as an explicit `null`.
|
|
99
|
+
*
|
|
100
|
+
* `.optional()` is not enough, and the difference cost a live failure: it permits an
|
|
101
|
+
* ABSENT key, while Fortnox sends the key with `null` in it for anything the company
|
|
102
|
+
* has not filled in. A sandbox with a blank address answers `CountryCode: null`,
|
|
103
|
+
* `ZipCode: null`, `VisitAddress: null` — verified against api.fortnox.se 2026-09-03 —
|
|
104
|
+
* and the parse threw where the mock, which always sent complete strings, had passed.
|
|
105
|
+
* That is exactly the seam the live suite exists to hold: the mock is our reading of
|
|
106
|
+
* the docs on both sides of the call, so only a real company can disagree with it.
|
|
107
|
+
*
|
|
108
|
+
* Null and absent both mean "not set here", so both become the fallback.
|
|
109
|
+
*/
|
|
110
|
+
const fortnoxText = (fallback = '') => z
|
|
111
|
+
.union([z.string(), z.null()])
|
|
112
|
+
.optional()
|
|
113
|
+
.transform((v) => v ?? fallback);
|
|
96
114
|
export const fortnoxCompany = z.object({
|
|
97
|
-
CompanyName:
|
|
98
|
-
OrganizationNumber:
|
|
99
|
-
|
|
100
|
-
|
|
115
|
+
CompanyName: fortnoxText(),
|
|
116
|
+
OrganizationNumber: fortnoxText(),
|
|
117
|
+
// Normalized to `undefined` rather than kept as `null`, because every caller asks
|
|
118
|
+
// `=== undefined` before stringifying it — and `String(null)` is the tenant id
|
|
119
|
+
// `"null"`, which would key a connection to a company that does not exist.
|
|
120
|
+
DatabaseNumber: z
|
|
121
|
+
.union([z.number(), z.string(), z.null()])
|
|
122
|
+
.optional()
|
|
123
|
+
.transform((v) => v ?? undefined),
|
|
124
|
+
CountryCode: fortnoxText(),
|
|
101
125
|
});
|
|
102
126
|
const tokenResponse = z.object({
|
|
103
127
|
access_token: z.string().min(1),
|
|
@@ -254,11 +278,14 @@ export class FortnoxApi {
|
|
|
254
278
|
/**
|
|
255
279
|
* The whole year's bookkeeping as one SIE4 file — the read this connector exists for.
|
|
256
280
|
*
|
|
257
|
-
* **The response is
|
|
258
|
-
*
|
|
259
|
-
* account name, cost-centre label and verification
|
|
260
|
-
* ledger that looks like a working one.
|
|
261
|
-
*
|
|
281
|
+
* **The response is PC8 (code page 437), not UTF-8 and not latin1**, and nothing in
|
|
282
|
+
* the HTTP response says so — only the file's own `#FORMAT` post does. Decoding it
|
|
283
|
+
* wrong mangles every å/ä/ö in every account name, cost-centre label and verification
|
|
284
|
+
* text, which is a corrupted ledger that looks like a working one. Decoding as latin1
|
|
285
|
+
* does not even fail loudly: every byte is a valid latin1 code point, so it produces
|
|
286
|
+
* no replacement character and no throw. That is what shipped here until a live call
|
|
287
|
+
* disproved it. So the bytes are taken as an ArrayBuffer and handed to `decodeSie`,
|
|
288
|
+
* which owns the charset decision for the whole connector.
|
|
262
289
|
*/
|
|
263
290
|
async sieFile(financialYearId) {
|
|
264
291
|
const token = await this.accessToken();
|
|
@@ -270,7 +297,8 @@ export class FortnoxApi {
|
|
|
270
297
|
const body = await res.text();
|
|
271
298
|
throw new FortnoxApiError(`Fortnox SIE4 export failed: ${errorMessage(body, res.status)}`, res.status, body);
|
|
272
299
|
}
|
|
273
|
-
|
|
300
|
+
// PC8/CP437, not latin1 — see `decodeSie`. Fortnox declares it in `#FORMAT`.
|
|
301
|
+
return decodeSie(await res.arrayBuffer());
|
|
274
302
|
}
|
|
275
303
|
}
|
|
276
304
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAQtC;;;;;;;;;;;;;GAaG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,kCAAkC,CAAC;AACrE,sDAAsD;AACtD,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,sEAAsE;IACtE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,8EAA8E;IAC9E,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC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ACvD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EAAE,EAAE;YAC1D,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;SAC9C,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,eAAe,CACvB,+BAA+B,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,EAC/D,GAAG,CAAC,MAAM,EACV,IAAI,CACL,CAAC;QACJ,CAAC;QACD,6EAA6E;QAC7E,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
package/dist/mock.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ import type { FetchLike } from '@substrat-run/kernel';
|
|
|
4
4
|
* whole sweep without a provider account.
|
|
5
5
|
*
|
|
6
6
|
* **What a mock proves:** that our shape works — the client-credentials mint, the
|
|
7
|
-
*
|
|
7
|
+
* PC8/CP437 decode, the year-overlap pick, the paging, the unchanged-hash skip.
|
|
8
8
|
* **What it cannot prove:** that our reading of Fortnox's API is correct. The mock IS
|
|
9
9
|
* our reading. Green here means *ready to check against a real company*, which is what
|
|
10
10
|
* `test/live.test.ts` does when a credential is present.
|
|
11
11
|
*
|
|
12
12
|
* The one thing it models with real bytes rather than a convenient string is the SIE
|
|
13
|
-
* response: {@link FortnoxMock.sieBytes} encodes to
|
|
13
|
+
* response: {@link FortnoxMock.sieBytes} encodes to PC8/CP437, so a connector that
|
|
14
14
|
* forgot to decode explicitly fails here rather than in production with mangled
|
|
15
15
|
* account names.
|
|
16
16
|
*/
|
|
@@ -33,8 +33,19 @@ export interface FortnoxMockOptions {
|
|
|
33
33
|
/** Seconds a minted token claims to live. */
|
|
34
34
|
expiresIn?: number;
|
|
35
35
|
}
|
|
36
|
-
/**
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Encode to PC8 (code page 437) — the charset a real Fortnox SIE export declares in
|
|
38
|
+
* `#FORMAT` and actually sends.
|
|
39
|
+
*
|
|
40
|
+
* This used to encode ISO-8859-1, and that single wrong premise is what let a wrong
|
|
41
|
+
* decoder pass every test in this package: the mock encoded latin1, the reader decoded
|
|
42
|
+
* latin1, and the two agreed with each other while disagreeing with Fortnox. Only the
|
|
43
|
+
* live suite could see it. Encoding here the way the provider really does is what makes
|
|
44
|
+
* the mock evidence about Fortnox rather than about our own assumption.
|
|
45
|
+
*
|
|
46
|
+
* A code point with no CP437 representation becomes `?`, exactly as Fortnox would.
|
|
47
|
+
*/
|
|
48
|
+
export declare function pc8Bytes(text: string): Uint8Array;
|
|
38
49
|
export declare class FortnoxMock {
|
|
39
50
|
readonly apiBase = "https://api.fortnox.test/3";
|
|
40
51
|
readonly oauthBase = "https://apps.fortnox.test/oauth-v1";
|
package/dist/mock.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAOtD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;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
6
|
-
|
|
1
|
+
import { CP437_HIGH } from './sie4.js';
|
|
2
|
+
/**
|
|
3
|
+
* Encode to PC8 (code page 437) — the charset a real Fortnox SIE export declares in
|
|
4
|
+
* `#FORMAT` and actually sends.
|
|
5
|
+
*
|
|
6
|
+
* This used to encode ISO-8859-1, and that single wrong premise is what let a wrong
|
|
7
|
+
* decoder pass every test in this package: the mock encoded latin1, the reader decoded
|
|
8
|
+
* latin1, and the two agreed with each other while disagreeing with Fortnox. Only the
|
|
9
|
+
* live suite could see it. Encoding here the way the provider really does is what makes
|
|
10
|
+
* the mock evidence about Fortnox rather than about our own assumption.
|
|
11
|
+
*
|
|
12
|
+
* A code point with no CP437 representation becomes `?`, exactly as Fortnox would.
|
|
13
|
+
*/
|
|
14
|
+
export function pc8Bytes(text) {
|
|
15
|
+
// `for...of` iterates CODE POINTS; `text[i]` would hand back UTF-16 code units, so an
|
|
16
|
+
// astral character (an emoji in a voucher text, say) would split into two surrogate
|
|
17
|
+
// halves and emit two `?` bytes where the contract above promises one.
|
|
18
|
+
const out = [];
|
|
19
|
+
for (const ch of text) {
|
|
20
|
+
const code = ch.codePointAt(0) ?? 0x3f;
|
|
21
|
+
if (code < 0x80) {
|
|
22
|
+
out.push(code);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const high = CP437_HIGH.indexOf(ch);
|
|
26
|
+
out.push(high === -1 ? 0x3f : 0x80 + high);
|
|
7
27
|
}
|
|
8
|
-
return out;
|
|
28
|
+
return new Uint8Array(out);
|
|
9
29
|
}
|
|
10
30
|
export class FortnoxMock {
|
|
11
31
|
apiBase = 'https://api.fortnox.test/3';
|
|
@@ -47,7 +67,7 @@ export class FortnoxMock {
|
|
|
47
67
|
ok: status >= 200 && status < 300,
|
|
48
68
|
status,
|
|
49
69
|
text: async () => text,
|
|
50
|
-
arrayBuffer: async () =>
|
|
70
|
+
arrayBuffer: async () => pc8Bytes(text).buffer,
|
|
51
71
|
};
|
|
52
72
|
}
|
|
53
73
|
/** The `fetch` a connector is handed. */
|
|
@@ -97,7 +117,7 @@ export class FortnoxMock {
|
|
|
97
117
|
if (text === undefined) {
|
|
98
118
|
return this.json({ ErrorInformation: { message: 'no such financial year' } }, 404);
|
|
99
119
|
}
|
|
100
|
-
const bytes =
|
|
120
|
+
const bytes = pc8Bytes(text);
|
|
101
121
|
return {
|
|
102
122
|
ok: true,
|
|
103
123
|
status: 200,
|
package/dist/mock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAiCvC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,sFAAsF;IACtF,oFAAoF;IACpF,uEAAuE;IACvE,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,EAAE,IAAI,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QACvC,IAAI,IAAI,GAAG,IAAI,EAAE,CAAC;YAChB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,WAAW;IACb,OAAO,GAAG,4BAA4B,CAAC;IACvC,SAAS,GAAG,oCAAoC,CAAC;IAEzC,QA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AAI,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,QAAQ,GAAG,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7D,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC1B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;YACrF,CAAC;YACD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC7B,OAAO;gBACL,EAAE,EAAE,IAAI;gBACR,MAAM,EAAE,GAAG;gBACX,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI;gBACtB,WAAW,EAAE,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,MAAqB;aACnB,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,EAAE,OAAO,EAAE,iBAAiB,IAAI,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IACpF,CAAC,CAAC;CACH"}
|
package/dist/sie4.d.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* per-voucher REST endpoints.
|
|
5
5
|
*
|
|
6
6
|
* Deliberately a parser over a *text* input, with no I/O of its own: the decoding
|
|
7
|
-
* from
|
|
7
|
+
* from PC8/CP437 happens in {@link decodeSie} below, called at the seam that owns the
|
|
8
|
+
* bytes ({@link FortnoxApi.sieFile}),
|
|
8
9
|
* so this file is pure and testable against a fixture, and a caller reading SIE from
|
|
9
10
|
* somewhere else (an upload, an archive) can use it unchanged.
|
|
10
11
|
*
|
|
@@ -22,6 +23,39 @@
|
|
|
22
23
|
* ignored rather than fatal: SIE files carry vendor extensions, and refusing a
|
|
23
24
|
* file over a post we do not read would break on a Fortnox release that adds one.
|
|
24
25
|
*/
|
|
26
|
+
/**
|
|
27
|
+
* Bytes 0x80–0xFF of code page 437, in order — the half of PC8 that is not ASCII.
|
|
28
|
+
*
|
|
29
|
+
* Generated from the code page, not typed from memory. Only the Swedish letters are
|
|
30
|
+
* load-bearing here (0x84 ä, 0x86 å, 0x8E Ä, 0x8F Å, 0x94 ö, 0x99 Ö), but a partial
|
|
31
|
+
* table would silently mangle everything else, so the whole upper half is present.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CP437_HIGH: string;
|
|
34
|
+
/**
|
|
35
|
+
* Decode a SIE file's bytes, honouring the charset it declares in `#FORMAT`.
|
|
36
|
+
*
|
|
37
|
+
* ## Why this is not `TextDecoder`
|
|
38
|
+
*
|
|
39
|
+
* SIE4 files are **PC8, which is code page 437** — an MS-DOS charset that predates the
|
|
40
|
+
* standard and is NOT in the WHATWG Encoding registry, so `new TextDecoder('cp437')`
|
|
41
|
+
* throws `RangeError` in every runtime. There is no web-standard decoder to reach for,
|
|
42
|
+
* which is why the table above exists rather than an import.
|
|
43
|
+
*
|
|
44
|
+
* ## Why the wrong decoder was invisible
|
|
45
|
+
*
|
|
46
|
+
* This previously decoded as `iso-8859-1`, and nothing complained — twice over. Every
|
|
47
|
+
* byte 0x00–0xFF is a valid latin1 code point, so a mis-decode can never produce U+FFFD
|
|
48
|
+
* and the "no replacement character" check that guarded this could not fail by
|
|
49
|
+
* construction. And `TextDecoder('iso-8859-1')` is really **windows-1252**, so Fortnox's
|
|
50
|
+
* `0x94` ö arrived as `”`. The result was correct-looking Swedish account names with the
|
|
51
|
+
* wrong letters in them — wrong data on a screen, never a throw. Confirmed against
|
|
52
|
+
* api.fortnox.se 2026-09-03, whose export declares `#FORMAT PC8`.
|
|
53
|
+
*
|
|
54
|
+
* A file declaring any other charset is REFUSED rather than decoded on a guess: PC8 is
|
|
55
|
+
* what SIE4 mandates and what every Fortnox export observed so far sends, and a wrong
|
|
56
|
+
* guess is invisible rather than loud.
|
|
57
|
+
*/
|
|
58
|
+
export declare function decodeSie(bytes: ArrayBuffer | Uint8Array): string;
|
|
25
59
|
/** A parsed `#KONTO` — the chart of accounts. */
|
|
26
60
|
export interface SieAccount {
|
|
27
61
|
number: string;
|
package/dist/sie4.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sie4.d.ts","sourceRoot":"","sources":["../src/sie4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"sie4.d.ts","sourceRoot":"","sources":["../src/sie4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,QAQ6E,CAAC;AAErG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,CAuBjE;AAED,iDAAiD;AACjD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uFAAuF;IACvF,MAAM,EAA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
|
6
6
|
* Deliberately a parser over a *text* input, with no I/O of its own: the decoding
|
|
7
|
-
* from
|
|
7
|
+
* from PC8/CP437 happens in {@link decodeSie} below, called at the seam that owns the
|
|
8
|
+
* bytes ({@link FortnoxApi.sieFile}),
|
|
8
9
|
* so this file is pure and testable against a fixture, and a caller reading SIE from
|
|
9
10
|
* somewhere else (an upload, an archive) can use it unchanged.
|
|
10
11
|
*
|
|
@@ -22,6 +23,65 @@
|
|
|
22
23
|
* ignored rather than fatal: SIE files carry vendor extensions, and refusing a
|
|
23
24
|
* file over a post we do not read would break on a Fortnox release that adds one.
|
|
24
25
|
*/
|
|
26
|
+
/**
|
|
27
|
+
* Bytes 0x80–0xFF of code page 437, in order — the half of PC8 that is not ASCII.
|
|
28
|
+
*
|
|
29
|
+
* Generated from the code page, not typed from memory. Only the Swedish letters are
|
|
30
|
+
* load-bearing here (0x84 ä, 0x86 å, 0x8E Ä, 0x8F Å, 0x94 ö, 0x99 Ö), but a partial
|
|
31
|
+
* table would silently mangle everything else, so the whole upper half is present.
|
|
32
|
+
*/
|
|
33
|
+
export const CP437_HIGH = '\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5' +
|
|
34
|
+
'\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00a2\u00a3\u00a5\u20a7\u0192' +
|
|
35
|
+
'\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u2310\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb' +
|
|
36
|
+
'\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510' +
|
|
37
|
+
'\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567' +
|
|
38
|
+
'\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580' +
|
|
39
|
+
'\u03b1\u00df\u0393\u03c0\u03a3\u03c3\u00b5\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u03c6\u03b5\u2229' +
|
|
40
|
+
'\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u00a0';
|
|
41
|
+
/**
|
|
42
|
+
* Decode a SIE file's bytes, honouring the charset it declares in `#FORMAT`.
|
|
43
|
+
*
|
|
44
|
+
* ## Why this is not `TextDecoder`
|
|
45
|
+
*
|
|
46
|
+
* SIE4 files are **PC8, which is code page 437** — an MS-DOS charset that predates the
|
|
47
|
+
* standard and is NOT in the WHATWG Encoding registry, so `new TextDecoder('cp437')`
|
|
48
|
+
* throws `RangeError` in every runtime. There is no web-standard decoder to reach for,
|
|
49
|
+
* which is why the table above exists rather than an import.
|
|
50
|
+
*
|
|
51
|
+
* ## Why the wrong decoder was invisible
|
|
52
|
+
*
|
|
53
|
+
* This previously decoded as `iso-8859-1`, and nothing complained — twice over. Every
|
|
54
|
+
* byte 0x00–0xFF is a valid latin1 code point, so a mis-decode can never produce U+FFFD
|
|
55
|
+
* and the "no replacement character" check that guarded this could not fail by
|
|
56
|
+
* construction. And `TextDecoder('iso-8859-1')` is really **windows-1252**, so Fortnox's
|
|
57
|
+
* `0x94` ö arrived as `”`. The result was correct-looking Swedish account names with the
|
|
58
|
+
* wrong letters in them — wrong data on a screen, never a throw. Confirmed against
|
|
59
|
+
* api.fortnox.se 2026-09-03, whose export declares `#FORMAT PC8`.
|
|
60
|
+
*
|
|
61
|
+
* A file declaring any other charset is REFUSED rather than decoded on a guess: PC8 is
|
|
62
|
+
* what SIE4 mandates and what every Fortnox export observed so far sends, and a wrong
|
|
63
|
+
* guess is invisible rather than loud.
|
|
64
|
+
*/
|
|
65
|
+
export function decodeSie(bytes) {
|
|
66
|
+
const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
67
|
+
// `#FORMAT` is ASCII and sits in the header, so it can be read before the charset is
|
|
68
|
+
// known — the one thing safe to decode without having decided first.
|
|
69
|
+
const header = String.fromCharCode(...view.subarray(0, 512));
|
|
70
|
+
const declared = /^#FORMAT\s+"?([A-Za-z0-9-]+)"?/m.exec(header)?.[1]?.toUpperCase();
|
|
71
|
+
if (declared !== undefined && declared !== 'PC8') {
|
|
72
|
+
// Refusing beats guessing. Reading a charset wrong does not throw anywhere
|
|
73
|
+
// downstream — it yields plausible Swedish account names with the wrong letters,
|
|
74
|
+
// which is precisely the failure that survived a year of green tests here.
|
|
75
|
+
throw new Error(`SIE #FORMAT ${declared} is not supported — this reader implements PC8 (CP437) only`);
|
|
76
|
+
}
|
|
77
|
+
let out = '';
|
|
78
|
+
for (const byte of view) {
|
|
79
|
+
// The index is provably in range (0x00–0x7F took the other branch), so the
|
|
80
|
+
// fallback is unreachable; it is here only because the compiler cannot see that.
|
|
81
|
+
out += byte < 0x80 ? String.fromCharCode(byte) : (CP437_HIGH[byte - 0x80] ?? '\ufffd');
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
25
85
|
/**
|
|
26
86
|
* Split one SIE line into fields, honouring quoting and object lists.
|
|
27
87
|
*
|
package/dist/sie4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sie4.js","sourceRoot":"","sources":["../src/sie4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"sie4.js","sourceRoot":"","sources":["../src/sie4.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GACrB,kGAAkG;IAClG,kGAAkG;IAClG,kGAAkG;IAClG,kGAAkG;IAClG,kGAAkG;IAClG,kGAAkG;IAClG,kGAAkG;IAClG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,CAAC,CAAC;oBACnC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;oBAC5B,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI;oBACnD,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE;oBACrB,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;iBAClD,CAAC,CAAC;gBACH,MAAM;YACR,CAAC;YACD,6EAA6E;YAC7E,6EAA6E;YAC7E,kEAAkE;YAClE;gBACE,MAAM;QACV,CAAC;QACD,KAAK,OAAO,CAAC;IACf,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/connector-fortnox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Substrat connector: Fortnox accounting (Swedish). Reads a company's bookkeeping as SIE4 on a poll and lands it into a scope through the vertical's own operation. Auth is OAuth2 client-credentials against a service consent, so there is no refresh token to rotate. Host code — swept on a ScopeHost, never module code.",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -24,22 +24,22 @@
|
|
|
24
24
|
"default": "./dist/index.js"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsc -p tsconfig.json",
|
|
29
|
-
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
30
|
-
"test": "vitest run"
|
|
31
|
-
},
|
|
32
27
|
"dependencies": {
|
|
33
|
-
"@substrat-run/contracts": "
|
|
34
|
-
"@substrat-run/kernel": "
|
|
28
|
+
"@substrat-run/contracts": "^0.98.1",
|
|
29
|
+
"@substrat-run/kernel": "^0.98.1"
|
|
35
30
|
},
|
|
36
31
|
"devDependencies": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
32
|
+
"typescript": "^7.0.0",
|
|
33
|
+
"vitest": "^3.2.7",
|
|
34
|
+
"zod": "^4.4.3",
|
|
35
|
+
"@substrat-run/adapter-sqlite": "^0.98.1"
|
|
41
36
|
},
|
|
42
37
|
"peerDependencies": {
|
|
43
38
|
"zod": "^4.4.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsc -p tsconfig.json",
|
|
42
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
43
|
+
"test": "vitest run"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|