@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.
Files changed (107) hide show
  1. package/README.md +149 -0
  2. package/dist/_official/index.d.mts +3 -0
  3. package/dist/_official/index.mjs +3 -0
  4. package/dist/_runtime/index.d.mts +1 -0
  5. package/dist/_runtime/index.mjs +1 -0
  6. package/dist/accounting-fields.d.mts +116 -0
  7. package/dist/accounting-fields.mjs +108 -0
  8. package/dist/accounting-gl-accounts.d.mts +63 -0
  9. package/dist/accounting-gl-accounts.mjs +49 -0
  10. package/dist/accounting-i6txC-MI.mjs +116 -0
  11. package/dist/accounting-subsidiaries.d.mts +59 -0
  12. package/dist/accounting-subsidiaries.mjs +49 -0
  13. package/dist/accounting-sync.d.mts +57 -0
  14. package/dist/accounting-sync.mjs +51 -0
  15. package/dist/accounting-tracking-categories.d.mts +36 -0
  16. package/dist/accounting-tracking-categories.mjs +34 -0
  17. package/dist/accounting-vendors.d.mts +62 -0
  18. package/dist/accounting-vendors.mjs +49 -0
  19. package/dist/applications.d.mts +59 -0
  20. package/dist/applications.mjs +35 -0
  21. package/dist/bills-B8W9et3K.mjs +86 -0
  22. package/dist/bills.d.mts +381 -0
  23. package/dist/bills.mjs +134 -0
  24. package/dist/business-CztnWUvt.mjs +83 -0
  25. package/dist/business.d.mts +28 -0
  26. package/dist/business.mjs +20 -0
  27. package/dist/card-programs.d.mts +90 -0
  28. package/dist/card-programs.mjs +50 -0
  29. package/dist/cards-BfgPcR38.mjs +153 -0
  30. package/dist/cards.d.mts +287 -0
  31. package/dist/cards.mjs +166 -0
  32. package/dist/cashbacks.d.mts +46 -0
  33. package/dist/cashbacks.mjs +34 -0
  34. package/dist/client.d.mts +79 -0
  35. package/dist/client.mjs +248 -0
  36. package/dist/common-CUpmNYXw.mjs +64 -0
  37. package/dist/connection.d.mts +2 -0
  38. package/dist/connection.mjs +3 -0
  39. package/dist/departments.d.mts +63 -0
  40. package/dist/departments.mjs +79 -0
  41. package/dist/entities.d.mts +38 -0
  42. package/dist/entities.mjs +34 -0
  43. package/dist/errors-Sm92tugz.d.mts +42 -0
  44. package/dist/events.d.mts +30 -0
  45. package/dist/events.mjs +39 -0
  46. package/dist/factory-Da6YVHdL.mjs +15 -0
  47. package/dist/index.d.mts +1 -0
  48. package/dist/index.mjs +1 -0
  49. package/dist/integration-BGliAxAS.mjs +124 -0
  50. package/dist/integration-Dd6tOtSy.d.mts +47 -0
  51. package/dist/limits.d.mts +179 -0
  52. package/dist/limits.mjs +84 -0
  53. package/dist/locations.d.mts +69 -0
  54. package/dist/locations.mjs +80 -0
  55. package/dist/memos.d.mts +42 -0
  56. package/dist/memos.mjs +36 -0
  57. package/dist/messaging.d.mts +1 -0
  58. package/dist/messaging.mjs +1 -0
  59. package/dist/new-resources-BBJsJEjT.mjs +77 -0
  60. package/dist/organization-BSaEpvBn.mjs +103 -0
  61. package/dist/provider-app-JO525h-N.d.mts +45 -0
  62. package/dist/purchase-orders.d.mts +75 -0
  63. package/dist/purchase-orders.mjs +36 -0
  64. package/dist/receipt-integrations.d.mts +31 -0
  65. package/dist/receipt-integrations.mjs +38 -0
  66. package/dist/receipts-STq41c2M.mjs +53 -0
  67. package/dist/receipts.d.mts +62 -0
  68. package/dist/receipts.mjs +61 -0
  69. package/dist/reimbursements-OknrZUMF.mjs +37 -0
  70. package/dist/reimbursements.d.mts +89 -0
  71. package/dist/reimbursements.mjs +39 -0
  72. package/dist/schemas/index.d.mts +887 -0
  73. package/dist/schemas/index.mjs +56 -0
  74. package/dist/shared-CTTtP5gv.mjs +24 -0
  75. package/dist/spend-programs.d.mts +48 -0
  76. package/dist/spend-programs.mjs +34 -0
  77. package/dist/spend-requests.d.mts +95 -0
  78. package/dist/spend-requests.mjs +53 -0
  79. package/dist/statements.d.mts +41 -0
  80. package/dist/statements.mjs +37 -0
  81. package/dist/transactions-Djd0oIGK.mjs +53 -0
  82. package/dist/transactions.d.mts +181 -0
  83. package/dist/transactions.mjs +81 -0
  84. package/dist/transfers-WBQZVdGP.mjs +40 -0
  85. package/dist/transfers.d.mts +72 -0
  86. package/dist/transfers.mjs +36 -0
  87. package/dist/triggers/index.d.mts +81 -0
  88. package/dist/triggers/index.mjs +199 -0
  89. package/dist/unified-requests.d.mts +67 -0
  90. package/dist/unified-requests.mjs +37 -0
  91. package/dist/users-ufcXrfNK.mjs +74 -0
  92. package/dist/users.d.mts +204 -0
  93. package/dist/users.mjs +101 -0
  94. package/dist/vendor-bank-accounts.d.mts +110 -0
  95. package/dist/vendor-bank-accounts.mjs +83 -0
  96. package/dist/vendors-B7DQrlAn.d.mts +1116 -0
  97. package/dist/vendors-Bx1cgXwC.mjs +83 -0
  98. package/dist/vendors.d.mts +116 -0
  99. package/dist/vendors.mjs +84 -0
  100. package/dist/verification.d.mts +22 -0
  101. package/dist/verification.mjs +38 -0
  102. package/dist/webhook-CsbvcgrC.mjs +61 -0
  103. package/dist/webhook-sde3Ui2N.d.mts +68 -0
  104. package/dist/webhooks-mgmt-d1xgVpWx.mjs +35 -0
  105. package/dist/webhooks.d.mts +83 -0
  106. package/dist/webhooks.mjs +81 -0
  107. package/package.json +222 -0
