rutter-ts 0.3.5 → 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 +48 -21
- package/dist/api.d.cts +11 -3
- package/dist/api.d.ts +11 -3
- package/dist/api.js +47 -20
- 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,38 +161,65 @@ 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;
|
|
168
168
|
}
|
|
169
|
-
async createInvoice(accessToken, params,
|
|
169
|
+
async createInvoice(accessToken, params, options) {
|
|
170
170
|
const endpoint = "/accounting/invoices";
|
|
171
|
+
const body = { invoice: params };
|
|
172
|
+
if (options?.responseMode) {
|
|
173
|
+
body.response_mode = options.responseMode;
|
|
174
|
+
}
|
|
171
175
|
const response = await this.client.post(
|
|
172
176
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
173
|
-
|
|
174
|
-
idempotencyKey ? { idempotencyKey } : void 0
|
|
177
|
+
body,
|
|
178
|
+
options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : void 0
|
|
179
|
+
);
|
|
180
|
+
const result = chunkJCJXW7AE_cjs.zCreateInvoiceResponse.safeParse(response);
|
|
181
|
+
if (!result.success) {
|
|
182
|
+
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
183
|
+
endpoint,
|
|
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
|
|
175
198
|
);
|
|
176
199
|
const result = chunkJCJXW7AE_cjs.zCreateInvoiceResponse.safeParse(response);
|
|
177
200
|
if (!result.success) {
|
|
178
201
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
179
202
|
endpoint,
|
|
180
|
-
|
|
203
|
+
z2__default.default.prettifyError(result.error)
|
|
181
204
|
);
|
|
182
205
|
}
|
|
183
206
|
return result.data;
|
|
184
207
|
}
|
|
185
|
-
async createCustomer(accessToken, params) {
|
|
208
|
+
async createCustomer(accessToken, params, options) {
|
|
186
209
|
const endpoint = "/accounting/customers";
|
|
210
|
+
const body = { customer: params };
|
|
211
|
+
if (options?.responseMode) {
|
|
212
|
+
body.response_mode = options.responseMode;
|
|
213
|
+
}
|
|
187
214
|
const response = await this.client.post(
|
|
188
215
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
189
|
-
|
|
216
|
+
body
|
|
190
217
|
);
|
|
191
218
|
const result = chunkJCJXW7AE_cjs.zCreateAccountingCustomerResponse.safeParse(response);
|
|
192
219
|
if (!result.success) {
|
|
193
220
|
throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
|
|
194
221
|
endpoint,
|
|
195
|
-
|
|
222
|
+
z2__default.default.prettifyError(result.error)
|
|
196
223
|
);
|
|
197
224
|
}
|
|
198
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<{
|
|
@@ -176,8 +176,16 @@ declare class RutterAccountingApi {
|
|
|
176
176
|
getAccount(accessToken: string, id: string): Promise<TAccountResponse>;
|
|
177
177
|
listInvoices(accessToken: string, params?: RutterPaginationParams & RutterQueryParams): Promise<TListInvoicesResponse>;
|
|
178
178
|
getInvoice(accessToken: string, id: string): Promise<TInvoiceResponse>;
|
|
179
|
-
createInvoice(accessToken: string, params: CreateInvoice,
|
|
180
|
-
|
|
179
|
+
createInvoice(accessToken: string, params: CreateInvoice, options?: {
|
|
180
|
+
idempotencyKey?: string;
|
|
181
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
182
|
+
}): Promise<TCreateInvoiceResponse>;
|
|
183
|
+
updateInvoice(accessToken: string, id: string, params: UpdateInvoice, options?: {
|
|
184
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
185
|
+
}): Promise<TCreateInvoiceResponse>;
|
|
186
|
+
createCustomer(accessToken: string, params: CreateAccountingCustomer, options?: {
|
|
187
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
188
|
+
}): Promise<TCreateCustomerResponse>;
|
|
181
189
|
}
|
|
182
190
|
|
|
183
191
|
export { RutterAccountingApi, RutterConnectionsApi };
|
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<{
|
|
@@ -176,8 +176,16 @@ declare class RutterAccountingApi {
|
|
|
176
176
|
getAccount(accessToken: string, id: string): Promise<TAccountResponse>;
|
|
177
177
|
listInvoices(accessToken: string, params?: RutterPaginationParams & RutterQueryParams): Promise<TListInvoicesResponse>;
|
|
178
178
|
getInvoice(accessToken: string, id: string): Promise<TInvoiceResponse>;
|
|
179
|
-
createInvoice(accessToken: string, params: CreateInvoice,
|
|
180
|
-
|
|
179
|
+
createInvoice(accessToken: string, params: CreateInvoice, options?: {
|
|
180
|
+
idempotencyKey?: string;
|
|
181
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
182
|
+
}): Promise<TCreateInvoiceResponse>;
|
|
183
|
+
updateInvoice(accessToken: string, id: string, params: UpdateInvoice, options?: {
|
|
184
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
185
|
+
}): Promise<TCreateInvoiceResponse>;
|
|
186
|
+
createCustomer(accessToken: string, params: CreateAccountingCustomer, options?: {
|
|
187
|
+
responseMode?: 'async' | 'prefer_sync';
|
|
188
|
+
}): Promise<TCreateCustomerResponse>;
|
|
181
189
|
}
|
|
182
190
|
|
|
183
191
|
export { RutterAccountingApi, RutterConnectionsApi };
|
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,38 +155,65 @@ 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;
|
|
162
162
|
}
|
|
163
|
-
async createInvoice(accessToken, params,
|
|
163
|
+
async createInvoice(accessToken, params, options) {
|
|
164
164
|
const endpoint = "/accounting/invoices";
|
|
165
|
+
const body = { invoice: params };
|
|
166
|
+
if (options?.responseMode) {
|
|
167
|
+
body.response_mode = options.responseMode;
|
|
168
|
+
}
|
|
165
169
|
const response = await this.client.post(
|
|
166
170
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
167
|
-
|
|
168
|
-
idempotencyKey ? { idempotencyKey } : void 0
|
|
171
|
+
body,
|
|
172
|
+
options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : void 0
|
|
173
|
+
);
|
|
174
|
+
const result = zCreateInvoiceResponse.safeParse(response);
|
|
175
|
+
if (!result.success) {
|
|
176
|
+
throw new RutterSchemaMismatchError(
|
|
177
|
+
endpoint,
|
|
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
|
|
169
192
|
);
|
|
170
193
|
const result = zCreateInvoiceResponse.safeParse(response);
|
|
171
194
|
if (!result.success) {
|
|
172
195
|
throw new RutterSchemaMismatchError(
|
|
173
196
|
endpoint,
|
|
174
|
-
|
|
197
|
+
z2.prettifyError(result.error)
|
|
175
198
|
);
|
|
176
199
|
}
|
|
177
200
|
return result.data;
|
|
178
201
|
}
|
|
179
|
-
async createCustomer(accessToken, params) {
|
|
202
|
+
async createCustomer(accessToken, params, options) {
|
|
180
203
|
const endpoint = "/accounting/customers";
|
|
204
|
+
const body = { customer: params };
|
|
205
|
+
if (options?.responseMode) {
|
|
206
|
+
body.response_mode = options.responseMode;
|
|
207
|
+
}
|
|
181
208
|
const response = await this.client.post(
|
|
182
209
|
`${endpoint}?access_token=${encodeURIComponent(accessToken)}`,
|
|
183
|
-
|
|
210
|
+
body
|
|
184
211
|
);
|
|
185
212
|
const result = zCreateAccountingCustomerResponse.safeParse(response);
|
|
186
213
|
if (!result.success) {
|
|
187
214
|
throw new RutterSchemaMismatchError(
|
|
188
215
|
endpoint,
|
|
189
|
-
|
|
216
|
+
z2.prettifyError(result.error)
|
|
190
217
|
);
|
|
191
218
|
}
|
|
192
219
|
return result.data;
|