@rawdash/connector-expensify 0.28.2

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/README.md ADDED
@@ -0,0 +1,140 @@
1
+ <!-- This file is generated from connector metadata by scripts/generate-connector-docs.ts. Do not edit by hand. -->
2
+
3
+ # @rawdash/connector-expensify
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@rawdash/connector-expensify)](https://www.npmjs.com/package/@rawdash/connector-expensify)
6
+ [![license](https://img.shields.io/npm/l/@rawdash/connector-expensify)](https://github.com/rawdash/rawdash/blob/main/LICENSE)
7
+
8
+ Sync Expensify expense reports, individual expenses, and daily category spend for finance-ops dashboards: reports pending, month-to-date spend, and spend by category.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ npm install @rawdash/connector-expensify
14
+ ```
15
+
16
+ ## Authentication
17
+
18
+ Expensify API partner credentials (partnerUserID + partnerUserSecret). Both are sent in the credentials block of every Integration Server request over HTTPS.
19
+
20
+ 1. In the Expensify web app, open Settings → Account → API and generate a partnerUserID / partnerUserSecret credential pair.
21
+ 2. Set the partnerUserID as the `partnerName` config field.
22
+ 3. Store the partnerUserSecret as a secret and reference it from config as `partnerPassword: secret("EXPENSIFY_PARTNER_PASSWORD")`.
23
+
24
+ ## Configuration
25
+
26
+ | Field | Type | Required | Description |
27
+ | ----------------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | `partnerName` | string | Yes | The Expensify API partnerUserID. Generate a credential pair in the Expensify web app under Settings → Account → API, and use the partnerUserID here. |
29
+ | `partnerPassword` | secret | Yes | The Expensify API partnerUserSecret paired with the partnerUserID. Store it as a secret. |
30
+ | `lookbackDays` | number | No | How many calendar days of reports (by submit/created date) to fetch on a full sync. Defaults to 180. |
31
+ | `resources` | array | No | Which Expensify resources to sync. Omit to sync all of them. |
32
+
33
+ ## Resources
34
+
35
+ - **`expensify_report`** _(entity)_ - Expense reports with total, currency, workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, ...), submitter, and submit/approve timestamps.
36
+ - Endpoint: `POST /ExpensifyIntegrations (combinedReportData)`
37
+ - `reportName`: Report title.
38
+ - `total` _(cents)_: Report total in the smallest currency unit.
39
+ - `currency`: ISO currency code of the report.
40
+ - `status`: Workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, CLOSED, ...), uppercased.
41
+ - `submitterEmail`: Email of the report submitter.
42
+ - `submittedDate`: Submission timestamp, if any.
43
+ - `approvedDate`: Approval timestamp, if any.
44
+ - `policyName`: Expense policy the report is under.
45
+ - `expenseCount`: Number of expenses on the report.
46
+ - **`expensify_expense`** _(event)_ - Individual expenses (one event per transaction) timestamped at the expense creation date, carrying merchant, amount, currency, category, and parent report.
47
+ - Endpoint: `POST /ExpensifyIntegrations (combinedReportData)`
48
+ - Derived from the transactionList of every report in the lookback window and rewritten on every sync, so resyncs are idempotent.
49
+ - `expenseId`: Expensify transaction id.
50
+ - `reportId`: Parent report id.
51
+ - `merchant`: Merchant name.
52
+ - `amount` _(cents)_: Expense amount in the smallest currency unit.
53
+ - `currency`: ISO currency code of the expense.
54
+ - `category`: Expense category, if categorized.
55
+ - `created`: Expense creation date (YYYY-MM-DD).
56
+ - `comment`: Free-text comment on the expense.
57
+ - `reimbursable`: Whether the expense is reimbursable.
58
+ - **`expensify_category_spend`** _(metric)_ - Daily expense spend bucketed by category and currency: the summed expense amount per (creation day, category, currency).
59
+ - Endpoint: `POST /ExpensifyIntegrations (combinedReportData)`
60
+ - Unit: cents
61
+ - Granularity: day
62
+ - Dimensions: `date`, `category`, `currency`
63
+ - Measures: `expenseCount`
64
+ - Aggregated in the connector from the same combinedReportData export used for reports and expenses. The metric value is the summed amount (smallest currency unit) for the bucket.
65
+
66
+ ## Example
67
+
68
+ ```ts
69
+ import {
70
+ defineConfig,
71
+ defineDashboard,
72
+ defineMetric,
73
+ secret,
74
+ } from '@rawdash/core';
75
+
76
+ const expensify = {
77
+ name: 'expensify',
78
+ connectorId: 'expensify',
79
+ config: {
80
+ partnerName: 'your_partnerUserID',
81
+ partnerPassword: secret('EXPENSIFY_PARTNER_PASSWORD'),
82
+ lookbackDays: 180,
83
+ },
84
+ };
85
+
86
+ export default defineConfig({
87
+ connectors: [expensify],
88
+ dashboards: {
89
+ finance: defineDashboard({
90
+ widgets: {
91
+ spend_mtd: {
92
+ kind: 'stat',
93
+ title: 'Spend (30d)',
94
+ window: '30d',
95
+ metric: defineMetric({
96
+ connector: expensify,
97
+ shape: 'metric',
98
+ name: 'expensify_category_spend',
99
+ field: 'value',
100
+ fn: 'sum',
101
+ }),
102
+ },
103
+ daily_spend: {
104
+ kind: 'timeseries',
105
+ title: 'Daily spend',
106
+ window: '90d',
107
+ metric: defineMetric({
108
+ connector: expensify,
109
+ shape: 'metric',
110
+ name: 'expensify_category_spend',
111
+ field: 'value',
112
+ fn: 'sum',
113
+ }),
114
+ },
115
+ },
116
+ }),
117
+ },
118
+ });
119
+ ```
120
+
121
+ ## Rate limits
122
+
123
+ Expensify does not publish a fixed per-credential request rate limit. The connector issues at most two requests per sync (a report-export generate call followed by a download call) and relies on the shared HTTP client to honor 429 responses with backoff.
124
+
125
+ ## Limitations
126
+
127
+ - Reports and expenses are fetched over a rolling lookback window (lookbackDays) and rewritten on every sync, so reports and expenses older than the window age out of storage. Category-spend metric history outside the window is preserved across incremental syncs.
128
+ - Amounts are reported in the smallest unit of each expense currency (e.g. cents for USD), matching the Expensify Integration Server output.
129
+ - The connector reads report data via the combinedReportData export (reports plus their transaction lists). Line-item receipt images and audit-log detail are out of scope.
130
+ - Category-spend is bucketed per (created day, category, currency); expenses without a category are grouped under "Uncategorized".
131
+
132
+ ## Links
133
+
134
+ - [Rawdash docs](https://rawdash.dev/docs/connectors)
135
+ - [Expensify API docs](https://integrations.expensify.com/Integration-Server/doc/)
136
+ - [GitHub](https://github.com/rawdash/rawdash)
137
+
138
+ ## License
139
+
140
+ Apache-2.0
@@ -0,0 +1,443 @@
1
+ import { BaseConnector, ConnectorContext, SyncOptions, StorageHandle, SyncResult, ConnectorDoc } from '@rawdash/core';
2
+ import { z } from 'zod';
3
+
4
+ declare const configFields: z.ZodObject<{
5
+ partnerName: z.ZodString;
6
+ partnerPassword: z.ZodObject<{
7
+ $secret: z.ZodString;
8
+ }, z.core.$strip>;
9
+ lookbackDays: z.ZodOptional<z.ZodNumber>;
10
+ resources: z.ZodOptional<z.ZodArray<z.ZodEnum<{
11
+ reports: "reports";
12
+ expenses: "expenses";
13
+ expense_categories: "expense_categories";
14
+ }>>>;
15
+ }, z.core.$strip>;
16
+ declare const doc: ConnectorDoc;
17
+ type ExpensifyResource = 'reports' | 'expenses' | 'expense_categories';
18
+ interface ExpensifySettings {
19
+ partnerName: string;
20
+ lookbackDays?: number;
21
+ resources?: readonly ExpensifyResource[];
22
+ }
23
+ declare const expensifyCredentials: {
24
+ partnerPassword: {
25
+ description: string;
26
+ auth: "required";
27
+ };
28
+ };
29
+ type ExpensifyCredentials = typeof expensifyCredentials;
30
+ declare const expensifyResources: {
31
+ readonly expensify_report: {
32
+ readonly shape: "entity";
33
+ readonly description: "Expense reports with total, currency, workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, ...), submitter, and submit/approve timestamps.";
34
+ readonly endpoint: "POST /ExpensifyIntegrations (combinedReportData)";
35
+ readonly filterable: [];
36
+ readonly fields: [{
37
+ readonly name: "reportName";
38
+ readonly description: "Report title.";
39
+ }, {
40
+ readonly name: "total";
41
+ readonly description: "Report total in the smallest currency unit.";
42
+ readonly unit: "cents";
43
+ }, {
44
+ readonly name: "currency";
45
+ readonly description: "ISO currency code of the report.";
46
+ }, {
47
+ readonly name: "status";
48
+ readonly description: "Workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, CLOSED, ...), uppercased.";
49
+ }, {
50
+ readonly name: "submitterEmail";
51
+ readonly description: "Email of the report submitter.";
52
+ }, {
53
+ readonly name: "submittedDate";
54
+ readonly description: "Submission timestamp, if any.";
55
+ }, {
56
+ readonly name: "approvedDate";
57
+ readonly description: "Approval timestamp, if any.";
58
+ }, {
59
+ readonly name: "policyName";
60
+ readonly description: "Expense policy the report is under.";
61
+ }, {
62
+ readonly name: "expenseCount";
63
+ readonly description: "Number of expenses on the report.";
64
+ }];
65
+ readonly responses: {
66
+ readonly reports: z.ZodArray<z.ZodObject<{
67
+ reportID: z.ZodString;
68
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
70
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
77
+ transactionID: z.ZodString;
78
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
+ amount: z.ZodNumber;
80
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ created: z.ZodString;
83
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
85
+ }, z.core.$strip>>>>;
86
+ }, z.core.$strip>>;
87
+ };
88
+ };
89
+ readonly expensify_expense: {
90
+ readonly shape: "event";
91
+ readonly description: "Individual expenses (one event per transaction) timestamped at the expense creation date, carrying merchant, amount, currency, category, and parent report.";
92
+ readonly endpoint: "POST /ExpensifyIntegrations (combinedReportData)";
93
+ readonly notes: "Derived from the transactionList of every report in the lookback window and rewritten on every sync, so resyncs are idempotent.";
94
+ readonly filterable: [];
95
+ readonly fields: [{
96
+ readonly name: "expenseId";
97
+ readonly description: "Expensify transaction id.";
98
+ }, {
99
+ readonly name: "reportId";
100
+ readonly description: "Parent report id.";
101
+ }, {
102
+ readonly name: "merchant";
103
+ readonly description: "Merchant name.";
104
+ }, {
105
+ readonly name: "amount";
106
+ readonly description: "Expense amount in the smallest currency unit.";
107
+ readonly unit: "cents";
108
+ }, {
109
+ readonly name: "currency";
110
+ readonly description: "ISO currency code of the expense.";
111
+ }, {
112
+ readonly name: "category";
113
+ readonly description: "Expense category, if categorized.";
114
+ }, {
115
+ readonly name: "created";
116
+ readonly description: "Expense creation date (YYYY-MM-DD).";
117
+ }, {
118
+ readonly name: "comment";
119
+ readonly description: "Free-text comment on the expense.";
120
+ }, {
121
+ readonly name: "reimbursable";
122
+ readonly description: "Whether the expense is reimbursable.";
123
+ }];
124
+ readonly responses: {
125
+ readonly expenses: z.ZodArray<z.ZodObject<{
126
+ reportID: z.ZodString;
127
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
129
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
130
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
131
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
133
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
135
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
136
+ transactionID: z.ZodString;
137
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
+ amount: z.ZodNumber;
139
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
140
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
141
+ created: z.ZodString;
142
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
143
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
144
+ }, z.core.$strip>>>>;
145
+ }, z.core.$strip>>;
146
+ };
147
+ };
148
+ readonly expensify_category_spend: {
149
+ readonly shape: "metric";
150
+ readonly description: "Daily expense spend bucketed by category and currency: the summed expense amount per (creation day, category, currency).";
151
+ readonly endpoint: "POST /ExpensifyIntegrations (combinedReportData)";
152
+ readonly unit: "cents";
153
+ readonly granularity: "day";
154
+ readonly notes: "Aggregated in the connector from the same combinedReportData export used for reports and expenses. The metric value is the summed amount (smallest currency unit) for the bucket.";
155
+ readonly dimensions: [{
156
+ readonly name: "date";
157
+ readonly description: "Expense creation day (YYYY-MM-DD).";
158
+ }, {
159
+ readonly name: "category";
160
+ readonly description: "Expense category, or \"Uncategorized\" when absent.";
161
+ }, {
162
+ readonly name: "currency";
163
+ readonly description: "ISO currency code the amount is denominated in.";
164
+ }];
165
+ readonly measures: [{
166
+ readonly name: "expenseCount";
167
+ readonly description: "Number of expenses aggregated into the bucket.";
168
+ }];
169
+ readonly responses: {
170
+ readonly expense_categories: z.ZodArray<z.ZodObject<{
171
+ reportID: z.ZodString;
172
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
174
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
175
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
176
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
181
+ transactionID: z.ZodString;
182
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
+ amount: z.ZodNumber;
184
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
185
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
186
+ created: z.ZodString;
187
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
188
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
189
+ }, z.core.$strip>>>>;
190
+ }, z.core.$strip>>;
191
+ };
192
+ };
193
+ };
194
+ declare const id = "expensify";
195
+ declare class ExpensifyConnector extends BaseConnector<ExpensifySettings, ExpensifyCredentials> {
196
+ static readonly id = "expensify";
197
+ static readonly resources: {
198
+ readonly expensify_report: {
199
+ readonly shape: "entity";
200
+ readonly description: "Expense reports with total, currency, workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, ...), submitter, and submit/approve timestamps.";
201
+ readonly endpoint: "POST /ExpensifyIntegrations (combinedReportData)";
202
+ readonly filterable: [];
203
+ readonly fields: [{
204
+ readonly name: "reportName";
205
+ readonly description: "Report title.";
206
+ }, {
207
+ readonly name: "total";
208
+ readonly description: "Report total in the smallest currency unit.";
209
+ readonly unit: "cents";
210
+ }, {
211
+ readonly name: "currency";
212
+ readonly description: "ISO currency code of the report.";
213
+ }, {
214
+ readonly name: "status";
215
+ readonly description: "Workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, CLOSED, ...), uppercased.";
216
+ }, {
217
+ readonly name: "submitterEmail";
218
+ readonly description: "Email of the report submitter.";
219
+ }, {
220
+ readonly name: "submittedDate";
221
+ readonly description: "Submission timestamp, if any.";
222
+ }, {
223
+ readonly name: "approvedDate";
224
+ readonly description: "Approval timestamp, if any.";
225
+ }, {
226
+ readonly name: "policyName";
227
+ readonly description: "Expense policy the report is under.";
228
+ }, {
229
+ readonly name: "expenseCount";
230
+ readonly description: "Number of expenses on the report.";
231
+ }];
232
+ readonly responses: {
233
+ readonly reports: z.ZodArray<z.ZodObject<{
234
+ reportID: z.ZodString;
235
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
236
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
237
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
238
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
239
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
240
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
241
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
242
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
243
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
244
+ transactionID: z.ZodString;
245
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
246
+ amount: z.ZodNumber;
247
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
248
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
249
+ created: z.ZodString;
250
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
251
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
252
+ }, z.core.$strip>>>>;
253
+ }, z.core.$strip>>;
254
+ };
255
+ };
256
+ readonly expensify_expense: {
257
+ readonly shape: "event";
258
+ readonly description: "Individual expenses (one event per transaction) timestamped at the expense creation date, carrying merchant, amount, currency, category, and parent report.";
259
+ readonly endpoint: "POST /ExpensifyIntegrations (combinedReportData)";
260
+ readonly notes: "Derived from the transactionList of every report in the lookback window and rewritten on every sync, so resyncs are idempotent.";
261
+ readonly filterable: [];
262
+ readonly fields: [{
263
+ readonly name: "expenseId";
264
+ readonly description: "Expensify transaction id.";
265
+ }, {
266
+ readonly name: "reportId";
267
+ readonly description: "Parent report id.";
268
+ }, {
269
+ readonly name: "merchant";
270
+ readonly description: "Merchant name.";
271
+ }, {
272
+ readonly name: "amount";
273
+ readonly description: "Expense amount in the smallest currency unit.";
274
+ readonly unit: "cents";
275
+ }, {
276
+ readonly name: "currency";
277
+ readonly description: "ISO currency code of the expense.";
278
+ }, {
279
+ readonly name: "category";
280
+ readonly description: "Expense category, if categorized.";
281
+ }, {
282
+ readonly name: "created";
283
+ readonly description: "Expense creation date (YYYY-MM-DD).";
284
+ }, {
285
+ readonly name: "comment";
286
+ readonly description: "Free-text comment on the expense.";
287
+ }, {
288
+ readonly name: "reimbursable";
289
+ readonly description: "Whether the expense is reimbursable.";
290
+ }];
291
+ readonly responses: {
292
+ readonly expenses: z.ZodArray<z.ZodObject<{
293
+ reportID: z.ZodString;
294
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
295
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
296
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
298
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
299
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
300
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
301
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
302
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
303
+ transactionID: z.ZodString;
304
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
305
+ amount: z.ZodNumber;
306
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
307
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
308
+ created: z.ZodString;
309
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
310
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
311
+ }, z.core.$strip>>>>;
312
+ }, z.core.$strip>>;
313
+ };
314
+ };
315
+ readonly expensify_category_spend: {
316
+ readonly shape: "metric";
317
+ readonly description: "Daily expense spend bucketed by category and currency: the summed expense amount per (creation day, category, currency).";
318
+ readonly endpoint: "POST /ExpensifyIntegrations (combinedReportData)";
319
+ readonly unit: "cents";
320
+ readonly granularity: "day";
321
+ readonly notes: "Aggregated in the connector from the same combinedReportData export used for reports and expenses. The metric value is the summed amount (smallest currency unit) for the bucket.";
322
+ readonly dimensions: [{
323
+ readonly name: "date";
324
+ readonly description: "Expense creation day (YYYY-MM-DD).";
325
+ }, {
326
+ readonly name: "category";
327
+ readonly description: "Expense category, or \"Uncategorized\" when absent.";
328
+ }, {
329
+ readonly name: "currency";
330
+ readonly description: "ISO currency code the amount is denominated in.";
331
+ }];
332
+ readonly measures: [{
333
+ readonly name: "expenseCount";
334
+ readonly description: "Number of expenses aggregated into the bucket.";
335
+ }];
336
+ readonly responses: {
337
+ readonly expense_categories: z.ZodArray<z.ZodObject<{
338
+ reportID: z.ZodString;
339
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
340
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
341
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
342
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
343
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
344
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
345
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
346
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
347
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
348
+ transactionID: z.ZodString;
349
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
350
+ amount: z.ZodNumber;
351
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
352
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
353
+ created: z.ZodString;
354
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
355
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
356
+ }, z.core.$strip>>>>;
357
+ }, z.core.$strip>>;
358
+ };
359
+ };
360
+ };
361
+ static readonly schemas: {
362
+ readonly reports: z.ZodArray<z.ZodObject<{
363
+ reportID: z.ZodString;
364
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
365
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
366
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
367
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
368
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
369
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
370
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
371
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
372
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
373
+ transactionID: z.ZodString;
374
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
375
+ amount: z.ZodNumber;
376
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
377
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
378
+ created: z.ZodString;
379
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
380
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
381
+ }, z.core.$strip>>>>;
382
+ }, z.core.$strip>>;
383
+ } & {
384
+ readonly expenses: z.ZodArray<z.ZodObject<{
385
+ reportID: z.ZodString;
386
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
387
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
388
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
389
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
390
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
391
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
392
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
393
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
394
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
395
+ transactionID: z.ZodString;
396
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
397
+ amount: z.ZodNumber;
398
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
399
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
400
+ created: z.ZodString;
401
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
402
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
403
+ }, z.core.$strip>>>>;
404
+ }, z.core.$strip>>;
405
+ } & {
406
+ readonly expense_categories: z.ZodArray<z.ZodObject<{
407
+ reportID: z.ZodString;
408
+ reportName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
409
+ total: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
410
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
411
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
412
+ submitterEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
413
+ submittedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
414
+ approvedDate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
415
+ policyName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
416
+ transactionList: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
417
+ transactionID: z.ZodString;
418
+ merchant: z.ZodOptional<z.ZodNullable<z.ZodString>>;
419
+ amount: z.ZodNumber;
420
+ currency: z.ZodOptional<z.ZodNullable<z.ZodString>>;
421
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
422
+ created: z.ZodString;
423
+ comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
424
+ reimbursable: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
425
+ }, z.core.$strip>>>>;
426
+ }, z.core.$strip>>;
427
+ } & Readonly<Record<string, z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
428
+ static create(input: unknown, ctx?: ConnectorContext): ExpensifyConnector;
429
+ readonly id = "expensify";
430
+ readonly credentials: {
431
+ partnerPassword: {
432
+ description: string;
433
+ auth: "required";
434
+ };
435
+ };
436
+ private buildHeaders;
437
+ private credentialsBlock;
438
+ private postJob;
439
+ private fetchCombinedReportData;
440
+ sync(options: SyncOptions, storage: StorageHandle, signal?: AbortSignal): Promise<SyncResult>;
441
+ }
442
+
443
+ export { ExpensifyConnector, type ExpensifySettings, configFields, ExpensifyConnector as default, doc, id, expensifyResources as resources };
package/dist/index.js ADDED
@@ -0,0 +1,514 @@
1
+ // ../../connector-shared/dist/index.js
2
+ var HTTP_CLIENT_VERSION = "0.0.0";
3
+ var DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;
4
+ function connectorUserAgent(connectorId) {
5
+ return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;
6
+ }
7
+
8
+ // src/expensify.ts
9
+ import {
10
+ BaseConnector,
11
+ defineConfigFields,
12
+ defineConnectorDoc,
13
+ defineResources,
14
+ metricSample,
15
+ schemasFromResources
16
+ } from "@rawdash/core";
17
+ import { z } from "zod";
18
+ var configFields = defineConfigFields(
19
+ z.object({
20
+ partnerName: z.string().min(1).meta({
21
+ label: "Partner user ID",
22
+ description: "The Expensify API partnerUserID. Generate a credential pair in the Expensify web app under Settings \u2192 Account \u2192 API, and use the partnerUserID here.",
23
+ placeholder: "your_partnerUserID"
24
+ }),
25
+ partnerPassword: z.object({ $secret: z.string() }).meta({
26
+ label: "Partner user secret",
27
+ description: "The Expensify API partnerUserSecret paired with the partnerUserID. Store it as a secret.",
28
+ placeholder: "xxxxxxxxxxxxxxxx",
29
+ secret: true
30
+ }),
31
+ lookbackDays: z.number().int().positive().optional().meta({
32
+ label: "Lookback days (full sync)",
33
+ description: "How many calendar days of reports (by submit/created date) to fetch on a full sync. Defaults to 180.",
34
+ placeholder: "180"
35
+ }),
36
+ resources: z.array(z.enum(["reports", "expenses", "expense_categories"])).nonempty().optional().meta({
37
+ label: "Resources",
38
+ description: "Which Expensify resources to sync. Omit to sync all of them."
39
+ })
40
+ })
41
+ );
42
+ var doc = defineConnectorDoc({
43
+ displayName: "Expensify",
44
+ category: "finance",
45
+ brandColor: "#03D47C",
46
+ tagline: "Sync Expensify expense reports, individual expenses, and daily category spend for finance-ops dashboards: reports pending, month-to-date spend, and spend by category.",
47
+ vendor: {
48
+ name: "Expensify",
49
+ domain: "expensify.com",
50
+ apiDocs: "https://integrations.expensify.com/Integration-Server/doc/",
51
+ website: "https://www.expensify.com"
52
+ },
53
+ auth: {
54
+ summary: "Expensify API partner credentials (partnerUserID + partnerUserSecret). Both are sent in the credentials block of every Integration Server request over HTTPS.",
55
+ setup: [
56
+ "In the Expensify web app, open Settings \u2192 Account \u2192 API and generate a partnerUserID / partnerUserSecret credential pair.",
57
+ "Set the partnerUserID as the `partnerName` config field.",
58
+ 'Store the partnerUserSecret as a secret and reference it from config as `partnerPassword: secret("EXPENSIFY_PARTNER_PASSWORD")`.'
59
+ ]
60
+ },
61
+ rateLimit: "Expensify does not publish a fixed per-credential request rate limit. The connector issues at most two requests per sync (a report-export generate call followed by a download call) and relies on the shared HTTP client to honor 429 responses with backoff.",
62
+ limitations: [
63
+ "Reports and expenses are fetched over a rolling lookback window (lookbackDays) and rewritten on every sync, so reports and expenses older than the window age out of storage. Category-spend metric history outside the window is preserved across incremental syncs.",
64
+ "Amounts are reported in the smallest unit of each expense currency (e.g. cents for USD), matching the Expensify Integration Server output.",
65
+ "The connector reads report data via the combinedReportData export (reports plus their transaction lists). Line-item receipt images and audit-log detail are out of scope.",
66
+ 'Category-spend is bucketed per (created day, category, currency); expenses without a category are grouped under "Uncategorized".'
67
+ ]
68
+ });
69
+ var expensifyCredentials = {
70
+ partnerPassword: {
71
+ description: "Expensify API partnerUserSecret",
72
+ auth: "required"
73
+ }
74
+ };
75
+ var ENDPOINT = "https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations";
76
+ var MS_PER_DAY = 24 * 60 * 60 * 1e3;
77
+ var DEFAULT_LOOKBACK_DAYS = 180;
78
+ var INCREMENTAL_LOOKBACK_DAYS = 30;
79
+ var REPORT_ENTITY = "expensify_report";
80
+ var EXPENSE_EVENT = "expensify_expense";
81
+ var CATEGORY_METRIC = "expensify_category_spend";
82
+ var ALL_RESOURCES = [
83
+ "reports",
84
+ "expenses",
85
+ "expense_categories"
86
+ ];
87
+ var dateString = z.string().regex(/^(19|20)\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/);
88
+ var isoTimestampString = z.string().regex(
89
+ /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/
90
+ );
91
+ var expenseSchema = z.object({
92
+ transactionID: z.string().min(1),
93
+ merchant: z.string().nullish(),
94
+ amount: z.number(),
95
+ currency: z.string().nullish(),
96
+ category: z.string().nullish(),
97
+ created: dateString,
98
+ comment: z.string().nullish(),
99
+ reimbursable: z.boolean().nullish()
100
+ });
101
+ var reportSchema = z.object({
102
+ reportID: z.string().min(1),
103
+ reportName: z.string().nullish(),
104
+ total: z.number().nullish(),
105
+ currency: z.string().nullish(),
106
+ status: z.string().nullish(),
107
+ submitterEmail: z.string().nullish(),
108
+ submittedDate: isoTimestampString.nullish(),
109
+ approvedDate: isoTimestampString.nullish(),
110
+ policyName: z.string().nullish(),
111
+ transactionList: z.array(expenseSchema).nullish()
112
+ });
113
+ var combinedReportSchema = z.array(reportSchema);
114
+ var expensifyResources = defineResources({
115
+ [REPORT_ENTITY]: {
116
+ shape: "entity",
117
+ description: "Expense reports with total, currency, workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, ...), submitter, and submit/approve timestamps.",
118
+ endpoint: "POST /ExpensifyIntegrations (combinedReportData)",
119
+ filterable: [],
120
+ fields: [
121
+ { name: "reportName", description: "Report title." },
122
+ {
123
+ name: "total",
124
+ description: "Report total in the smallest currency unit.",
125
+ unit: "cents"
126
+ },
127
+ { name: "currency", description: "ISO currency code of the report." },
128
+ {
129
+ name: "status",
130
+ description: "Workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, CLOSED, ...), uppercased."
131
+ },
132
+ { name: "submitterEmail", description: "Email of the report submitter." },
133
+ { name: "submittedDate", description: "Submission timestamp, if any." },
134
+ { name: "approvedDate", description: "Approval timestamp, if any." },
135
+ {
136
+ name: "policyName",
137
+ description: "Expense policy the report is under."
138
+ },
139
+ {
140
+ name: "expenseCount",
141
+ description: "Number of expenses on the report."
142
+ }
143
+ ],
144
+ responses: { reports: combinedReportSchema }
145
+ },
146
+ [EXPENSE_EVENT]: {
147
+ shape: "event",
148
+ description: "Individual expenses (one event per transaction) timestamped at the expense creation date, carrying merchant, amount, currency, category, and parent report.",
149
+ endpoint: "POST /ExpensifyIntegrations (combinedReportData)",
150
+ notes: "Derived from the transactionList of every report in the lookback window and rewritten on every sync, so resyncs are idempotent.",
151
+ filterable: [],
152
+ fields: [
153
+ { name: "expenseId", description: "Expensify transaction id." },
154
+ { name: "reportId", description: "Parent report id." },
155
+ { name: "merchant", description: "Merchant name." },
156
+ {
157
+ name: "amount",
158
+ description: "Expense amount in the smallest currency unit.",
159
+ unit: "cents"
160
+ },
161
+ { name: "currency", description: "ISO currency code of the expense." },
162
+ { name: "category", description: "Expense category, if categorized." },
163
+ { name: "created", description: "Expense creation date (YYYY-MM-DD)." },
164
+ { name: "comment", description: "Free-text comment on the expense." },
165
+ {
166
+ name: "reimbursable",
167
+ description: "Whether the expense is reimbursable."
168
+ }
169
+ ],
170
+ responses: { expenses: combinedReportSchema }
171
+ },
172
+ [CATEGORY_METRIC]: {
173
+ shape: "metric",
174
+ description: "Daily expense spend bucketed by category and currency: the summed expense amount per (creation day, category, currency).",
175
+ endpoint: "POST /ExpensifyIntegrations (combinedReportData)",
176
+ unit: "cents",
177
+ granularity: "day",
178
+ notes: "Aggregated in the connector from the same combinedReportData export used for reports and expenses. The metric value is the summed amount (smallest currency unit) for the bucket.",
179
+ dimensions: [
180
+ {
181
+ name: "date",
182
+ description: "Expense creation day (YYYY-MM-DD)."
183
+ },
184
+ {
185
+ name: "category",
186
+ description: 'Expense category, or "Uncategorized" when absent.'
187
+ },
188
+ {
189
+ name: "currency",
190
+ description: "ISO currency code the amount is denominated in."
191
+ }
192
+ ],
193
+ measures: [
194
+ {
195
+ name: "expenseCount",
196
+ description: "Number of expenses aggregated into the bucket."
197
+ }
198
+ ],
199
+ responses: { expense_categories: combinedReportSchema }
200
+ }
201
+ });
202
+ function pad2(n) {
203
+ return String(n).padStart(2, "0");
204
+ }
205
+ function toIsoDate(ms) {
206
+ const d = new Date(ms);
207
+ return `${d.getUTCFullYear()}-${pad2(d.getUTCMonth() + 1)}-${pad2(d.getUTCDate())}`;
208
+ }
209
+ function startOfUtcDay(ms) {
210
+ return Math.floor(ms / MS_PER_DAY) * MS_PER_DAY;
211
+ }
212
+ function isoDateToMs(date) {
213
+ const [y, m, d] = date.slice(0, 10).split("-").map(Number);
214
+ if (y === void 0 || m === void 0 || d === void 0 || !Number.isFinite(y) || !Number.isFinite(m) || !Number.isFinite(d)) {
215
+ return NaN;
216
+ }
217
+ return Date.UTC(y, m - 1, d);
218
+ }
219
+ function parseTimestamp(value) {
220
+ if (!value) {
221
+ return null;
222
+ }
223
+ const direct = Date.parse(value.replace(" ", "T"));
224
+ if (Number.isFinite(direct)) {
225
+ return direct;
226
+ }
227
+ const dayMs = isoDateToMs(value);
228
+ return Number.isFinite(dayMs) ? dayMs : null;
229
+ }
230
+ function getReportWindow(options, lookbackDays, now = Date.now()) {
231
+ const today = startOfUtcDay(now);
232
+ if (options.mode === "latest") {
233
+ return {
234
+ from: toIsoDate(today - (INCREMENTAL_LOOKBACK_DAYS - 1) * MS_PER_DAY),
235
+ to: toIsoDate(today)
236
+ };
237
+ }
238
+ if (options.since) {
239
+ const sinceMs = new Date(options.since).getTime();
240
+ if (Number.isFinite(sinceMs)) {
241
+ const requested = Math.max(
242
+ 1,
243
+ Math.ceil((today - startOfUtcDay(sinceMs)) / MS_PER_DAY) + 1
244
+ );
245
+ const capped = Math.min(requested, lookbackDays);
246
+ return {
247
+ from: toIsoDate(today - (capped - 1) * MS_PER_DAY),
248
+ to: toIsoDate(today)
249
+ };
250
+ }
251
+ }
252
+ return {
253
+ from: toIsoDate(today - (lookbackDays - 1) * MS_PER_DAY),
254
+ to: toIsoDate(today)
255
+ };
256
+ }
257
+ function reportToEntity(report) {
258
+ const updatedAt = parseTimestamp(report.approvedDate) ?? parseTimestamp(report.submittedDate) ?? 0;
259
+ const attributes = {
260
+ reportName: report.reportName ?? null,
261
+ total: report.total ?? null,
262
+ currency: report.currency ?? null,
263
+ status: report.status ? report.status.toUpperCase() : null,
264
+ submitterEmail: report.submitterEmail ?? null,
265
+ submittedDate: report.submittedDate ?? null,
266
+ approvedDate: report.approvedDate ?? null,
267
+ policyName: report.policyName ?? null,
268
+ expenseCount: report.transactionList?.length ?? 0
269
+ };
270
+ return {
271
+ type: REPORT_ENTITY,
272
+ id: report.reportID,
273
+ attributes,
274
+ updated_at: updatedAt
275
+ };
276
+ }
277
+ function reportToExpenseEvents(report) {
278
+ return (report.transactionList ?? []).map((expense) => {
279
+ const ts = isoDateToMs(expense.created);
280
+ const attributes = {
281
+ expenseId: expense.transactionID,
282
+ reportId: report.reportID,
283
+ merchant: expense.merchant ?? null,
284
+ amount: expense.amount,
285
+ currency: expense.currency ?? report.currency ?? null,
286
+ category: expense.category ?? null,
287
+ created: expense.created,
288
+ comment: expense.comment ?? null,
289
+ reimbursable: expense.reimbursable ?? null
290
+ };
291
+ return {
292
+ name: EXPENSE_EVENT,
293
+ start_ts: Number.isFinite(ts) ? ts : 0,
294
+ end_ts: null,
295
+ attributes
296
+ };
297
+ });
298
+ }
299
+ function categoryBuckets(reports) {
300
+ const byKey = /* @__PURE__ */ new Map();
301
+ for (const report of reports) {
302
+ for (const expense of report.transactionList ?? []) {
303
+ const date = expense.created;
304
+ const category = expense.category ?? "Uncategorized";
305
+ const currency = expense.currency ?? report.currency ?? "USD";
306
+ const key = `${date}\0${category}\0${currency}`;
307
+ let bucket = byKey.get(key);
308
+ if (!bucket) {
309
+ bucket = { date, category, currency, total: 0, count: 0 };
310
+ byKey.set(key, bucket);
311
+ }
312
+ bucket.total += expense.amount;
313
+ bucket.count += 1;
314
+ }
315
+ }
316
+ return Array.from(byKey.values()).sort(
317
+ (a, b) => a.date < b.date ? -1 : a.date > b.date ? 1 : 0
318
+ );
319
+ }
320
+ function categoryBucketToMetricSample(bucket) {
321
+ const ts = isoDateToMs(bucket.date);
322
+ return metricSample(expensifyResources, CATEGORY_METRIC, {
323
+ ts: Number.isFinite(ts) ? ts : 0,
324
+ value: bucket.total,
325
+ attributes: {
326
+ date: bucket.date,
327
+ category: bucket.category,
328
+ currency: bucket.currency,
329
+ expenseCount: bucket.count
330
+ }
331
+ });
332
+ }
333
+ function parseReportArray(body) {
334
+ let candidate = body;
335
+ if (typeof body === "string") {
336
+ const trimmed = body.trim();
337
+ if (!trimmed.startsWith("[")) {
338
+ return null;
339
+ }
340
+ try {
341
+ candidate = JSON.parse(trimmed);
342
+ } catch {
343
+ return null;
344
+ }
345
+ }
346
+ if (!Array.isArray(candidate)) {
347
+ return null;
348
+ }
349
+ return combinedReportSchema.parse(candidate);
350
+ }
351
+ function expensifyErrorMessage(body) {
352
+ if (body && typeof body === "object" && !Array.isArray(body) && "responseCode" in body) {
353
+ const record = body;
354
+ const code = typeof record.responseCode === "number" ? record.responseCode : null;
355
+ if (code !== null && code >= 200 && code < 300) {
356
+ return null;
357
+ }
358
+ const message = typeof record.responseMessage === "string" ? record.responseMessage : "unknown error";
359
+ return `Expensify Integration Server error ${code ?? "unknown"}: ${message}`;
360
+ }
361
+ return null;
362
+ }
363
+ function extractFileName(body) {
364
+ if (typeof body !== "string") {
365
+ return null;
366
+ }
367
+ const trimmed = body.trim();
368
+ return trimmed.length > 0 && !trimmed.startsWith("[") && !trimmed.startsWith("{") ? trimmed : null;
369
+ }
370
+ var COMBINED_REPORT_TEMPLATE = `[<#list reports as report><#if report_index != 0>,</#if>{"reportID":"\${report.reportID}","reportName":"\${(report.reportName)!''}","total":\${(report.total)!0},"currency":"\${(report.currency)!''}","status":"\${(report.status)!''}","submitterEmail":"\${(report.submitterEmail)!''}","submittedDate":"\${(report.submitted)!''}","approvedDate":"\${(report.approved)!''}","policyName":"\${(report.policyName)!''}","transactionList":[<#list report.transactionList as expense><#if expense_index != 0>,</#if>{"transactionID":"\${expense.transactionID}","merchant":"\${(expense.merchant)!''}","amount":\${(expense.amount)!0},"currency":"\${(expense.currency)!''}","category":"\${(expense.category)!''}","created":"\${expense.created}","comment":"\${(expense.comment)!''}","reimbursable":\${(expense.reimbursable)?c}}</#list>]}</#list>]`;
371
+ var id = "expensify";
372
+ var ExpensifyConnector = class _ExpensifyConnector extends BaseConnector {
373
+ static id = id;
374
+ static resources = expensifyResources;
375
+ static schemas = schemasFromResources(expensifyResources);
376
+ static create(input, ctx) {
377
+ const parsed = configFields.parse(input);
378
+ return new _ExpensifyConnector(
379
+ {
380
+ partnerName: parsed.partnerName,
381
+ lookbackDays: parsed.lookbackDays,
382
+ resources: parsed.resources
383
+ },
384
+ { partnerPassword: parsed.partnerPassword },
385
+ ctx
386
+ );
387
+ }
388
+ id = id;
389
+ credentials = expensifyCredentials;
390
+ buildHeaders() {
391
+ return {
392
+ "Content-Type": "application/x-www-form-urlencoded",
393
+ "User-Agent": connectorUserAgent("expensify")
394
+ };
395
+ }
396
+ credentialsBlock() {
397
+ return {
398
+ partnerUserID: this.settings.partnerName,
399
+ partnerUserSecret: this.creds.partnerPassword
400
+ };
401
+ }
402
+ async postJob(requestJobDescription, resource, template, signal) {
403
+ const form = new URLSearchParams({
404
+ requestJobDescription: JSON.stringify(requestJobDescription)
405
+ });
406
+ if (template !== void 0) {
407
+ form.set("template", template);
408
+ }
409
+ const res = await this.post(ENDPOINT, {
410
+ resource,
411
+ headers: this.buildHeaders(),
412
+ body: form.toString(),
413
+ signal
414
+ });
415
+ return res.body;
416
+ }
417
+ async fetchCombinedReportData(window, signal) {
418
+ const generated = await this.postJob(
419
+ {
420
+ type: "file",
421
+ credentials: this.credentialsBlock(),
422
+ onReceive: { immediateResponse: ["returnRandomFileName"] },
423
+ inputSettings: {
424
+ type: "combinedReportData",
425
+ filters: { startDate: window.from, endDate: window.to }
426
+ },
427
+ outputSettings: { fileExtension: "json" }
428
+ },
429
+ "reports_generate",
430
+ COMBINED_REPORT_TEMPLATE,
431
+ signal
432
+ );
433
+ const generatedError = expensifyErrorMessage(generated);
434
+ if (generatedError) {
435
+ throw new Error(generatedError);
436
+ }
437
+ const inline = parseReportArray(generated);
438
+ if (inline) {
439
+ return inline;
440
+ }
441
+ const fileName = extractFileName(generated);
442
+ if (!fileName) {
443
+ throw new Error(
444
+ "Expensify: report-export generate call returned neither report data nor a file name."
445
+ );
446
+ }
447
+ const downloaded = await this.postJob(
448
+ {
449
+ type: "download",
450
+ credentials: this.credentialsBlock(),
451
+ fileName,
452
+ fileSystem: "integrationServer"
453
+ },
454
+ "reports_download",
455
+ void 0,
456
+ signal
457
+ );
458
+ const downloadedError = expensifyErrorMessage(downloaded);
459
+ if (downloadedError) {
460
+ throw new Error(downloadedError);
461
+ }
462
+ const data = parseReportArray(downloaded);
463
+ if (!data) {
464
+ throw new Error(
465
+ `Expensify: download of report file "${fileName}" did not return report data.`
466
+ );
467
+ }
468
+ return data;
469
+ }
470
+ async sync(options, storage, signal) {
471
+ const lookbackDays = this.settings.lookbackDays ?? DEFAULT_LOOKBACK_DAYS;
472
+ const window = getReportWindow(options, lookbackDays);
473
+ const active = new Set(
474
+ this.settings.resources ?? ALL_RESOURCES
475
+ );
476
+ const reports = await this.fetchCombinedReportData(window, signal);
477
+ if (active.has("reports")) {
478
+ const entities = reports.map(reportToEntity);
479
+ await storage.entities(entities, { types: [REPORT_ENTITY] });
480
+ }
481
+ if (active.has("expenses")) {
482
+ const events = reports.flatMap(reportToExpenseEvents);
483
+ await storage.events(events, { names: [EXPENSE_EVENT] });
484
+ }
485
+ if (active.has("expense_categories")) {
486
+ const buckets = categoryBuckets(reports);
487
+ const samples = buckets.map(categoryBucketToMetricSample);
488
+ const fromMs = isoDateToMs(window.from);
489
+ const toMs = isoDateToMs(window.to);
490
+ const times = samples.map((s) => s.ts);
491
+ const replaceWindow = Number.isFinite(fromMs) && Number.isFinite(toMs) ? {
492
+ start: Math.min(fromMs, ...times),
493
+ end: Math.max(toMs + MS_PER_DAY - 1, ...times)
494
+ } : void 0;
495
+ await storage.metrics(samples, {
496
+ names: [CATEGORY_METRIC],
497
+ ...replaceWindow ? { replaceWindow } : {}
498
+ });
499
+ }
500
+ return { done: true };
501
+ }
502
+ };
503
+
504
+ // src/index.ts
505
+ var index_default = ExpensifyConnector;
506
+ export {
507
+ ExpensifyConnector,
508
+ configFields,
509
+ index_default as default,
510
+ doc,
511
+ id,
512
+ expensifyResources as resources
513
+ };
514
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../connector-shared/src/errors.ts","../../../connector-shared/src/retry.ts","../../../connector-shared/src/version.ts","../../../connector-shared/src/request.ts","../../../connector-shared/src/rate-limit.ts","../../../connector-shared/src/map-concurrent.ts","../../../connector-shared/src/sanitize.ts","../../../connector-shared/src/epoch.ts","../../../connector-shared/src/pagination.ts","../../../connector-shared/src/logger.ts","../src/expensify.ts","../src/index.ts"],"sourcesContent":["import type { HttpResponse } from './types';\n\nexport type HttpErrorKind =\n | 'transient'\n | 'rate_limit'\n | 'auth'\n | 'upstream_bug'\n | 'client_bug';\n\nexport abstract class HttpClientError extends Error {\n abstract readonly kind: HttpErrorKind;\n readonly response?: HttpResponse;\n\n constructor(message: string, response?: HttpResponse) {\n super(message);\n this.name = new.target.name;\n this.response = response;\n }\n}\n\nexport class TransientError extends HttpClientError {\n readonly kind = 'transient' as const;\n}\n\nexport class RateLimitError extends HttpClientError {\n readonly kind = 'rate_limit' as const;\n readonly retryAfter?: Date;\n\n constructor(message: string, response?: HttpResponse, retryAfter?: Date) {\n super(message, response);\n this.retryAfter = retryAfter;\n }\n}\n\nexport class AuthError extends HttpClientError {\n readonly kind = 'auth' as const;\n}\n\nexport class UpstreamBugError extends HttpClientError {\n readonly kind = 'upstream_bug' as const;\n}\n\nexport class ClientBugError extends HttpClientError {\n readonly kind = 'client_bug' as const;\n}\n\nexport function classifyStatus(status: number): HttpErrorKind {\n if (status === 429) {\n return 'rate_limit';\n }\n if (status === 401 || status === 403) {\n return 'auth';\n }\n if (status === 408) {\n return 'transient';\n }\n if (status >= 500) {\n return 'upstream_bug';\n }\n if (status >= 400) {\n return 'client_bug';\n }\n return 'client_bug';\n}\n\nexport function errorForStatus(\n message: string,\n response: HttpResponse,\n retryAfter?: Date,\n): HttpClientError {\n const kind = classifyStatus(response.status);\n switch (kind) {\n case 'rate_limit':\n return new RateLimitError(message, response, retryAfter);\n case 'auth':\n return new AuthError(message, response);\n case 'transient':\n return new TransientError(message, response);\n case 'upstream_bug':\n return new UpstreamBugError(message, response);\n case 'client_bug':\n return new ClientBugError(message, response);\n }\n}\n","import { HttpClientError, RateLimitError, TransientError } from './errors';\n\nexport interface RetryPolicy {\n maxAttempts?: number;\n initialDelayMs?: number;\n maxDelayMs?: number;\n retryOn?: (status: number | null, err?: Error) => boolean;\n}\n\nexport const defaultRetryOn = (status: number | null, err?: Error): boolean => {\n if (err instanceof RateLimitError) {\n return true;\n }\n if (err instanceof TransientError) {\n return true;\n }\n if (status === null) {\n return err instanceof Error && !(err instanceof HttpClientError);\n }\n if (status === 408 || status === 429) {\n return true;\n }\n if (status >= 500) {\n return true;\n }\n return false;\n};\n\nexport function backoffDelayMs(\n attempt: number,\n policy: Required<Pick<RetryPolicy, 'initialDelayMs' | 'maxDelayMs'>>,\n): number {\n const base = policy.initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, policy.maxDelayMs);\n}\n\nexport function parseRetryAfter(\n headerValue: string | null,\n now: Date = new Date(),\n): Date | undefined {\n if (!headerValue) {\n return undefined;\n }\n const trimmed = headerValue.trim();\n if (/^\\d+$/.test(trimmed)) {\n return new Date(now.getTime() + Number(trimmed) * 1000);\n }\n const parsed = Date.parse(trimmed);\n if (Number.isNaN(parsed)) {\n return undefined;\n }\n return new Date(parsed);\n}\n\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) {\n return Promise.reject(signal.reason ?? new Error('Aborted'));\n }\n return new Promise<void>((resolve, reject) => {\n const onAbort = () => {\n clearTimeout(timer);\n reject(signal!.reason ?? new Error('Aborted'));\n };\n const timer = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n}\n","export const HTTP_CLIENT_VERSION = '0.0.0';\n\nexport const DEFAULT_USER_AGENT = `rawdash-connector/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n\nexport function connectorUserAgent(connectorId: string): string {\n return `rawdash-connector-${connectorId}/${HTTP_CLIENT_VERSION} (+https://rawdash.dev)`;\n}\n","import {\n AuthError,\n ClientBugError,\n HttpClientError,\n RateLimitError,\n TransientError,\n UpstreamBugError,\n errorForStatus,\n} from './errors';\nimport { defaultRetryOn, parseRetryAfter, sleep } from './retry';\nimport type { FetchLike, HttpMethod, HttpRequest, HttpResponse } from './types';\nimport { DEFAULT_USER_AGENT } from './version';\n\nconst DEFAULT_TIMEOUT_MS = 10_000;\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_INITIAL_DELAY_MS = 1000;\nconst DEFAULT_MAX_DELAY_MS = 60_000;\nconst OBSERVER_TIMEOUT_MS = 250;\n\nexport interface RequestObservation {\n url: string;\n method: HttpMethod;\n status: number;\n resource: string;\n requestId: string;\n body: unknown;\n}\n\nexport type RequestObserver = (\n event: RequestObservation,\n) => void | Promise<void>;\n\nexport interface RequestOptions {\n fetch?: FetchLike;\n observer?: RequestObserver;\n resource: string;\n requestId?: string;\n}\n\nasync function notifyObserver(\n observer: RequestObserver,\n event: RequestObservation,\n): Promise<void> {\n let result: void | Promise<void>;\n try {\n result = observer(event);\n } catch (err) {\n console.warn('[connector-shared] request observer threw:', err);\n return;\n }\n if (!(result instanceof Promise)) {\n return;\n }\n const guarded = result.catch((err) => {\n console.warn('[connector-shared] request observer rejected:', err);\n });\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, OBSERVER_TIMEOUT_MS);\n });\n try {\n await Promise.race([guarded, timeout]);\n } finally {\n if (timer) {\n clearTimeout(timer);\n }\n }\n}\n\nfunction newRequestId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c?.randomUUID) {\n return c.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;\n}\n\nfunction mergeHeaders(\n defaults: Record<string, string>,\n overrides: Record<string, string> | undefined,\n): Record<string, string> {\n const merged: Record<string, string> = {};\n for (const [k, v] of Object.entries(defaults)) {\n merged[k.toLowerCase()] = v;\n }\n if (overrides) {\n for (const [k, v] of Object.entries(overrides)) {\n merged[k.toLowerCase()] = v;\n }\n }\n return merged;\n}\n\nfunction linkTimeoutSignal(\n parent: AbortSignal | undefined,\n timeoutMs: number,\n): { signal: AbortSignal; cancel: () => void } {\n const controller = new AbortController();\n const onParentAbort = () => {\n controller.abort(parent?.reason);\n };\n if (parent) {\n if (parent.aborted) {\n controller.abort(parent.reason);\n } else {\n parent.addEventListener('abort', onParentAbort, { once: true });\n }\n }\n const timer = setTimeout(() => {\n controller.abort(new Error(`Request timed out after ${timeoutMs}ms`));\n }, timeoutMs);\n return {\n signal: controller.signal,\n cancel: () => {\n clearTimeout(timer);\n if (parent) {\n parent.removeEventListener('abort', onParentAbort);\n }\n },\n };\n}\n\nasync function readBody(\n res: Response,\n parseJson: boolean,\n binary: boolean,\n): Promise<unknown> {\n if (res.status === 204 || res.status === 205) {\n return null;\n }\n if (binary) {\n return new Uint8Array(await res.arrayBuffer());\n }\n const contentType = res.headers.get('content-type') ?? '';\n if (parseJson && contentType.includes('application/json')) {\n const text = await res.text();\n if (text.length === 0) {\n return null;\n }\n return JSON.parse(text);\n }\n return res.text();\n}\n\nexport async function request<T = unknown>(\n req: HttpRequest,\n options: RequestOptions,\n): Promise<HttpResponse<T>> {\n const fetchImpl: FetchLike = options.fetch ?? (globalThis.fetch as FetchLike);\n const retry = req.retry ?? {};\n const maxAttempts = retry.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;\n const initialDelayMs = retry.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;\n const maxDelayMs = retry.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n const retryOn = retry.retryOn ?? defaultRetryOn;\n const timeoutMs = req.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const parseJson = req.parseJson ?? true;\n const binary = req.binary ?? false;\n\n const headers = mergeHeaders(\n {\n 'User-Agent': DEFAULT_USER_AGENT,\n Accept: 'application/json',\n },\n req.headers,\n );\n\n let lastErr: Error | undefined;\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n req.signal?.throwIfAborted();\n\n const { signal, cancel } = linkTimeoutSignal(req.signal, timeoutMs);\n let res: Response;\n try {\n res = await fetchImpl(req.url, {\n method: req.method ?? 'GET',\n headers,\n body: req.body as RequestInit['body'],\n signal,\n });\n } catch (err) {\n cancel();\n if (req.signal?.aborted) {\n throw req.signal.reason ?? err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n lastErr = error;\n if (attempt < maxAttempts - 1 && retryOn(null, error)) {\n const delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n await sleep(delay, req.signal);\n continue;\n }\n throw new TransientError(error.message);\n }\n cancel();\n\n const body = await readBody(res, parseJson, binary);\n const httpResponse: HttpResponse<T> = {\n status: res.status,\n headers: res.headers,\n body: body as T,\n };\n if (req.rateLimit) {\n const state = req.rateLimit.parse(res.headers);\n if (state) {\n httpResponse.rateLimitState = state;\n }\n }\n\n if (options.observer) {\n await notifyObserver(options.observer, {\n url: req.url,\n method: req.method ?? 'GET',\n status: res.status,\n resource: options.resource,\n requestId: options.requestId ?? newRequestId(),\n body,\n });\n }\n\n if (res.ok) {\n return httpResponse;\n }\n\n const retryAfter = parseRetryAfter(res.headers.get('retry-after'));\n const message = `HTTP ${res.status} ${res.statusText} for ${req.method ?? 'GET'} ${req.url}`;\n const err = errorForStatus(message, httpResponse, retryAfter);\n\n if (\n attempt < maxAttempts - 1 &&\n retryOn(res.status, err) &&\n !(err instanceof AuthError) &&\n !(err instanceof ClientBugError)\n ) {\n lastErr = err;\n let delay = computeDelay(attempt, initialDelayMs, maxDelayMs);\n if (err instanceof RateLimitError && retryAfter) {\n const wait = retryAfter.getTime() - Date.now();\n if (wait > 0) {\n delay = Math.min(wait, maxDelayMs);\n }\n }\n await sleep(delay, req.signal);\n continue;\n }\n\n throw err;\n }\n\n throw lastErr ?? new UpstreamBugError('Exhausted retry attempts');\n}\n\nfunction computeDelay(\n attempt: number,\n initialDelayMs: number,\n maxDelayMs: number,\n): number {\n const base = initialDelayMs * 2 ** attempt;\n const jitter = base * 0.25 * Math.random();\n return Math.min(base + jitter, maxDelayMs);\n}\n\nexport { HttpClientError };\n","export interface RateLimitState {\n remaining: number;\n resetAt: Date;\n}\n\nexport interface RateLimitPolicy {\n parse(headers: Headers): RateLimitState | null;\n}\n\nexport interface StandardRateLimitPolicyConfig {\n remainingHeader: string;\n resetHeader: string;\n resetUnit: 's' | 'ms';\n resetFallbackMs?: number;\n}\n\nexport function standardRateLimitPolicy(\n config: StandardRateLimitPolicyConfig,\n): RateLimitPolicy {\n const { remainingHeader, resetHeader, resetUnit, resetFallbackMs } = config;\n const multiplier = resetUnit === 's' ? 1000 : 1;\n return {\n parse(h) {\n const remainingRaw = h.get(remainingHeader);\n if (remainingRaw === null || remainingRaw.trim() === '') {\n return null;\n }\n const remaining = Number(remainingRaw);\n if (!Number.isFinite(remaining)) {\n return null;\n }\n const resetRaw = h.get(resetHeader);\n if (resetRaw === null) {\n if (resetFallbackMs === undefined) {\n return null;\n }\n return {\n remaining,\n resetAt: new Date(Date.now() + resetFallbackMs),\n };\n }\n if (resetRaw.trim() === '') {\n return null;\n }\n const reset = Number(resetRaw);\n if (!Number.isFinite(reset) || reset < 0) {\n return null;\n }\n const resetMs = reset * multiplier;\n if (!Number.isFinite(resetMs)) {\n return null;\n }\n return { remaining, resetAt: new Date(resetMs) };\n },\n };\n}\n","export async function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n fn: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n if (items.length === 0) {\n return results;\n }\n const normalized = Number.isFinite(concurrency) ? Math.floor(concurrency) : 1;\n const limit = Math.max(1, Math.min(normalized, items.length));\n let next = 0;\n let failed = false;\n\n async function worker(): Promise<void> {\n while (!failed) {\n const i = next++;\n if (i >= items.length) {\n return;\n }\n try {\n results[i] = await fn(items[i]!, i);\n } catch (err) {\n failed = true;\n throw err;\n }\n }\n }\n\n const workers: Promise<void>[] = [];\n for (let w = 0; w < limit; w++) {\n workers.push(worker());\n }\n await Promise.all(workers);\n return results;\n}\n","export interface SanitizeAllowedUrlOptions {\n url: string | null;\n host: string;\n pathname: string;\n protocol?: 'https:' | 'http:';\n}\n\nexport function sanitizeAllowedUrl(\n options: SanitizeAllowedUrlOptions,\n): string | null {\n const { url, host, pathname, protocol = 'https:' } = options;\n if (url === null) {\n return null;\n }\n try {\n const u = new URL(url);\n if (u.protocol !== protocol || u.host !== host || u.pathname !== pathname) {\n return null;\n }\n return u.toString();\n } catch {\n return null;\n }\n}\n","export type EpochUnit = 'ms' | 's' | 'iso';\n\nexport function parseEpoch(\n value: number | string | null | undefined,\n unit: EpochUnit,\n): number | null {\n if (value === null || value === undefined) {\n return null;\n }\n if (unit === 'iso') {\n if (typeof value !== 'string') {\n return null;\n }\n const ms = new Date(value).getTime();\n return Number.isFinite(ms) ? ms : null;\n }\n if (typeof value === 'string' && value.trim() === '') {\n return null;\n }\n const n = typeof value === 'number' ? value : Number(value);\n if (!Number.isFinite(n)) {\n return null;\n }\n const result = unit === 's' ? n * 1000 : n;\n return Number.isFinite(result) ? result : null;\n}\n","import { request } from './request';\nimport type { HttpRequest } from './types';\n\nexport function parseLinkHeader(header: string | null): Record<string, string> {\n if (!header) {\n return {};\n }\n const result: Record<string, string> = {};\n for (const part of header.split(',')) {\n const match = part.match(/<([^>]+)>\\s*;\\s*rel=\"([^\"]+)\"/);\n if (match) {\n result[match[2]!] = match[1]!;\n }\n }\n return result;\n}\n\nexport async function* paginateLink<T>(\n initial: HttpRequest,\n parse: (body: unknown) => T[],\n options: { resource: string },\n): AsyncIterable<T> {\n let next: string | null = initial.url;\n while (next) {\n const res: Awaited<ReturnType<typeof request>> = await request(\n {\n ...initial,\n url: next,\n },\n { resource: options.resource },\n );\n for (const item of parse(res.body)) {\n yield item;\n }\n const links = parseLinkHeader(res.headers.get('link'));\n next = links['next'] ?? null;\n }\n}\n\nexport async function* paginateCursor<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; nextCursor: string | null },\n buildNext: (req: HttpRequest, cursor: string) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let req: HttpRequest = initial;\n while (true) {\n const res = await request(req, { resource: options.resource });\n const { items, nextCursor } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!nextCursor) {\n return;\n }\n req = buildNext(req, nextCursor);\n }\n}\n\nexport async function* paginatePage<T>(\n initial: HttpRequest,\n parse: (body: unknown) => { items: T[]; hasMore: boolean },\n buildPage: (req: HttpRequest, page: number) => HttpRequest,\n options: { resource: string },\n): AsyncIterable<T> {\n let page = 1;\n while (true) {\n const req = page === 1 ? initial : buildPage(initial, page);\n const res = await request(req, { resource: options.resource });\n const { items, hasMore } = parse(res.body);\n for (const item of items) {\n yield item;\n }\n if (!hasMore || items.length === 0) {\n return;\n }\n page++;\n }\n}\n","export type LogFields = Record<string, unknown>;\n\nexport interface ConnectorLogger {\n info(event: string, fields?: LogFields): void;\n warn(event: string, fields?: LogFields): void;\n}\n\nexport interface ConnectorLoggerOptions {\n scope: string;\n}\n\nconst MAX_VALUE_LEN = 120;\n\nfunction truncate(s: string, max = MAX_VALUE_LEN): string {\n if (s.length <= max) {\n return s;\n }\n return `${s.slice(0, max - 1)}…`;\n}\n\nfunction formatValue(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return '';\n }\n if (typeof value === 'number' || typeof value === 'boolean') {\n return String(value);\n }\n if (typeof value === 'string') {\n const t = truncate(value);\n if (/[\\s\"=]/.test(t)) {\n return JSON.stringify(t);\n }\n return t;\n }\n if (typeof value === 'bigint') {\n return value.toString();\n }\n let json: string | undefined;\n try {\n json = JSON.stringify(value);\n } catch {\n json = undefined;\n }\n return truncate(json ?? String(value));\n}\n\nexport function formatLogFields(fields?: LogFields): string {\n if (!fields) {\n return '';\n }\n const parts: string[] = [];\n for (const [k, v] of Object.entries(fields)) {\n if (v === undefined) {\n continue;\n }\n parts.push(`${k}=${formatValue(v)}`);\n }\n return parts.length > 0 ? ` ${parts.join(' ')}` : '';\n}\n\nexport function formatLogLine(\n scope: string,\n event: string,\n fields?: LogFields,\n): string {\n return `[${scope}] ${event}${formatLogFields(fields)}`;\n}\n\nexport function createDefaultConnectorLogger(\n opts: ConnectorLoggerOptions,\n): ConnectorLogger {\n return {\n info(event, fields) {\n console.info(formatLogLine(opts.scope, event, fields));\n },\n warn(event, fields) {\n console.warn(formatLogLine(opts.scope, event, fields));\n },\n };\n}\n\nconst NOOP_LOGGER: ConnectorLogger = {\n info() {},\n warn() {},\n};\n\nexport function noopConnectorLogger(): ConnectorLogger {\n return NOOP_LOGGER;\n}\n","import { connectorUserAgent } from '@rawdash/connector-shared';\nimport {\n BaseConnector,\n type ConnectorContext,\n type ConnectorDoc,\n type CredentialsSchema,\n type Entity,\n type Event,\n type JSONValue,\n type MetricSample,\n type StorageHandle,\n type SyncOptions,\n type SyncResult,\n defineConfigFields,\n defineConnectorDoc,\n defineResources,\n metricSample,\n schemasFromResources,\n} from '@rawdash/core';\nimport { z } from 'zod';\n\nexport const configFields = defineConfigFields(\n z.object({\n partnerName: z.string().min(1).meta({\n label: 'Partner user ID',\n description:\n 'The Expensify API partnerUserID. Generate a credential pair in the Expensify web app under Settings → Account → API, and use the partnerUserID here.',\n placeholder: 'your_partnerUserID',\n }),\n partnerPassword: z.object({ $secret: z.string() }).meta({\n label: 'Partner user secret',\n description:\n 'The Expensify API partnerUserSecret paired with the partnerUserID. Store it as a secret.',\n placeholder: 'xxxxxxxxxxxxxxxx',\n secret: true,\n }),\n lookbackDays: z.number().int().positive().optional().meta({\n label: 'Lookback days (full sync)',\n description:\n 'How many calendar days of reports (by submit/created date) to fetch on a full sync. Defaults to 180.',\n placeholder: '180',\n }),\n resources: z\n .array(z.enum(['reports', 'expenses', 'expense_categories']))\n .nonempty()\n .optional()\n .meta({\n label: 'Resources',\n description:\n 'Which Expensify resources to sync. Omit to sync all of them.',\n }),\n }),\n);\n\nexport const doc: ConnectorDoc = defineConnectorDoc({\n displayName: 'Expensify',\n category: 'finance',\n brandColor: '#03D47C',\n tagline:\n 'Sync Expensify expense reports, individual expenses, and daily category spend for finance-ops dashboards: reports pending, month-to-date spend, and spend by category.',\n vendor: {\n name: 'Expensify',\n domain: 'expensify.com',\n apiDocs: 'https://integrations.expensify.com/Integration-Server/doc/',\n website: 'https://www.expensify.com',\n },\n auth: {\n summary:\n 'Expensify API partner credentials (partnerUserID + partnerUserSecret). Both are sent in the credentials block of every Integration Server request over HTTPS.',\n setup: [\n 'In the Expensify web app, open Settings → Account → API and generate a partnerUserID / partnerUserSecret credential pair.',\n 'Set the partnerUserID as the `partnerName` config field.',\n 'Store the partnerUserSecret as a secret and reference it from config as `partnerPassword: secret(\"EXPENSIFY_PARTNER_PASSWORD\")`.',\n ],\n },\n rateLimit:\n 'Expensify does not publish a fixed per-credential request rate limit. The connector issues at most two requests per sync (a report-export generate call followed by a download call) and relies on the shared HTTP client to honor 429 responses with backoff.',\n limitations: [\n 'Reports and expenses are fetched over a rolling lookback window (lookbackDays) and rewritten on every sync, so reports and expenses older than the window age out of storage. Category-spend metric history outside the window is preserved across incremental syncs.',\n 'Amounts are reported in the smallest unit of each expense currency (e.g. cents for USD), matching the Expensify Integration Server output.',\n 'The connector reads report data via the combinedReportData export (reports plus their transaction lists). Line-item receipt images and audit-log detail are out of scope.',\n 'Category-spend is bucketed per (created day, category, currency); expenses without a category are grouped under \"Uncategorized\".',\n ],\n});\n\nexport type ExpensifyResource = 'reports' | 'expenses' | 'expense_categories';\n\nexport interface ExpensifySettings {\n partnerName: string;\n lookbackDays?: number;\n resources?: readonly ExpensifyResource[];\n}\n\nconst expensifyCredentials = {\n partnerPassword: {\n description: 'Expensify API partnerUserSecret',\n auth: 'required' as const,\n },\n} satisfies CredentialsSchema;\n\ntype ExpensifyCredentials = typeof expensifyCredentials;\n\nconst ENDPOINT =\n 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations';\nconst MS_PER_DAY = 24 * 60 * 60 * 1000;\nconst DEFAULT_LOOKBACK_DAYS = 180;\nconst INCREMENTAL_LOOKBACK_DAYS = 30;\n\nconst REPORT_ENTITY = 'expensify_report';\nconst EXPENSE_EVENT = 'expensify_expense';\nconst CATEGORY_METRIC = 'expensify_category_spend';\n\nconst ALL_RESOURCES: readonly ExpensifyResource[] = [\n 'reports',\n 'expenses',\n 'expense_categories',\n];\n\nconst dateString = z\n .string()\n .regex(/^(19|20)\\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/);\n\nconst isoTimestampString = z\n .string()\n .regex(\n /^\\d{4}-\\d{2}-\\d{2}(?:[T ]\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?(?:Z|[+-]\\d{2}:?\\d{2})?)?$/,\n );\n\nconst expenseSchema = z.object({\n transactionID: z.string().min(1),\n merchant: z.string().nullish(),\n amount: z.number(),\n currency: z.string().nullish(),\n category: z.string().nullish(),\n created: dateString,\n comment: z.string().nullish(),\n reimbursable: z.boolean().nullish(),\n});\n\nconst reportSchema = z.object({\n reportID: z.string().min(1),\n reportName: z.string().nullish(),\n total: z.number().nullish(),\n currency: z.string().nullish(),\n status: z.string().nullish(),\n submitterEmail: z.string().nullish(),\n submittedDate: isoTimestampString.nullish(),\n approvedDate: isoTimestampString.nullish(),\n policyName: z.string().nullish(),\n transactionList: z.array(expenseSchema).nullish(),\n});\n\nconst combinedReportSchema = z.array(reportSchema);\n\nexport type ExpensifyReport = z.infer<typeof reportSchema>;\nexport type ExpensifyExpense = z.infer<typeof expenseSchema>;\n\nexport const expensifyResources = defineResources({\n [REPORT_ENTITY]: {\n shape: 'entity',\n description:\n 'Expense reports with total, currency, workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, ...), submitter, and submit/approve timestamps.',\n endpoint: 'POST /ExpensifyIntegrations (combinedReportData)',\n filterable: [],\n fields: [\n { name: 'reportName', description: 'Report title.' },\n {\n name: 'total',\n description: 'Report total in the smallest currency unit.',\n unit: 'cents',\n },\n { name: 'currency', description: 'ISO currency code of the report.' },\n {\n name: 'status',\n description:\n 'Workflow status (OPEN, SUBMITTED, APPROVED, REIMBURSED, CLOSED, ...), uppercased.',\n },\n { name: 'submitterEmail', description: 'Email of the report submitter.' },\n { name: 'submittedDate', description: 'Submission timestamp, if any.' },\n { name: 'approvedDate', description: 'Approval timestamp, if any.' },\n {\n name: 'policyName',\n description: 'Expense policy the report is under.',\n },\n {\n name: 'expenseCount',\n description: 'Number of expenses on the report.',\n },\n ],\n responses: { reports: combinedReportSchema },\n },\n [EXPENSE_EVENT]: {\n shape: 'event',\n description:\n 'Individual expenses (one event per transaction) timestamped at the expense creation date, carrying merchant, amount, currency, category, and parent report.',\n endpoint: 'POST /ExpensifyIntegrations (combinedReportData)',\n notes:\n 'Derived from the transactionList of every report in the lookback window and rewritten on every sync, so resyncs are idempotent.',\n filterable: [],\n fields: [\n { name: 'expenseId', description: 'Expensify transaction id.' },\n { name: 'reportId', description: 'Parent report id.' },\n { name: 'merchant', description: 'Merchant name.' },\n {\n name: 'amount',\n description: 'Expense amount in the smallest currency unit.',\n unit: 'cents',\n },\n { name: 'currency', description: 'ISO currency code of the expense.' },\n { name: 'category', description: 'Expense category, if categorized.' },\n { name: 'created', description: 'Expense creation date (YYYY-MM-DD).' },\n { name: 'comment', description: 'Free-text comment on the expense.' },\n {\n name: 'reimbursable',\n description: 'Whether the expense is reimbursable.',\n },\n ],\n responses: { expenses: combinedReportSchema },\n },\n [CATEGORY_METRIC]: {\n shape: 'metric',\n description:\n 'Daily expense spend bucketed by category and currency: the summed expense amount per (creation day, category, currency).',\n endpoint: 'POST /ExpensifyIntegrations (combinedReportData)',\n unit: 'cents',\n granularity: 'day',\n notes:\n 'Aggregated in the connector from the same combinedReportData export used for reports and expenses. The metric value is the summed amount (smallest currency unit) for the bucket.',\n dimensions: [\n {\n name: 'date',\n description: 'Expense creation day (YYYY-MM-DD).',\n },\n {\n name: 'category',\n description: 'Expense category, or \"Uncategorized\" when absent.',\n },\n {\n name: 'currency',\n description: 'ISO currency code the amount is denominated in.',\n },\n ],\n measures: [\n {\n name: 'expenseCount',\n description: 'Number of expenses aggregated into the bucket.',\n },\n ],\n responses: { expense_categories: combinedReportSchema },\n },\n});\n\ninterface DateWindow {\n from: string;\n to: string;\n}\n\nfunction pad2(n: number): string {\n return String(n).padStart(2, '0');\n}\n\nfunction toIsoDate(ms: number): string {\n const d = new Date(ms);\n return `${d.getUTCFullYear()}-${pad2(d.getUTCMonth() + 1)}-${pad2(d.getUTCDate())}`;\n}\n\nfunction startOfUtcDay(ms: number): number {\n return Math.floor(ms / MS_PER_DAY) * MS_PER_DAY;\n}\n\nfunction isoDateToMs(date: string): number {\n const [y, m, d] = date.slice(0, 10).split('-').map(Number);\n if (\n y === undefined ||\n m === undefined ||\n d === undefined ||\n !Number.isFinite(y) ||\n !Number.isFinite(m) ||\n !Number.isFinite(d)\n ) {\n return NaN;\n }\n return Date.UTC(y, m - 1, d);\n}\n\nfunction parseTimestamp(value: string | null | undefined): number | null {\n if (!value) {\n return null;\n }\n const direct = Date.parse(value.replace(' ', 'T'));\n if (Number.isFinite(direct)) {\n return direct;\n }\n const dayMs = isoDateToMs(value);\n return Number.isFinite(dayMs) ? dayMs : null;\n}\n\nexport function getReportWindow(\n options: SyncOptions,\n lookbackDays: number,\n now: number = Date.now(),\n): DateWindow {\n const today = startOfUtcDay(now);\n if (options.mode === 'latest') {\n return {\n from: toIsoDate(today - (INCREMENTAL_LOOKBACK_DAYS - 1) * MS_PER_DAY),\n to: toIsoDate(today),\n };\n }\n if (options.since) {\n const sinceMs = new Date(options.since).getTime();\n if (Number.isFinite(sinceMs)) {\n const requested = Math.max(\n 1,\n Math.ceil((today - startOfUtcDay(sinceMs)) / MS_PER_DAY) + 1,\n );\n const capped = Math.min(requested, lookbackDays);\n return {\n from: toIsoDate(today - (capped - 1) * MS_PER_DAY),\n to: toIsoDate(today),\n };\n }\n }\n return {\n from: toIsoDate(today - (lookbackDays - 1) * MS_PER_DAY),\n to: toIsoDate(today),\n };\n}\n\nexport function reportToEntity(report: ExpensifyReport): Entity {\n const updatedAt =\n parseTimestamp(report.approvedDate) ??\n parseTimestamp(report.submittedDate) ??\n 0;\n const attributes: Record<string, JSONValue> = {\n reportName: report.reportName ?? null,\n total: report.total ?? null,\n currency: report.currency ?? null,\n status: report.status ? report.status.toUpperCase() : null,\n submitterEmail: report.submitterEmail ?? null,\n submittedDate: report.submittedDate ?? null,\n approvedDate: report.approvedDate ?? null,\n policyName: report.policyName ?? null,\n expenseCount: report.transactionList?.length ?? 0,\n };\n return {\n type: REPORT_ENTITY,\n id: report.reportID,\n attributes,\n updated_at: updatedAt,\n };\n}\n\nexport function reportToExpenseEvents(report: ExpensifyReport): Event[] {\n return (report.transactionList ?? []).map((expense) => {\n const ts = isoDateToMs(expense.created);\n const attributes: Record<string, JSONValue> = {\n expenseId: expense.transactionID,\n reportId: report.reportID,\n merchant: expense.merchant ?? null,\n amount: expense.amount,\n currency: expense.currency ?? report.currency ?? null,\n category: expense.category ?? null,\n created: expense.created,\n comment: expense.comment ?? null,\n reimbursable: expense.reimbursable ?? null,\n };\n return {\n name: EXPENSE_EVENT,\n start_ts: Number.isFinite(ts) ? ts : 0,\n end_ts: null,\n attributes,\n };\n });\n}\n\ninterface CategoryBucket {\n date: string;\n category: string;\n currency: string;\n total: number;\n count: number;\n}\n\nexport function categoryBuckets(reports: ExpensifyReport[]): CategoryBucket[] {\n const byKey = new Map<string, CategoryBucket>();\n for (const report of reports) {\n for (const expense of report.transactionList ?? []) {\n const date = expense.created;\n const category = expense.category ?? 'Uncategorized';\n const currency = expense.currency ?? report.currency ?? 'USD';\n const key = `${date}\u0000${category}\u0000${currency}`;\n let bucket = byKey.get(key);\n if (!bucket) {\n bucket = { date, category, currency, total: 0, count: 0 };\n byKey.set(key, bucket);\n }\n bucket.total += expense.amount;\n bucket.count += 1;\n }\n }\n return Array.from(byKey.values()).sort((a, b) =>\n a.date < b.date ? -1 : a.date > b.date ? 1 : 0,\n );\n}\n\nexport function categoryBucketToMetricSample(\n bucket: CategoryBucket,\n): MetricSample {\n const ts = isoDateToMs(bucket.date);\n return metricSample(expensifyResources, CATEGORY_METRIC, {\n ts: Number.isFinite(ts) ? ts : 0,\n value: bucket.total,\n attributes: {\n date: bucket.date,\n category: bucket.category,\n currency: bucket.currency,\n expenseCount: bucket.count,\n },\n });\n}\n\nfunction parseReportArray(body: unknown): ExpensifyReport[] | null {\n let candidate: unknown = body;\n if (typeof body === 'string') {\n const trimmed = body.trim();\n if (!trimmed.startsWith('[')) {\n return null;\n }\n try {\n candidate = JSON.parse(trimmed);\n } catch {\n return null;\n }\n }\n if (!Array.isArray(candidate)) {\n return null;\n }\n return combinedReportSchema.parse(candidate);\n}\n\nfunction expensifyErrorMessage(body: unknown): string | null {\n if (\n body &&\n typeof body === 'object' &&\n !Array.isArray(body) &&\n 'responseCode' in body\n ) {\n const record = body as {\n responseCode?: unknown;\n responseMessage?: unknown;\n };\n const code =\n typeof record.responseCode === 'number' ? record.responseCode : null;\n if (code !== null && code >= 200 && code < 300) {\n return null;\n }\n const message =\n typeof record.responseMessage === 'string'\n ? record.responseMessage\n : 'unknown error';\n return `Expensify Integration Server error ${code ?? 'unknown'}: ${message}`;\n }\n return null;\n}\n\nfunction extractFileName(body: unknown): string | null {\n if (typeof body !== 'string') {\n return null;\n }\n const trimmed = body.trim();\n return trimmed.length > 0 &&\n !trimmed.startsWith('[') &&\n !trimmed.startsWith('{')\n ? trimmed\n : null;\n}\n\nconst COMBINED_REPORT_TEMPLATE =\n '[<#list reports as report><#if report_index != 0>,</#if>' +\n '{\"reportID\":\"${report.reportID}\",\"reportName\":\"${(report.reportName)!\\'\\'}\",' +\n '\"total\":${(report.total)!0},\"currency\":\"${(report.currency)!\\'\\'}\",' +\n '\"status\":\"${(report.status)!\\'\\'}\",\"submitterEmail\":\"${(report.submitterEmail)!\\'\\'}\",' +\n '\"submittedDate\":\"${(report.submitted)!\\'\\'}\",\"approvedDate\":\"${(report.approved)!\\'\\'}\",' +\n '\"policyName\":\"${(report.policyName)!\\'\\'}\",\"transactionList\":[' +\n '<#list report.transactionList as expense><#if expense_index != 0>,</#if>' +\n '{\"transactionID\":\"${expense.transactionID}\",\"merchant\":\"${(expense.merchant)!\\'\\'}\",' +\n '\"amount\":${(expense.amount)!0},\"currency\":\"${(expense.currency)!\\'\\'}\",' +\n '\"category\":\"${(expense.category)!\\'\\'}\",\"created\":\"${expense.created}\",' +\n '\"comment\":\"${(expense.comment)!\\'\\'}\",\"reimbursable\":${(expense.reimbursable)?c}}' +\n '</#list>]}</#list>]';\n\nexport const id = 'expensify';\n\nexport class ExpensifyConnector extends BaseConnector<\n ExpensifySettings,\n ExpensifyCredentials\n> {\n static readonly id = id;\n\n static readonly resources = expensifyResources;\n\n static readonly schemas = schemasFromResources(expensifyResources);\n\n static create(input: unknown, ctx?: ConnectorContext): ExpensifyConnector {\n const parsed = configFields.parse(input);\n return new ExpensifyConnector(\n {\n partnerName: parsed.partnerName,\n lookbackDays: parsed.lookbackDays,\n resources: parsed.resources,\n },\n { partnerPassword: parsed.partnerPassword },\n ctx,\n );\n }\n\n readonly id = id;\n override readonly credentials = expensifyCredentials;\n\n private buildHeaders(): Record<string, string> {\n return {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'User-Agent': connectorUserAgent('expensify'),\n };\n }\n\n private credentialsBlock(): {\n partnerUserID: string;\n partnerUserSecret: string;\n } {\n return {\n partnerUserID: this.settings.partnerName,\n partnerUserSecret: this.creds.partnerPassword,\n };\n }\n\n private async postJob(\n requestJobDescription: Record<string, unknown>,\n resource: string,\n template: string | undefined,\n signal?: AbortSignal,\n ): Promise<unknown> {\n const form = new URLSearchParams({\n requestJobDescription: JSON.stringify(requestJobDescription),\n });\n if (template !== undefined) {\n form.set('template', template);\n }\n const res = await this.post<unknown>(ENDPOINT, {\n resource,\n headers: this.buildHeaders(),\n body: form.toString(),\n signal,\n });\n return res.body;\n }\n\n private async fetchCombinedReportData(\n window: DateWindow,\n signal?: AbortSignal,\n ): Promise<ExpensifyReport[]> {\n const generated = await this.postJob(\n {\n type: 'file',\n credentials: this.credentialsBlock(),\n onReceive: { immediateResponse: ['returnRandomFileName'] },\n inputSettings: {\n type: 'combinedReportData',\n filters: { startDate: window.from, endDate: window.to },\n },\n outputSettings: { fileExtension: 'json' },\n },\n 'reports_generate',\n COMBINED_REPORT_TEMPLATE,\n signal,\n );\n const generatedError = expensifyErrorMessage(generated);\n if (generatedError) {\n throw new Error(generatedError);\n }\n const inline = parseReportArray(generated);\n if (inline) {\n return inline;\n }\n const fileName = extractFileName(generated);\n if (!fileName) {\n throw new Error(\n 'Expensify: report-export generate call returned neither report data nor a file name.',\n );\n }\n const downloaded = await this.postJob(\n {\n type: 'download',\n credentials: this.credentialsBlock(),\n fileName,\n fileSystem: 'integrationServer',\n },\n 'reports_download',\n undefined,\n signal,\n );\n const downloadedError = expensifyErrorMessage(downloaded);\n if (downloadedError) {\n throw new Error(downloadedError);\n }\n const data = parseReportArray(downloaded);\n if (!data) {\n throw new Error(\n `Expensify: download of report file \"${fileName}\" did not return report data.`,\n );\n }\n return data;\n }\n\n async sync(\n options: SyncOptions,\n storage: StorageHandle,\n signal?: AbortSignal,\n ): Promise<SyncResult> {\n const lookbackDays = this.settings.lookbackDays ?? DEFAULT_LOOKBACK_DAYS;\n const window = getReportWindow(options, lookbackDays);\n const active = new Set<ExpensifyResource>(\n this.settings.resources ?? ALL_RESOURCES,\n );\n\n const reports = await this.fetchCombinedReportData(window, signal);\n\n if (active.has('reports')) {\n const entities = reports.map(reportToEntity);\n await storage.entities(entities, { types: [REPORT_ENTITY] });\n }\n\n if (active.has('expenses')) {\n const events = reports.flatMap(reportToExpenseEvents);\n await storage.events(events, { names: [EXPENSE_EVENT] });\n }\n\n if (active.has('expense_categories')) {\n const buckets = categoryBuckets(reports);\n const samples = buckets.map(categoryBucketToMetricSample);\n const fromMs = isoDateToMs(window.from);\n const toMs = isoDateToMs(window.to);\n const times = samples.map((s) => s.ts);\n const replaceWindow =\n Number.isFinite(fromMs) && Number.isFinite(toMs)\n ? {\n start: Math.min(fromMs, ...times),\n end: Math.max(toMs + MS_PER_DAY - 1, ...times),\n }\n : undefined;\n await storage.metrics(samples, {\n names: [CATEGORY_METRIC],\n ...(replaceWindow ? { replaceWindow } : {}),\n });\n }\n\n return { done: true };\n }\n}\n","import { ExpensifyConnector } from './expensify';\n\nexport {\n configFields,\n doc,\n ExpensifyConnector,\n expensifyResources as resources,\n id,\n} from './expensify';\nexport type { ExpensifySettings } from './expensify';\nexport default ExpensifyConnector;\n"],"mappings":";AEAO,IAAM,sBAAsB;AAE5B,IAAM,qBAAqB,qBAAqB,mBAAmB;AAEnE,SAAS,mBAAmB,aAA6B;AAC9D,SAAO,qBAAqB,WAAW,IAAI,mBAAmB;AAChE;;;AQLA;AAAA,EACE;AAAA,EAWA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS;AAEX,IAAM,eAAe;AAAA,EAC1B,EAAE,OAAO;AAAA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D,UAAM,SAAS,IAAI;AAAA,MACjB,KAAK,SAAS,aAAa;AAAA,IAC7B;AAEA,UAAM,UAAU,MAAM,KAAK,wBAAwB,QAAQ,MAAM;AAEjE,QAAI,OAAO,IAAI,SAAS,GAAG;AACzB,YAAM,WAAW,QAAQ,IAAI,cAAc;AAC3C,YAAM,QAAQ,SAAS,UAAU,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;AAAA,IAC7D;AAEA,QAAI,OAAO,IAAI,UAAU,GAAG;AAC1B,YAAM,SAAS,QAAQ,QAAQ,qBAAqB;AACpD,YAAM,QAAQ,OAAO,QAAQ,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;AAAA,IACzD;AAEA,QAAI,OAAO,IAAI,oBAAoB,GAAG;AACpC,YAAM,UAAU,gBAAgB,OAAO;AACvC,YAAM,UAAU,QAAQ,IAAI,4BAA4B;AACxD,YAAM,SAAS,YAAY,OAAO,IAAI;AACtC,YAAM,OAAO,YAAY,OAAO,EAAE;AAClC,YAAM,QAAQ,QAAQ,IAAI,CAAC,MAAM,EAAE,EAAE;AACrC,YAAM,gBACJ,OAAO,SAAS,MAAM,KAAK,OAAO,SAAS,IAAI,IAC3C;AAAA,QACE,OAAO,KAAK,IAAI,QAAQ,GAAG,KAAK;AAAA,QAChC,KAAK,KAAK,IAAI,OAAO,aAAa,GAAG,GAAG,KAAK;AAAA,MAC/C,IACA;AACN,YAAM,QAAQ,QAAQ,SAAS;AAAA,QAC7B,OAAO,CAAC,eAAe;AAAA,QACvB,GAAI,gBAAgB,EAAE,cAAc,IAAI,CAAC;AAAA,MAC3C,CAAC;AAAA,IACH;AAEA,WAAO,EAAE,MAAM,KAAK;AAAA,EACtB;AACF;;;ACzoBA,IAAO,gBAAQ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@rawdash/connector-expensify",
3
+ "version": "0.28.2",
4
+ "description": "Rawdash connector for Expensify — expense reports, expenses, and category spend",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/rawdash/rawdash.git",
11
+ "directory": "packages/connectors/expensify"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "exports": {
19
+ ".": {
20
+ "@rawdash/source": "./src/index.ts",
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "eslint src",
29
+ "test": "vitest run"
30
+ },
31
+ "dependencies": {
32
+ "@rawdash/core": "workspace:*",
33
+ "zod": "^4.4.3"
34
+ },
35
+ "devDependencies": {
36
+ "@rawdash/connector-shared": "workspace:*",
37
+ "@rawdash/connector-test-utils": "workspace:*",
38
+ "fast-check": "^4.8.0",
39
+ "tsup": "^8.0.0",
40
+ "typescript": "^5.7.2",
41
+ "vitest": "^4.1.4"
42
+ }
43
+ }