@ebitex/commerce-sdk 0.1.0 → 0.1.303
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 +201 -201
- package/README.md +34 -34
- package/dist/client.d.ts +21 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +74 -3
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/query.d.ts +7 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +16 -0
- package/dist/query.js.map +1 -1
- package/dist/types.d.ts +72 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +39 -39
package/LICENSE
CHANGED
|
@@ -1,201 +1,201 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# @ebitex/commerce-sdk
|
|
2
|
-
|
|
3
|
-
A client for the ebitex Commerce Delivery API. It reads a store's catalogue (products, prices, availability and categories) and its live stock, from a server or a browser, with no runtime dependencies.
|
|
4
|
-
|
|
5
|
-
```ts
|
|
6
|
-
import { createCommerceClient } from '@ebitex/commerce-sdk'
|
|
7
|
-
|
|
8
|
-
const commerce = createCommerceClient({ apiKey: 'ebx_your_key' })
|
|
9
|
-
|
|
10
|
-
const store = await commerce.store()
|
|
11
|
-
const page = await commerce.products({ search: 'trail', limit: 12 })
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
A key restricted to your site's origins is browser-safe and may be shipped to a browser. A key with no restriction is a server key: keep it on a server.
|
|
15
|
-
|
|
16
|
-
## Prices
|
|
17
|
-
|
|
18
|
-
A price is whole minor units beside a currency (`amountMinor`, `currency`) and the same amount as the store's own decimal string (`amount`). Show `amount`; do arithmetic on `amountMinor`. A variant with no price has `price: null`: unpriced, which is not free.
|
|
19
|
-
|
|
20
|
-
## Availability and stock
|
|
21
|
-
|
|
22
|
-
Product reads carry each variant's `availability` (`inStock`, `backorder` or `outOfStock`), up to a few minutes old, for display. `stock(skus)` is never cached and is the authority to confirm against before you take an order. A server key is told counts (`available`); a browser-safe key only if the store allows it, and otherwise `available` is absent from every item.
|
|
23
|
-
|
|
24
|
-
## Paging
|
|
25
|
-
|
|
26
|
-
`eachPage()` and `eachProduct()` capture the query once and replay it unchanged with each cursor, because a cursor belongs to the query that produced it.
|
|
27
|
-
|
|
28
|
-
## Errors
|
|
29
|
-
|
|
30
|
-
A non-success response throws `CommerceApiError` with `status`, `code` (`invalid_cursor`, `rate_limited`, …), `requestId` (quote it to support) and, on a `429`, `retryAfterSeconds`. A product that is not available is `null` from `product()`, not an error, unless you pass `throwIfMissing`. A request the client refuses to send (a limit of zero, more than 50 keys) throws the same error with `local: true` and the server's own code. A network failure is a `CommerceNetworkError` that keeps its cause and never puts the URL in its message.
|
|
31
|
-
|
|
32
|
-
## Licence
|
|
33
|
-
|
|
34
|
-
Apache-2.0.
|
|
1
|
+
# @ebitex/commerce-sdk
|
|
2
|
+
|
|
3
|
+
A client for the ebitex Commerce Delivery API. It reads a store's catalogue (products, prices, availability and categories) and its live stock, from a server or a browser, with no runtime dependencies.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createCommerceClient } from '@ebitex/commerce-sdk'
|
|
7
|
+
|
|
8
|
+
const commerce = createCommerceClient({ apiKey: 'ebx_your_key' })
|
|
9
|
+
|
|
10
|
+
const store = await commerce.store()
|
|
11
|
+
const page = await commerce.products({ search: 'trail', limit: 12 })
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
A key restricted to your site's origins is browser-safe and may be shipped to a browser. A key with no restriction is a server key: keep it on a server.
|
|
15
|
+
|
|
16
|
+
## Prices
|
|
17
|
+
|
|
18
|
+
A price is whole minor units beside a currency (`amountMinor`, `currency`) and the same amount as the store's own decimal string (`amount`). Show `amount`; do arithmetic on `amountMinor`. A variant with no price has `price: null`: unpriced, which is not free.
|
|
19
|
+
|
|
20
|
+
## Availability and stock
|
|
21
|
+
|
|
22
|
+
Product reads carry each variant's `availability` (`inStock`, `backorder` or `outOfStock`), up to a few minutes old, for display. `stock(skus)` is never cached and is the authority to confirm against before you take an order. A server key is told counts (`available`); a browser-safe key only if the store allows it, and otherwise `available` is absent from every item.
|
|
23
|
+
|
|
24
|
+
## Paging
|
|
25
|
+
|
|
26
|
+
`eachPage()` and `eachProduct()` capture the query once and replay it unchanged with each cursor, because a cursor belongs to the query that produced it.
|
|
27
|
+
|
|
28
|
+
## Errors
|
|
29
|
+
|
|
30
|
+
A non-success response throws `CommerceApiError` with `status`, `code` (`invalid_cursor`, `rate_limited`, …), `requestId` (quote it to support) and, on a `429`, `retryAfterSeconds`. A product that is not available is `null` from `product()`, not an error, unless you pass `throwIfMissing`. A request the client refuses to send (a limit of zero, more than 50 keys) throws the same error with `local: true` and the server's own code. A network failure is a `CommerceNetworkError` that keeps its cause and never puts the URL in its message.
|
|
31
|
+
|
|
32
|
+
## Licence
|
|
33
|
+
|
|
34
|
+
Apache-2.0.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CategoryList, Product, ProductBatch, ProductResponse, ProductsPage, ProductsQuery, StockResult, StoreInfo } from './types.js';
|
|
1
|
+
import type { Cart, CategoryList, CreateCartInput, Product, ProductBatch, ProductResponse, ProductsPage, ProductsQuery, SetAddressInput, StockResult, StoreInfo } from './types.js';
|
|
2
2
|
export declare const DEFAULT_BASE_URL = "https://api.ebitex.io";
|
|
3
3
|
export interface CommerceClientOptions {
|
|
4
4
|
/** A delivery key bound to one store. A server key may be told stock counts and must never reach a browser; a browser-safe key is restricted to origins or addresses. */
|
|
@@ -11,6 +11,10 @@ export interface CommerceClientOptions {
|
|
|
11
11
|
export interface CallOptions {
|
|
12
12
|
signal?: AbortSignal;
|
|
13
13
|
}
|
|
14
|
+
/** Cart calls name the shopper: their visitor token, from the visitors SDK or your own server. It is sent as `X-Visitor-Token` and is never part of a URL. */
|
|
15
|
+
export interface CartCallOptions extends CallOptions {
|
|
16
|
+
visitorToken: string;
|
|
17
|
+
}
|
|
14
18
|
export interface CommerceClient {
|
|
15
19
|
/** The store this key reads: its key, name, currency and whether its prices include tax. */
|
|
16
20
|
store(options?: CallOptions): Promise<StoreInfo>;
|
|
@@ -25,10 +29,12 @@ export interface CommerceClient {
|
|
|
25
29
|
/** One product, or `null` when there is none available to this key. `throwIfMissing` makes that an error. */
|
|
26
30
|
product<A = Record<string, unknown>>(key: string, options?: CallOptions & {
|
|
27
31
|
throwIfMissing?: boolean;
|
|
32
|
+
currency?: string;
|
|
28
33
|
}): Promise<Product<A> | null>;
|
|
29
34
|
/** The primitive under `product`: keeps the `ETag`, and sends `If-None-Match` when given, so an unchanged product is `notModified`. */
|
|
30
35
|
productResponse<A = Record<string, unknown>>(key: string, options?: CallOptions & {
|
|
31
36
|
ifNoneMatch?: string;
|
|
37
|
+
currency?: string;
|
|
32
38
|
}): Promise<ProductResponse<A>>;
|
|
33
39
|
/** The categories the store's products use. */
|
|
34
40
|
categories(options?: CallOptions): Promise<CategoryList>;
|
|
@@ -37,6 +43,20 @@ export interface CommerceClient {
|
|
|
37
43
|
* Counts appear only when the key may see them; see `StockItem.available`. Budgeted tighter than the other reads, so call it when you need it, not on every render.
|
|
38
44
|
*/
|
|
39
45
|
stock(skus: readonly string[], options?: CallOptions): Promise<StockResult>;
|
|
46
|
+
/** Creates an empty cart for the shopper. Its currency (one the store sells in) is fixed for its life. */
|
|
47
|
+
createCart(input: CreateCartInput | undefined, options: CartCallOptions): Promise<Cart>;
|
|
48
|
+
/** The cart with every price and total worked out now, or `null` when it is not this shopper's or does not exist. `throwIfMissing` makes that an error. */
|
|
49
|
+
cart(id: string, options: CartCallOptions & {
|
|
50
|
+
throwIfMissing?: boolean;
|
|
51
|
+
}): Promise<Cart | null>;
|
|
52
|
+
/** Sets one SKU's quantity: 1 to 99 adds or changes the line, 0 removes it. Returns the whole cart. */
|
|
53
|
+
setCartLine(id: string, sku: string, quantity: number, options: CartCallOptions): Promise<Cart>;
|
|
54
|
+
/** Sets the delivery and/or billing address: present replaces (`null` clears), absent is left alone. Returns the whole cart. */
|
|
55
|
+
setCartAddress(id: string, addresses: SetAddressInput, options: CartCallOptions): Promise<Cart>;
|
|
56
|
+
/** Replaces the cart's promotion codes. They are recorded and change no price in this release. Returns the whole cart. */
|
|
57
|
+
setCartPromotionCodes(id: string, codes: readonly string[], options: CartCallOptions): Promise<Cart>;
|
|
58
|
+
/** Deletes the cart. */
|
|
59
|
+
deleteCart(id: string, options: CartCallOptions): Promise<void>;
|
|
40
60
|
}
|
|
41
61
|
export declare function createCommerceClient(options: CommerceClientOptions): CommerceClient;
|
|
42
62
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,IAAI,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;IAC3J,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG;QAAE,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IAC/F,uGAAuG;IACvG,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/F,gIAAgI;IAChI,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/F,0HAA0H;IAC1H,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACpG,wBAAwB;IACxB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CA8HnF"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommerceApiError, CommerceNetworkError } from './errors.js';
|
|
2
|
-
import { buildKeysQuery, buildProductsQuery } from './query.js';
|
|
2
|
+
import { buildCurrencyQuery, buildKeysQuery, buildProductsQuery, Limits } from './query.js';
|
|
3
3
|
export const DEFAULT_BASE_URL = 'https://api.ebitex.io';
|
|
4
4
|
const ROOT = '/commerce/delivery/v1';
|
|
5
5
|
export function createCommerceClient(options) {
|
|
@@ -11,9 +11,13 @@ export function createCommerceClient(options) {
|
|
|
11
11
|
const headers = { Authorization: `Bearer ${options.apiKey}`, Accept: 'application/json' };
|
|
12
12
|
if (init.ifNoneMatch)
|
|
13
13
|
headers['If-None-Match'] = init.ifNoneMatch;
|
|
14
|
+
if (init.visitorToken)
|
|
15
|
+
headers['X-Visitor-Token'] = init.visitorToken;
|
|
16
|
+
if (init.body !== undefined)
|
|
17
|
+
headers['Content-Type'] = 'application/json';
|
|
14
18
|
const url = `${base}${ROOT}${path}${query ? `?${query}` : ''}`;
|
|
15
19
|
try {
|
|
16
|
-
return await doFetch(url, { method: 'GET', headers, signal: init.signal });
|
|
20
|
+
return await doFetch(url, { method: init.method ?? 'GET', headers, signal: init.signal, body: init.body === undefined ? undefined : JSON.stringify(init.body) });
|
|
17
21
|
}
|
|
18
22
|
catch (cause) {
|
|
19
23
|
if (cause instanceof DOMException && cause.name === 'AbortError')
|
|
@@ -44,7 +48,7 @@ export function createCommerceClient(options) {
|
|
|
44
48
|
async function productResponse(key, opts = {}) {
|
|
45
49
|
if (!key)
|
|
46
50
|
throw new CommerceApiError(400, 'invalid_keys', 'A product key is required.', null, null, true);
|
|
47
|
-
const response = await send(`/products/${encodeURIComponent(key)}`,
|
|
51
|
+
const response = await send(`/products/${encodeURIComponent(key)}`, buildCurrencyQuery(opts.currency), opts);
|
|
48
52
|
const etag = response.headers.get('ETag');
|
|
49
53
|
if (response.status === 304)
|
|
50
54
|
return { status: 'notModified', etag };
|
|
@@ -76,8 +80,75 @@ export function createCommerceClient(options) {
|
|
|
76
80
|
productResponse,
|
|
77
81
|
categories: async (call) => json(await send('/categories', '', call)),
|
|
78
82
|
stock: async (skus, call) => json(await send('/stock', buildKeysQuery(skus, 'SKUs'), call)),
|
|
83
|
+
async createCart(input, call) {
|
|
84
|
+
requireToken(call);
|
|
85
|
+
const currency = input?.currency === undefined ? undefined : buildCurrencyQuery(input.currency).slice('currency='.length);
|
|
86
|
+
return json(await send('/carts', '', { ...call, method: 'POST', body: currency === undefined ? {} : { currency } }));
|
|
87
|
+
},
|
|
88
|
+
async cart(id, call) {
|
|
89
|
+
requireToken(call);
|
|
90
|
+
const response = await send(`/carts/${requireId(id)}`, '', call);
|
|
91
|
+
if (response.ok)
|
|
92
|
+
return (await response.json());
|
|
93
|
+
const error = await toError(response);
|
|
94
|
+
if (response.status === 404 && error.code === 'cart_not_found') {
|
|
95
|
+
if (call.throwIfMissing)
|
|
96
|
+
throw error;
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
throw error;
|
|
100
|
+
},
|
|
101
|
+
async setCartLine(id, sku, quantity, call) {
|
|
102
|
+
requireToken(call);
|
|
103
|
+
const trimmed = sku?.trim();
|
|
104
|
+
if (!trimmed)
|
|
105
|
+
throw new CommerceApiError(400, 'invalid_request', 'A line is a SKU and a quantity.', null, null, true);
|
|
106
|
+
if (!Number.isInteger(quantity) || quantity < 0 || quantity > Limits.maxCartQuantity) {
|
|
107
|
+
throw new CommerceApiError(400, 'invalid_quantity', `A quantity is 1 to ${Limits.maxCartQuantity}, or 0 to remove the line.`, null, null, true);
|
|
108
|
+
}
|
|
109
|
+
return json(await send(`/carts/${requireId(id)}/lines`, '', { ...call, method: 'PUT', body: { sku: trimmed, quantity } }));
|
|
110
|
+
},
|
|
111
|
+
async setCartAddress(id, addresses, call) {
|
|
112
|
+
requireToken(call);
|
|
113
|
+
const body = {};
|
|
114
|
+
for (const part of ['delivery', 'billing']) {
|
|
115
|
+
const value = addresses[part];
|
|
116
|
+
if (value === undefined)
|
|
117
|
+
continue;
|
|
118
|
+
if (value !== null && !/^[A-Za-z]{2}$/.test(value.country ?? '')) {
|
|
119
|
+
throw new CommerceApiError(400, 'invalid_address', 'A country is a two-letter ISO 3166 code, such as GB.', null, null, true);
|
|
120
|
+
}
|
|
121
|
+
body[part] = value;
|
|
122
|
+
}
|
|
123
|
+
if (Object.keys(body).length === 0)
|
|
124
|
+
throw new CommerceApiError(400, 'invalid_request', 'Send a delivery and/or a billing address (null clears one).', null, null, true);
|
|
125
|
+
return json(await send(`/carts/${requireId(id)}/address`, '', { ...call, method: 'PUT', body }));
|
|
126
|
+
},
|
|
127
|
+
async setCartPromotionCodes(id, codes, call) {
|
|
128
|
+
requireToken(call);
|
|
129
|
+
if (codes.length > Limits.maxPromotionCodes || codes.some((c) => c.trim().length > Limits.maxPromotionCodeLength)) {
|
|
130
|
+
throw new CommerceApiError(400, 'invalid_promotion_codes', `At most ${Limits.maxPromotionCodes} codes of at most ${Limits.maxPromotionCodeLength} characters.`, null, null, true);
|
|
131
|
+
}
|
|
132
|
+
return json(await send(`/carts/${requireId(id)}/promotion-codes`, '', { ...call, method: 'PUT', body: { codes } }));
|
|
133
|
+
},
|
|
134
|
+
async deleteCart(id, call) {
|
|
135
|
+
requireToken(call);
|
|
136
|
+
const response = await send(`/carts/${requireId(id)}`, '', { ...call, method: 'DELETE' });
|
|
137
|
+
if (!response.ok)
|
|
138
|
+
throw await toError(response);
|
|
139
|
+
},
|
|
79
140
|
};
|
|
80
141
|
}
|
|
142
|
+
/** A cart call without the shopper's token is refused here, with the code the server would answer, rather than sent. */
|
|
143
|
+
function requireToken(call) {
|
|
144
|
+
if (!call?.visitorToken)
|
|
145
|
+
throw new CommerceApiError(401, 'visitor_token_required', 'Send the shopper’s visitor token as visitorToken.', null, null, true);
|
|
146
|
+
}
|
|
147
|
+
function requireId(id) {
|
|
148
|
+
if (!id)
|
|
149
|
+
throw new CommerceApiError(400, 'invalid_request', 'A cart id is required.', null, null, true);
|
|
150
|
+
return encodeURIComponent(id);
|
|
151
|
+
}
|
|
81
152
|
async function toError(response) {
|
|
82
153
|
const requestId = response.headers.get('X-Request-Id');
|
|
83
154
|
const retryAfter = Number(response.headers.get('Retry-After'));
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"client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C,IAAI,EAAE,CAAgE,CAAA;QACnG,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;YAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;QACrD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC5E,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ;YAAE,aAAa,GAAG,IAAI,CAAC,SAAS,CAAA;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,+FAA+F;IACjG,CAAC;IACD,OAAO,IAAI,gBAAgB,CACzB,QAAQ,CAAC,MAAM,EACf,IAAI,EACJ,OAAO,EACP,SAAS,IAAI,aAAa,EAC1B,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CACvF,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { createCommerceClient, DEFAULT_BASE_URL } from './client.js';
|
|
2
|
-
export type { CallOptions, CommerceClient, CommerceClientOptions } from './client.js';
|
|
2
|
+
export type { CallOptions, CartCallOptions, CommerceClient, CommerceClientOptions } from './client.js';
|
|
3
3
|
export { CommerceApiError, CommerceNetworkError } from './errors.js';
|
|
4
|
-
export { buildKeysQuery, buildProductsQuery, Limits } from './query.js';
|
|
5
|
-
export type { Availability, Category, CategoryList, MediaReference, Money, OptionAxis, Product, ProductBatch, ProductResponse, ProductSort, ProductsPage, ProductsQuery, StockItem, StockResult, StoreInfo, Variant, } from './types.js';
|
|
4
|
+
export { buildCurrencyQuery, buildKeysQuery, buildProductsQuery, Limits, normalizeCurrency } from './query.js';
|
|
5
|
+
export type { Address, Availability, Cart, CartLine, CartMoney, CartShipping, CartTotals, Category, CategoryList, CreateCartInput, MediaReference, Money, OptionAxis, Product, ProductBatch, ProductResponse, ProductSort, ProductsPage, ProductsQuery, SetAddressInput, StockItem, StockResult, StoreInfo, Variant, } from './types.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACpE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACpE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACtG,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9G,YAAY,EACV,OAAO,EACP,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,cAAc,EACd,KAAK,EACL,UAAU,EACV,OAAO,EACP,YAAY,EACZ,eAAe,EACf,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,SAAS,EACT,WAAW,EACX,SAAS,EACT,OAAO,GACR,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { createCommerceClient, DEFAULT_BASE_URL } from './client.js';
|
|
2
2
|
export { CommerceApiError, CommerceNetworkError } from './errors.js';
|
|
3
|
-
export { buildKeysQuery, buildProductsQuery, Limits } from './query.js';
|
|
3
|
+
export { buildCurrencyQuery, buildKeysQuery, buildProductsQuery, Limits, normalizeCurrency } from './query.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/query.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export declare const Limits: {
|
|
|
4
4
|
readonly maxPageSize: 100;
|
|
5
5
|
readonly maxBatchKeys: 50;
|
|
6
6
|
readonly maxSearch: 100;
|
|
7
|
+
readonly maxCartQuantity: 99;
|
|
8
|
+
readonly maxPromotionCodes: 10;
|
|
9
|
+
readonly maxPromotionCodeLength: 64;
|
|
7
10
|
};
|
|
8
11
|
/**
|
|
9
12
|
* `encodeURIComponent` leaves `! ' ( ) *` alone; RFC 3986 percent-encoding, which the .NET client uses, does not. Escaping them here makes the two
|
|
@@ -17,4 +20,8 @@ export declare function encode(value: string): string;
|
|
|
17
20
|
export declare function buildProductsQuery(query?: ProductsQuery): string;
|
|
18
21
|
/** The query string for reading products by key (a batch) or stock by SKU: one to fifty comma-separated values. */
|
|
19
22
|
export declare function buildKeysQuery(keys: readonly string[], what?: 'product keys' | 'SKUs'): string;
|
|
23
|
+
/** An ISO 4217 code in upper case, or a local `invalid_currency`. Whether the store sells in it is the server's to say. */
|
|
24
|
+
export declare function normalizeCurrency(currency: string): string;
|
|
25
|
+
/** `currency=EUR`, or an empty string for no currency: the query string of a single-product read. */
|
|
26
|
+
export declare function buildCurrencyQuery(currency?: string): string;
|
|
20
27
|
//# sourceMappingURL=query.d.ts.map
|
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,YAAY,CAAA;AAE5D,oHAAoH;AACpH,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,YAAY,CAAA;AAE5D,oHAAoH;AACpH,eAAO,MAAM,MAAM;;;;;;;CAOT,CAAA;AAMV;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,GAAE,aAAkB,GAAG,MAAM,CA6BpE;AAED,mHAAmH;AACnH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,GAAE,cAAc,GAAG,MAAuB,GAAG,MAAM,CAQ9G;AAED,2HAA2H;AAC3H,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAI1D;AAED,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
package/dist/query.js
CHANGED
|
@@ -4,6 +4,9 @@ export const Limits = {
|
|
|
4
4
|
maxPageSize: 100,
|
|
5
5
|
maxBatchKeys: 50,
|
|
6
6
|
maxSearch: 100,
|
|
7
|
+
maxCartQuantity: 99,
|
|
8
|
+
maxPromotionCodes: 10,
|
|
9
|
+
maxPromotionCodeLength: 64,
|
|
7
10
|
};
|
|
8
11
|
const SORTS = ['name', 'createdUtc'];
|
|
9
12
|
const local = (code, message) => new CommerceApiError(400, code, message, null, null, true);
|
|
@@ -40,6 +43,8 @@ export function buildProductsQuery(query = {}) {
|
|
|
40
43
|
}
|
|
41
44
|
parts.push(`limit=${query.limit}`);
|
|
42
45
|
}
|
|
46
|
+
if (query.currency !== undefined)
|
|
47
|
+
parts.push(`currency=${normalizeCurrency(query.currency)}`);
|
|
43
48
|
if (query.cursor)
|
|
44
49
|
parts.push(`cursor=${encode(query.cursor)}`);
|
|
45
50
|
return parts.join('&');
|
|
@@ -55,4 +60,15 @@ export function buildKeysQuery(keys, what = 'product keys') {
|
|
|
55
60
|
}
|
|
56
61
|
return `keys=${keys.map(encode).join(',')}`;
|
|
57
62
|
}
|
|
63
|
+
/** An ISO 4217 code in upper case, or a local `invalid_currency`. Whether the store sells in it is the server's to say. */
|
|
64
|
+
export function normalizeCurrency(currency) {
|
|
65
|
+
const code = currency.trim().toUpperCase();
|
|
66
|
+
if (!/^[A-Z]{3}$/.test(code))
|
|
67
|
+
throw local('invalid_currency', 'currency is a three-letter ISO 4217 code, such as EUR.');
|
|
68
|
+
return code;
|
|
69
|
+
}
|
|
70
|
+
/** `currency=EUR`, or an empty string for no currency: the query string of a single-product read. */
|
|
71
|
+
export function buildCurrencyQuery(currency) {
|
|
72
|
+
return currency === undefined ? '' : `currency=${normalizeCurrency(currency)}`;
|
|
73
|
+
}
|
|
58
74
|
//# sourceMappingURL=query.js.map
|
package/dist/query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","s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
|
|
66
66
|
export interface StoreInfo {
|
|
67
67
|
key: string;
|
|
68
68
|
name: string;
|
|
69
|
+
/** The store's own currency. */
|
|
69
70
|
currency: string;
|
|
70
71
|
pricesIncludeTax: boolean;
|
|
72
|
+
/** Every currency the store sells in, its own first: what `currency` accepts on a read or a cart. */
|
|
73
|
+
currencies: string[];
|
|
71
74
|
}
|
|
72
75
|
export interface StockItem {
|
|
73
76
|
sku: string;
|
|
@@ -92,6 +95,8 @@ export interface ProductsQuery {
|
|
|
92
95
|
sort?: ProductSort;
|
|
93
96
|
/** 1 to 100; the server's default is 25. */
|
|
94
97
|
limit?: number;
|
|
98
|
+
/** An ISO 4217 code the store sells in (see `StoreInfo.currencies`); prices come back in it. The store's own currency by default. */
|
|
99
|
+
currency?: string;
|
|
95
100
|
/** The `nextCursor` of the previous page, replayed with exactly the same other parameters. */
|
|
96
101
|
cursor?: string;
|
|
97
102
|
}
|
|
@@ -105,4 +110,71 @@ export type ProductResponse<A = Record<string, unknown>> = {
|
|
|
105
110
|
} | {
|
|
106
111
|
status: 'missing';
|
|
107
112
|
};
|
|
113
|
+
/** Where an order goes, or is billed to. The country (a two-letter ISO 3166 code) is what tax and shipping are worked out from. */
|
|
114
|
+
export interface Address {
|
|
115
|
+
country: string;
|
|
116
|
+
region?: string | null;
|
|
117
|
+
postalCode?: string | null;
|
|
118
|
+
}
|
|
119
|
+
/** Money in a cart's currency. A cart's amounts are always shown from `amount`; do arithmetic on `amountMinor`. */
|
|
120
|
+
export interface CartMoney {
|
|
121
|
+
amountMinor: number;
|
|
122
|
+
currency: string;
|
|
123
|
+
amount: string;
|
|
124
|
+
}
|
|
125
|
+
export interface CartLine {
|
|
126
|
+
sku: string;
|
|
127
|
+
productKey: string;
|
|
128
|
+
name: string;
|
|
129
|
+
options: Record<string, string>;
|
|
130
|
+
quantity: number;
|
|
131
|
+
/** Absent on a line with an `issue`. */
|
|
132
|
+
unit?: CartMoney;
|
|
133
|
+
amount?: CartMoney;
|
|
134
|
+
availability?: Availability;
|
|
135
|
+
/** Present only when the key may see counts (as for `stock()`). */
|
|
136
|
+
available?: number;
|
|
137
|
+
/** `unavailable` (no longer sold here) or `unpriced`: the line contributes nothing to the totals. */
|
|
138
|
+
issue?: 'unavailable' | 'unpriced';
|
|
139
|
+
taxPercent?: number;
|
|
140
|
+
taxName?: string;
|
|
141
|
+
/** True when the price was converted from the store's own currency rather than set for this one. */
|
|
142
|
+
converted: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface CartShipping {
|
|
145
|
+
/** `not_needed`, `needs_address`, `unavailable` (the store cannot ship there in this currency) or `ok`. */
|
|
146
|
+
status: 'not_needed' | 'needs_address' | 'unavailable' | 'ok';
|
|
147
|
+
name?: string;
|
|
148
|
+
amount?: CartMoney;
|
|
149
|
+
}
|
|
150
|
+
export interface CartTotals {
|
|
151
|
+
pricesIncludeTax: boolean;
|
|
152
|
+
/** False until there is an address a rate applies to; `net` and `tax` are absent, not zero, until then. */
|
|
153
|
+
taxCalculated: boolean;
|
|
154
|
+
items: CartMoney;
|
|
155
|
+
net?: CartMoney;
|
|
156
|
+
tax?: CartMoney;
|
|
157
|
+
/** Always present for a store whose prices include tax; for one whose prices do not, only once tax is calculated. */
|
|
158
|
+
total?: CartMoney;
|
|
159
|
+
}
|
|
160
|
+
export interface Cart {
|
|
161
|
+
id: string;
|
|
162
|
+
currency: string;
|
|
163
|
+
deliveryAddress?: Address;
|
|
164
|
+
billingAddress?: Address;
|
|
165
|
+
promotionCodes: string[];
|
|
166
|
+
lines: CartLine[];
|
|
167
|
+
shipping: CartShipping;
|
|
168
|
+
totals: CartTotals;
|
|
169
|
+
updatedUtc: string;
|
|
170
|
+
}
|
|
171
|
+
export interface CreateCartInput {
|
|
172
|
+
/** One the store sells in; the store's own by default. Fixed for the cart's life. */
|
|
173
|
+
currency?: string;
|
|
174
|
+
}
|
|
175
|
+
/** A property that is present replaces that address (`null` clears it); one that is absent is left alone. */
|
|
176
|
+
export interface SetAddressInput {
|
|
177
|
+
delivery?: Address | null;
|
|
178
|
+
billing?: Address | null;
|
|
179
|
+
}
|
|
108
180
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,CAAA;AAEjE,gJAAgJ;AAChJ,MAAM,WAAW,KAAK;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,8IAA8I;IAC9I,MAAM,EAAE,MAAM,CAAA;IACd,0EAA0E;IAC1E,WAAW,EAAE,OAAO,CAAA;IACpB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,oGAAoG;IACpG,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,uFAAuF;IACvF,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,0FAA0F;AAC1F,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,2FAA2F;AAC3F,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IA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ce Delivery API: read a store's catalogue (products, prices, availability, categories) and live stock, for a server or a browser.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"ebitex",
|
|
7
|
-
"commerce",
|
|
8
|
-
"catalogue",
|
|
9
|
-
"headless-commerce",
|
|
10
|
-
"delivery-api"
|
|
11
|
-
],
|
|
12
|
-
"license": "Apache-2.0",
|
|
13
|
-
"homepage": "https://developers.ebitex.io/reference/commerce-sdk/",
|
|
14
|
-
"type": "module",
|
|
15
|
-
"sideEffects": false,
|
|
16
|
-
"files": [
|
|
17
|
-
"dist"
|
|
18
|
-
],
|
|
19
|
-
"exports": {
|
|
20
|
-
".": {
|
|
21
|
-
"types": "./dist/index.d.ts",
|
|
22
|
-
"import": "./dist/index.js"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
},
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "tsc -p tsconfig.build.json",
|
|
30
|
-
"lint": "oxlint",
|
|
31
|
-
"test": "vitest run"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/node": "^24.0.0",
|
|
35
|
-
"oxlint": "^1.71.0",
|
|
36
|
-
"typescript": "~6.0.2",
|
|
37
|
-
"vitest": "^4.1.10"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@ebitex/commerce-sdk",
|
|
3
|
+
"version": "0.1.303",
|
|
4
|
+
"description": "The client for the ebitex Commerce Delivery API: read a store's catalogue (products, prices, availability, categories) and live stock, for a server or a browser.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ebitex",
|
|
7
|
+
"commerce",
|
|
8
|
+
"catalogue",
|
|
9
|
+
"headless-commerce",
|
|
10
|
+
"delivery-api"
|
|
11
|
+
],
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
|
+
"homepage": "https://developers.ebitex.io/reference/commerce-sdk/",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc -p tsconfig.build.json",
|
|
30
|
+
"lint": "oxlint",
|
|
31
|
+
"test": "vitest run"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^24.0.0",
|
|
35
|
+
"oxlint": "^1.71.0",
|
|
36
|
+
"typescript": "~6.0.2",
|
|
37
|
+
"vitest": "^4.1.10"
|
|
38
|
+
}
|
|
39
|
+
}
|