@@ -0,0 +1,81 @@
1
+ import { createRampClient } from "./client.mjs";
2
+ import { i as rampTransactionSchema, n as rampTransactionListInputSchema, r as rampTransactionListSchema, t as rampTransactionGetInputSchema } from "./transactions-Djd0oIGK.mjs";
3
+ import { t as rampOperation } from "./factory-Da6YVHdL.mjs";
4
+ import { t as omitUndefined } from "./shared-CTTtP5gv.mjs";
5
+ import { z } from "zod";
6
+
7
+ //#region src/transactions.ts
8
+ function clientFor(credentials, options) {
9
+ return createRampClient(credentials, options);
10
+ }
11
+ const listTransactions = rampOperation({
12
+ id: "list_transactions",
13
+ name: "List Transactions",
14
+ description: "List Ramp card transactions with optional filters (date range, amount, merchant, user, state). Returns a single page of results; use `cursor` to paginate.",
15
+ input: rampTransactionListInputSchema,
16
+ output: rampTransactionListSchema,
17
+ run: async (input, credentials) => {
18
+ const client = clientFor(credentials);
19
+ const query = omitUndefined({
20
+ department_id: input.department_id,
21
+ location_id: input.location_id,
22
+ card_id: input.card_id,
23
+ entity_id: input.entity_id,
24
+ merchant_id: input.merchant_id,
25
+ sk_category_id: input.sk_category_id,
26
+ state: input.state,
27
+ min_amount: input.minAmount,
28
+ max_amount: input.maxAmount,
29
+ from_date: input.start,
30
+ to_date: input.end,
31
+ order_by_date_desc: input.orderBy === "user_transaction_time DESC" ? true : void 0,
32
+ page_size: input.pageSize,
33
+ start: input.cursor
34
+ });
35
+ const response = await client.request("/transactions", { query });
36
+ return rampTransactionListSchema.parse(response);
37
+ }
38
+ });
39
+ const getTransaction = rampOperation({
40
+ id: "get_transaction",
41
+ name: "Get Transaction",
42
+ description: "Fetch a single Ramp card transaction by id.",
43
+ input: rampTransactionGetInputSchema,
44
+ output: rampTransactionSchema,
45
+ run: async (input, credentials) => {
46
+ const response = await clientFor(credentials).request(`/transactions/${encodeURIComponent(input.transactionId)}`);
47
+ return rampTransactionSchema.parse(response);
48
+ }
49
+ });
50
+ const listAllTransactions = rampOperation({
51
+ id: "list_all_transactions",
52
+ name: "List All Transactions (auto-paginated)",
53
+ description: "Stream every matching Ramp transaction by following `page.next` until exhausted. Use with care on large date ranges.",
54
+ input: rampTransactionListInputSchema,
55
+ output: z.object({ data: z.array(rampTransactionSchema) }),
56
+ run: async (input, credentials) => {
57
+ const client = clientFor(credentials);
58
+ const query = omitUndefined({
59
+ department_id: input.department_id,
60
+ location_id: input.location_id,
61
+ card_id: input.card_id,
62
+ entity_id: input.entity_id,
63
+ merchant_id: input.merchant_id,
64
+ sk_category_id: input.sk_category_id,
65
+ state: input.state,
66
+ min_amount: input.minAmount,
67
+ max_amount: input.maxAmount,
68
+ from_date: input.start,
69
+ to_date: input.end
70
+ });
71
+ const data = [];
72
+ for await (const item of client.paginate("/transactions", {
73
+ query,
74
+ pageSize: input.pageSize ?? 100
75
+ })) data.push(rampTransactionSchema.parse(item));
76
+ return { data };
77
+ }
78
+ });
79
+
80
+ //#endregion
81
+ export { getTransaction, listAllTransactions, listTransactions };
@@ -0,0 +1,40 @@
1
+ import { a as rampListPaginationInputSchema, c as rampMoneySchema, f as rampTimestampSchema, i as rampIdSchema, o as rampListResponseSchema } from "./common-CUpmNYXw.mjs";
2
+ import { z } from "zod";
3
+
4
+ //#region src/schemas/transfers.ts
5
+ const rampTransferStatusSchema = z.enum([
6
+ "PENDING",
7
+ "PROCESSING",
8
+ "COMPLETED",
9
+ "CANCELED",
10
+ "FAILED"
11
+ ]);
12
+ const rampTransferSchema = z.object({
13
+ id: rampIdSchema,
14
+ amount: rampMoneySchema.optional(),
15
+ status: rampTransferStatusSchema.optional(),
16
+ created_at: rampTimestampSchema.optional(),
17
+ settled_at: rampTimestampSchema.optional(),
18
+ source_account: z.string().optional(),
19
+ destination_account: z.string().optional(),
20
+ entity_id: rampIdSchema.optional()
21
+ }).passthrough();
22
+ const rampTransferListInputSchema = z.object({
23
+ entity_id: rampIdSchema.optional(),
24
+ status: rampTransferStatusSchema.optional()
25
+ }).merge(rampListPaginationInputSchema);
26
+ const rampTransferListSchema = rampListResponseSchema(rampTransferSchema);
27
+ const rampTransferGetInputSchema = z.object({ transferId: rampIdSchema });
28
+ const rampCashbackSchema = z.object({
29
+ id: rampIdSchema,
30
+ amount: rampMoneySchema.optional(),
31
+ status: z.string().optional(),
32
+ granted_date: rampTimestampSchema.optional(),
33
+ entity_id: rampIdSchema.optional()
34
+ }).passthrough();
35
+ const rampCashbackListInputSchema = rampListPaginationInputSchema;
36
+ const rampCashbackListSchema = rampListResponseSchema(rampCashbackSchema);
37
+ const rampCashbackGetInputSchema = z.object({ cashbackId: rampIdSchema });
38
+
39
+ //#endregion
40
+ export { rampTransferGetInputSchema as a, rampTransferSchema as c, rampCashbackSchema as i, rampTransferStatusSchema as l, rampCashbackListInputSchema as n, rampTransferListInputSchema as o, rampCashbackListSchema as r, rampTransferListSchema as s, rampCashbackGetInputSchema as t };
@@ -0,0 +1,72 @@
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/transfers.d.ts
7
+ declare const listTransfers: _keystrokehq_core0.Operation<zod.ZodObject<{
8
+ entity_id: zod.ZodOptional<zod.ZodString>;
9
+ status: zod.ZodOptional<zod.ZodEnum<{
10
+ PENDING: "PENDING";
11
+ CANCELED: "CANCELED";
12
+ FAILED: "FAILED";
13
+ PROCESSING: "PROCESSING";
14
+ COMPLETED: "COMPLETED";
15
+ }>>;
16
+ pageSize: zod.ZodOptional<zod.ZodNumber>;
17
+ cursor: zod.ZodOptional<zod.ZodString>;
18
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
19
+ data: zod.ZodArray<zod.ZodObject<{
20
+ id: zod.ZodString;
21
+ amount: zod.ZodOptional<zod.ZodObject<{
22
+ amountCents: zod.ZodNumber;
23
+ currency: zod.ZodString;
24
+ }, zod_v4_core0.$strip>>;
25
+ status: zod.ZodOptional<zod.ZodEnum<{
26
+ PENDING: "PENDING";
27
+ CANCELED: "CANCELED";
28
+ FAILED: "FAILED";
29
+ PROCESSING: "PROCESSING";
30
+ COMPLETED: "COMPLETED";
31
+ }>>;
32
+ created_at: zod.ZodOptional<zod.ZodString>;
33
+ settled_at: zod.ZodOptional<zod.ZodString>;
34
+ source_account: zod.ZodOptional<zod.ZodString>;
35
+ destination_account: zod.ZodOptional<zod.ZodString>;
36
+ entity_id: zod.ZodOptional<zod.ZodString>;
37
+ }, zod_v4_core0.$loose>>;
38
+ page: zod.ZodOptional<zod.ZodObject<{
39
+ next: zod.ZodOptional<zod.ZodString>;
40
+ }, zod_v4_core0.$strip>>;
41
+ }, zod_v4_core0.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
42
+ RAMP_ACCESS_TOKEN: zod.ZodString;
43
+ }, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
44
+ RAMP_ACCESS_TOKEN: zod.ZodString;
45
+ }, zod_v4_core0.$strip>>[] | undefined>], undefined>;
46
+ declare const getTransfer: _keystrokehq_core0.Operation<zod.ZodObject<{
47
+ transferId: zod.ZodString;
48
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
49
+ id: zod.ZodString;
50
+ amount: zod.ZodOptional<zod.ZodObject<{
51
+ amountCents: zod.ZodNumber;
52
+ currency: zod.ZodString;
53
+ }, zod_v4_core0.$strip>>;
54
+ status: zod.ZodOptional<zod.ZodEnum<{
55
+ PENDING: "PENDING";
56
+ CANCELED: "CANCELED";
57
+ FAILED: "FAILED";
58
+ PROCESSING: "PROCESSING";
59
+ COMPLETED: "COMPLETED";
60
+ }>>;
61
+ created_at: zod.ZodOptional<zod.ZodString>;
62
+ settled_at: zod.ZodOptional<zod.ZodString>;
63
+ source_account: zod.ZodOptional<zod.ZodString>;
64
+ destination_account: zod.ZodOptional<zod.ZodString>;
65
+ entity_id: zod.ZodOptional<zod.ZodString>;
66
+ }, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
67
+ RAMP_ACCESS_TOKEN: zod.ZodString;
68
+ }, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
69
+ RAMP_ACCESS_TOKEN: zod.ZodString;
70
+ }, zod_v4_core0.$strip>>[] | undefined>], undefined>;
71
+ //#endregion
72
+ export { getTransfer, listTransfers };
@@ -0,0 +1,36 @@
1
+ import { createRampClient } from "./client.mjs";
2
+ import { a as rampTransferGetInputSchema, c as rampTransferSchema, o as rampTransferListInputSchema, s as rampTransferListSchema } from "./transfers-WBQZVdGP.mjs";
3
+ import { t as rampOperation } from "./factory-Da6YVHdL.mjs";
4
+ import { t as omitUndefined } from "./shared-CTTtP5gv.mjs";
5
+
6
+ //#region src/transfers.ts
7
+ const listTransfers = rampOperation({
8
+ id: "list_transfers",
9
+ name: "List Transfers",
10
+ description: "List funding transfers between the connected Ramp business and external accounts.",
11
+ input: rampTransferListInputSchema,
12
+ output: rampTransferListSchema,
13
+ run: async (input, credentials) => {
14
+ const client = createRampClient(credentials);
15
+ return rampTransferListSchema.parse(await client.request("/transfers", { query: omitUndefined({
16
+ entity_id: input.entity_id,
17
+ status: input.status,
18
+ page_size: input.pageSize,
19
+ start: input.cursor
20
+ }) }));
21
+ }
22
+ });
23
+ const getTransfer = rampOperation({
24
+ id: "get_transfer",
25
+ name: "Get Transfer",
26
+ description: "Fetch a transfer by id.",
27
+ input: rampTransferGetInputSchema,
28
+ output: rampTransferSchema,
29
+ run: async (input, credentials) => {
30
+ const client = createRampClient(credentials);
31
+ return rampTransferSchema.parse(await client.request(`/transfers/${encodeURIComponent(input.transferId)}`));
32
+ }
33
+ });
34
+
35
+ //#endregion
36
+ export { getTransfer, listTransfers };
@@ -0,0 +1,81 @@
1
+ import { i as ramp } from "../integration-Dd6tOtSy.mjs";
2
+ import { n as rampAppCredentialSet } from "../provider-app-JO525h-N.mjs";
3
+ import { c as rampWebhookEventEnvelopeSchema } from "../webhook-sde3Ui2N.mjs";
4
+ import { toRampWebhookEvent } from "../events.mjs";
5
+ import { E as rampUserSchema, Ft as rampSpendRequestSchema, Kt as rampBillSchema, R as rampTransferSchema, W as rampTransactionSchema, X as rampReimbursementSchema, h as rampVendorSchema, it as rampApplicationSchema, lt as rampPurchaseOrderSchema, mt as rampUnifiedRequestSchema } from "../vendors-B7DQrlAn.mjs";
6
+ import { z } from "zod";
7
+ import { BoundTrigger, WebhookRequest } from "@keystrokehq/core";
8
+ import { IntegrationTriggerBindingFactory, IntegrationTriggerBindingOptions, createWebhookTriggerBindingFactory } from "@keystrokehq/integration-authoring";
9
+ import { PollingTriggerManifest, WebhookTriggerManifest } from "@keystrokehq/core/trigger";
10
+
11
+ //#region src/triggers/polling-bindings.d.ts
12
+ type RampPollResponse<TItemSchema extends z.ZodTypeAny> = {
13
+ data: z.output<TItemSchema>[];
14
+ };
15
+ type RampPollingBindingFactory<TItemSchema extends z.ZodTypeAny> = IntegrationTriggerBindingFactory<RampPollResponse<TItemSchema>, readonly [typeof ramp], PollingTriggerManifest, RampPollResponse<TItemSchema>>;
16
+ declare const pollTransactions: RampPollingBindingFactory<typeof rampTransactionSchema>;
17
+ declare const pollUsers: RampPollingBindingFactory<typeof rampUserSchema>;
18
+ declare const pollBills: RampPollingBindingFactory<typeof rampBillSchema>;
19
+ declare const pollVendors: RampPollingBindingFactory<typeof rampVendorSchema>;
20
+ declare const pollReimbursements: RampPollingBindingFactory<typeof rampReimbursementSchema>;
21
+ declare const pollSpendRequests: RampPollingBindingFactory<typeof rampSpendRequestSchema>;
22
+ declare const pollPurchaseOrders: RampPollingBindingFactory<typeof rampPurchaseOrderSchema>;
23
+ declare const pollApplications: RampPollingBindingFactory<typeof rampApplicationSchema>;
24
+ declare const pollUnifiedRequests: RampPollingBindingFactory<typeof rampUnifiedRequestSchema>;
25
+ declare const pollTransfers: RampPollingBindingFactory<typeof rampTransferSchema>;
26
+ //#endregion
27
+ //#region src/triggers/shared.d.ts
28
+ type RampWebhookCredentialSets = readonly [typeof ramp, typeof rampAppCredentialSet];
29
+ type RampWebhookBindingOptions<TOutput> = IntegrationTriggerBindingOptions<RampWebhookEvent, TOutput, WebhookRequest>;
30
+ type RampWebhookBoundTrigger<TOutput> = BoundTrigger<z.output<typeof rampWebhookEventEnvelopeSchema>, RampWebhookCredentialSets, WebhookTriggerManifest, TOutput, WebhookRequest>;
31
+ type RampWebhookEvent = ReturnType<typeof toRampWebhookEvent>;
32
+ declare function createRampWebhookBinding(defaultName: string, defaultDescription: string, eventTypeMatches: (eventType: string) => boolean): ReturnType<typeof createWebhookTriggerBindingFactory<typeof rampWebhookEventEnvelopeSchema, RampWebhookEvent, RampWebhookCredentialSets>>;
33
+ //#endregion
34
+ //#region src/triggers/webhook-bindings.d.ts
35
+ type Binding = <TOutput = RampWebhookEvent>(options?: IntegrationTriggerBindingOptions<RampWebhookEvent, TOutput, WebhookRequest>) => RampWebhookBoundTrigger<TOutput>;
36
+ /**
37
+ * Ramp webhook namespace.
38
+ *
39
+ * Contains only currently-documented webhook events (15 specific + 6 coarse
40
+ * `any*` helpers) as of 2026-04-17. See IMPLEMENTATION_NOTES.md § 7 Q2 for
41
+ * the rationale behind this catalog (PLAN.md mentioned many additional
42
+ * events that are not currently published by Ramp).
43
+ */
44
+ declare const webhooks: Readonly<{
45
+ transactions: Readonly<{
46
+ authorized: Binding;
47
+ cleared: Binding;
48
+ declined: Binding;
49
+ updated: Binding;
50
+ any: Binding;
51
+ }>;
52
+ bills: Readonly<{
53
+ approved: Binding;
54
+ paid: Binding;
55
+ created: Binding;
56
+ canceled: Binding;
57
+ any: Binding;
58
+ }>;
59
+ purchaseOrders: Readonly<{
60
+ created: Binding;
61
+ approved: Binding;
62
+ denied: Binding;
63
+ any: Binding;
64
+ }>;
65
+ spendRequests: Readonly<{
66
+ commentCreated: Binding;
67
+ any: Binding;
68
+ }>;
69
+ applications: Readonly<{
70
+ approved: Binding;
71
+ denied: Binding;
72
+ any: Binding;
73
+ }>;
74
+ unifiedRequests: Readonly<{
75
+ updated: Binding;
76
+ any: Binding;
77
+ }>;
78
+ }>;
79
+ type RampWebhooksNamespace = typeof webhooks;
80
+ //#endregion
81
+ export { type RampWebhookBindingOptions, type RampWebhookBoundTrigger, type RampWebhookCredentialSets, type RampWebhookEvent, type RampWebhooksNamespace, createRampWebhookBinding, pollApplications, pollBills, pollPurchaseOrders, pollReimbursements, pollSpendRequests, pollTransactions, pollTransfers, pollUnifiedRequests, pollUsers, pollVendors, webhooks };
@@ -0,0 +1,199 @@
1
+ import { a as rampAppCredentialSet, n as ramp } from "../integration-BGliAxAS.mjs";
2
+ import { createRampClient } from "../client.mjs";
3
+ import { l as rampBillSchema } from "../bills-B8W9et3K.mjs";
4
+ import { h as rampSpendRequestSchema } from "../business-CztnWUvt.mjs";
5
+ import { i as rampApplicationSchema, l as rampPurchaseOrderSchema, m as rampUnifiedRequestSchema } from "../new-resources-BBJsJEjT.mjs";
6
+ import { i as rampReimbursementSchema } from "../reimbursements-OknrZUMF.mjs";
7
+ import { i as rampTransactionSchema } from "../transactions-Djd0oIGK.mjs";
8
+ import { c as rampTransferSchema } from "../transfers-WBQZVdGP.mjs";
9
+ import { c as rampUserSchema } from "../users-ufcXrfNK.mjs";
10
+ import { p as rampVendorSchema } from "../vendors-Bx1cgXwC.mjs";
11
+ import { a as rampWebhookEventEnvelopeSchema } from "../webhook-CsbvcgrC.mjs";
12
+ import { toRampWebhookEvent } from "../events.mjs";
13
+ import { verifyRampWebhookRequest } from "../verification.mjs";
14
+ import { z } from "zod";
15
+ import { createPollingTriggerBindingFactory, createWebhookTriggerBindingFactory } from "@keystrokehq/integration-authoring";
16
+
17
+ //#region src/triggers/polling-bindings.ts
18
+ /**
19
+ * Polling triggers compensate for gaps in Ramp's native webhook catalog. Each
20
+ * binding polls a canonical list endpoint on a conservative cadence (5m) and
21
+ * emits one event per resource id discovered since the last poll.
22
+ */
23
+ const RAMP_CREDENTIAL_SETS = [ramp];
24
+ function responseShape(item) {
25
+ return z.object({ data: z.array(item) });
26
+ }
27
+ function pollListEndpoint(path, itemSchema, queryBuilder) {
28
+ return async (ctx) => {
29
+ const client = createRampClient(ctx.credentials.ramp);
30
+ const query = queryBuilder ? queryBuilder(ctx.lastPolledAt) : {};
31
+ const filtered = Object.fromEntries(Object.entries(query).filter(([, v]) => v !== void 0));
32
+ return { data: ((await client.request(path, { query: filtered }))?.data ?? []).map((item) => itemSchema.parse(item)) };
33
+ };
34
+ }
35
+ const pollTransactions = createPollingTriggerBindingFactory({
36
+ defaultName: "Ramp Poll Transactions",
37
+ defaultDescription: "Polls /transactions every 5 minutes and emits new rows.",
38
+ schedule: "*/5 * * * *",
39
+ response: responseShape(rampTransactionSchema),
40
+ credentialSets: RAMP_CREDENTIAL_SETS,
41
+ poll: pollListEndpoint("/transactions", rampTransactionSchema, (lastPolledAt) => ({
42
+ from_date: lastPolledAt,
43
+ page_size: 100
44
+ }))
45
+ });
46
+ const pollUsers = createPollingTriggerBindingFactory({
47
+ defaultName: "Ramp Poll Users",
48
+ defaultDescription: "Polls /users every hour to surface new or updated users.",
49
+ schedule: "0 * * * *",
50
+ response: responseShape(rampUserSchema),
51
+ credentialSets: RAMP_CREDENTIAL_SETS,
52
+ poll: pollListEndpoint("/users", rampUserSchema, () => ({ page_size: 100 }))
53
+ });
54
+ const pollBills = createPollingTriggerBindingFactory({
55
+ defaultName: "Ramp Poll Bills",
56
+ defaultDescription: "Polls /bills every 5 minutes for newly-created or updated bills.",
57
+ schedule: "*/5 * * * *",
58
+ response: responseShape(rampBillSchema),
59
+ credentialSets: RAMP_CREDENTIAL_SETS,
60
+ poll: pollListEndpoint("/bills", rampBillSchema, () => ({ page_size: 100 }))
61
+ });
62
+ const pollVendors = createPollingTriggerBindingFactory({
63
+ defaultName: "Ramp Poll Vendors",
64
+ defaultDescription: "Polls /vendors hourly to surface new vendors.",
65
+ schedule: "0 * * * *",
66
+ response: responseShape(rampVendorSchema),
67
+ credentialSets: RAMP_CREDENTIAL_SETS,
68
+ poll: pollListEndpoint("/vendors", rampVendorSchema, () => ({ page_size: 100 }))
69
+ });
70
+ const pollReimbursements = createPollingTriggerBindingFactory({
71
+ defaultName: "Ramp Poll Reimbursements",
72
+ defaultDescription: "Polls /reimbursements every 5 minutes.",
73
+ schedule: "*/5 * * * *",
74
+ response: responseShape(rampReimbursementSchema),
75
+ credentialSets: RAMP_CREDENTIAL_SETS,
76
+ poll: pollListEndpoint("/reimbursements", rampReimbursementSchema, (lastPolledAt) => ({
77
+ from_date: lastPolledAt,
78
+ page_size: 100
79
+ }))
80
+ });
81
+ const pollSpendRequests = createPollingTriggerBindingFactory({
82
+ defaultName: "Ramp Poll Spend Requests",
83
+ defaultDescription: "Polls /spend-requests every 5 minutes.",
84
+ schedule: "*/5 * * * *",
85
+ response: responseShape(rampSpendRequestSchema),
86
+ credentialSets: RAMP_CREDENTIAL_SETS,
87
+ poll: pollListEndpoint("/spend-requests", rampSpendRequestSchema, () => ({ page_size: 100 }))
88
+ });
89
+ const pollPurchaseOrders = createPollingTriggerBindingFactory({
90
+ defaultName: "Ramp Poll Purchase Orders",
91
+ defaultDescription: "Polls /purchase-orders every 5 minutes.",
92
+ schedule: "*/5 * * * *",
93
+ response: responseShape(rampPurchaseOrderSchema),
94
+ credentialSets: RAMP_CREDENTIAL_SETS,
95
+ poll: pollListEndpoint("/purchase-orders", rampPurchaseOrderSchema, () => ({ page_size: 100 }))
96
+ });
97
+ const pollApplications = createPollingTriggerBindingFactory({
98
+ defaultName: "Ramp Poll Applications",
99
+ defaultDescription: "Polls /applications every 10 minutes for workflow requests.",
100
+ schedule: "*/10 * * * *",
101
+ response: responseShape(rampApplicationSchema),
102
+ credentialSets: RAMP_CREDENTIAL_SETS,
103
+ poll: pollListEndpoint("/applications", rampApplicationSchema, () => ({ page_size: 100 }))
104
+ });
105
+ const pollUnifiedRequests = createPollingTriggerBindingFactory({
106
+ defaultName: "Ramp Poll Unified Requests",
107
+ defaultDescription: "Polls /unified-requests every 10 minutes.",
108
+ schedule: "*/10 * * * *",
109
+ response: responseShape(rampUnifiedRequestSchema),
110
+ credentialSets: RAMP_CREDENTIAL_SETS,
111
+ poll: pollListEndpoint("/unified-requests", rampUnifiedRequestSchema, () => ({ page_size: 100 }))
112
+ });
113
+ const pollTransfers = createPollingTriggerBindingFactory({
114
+ defaultName: "Ramp Poll Transfers",
115
+ defaultDescription: "Polls /transfers every 15 minutes.",
116
+ schedule: "*/15 * * * *",
117
+ response: responseShape(rampTransferSchema),
118
+ credentialSets: RAMP_CREDENTIAL_SETS,
119
+ poll: pollListEndpoint("/transfers", rampTransferSchema, () => ({ page_size: 100 }))
120
+ });
121
+
122
+ //#endregion
123
+ //#region src/triggers/shared.ts
124
+ function createRampWebhookBinding(defaultName, defaultDescription, eventTypeMatches) {
125
+ return createWebhookTriggerBindingFactory({
126
+ defaultName,
127
+ defaultDescription,
128
+ path: "/ramp",
129
+ method: "POST",
130
+ payload: rampWebhookEventEnvelopeSchema,
131
+ credentialSets: [ramp, rampAppCredentialSet],
132
+ verify: (request, ctx) => {
133
+ const { webhookSecret } = ctx.credentials["ramp-app"];
134
+ if (!webhookSecret) throw new Error("Ramp webhook secret is not configured. Set KEYSTROKE_PLATFORM_RAMP_WEBHOOK_SECRET after registering a webhook subscription.");
135
+ if (!verifyRampWebhookRequest(request, webhookSecret)) throw new Error("Invalid Ramp webhook signature.");
136
+ },
137
+ definitionFilter: (payload) => eventTypeMatches(payload.type),
138
+ mapPayload: (payload) => toRampWebhookEvent(payload),
139
+ idempotencyKey: (_payload, mappedPayload) => mappedPayload?.id,
140
+ response: { successStatus: 200 }
141
+ });
142
+ }
143
+
144
+ //#endregion
145
+ //#region src/triggers/webhook-bindings.ts
146
+ function exact(eventType) {
147
+ const bind = createRampWebhookBinding(`Ramp ${eventType}`, `Ramp ${eventType} event`, (type) => type === eventType);
148
+ return (options) => bind(options);
149
+ }
150
+ function prefix(name, description, prefixStr) {
151
+ const bind = createRampWebhookBinding(name, description, (type) => type.startsWith(prefixStr));
152
+ return (options) => bind(options);
153
+ }
154
+ /**
155
+ * Ramp webhook namespace.
156
+ *
157
+ * Contains only currently-documented webhook events (15 specific + 6 coarse
158
+ * `any*` helpers) as of 2026-04-17. See IMPLEMENTATION_NOTES.md § 7 Q2 for
159
+ * the rationale behind this catalog (PLAN.md mentioned many additional
160
+ * events that are not currently published by Ramp).
161
+ */
162
+ const webhooks = Object.freeze({
163
+ transactions: Object.freeze({
164
+ authorized: exact("transactions.authorized"),
165
+ cleared: exact("transactions.cleared"),
166
+ declined: exact("transactions.declined"),
167
+ updated: exact("transactions.updated"),
168
+ any: prefix("Ramp Any Transaction Event", "Any transaction.* webhook (authorized/cleared/declined/updated)", "transactions.")
169
+ }),
170
+ bills: Object.freeze({
171
+ approved: exact("bills.approved"),
172
+ paid: exact("bills.paid"),
173
+ created: exact("bills.created"),
174
+ canceled: exact("bills.canceled"),
175
+ any: prefix("Ramp Any Bill Event", "Any bills.* webhook (approved/paid/created/canceled)", "bills.")
176
+ }),
177
+ purchaseOrders: Object.freeze({
178
+ created: exact("purchase_orders.created"),
179
+ approved: exact("purchase_orders.approved"),
180
+ denied: exact("purchase_orders.denied"),
181
+ any: prefix("Ramp Any Purchase Order Event", "Any purchase_orders.* webhook", "purchase_orders.")
182
+ }),
183
+ spendRequests: Object.freeze({
184
+ commentCreated: exact("spend_requests.comment_created"),
185
+ any: prefix("Ramp Any Spend Request Event", "Any spend_requests.* webhook", "spend_requests.")
186
+ }),
187
+ applications: Object.freeze({
188
+ approved: exact("applications.approved"),
189
+ denied: exact("applications.denied"),
190
+ any: prefix("Ramp Any Application Event", "Any applications.* webhook", "applications.")
191
+ }),
192
+ unifiedRequests: Object.freeze({
193
+ updated: exact("unified_requests.updated"),
194
+ any: prefix("Ramp Any Unified Request Event", "Any unified_requests.* webhook", "unified_requests.")
195
+ })
196
+ });
197
+
198
+ //#endregion
199
+ export { createRampWebhookBinding, pollApplications, pollBills, pollPurchaseOrders, pollReimbursements, pollSpendRequests, pollTransactions, pollTransfers, pollUnifiedRequests, pollUsers, pollVendors, webhooks };
@@ -0,0 +1,67 @@
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/unified-requests.d.ts
7
+ declare const listUnifiedRequests: _keystrokehq_core0.Operation<zod.ZodObject<{
8
+ status: zod.ZodOptional<zod.ZodEnum<{
9
+ PENDING: "PENDING";
10
+ APPROVED: "APPROVED";
11
+ CANCELED: "CANCELED";
12
+ DENIED: "DENIED";
13
+ FULFILLED: "FULFILLED";
14
+ }>>;
15
+ request_type: zod.ZodOptional<zod.ZodString>;
16
+ user_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
+ status: zod.ZodOptional<zod.ZodEnum<{
23
+ PENDING: "PENDING";
24
+ APPROVED: "APPROVED";
25
+ CANCELED: "CANCELED";
26
+ DENIED: "DENIED";
27
+ FULFILLED: "FULFILLED";
28
+ }>>;
29
+ request_type: zod.ZodOptional<zod.ZodString>;
30
+ user_id: zod.ZodOptional<zod.ZodString>;
31
+ created_at: zod.ZodOptional<zod.ZodString>;
32
+ updated_at: zod.ZodOptional<zod.ZodString>;
33
+ resource_id: zod.ZodOptional<zod.ZodString>;
34
+ resource_type: zod.ZodOptional<zod.ZodString>;
35
+ }, zod_v4_core0.$loose>>;
36
+ page: zod.ZodOptional<zod.ZodObject<{
37
+ next: zod.ZodOptional<zod.ZodString>;
38
+ }, zod_v4_core0.$strip>>;
39
+ }, zod_v4_core0.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
40
+ RAMP_ACCESS_TOKEN: zod.ZodString;
41
+ }, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
42
+ RAMP_ACCESS_TOKEN: zod.ZodString;
43
+ }, zod_v4_core0.$strip>>[] | undefined>], undefined>;
44
+ declare const getUnifiedRequest: _keystrokehq_core0.Operation<zod.ZodObject<{
45
+ unifiedRequestId: zod.ZodString;
46
+ }, zod_v4_core0.$strip>, zod.ZodObject<{
47
+ id: zod.ZodString;
48
+ status: zod.ZodOptional<zod.ZodEnum<{
49
+ PENDING: "PENDING";
50
+ APPROVED: "APPROVED";
51
+ CANCELED: "CANCELED";
52
+ DENIED: "DENIED";
53
+ FULFILLED: "FULFILLED";
54
+ }>>;
55
+ request_type: zod.ZodOptional<zod.ZodString>;
56
+ user_id: zod.ZodOptional<zod.ZodString>;
57
+ created_at: zod.ZodOptional<zod.ZodString>;
58
+ updated_at: zod.ZodOptional<zod.ZodString>;
59
+ resource_id: zod.ZodOptional<zod.ZodString>;
60
+ resource_type: zod.ZodOptional<zod.ZodString>;
61
+ }, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
62
+ RAMP_ACCESS_TOKEN: zod.ZodString;
63
+ }, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
64
+ RAMP_ACCESS_TOKEN: zod.ZodString;
65
+ }, zod_v4_core0.$strip>>[] | undefined>], undefined>;
66
+ //#endregion
67
+ export { getUnifiedRequest, listUnifiedRequests };
@@ -0,0 +1,37 @@
1
+ import { createRampClient } from "./client.mjs";
2
+ import { d as rampUnifiedRequestGetInputSchema, f as rampUnifiedRequestListInputSchema, m as rampUnifiedRequestSchema, p as rampUnifiedRequestListSchema } 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/unified-requests.ts
7
+ const listUnifiedRequests = rampOperation({
8
+ id: "list_unified_requests",
9
+ name: "List Unified Requests",
10
+ description: "List Ramp \"unified requests\" — the normalised request object spanning spend requests, bills, applications, and purchase orders.",
11
+ input: rampUnifiedRequestListInputSchema,
12
+ output: rampUnifiedRequestListSchema,
13
+ run: async (input, credentials) => {
14
+ const client = createRampClient(credentials);
15
+ return rampUnifiedRequestListSchema.parse(await client.request("/unified-requests", { query: omitUndefined({
16
+ status: input.status,
17
+ request_type: input.request_type,
18
+ user_id: input.user_id,
19
+ page_size: input.pageSize,
20
+ start: input.cursor
21
+ }) }));
22
+ }
23
+ });
24
+ const getUnifiedRequest = rampOperation({
25
+ id: "get_unified_request",
26
+ name: "Get Unified Request",
27
+ description: "Fetch a unified request by id.",
28
+ input: rampUnifiedRequestGetInputSchema,
29
+ output: rampUnifiedRequestSchema,
30
+ run: async (input, credentials) => {
31
+ const client = createRampClient(credentials);
32
+ return rampUnifiedRequestSchema.parse(await client.request(`/unified-requests/${encodeURIComponent(input.unifiedRequestId)}`));
33
+ }
34
+ });
35
+
36
+ //#endregion
37
+ export { getUnifiedRequest, listUnifiedRequests };