@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,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
|
|
5
|
+
//#region src/departments.d.ts
|
|
6
|
+
declare const listDepartments: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
data: z.ZodArray<z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
name: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$loose>>;
|
|
14
|
+
page: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
next: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", z.ZodObject<{
|
|
18
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
19
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
20
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
21
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
22
|
+
declare const getDepartment: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
23
|
+
departmentId: z.ZodString;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
name: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", z.ZodObject<{
|
|
28
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
29
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
30
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
31
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
32
|
+
declare const createDepartment: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
name: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", z.ZodObject<{
|
|
38
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
39
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
40
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
41
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
42
|
+
declare const updateDepartment: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
43
|
+
departmentId: z.ZodString;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
name: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", z.ZodObject<{
|
|
49
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
50
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
51
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
52
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
53
|
+
declare const deleteDepartment: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
54
|
+
departmentId: z.ZodString;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
success: z.ZodBoolean;
|
|
57
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", z.ZodObject<{
|
|
58
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
59
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
60
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
61
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { createDepartment, deleteDepartment, getDepartment, listDepartments, updateDepartment };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createRampClient } from "./client.mjs";
|
|
2
|
+
import { a as rampDepartmentListSchema, i as rampDepartmentListInputSchema, n as rampDepartmentDeleteInputSchema, o as rampDepartmentSchema, r as rampDepartmentGetInputSchema, s as rampDepartmentUpdateInputSchema, t as rampDepartmentCreateInputSchema } from "./organization-BSaEpvBn.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/departments.ts
|
|
8
|
+
const listDepartments = rampOperation({
|
|
9
|
+
id: "list_departments",
|
|
10
|
+
name: "List Departments",
|
|
11
|
+
description: "List all departments configured for the connected Ramp business.",
|
|
12
|
+
input: rampDepartmentListInputSchema,
|
|
13
|
+
output: rampDepartmentListSchema,
|
|
14
|
+
run: async (input, credentials) => {
|
|
15
|
+
const client = createRampClient(credentials);
|
|
16
|
+
return rampDepartmentListSchema.parse(await client.request("/departments", { query: omitUndefined({
|
|
17
|
+
page_size: input.pageSize,
|
|
18
|
+
start: input.cursor
|
|
19
|
+
}) }));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const getDepartment = rampOperation({
|
|
23
|
+
id: "get_department",
|
|
24
|
+
name: "Get Department",
|
|
25
|
+
description: "Fetch a Ramp department by id.",
|
|
26
|
+
input: rampDepartmentGetInputSchema,
|
|
27
|
+
output: rampDepartmentSchema,
|
|
28
|
+
run: async (input, credentials) => {
|
|
29
|
+
const client = createRampClient(credentials);
|
|
30
|
+
return rampDepartmentSchema.parse(await client.request(`/departments/${encodeURIComponent(input.departmentId)}`));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const createDepartment = rampOperation({
|
|
34
|
+
id: "create_department",
|
|
35
|
+
name: "Create Department",
|
|
36
|
+
description: "Create a new department in the Ramp org hierarchy.",
|
|
37
|
+
input: rampDepartmentCreateInputSchema,
|
|
38
|
+
output: rampDepartmentSchema,
|
|
39
|
+
needsApproval: true,
|
|
40
|
+
run: async (input, credentials) => {
|
|
41
|
+
const client = createRampClient(credentials);
|
|
42
|
+
return rampDepartmentSchema.parse(await client.request("/departments", {
|
|
43
|
+
method: "POST",
|
|
44
|
+
body: input
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const updateDepartment = rampOperation({
|
|
49
|
+
id: "update_department",
|
|
50
|
+
name: "Update Department",
|
|
51
|
+
description: "Rename an existing Ramp department.",
|
|
52
|
+
input: rampDepartmentUpdateInputSchema,
|
|
53
|
+
output: rampDepartmentSchema,
|
|
54
|
+
needsApproval: true,
|
|
55
|
+
run: async (input, credentials) => {
|
|
56
|
+
const client = createRampClient(credentials);
|
|
57
|
+
const { departmentId, name } = input;
|
|
58
|
+
await client.request(`/departments/${encodeURIComponent(departmentId)}`, {
|
|
59
|
+
method: "PATCH",
|
|
60
|
+
body: { name }
|
|
61
|
+
});
|
|
62
|
+
return rampDepartmentSchema.parse(await client.request(`/departments/${encodeURIComponent(departmentId)}`));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const deleteDepartment = rampOperation({
|
|
66
|
+
id: "delete_department",
|
|
67
|
+
name: "Delete Department",
|
|
68
|
+
description: "Delete a Ramp department by id.",
|
|
69
|
+
input: rampDepartmentDeleteInputSchema,
|
|
70
|
+
output: z.object({ success: z.boolean() }),
|
|
71
|
+
needsApproval: true,
|
|
72
|
+
run: async (input, credentials) => {
|
|
73
|
+
await createRampClient(credentials).request(`/departments/${encodeURIComponent(input.departmentId)}`, { method: "DELETE" });
|
|
74
|
+
return { success: true };
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { createDepartment, deleteDepartment, getDepartment, listDepartments, updateDepartment };
|
|
@@ -0,0 +1,38 @@
|
|
|
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/entities.d.ts
|
|
7
|
+
declare const listEntities: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
8
|
+
pageSize: zod.ZodOptional<zod.ZodNumber>;
|
|
9
|
+
cursor: zod.ZodOptional<zod.ZodString>;
|
|
10
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
11
|
+
data: zod.ZodArray<zod.ZodObject<{
|
|
12
|
+
id: zod.ZodString;
|
|
13
|
+
entity_name: zod.ZodOptional<zod.ZodString>;
|
|
14
|
+
country_code: zod.ZodOptional<zod.ZodString>;
|
|
15
|
+
is_primary: zod.ZodOptional<zod.ZodBoolean>;
|
|
16
|
+
}, zod_v4_core0.$loose>>;
|
|
17
|
+
page: zod.ZodOptional<zod.ZodObject<{
|
|
18
|
+
next: zod.ZodOptional<zod.ZodString>;
|
|
19
|
+
}, zod_v4_core0.$strip>>;
|
|
20
|
+
}, zod_v4_core0.$strip>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
21
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
22
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
23
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
24
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
25
|
+
declare const getEntity: _keystrokehq_core0.Operation<zod.ZodObject<{
|
|
26
|
+
entityId: zod.ZodString;
|
|
27
|
+
}, zod_v4_core0.$strip>, zod.ZodObject<{
|
|
28
|
+
id: zod.ZodString;
|
|
29
|
+
entity_name: zod.ZodOptional<zod.ZodString>;
|
|
30
|
+
country_code: zod.ZodOptional<zod.ZodString>;
|
|
31
|
+
is_primary: zod.ZodOptional<zod.ZodBoolean>;
|
|
32
|
+
}, zod_v4_core0.$loose>, readonly [_keystrokehq_core0.CredentialSet<"ramp", zod.ZodObject<{
|
|
33
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
34
|
+
}, zod_v4_core0.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<zod.ZodObject<{
|
|
35
|
+
RAMP_ACCESS_TOKEN: zod.ZodString;
|
|
36
|
+
}, zod_v4_core0.$strip>>[] | undefined>], undefined>;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { getEntity, listEntities };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRampClient } from "./client.mjs";
|
|
2
|
+
import { a as rampEntitySchema, i as rampEntityListSchema, n as rampEntityGetInputSchema, r as rampEntityListInputSchema } from "./business-CztnWUvt.mjs";
|
|
3
|
+
import { t as rampOperation } from "./factory-Da6YVHdL.mjs";
|
|
4
|
+
import { t as omitUndefined } from "./shared-CTTtP5gv.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/entities.ts
|
|
7
|
+
const listEntities = rampOperation({
|
|
8
|
+
id: "list_entities",
|
|
9
|
+
name: "List Entities",
|
|
10
|
+
description: "List legal entities configured under the connected Ramp business.",
|
|
11
|
+
input: rampEntityListInputSchema,
|
|
12
|
+
output: rampEntityListSchema,
|
|
13
|
+
run: async (input, credentials) => {
|
|
14
|
+
const client = createRampClient(credentials);
|
|
15
|
+
return rampEntityListSchema.parse(await client.request("/entities", { query: omitUndefined({
|
|
16
|
+
page_size: input.pageSize,
|
|
17
|
+
start: input.cursor
|
|
18
|
+
}) }));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const getEntity = rampOperation({
|
|
22
|
+
id: "get_entity",
|
|
23
|
+
name: "Get Entity",
|
|
24
|
+
description: "Fetch a Ramp legal entity by id.",
|
|
25
|
+
input: rampEntityGetInputSchema,
|
|
26
|
+
output: rampEntitySchema,
|
|
27
|
+
run: async (input, credentials) => {
|
|
28
|
+
const client = createRampClient(credentials);
|
|
29
|
+
return rampEntitySchema.parse(await client.request(`/entities/${encodeURIComponent(input.entityId)}`));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { getEntity, listEntities };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas/errors.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Ramp returns a fairly consistent error body shape:
|
|
6
|
+
* { error_v2: { message, notes, additional_info, error_code } }
|
|
7
|
+
* or a flattened `{ error: string, message?: string }` for older endpoints.
|
|
8
|
+
*
|
|
9
|
+
* We normalize both into a single shape before throwing.
|
|
10
|
+
*/
|
|
11
|
+
declare const rampErrorPayloadSchema: z.ZodObject<{
|
|
12
|
+
status: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
error_v2: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
message: z.ZodOptional<z.ZodString>;
|
|
15
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
16
|
+
additional_info: z.ZodOptional<z.ZodString>;
|
|
17
|
+
error_code: z.ZodOptional<z.ZodString>;
|
|
18
|
+
parameter: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
error: z.ZodOptional<z.ZodString>;
|
|
21
|
+
message: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
type RampErrorPayload = z.infer<typeof rampErrorPayloadSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Discriminated union of known Ramp failure modes. Emitted by the client to
|
|
26
|
+
* aid downstream retry/approval logic.
|
|
27
|
+
*/
|
|
28
|
+
declare const rampErrorKindSchema: z.ZodEnum<{
|
|
29
|
+
unknown: "unknown";
|
|
30
|
+
network: "network";
|
|
31
|
+
timeout: "timeout";
|
|
32
|
+
auth_revoked: "auth_revoked";
|
|
33
|
+
missing_scope: "missing_scope";
|
|
34
|
+
rate_limited: "rate_limited";
|
|
35
|
+
validation: "validation";
|
|
36
|
+
not_found: "not_found";
|
|
37
|
+
conflict: "conflict";
|
|
38
|
+
server_error: "server_error";
|
|
39
|
+
}>;
|
|
40
|
+
type RampErrorKind = z.infer<typeof rampErrorKindSchema>;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { rampErrorPayloadSchema as i, RampErrorPayload as n, rampErrorKindSchema as r, RampErrorKind as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { a as RampWebhookEventEnvelope, c as rampWebhookEventEnvelopeSchema, r as RampDocumentedWebhookEventType, t as RAMP_DOCUMENTED_WEBHOOK_EVENT_TYPES } from "./webhook-sde3Ui2N.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/events.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Enumeration of the coarse-grained event families that the package exposes
|
|
7
|
+
* via the {@link webhooks} namespace. Each family maps to multiple underlying
|
|
8
|
+
* Ramp event `type` values (e.g. `transactionsAny` covers authorized/cleared/
|
|
9
|
+
* declined/updated).
|
|
10
|
+
*/
|
|
11
|
+
declare const rampWebhookFamilySchema: z.ZodEnum<{
|
|
12
|
+
transactions: "transactions";
|
|
13
|
+
bills: "bills";
|
|
14
|
+
purchase_orders: "purchase_orders";
|
|
15
|
+
spend_requests: "spend_requests";
|
|
16
|
+
applications: "applications";
|
|
17
|
+
unified_requests: "unified_requests";
|
|
18
|
+
}>;
|
|
19
|
+
type RampWebhookFamily = z.infer<typeof rampWebhookFamilySchema>;
|
|
20
|
+
interface RampWebhookEvent {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly type: RampDocumentedWebhookEventType | string;
|
|
23
|
+
readonly family: RampWebhookFamily | undefined;
|
|
24
|
+
readonly createdAt: string;
|
|
25
|
+
readonly businessId: string;
|
|
26
|
+
readonly objectId: string;
|
|
27
|
+
}
|
|
28
|
+
declare function toRampWebhookEvent(envelope: RampWebhookEventEnvelope): RampWebhookEvent;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { RAMP_DOCUMENTED_WEBHOOK_EVENT_TYPES, type RampDocumentedWebhookEventType, RampWebhookEvent, type RampWebhookEventEnvelope, RampWebhookFamily, rampWebhookEventEnvelopeSchema, rampWebhookFamilySchema, toRampWebhookEvent };
|
package/dist/events.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { a as rampWebhookEventEnvelopeSchema, t as RAMP_DOCUMENTED_WEBHOOK_EVENT_TYPES } from "./webhook-CsbvcgrC.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/events.ts
|
|
5
|
+
/**
|
|
6
|
+
* Enumeration of the coarse-grained event families that the package exposes
|
|
7
|
+
* via the {@link webhooks} namespace. Each family maps to multiple underlying
|
|
8
|
+
* Ramp event `type` values (e.g. `transactionsAny` covers authorized/cleared/
|
|
9
|
+
* declined/updated).
|
|
10
|
+
*/
|
|
11
|
+
const rampWebhookFamilySchema = z.enum([
|
|
12
|
+
"transactions",
|
|
13
|
+
"bills",
|
|
14
|
+
"purchase_orders",
|
|
15
|
+
"spend_requests",
|
|
16
|
+
"applications",
|
|
17
|
+
"unified_requests"
|
|
18
|
+
]);
|
|
19
|
+
function familyFor(eventType) {
|
|
20
|
+
if (eventType.startsWith("transactions.")) return "transactions";
|
|
21
|
+
if (eventType.startsWith("bills.")) return "bills";
|
|
22
|
+
if (eventType.startsWith("purchase_orders.")) return "purchase_orders";
|
|
23
|
+
if (eventType.startsWith("spend_requests.")) return "spend_requests";
|
|
24
|
+
if (eventType.startsWith("applications.")) return "applications";
|
|
25
|
+
if (eventType.startsWith("unified_requests.")) return "unified_requests";
|
|
26
|
+
}
|
|
27
|
+
function toRampWebhookEvent(envelope) {
|
|
28
|
+
return {
|
|
29
|
+
id: envelope.id,
|
|
30
|
+
type: envelope.type,
|
|
31
|
+
family: familyFor(envelope.type),
|
|
32
|
+
createdAt: envelope.created_at,
|
|
33
|
+
businessId: envelope.business_id,
|
|
34
|
+
objectId: envelope.object.id
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { RAMP_DOCUMENTED_WEBHOOK_EVENT_TYPES, rampWebhookEventEnvelopeSchema, rampWebhookFamilySchema, toRampWebhookEvent };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { n as ramp } from "./integration-BGliAxAS.mjs";
|
|
2
|
+
import { createOfficialOperationFactory } from "@keystrokehq/integration-authoring/official";
|
|
3
|
+
|
|
4
|
+
//#region src/factory.ts
|
|
5
|
+
/**
|
|
6
|
+
* Operation factory bound to the public Ramp OAuth credential set.
|
|
7
|
+
*
|
|
8
|
+
* Every operation exported by the package MUST be declared via this factory
|
|
9
|
+
* so that the platform can route credentials, surface manifests, and enforce
|
|
10
|
+
* `needsApproval` gating consistently. Do not instantiate `Operation` directly.
|
|
11
|
+
*/
|
|
12
|
+
const rampOperation = createOfficialOperationFactory(ramp);
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { rampOperation as t };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { defineOfficialIntegration } from "@keystrokehq/integration-authoring/official";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { CredentialSet } from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/_official/provider-app.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
|
+
const rampAppCredentialSet = new CredentialSet({
|
|
17
|
+
id: "ramp-app",
|
|
18
|
+
exposure: "platform-only",
|
|
19
|
+
name: "Ramp App",
|
|
20
|
+
auth: z.object({
|
|
21
|
+
clientId: z.string().min(1),
|
|
22
|
+
clientSecret: z.string().min(1),
|
|
23
|
+
webhookSecret: z.string().min(1).optional()
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
const rampPlatformProviderSeed = {
|
|
27
|
+
provider: "ramp",
|
|
28
|
+
appRef: "ramp-platform",
|
|
29
|
+
displayName: "Ramp Platform",
|
|
30
|
+
credentialSetName: "Keystroke Ramp Platform App",
|
|
31
|
+
envShape: {
|
|
32
|
+
KEYSTROKE_PLATFORM_RAMP_CLIENT_ID: z.string().optional(),
|
|
33
|
+
KEYSTROKE_PLATFORM_RAMP_CLIENT_SECRET: z.string().optional(),
|
|
34
|
+
KEYSTROKE_PLATFORM_RAMP_WEBHOOK_SECRET: z.string().optional()
|
|
35
|
+
},
|
|
36
|
+
requiredEnvKeys: ["KEYSTROKE_PLATFORM_RAMP_CLIENT_ID", "KEYSTROKE_PLATFORM_RAMP_CLIENT_SECRET"],
|
|
37
|
+
externalAppIdEnvKey: "KEYSTROKE_PLATFORM_RAMP_CLIENT_ID",
|
|
38
|
+
buildCredentials: (env) => ({
|
|
39
|
+
clientId: env.KEYSTROKE_PLATFORM_RAMP_CLIENT_ID,
|
|
40
|
+
clientSecret: env.KEYSTROKE_PLATFORM_RAMP_CLIENT_SECRET,
|
|
41
|
+
...env.KEYSTROKE_PLATFORM_RAMP_WEBHOOK_SECRET ? { webhookSecret: env.KEYSTROKE_PLATFORM_RAMP_WEBHOOK_SECRET } : {}
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/integration.ts
|
|
47
|
+
/**
|
|
48
|
+
* Public auth schema for Ramp connections.
|
|
49
|
+
*
|
|
50
|
+
* Stores only the OAuth access token. The Ramp platform issues access tokens
|
|
51
|
+
* with a ~10-day lifetime; the refresh token lifecycle is managed by the
|
|
52
|
+
* platform OAuth machinery and does not need to be re-exposed here.
|
|
53
|
+
*
|
|
54
|
+
* Deliberately does NOT include environment discrimination — we route all
|
|
55
|
+
* API traffic through `https://api.ramp.com` by default. Sandbox usage
|
|
56
|
+
* requires bypassing the public connection and calling {@link createRampClient}
|
|
57
|
+
* directly with `{ environment: 'sandbox' }`.
|
|
58
|
+
*/
|
|
59
|
+
const rampAuthSchema = z.object({ RAMP_ACCESS_TOKEN: z.string().min(1) });
|
|
60
|
+
/**
|
|
61
|
+
* OAuth scopes requested at connect time.
|
|
62
|
+
*
|
|
63
|
+
* Only includes scopes that are currently documented in Ramp's developer docs
|
|
64
|
+
* (verified 2026-04-17). Operations gated on undocumented scopes must fail at
|
|
65
|
+
* runtime with `RampMissingScopeError` and must NOT add phantom scopes here.
|
|
66
|
+
*/
|
|
67
|
+
const RAMP_OAUTH_SCOPES = [
|
|
68
|
+
"accounting:read",
|
|
69
|
+
"accounting:write",
|
|
70
|
+
"bank_accounts:read",
|
|
71
|
+
"bills:read",
|
|
72
|
+
"bills:write",
|
|
73
|
+
"business:read",
|
|
74
|
+
"card_programs:read",
|
|
75
|
+
"card_programs:write",
|
|
76
|
+
"cards:read",
|
|
77
|
+
"cards:write",
|
|
78
|
+
"cashbacks:read",
|
|
79
|
+
"departments:read",
|
|
80
|
+
"departments:write",
|
|
81
|
+
"entities:read",
|
|
82
|
+
"limits:read",
|
|
83
|
+
"limits:write",
|
|
84
|
+
"locations:read",
|
|
85
|
+
"locations:write",
|
|
86
|
+
"memos:read",
|
|
87
|
+
"receipt_integrations:read",
|
|
88
|
+
"receipt_integrations:write",
|
|
89
|
+
"receipts:read",
|
|
90
|
+
"receipts:write",
|
|
91
|
+
"reimbursements:read",
|
|
92
|
+
"spend_programs:read",
|
|
93
|
+
"statements:read",
|
|
94
|
+
"transactions:read",
|
|
95
|
+
"transfers:read",
|
|
96
|
+
"users:read",
|
|
97
|
+
"users:write",
|
|
98
|
+
"vendors:read",
|
|
99
|
+
"vendors:write"
|
|
100
|
+
];
|
|
101
|
+
const rampOfficialIntegration = {
|
|
102
|
+
id: "ramp",
|
|
103
|
+
name: "Ramp",
|
|
104
|
+
description: "Ramp corporate cards, spend management, bill pay, reimbursements, and accounting integrations for Keystroke workflows.",
|
|
105
|
+
auth: rampAuthSchema,
|
|
106
|
+
connections: [{
|
|
107
|
+
id: "oauth",
|
|
108
|
+
kind: "oauth",
|
|
109
|
+
tokenType: "refreshable",
|
|
110
|
+
authUrl: "https://app.ramp.com/v1/authorize",
|
|
111
|
+
tokenUrl: "https://api.ramp.com/developer/v1/token",
|
|
112
|
+
revokeUrl: "https://api.ramp.com/developer/v1/token/revoke",
|
|
113
|
+
scopes: RAMP_OAUTH_SCOPES,
|
|
114
|
+
vault: { accessToken: "RAMP_ACCESS_TOKEN" }
|
|
115
|
+
}]
|
|
116
|
+
};
|
|
117
|
+
const rampBundle = defineOfficialIntegration({
|
|
118
|
+
...rampOfficialIntegration,
|
|
119
|
+
internal: { providerApp: rampAppCredentialSet }
|
|
120
|
+
});
|
|
121
|
+
const ramp = rampBundle.credentialSet;
|
|
122
|
+
|
|
123
|
+
//#endregion
|
|
124
|
+
export { rampAppCredentialSet as a, rampOfficialIntegration as i, ramp as n, rampPlatformProviderSeed as o, rampBundle as r, RAMP_OAUTH_SCOPES as t };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
5
|
+
import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
|
|
6
|
+
|
|
7
|
+
//#region src/integration.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* OAuth scopes requested at connect time.
|
|
10
|
+
*
|
|
11
|
+
* Only includes scopes that are currently documented in Ramp's developer docs
|
|
12
|
+
* (verified 2026-04-17). Operations gated on undocumented scopes must fail at
|
|
13
|
+
* runtime with `RampMissingScopeError` and must NOT add phantom scopes here.
|
|
14
|
+
*/
|
|
15
|
+
declare const RAMP_OAUTH_SCOPES: readonly ["accounting:read", "accounting:write", "bank_accounts:read", "bills:read", "bills:write", "business:read", "card_programs:read", "card_programs:write", "cards:read", "cards:write", "cashbacks:read", "departments:read", "departments:write", "entities:read", "limits:read", "limits:write", "locations:read", "locations:write", "memos:read", "receipt_integrations:read", "receipt_integrations:write", "receipts:read", "receipts:write", "reimbursements:read", "spend_programs:read", "statements:read", "transactions:read", "transfers:read", "users:read", "users:write", "vendors:read", "vendors:write"];
|
|
16
|
+
declare const rampOfficialIntegration: {
|
|
17
|
+
id: "ramp";
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
auth: z.ZodObject<{
|
|
21
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
connections: {
|
|
24
|
+
id: string;
|
|
25
|
+
kind: "oauth";
|
|
26
|
+
tokenType: "refreshable";
|
|
27
|
+
authUrl: string;
|
|
28
|
+
tokenUrl: string;
|
|
29
|
+
revokeUrl: string;
|
|
30
|
+
scopes: readonly ["accounting:read", "accounting:write", "bank_accounts:read", "bills:read", "bills:write", "business:read", "card_programs:read", "card_programs:write", "cards:read", "cards:write", "cashbacks:read", "departments:read", "departments:write", "entities:read", "limits:read", "limits:write", "locations:read", "locations:write", "memos:read", "receipt_integrations:read", "receipt_integrations:write", "receipts:read", "receipts:write", "reimbursements:read", "spend_programs:read", "statements:read", "transactions:read", "transfers:read", "users:read", "users:write", "vendors:read", "vendors:write"];
|
|
31
|
+
vault: {
|
|
32
|
+
accessToken: "RAMP_ACCESS_TOKEN";
|
|
33
|
+
};
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
declare const rampBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"ramp", z.ZodObject<{
|
|
37
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
38
|
+
}, z.core.$strip>>;
|
|
39
|
+
declare const ramp: _keystrokehq_core0.CredentialSet<"ramp", z.ZodObject<{
|
|
40
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
41
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
42
|
+
RAMP_ACCESS_TOKEN: z.ZodString;
|
|
43
|
+
}, z.core.$strip>>[] | undefined>;
|
|
44
|
+
type RampCredentials = InferCredentialSetAuth<typeof ramp>;
|
|
45
|
+
type RampOAuthScope = (typeof RAMP_OAUTH_SCOPES)[number];
|
|
46
|
+
//#endregion
|
|
47
|
+
export { rampBundle as a, ramp as i, RampCredentials as n, rampOfficialIntegration as o, RampOAuthScope as r, RAMP_OAUTH_SCOPES as t };
|