@keystrokehq/segment 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 +232 -0
- package/dist/_official/index.d.mts +2 -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/audiences.d.mts +282 -0
- package/dist/audiences.mjs +205 -0
- package/dist/client.d.mts +90 -0
- package/dist/client.mjs +337 -0
- package/dist/common-CdGiJbjq.mjs +56 -0
- package/dist/computed-traits.d.mts +215 -0
- package/dist/computed-traits.mjs +149 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/crud-SWa_79Hg.mjs +140 -0
- package/dist/deletion-suppression.d.mts +191 -0
- package/dist/deletion-suppression.mjs +103 -0
- package/dist/delivery-overview.d.mts +79 -0
- package/dist/delivery-overview.mjs +54 -0
- package/dist/destination-filters.d.mts +190 -0
- package/dist/destination-filters.mjs +115 -0
- package/dist/destinations.d.mts +473 -0
- package/dist/destinations.mjs +257 -0
- package/dist/edge-functions.d.mts +168 -0
- package/dist/edge-functions.mjs +72 -0
- package/dist/errors-4FGnrowW.mjs +27 -0
- package/dist/events-catalog.d.mts +111 -0
- package/dist/events-catalog.mjs +65 -0
- package/dist/events.d.mts +167 -0
- package/dist/events.mjs +134 -0
- package/dist/factory-CvfKfzMq.mjs +8 -0
- package/dist/functions.d.mts +347 -0
- package/dist/functions.mjs +180 -0
- package/dist/iam-groups.d.mts +284 -0
- package/dist/iam-groups.mjs +144 -0
- package/dist/iam-users.d.mts +205 -0
- package/dist/iam-users.mjs +91 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-B5zYasBZ.mjs +25 -0
- package/dist/integration-D2yRaKFR.d.mts +67 -0
- package/dist/labels.d.mts +100 -0
- package/dist/labels.mjs +58 -0
- package/dist/monitoring.d.mts +182 -0
- package/dist/monitoring.mjs +88 -0
- package/dist/profiles-sync.d.mts +127 -0
- package/dist/profiles-sync.mjs +89 -0
- package/dist/profiles.d.mts +197 -0
- package/dist/profiles.mjs +137 -0
- package/dist/reverse-etl.d.mts +448 -0
- package/dist/reverse-etl.mjs +228 -0
- package/dist/roles.d.mts +48 -0
- package/dist/roles.mjs +25 -0
- package/dist/schemas/index.d.mts +57 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/sources.d.mts +560 -0
- package/dist/sources.mjs +259 -0
- package/dist/tracking-plans.d.mts +351 -0
- package/dist/tracking-plans.mjs +160 -0
- package/dist/tracking.d.mts +499 -0
- package/dist/tracking.mjs +255 -0
- package/dist/transformations.d.mts +188 -0
- package/dist/transformations.mjs +83 -0
- package/dist/triggers.d.mts +54 -0
- package/dist/triggers.mjs +341 -0
- package/dist/usage.d.mts +70 -0
- package/dist/usage.mjs +55 -0
- package/dist/verification.d.mts +17 -0
- package/dist/verification.mjs +51 -0
- package/dist/warehouses.d.mts +341 -0
- package/dist/warehouses.mjs +176 -0
- package/dist/workspaces.d.mts +95 -0
- package/dist/workspaces.mjs +67 -0
- package/package.json +188 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { createSegmentClient } from "./client.mjs";
|
|
2
|
+
import { a as segmentLooseObjectSchema, n as segmentIdSchema } from "./common-CdGiJbjq.mjs";
|
|
3
|
+
import { t as segmentOperation } from "./factory-CvfKfzMq.mjs";
|
|
4
|
+
import { n as crudList, r as crudMutate, t as crudGet } from "./crud-SWa_79Hg.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/iam-users.ts
|
|
8
|
+
/**
|
|
9
|
+
* segment/iam-users.ts — IAM users + invites + permissions. 6 actions
|
|
10
|
+
* (PLAN § 6.14).
|
|
11
|
+
*/
|
|
12
|
+
const iamUserSchema = segmentLooseObjectSchema({
|
|
13
|
+
id: segmentIdSchema,
|
|
14
|
+
email: z.string().optional(),
|
|
15
|
+
name: z.string().optional()
|
|
16
|
+
});
|
|
17
|
+
const iamInviteSchema = segmentLooseObjectSchema({
|
|
18
|
+
id: segmentIdSchema,
|
|
19
|
+
email: z.string().optional(),
|
|
20
|
+
status: z.string().optional(),
|
|
21
|
+
createdAt: z.string().optional()
|
|
22
|
+
});
|
|
23
|
+
const permissionSchema = segmentLooseObjectSchema({
|
|
24
|
+
roleId: segmentIdSchema,
|
|
25
|
+
resources: z.array(z.record(z.string(), z.unknown())).optional()
|
|
26
|
+
});
|
|
27
|
+
const listUsers = crudList({
|
|
28
|
+
id: "segment.iam.users.list",
|
|
29
|
+
name: "List IAM users",
|
|
30
|
+
description: "List IAM users in the workspace.",
|
|
31
|
+
path: "/users",
|
|
32
|
+
itemsKey: "users",
|
|
33
|
+
item: iamUserSchema
|
|
34
|
+
});
|
|
35
|
+
const getUser = crudGet({
|
|
36
|
+
id: "segment.iam.users.get",
|
|
37
|
+
name: "Get IAM user",
|
|
38
|
+
description: "Fetch an IAM user by id.",
|
|
39
|
+
path: "/users/{id}",
|
|
40
|
+
output: iamUserSchema,
|
|
41
|
+
unwrapKey: "user"
|
|
42
|
+
});
|
|
43
|
+
const inviteUser = crudMutate({
|
|
44
|
+
id: "segment.iam.users.invite",
|
|
45
|
+
name: "Invite user",
|
|
46
|
+
description: "Invite a user to the workspace.",
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: "/invites",
|
|
49
|
+
bodyShape: {
|
|
50
|
+
email: z.string().min(1),
|
|
51
|
+
permissions: z.array(permissionSchema).optional()
|
|
52
|
+
},
|
|
53
|
+
output: iamInviteSchema,
|
|
54
|
+
unwrapKey: "invite"
|
|
55
|
+
});
|
|
56
|
+
const listInvites = crudList({
|
|
57
|
+
id: "segment.iam.users.listInvites",
|
|
58
|
+
name: "List pending invites",
|
|
59
|
+
description: "List outstanding invitations.",
|
|
60
|
+
path: "/invites",
|
|
61
|
+
itemsKey: "invites",
|
|
62
|
+
item: iamInviteSchema
|
|
63
|
+
});
|
|
64
|
+
const deleteInvite = crudMutate({
|
|
65
|
+
id: "segment.iam.users.deleteInvite",
|
|
66
|
+
name: "Delete invite",
|
|
67
|
+
description: "Delete a pending invitation.",
|
|
68
|
+
method: "DELETE",
|
|
69
|
+
path: "/invites/{id}",
|
|
70
|
+
output: z.object({}).catchall(z.unknown())
|
|
71
|
+
});
|
|
72
|
+
const replaceUserPermissions = segmentOperation({
|
|
73
|
+
id: "segment.iam.users.replacePermissions",
|
|
74
|
+
name: "Replace user permissions",
|
|
75
|
+
description: "Replace the permission set on an IAM user.",
|
|
76
|
+
input: z.object({
|
|
77
|
+
id: segmentIdSchema,
|
|
78
|
+
permissions: z.array(permissionSchema).min(1)
|
|
79
|
+
}),
|
|
80
|
+
output: z.object({ items: z.array(permissionSchema) }),
|
|
81
|
+
needsApproval: true,
|
|
82
|
+
run: async (input, credentials) => {
|
|
83
|
+
return { items: ((await createSegmentClient(credentials).publicApi.request(`/users/${encodeURIComponent(input.id)}/permissions`, {
|
|
84
|
+
method: "PUT",
|
|
85
|
+
body: { permissions: input.permissions }
|
|
86
|
+
})).data?.permissions ?? input.permissions).map((entry) => permissionSchema.parse(entry)) };
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
export { deleteInvite, getUser, iamInviteSchema, iamUserSchema, inviteUser, listInvites, listUsers, replaceUserPermissions };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineOfficialIntegration } from "@keystrokehq/integration-authoring/official";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/integration.ts
|
|
5
|
+
const segmentRegionSchema = z.enum(["us", "eu"]);
|
|
6
|
+
const segmentAuthSchema = z.object({
|
|
7
|
+
SEGMENT_PUBLIC_API_TOKEN: z.string().min(1),
|
|
8
|
+
SEGMENT_REGION: segmentRegionSchema.default("us"),
|
|
9
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.string().min(1).optional(),
|
|
10
|
+
SEGMENT_WRITE_KEYS_JSON: z.string().optional(),
|
|
11
|
+
SEGMENT_PROFILE_API_TOKEN: z.string().min(1).optional(),
|
|
12
|
+
SEGMENT_PROFILE_SPACE_ID: z.string().min(1).optional(),
|
|
13
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.string().min(1).optional()
|
|
14
|
+
});
|
|
15
|
+
const segmentOfficialIntegration = {
|
|
16
|
+
id: "segment",
|
|
17
|
+
name: "Segment",
|
|
18
|
+
description: "Twilio Segment Customer Data Platform — track events, manage sources/destinations/tracking plans/warehouses, audiences, reverse ETL, and monitor delivery from Keystroke workflows.",
|
|
19
|
+
auth: segmentAuthSchema
|
|
20
|
+
};
|
|
21
|
+
const segmentBundle = defineOfficialIntegration(segmentOfficialIntegration);
|
|
22
|
+
const segment = segmentBundle.credentialSet;
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { segmentBundle as n, segmentOfficialIntegration as r, segment as t };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as _keystrokehq_integration_authoring_official0 from "@keystrokehq/integration-authoring/official";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
+
import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
|
|
5
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
6
|
+
|
|
7
|
+
//#region src/integration.d.ts
|
|
8
|
+
declare const segmentRegionSchema: z.ZodEnum<{
|
|
9
|
+
us: "us";
|
|
10
|
+
eu: "eu";
|
|
11
|
+
}>;
|
|
12
|
+
declare const segmentOfficialIntegration: {
|
|
13
|
+
id: "segment";
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
auth: z.ZodObject<{
|
|
17
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
18
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
19
|
+
us: "us";
|
|
20
|
+
eu: "eu";
|
|
21
|
+
}>>;
|
|
22
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
23
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
24
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
25
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
26
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
};
|
|
29
|
+
declare const segmentBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"segment", z.ZodObject<{
|
|
30
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
31
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
32
|
+
us: "us";
|
|
33
|
+
eu: "eu";
|
|
34
|
+
}>>;
|
|
35
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
36
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
37
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
38
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
39
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
declare const segment: _keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
42
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
43
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
us: "us";
|
|
45
|
+
eu: "eu";
|
|
46
|
+
}>>;
|
|
47
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
48
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
49
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
50
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
51
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
53
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
54
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
55
|
+
us: "us";
|
|
56
|
+
eu: "eu";
|
|
57
|
+
}>>;
|
|
58
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
59
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
60
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
61
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
62
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>>[] | undefined>;
|
|
64
|
+
type SegmentCredentials = InferCredentialSetAuth<typeof segment>;
|
|
65
|
+
type SegmentRegion = z.infer<typeof segmentRegionSchema>;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { segmentOfficialIntegration as a, segmentBundle as i, SegmentRegion as n, segment as r, SegmentCredentials as t };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/labels.d.ts
|
|
6
|
+
declare const listLabels: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
|
|
7
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
10
|
+
items: z.ZodArray<z.ZodObject<{
|
|
11
|
+
key: z.ZodString;
|
|
12
|
+
value: z.ZodString;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
16
|
+
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
18
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
19
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
20
|
+
us: "us";
|
|
21
|
+
eu: "eu";
|
|
22
|
+
}>>;
|
|
23
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
24
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
25
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
26
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
27
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
29
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
30
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
31
|
+
us: "us";
|
|
32
|
+
eu: "eu";
|
|
33
|
+
}>>;
|
|
34
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
35
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
36
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
37
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
38
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
40
|
+
declare const createLabel: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
41
|
+
key: z.ZodString;
|
|
42
|
+
value: z.ZodString;
|
|
43
|
+
description: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
+
key: z.ZodString;
|
|
46
|
+
value: z.ZodString;
|
|
47
|
+
description: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
49
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
50
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
51
|
+
us: "us";
|
|
52
|
+
eu: "eu";
|
|
53
|
+
}>>;
|
|
54
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
55
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
56
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
57
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
58
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
60
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
61
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
62
|
+
us: "us";
|
|
63
|
+
eu: "eu";
|
|
64
|
+
}>>;
|
|
65
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
66
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
67
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
68
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
69
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
71
|
+
declare const deleteLabel: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
72
|
+
key: z.ZodString;
|
|
73
|
+
value: z.ZodString;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
deleted: z.ZodLiteral<true>;
|
|
76
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
77
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
78
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
79
|
+
us: "us";
|
|
80
|
+
eu: "eu";
|
|
81
|
+
}>>;
|
|
82
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
83
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
84
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
85
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
86
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
88
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
89
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
90
|
+
us: "us";
|
|
91
|
+
eu: "eu";
|
|
92
|
+
}>>;
|
|
93
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
94
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
95
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
96
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
97
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
99
|
+
//#endregion
|
|
100
|
+
export { createLabel, deleteLabel, listLabels };
|
package/dist/labels.mjs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createSegmentClient } from "./client.mjs";
|
|
2
|
+
import { r as segmentLabelSchema } from "./common-CdGiJbjq.mjs";
|
|
3
|
+
import { t as segmentOperation } from "./factory-CvfKfzMq.mjs";
|
|
4
|
+
import { n as crudList } from "./crud-SWa_79Hg.mjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/labels.ts
|
|
8
|
+
/**
|
|
9
|
+
* segment/labels.ts — workspace labels. 3 actions (PLAN § 6.12). Labels are
|
|
10
|
+
* identified by `(key, value)` compound ids, so delete goes through a
|
|
11
|
+
* composite path rather than the generic {id} form.
|
|
12
|
+
*/
|
|
13
|
+
const listLabels = crudList({
|
|
14
|
+
id: "segment.labels.list",
|
|
15
|
+
name: "List labels",
|
|
16
|
+
description: "List labels defined in the workspace.",
|
|
17
|
+
path: "/labels",
|
|
18
|
+
itemsKey: "labels",
|
|
19
|
+
item: segmentLabelSchema
|
|
20
|
+
});
|
|
21
|
+
const createLabel = segmentOperation({
|
|
22
|
+
id: "segment.labels.create",
|
|
23
|
+
name: "Create label",
|
|
24
|
+
description: "Create a new workspace label (key:value).",
|
|
25
|
+
input: z.object({
|
|
26
|
+
key: z.string().min(1),
|
|
27
|
+
value: z.string().min(1),
|
|
28
|
+
description: z.string().optional()
|
|
29
|
+
}),
|
|
30
|
+
output: segmentLabelSchema,
|
|
31
|
+
needsApproval: true,
|
|
32
|
+
run: async (input, credentials) => {
|
|
33
|
+
const body = await createSegmentClient(credentials).publicApi.request("/labels", {
|
|
34
|
+
method: "POST",
|
|
35
|
+
body: input
|
|
36
|
+
});
|
|
37
|
+
const rec = body;
|
|
38
|
+
return segmentLabelSchema.parse(rec.data?.label ?? body);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const deleteLabel = segmentOperation({
|
|
42
|
+
id: "segment.labels.delete",
|
|
43
|
+
name: "Delete label",
|
|
44
|
+
description: "Delete a workspace label by (key, value).",
|
|
45
|
+
input: z.object({
|
|
46
|
+
key: z.string().min(1),
|
|
47
|
+
value: z.string().min(1)
|
|
48
|
+
}),
|
|
49
|
+
output: z.object({ deleted: z.literal(true) }),
|
|
50
|
+
needsApproval: true,
|
|
51
|
+
run: async (input, credentials) => {
|
|
52
|
+
await createSegmentClient(credentials).publicApi.request(`/labels/${encodeURIComponent(input.key)}/${encodeURIComponent(input.value)}`, { method: "DELETE" });
|
|
53
|
+
return { deleted: true };
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { createLabel, deleteLabel, listLabels };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/monitoring.d.ts
|
|
6
|
+
declare const monitoringSubscriptionSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
eventType: z.ZodOptional<z.ZodString>;
|
|
9
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
10
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
13
|
+
declare const monitoringAlertSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
firedAt: z.ZodOptional<z.ZodString>;
|
|
17
|
+
severity: z.ZodOptional<z.ZodString>;
|
|
18
|
+
message: z.ZodOptional<z.ZodString>;
|
|
19
|
+
resolvedAt: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
21
|
+
declare const listMonitoringSubscriptions: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
|
|
22
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
25
|
+
items: z.ZodArray<z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
eventType: z.ZodOptional<z.ZodString>;
|
|
28
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
29
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
32
|
+
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
33
|
+
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
35
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
36
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
37
|
+
us: "us";
|
|
38
|
+
eu: "eu";
|
|
39
|
+
}>>;
|
|
40
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
41
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
42
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
43
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
44
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
45
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
46
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
47
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
48
|
+
us: "us";
|
|
49
|
+
eu: "eu";
|
|
50
|
+
}>>;
|
|
51
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
52
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
53
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
54
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
55
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
57
|
+
declare const createMonitoringSubscription: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
58
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
59
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
60
|
+
id: z.ZodString;
|
|
61
|
+
eventType: z.ZodOptional<z.ZodString>;
|
|
62
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
63
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
65
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
66
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
67
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
68
|
+
us: "us";
|
|
69
|
+
eu: "eu";
|
|
70
|
+
}>>;
|
|
71
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
72
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
73
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
74
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
75
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
76
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
77
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
78
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
79
|
+
us: "us";
|
|
80
|
+
eu: "eu";
|
|
81
|
+
}>>;
|
|
82
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
83
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
84
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
85
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
86
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
88
|
+
declare const updateMonitoringSubscription: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
89
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
id: z.ZodString;
|
|
92
|
+
eventType: z.ZodOptional<z.ZodString>;
|
|
93
|
+
webhookUrl: z.ZodOptional<z.ZodString>;
|
|
94
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
95
|
+
filters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
97
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
98
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
99
|
+
us: "us";
|
|
100
|
+
eu: "eu";
|
|
101
|
+
}>>;
|
|
102
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
103
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
104
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
105
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
106
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
108
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
109
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
110
|
+
us: "us";
|
|
111
|
+
eu: "eu";
|
|
112
|
+
}>>;
|
|
113
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
114
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
115
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
116
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
117
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
118
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
119
|
+
declare const deleteMonitoringSubscription: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
120
|
+
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
121
|
+
}, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
122
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
123
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
124
|
+
us: "us";
|
|
125
|
+
eu: "eu";
|
|
126
|
+
}>>;
|
|
127
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
128
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
129
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
130
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
131
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
133
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
134
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
135
|
+
us: "us";
|
|
136
|
+
eu: "eu";
|
|
137
|
+
}>>;
|
|
138
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
139
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
140
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
141
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
142
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
144
|
+
declare const listMonitoringAlerts: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
|
|
145
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
pageToken: z.ZodOptional<z.ZodString>;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
148
|
+
items: z.ZodArray<z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
subscriptionId: z.ZodOptional<z.ZodString>;
|
|
151
|
+
firedAt: z.ZodOptional<z.ZodString>;
|
|
152
|
+
severity: z.ZodOptional<z.ZodString>;
|
|
153
|
+
message: z.ZodOptional<z.ZodString>;
|
|
154
|
+
resolvedAt: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
156
|
+
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
157
|
+
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
159
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
160
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
161
|
+
us: "us";
|
|
162
|
+
eu: "eu";
|
|
163
|
+
}>>;
|
|
164
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
165
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
166
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
167
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
168
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
170
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
171
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
172
|
+
us: "us";
|
|
173
|
+
eu: "eu";
|
|
174
|
+
}>>;
|
|
175
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
176
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
177
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
178
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
179
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
181
|
+
//#endregion
|
|
182
|
+
export { createMonitoringSubscription, deleteMonitoringSubscription, listMonitoringAlerts, listMonitoringSubscriptions, monitoringAlertSchema, monitoringSubscriptionSchema, updateMonitoringSubscription };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { a as segmentLooseObjectSchema, n as segmentIdSchema } from "./common-CdGiJbjq.mjs";
|
|
2
|
+
import { n as crudList, r as crudMutate } from "./crud-SWa_79Hg.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/monitoring.ts
|
|
6
|
+
/**
|
|
7
|
+
* segment/monitoring.ts — Monitoring subscriptions + alerts. 5 actions
|
|
8
|
+
* (PLAN § 6.9).
|
|
9
|
+
*/
|
|
10
|
+
const monitoringSubscriptionSchema = segmentLooseObjectSchema({
|
|
11
|
+
id: segmentIdSchema,
|
|
12
|
+
eventType: z.string().optional(),
|
|
13
|
+
webhookUrl: z.string().optional(),
|
|
14
|
+
enabled: z.boolean().optional(),
|
|
15
|
+
filters: z.record(z.string(), z.unknown()).optional()
|
|
16
|
+
});
|
|
17
|
+
const monitoringAlertSchema = segmentLooseObjectSchema({
|
|
18
|
+
id: segmentIdSchema,
|
|
19
|
+
subscriptionId: z.string().optional(),
|
|
20
|
+
firedAt: z.string().optional(),
|
|
21
|
+
severity: z.string().optional(),
|
|
22
|
+
message: z.string().optional(),
|
|
23
|
+
resolvedAt: z.string().optional()
|
|
24
|
+
});
|
|
25
|
+
const listMonitoringSubscriptions = crudList({
|
|
26
|
+
id: "segment.monitoring.listSubscriptions",
|
|
27
|
+
name: "List monitoring subscriptions",
|
|
28
|
+
description: "List monitoring subscriptions the workspace has registered.",
|
|
29
|
+
path: "/monitoring/subscriptions",
|
|
30
|
+
itemsKey: "subscriptions",
|
|
31
|
+
item: monitoringSubscriptionSchema
|
|
32
|
+
});
|
|
33
|
+
const createMonitoringSubscription = crudMutate({
|
|
34
|
+
id: "segment.monitoring.createSubscription",
|
|
35
|
+
name: "Create monitoring subscription",
|
|
36
|
+
description: "Create a monitoring subscription to receive alert webhooks.",
|
|
37
|
+
method: "POST",
|
|
38
|
+
path: "/monitoring/subscriptions",
|
|
39
|
+
bodyShape: {
|
|
40
|
+
eventType: z.string().min(1),
|
|
41
|
+
webhookUrl: z.string().url(),
|
|
42
|
+
enabled: z.boolean().optional(),
|
|
43
|
+
filters: z.record(z.string(), z.unknown()).optional()
|
|
44
|
+
},
|
|
45
|
+
output: monitoringSubscriptionSchema,
|
|
46
|
+
unwrapKey: "subscription"
|
|
47
|
+
});
|
|
48
|
+
const updateMonitoringSubscription = crudMutate({
|
|
49
|
+
id: "segment.monitoring.updateSubscription",
|
|
50
|
+
name: "Update monitoring subscription",
|
|
51
|
+
description: "Patch a monitoring subscription.",
|
|
52
|
+
method: "PATCH",
|
|
53
|
+
path: "/monitoring/subscriptions/{id}",
|
|
54
|
+
bodyShape: {
|
|
55
|
+
webhookUrl: z.string().url().optional(),
|
|
56
|
+
enabled: z.boolean().optional(),
|
|
57
|
+
filters: z.record(z.string(), z.unknown()).optional()
|
|
58
|
+
},
|
|
59
|
+
output: monitoringSubscriptionSchema,
|
|
60
|
+
unwrapKey: "subscription"
|
|
61
|
+
});
|
|
62
|
+
const deleteMonitoringSubscription = crudMutate({
|
|
63
|
+
id: "segment.monitoring.deleteSubscription",
|
|
64
|
+
name: "Delete monitoring subscription",
|
|
65
|
+
description: "Delete a monitoring subscription.",
|
|
66
|
+
method: "DELETE",
|
|
67
|
+
path: "/monitoring/subscriptions/{id}",
|
|
68
|
+
output: z.object({}).catchall(z.unknown())
|
|
69
|
+
});
|
|
70
|
+
const listMonitoringAlerts = crudList({
|
|
71
|
+
id: "segment.monitoring.listAlerts",
|
|
72
|
+
name: "List monitoring alerts",
|
|
73
|
+
description: "List active monitoring alerts in the workspace.",
|
|
74
|
+
path: "/monitoring/alerts",
|
|
75
|
+
itemsKey: "alerts",
|
|
76
|
+
item: monitoringAlertSchema,
|
|
77
|
+
extraInput: {
|
|
78
|
+
severity: z.string().optional(),
|
|
79
|
+
status: z.enum([
|
|
80
|
+
"firing",
|
|
81
|
+
"resolved",
|
|
82
|
+
"all"
|
|
83
|
+
]).optional()
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
export { createMonitoringSubscription, deleteMonitoringSubscription, listMonitoringAlerts, listMonitoringSubscriptions, monitoringAlertSchema, monitoringSubscriptionSchema, updateMonitoringSubscription };
|