rutter-ts 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.cjs +35 -16
- package/dist/api.d.cts +4 -1
- package/dist/api.d.ts +4 -1
- package/dist/api.js +34 -15
- package/package.json +1 -1
package/dist/api.cjs
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkLPP3MIOV_cjs = require('./chunk-LPP3MIOV.cjs');
|
|
4
4
|
var chunkJCJXW7AE_cjs = require('./chunk-JCJXW7AE.cjs');
|
|
5
|
-
var
|
|
5
|
+
var z2 = require('zod');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var z2__default = /*#__PURE__*/_interopDefault(z2);
|
|
10
10
|
|
|
11
11
|
var zGetAccessTokenConnectionResponse2 = chunkJCJXW7AE_cjs.zGetAccessTokenConnectionResponse.extend({
|
|
12
12
|
connection: chunkJCJXW7AE_cjs.zGetAccessTokenConnectionResponse.shape.connection.extend({
|
|
13
|
-
initial_orders_synced_count:
|
|
14
|
-
disabled_reason:
|
|
13
|
+
initial_orders_synced_count: z2__default.default.number().nullish(),
|
|
14
|
+
disabled_reason: z2__default.default.string().nullish()
|
|
15
15
|
})
|
|
16
16
|
});
|
|
17
17
|
var RutterConnectionsApi = class {
|
|
@@ -28,7 +28,7 @@ var RutterConnectionsApi = class {
|
|
|
28
28
|
if (!result.success) {
|
|
29
29
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
30
30
|
endpoint,
|
|
31
|
-
|
|
31
|
+
z2__default.default.prettifyError(result.error)
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
34
|
return result.data;
|
|
@@ -40,7 +40,7 @@ var RutterConnectionsApi = class {
|
|
|
40
40
|
if (!result.success) {
|
|
41
41
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
42
42
|
endpoint,
|
|
43
|
-
|
|
43
|
+
z2__default.default.prettifyError(result.error)
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
return result.data;
|
|
@@ -54,7 +54,7 @@ var RutterConnectionsApi = class {
|
|
|
54
54
|
if (!result.success) {
|
|
55
55
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
56
56
|
endpoint,
|
|
57
|
-
|
|
57
|
+
z2__default.default.prettifyError(result.error)
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
return result.data;
|
|
@@ -70,7 +70,7 @@ var RutterConnectionsApi = class {
|
|
|
70
70
|
if (!result.success) {
|
|
71
71
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
72
72
|
endpoint,
|
|
73
|
-
|
|
73
|
+
z2__default.default.prettifyError(result.error)
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
return result.data;
|
|
@@ -84,7 +84,7 @@ var RutterConnectionsApi = class {
|
|
|
84
84
|
if (!result.success) {
|
|
85
85
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
86
86
|
endpoint,
|
|
87
|
-
|
|
87
|
+
z2__default.default.prettifyError(result.error)
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
return result.data;
|
|
@@ -103,7 +103,7 @@ var RutterAccountingApi = class {
|
|
|
103
103
|
if (!result.success) {
|
|
104
104
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
105
105
|
endpoint,
|
|
106
|
-
|
|
106
|
+
z2__default.default.prettifyError(result.error)
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
return result.data;
|
|
@@ -118,7 +118,7 @@ var RutterAccountingApi = class {
|
|
|
118
118
|
if (!result.success) {
|
|
119
119
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
120
120
|
endpoint,
|
|
121
|
-
|
|
121
|
+
z2__default.default.prettifyError(result.error)
|
|
122
122
|
);
|
|
123
123
|
}
|
|
124
124
|
return result.data;
|
|
@@ -132,7 +132,7 @@ var RutterAccountingApi = class {
|
|
|
132
132
|
if (!result.success) {
|
|
133
133
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
134
134
|
endpoint,
|
|
135
|
-
|
|
135
|
+
z2__default.default.prettifyError(result.error)
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
138
|
return result.data;
|
|
@@ -147,7 +147,7 @@ var RutterAccountingApi = class {
|
|
|
147
147
|
if (!result.success) {
|
|
148
148
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
149
149
|
endpoint,
|
|
150
|
-
|
|
150
|
+
z2__default.default.prettifyError(result.error)
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
153
|
return result.data;
|
|
@@ -161,7 +161,7 @@ var RutterAccountingApi = class {
|
|
|
161
161
|
if (!result.success) {
|
|
162
162
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
163
163
|
endpoint,
|
|
164
|
-
|
|
164
|
+
z2__default.default.prettifyError(result.error)
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
return result.data;
|
|
@@ -181,7 +181,26 @@ var RutterAccountingApi = class {
|
|
|
181
181
|
if (!result.success) {
|
|
182
182
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
183
183
|
endpoint,
|
|
184
|
-
|
|
184
|
+
z2__default.default.prettifyError(result.error)
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return result.data;
|
|
188
|
+
}
|
|
189
|
+
async updateInvoice(accessToken, id, params, options) {
|
|
190
|
+
const endpoint = `/accounting/invoices/${id}`;
|
|
191
|
+
const body = { invoice: params };
|
|
192
|
+
if (options?.responseMode) {
|
|
193
|
+
body.response_mode = options.responseMode;
|
|
194
|
+
}
|
|
195
|
+
const response = await this.client.patch(
|
|
196
|
+
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
197
|
+
body
|
|
198
|
+
);
|
|
199
|
+
const result = chunkJCJXW7AE_cjs.zCreateInvoiceResponse.safeParse(response);
|
|
200
|
+
if (!result.success) {
|
|
201
|
+
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
202
|
+
endpoint,
|
|
203
|
+
z2__default.default.prettifyError(result.error)
|
|
185
204
|
);
|
|
186
205
|
}
|
|
187
206
|
return result.data;
|
|
@@ -200,7 +219,7 @@ var RutterAccountingApi = class {
|
|
|
200
219
|
if (!result.success) {
|
|
201
220
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
202
221
|
endpoint,
|
|
203
|
-
|
|
222
|
+
z2__default.default.prettifyError(result.error)
|
|
204
223
|
);
|
|
205
224
|
}
|
|
206
225
|
return result.data;
|
package/dist/api.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z__default from 'zod';
|
|
2
2
|
import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-DPjGawJr.cjs';
|
|
3
|
-
import { zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.cjs';
|
|
3
|
+
import { zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, UpdateInvoice, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.cjs';
|
|
4
4
|
|
|
5
5
|
declare const zGetAccessTokenConnectionResponse: z__default.ZodObject<{
|
|
6
6
|
connection: z__default.ZodObject<{
|
|
@@ -180,6 +180,9 @@ declare class RutterAccountingApi {
|
|
|
180
180
|
idempotencyKey?: string;
|
|
181
181
|
responseMode?: 'async' | 'prefer_sync';
|
|
182
182
|
}): Promise<TCreateInvoiceResponse>;
|
|
183
|
+
updateInvoice(accessToken: string, id: string, params: UpdateInvoice, options?: {
|
|
184
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
185
|
+
}): Promise<TCreateInvoiceResponse>;
|
|
183
186
|
createCustomer(accessToken: string, params: CreateAccountingCustomer, options?: {
|
|
184
187
|
responseMode?: 'async' | 'prefer_sync';
|
|
185
188
|
}): Promise<TCreateCustomerResponse>;
|
package/dist/api.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z__default from 'zod';
|
|
2
2
|
import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-DPjGawJr.js';
|
|
3
|
-
import { zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.js';
|
|
3
|
+
import { zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, UpdateInvoice, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.js';
|
|
4
4
|
|
|
5
5
|
declare const zGetAccessTokenConnectionResponse: z__default.ZodObject<{
|
|
6
6
|
connection: z__default.ZodObject<{
|
|
@@ -180,6 +180,9 @@ declare class RutterAccountingApi {
|
|
|
180
180
|
idempotencyKey?: string;
|
|
181
181
|
responseMode?: 'async' | 'prefer_sync';
|
|
182
182
|
}): Promise<TCreateInvoiceResponse>;
|
|
183
|
+
updateInvoice(accessToken: string, id: string, params: UpdateInvoice, options?: {
|
|
184
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
185
|
+
}): Promise<TCreateInvoiceResponse>;
|
|
183
186
|
createCustomer(accessToken: string, params: CreateAccountingCustomer, options?: {
|
|
184
187
|
responseMode?: 'async' | 'prefer_sync';
|
|
185
188
|
}): Promise<TCreateCustomerResponse>;
|
package/dist/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RutterSchemaMismatchError } from './chunk-LLGYUOGX.js';
|
|
2
2
|
import { zGetAccessTokenConnectionResponse, zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, zCreateInvoiceResponse, zCreateAccountingCustomerResponse } from './chunk-HSUL4OZU.js';
|
|
3
|
-
import
|
|
3
|
+
import z2 from 'zod';
|
|
4
4
|
|
|
5
5
|
var zGetAccessTokenConnectionResponse2 = zGetAccessTokenConnectionResponse.extend({
|
|
6
6
|
connection: zGetAccessTokenConnectionResponse.shape.connection.extend({
|
|
7
|
-
initial_orders_synced_count:
|
|
8
|
-
disabled_reason:
|
|
7
|
+
initial_orders_synced_count: z2.number().nullish(),
|
|
8
|
+
disabled_reason: z2.string().nullish()
|
|
9
9
|
})
|
|
10
10
|
});
|
|
11
11
|
var RutterConnectionsApi = class {
|
|
@@ -22,7 +22,7 @@ var RutterConnectionsApi = class {
|
|
|
22
22
|
if (!result.success) {
|
|
23
23
|
throw new RutterSchemaMismatchError(
|
|
24
24
|
endpoint,
|
|
25
|
-
|
|
25
|
+
z2.prettifyError(result.error)
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
return result.data;
|
|
@@ -34,7 +34,7 @@ var RutterConnectionsApi = class {
|
|
|
34
34
|
if (!result.success) {
|
|
35
35
|
throw new RutterSchemaMismatchError(
|
|
36
36
|
endpoint,
|
|
37
|
-
|
|
37
|
+
z2.prettifyError(result.error)
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
return result.data;
|
|
@@ -48,7 +48,7 @@ var RutterConnectionsApi = class {
|
|
|
48
48
|
if (!result.success) {
|
|
49
49
|
throw new RutterSchemaMismatchError(
|
|
50
50
|
endpoint,
|
|
51
|
-
|
|
51
|
+
z2.prettifyError(result.error)
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
return result.data;
|
|
@@ -64,7 +64,7 @@ var RutterConnectionsApi = class {
|
|
|
64
64
|
if (!result.success) {
|
|
65
65
|
throw new RutterSchemaMismatchError(
|
|
66
66
|
endpoint,
|
|
67
|
-
|
|
67
|
+
z2.prettifyError(result.error)
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
return result.data;
|
|
@@ -78,7 +78,7 @@ var RutterConnectionsApi = class {
|
|
|
78
78
|
if (!result.success) {
|
|
79
79
|
throw new RutterSchemaMismatchError(
|
|
80
80
|
endpoint,
|
|
81
|
-
|
|
81
|
+
z2.prettifyError(result.error)
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
return result.data;
|
|
@@ -97,7 +97,7 @@ var RutterAccountingApi = class {
|
|
|
97
97
|
if (!result.success) {
|
|
98
98
|
throw new RutterSchemaMismatchError(
|
|
99
99
|
endpoint,
|
|
100
|
-
|
|
100
|
+
z2.prettifyError(result.error)
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
return result.data;
|
|
@@ -112,7 +112,7 @@ var RutterAccountingApi = class {
|
|
|
112
112
|
if (!result.success) {
|
|
113
113
|
throw new RutterSchemaMismatchError(
|
|
114
114
|
endpoint,
|
|
115
|
-
|
|
115
|
+
z2.prettifyError(result.error)
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
return result.data;
|
|
@@ -126,7 +126,7 @@ var RutterAccountingApi = class {
|
|
|
126
126
|
if (!result.success) {
|
|
127
127
|
throw new RutterSchemaMismatchError(
|
|
128
128
|
endpoint,
|
|
129
|
-
|
|
129
|
+
z2.prettifyError(result.error)
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
return result.data;
|
|
@@ -141,7 +141,7 @@ var RutterAccountingApi = class {
|
|
|
141
141
|
if (!result.success) {
|
|
142
142
|
throw new RutterSchemaMismatchError(
|
|
143
143
|
endpoint,
|
|
144
|
-
|
|
144
|
+
z2.prettifyError(result.error)
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
147
|
return result.data;
|
|
@@ -155,7 +155,7 @@ var RutterAccountingApi = class {
|
|
|
155
155
|
if (!result.success) {
|
|
156
156
|
throw new RutterSchemaMismatchError(
|
|
157
157
|
endpoint,
|
|
158
|
-
|
|
158
|
+
z2.prettifyError(result.error)
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
161
|
return result.data;
|
|
@@ -175,7 +175,26 @@ var RutterAccountingApi = class {
|
|
|
175
175
|
if (!result.success) {
|
|
176
176
|
throw new RutterSchemaMismatchError(
|
|
177
177
|
endpoint,
|
|
178
|
-
|
|
178
|
+
z2.prettifyError(result.error)
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
return result.data;
|
|
182
|
+
}
|
|
183
|
+
async updateInvoice(accessToken, id, params, options) {
|
|
184
|
+
const endpoint = `/accounting/invoices/${id}`;
|
|
185
|
+
const body = { invoice: params };
|
|
186
|
+
if (options?.responseMode) {
|
|
187
|
+
body.response_mode = options.responseMode;
|
|
188
|
+
}
|
|
189
|
+
const response = await this.client.patch(
|
|
190
|
+
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
191
|
+
body
|
|
192
|
+
);
|
|
193
|
+
const result = zCreateInvoiceResponse.safeParse(response);
|
|
194
|
+
if (!result.success) {
|
|
195
|
+
throw new RutterSchemaMismatchError(
|
|
196
|
+
endpoint,
|
|
197
|
+
z2.prettifyError(result.error)
|
|
179
198
|
);
|
|
180
199
|
}
|
|
181
200
|
return result.data;
|
|
@@ -194,7 +213,7 @@ var RutterAccountingApi = class {
|
|
|
194
213
|
if (!result.success) {
|
|
195
214
|
throw new RutterSchemaMismatchError(
|
|
196
215
|
endpoint,
|
|
197
|
-
|
|
216
|
+
z2.prettifyError(result.error)
|
|
198
217
|
);
|
|
199
218
|
}
|
|
200
219
|
return result.data;
|