@keystrokehq/ramp 0.0.1
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 +149 -0
- package/dist/_official/index.d.mts +3 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/accounting-fields.d.mts +116 -0
- package/dist/accounting-fields.mjs +108 -0
- package/dist/accounting-gl-accounts.d.mts +63 -0
- package/dist/accounting-gl-accounts.mjs +49 -0
- package/dist/accounting-i6txC-MI.mjs +116 -0
- package/dist/accounting-subsidiaries.d.mts +59 -0
- package/dist/accounting-subsidiaries.mjs +49 -0
- package/dist/accounting-sync.d.mts +57 -0
- package/dist/accounting-sync.mjs +51 -0
- package/dist/accounting-tracking-categories.d.mts +36 -0
- package/dist/accounting-tracking-categories.mjs +34 -0
- package/dist/accounting-vendors.d.mts +62 -0
- package/dist/accounting-vendors.mjs +49 -0
- package/dist/applications.d.mts +59 -0
- package/dist/applications.mjs +35 -0
- package/dist/bills-B8W9et3K.mjs +86 -0
- package/dist/bills.d.mts +381 -0
- package/dist/bills.mjs +134 -0
- package/dist/business-CztnWUvt.mjs +83 -0
- package/dist/business.d.mts +28 -0
- package/dist/business.mjs +20 -0
- package/dist/card-programs.d.mts +90 -0
- package/dist/card-programs.mjs +50 -0
- package/dist/cards-BfgPcR38.mjs +153 -0
- package/dist/cards.d.mts +287 -0
- package/dist/cards.mjs +166 -0
- package/dist/cashbacks.d.mts +46 -0
- package/dist/cashbacks.mjs +34 -0
- package/dist/client.d.mts +79 -0
- package/dist/client.mjs +248 -0
- package/dist/common-CUpmNYXw.mjs +64 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/departments.d.mts +63 -0
- package/dist/departments.mjs +79 -0
- package/dist/entities.d.mts +38 -0
- package/dist/entities.mjs +34 -0
- package/dist/errors-Sm92tugz.d.mts +42 -0
- package/dist/events.d.mts +30 -0
- package/dist/events.mjs +39 -0
- package/dist/factory-Da6YVHdL.mjs +15 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-BGliAxAS.mjs +124 -0
- package/dist/integration-Dd6tOtSy.d.mts +47 -0
- package/dist/limits.d.mts +179 -0
- package/dist/limits.mjs +84 -0
- package/dist/locations.d.mts +69 -0
- package/dist/locations.mjs +80 -0
- package/dist/memos.d.mts +42 -0
- package/dist/memos.mjs +36 -0
- package/dist/messaging.d.mts +1 -0
- package/dist/messaging.mjs +1 -0
- package/dist/new-resources-BBJsJEjT.mjs +77 -0
- package/dist/organization-BSaEpvBn.mjs +103 -0
- package/dist/provider-app-JO525h-N.d.mts +45 -0
- package/dist/purchase-orders.d.mts +75 -0
- package/dist/purchase-orders.mjs +36 -0
- package/dist/receipt-integrations.d.mts +31 -0
- package/dist/receipt-integrations.mjs +38 -0
- package/dist/receipts-STq41c2M.mjs +53 -0
- package/dist/receipts.d.mts +62 -0
- package/dist/receipts.mjs +61 -0
- package/dist/reimbursements-OknrZUMF.mjs +37 -0
- package/dist/reimbursements.d.mts +89 -0
- package/dist/reimbursements.mjs +39 -0
- package/dist/schemas/index.d.mts +887 -0
- package/dist/schemas/index.mjs +56 -0
- package/dist/shared-CTTtP5gv.mjs +24 -0
- package/dist/spend-programs.d.mts +48 -0
- package/dist/spend-programs.mjs +34 -0
- package/dist/spend-requests.d.mts +95 -0
- package/dist/spend-requests.mjs +53 -0
- package/dist/statements.d.mts +41 -0
- package/dist/statements.mjs +37 -0
- package/dist/transactions-Djd0oIGK.mjs +53 -0
- package/dist/transactions.d.mts +181 -0
- package/dist/transactions.mjs +81 -0
- package/dist/transfers-WBQZVdGP.mjs +40 -0
- package/dist/transfers.d.mts +72 -0
- package/dist/transfers.mjs +36 -0
- package/dist/triggers/index.d.mts +81 -0
- package/dist/triggers/index.mjs +199 -0
- package/dist/unified-requests.d.mts +67 -0
- package/dist/unified-requests.mjs +37 -0
- package/dist/users-ufcXrfNK.mjs +74 -0
- package/dist/users.d.mts +204 -0
- package/dist/users.mjs +101 -0
- package/dist/vendor-bank-accounts.d.mts +110 -0
- package/dist/vendor-bank-accounts.mjs +83 -0
- package/dist/vendors-B7DQrlAn.d.mts +1116 -0
- package/dist/vendors-Bx1cgXwC.mjs +83 -0
- package/dist/vendors.d.mts +116 -0
- package/dist/vendors.mjs +84 -0
- package/dist/verification.d.mts +22 -0
- package/dist/verification.mjs +38 -0
- package/dist/webhook-CsbvcgrC.mjs +61 -0
- package/dist/webhook-sde3Ui2N.d.mts +68 -0
- package/dist/webhooks-mgmt-d1xgVpWx.mjs +35 -0
- package/dist/webhooks.d.mts +83 -0
- package/dist/webhooks.mjs +81 -0
- package/package.json +222 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CredentialSet } from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
|
|
5
|
+
//#region src/_official/provider-app.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Internal credential set for the Keystroke-owned Ramp OAuth application.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors the `zoomAppCredentialSet` pattern: stores the client id/secret that
|
|
10
|
+
* Keystroke uses to speak to Ramp's token endpoint, and optionally the webhook
|
|
11
|
+
* signing secret used to verify inbound `X-Ramp-Signature` headers.
|
|
12
|
+
*
|
|
13
|
+
* This is never exposed directly to end users — the public OAuth flow injects
|
|
14
|
+
* access tokens into {@link ramp} (defined in `integration.ts`).
|
|
15
|
+
*/
|
|
16
|
+
declare const rampAppCredentialSet: CredentialSet<"ramp-app", z.ZodObject<{
|
|
17
|
+
clientId: z.ZodString;
|
|
18
|
+
clientSecret: z.ZodString;
|
|
19
|
+
webhookSecret: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
21
|
+
clientId: z.ZodString;
|
|
22
|
+
clientSecret: z.ZodString;
|
|
23
|
+
webhookSecret: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>>[] | undefined>;
|
|
25
|
+
declare const rampPlatformProviderSeed: {
|
|
26
|
+
readonly provider: "ramp";
|
|
27
|
+
readonly appRef: "ramp-platform";
|
|
28
|
+
readonly displayName: "Ramp Platform";
|
|
29
|
+
readonly credentialSetName: "Keystroke Ramp Platform App";
|
|
30
|
+
readonly envShape: {
|
|
31
|
+
readonly KEYSTROKE_PLATFORM_RAMP_CLIENT_ID: z.ZodOptional<z.ZodString>;
|
|
32
|
+
readonly KEYSTROKE_PLATFORM_RAMP_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
|
|
33
|
+
readonly KEYSTROKE_PLATFORM_RAMP_WEBHOOK_SECRET: z.ZodOptional<z.ZodString>;
|
|
34
|
+
};
|
|
35
|
+
readonly requiredEnvKeys: readonly ["KEYSTROKE_PLATFORM_RAMP_CLIENT_ID", "KEYSTROKE_PLATFORM_RAMP_CLIENT_SECRET"];
|
|
36
|
+
readonly externalAppIdEnvKey: "KEYSTROKE_PLATFORM_RAMP_CLIENT_ID";
|
|
37
|
+
readonly buildCredentials: (env: Record<string, string | undefined>) => {
|
|
38
|
+
webhookSecret?: string | undefined;
|
|
39
|
+
clientId: string | undefined;
|
|
40
|
+
clientSecret: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
type RampAppCredentials = z.infer<typeof rampAppCredentialSet.auth>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { rampAppCredentialSet as n, rampPlatformProviderSeed as r, RampAppCredentials as t };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as zod from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
|
+
|
|
6
|
+
//#region src/purchase-orders.d.ts
|
|
7
|
+
declare const listPurchaseOrders: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
8
|
+
status: zod.ZodOptional<zod.ZodEnum<{
|
|
9
|
+
DRAFT: "DRAFT";
|
|
10
|
+
PENDING: "PENDING";
|
|
11
|
+
APPROVED: "APPROVED";
|
|
12
|
+
CANCELED: "CANCELED";
|
|
13
|
+
DENIED: "DENIED";
|
|
14
|
+
CLOSED: "CLOSED";
|
|
15
|
+
}>>;
|
|
16
|
+
vendor_id: zod.ZodOptional<zod.ZodString>;
|
|
17
|
+
pageSize: zod.ZodOptional<zod.ZodNumber>;
|
|
18
|
+
cursor: zod.ZodOptional<zod.ZodString>;
|
|
19
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
20
|
+
data: zod.ZodArray<zod.ZodObject<{
|
|
21
|
+
id: zod.ZodString;
|
|
22
|
+
number: zod.ZodOptional<zod.ZodString>;
|
|
23
|
+
status: zod.ZodOptional<zod.ZodEnum<{
|
|
24
|
+
DRAFT: "DRAFT";
|
|
25
|
+
PENDING: "PENDING";
|
|
26
|
+
APPROVED: "APPROVED";
|
|
27
|
+
CANCELED: "CANCELED";
|
|
28
|
+
DENIED: "DENIED";
|
|
29
|
+
CLOSED: "CLOSED";
|
|
30
|
+
}>>;
|
|
31
|
+
vendor_id: zod.ZodOptional<zod.ZodString>;
|
|
32
|
+
amount: zod.ZodOptional<zod.ZodObject<{
|
|
33
|
+
amountCents: zod.ZodNumber;
|
|
34
|
+
currency: zod.ZodString;
|
|
35
|
+
}, zod_v4_core0.$strip>>;
|
|
36
|
+
created_at: zod.ZodOptional<zod.ZodString>;
|
|
37
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
38
|
+
entity_id: zod.ZodOptional<zod.ZodString>;
|
|
39
|
+
}, zod_v4_core0.$loose>>;
|
|
40
|
+
page: zod.ZodOptional<zod.ZodObject<{
|
|
41
|
+
next: zod.ZodOptional<zod.ZodString>;
|
|
42
|
+
}, zod_v4_core0.$strip>>;
|
|
43
|
+
}, zod_v4_core0.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
44
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
45
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
46
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
47
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
48
|
+
declare const getPurchaseOrder: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
49
|
+
purchaseOrderId: zod.ZodString;
|
|
50
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
51
|
+
id: zod.ZodString;
|
|
52
|
+
number: zod.ZodOptional<zod.ZodString>;
|
|
53
|
+
status: zod.ZodOptional<zod.ZodEnum<{
|
|
54
|
+
DRAFT: "DRAFT";
|
|
55
|
+
PENDING: "PENDING";
|
|
56
|
+
APPROVED: "APPROVED";
|
|
57
|
+
CANCELED: "CANCELED";
|
|
58
|
+
DENIED: "DENIED";
|
|
59
|
+
CLOSED: "CLOSED";
|
|
60
|
+
}>>;
|
|
61
|
+
vendor_id: zod.ZodOptional<zod.ZodString>;
|
|
62
|
+
amount: zod.ZodOptional<zod.ZodObject<{
|
|
63
|
+
amountCents: zod.ZodNumber;
|
|
64
|
+
currency: zod.ZodString;
|
|
65
|
+
}, zod_v4_core0.$strip>>;
|
|
66
|
+
created_at: zod.ZodOptional<zod.ZodString>;
|
|
67
|
+
description: zod.ZodOptional<zod.ZodString>;
|
|
68
|
+
entity_id: zod.ZodOptional<zod.ZodString>;
|
|
69
|
+
}, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
70
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
71
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
72
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
73
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
74
|
+
//#endregion
|
|
75
|
+
export { getPurchaseOrder, listPurchaseOrders };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createRampClient } from "./client.mjs";
|
|
2
|
+
import { c as rampPurchaseOrderListSchema, l as rampPurchaseOrderSchema, o as rampPurchaseOrderGetInputSchema, s as rampPurchaseOrderListInputSchema } from "./new-resources-BBJsJEjT.mjs";
|
|
3
|
+
import { t as rampOperation } from "./factory-Da6YVHdL.mjs";
|
|
4
|
+
import { t as omitUndefined } from "./shared-CTTtP5gv.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/purchase-orders.ts
|
|
7
|
+
const listPurchaseOrders = rampOperation({
|
|
8
|
+
id: "list_purchase_orders",
|
|
9
|
+
name: "List Purchase Orders",
|
|
10
|
+
description: "List Ramp purchase orders. Supports status and vendor filters.",
|
|
11
|
+
input: rampPurchaseOrderListInputSchema,
|
|
12
|
+
output: rampPurchaseOrderListSchema,
|
|
13
|
+
run: async (input, credentials) => {
|
|
14
|
+
const client = createRampClient(credentials);
|
|
15
|
+
return rampPurchaseOrderListSchema.parse(await client.request("/purchase-orders", { query: omitUndefined({
|
|
16
|
+
status: input.status,
|
|
17
|
+
vendor_id: input.vendor_id,
|
|
18
|
+
page_size: input.pageSize,
|
|
19
|
+
start: input.cursor
|
|
20
|
+
}) }));
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const getPurchaseOrder = rampOperation({
|
|
24
|
+
id: "get_purchase_order",
|
|
25
|
+
name: "Get Purchase Order",
|
|
26
|
+
description: "Fetch a purchase order by id.",
|
|
27
|
+
input: rampPurchaseOrderGetInputSchema,
|
|
28
|
+
output: rampPurchaseOrderSchema,
|
|
29
|
+
run: async (input, credentials) => {
|
|
30
|
+
const client = createRampClient(credentials);
|
|
31
|
+
return rampPurchaseOrderSchema.parse(await client.request(`/purchase-orders/${encodeURIComponent(input.purchaseOrderId)}`));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { getPurchaseOrder, listPurchaseOrders };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as zod from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
|
+
|
|
6
|
+
//#region src/receipt-integrations.d.ts
|
|
7
|
+
declare const optInReceiptIntegration: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
8
|
+
business_id: zod.ZodString;
|
|
9
|
+
email_address: zod.ZodString;
|
|
10
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
11
|
+
business_id: zod.ZodOptional<zod.ZodString>;
|
|
12
|
+
email_address: zod.ZodOptional<zod.ZodString>;
|
|
13
|
+
opted_in: zod.ZodOptional<zod.ZodBoolean>;
|
|
14
|
+
}, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
15
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
16
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
17
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
18
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
19
|
+
declare const optOutReceiptIntegration: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
20
|
+
business_id: zod.ZodString;
|
|
21
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
22
|
+
business_id: zod.ZodOptional<zod.ZodString>;
|
|
23
|
+
email_address: zod.ZodOptional<zod.ZodString>;
|
|
24
|
+
opted_in: zod.ZodOptional<zod.ZodBoolean>;
|
|
25
|
+
}, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
26
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
27
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
28
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
29
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { optInReceiptIntegration, optOutReceiptIntegration };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRampClient } from "./client.mjs";
|
|
2
|
+
import { i as rampReceiptIntegrationOptedInSchema, n as rampReceiptIntegrationOptInInputSchema, r as rampReceiptIntegrationOptOutInputSchema } from "./receipts-STq41c2M.mjs";
|
|
3
|
+
import { t as rampOperation } from "./factory-Da6YVHdL.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/receipt-integrations.ts
|
|
6
|
+
const optInReceiptIntegration = rampOperation({
|
|
7
|
+
id: "opt_in_receipt_integration",
|
|
8
|
+
name: "Opt In Receipt Integration",
|
|
9
|
+
description: "Enable the inbound receipt-email integration for a Ramp business so users can forward receipts from their mail client.",
|
|
10
|
+
input: rampReceiptIntegrationOptInInputSchema,
|
|
11
|
+
output: rampReceiptIntegrationOptedInSchema,
|
|
12
|
+
needsApproval: true,
|
|
13
|
+
run: async (input, credentials) => {
|
|
14
|
+
const client = createRampClient(credentials);
|
|
15
|
+
return rampReceiptIntegrationOptedInSchema.parse(await client.request("/receipt-integrations/opt-in", {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: input
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const optOutReceiptIntegration = rampOperation({
|
|
22
|
+
id: "opt_out_receipt_integration",
|
|
23
|
+
name: "Opt Out Receipt Integration",
|
|
24
|
+
description: "Disable the inbound receipt-email integration for a Ramp business.",
|
|
25
|
+
input: rampReceiptIntegrationOptOutInputSchema,
|
|
26
|
+
output: rampReceiptIntegrationOptedInSchema,
|
|
27
|
+
needsApproval: true,
|
|
28
|
+
run: async (input, credentials) => {
|
|
29
|
+
const client = createRampClient(credentials);
|
|
30
|
+
return rampReceiptIntegrationOptedInSchema.parse(await client.request("/receipt-integrations/opt-out", {
|
|
31
|
+
method: "POST",
|
|
32
|
+
body: input
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { optInReceiptIntegration, optOutReceiptIntegration };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { a as rampListPaginationInputSchema, f as rampTimestampSchema, i as rampIdSchema, o as rampListResponseSchema } from "./common-CUpmNYXw.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/schemas/receipts.ts
|
|
5
|
+
const rampReceiptSchema = z.object({
|
|
6
|
+
id: rampIdSchema,
|
|
7
|
+
user_id: rampIdSchema.optional(),
|
|
8
|
+
transaction_id: rampIdSchema.optional(),
|
|
9
|
+
receipt_url: z.string().optional(),
|
|
10
|
+
created_at: rampTimestampSchema.optional()
|
|
11
|
+
}).passthrough();
|
|
12
|
+
const rampReceiptListInputSchema = z.object({
|
|
13
|
+
user_id: rampIdSchema.optional(),
|
|
14
|
+
transaction_id: rampIdSchema.optional(),
|
|
15
|
+
created_before: rampTimestampSchema.optional(),
|
|
16
|
+
created_after: rampTimestampSchema.optional()
|
|
17
|
+
}).merge(rampListPaginationInputSchema);
|
|
18
|
+
const rampReceiptListSchema = rampListResponseSchema(rampReceiptSchema);
|
|
19
|
+
const rampReceiptGetInputSchema = z.object({ receiptId: rampIdSchema });
|
|
20
|
+
const rampReceiptUploadInputSchema = z.object({
|
|
21
|
+
user_id: rampIdSchema,
|
|
22
|
+
transaction_id: rampIdSchema.optional(),
|
|
23
|
+
filename: z.string().trim().min(1),
|
|
24
|
+
contentType: z.string().trim().min(1),
|
|
25
|
+
dataBase64: z.string().trim().min(1),
|
|
26
|
+
idempotency_key: z.string().trim().min(1).optional()
|
|
27
|
+
});
|
|
28
|
+
const rampReceiptIntegrationOptInInputSchema = z.object({
|
|
29
|
+
business_id: rampIdSchema,
|
|
30
|
+
email_address: z.string().trim().min(1)
|
|
31
|
+
});
|
|
32
|
+
const rampReceiptIntegrationOptedInSchema = z.object({
|
|
33
|
+
business_id: rampIdSchema.optional(),
|
|
34
|
+
email_address: z.string().optional(),
|
|
35
|
+
opted_in: z.boolean().optional()
|
|
36
|
+
}).passthrough();
|
|
37
|
+
const rampReceiptIntegrationOptOutInputSchema = z.object({ business_id: rampIdSchema });
|
|
38
|
+
const rampStatementSchema = z.object({
|
|
39
|
+
id: rampIdSchema,
|
|
40
|
+
statement_date: rampTimestampSchema.optional(),
|
|
41
|
+
download_url: z.string().optional(),
|
|
42
|
+
entity_id: rampIdSchema.optional()
|
|
43
|
+
}).passthrough();
|
|
44
|
+
const rampStatementListInputSchema = z.object({
|
|
45
|
+
entity_id: rampIdSchema.optional(),
|
|
46
|
+
start: rampTimestampSchema.optional(),
|
|
47
|
+
end: rampTimestampSchema.optional()
|
|
48
|
+
}).merge(rampListPaginationInputSchema);
|
|
49
|
+
const rampStatementListSchema = rampListResponseSchema(rampStatementSchema);
|
|
50
|
+
const rampStatementGetInputSchema = z.object({ statementId: rampIdSchema });
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { rampReceiptListInputSchema as a, rampReceiptUploadInputSchema as c, rampStatementListSchema as d, rampStatementSchema as f, rampReceiptIntegrationOptedInSchema as i, rampStatementGetInputSchema as l, rampReceiptIntegrationOptInInputSchema as n, rampReceiptListSchema as o, rampReceiptIntegrationOptOutInputSchema as r, rampReceiptSchema as s, rampReceiptGetInputSchema as t, rampStatementListInputSchema as u };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as zod from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
|
+
|
|
6
|
+
//#region src/receipts.d.ts
|
|
7
|
+
declare const listReceipts: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
8
|
+
user_id: zod.ZodOptional<zod.ZodString>;
|
|
9
|
+
transaction_id: zod.ZodOptional<zod.ZodString>;
|
|
10
|
+
created_before: zod.ZodOptional<zod.ZodString>;
|
|
11
|
+
created_after: zod.ZodOptional<zod.ZodString>;
|
|
12
|
+
pageSize: zod.ZodOptional<zod.ZodNumber>;
|
|
13
|
+
cursor: zod.ZodOptional<zod.ZodString>;
|
|
14
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
15
|
+
data: zod.ZodArray<zod.ZodObject<{
|
|
16
|
+
id: zod.ZodString;
|
|
17
|
+
user_id: zod.ZodOptional<zod.ZodString>;
|
|
18
|
+
transaction_id: zod.ZodOptional<zod.ZodString>;
|
|
19
|
+
receipt_url: zod.ZodOptional<zod.ZodString>;
|
|
20
|
+
created_at: zod.ZodOptional<zod.ZodString>;
|
|
21
|
+
}, zod_v4_core0.$loose>>;
|
|
22
|
+
page: zod.ZodOptional<zod.ZodObject<{
|
|
23
|
+
next: zod.ZodOptional<zod.ZodString>;
|
|
24
|
+
}, zod_v4_core0.$strip>>;
|
|
25
|
+
}, zod_v4_core0.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
26
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
27
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
28
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
29
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
30
|
+
declare const getReceipt: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
31
|
+
receiptId: zod.ZodString;
|
|
32
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
33
|
+
id: zod.ZodString;
|
|
34
|
+
user_id: zod.ZodOptional<zod.ZodString>;
|
|
35
|
+
transaction_id: zod.ZodOptional<zod.ZodString>;
|
|
36
|
+
receipt_url: zod.ZodOptional<zod.ZodString>;
|
|
37
|
+
created_at: zod.ZodOptional<zod.ZodString>;
|
|
38
|
+
}, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
39
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
40
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
41
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
42
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
43
|
+
declare const uploadReceipt: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
44
|
+
user_id: zod.ZodString;
|
|
45
|
+
transaction_id: zod.ZodOptional<zod.ZodString>;
|
|
46
|
+
filename: zod.ZodString;
|
|
47
|
+
contentType: zod.ZodString;
|
|
48
|
+
dataBase64: zod.ZodString;
|
|
49
|
+
idempotency_key: zod.ZodOptional<zod.ZodString>;
|
|
50
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
51
|
+
id: zod.ZodString;
|
|
52
|
+
user_id: zod.ZodOptional<zod.ZodString>;
|
|
53
|
+
transaction_id: zod.ZodOptional<zod.ZodString>;
|
|
54
|
+
receipt_url: zod.ZodOptional<zod.ZodString>;
|
|
55
|
+
created_at: zod.ZodOptional<zod.ZodString>;
|
|
56
|
+
}, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
57
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
58
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
59
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
60
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { getReceipt, listReceipts, uploadReceipt };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createRampClient } from "./client.mjs";
|
|
2
|
+
import { a as rampReceiptListInputSchema, c as rampReceiptUploadInputSchema, o as rampReceiptListSchema, s as rampReceiptSchema, t as rampReceiptGetInputSchema } from "./receipts-STq41c2M.mjs";
|
|
3
|
+
import { t as rampOperation } from "./factory-Da6YVHdL.mjs";
|
|
4
|
+
import { t as omitUndefined } from "./shared-CTTtP5gv.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/receipts.ts
|
|
7
|
+
const listReceipts = rampOperation({
|
|
8
|
+
id: "list_receipts",
|
|
9
|
+
name: "List Receipts",
|
|
10
|
+
description: "List receipts attached to transactions or uploaded by users. Supports user, transaction, and creation date filters.",
|
|
11
|
+
input: rampReceiptListInputSchema,
|
|
12
|
+
output: rampReceiptListSchema,
|
|
13
|
+
run: async (input, credentials) => {
|
|
14
|
+
const client = createRampClient(credentials);
|
|
15
|
+
return rampReceiptListSchema.parse(await client.request("/receipts", { query: omitUndefined({
|
|
16
|
+
user_id: input.user_id,
|
|
17
|
+
transaction_id: input.transaction_id,
|
|
18
|
+
created_before: input.created_before,
|
|
19
|
+
created_after: input.created_after,
|
|
20
|
+
page_size: input.pageSize,
|
|
21
|
+
start: input.cursor
|
|
22
|
+
}) }));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const getReceipt = rampOperation({
|
|
26
|
+
id: "get_receipt",
|
|
27
|
+
name: "Get Receipt",
|
|
28
|
+
description: "Fetch a Ramp receipt by id. Returns a short-lived signed download URL.",
|
|
29
|
+
input: rampReceiptGetInputSchema,
|
|
30
|
+
output: rampReceiptSchema,
|
|
31
|
+
run: async (input, credentials) => {
|
|
32
|
+
const client = createRampClient(credentials);
|
|
33
|
+
return rampReceiptSchema.parse(await client.request(`/receipts/${encodeURIComponent(input.receiptId)}`));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const uploadReceipt = rampOperation({
|
|
37
|
+
id: "upload_receipt",
|
|
38
|
+
name: "Upload Receipt",
|
|
39
|
+
description: "Upload a receipt image to Ramp. The image bytes must be supplied as base64. Optionally attach to a transaction.",
|
|
40
|
+
input: rampReceiptUploadInputSchema,
|
|
41
|
+
output: rampReceiptSchema,
|
|
42
|
+
needsApproval: true,
|
|
43
|
+
run: async (input, credentials) => {
|
|
44
|
+
const client = createRampClient(credentials);
|
|
45
|
+
const form = new FormData();
|
|
46
|
+
const bytes = Uint8Array.from(atob(input.dataBase64), (ch) => ch.charCodeAt(0));
|
|
47
|
+
const blob = new Blob([bytes], { type: input.contentType });
|
|
48
|
+
form.append("file", blob, input.filename);
|
|
49
|
+
form.append("user_id", input.user_id);
|
|
50
|
+
if (input.transaction_id !== void 0) form.append("transaction_id", input.transaction_id);
|
|
51
|
+
return rampReceiptSchema.parse(await client.request("/receipts", {
|
|
52
|
+
method: "POST",
|
|
53
|
+
body: form,
|
|
54
|
+
multipart: true,
|
|
55
|
+
...input.idempotency_key !== void 0 ? { idempotencyKey: input.idempotency_key } : {}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { getReceipt, listReceipts, uploadReceipt };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { a as rampListPaginationInputSchema, c as rampMoneySchema, f as rampTimestampSchema, i as rampIdSchema, o as rampListResponseSchema, r as rampDateRangeInputSchema } from "./common-CUpmNYXw.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/schemas/reimbursements.ts
|
|
5
|
+
const rampReimbursementStateSchema = z.enum([
|
|
6
|
+
"PENDING",
|
|
7
|
+
"APPROVED",
|
|
8
|
+
"REJECTED",
|
|
9
|
+
"PAID",
|
|
10
|
+
"CANCELED",
|
|
11
|
+
"DRAFT"
|
|
12
|
+
]);
|
|
13
|
+
const rampReimbursementSchema = z.object({
|
|
14
|
+
id: rampIdSchema,
|
|
15
|
+
user_id: rampIdSchema.optional(),
|
|
16
|
+
merchant: z.string().optional(),
|
|
17
|
+
amount: rampMoneySchema.optional(),
|
|
18
|
+
currency: z.string().optional(),
|
|
19
|
+
transaction_date: rampTimestampSchema.optional(),
|
|
20
|
+
memo: z.string().optional(),
|
|
21
|
+
state: rampReimbursementStateSchema.optional(),
|
|
22
|
+
receipts: z.array(rampIdSchema).optional(),
|
|
23
|
+
accounting_categories: z.array(z.object({
|
|
24
|
+
id: rampIdSchema,
|
|
25
|
+
name: z.string().optional()
|
|
26
|
+
}).passthrough()).optional(),
|
|
27
|
+
created_at: rampTimestampSchema.optional()
|
|
28
|
+
}).passthrough();
|
|
29
|
+
const rampReimbursementListInputSchema = z.object({
|
|
30
|
+
user_id: rampIdSchema.optional(),
|
|
31
|
+
state: rampReimbursementStateSchema.optional()
|
|
32
|
+
}).merge(rampListPaginationInputSchema).merge(rampDateRangeInputSchema);
|
|
33
|
+
const rampReimbursementListSchema = rampListResponseSchema(rampReimbursementSchema);
|
|
34
|
+
const rampReimbursementGetInputSchema = z.object({ reimbursementId: rampIdSchema });
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { rampReimbursementStateSchema as a, rampReimbursementSchema as i, rampReimbursementListInputSchema as n, rampReimbursementListSchema as r, rampReimbursementGetInputSchema as t };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as zod from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
|
+
|
|
6
|
+
//#region src/reimbursements.d.ts
|
|
7
|
+
declare const listReimbursements: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
8
|
+
user_id: zod.ZodOptional<zod.ZodString>;
|
|
9
|
+
state: zod.ZodOptional<zod.ZodEnum<{
|
|
10
|
+
DRAFT: "DRAFT";
|
|
11
|
+
PENDING: "PENDING";
|
|
12
|
+
APPROVED: "APPROVED";
|
|
13
|
+
REJECTED: "REJECTED";
|
|
14
|
+
PAID: "PAID";
|
|
15
|
+
CANCELED: "CANCELED";
|
|
16
|
+
}>>;
|
|
17
|
+
pageSize: zod.ZodOptional<zod.ZodNumber>;
|
|
18
|
+
cursor: zod.ZodOptional<zod.ZodString>;
|
|
19
|
+
start: zod.ZodOptional<zod.ZodString>;
|
|
20
|
+
end: zod.ZodOptional<zod.ZodString>;
|
|
21
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
22
|
+
data: zod.ZodArray<zod.ZodObject<{
|
|
23
|
+
id: zod.ZodString;
|
|
24
|
+
user_id: zod.ZodOptional<zod.ZodString>;
|
|
25
|
+
merchant: zod.ZodOptional<zod.ZodString>;
|
|
26
|
+
amount: zod.ZodOptional<zod.ZodObject<{
|
|
27
|
+
amountCents: zod.ZodNumber;
|
|
28
|
+
currency: zod.ZodString;
|
|
29
|
+
}, zod_v4_core0.$strip>>;
|
|
30
|
+
currency: zod.ZodOptional<zod.ZodString>;
|
|
31
|
+
transaction_date: zod.ZodOptional<zod.ZodString>;
|
|
32
|
+
memo: zod.ZodOptional<zod.ZodString>;
|
|
33
|
+
state: zod.ZodOptional<zod.ZodEnum<{
|
|
34
|
+
DRAFT: "DRAFT";
|
|
35
|
+
PENDING: "PENDING";
|
|
36
|
+
APPROVED: "APPROVED";
|
|
37
|
+
REJECTED: "REJECTED";
|
|
38
|
+
PAID: "PAID";
|
|
39
|
+
CANCELED: "CANCELED";
|
|
40
|
+
}>>;
|
|
41
|
+
receipts: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
42
|
+
accounting_categories: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
43
|
+
id: zod.ZodString;
|
|
44
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
45
|
+
}, zod_v4_core0.$loose>>>;
|
|
46
|
+
created_at: zod.ZodOptional<zod.ZodString>;
|
|
47
|
+
}, zod_v4_core0.$loose>>;
|
|
48
|
+
page: zod.ZodOptional<zod.ZodObject<{
|
|
49
|
+
next: zod.ZodOptional<zod.ZodString>;
|
|
50
|
+
}, zod_v4_core0.$strip>>;
|
|
51
|
+
}, zod_v4_core0.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
52
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
53
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
54
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
55
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
56
|
+
declare const getReimbursement: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
57
|
+
reimbursementId: zod.ZodString;
|
|
58
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
59
|
+
id: zod.ZodString;
|
|
60
|
+
user_id: zod.ZodOptional<zod.ZodString>;
|
|
61
|
+
merchant: zod.ZodOptional<zod.ZodString>;
|
|
62
|
+
amount: zod.ZodOptional<zod.ZodObject<{
|
|
63
|
+
amountCents: zod.ZodNumber;
|
|
64
|
+
currency: zod.ZodString;
|
|
65
|
+
}, zod_v4_core0.$strip>>;
|
|
66
|
+
currency: zod.ZodOptional<zod.ZodString>;
|
|
67
|
+
transaction_date: zod.ZodOptional<zod.ZodString>;
|
|
68
|
+
memo: zod.ZodOptional<zod.ZodString>;
|
|
69
|
+
state: zod.ZodOptional<zod.ZodEnum<{
|
|
70
|
+
DRAFT: "DRAFT";
|
|
71
|
+
PENDING: "PENDING";
|
|
72
|
+
APPROVED: "APPROVED";
|
|
73
|
+
REJECTED: "REJECTED";
|
|
74
|
+
PAID: "PAID";
|
|
75
|
+
CANCELED: "CANCELED";
|
|
76
|
+
}>>;
|
|
77
|
+
receipts: zod.ZodOptional<zod.ZodArray<zod.ZodString>>;
|
|
78
|
+
accounting_categories: zod.ZodOptional<zod.ZodArray<zod.ZodObject<{
|
|
79
|
+
id: zod.ZodString;
|
|
80
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
81
|
+
}, zod_v4_core0.$loose>>>;
|
|
82
|
+
created_at: zod.ZodOptional<zod.ZodString>;
|
|
83
|
+
}, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
84
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
85
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
86
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
87
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
88
|
+
//#endregion
|
|
89
|
+
export { getReimbursement, listReimbursements };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createRampClient } from "./client.mjs";
|
|
2
|
+
import { i as rampReimbursementSchema, n as rampReimbursementListInputSchema, r as rampReimbursementListSchema, t as rampReimbursementGetInputSchema } from "./reimbursements-OknrZUMF.mjs";
|
|
3
|
+
import { t as rampOperation } from "./factory-Da6YVHdL.mjs";
|
|
4
|
+
import { t as omitUndefined } from "./shared-CTTtP5gv.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/reimbursements.ts
|
|
7
|
+
const listReimbursements = rampOperation({
|
|
8
|
+
id: "list_reimbursements",
|
|
9
|
+
name: "List Reimbursements",
|
|
10
|
+
description: "List Ramp reimbursements visible to the connected credential. Supports user, state, and date range filters.",
|
|
11
|
+
input: rampReimbursementListInputSchema,
|
|
12
|
+
output: rampReimbursementListSchema,
|
|
13
|
+
run: async (input, credentials) => {
|
|
14
|
+
const client = createRampClient(credentials);
|
|
15
|
+
const query = omitUndefined({
|
|
16
|
+
user_id: input.user_id,
|
|
17
|
+
state: input.state,
|
|
18
|
+
from_date: input.start,
|
|
19
|
+
to_date: input.end,
|
|
20
|
+
page_size: input.pageSize,
|
|
21
|
+
start: input.cursor
|
|
22
|
+
});
|
|
23
|
+
return rampReimbursementListSchema.parse(await client.request("/reimbursements", { query }));
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const getReimbursement = rampOperation({
|
|
27
|
+
id: "get_reimbursement",
|
|
28
|
+
name: "Get Reimbursement",
|
|
29
|
+
description: "Fetch a reimbursement by id.",
|
|
30
|
+
input: rampReimbursementGetInputSchema,
|
|
31
|
+
output: rampReimbursementSchema,
|
|
32
|
+
run: async (input, credentials) => {
|
|
33
|
+
const client = createRampClient(credentials);
|
|
34
|
+
return rampReimbursementSchema.parse(await client.request(`/reimbursements/${encodeURIComponent(input.reimbursementId)}`));
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { getReimbursement, listReimbursements };
|