@keystrokehq/segment 0.0.9 → 0.0.16-integration-id-canonicalization.0
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 +52 -173
- package/dist/{client.mjs → client-DQfeZzLR.mjs} +28 -3
- package/dist/credential-sets/index.d.mts +2 -0
- package/dist/credential-sets/index.mjs +3 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +5 -1
- package/dist/operations/index.d.mts +2 -0
- package/dist/operations/index.mjs +3 -0
- package/dist/schemas/index.mjs +1 -1
- package/dist/segment.credential-set-BTTrkHO7.mjs +33 -0
- package/dist/{integration-CeShwMIi.d.mts → segment.credential-set-BgROtI_9.d.mts} +28 -37
- package/dist/{triggers.d.mts → triggers/index.d.mts} +72 -6
- package/dist/{triggers.mjs → triggers/index.mjs} +136 -7
- package/dist/workspace-list-spaces.operation-DKWX3vl5.mjs +5200 -0
- package/dist/workspace-list-spaces.operation-QbDIgfRG.d.mts +6548 -0
- package/package.json +11 -123
- package/dist/_official/index.d.mts +0 -2
- package/dist/_official/index.mjs +0 -3
- package/dist/_runtime/index.d.mts +0 -1
- package/dist/_runtime/index.mjs +0 -1
- package/dist/audiences.d.mts +0 -282
- package/dist/audiences.mjs +0 -205
- package/dist/client.d.mts +0 -90
- package/dist/computed-traits.d.mts +0 -215
- package/dist/computed-traits.mjs +0 -149
- package/dist/connection.d.mts +0 -2
- package/dist/connection.mjs +0 -3
- package/dist/crud-DV9e4Spi.mjs +0 -140
- package/dist/deletion-suppression.d.mts +0 -191
- package/dist/deletion-suppression.mjs +0 -103
- package/dist/delivery-overview.d.mts +0 -79
- package/dist/delivery-overview.mjs +0 -54
- package/dist/destination-filters.d.mts +0 -190
- package/dist/destination-filters.mjs +0 -115
- package/dist/destinations.d.mts +0 -473
- package/dist/destinations.mjs +0 -257
- package/dist/edge-functions.d.mts +0 -168
- package/dist/edge-functions.mjs +0 -72
- package/dist/errors-4FGnrowW.mjs +0 -27
- package/dist/events-catalog.d.mts +0 -111
- package/dist/events-catalog.mjs +0 -65
- package/dist/events.d.mts +0 -167
- package/dist/events.mjs +0 -134
- package/dist/factory-DRwj5eiU.mjs +0 -7
- package/dist/functions.d.mts +0 -347
- package/dist/functions.mjs +0 -180
- package/dist/iam-groups.d.mts +0 -284
- package/dist/iam-groups.mjs +0 -144
- package/dist/iam-users.d.mts +0 -205
- package/dist/iam-users.mjs +0 -91
- package/dist/integration-B9FOjHPc.mjs +0 -115
- package/dist/labels.d.mts +0 -100
- package/dist/labels.mjs +0 -58
- package/dist/monitoring.d.mts +0 -182
- package/dist/monitoring.mjs +0 -88
- package/dist/profiles-sync.d.mts +0 -127
- package/dist/profiles-sync.mjs +0 -89
- package/dist/profiles.d.mts +0 -197
- package/dist/profiles.mjs +0 -137
- package/dist/reverse-etl.d.mts +0 -448
- package/dist/reverse-etl.mjs +0 -228
- package/dist/roles.d.mts +0 -48
- package/dist/roles.mjs +0 -25
- package/dist/sources.d.mts +0 -560
- package/dist/sources.mjs +0 -259
- package/dist/tracking-plans.d.mts +0 -351
- package/dist/tracking-plans.mjs +0 -160
- package/dist/tracking.d.mts +0 -499
- package/dist/tracking.mjs +0 -255
- package/dist/transformations.d.mts +0 -188
- package/dist/transformations.mjs +0 -83
- package/dist/usage.d.mts +0 -70
- package/dist/usage.mjs +0 -55
- package/dist/verification.d.mts +0 -17
- package/dist/verification.mjs +0 -51
- package/dist/warehouses.d.mts +0 -341
- package/dist/warehouses.mjs +0 -176
- package/dist/workspaces.d.mts +0 -95
- package/dist/workspaces.mjs +0 -67
- /package/dist/{common-CdGiJbjq.mjs → common-DUU0airJ.mjs} +0 -0
package/dist/iam-users.mjs
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
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-DRwj5eiU.mjs";
|
|
4
|
-
import { n as crudList, r as crudMutate, t as crudGet } from "./crud-DV9e4Spi.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 };
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { CredentialSet, Operation } from "@keystrokehq/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
//#region ../../packages/integration-authoring/dist/official/runtime.mjs
|
|
5
|
-
const REGISTRY_KEY = "__ks_official_integration_metadata_registry";
|
|
6
|
-
function getRegistry() {
|
|
7
|
-
const globalStore = globalThis;
|
|
8
|
-
if (!globalStore[REGISTRY_KEY]) globalStore[REGISTRY_KEY] = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
return globalStore[REGISTRY_KEY];
|
|
10
|
-
}
|
|
11
|
-
function registerOfficialOperation(operation, metadata) {
|
|
12
|
-
getRegistry().set(operation, Object.freeze({ ...metadata }));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region ../../packages/integration-authoring/dist/official/index.mjs
|
|
17
|
-
const OFFICIAL_CREDENTIAL_SET_ID_PREFIX = "keystroke:";
|
|
18
|
-
function stripOfficialCredentialSetIdPrefix(id) {
|
|
19
|
-
return id.startsWith(OFFICIAL_CREDENTIAL_SET_ID_PREFIX) ? id.slice(10) : id;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Creates a factory for Keystroke-official integration operations.
|
|
23
|
-
*
|
|
24
|
-
* It keeps the same flat `run(input, credentials)` ergonomics as the generic
|
|
25
|
-
* operation factory, while registering official metadata for builder/runtime
|
|
26
|
-
* operation metadata.
|
|
27
|
-
*/
|
|
28
|
-
function createOfficialOperationFactory(credentialSet) {
|
|
29
|
-
const integrationId = stripOfficialCredentialSetIdPrefix(credentialSet.id);
|
|
30
|
-
return (config) => {
|
|
31
|
-
const wrappedRun = async (input, ctx) => {
|
|
32
|
-
const creds = ctx.credentials[credentialSet.id];
|
|
33
|
-
return config.run(input, creds);
|
|
34
|
-
};
|
|
35
|
-
const operation = new Operation({
|
|
36
|
-
id: config.id,
|
|
37
|
-
name: config.name,
|
|
38
|
-
description: config.description,
|
|
39
|
-
input: config.input,
|
|
40
|
-
output: config.output,
|
|
41
|
-
credentialSets: [credentialSet],
|
|
42
|
-
...config.tags !== void 0 ? { tags: config.tags } : {},
|
|
43
|
-
...config.needsApproval !== void 0 ? { needsApproval: config.needsApproval } : {},
|
|
44
|
-
...config.requiredOAuthScopes !== void 0 ? { requiredOAuthScopes: config.requiredOAuthScopes } : {},
|
|
45
|
-
...config.retries !== void 0 ? { retries: config.retries } : {},
|
|
46
|
-
...config.timeout !== void 0 ? { timeout: config.timeout } : {},
|
|
47
|
-
...config.maxDurationMs !== void 0 ? { maxDurationMs: config.maxDurationMs } : {},
|
|
48
|
-
run: wrappedRun
|
|
49
|
-
});
|
|
50
|
-
registerOfficialOperation(operation, { integrationId });
|
|
51
|
-
return operation;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Creates an official integration bundle from a single config object.
|
|
56
|
-
*
|
|
57
|
-
* - Creates the public `CredentialSet` internally.
|
|
58
|
-
* - Accepts optional `internal` fields for Keystroke-owned platform credentials.
|
|
59
|
-
*/
|
|
60
|
-
function defineOfficialIntegration(config) {
|
|
61
|
-
const internalCredentialSets = config.internal ?? {};
|
|
62
|
-
const allInternalCredentialSets = [
|
|
63
|
-
...internalCredentialSets.providerApp ? [internalCredentialSets.providerApp] : [],
|
|
64
|
-
...internalCredentialSets.providerAppVariants ?? [],
|
|
65
|
-
...internalCredentialSets.webhookVerification ? [internalCredentialSets.webhookVerification] : [],
|
|
66
|
-
...internalCredentialSets.other ?? []
|
|
67
|
-
];
|
|
68
|
-
const credentialSet = new CredentialSet({
|
|
69
|
-
id: config.id,
|
|
70
|
-
name: config.name,
|
|
71
|
-
description: config.description,
|
|
72
|
-
auth: config.auth,
|
|
73
|
-
...config.connections ? { connections: config.connections } : {},
|
|
74
|
-
...config.proxy ? { proxy: config.proxy } : {},
|
|
75
|
-
...config.needsRawSecret === true ? { needsRawSecret: true } : {}
|
|
76
|
-
});
|
|
77
|
-
return Object.freeze({
|
|
78
|
-
integration: {
|
|
79
|
-
id: config.id,
|
|
80
|
-
name: config.name,
|
|
81
|
-
...config.description !== void 0 ? { description: config.description } : {},
|
|
82
|
-
auth: config.auth,
|
|
83
|
-
...config.proxy ? { proxy: config.proxy } : {},
|
|
84
|
-
...config.needsRawSecret === true ? { needsRawSecret: true } : {},
|
|
85
|
-
...config.connections ? { connections: config.connections } : {}
|
|
86
|
-
},
|
|
87
|
-
credentialSet,
|
|
88
|
-
internalCredentialSets,
|
|
89
|
-
allInternalCredentialSets
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/integration.ts
|
|
95
|
-
const segmentRegionSchema = z.enum(["us", "eu"]);
|
|
96
|
-
const segmentAuthSchema = z.object({
|
|
97
|
-
SEGMENT_PUBLIC_API_TOKEN: z.string().min(1),
|
|
98
|
-
SEGMENT_REGION: segmentRegionSchema.default("us"),
|
|
99
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.string().min(1).optional(),
|
|
100
|
-
SEGMENT_WRITE_KEYS_JSON: z.string().optional(),
|
|
101
|
-
SEGMENT_PROFILE_API_TOKEN: z.string().min(1).optional(),
|
|
102
|
-
SEGMENT_PROFILE_SPACE_ID: z.string().min(1).optional(),
|
|
103
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.string().min(1).optional()
|
|
104
|
-
});
|
|
105
|
-
const segmentOfficialIntegration = {
|
|
106
|
-
id: "segment",
|
|
107
|
-
name: "Segment",
|
|
108
|
-
description: "Twilio Segment Customer Data Platform — track events, manage sources/destinations/tracking plans/warehouses, audiences, reverse ETL, and monitor delivery from Keystroke workflows.",
|
|
109
|
-
auth: segmentAuthSchema
|
|
110
|
-
};
|
|
111
|
-
const segmentBundle = defineOfficialIntegration(segmentOfficialIntegration);
|
|
112
|
-
const segment = segmentBundle.credentialSet;
|
|
113
|
-
|
|
114
|
-
//#endregion
|
|
115
|
-
export { createOfficialOperationFactory as i, segmentBundle as n, segmentOfficialIntegration as r, segment as t };
|
package/dist/labels.d.mts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
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
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { createSegmentClient } from "./client.mjs";
|
|
2
|
-
import { r as segmentLabelSchema } from "./common-CdGiJbjq.mjs";
|
|
3
|
-
import { t as segmentOperation } from "./factory-DRwj5eiU.mjs";
|
|
4
|
-
import { n as crudList } from "./crud-DV9e4Spi.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 };
|
package/dist/monitoring.d.mts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
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 };
|
package/dist/monitoring.mjs
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { a as segmentLooseObjectSchema, n as segmentIdSchema } from "./common-CdGiJbjq.mjs";
|
|
2
|
-
import { n as crudList, r as crudMutate } from "./crud-DV9e4Spi.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 };
|