rutter-ts 0.3.3 → 0.3.5

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 CHANGED
@@ -2,12 +2,18 @@
2
2
 
3
3
  var chunkLPP3MIOV_cjs = require('./chunk-LPP3MIOV.cjs');
4
4
  var chunkJCJXW7AE_cjs = require('./chunk-JCJXW7AE.cjs');
5
- var z2 = require('zod');
5
+ var z = require('zod');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
9
- var z2__default = /*#__PURE__*/_interopDefault(z2);
9
+ var z__default = /*#__PURE__*/_interopDefault(z);
10
10
 
11
+ var zGetAccessTokenConnectionResponse2 = chunkJCJXW7AE_cjs.zGetAccessTokenConnectionResponse.extend({
12
+ connection: chunkJCJXW7AE_cjs.zGetAccessTokenConnectionResponse.shape.connection.extend({
13
+ initial_orders_synced_count: z__default.default.number().nullish(),
14
+ disabled_reason: z__default.default.string().nullish()
15
+ })
16
+ });
11
17
  var RutterConnectionsApi = class {
12
18
  constructor(client) {
13
19
  this.client = client;
@@ -22,7 +28,7 @@ var RutterConnectionsApi = class {
22
28
  if (!result.success) {
23
29
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
24
30
  endpoint,
25
- z2__default.default.prettifyError(result.error)
31
+ z__default.default.prettifyError(result.error)
26
32
  );
27
33
  }
28
34
  return result.data;
@@ -34,7 +40,7 @@ var RutterConnectionsApi = class {
34
40
  if (!result.success) {
35
41
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
36
42
  endpoint,
37
- z2__default.default.prettifyError(result.error)
43
+ z__default.default.prettifyError(result.error)
38
44
  );
39
45
  }
40
46
  return result.data;
@@ -44,23 +50,27 @@ var RutterConnectionsApi = class {
44
50
  const response = await this.client.get(endpoint, {
45
51
  access_token: accessToken
46
52
  });
47
- const result = chunkJCJXW7AE_cjs.zGetAccessTokenConnectionResponse.safeParse(response);
53
+ const result = zGetAccessTokenConnectionResponse2.safeParse(response);
48
54
  if (!result.success) {
49
55
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
50
56
  endpoint,
51
- z2__default.default.prettifyError(result.error)
57
+ z__default.default.prettifyError(result.error)
52
58
  );
53
59
  }
54
60
  return result.data;
55
61
  }
56
62
  async exchangeToken(params) {
57
63
  const endpoint = "/item/public_token/exchange";
58
- const response = await this.client.post(endpoint, params);
64
+ const response = await this.client.post(endpoint, {
65
+ ...params,
66
+ client_id: this.client.clientId,
67
+ secret: this.client.clientSecret
68
+ });
59
69
  const result = chunkJCJXW7AE_cjs.zExchangeTokenResponse.safeParse(response);
60
70
  if (!result.success) {
61
71
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
62
72
  endpoint,
63
- z2__default.default.prettifyError(result.error)
73
+ z__default.default.prettifyError(result.error)
64
74
  );
65
75
  }
66
76
  return result.data;
@@ -74,7 +84,7 @@ var RutterConnectionsApi = class {
74
84
  if (!result.success) {
75
85
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
76
86
  endpoint,
77
- z2__default.default.prettifyError(result.error)
87
+ z__default.default.prettifyError(result.error)
78
88
  );
79
89
  }
80
90
  return result.data;
@@ -93,7 +103,7 @@ var RutterAccountingApi = class {
93
103
  if (!result.success) {
94
104
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
95
105
  endpoint,
96
- z2__default.default.prettifyError(result.error)
106
+ z__default.default.prettifyError(result.error)
97
107
  );
98
108
  }
99
109
  return result.data;
@@ -108,7 +118,7 @@ var RutterAccountingApi = class {
108
118
  if (!result.success) {
109
119
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
110
120
  endpoint,
111
- z2__default.default.prettifyError(result.error)
121
+ z__default.default.prettifyError(result.error)
112
122
  );
113
123
  }
114
124
  return result.data;
@@ -122,7 +132,7 @@ var RutterAccountingApi = class {
122
132
  if (!result.success) {
123
133
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
124
134
  endpoint,
125
- z2__default.default.prettifyError(result.error)
135
+ z__default.default.prettifyError(result.error)
126
136
  );
127
137
  }
128
138
  return result.data;
@@ -137,7 +147,7 @@ var RutterAccountingApi = class {
137
147
  if (!result.success) {
138
148
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
139
149
  endpoint,
140
- z2__default.default.prettifyError(result.error)
150
+ z__default.default.prettifyError(result.error)
141
151
  );
142
152
  }
143
153
  return result.data;
@@ -151,7 +161,7 @@ var RutterAccountingApi = class {
151
161
  if (!result.success) {
152
162
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
153
163
  endpoint,
154
- z2__default.default.prettifyError(result.error)
164
+ z__default.default.prettifyError(result.error)
155
165
  );
156
166
  }
157
167
  return result.data;
@@ -167,7 +177,7 @@ var RutterAccountingApi = class {
167
177
  if (!result.success) {
168
178
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
169
179
  endpoint,
170
- z2__default.default.prettifyError(result.error)
180
+ z__default.default.prettifyError(result.error)
171
181
  );
172
182
  }
173
183
  return result.data;
@@ -182,7 +192,7 @@ var RutterAccountingApi = class {
182
192
  if (!result.success) {
183
193
  throw new chunkLPP3MIOV_cjs.RutterSchemaMismatchError(
184
194
  endpoint,
185
- z2__default.default.prettifyError(result.error)
195
+ z__default.default.prettifyError(result.error)
186
196
  );
187
197
  }
188
198
  return result.data;
package/dist/api.d.cts CHANGED
@@ -1,7 +1,147 @@
1
1
  import z__default from 'zod';
2
- import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-sPbSz2i_.cjs';
3
- import { zConnectionResponse, zListConnectionsResponse, zGetAccessTokenConnectionResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.cjs';
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';
4
4
 
5
+ declare const zGetAccessTokenConnectionResponse: z__default.ZodObject<{
6
+ connection: z__default.ZodObject<{
7
+ id: z__default.ZodString;
8
+ store_unique_id: z__default.ZodString;
9
+ estimated_completed_at: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
10
+ last_sync_completed_at: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
11
+ last_sync_started_at: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
12
+ oldest_order_date: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
13
+ newest_order_date: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
14
+ disabled: z__default.ZodBoolean;
15
+ link_url: z__default.ZodString;
16
+ needs_update: z__default.ZodBoolean;
17
+ platform: z__default.ZodEnum<{
18
+ AMAZON: "AMAZON";
19
+ EBAY: "EBAY";
20
+ ETSY: "ETSY";
21
+ FNAC: "FNAC";
22
+ WALMART: "WALMART";
23
+ SHOPEE: "SHOPEE";
24
+ LAZADA: "LAZADA";
25
+ MERCADOLIBRE: "MERCADOLIBRE";
26
+ ALIBABA: "ALIBABA";
27
+ SHOPLINE: "SHOPLINE";
28
+ PRESTASHOP: "PRESTASHOP";
29
+ SHOPIFY: "SHOPIFY";
30
+ MAGENTO: "MAGENTO";
31
+ WOO_COMMERCE: "WOO_COMMERCE";
32
+ SQUARESPACE: "SQUARESPACE";
33
+ WIX: "WIX";
34
+ SHOPER: "SHOPER";
35
+ SHOPLAZZA: "SHOPLAZZA";
36
+ BIG_COMMERCE: "BIG_COMMERCE";
37
+ SALLA: "SALLA";
38
+ ZID: "ZID";
39
+ COMMERCELAYER: "COMMERCELAYER";
40
+ WEBFLOW: "WEBFLOW";
41
+ GUMROAD: "GUMROAD";
42
+ ECWID: "ECWID";
43
+ PAYPAL: "PAYPAL";
44
+ SQUARE: "SQUARE";
45
+ STRIPE: "STRIPE";
46
+ CLOVER: "CLOVER";
47
+ MOLLIE: "MOLLIE";
48
+ PAYNL: "PAYNL";
49
+ AUTHORIZENET: "AUTHORIZENET";
50
+ RECHARGE: "RECHARGE";
51
+ CHARGIFY: "CHARGIFY";
52
+ CHARGEBEE: "CHARGEBEE";
53
+ RECURLY: "RECURLY";
54
+ KASHFLOW: "KASHFLOW";
55
+ SAGE_INTACCT: "SAGE_INTACCT";
56
+ SAGE_INTACCT_V2: "SAGE_INTACCT_V2";
57
+ DYNAMICS365: "DYNAMICS365";
58
+ ZOHOBOOKS: "ZOHOBOOKS";
59
+ EXACTONLINE: "EXACTONLINE";
60
+ FREEAGENT: "FREEAGENT";
61
+ QUICKBOOKS: "QUICKBOOKS";
62
+ QUICKBOOKS_DESKTOP: "QUICKBOOKS_DESKTOP";
63
+ FRESHBOOKS: "FRESHBOOKS";
64
+ XERO: "XERO";
65
+ SAGE_BUSINESS_CLOUD: "SAGE_BUSINESS_CLOUD";
66
+ SAGE_50: "SAGE_50";
67
+ NETSUITE: "NETSUITE";
68
+ WAVE: "WAVE";
69
+ DUALENTRY: "DUALENTRY";
70
+ MONEYBIRD: "MONEYBIRD";
71
+ SAGE200CLOUD: "SAGE200CLOUD";
72
+ MX: "MX";
73
+ PLAID: "PLAID";
74
+ TELLER: "TELLER";
75
+ ODOO: "ODOO";
76
+ TALLY: "TALLY";
77
+ GOOGLE: "GOOGLE";
78
+ FACEBOOK: "FACEBOOK";
79
+ TIKTOK: "TIKTOK";
80
+ INTUIT_BANK_FEEDS: "INTUIT_BANK_FEEDS";
81
+ SAGE: "SAGE";
82
+ SAGE_BANK_FEEDS: "SAGE_BANK_FEEDS";
83
+ QUICKBOOKS_HRIS: "QUICKBOOKS_HRIS";
84
+ BAMBOO_HR: "BAMBOO_HR";
85
+ GUSTO: "GUSTO";
86
+ }>;
87
+ store_domain: z__default.ZodNullable<z__default.ZodString>;
88
+ store_name: z__default.ZodNullable<z__default.ZodString>;
89
+ unavailable_objects: z__default.ZodNullable<z__default.ZodArray<z__default.ZodEnum<{
90
+ expense: "expense";
91
+ account: "account";
92
+ items: "items";
93
+ invoice_payment: "invoice_payment";
94
+ journal_entry: "journal_entry";
95
+ bank_deposit: "bank_deposit";
96
+ attachment: "attachment";
97
+ bank_feed_account: "bank_feed_account";
98
+ bank_feed_transaction: "bank_feed_transaction";
99
+ bank_transfer: "bank_transfer";
100
+ bill_credit_memo: "bill_credit_memo";
101
+ bill_payment: "bill_payment";
102
+ bill: "bill";
103
+ class: "class";
104
+ company_info: "company_info";
105
+ currencies: "currencies";
106
+ department: "department";
107
+ invoice_credit_memo: "invoice_credit_memo";
108
+ payment_method: "payment_method";
109
+ invoice: "invoice";
110
+ location: "location";
111
+ payment_term: "payment_term";
112
+ project: "project";
113
+ purchase_order: "purchase_order";
114
+ sales_order: "sales_order";
115
+ sales_receipt: "sales_receipt";
116
+ subsidiary: "subsidiary";
117
+ task: "task";
118
+ tax_agency: "tax_agency";
119
+ tax_area: "tax_area";
120
+ tax_rates: "tax_rates";
121
+ transaction: "transaction";
122
+ vendor: "vendor";
123
+ order: "order";
124
+ accounting_customer: "accounting_customer";
125
+ accounting_customer_refund: "accounting_customer_refund";
126
+ accounting_transaction: "accounting_transaction";
127
+ account_transaction: "account_transaction";
128
+ balance_sheet: "balance_sheet";
129
+ cash_flow: "cash_flow";
130
+ categories: "categories";
131
+ commerce_customer: "commerce_customer";
132
+ customer_group: "customer_group";
133
+ income_statement: "income_statement";
134
+ payout: "payout";
135
+ product: "product";
136
+ store: "store";
137
+ subscription: "subscription";
138
+ updated_transaction: "updated_transaction";
139
+ }>>>;
140
+ created_at: z__default.ZodOptional<z__default.ZodString>;
141
+ initial_orders_synced_count: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodNumber>>;
142
+ disabled_reason: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
143
+ }, z__default.core.$strip>;
144
+ }, z__default.core.$strip>;
5
145
  type TConnectionResponse = z__default.infer<typeof zConnectionResponse>;
6
146
  type TListConnectionsResponse = z__default.infer<typeof zListConnectionsResponse>;
7
147
  type TExchangeTokenResponse = z__default.infer<typeof zExchangeTokenResponse>;
package/dist/api.d.ts CHANGED
@@ -1,7 +1,147 @@
1
1
  import z__default from 'zod';
2
- import { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams } from './client-sPbSz2i_.js';
3
- import { zConnectionResponse, zListConnectionsResponse, zGetAccessTokenConnectionResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, CreateInvoice, zCreateInvoiceResponse, CreateAccountingCustomer, zCreateAccountingCustomerResponse } from './generated.js';
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';
4
4
 
5
+ declare const zGetAccessTokenConnectionResponse: z__default.ZodObject<{
6
+ connection: z__default.ZodObject<{
7
+ id: z__default.ZodString;
8
+ store_unique_id: z__default.ZodString;
9
+ estimated_completed_at: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
10
+ last_sync_completed_at: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
11
+ last_sync_started_at: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
12
+ oldest_order_date: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
13
+ newest_order_date: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
14
+ disabled: z__default.ZodBoolean;
15
+ link_url: z__default.ZodString;
16
+ needs_update: z__default.ZodBoolean;
17
+ platform: z__default.ZodEnum<{
18
+ AMAZON: "AMAZON";
19
+ EBAY: "EBAY";
20
+ ETSY: "ETSY";
21
+ FNAC: "FNAC";
22
+ WALMART: "WALMART";
23
+ SHOPEE: "SHOPEE";
24
+ LAZADA: "LAZADA";
25
+ MERCADOLIBRE: "MERCADOLIBRE";
26
+ ALIBABA: "ALIBABA";
27
+ SHOPLINE: "SHOPLINE";
28
+ PRESTASHOP: "PRESTASHOP";
29
+ SHOPIFY: "SHOPIFY";
30
+ MAGENTO: "MAGENTO";
31
+ WOO_COMMERCE: "WOO_COMMERCE";
32
+ SQUARESPACE: "SQUARESPACE";
33
+ WIX: "WIX";
34
+ SHOPER: "SHOPER";
35
+ SHOPLAZZA: "SHOPLAZZA";
36
+ BIG_COMMERCE: "BIG_COMMERCE";
37
+ SALLA: "SALLA";
38
+ ZID: "ZID";
39
+ COMMERCELAYER: "COMMERCELAYER";
40
+ WEBFLOW: "WEBFLOW";
41
+ GUMROAD: "GUMROAD";
42
+ ECWID: "ECWID";
43
+ PAYPAL: "PAYPAL";
44
+ SQUARE: "SQUARE";
45
+ STRIPE: "STRIPE";
46
+ CLOVER: "CLOVER";
47
+ MOLLIE: "MOLLIE";
48
+ PAYNL: "PAYNL";
49
+ AUTHORIZENET: "AUTHORIZENET";
50
+ RECHARGE: "RECHARGE";
51
+ CHARGIFY: "CHARGIFY";
52
+ CHARGEBEE: "CHARGEBEE";
53
+ RECURLY: "RECURLY";
54
+ KASHFLOW: "KASHFLOW";
55
+ SAGE_INTACCT: "SAGE_INTACCT";
56
+ SAGE_INTACCT_V2: "SAGE_INTACCT_V2";
57
+ DYNAMICS365: "DYNAMICS365";
58
+ ZOHOBOOKS: "ZOHOBOOKS";
59
+ EXACTONLINE: "EXACTONLINE";
60
+ FREEAGENT: "FREEAGENT";
61
+ QUICKBOOKS: "QUICKBOOKS";
62
+ QUICKBOOKS_DESKTOP: "QUICKBOOKS_DESKTOP";
63
+ FRESHBOOKS: "FRESHBOOKS";
64
+ XERO: "XERO";
65
+ SAGE_BUSINESS_CLOUD: "SAGE_BUSINESS_CLOUD";
66
+ SAGE_50: "SAGE_50";
67
+ NETSUITE: "NETSUITE";
68
+ WAVE: "WAVE";
69
+ DUALENTRY: "DUALENTRY";
70
+ MONEYBIRD: "MONEYBIRD";
71
+ SAGE200CLOUD: "SAGE200CLOUD";
72
+ MX: "MX";
73
+ PLAID: "PLAID";
74
+ TELLER: "TELLER";
75
+ ODOO: "ODOO";
76
+ TALLY: "TALLY";
77
+ GOOGLE: "GOOGLE";
78
+ FACEBOOK: "FACEBOOK";
79
+ TIKTOK: "TIKTOK";
80
+ INTUIT_BANK_FEEDS: "INTUIT_BANK_FEEDS";
81
+ SAGE: "SAGE";
82
+ SAGE_BANK_FEEDS: "SAGE_BANK_FEEDS";
83
+ QUICKBOOKS_HRIS: "QUICKBOOKS_HRIS";
84
+ BAMBOO_HR: "BAMBOO_HR";
85
+ GUSTO: "GUSTO";
86
+ }>;
87
+ store_domain: z__default.ZodNullable<z__default.ZodString>;
88
+ store_name: z__default.ZodNullable<z__default.ZodString>;
89
+ unavailable_objects: z__default.ZodNullable<z__default.ZodArray<z__default.ZodEnum<{
90
+ expense: "expense";
91
+ account: "account";
92
+ items: "items";
93
+ invoice_payment: "invoice_payment";
94
+ journal_entry: "journal_entry";
95
+ bank_deposit: "bank_deposit";
96
+ attachment: "attachment";
97
+ bank_feed_account: "bank_feed_account";
98
+ bank_feed_transaction: "bank_feed_transaction";
99
+ bank_transfer: "bank_transfer";
100
+ bill_credit_memo: "bill_credit_memo";
101
+ bill_payment: "bill_payment";
102
+ bill: "bill";
103
+ class: "class";
104
+ company_info: "company_info";
105
+ currencies: "currencies";
106
+ department: "department";
107
+ invoice_credit_memo: "invoice_credit_memo";
108
+ payment_method: "payment_method";
109
+ invoice: "invoice";
110
+ location: "location";
111
+ payment_term: "payment_term";
112
+ project: "project";
113
+ purchase_order: "purchase_order";
114
+ sales_order: "sales_order";
115
+ sales_receipt: "sales_receipt";
116
+ subsidiary: "subsidiary";
117
+ task: "task";
118
+ tax_agency: "tax_agency";
119
+ tax_area: "tax_area";
120
+ tax_rates: "tax_rates";
121
+ transaction: "transaction";
122
+ vendor: "vendor";
123
+ order: "order";
124
+ accounting_customer: "accounting_customer";
125
+ accounting_customer_refund: "accounting_customer_refund";
126
+ accounting_transaction: "accounting_transaction";
127
+ account_transaction: "account_transaction";
128
+ balance_sheet: "balance_sheet";
129
+ cash_flow: "cash_flow";
130
+ categories: "categories";
131
+ commerce_customer: "commerce_customer";
132
+ customer_group: "customer_group";
133
+ income_statement: "income_statement";
134
+ payout: "payout";
135
+ product: "product";
136
+ store: "store";
137
+ subscription: "subscription";
138
+ updated_transaction: "updated_transaction";
139
+ }>>>;
140
+ created_at: z__default.ZodOptional<z__default.ZodString>;
141
+ initial_orders_synced_count: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodNumber>>;
142
+ disabled_reason: z__default.ZodOptional<z__default.ZodNullable<z__default.ZodString>>;
143
+ }, z__default.core.$strip>;
144
+ }, z__default.core.$strip>;
5
145
  type TConnectionResponse = z__default.infer<typeof zConnectionResponse>;
6
146
  type TListConnectionsResponse = z__default.infer<typeof zListConnectionsResponse>;
7
147
  type TExchangeTokenResponse = z__default.infer<typeof zExchangeTokenResponse>;
package/dist/api.js CHANGED
@@ -1,7 +1,13 @@
1
1
  import { RutterSchemaMismatchError } from './chunk-LLGYUOGX.js';
2
- import { zConnectionResponse, zListConnectionsResponse, zGetAccessTokenConnectionResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, zCreateInvoiceResponse, zCreateAccountingCustomerResponse } from './chunk-HSUL4OZU.js';
3
- import z2 from 'zod';
2
+ import { zGetAccessTokenConnectionResponse, zConnectionResponse, zListConnectionsResponse, zExchangeTokenResponse, zDeleteConnectionResponse, zCompanyInfo20240430ResponseWithConnection, zListAccountResponseWithConnection, zAccountResponseWithConnection, zListInvoiceResponseWithConnection, zInvoiceResponseWithConnection, zCreateInvoiceResponse, zCreateAccountingCustomerResponse } from './chunk-HSUL4OZU.js';
3
+ import z from 'zod';
4
4
 
5
+ var zGetAccessTokenConnectionResponse2 = zGetAccessTokenConnectionResponse.extend({
6
+ connection: zGetAccessTokenConnectionResponse.shape.connection.extend({
7
+ initial_orders_synced_count: z.number().nullish(),
8
+ disabled_reason: z.string().nullish()
9
+ })
10
+ });
5
11
  var RutterConnectionsApi = class {
6
12
  constructor(client) {
7
13
  this.client = client;
@@ -16,7 +22,7 @@ var RutterConnectionsApi = class {
16
22
  if (!result.success) {
17
23
  throw new RutterSchemaMismatchError(
18
24
  endpoint,
19
- z2.prettifyError(result.error)
25
+ z.prettifyError(result.error)
20
26
  );
21
27
  }
22
28
  return result.data;
@@ -28,7 +34,7 @@ var RutterConnectionsApi = class {
28
34
  if (!result.success) {
29
35
  throw new RutterSchemaMismatchError(
30
36
  endpoint,
31
- z2.prettifyError(result.error)
37
+ z.prettifyError(result.error)
32
38
  );
33
39
  }
34
40
  return result.data;
@@ -38,23 +44,27 @@ var RutterConnectionsApi = class {
38
44
  const response = await this.client.get(endpoint, {
39
45
  access_token: accessToken
40
46
  });
41
- const result = zGetAccessTokenConnectionResponse.safeParse(response);
47
+ const result = zGetAccessTokenConnectionResponse2.safeParse(response);
42
48
  if (!result.success) {
43
49
  throw new RutterSchemaMismatchError(
44
50
  endpoint,
45
- z2.prettifyError(result.error)
51
+ z.prettifyError(result.error)
46
52
  );
47
53
  }
48
54
  return result.data;
49
55
  }
50
56
  async exchangeToken(params) {
51
57
  const endpoint = "/item/public_token/exchange";
52
- const response = await this.client.post(endpoint, params);
58
+ const response = await this.client.post(endpoint, {
59
+ ...params,
60
+ client_id: this.client.clientId,
61
+ secret: this.client.clientSecret
62
+ });
53
63
  const result = zExchangeTokenResponse.safeParse(response);
54
64
  if (!result.success) {
55
65
  throw new RutterSchemaMismatchError(
56
66
  endpoint,
57
- z2.prettifyError(result.error)
67
+ z.prettifyError(result.error)
58
68
  );
59
69
  }
60
70
  return result.data;
@@ -68,7 +78,7 @@ var RutterConnectionsApi = class {
68
78
  if (!result.success) {
69
79
  throw new RutterSchemaMismatchError(
70
80
  endpoint,
71
- z2.prettifyError(result.error)
81
+ z.prettifyError(result.error)
72
82
  );
73
83
  }
74
84
  return result.data;
@@ -87,7 +97,7 @@ var RutterAccountingApi = class {
87
97
  if (!result.success) {
88
98
  throw new RutterSchemaMismatchError(
89
99
  endpoint,
90
- z2.prettifyError(result.error)
100
+ z.prettifyError(result.error)
91
101
  );
92
102
  }
93
103
  return result.data;
@@ -102,7 +112,7 @@ var RutterAccountingApi = class {
102
112
  if (!result.success) {
103
113
  throw new RutterSchemaMismatchError(
104
114
  endpoint,
105
- z2.prettifyError(result.error)
115
+ z.prettifyError(result.error)
106
116
  );
107
117
  }
108
118
  return result.data;
@@ -116,7 +126,7 @@ var RutterAccountingApi = class {
116
126
  if (!result.success) {
117
127
  throw new RutterSchemaMismatchError(
118
128
  endpoint,
119
- z2.prettifyError(result.error)
129
+ z.prettifyError(result.error)
120
130
  );
121
131
  }
122
132
  return result.data;
@@ -131,7 +141,7 @@ var RutterAccountingApi = class {
131
141
  if (!result.success) {
132
142
  throw new RutterSchemaMismatchError(
133
143
  endpoint,
134
- z2.prettifyError(result.error)
144
+ z.prettifyError(result.error)
135
145
  );
136
146
  }
137
147
  return result.data;
@@ -145,7 +155,7 @@ var RutterAccountingApi = class {
145
155
  if (!result.success) {
146
156
  throw new RutterSchemaMismatchError(
147
157
  endpoint,
148
- z2.prettifyError(result.error)
158
+ z.prettifyError(result.error)
149
159
  );
150
160
  }
151
161
  return result.data;
@@ -161,7 +171,7 @@ var RutterAccountingApi = class {
161
171
  if (!result.success) {
162
172
  throw new RutterSchemaMismatchError(
163
173
  endpoint,
164
- z2.prettifyError(result.error)
174
+ z.prettifyError(result.error)
165
175
  );
166
176
  }
167
177
  return result.data;
@@ -176,7 +186,7 @@ var RutterAccountingApi = class {
176
186
  if (!result.success) {
177
187
  throw new RutterSchemaMismatchError(
178
188
  endpoint,
179
- z2.prettifyError(result.error)
189
+ z.prettifyError(result.error)
180
190
  );
181
191
  }
182
192
  return result.data;
@@ -19,8 +19,8 @@ interface RutterRequestOptions {
19
19
 
20
20
  declare class RutterClient {
21
21
  readonly baseUrl: string;
22
- private readonly clientId;
23
- private readonly clientSecret;
22
+ readonly clientId: string;
23
+ readonly clientSecret: string;
24
24
  constructor(baseUrl: string, clientId: string, clientSecret: string);
25
25
  private get authHeader();
26
26
  private request;
@@ -19,8 +19,8 @@ interface RutterRequestOptions {
19
19
 
20
20
  declare class RutterClient {
21
21
  readonly baseUrl: string;
22
- private readonly clientId;
23
- private readonly clientSecret;
22
+ readonly clientId: string;
23
+ readonly clientSecret: string;
24
24
  constructor(baseUrl: string, clientId: string, clientSecret: string);
25
25
  private get authHeader();
26
26
  private request;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-sPbSz2i_.cjs';
2
- export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-sPbSz2i_.cjs';
1
+ import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-DPjGawJr.cjs';
2
+ export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-DPjGawJr.cjs';
3
3
 
4
4
  declare class RutterError extends Error {
5
5
  readonly status: number;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-sPbSz2i_.js';
2
- export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-sPbSz2i_.js';
1
+ import { R as RutterErrorMetadata, a as RutterErrorBody } from './client-DPjGawJr.js';
2
+ export { b as RutterClient, c as RutterPaginationParams, d as RutterQueryParams, e as RutterRequestOptions } from './client-DPjGawJr.js';
3
3
 
4
4
  declare class RutterError extends Error {
5
5
  readonly status: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rutter-ts",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "TypeScript SDK for the Rutter API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",