@vibesdotdev/integrations-pagerduty 0.0.0-stage → 1.0.0-rc.3
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/LICENSE +126 -0
- package/README.md +30 -2
- package/dist/client/helper.d.ts +20 -0
- package/dist/client/helper.d.ts.map +1 -0
- package/dist/client/helper.js +21 -0
- package/dist/client/helper.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/runtime-client.d.ts +29 -0
- package/dist/client/runtime-client.d.ts.map +1 -0
- package/dist/client/runtime-client.js +60 -0
- package/dist/client/runtime-client.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations-pagerduty.plugin.d.ts +18 -0
- package/dist/integrations-pagerduty.plugin.d.ts.map +1 -0
- package/dist/integrations-pagerduty.plugin.js +42 -0
- package/dist/integrations-pagerduty.plugin.js.map +1 -0
- package/dist/pagerduty/configuration.d.ts +6 -0
- package/dist/pagerduty/configuration.d.ts.map +1 -0
- package/dist/pagerduty/configuration.js +16 -0
- package/dist/pagerduty/configuration.js.map +1 -0
- package/dist/pagerduty/index.d.ts +9 -0
- package/dist/pagerduty/index.d.ts.map +1 -0
- package/dist/pagerduty/index.js +8 -0
- package/dist/pagerduty/index.js.map +1 -0
- package/dist/pagerduty/pagerduty-connector.d.ts +16 -0
- package/dist/pagerduty/pagerduty-connector.d.ts.map +1 -0
- package/dist/pagerduty/pagerduty-connector.js +80 -0
- package/dist/pagerduty/pagerduty-connector.js.map +1 -0
- package/dist/pagerduty/pagerduty-implementation.d.ts +8 -0
- package/dist/pagerduty/pagerduty-implementation.d.ts.map +1 -0
- package/dist/pagerduty/pagerduty-implementation.js +25 -0
- package/dist/pagerduty/pagerduty-implementation.js.map +1 -0
- package/dist/pagerduty/runtime-context.d.ts +7 -0
- package/dist/pagerduty/runtime-context.d.ts.map +1 -0
- package/dist/pagerduty/runtime-context.js +34 -0
- package/dist/pagerduty/runtime-context.js.map +1 -0
- package/dist/pagerduty/system.integration.pagerduty.descriptor.d.ts +69 -0
- package/dist/pagerduty/system.integration.pagerduty.descriptor.d.ts.map +1 -0
- package/dist/pagerduty/system.integration.pagerduty.descriptor.js +53 -0
- package/dist/pagerduty/system.integration.pagerduty.descriptor.js.map +1 -0
- package/dist/schemas/pagerduty.d.ts +146 -0
- package/dist/schemas/pagerduty.d.ts.map +1 -0
- package/dist/schemas/pagerduty.js +58 -0
- package/dist/schemas/pagerduty.js.map +1 -0
- package/package.json +111 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: VIBES DEV LLC
|
|
6
|
+
Licensed Work: @vibesdotdev/integrations-pagerduty
|
|
7
|
+
The Licensed Work is (c) 2026 VIBES DEV LLC.
|
|
8
|
+
Additional Use Grant: In this grant, "Vibes Platform" means the hosted services VIBES DEV LLC
|
|
9
|
+
operates at vibes.dev and its subdomains.
|
|
10
|
+
|
|
11
|
+
You may make production use of the Licensed Work, including commercial
|
|
12
|
+
use, subject to the limits below. Permitted production use includes:
|
|
13
|
+
building, operating and selling your own applications, agents and services
|
|
14
|
+
on or with the Vibes Platform; self-hosting the Licensed Work for use inside
|
|
15
|
+
your own organization; and providing consulting, integration or development
|
|
16
|
+
services to clients who build on the Vibes Platform.
|
|
17
|
+
|
|
18
|
+
The production use permitted above does not include use that:
|
|
19
|
+
|
|
20
|
+
(a) offers third parties a hosted, managed or embedded service that
|
|
21
|
+
substitutes for the Vibes Platform or a material part of it (including
|
|
22
|
+
agent hosting; fleet, sandbox or container provisioning; package
|
|
23
|
+
registry; source hosting and continuous integration; and managed AI,
|
|
24
|
+
storage, secrets or messaging), where the Licensed Work provides a
|
|
25
|
+
material part of that service's value and that service earns more than
|
|
26
|
+
US$1,000,000 in gross revenue in any twelve-month period;
|
|
27
|
+
(b) sells, rents, sublicenses or white-labels the Licensed Work, or access
|
|
28
|
+
to Vibes Platform functionality, as a product in its own right;
|
|
29
|
+
(c) removes, disables or works around entitlement checks, usage metering,
|
|
30
|
+
quotas or plan limits, or reaches Vibes Platform features the user's
|
|
31
|
+
account is not entitled to;
|
|
32
|
+
(d) scrapes, bulk-exports or harvests data or content from the Vibes
|
|
33
|
+
Platform or its users other than through documented interfaces and
|
|
34
|
+
within their terms, or uses outputs or data obtained from the Vibes
|
|
35
|
+
Platform to train or improve a product that competes with it;
|
|
36
|
+
(e) violates applicable law, infringes anyone's rights, commits fraud or
|
|
37
|
+
deception, conducts unlawful surveillance or harassment, distributes
|
|
38
|
+
malware, or accesses systems without authorization; or
|
|
39
|
+
(f) violates applicable antitrust or competition law.
|
|
40
|
+
|
|
41
|
+
A written permission from the Licensor extends this grant.
|
|
42
|
+
Change Date: Four years from the date the Licensed Work is published.
|
|
43
|
+
Change License: MIT
|
|
44
|
+
|
|
45
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
46
|
+
contact VIBES DEV LLC through https://vibes.dev.
|
|
47
|
+
|
|
48
|
+
Notice
|
|
49
|
+
|
|
50
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
51
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
52
|
+
under an Open Source License, as stated in this License.
|
|
53
|
+
|
|
54
|
+
-----------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
Business Source License 1.1
|
|
57
|
+
|
|
58
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
59
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
60
|
+
|
|
61
|
+
Terms
|
|
62
|
+
|
|
63
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
64
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
65
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
66
|
+
production use.
|
|
67
|
+
|
|
68
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
69
|
+
available distribution of a specific version of the Licensed Work under this
|
|
70
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
71
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
72
|
+
above terminate.
|
|
73
|
+
|
|
74
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
75
|
+
currently in effect as described in this License, you must purchase a
|
|
76
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
77
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
78
|
+
|
|
79
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
80
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
81
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
82
|
+
for each version of the Licensed Work released by Licensor.
|
|
83
|
+
|
|
84
|
+
You must conspicuously display this License on each original or modified copy
|
|
85
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
86
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
87
|
+
License apply to your use of that work.
|
|
88
|
+
|
|
89
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
90
|
+
terminate your rights under this License for the current and all other
|
|
91
|
+
versions of the Licensed Work.
|
|
92
|
+
|
|
93
|
+
This License does not grant you any right in any trademark or logo of
|
|
94
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
95
|
+
Licensor as expressly required by this License).
|
|
96
|
+
|
|
97
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
98
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
99
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
100
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
101
|
+
TITLE.
|
|
102
|
+
|
|
103
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
104
|
+
your works, and to refer to it using the trademark “Business Source License”,
|
|
105
|
+
as long as you comply with the Covenants of Licensor below.
|
|
106
|
+
|
|
107
|
+
Covenants of Licensor
|
|
108
|
+
|
|
109
|
+
In consideration of the right to use this License’s text and the “Business
|
|
110
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
111
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
112
|
+
|
|
113
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
114
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
115
|
+
where “compatible” means that software provided under the Change License can
|
|
116
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
117
|
+
later version. Licensor may specify additional Change Licenses without
|
|
118
|
+
limitation.
|
|
119
|
+
|
|
120
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
121
|
+
impose any additional restriction on the right granted in this License, as
|
|
122
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
123
|
+
|
|
124
|
+
3. To specify a Change Date.
|
|
125
|
+
|
|
126
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# PagerDuty integration
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compose `@vibesdotdev/integrations-pagerduty/plugin` into the runtime, then
|
|
4
|
+
resolve the semantic client:
|
|
5
|
+
|
|
6
|
+
```ts
|
|
7
|
+
import { getVibesPagerDutyClient } from '@vibesdotdev/integrations-pagerduty/client';
|
|
8
|
+
|
|
9
|
+
const pagerduty = await getVibesPagerDutyClient(runtime);
|
|
10
|
+
const incident = await pagerduty.incidents.trigger({
|
|
11
|
+
summary: 'Checkout unavailable',
|
|
12
|
+
source: 'checkout-service',
|
|
13
|
+
severity: 'critical'
|
|
14
|
+
});
|
|
15
|
+
await pagerduty.incidents.acknowledge(incident.dedupKey);
|
|
16
|
+
await pagerduty.incidents.resolve(incident.dedupKey);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Consumer hosts supply authenticated user context and compose the Platform
|
|
20
|
+
internal API's service origin and credential. Provider hosts compose the
|
|
21
|
+
Integrations kind, Logging, Storage and `system/settings-reader`; routing
|
|
22
|
+
credentials resolve through the inherited integration owner, using an
|
|
23
|
+
organization credential or the `PAGERDUTY_ROUTING_KEY` secret reference.
|
|
24
|
+
|
|
25
|
+
The root exports schemas and public clients/helpers; concrete provider access
|
|
26
|
+
is through `./pagerduty`. Inputs and responses are schema validated. Failures
|
|
27
|
+
use value-free `CapabilityError` codes and reasons. Missing optional vendor
|
|
28
|
+
response strings normalize to empty strings.
|
|
29
|
+
|
|
30
|
+
See [SPEC.md](./SPEC.md) for exports, composition, refusal reasons and proof.
|
|
31
|
+
Run `bun run check`, `bun run test` and `bun run build` from this directory.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { VibesRuntime } from '@vibesdotdev/kernel';
|
|
2
|
+
import type { PagerDutyClient } from './runtime-client.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the canonical `PagerDutyClient`.
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `runtime.query('runtime/client').withId('pagerduty').resolve()`.
|
|
7
|
+
* Requires the integrations-pagerduty plugin to be composed into the runtime.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { getVibesPagerDutyClient } from '@vibesdotdev/integrations-pagerduty/client';
|
|
11
|
+
* const pagerduty = await getVibesPagerDutyClient(runtime);
|
|
12
|
+
* const { dedupKey } = await pagerduty.incidents.trigger({
|
|
13
|
+
* summary: 'Checkout latency p99 > 2s',
|
|
14
|
+
* source: 'checkout-service',
|
|
15
|
+
* severity: 'error'
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function getVibesPagerDutyClient(runtime: VibesRuntime): Promise<PagerDutyClient>;
|
|
20
|
+
//# sourceMappingURL=helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/client/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAE7F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getVibesClient } from '@vibesdotdev/kernel/client';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the canonical `PagerDutyClient`.
|
|
4
|
+
*
|
|
5
|
+
* Equivalent to `runtime.query('runtime/client').withId('pagerduty').resolve()`.
|
|
6
|
+
* Requires the integrations-pagerduty plugin to be composed into the runtime.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { getVibesPagerDutyClient } from '@vibesdotdev/integrations-pagerduty/client';
|
|
10
|
+
* const pagerduty = await getVibesPagerDutyClient(runtime);
|
|
11
|
+
* const { dedupKey } = await pagerduty.incidents.trigger({
|
|
12
|
+
* summary: 'Checkout latency p99 > 2s',
|
|
13
|
+
* source: 'checkout-service',
|
|
14
|
+
* severity: 'error'
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export async function getVibesPagerDutyClient(runtime) {
|
|
19
|
+
return getVibesClient('pagerduty', runtime);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/client/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAAqB;IAClE,OAAO,cAAc,CAAkB,WAAW,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type KindContext, type VibesRuntime } from '@vibesdotdev/kernel';
|
|
2
|
+
import { BaseRuntimeClient, type RuntimeClientDescriptor } from '@vibesdotdev/kernel/client';
|
|
3
|
+
import { type PagerDutyClientContext, type TriggerIncidentOptions, type PagerDutyEnqueueResult } from '../schemas/pagerduty.ts';
|
|
4
|
+
export type { PagerDutyClientContext } from '../schemas/pagerduty.ts';
|
|
5
|
+
/** Runtime-owned semantic client over the Platform internal integrations API. */
|
|
6
|
+
export declare class PagerDutyClient extends BaseRuntimeClient {
|
|
7
|
+
readonly incidents: {
|
|
8
|
+
trigger: (options: TriggerIncidentOptions) => Promise<{
|
|
9
|
+
status: string;
|
|
10
|
+
message: string;
|
|
11
|
+
dedupKey: string;
|
|
12
|
+
}>;
|
|
13
|
+
acknowledge: (dedupKey: string) => Promise<{
|
|
14
|
+
status: string;
|
|
15
|
+
message: string;
|
|
16
|
+
dedupKey: string;
|
|
17
|
+
}>;
|
|
18
|
+
resolve: (dedupKey: string) => Promise<{
|
|
19
|
+
status: string;
|
|
20
|
+
message: string;
|
|
21
|
+
dedupKey: string;
|
|
22
|
+
}>;
|
|
23
|
+
};
|
|
24
|
+
private readonly contextOverride;
|
|
25
|
+
constructor(descriptor?: RuntimeClientDescriptor, context?: PagerDutyClientContext | KindContext, runtime?: VibesRuntime);
|
|
26
|
+
get integrationId(): string;
|
|
27
|
+
invoke(operationId: string, args?: unknown): Promise<PagerDutyEnqueueResult>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=runtime-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-client.d.ts","sourceRoot":"","sources":["../../src/client/runtime-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,EAGN,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EACrF,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,iFAAiF;AACjF,qBAAa,eAAgB,SAAQ,iBAAiB;IACrD,QAAQ,CAAC,SAAS;2BAWG,sBAAsB;;;;;gCACjB,MAAM;;;;;4BACV,MAAM;;;;;MAbT;IACnB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;gBAG/D,UAAU,GAAE,uBAAqE,EACjF,OAAO,CAAC,EAAE,sBAAsB,GAAG,WAAW,EAC9C,OAAO,CAAC,EAAE,YAAY;IAWvB,IAAI,aAAa,IAAI,MAAM,CAAoC;IAEzD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAwClF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CapabilityError, settle } from '@vibesdotdev/kernel';
|
|
2
|
+
import { BaseRuntimeClient } from '@vibesdotdev/kernel/client';
|
|
3
|
+
import { getVibesPlatformInternalClient } from '@vibesdotdev/platform/internal-api';
|
|
4
|
+
import { admitPagerDutyInput, PagerDutyClientContextSchema, PagerDutyUserIdSchema, PagerDutyOrgIdSchema, PagerDutyOperationSchema, TriggerIncidentOptionsSchema, DedupKeyOptionsSchema, PagerDutyEnqueueResultSchema } from "../schemas/pagerduty.js";
|
|
5
|
+
/** Runtime-owned semantic client over the Platform internal integrations API. */
|
|
6
|
+
export class PagerDutyClient extends BaseRuntimeClient {
|
|
7
|
+
incidents;
|
|
8
|
+
contextOverride;
|
|
9
|
+
constructor(descriptor = { id: 'pagerduty', kind: 'runtime/client' }, context, runtime) {
|
|
10
|
+
super(descriptor, context && 'runtime' in context ? context : undefined, runtime);
|
|
11
|
+
this.contextOverride = context && 'runtime' in context ? null : admitPagerDutyInput(PagerDutyClientContextSchema, context ?? {});
|
|
12
|
+
this.incidents = {
|
|
13
|
+
trigger: (options) => this.invoke('triggerIncident', options),
|
|
14
|
+
acknowledge: (dedupKey) => this.invoke('acknowledgeIncident', { dedupKey }),
|
|
15
|
+
resolve: (dedupKey) => this.invoke('resolveIncident', { dedupKey })
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
get integrationId() { return 'integration.pagerduty'; }
|
|
19
|
+
async invoke(operationId, args) {
|
|
20
|
+
const operation = admitPagerDutyInput(PagerDutyOperationSchema, operationId);
|
|
21
|
+
const schema = operation === 'triggerIncident' ? TriggerIncidentOptionsSchema : DedupKeyOptionsSchema;
|
|
22
|
+
const parsedInput = schema.safeParse(args);
|
|
23
|
+
if (!parsedInput.success) {
|
|
24
|
+
throw new CapabilityError('Invalid PagerDuty input.', 'INVALID_INPUT', { reason: 'pagerduty-input-invalid' });
|
|
25
|
+
}
|
|
26
|
+
const input = parsedInput.data;
|
|
27
|
+
const user = await settle(async () => this.contextOverride?.userId ?? await this.runtime.context('userId'));
|
|
28
|
+
const userId = PagerDutyUserIdSchema.safeParse(user.ok ? user.value : undefined);
|
|
29
|
+
if (!userId.success) {
|
|
30
|
+
throw new CapabilityError('PagerDuty requires a user context.', 'UNAVAILABLE', { reason: 'pagerduty-context-missing' });
|
|
31
|
+
}
|
|
32
|
+
const org = await settle(async () => this.contextOverride?.organizationId ?? this.contextOverride?.orgId ?? await this.runtime.context('orgId'));
|
|
33
|
+
if (!org.ok && !(org.cause instanceof Error && CapabilityError.isAbsenceOf(org.cause, 'context', 'orgId'))) {
|
|
34
|
+
throw new CapabilityError('PagerDuty organization context is unavailable.', 'UNAVAILABLE', { reason: 'pagerduty-context-missing' });
|
|
35
|
+
}
|
|
36
|
+
const organizationId = admitPagerDutyInput(PagerDutyOrgIdSchema, org.ok ? org.value : undefined);
|
|
37
|
+
const invoked = await settle(async () => {
|
|
38
|
+
const client = await getVibesPlatformInternalClient(this.runtime);
|
|
39
|
+
return client.integrations.invoke({
|
|
40
|
+
userId: userId.data, organizationId, integrationId: this.integrationId, operationId: operation, args: input
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
if (!invoked.ok) {
|
|
44
|
+
throw new CapabilityError('PagerDuty platform request failed.', 'UNAVAILABLE', { reason: 'pagerduty-platform-failed' });
|
|
45
|
+
}
|
|
46
|
+
const result = invoked.value;
|
|
47
|
+
if (!result.ok) {
|
|
48
|
+
throw new CapabilityError('PagerDuty operation refused.', 'UNAVAILABLE', { reason: 'pagerduty-operation-failed' });
|
|
49
|
+
}
|
|
50
|
+
if (result.data === null || result.data === undefined) {
|
|
51
|
+
throw new CapabilityError('PagerDuty result is missing.', 'UNAVAILABLE', { reason: 'pagerduty-result-missing' });
|
|
52
|
+
}
|
|
53
|
+
const parsed = PagerDutyEnqueueResultSchema.safeParse(result.data);
|
|
54
|
+
if (!parsed.success) {
|
|
55
|
+
throw new CapabilityError('Invalid PagerDuty platform result.', 'UNAVAILABLE', { reason: 'pagerduty-platform-failed' });
|
|
56
|
+
}
|
|
57
|
+
return parsed.data;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=runtime-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-client.js","sourceRoot":"","sources":["../../src/client/runtime-client.ts"],"names":[],"mappings":"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"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibesdotdev/integrations-pagerduty
|
|
3
|
+
*
|
|
4
|
+
* PagerDuty integration provider for the Vibes platform.
|
|
5
|
+
* Provides a PagerDuty runtime client for incident-alerting workflows
|
|
6
|
+
* (trigger, acknowledge, resolve alerts via the Events API v2).
|
|
7
|
+
*
|
|
8
|
+
* @module @vibesdotdev/integrations-pagerduty
|
|
9
|
+
*/
|
|
10
|
+
export { default as integrationsPagerDutyPlugin } from './integrations-pagerduty.plugin.ts';
|
|
11
|
+
export { default } from './integrations-pagerduty.plugin.ts';
|
|
12
|
+
export { PagerDutyClient, getVibesPagerDutyClient } from './client/index.ts';
|
|
13
|
+
export { default as pagerdutyDescriptor } from './pagerduty/system.integration.pagerduty.descriptor.ts';
|
|
14
|
+
export * from './schemas/pagerduty.ts';
|
|
15
|
+
export { PagerDutyEventsConnector, PAGERDUTY_DEFAULT_BASE_URL } from './pagerduty/pagerduty-connector.ts';
|
|
16
|
+
export type { PagerDutyEnqueueResult, PagerDutySeverity, TriggerIncidentOptions } from './pagerduty/pagerduty-connector.ts';
|
|
17
|
+
export { PAGERDUTY_INTEGRATION_ID, resolvePagerDutyIntegration, resolvePagerDutyConnector } from './pagerduty/runtime-context.ts';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAGxG,cAAc,wBAAwB,CAAC;AAGvC,OAAO,EACN,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EACX,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EACN,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,gCAAgC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vibesdotdev/integrations-pagerduty
|
|
3
|
+
*
|
|
4
|
+
* PagerDuty integration provider for the Vibes platform.
|
|
5
|
+
* Provides a PagerDuty runtime client for incident-alerting workflows
|
|
6
|
+
* (trigger, acknowledge, resolve alerts via the Events API v2).
|
|
7
|
+
*
|
|
8
|
+
* @module @vibesdotdev/integrations-pagerduty
|
|
9
|
+
*/
|
|
10
|
+
// Plugin export
|
|
11
|
+
export { default as integrationsPagerDutyPlugin } from "./integrations-pagerduty.plugin.js";
|
|
12
|
+
export { default } from "./integrations-pagerduty.plugin.js";
|
|
13
|
+
// Canonical runtime client (consumer-facing entrypoint)
|
|
14
|
+
export { PagerDutyClient, getVibesPagerDutyClient } from "./client/index.js";
|
|
15
|
+
// PagerDuty descriptor export
|
|
16
|
+
export { default as pagerdutyDescriptor } from "./pagerduty/system.integration.pagerduty.descriptor.js";
|
|
17
|
+
// Provider implementation
|
|
18
|
+
export * from "./schemas/pagerduty.js";
|
|
19
|
+
// Inlined connector + response types
|
|
20
|
+
export { PagerDutyEventsConnector, PAGERDUTY_DEFAULT_BASE_URL } from "./pagerduty/pagerduty-connector.js";
|
|
21
|
+
// Runtime-context helpers (external callers / jobs)
|
|
22
|
+
export { PAGERDUTY_INTEGRATION_ID, resolvePagerDutyIntegration, resolvePagerDutyConnector } from "./pagerduty/runtime-context.js";
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gBAAgB;AAChB,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D,wDAAwD;AACxD,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,8BAA8B;AAC9B,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAExG,0BAA0B;AAC1B,cAAc,wBAAwB,CAAC;AAEvC,qCAAqC;AACrC,OAAO,EACN,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,oCAAoC,CAAC;AAO5C,oDAAoD;AACpD,OAAO,EACN,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrations PagerDuty Plugin
|
|
3
|
+
*
|
|
4
|
+
* Registers two things with the runtime:
|
|
5
|
+
*
|
|
6
|
+
* 1. The `integration/provider` descriptor (id `integration.pagerduty`) +
|
|
7
|
+
* `PagerDutyIntegrationProvider` implementation, which inherits credential
|
|
8
|
+
* resolution from `BaseIntegrationProvider` and dispatches the declared
|
|
9
|
+
* incident-alerting ops to the inlined `PagerDutyEventsConnector`.
|
|
10
|
+
*
|
|
11
|
+
* 2. The canonical `runtime/client` descriptor (id `pagerduty`) +
|
|
12
|
+
* `PagerDutyClient` implementation, which is the consumer-facing typed
|
|
13
|
+
* surface (`pagerduty.incidents.*`). Apps resolve it via
|
|
14
|
+
* `getVibesPagerDutyClient(runtime)` and never reach for the Events API directly.
|
|
15
|
+
*/
|
|
16
|
+
export declare const integrationsPagerDutyPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
|
|
17
|
+
export default integrationsPagerDutyPlugin;
|
|
18
|
+
//# sourceMappingURL=integrations-pagerduty.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations-pagerduty.plugin.d.ts","sourceRoot":"","sources":["../src/integrations-pagerduty.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,eAAO,MAAM,2BAA2B,6CAyBtC,CAAC;AAEH,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrations PagerDuty Plugin
|
|
3
|
+
*
|
|
4
|
+
* Registers two things with the runtime:
|
|
5
|
+
*
|
|
6
|
+
* 1. The `integration/provider` descriptor (id `integration.pagerduty`) +
|
|
7
|
+
* `PagerDutyIntegrationProvider` implementation, which inherits credential
|
|
8
|
+
* resolution from `BaseIntegrationProvider` and dispatches the declared
|
|
9
|
+
* incident-alerting ops to the inlined `PagerDutyEventsConnector`.
|
|
10
|
+
*
|
|
11
|
+
* 2. The canonical `runtime/client` descriptor (id `pagerduty`) +
|
|
12
|
+
* `PagerDutyClient` implementation, which is the consumer-facing typed
|
|
13
|
+
* surface (`pagerduty.incidents.*`). Apps resolve it via
|
|
14
|
+
* `getVibesPagerDutyClient(runtime)` and never reach for the Events API directly.
|
|
15
|
+
*/
|
|
16
|
+
import { createRuntimePlugin, loader } from '@vibesdotdev/kernel/factory';
|
|
17
|
+
import pagerdutyDescriptor from "./pagerduty/system.integration.pagerduty.descriptor.js";
|
|
18
|
+
export const integrationsPagerDutyPlugin = createRuntimePlugin({
|
|
19
|
+
id: 'integrations-pagerduty',
|
|
20
|
+
name: 'Integrations PagerDuty Plugin',
|
|
21
|
+
description: 'PagerDuty integration provider + canonical runtime client',
|
|
22
|
+
descriptors: [
|
|
23
|
+
pagerdutyDescriptor,
|
|
24
|
+
{
|
|
25
|
+
id: 'pagerduty',
|
|
26
|
+
kind: 'runtime/client',
|
|
27
|
+
description: 'Canonical PagerDuty client — incidents namespace over declared operations'
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
loaders: [
|
|
31
|
+
loader(pagerdutyDescriptor.id, { kind: 'integration/provider' }, async () => {
|
|
32
|
+
const { PagerDutyIntegrationProvider } = await import("./pagerduty/pagerduty-implementation.js");
|
|
33
|
+
return { default: PagerDutyIntegrationProvider };
|
|
34
|
+
}),
|
|
35
|
+
loader('pagerduty', { kind: 'runtime/client' }, async () => {
|
|
36
|
+
const { PagerDutyClient } = await import("./client/runtime-client.js");
|
|
37
|
+
return { impl: PagerDutyClient };
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
export default integrationsPagerDutyPlugin;
|
|
42
|
+
//# sourceMappingURL=integrations-pagerduty.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations-pagerduty.plugin.js","sourceRoot":"","sources":["../src/integrations-pagerduty.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,mBAAmB,MAAM,wDAAwD,CAAC;AAEzF,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAAC;IAC9D,EAAE,EAAE,wBAAwB;IAC5B,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,2DAA2D;IACxE,WAAW,EAAE;QACZ,mBAAmB;QACnB;YACC,EAAE,EAAE,WAAW;YACf,IAAI,EAAE,gBAAgB;YACtB,WAAW,EACV,2EAA2E;SAC5E;KACD;IACD,OAAO,EAAE;QACR,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAAE,KAAK,IAAI,EAAE;YAC3E,MAAM,EAAE,4BAA4B,EAAE,GAAG,MAAM,MAAM,CACpD,yCAAyC,CACzC,CAAC;YACF,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;QAClD,CAAC,CAAC;QACF,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,EAAE,KAAK,IAAI,EAAE;YAC1D,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;YACvE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;QAClC,CAAC,CAAC;KACF;CACD,CAAC,CAAC;AAEH,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RuntimeRef } from '@vibesdotdev/kernel';
|
|
2
|
+
import type { IntegrationProviderResolvedConfiguration } from '@vibesdotdev/integrations/schemas/integration-descriptor';
|
|
3
|
+
import { PagerDutyEventsConnector } from './pagerduty-connector.ts';
|
|
4
|
+
/** Interpret inherited configuration identically for the provider and public helper. */
|
|
5
|
+
export declare function connectorFromConfiguration(runtime: RuntimeRef, resolved: IntegrationProviderResolvedConfiguration): PagerDutyEventsConnector;
|
|
6
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/pagerduty/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,0DAA0D,CAAC;AAEzH,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,wFAAwF;AACxF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,wCAAwC,GAAG,wBAAwB,CAU5I"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
2
|
+
import { PagerDutyConfigSchema, PagerDutyCredentialsSchema } from "../schemas/pagerduty.js";
|
|
3
|
+
import { PagerDutyEventsConnector } from "./pagerduty-connector.js";
|
|
4
|
+
/** Interpret inherited configuration identically for the provider and public helper. */
|
|
5
|
+
export function connectorFromConfiguration(runtime, resolved) {
|
|
6
|
+
const config = PagerDutyConfigSchema.safeParse(resolved.config);
|
|
7
|
+
if (!config.success) {
|
|
8
|
+
throw new CapabilityError('Invalid PagerDuty configuration.', 'INVALID_INPUT', { reason: 'pagerduty-config-invalid' });
|
|
9
|
+
}
|
|
10
|
+
const credentials = PagerDutyCredentialsSchema.safeParse({ routingKey: resolved.credentialReferences.routingKey ?? [] });
|
|
11
|
+
if (!credentials.success) {
|
|
12
|
+
throw new CapabilityError('PagerDuty routing credential is unavailable.', 'UNAVAILABLE', { reason: 'pagerduty-credential-missing' });
|
|
13
|
+
}
|
|
14
|
+
return new PagerDutyEventsConnector(runtime, { baseUrl: config.data.baseUrl, credentialReferences: credentials.data.routingKey });
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../src/pagerduty/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,wFAAwF;AACxF,MAAM,UAAU,0BAA0B,CAAC,OAAmB,EAAE,QAAkD;IACjH,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,eAAe,CAAC,kCAAkC,EAAE,eAAe,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,CAAC,CAAC;IACxH,CAAC;IACD,MAAM,WAAW,GAAG,0BAA0B,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,oBAAoB,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC,CAAC;IACzH,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,eAAe,CAAC,8CAA8C,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAC,CAAC;IACtI,CAAC;IACD,OAAO,IAAI,wBAAwB,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,EAAE,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;AACnI,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PagerDuty integration module
|
|
3
|
+
*/
|
|
4
|
+
export { default as pagerdutyDescriptor } from './system.integration.pagerduty.descriptor.ts';
|
|
5
|
+
export { PagerDutyIntegrationProvider } from './pagerduty-implementation.ts';
|
|
6
|
+
export { PagerDutyEventsConnector, PAGERDUTY_DEFAULT_BASE_URL } from './pagerduty-connector.ts';
|
|
7
|
+
export type { PagerDutyEnqueueResult, PagerDutySeverity, TriggerIncidentOptions } from './pagerduty-connector.ts';
|
|
8
|
+
export { PAGERDUTY_INTEGRATION_ID, resolvePagerDutyIntegration, resolvePagerDutyConnector } from './runtime-context.ts';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pagerduty/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EACN,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACX,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACN,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PagerDuty integration module
|
|
3
|
+
*/
|
|
4
|
+
export { default as pagerdutyDescriptor } from "./system.integration.pagerduty.descriptor.js";
|
|
5
|
+
export { PagerDutyIntegrationProvider } from "./pagerduty-implementation.js";
|
|
6
|
+
export { PagerDutyEventsConnector, PAGERDUTY_DEFAULT_BASE_URL } from "./pagerduty-connector.js";
|
|
7
|
+
export { PAGERDUTY_INTEGRATION_ID, resolvePagerDutyIntegration, resolvePagerDutyConnector } from "./runtime-context.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pagerduty/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAE7E,OAAO,EACN,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACN,wBAAwB,EACxB,2BAA2B,EAC3B,yBAAyB,EACzB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type RuntimeRef } from '@vibesdotdev/kernel';
|
|
2
|
+
import { type PagerDutyConnectorOptions, type PagerDutyEnqueueResult, type TriggerIncidentOptions } from '../schemas/pagerduty.ts';
|
|
3
|
+
export { PAGERDUTY_DEFAULT_BASE_URL } from '../schemas/pagerduty.ts';
|
|
4
|
+
export type { PagerDutyEnqueueResult, PagerDutySeverity, TriggerIncidentOptions } from '../schemas/pagerduty.ts';
|
|
5
|
+
/** Events API v2 transport. Public inputs and vendor responses are schema owned. */
|
|
6
|
+
export declare class PagerDutyEventsConnector {
|
|
7
|
+
private readonly runtime;
|
|
8
|
+
private readonly credentialReferences;
|
|
9
|
+
private readonly baseUrl;
|
|
10
|
+
constructor(runtime: RuntimeRef, options: PagerDutyConnectorOptions);
|
|
11
|
+
private enqueue;
|
|
12
|
+
triggerIncident(options: TriggerIncidentOptions): Promise<PagerDutyEnqueueResult>;
|
|
13
|
+
acknowledgeIncident(dedupKey: string): Promise<PagerDutyEnqueueResult>;
|
|
14
|
+
resolveIncident(dedupKey: string): Promise<PagerDutyEnqueueResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=pagerduty-connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagerduty-connector.d.ts","sourceRoot":"","sources":["../../src/pagerduty/pagerduty-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/E,OAAO,EAGN,KAAK,yBAAyB,EAAuB,KAAK,sBAAsB,EAChF,KAAK,sBAAsB,EAC3B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjH,oFAAoF;AACpF,qBAAa,wBAAwB;IAIxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAoD;IACzF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAEJ,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,yBAAyB;YAStE,OAAO;IAsCf,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAWjF,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAKtE,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;CAIxE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { CapabilityError, settle } from '@vibesdotdev/kernel';
|
|
2
|
+
import { sendIntegrationAuthenticatedRequest } from '@vibesdotdev/integrations/server/secrets';
|
|
3
|
+
import { admitPagerDutyInput, DedupKeyOptionsSchema, PagerDutyConnectorOptionsSchema, PagerDutyVendorResponseSchema, TriggerIncidentOptionsSchema } from "../schemas/pagerduty.js";
|
|
4
|
+
export { PAGERDUTY_DEFAULT_BASE_URL } from "../schemas/pagerduty.js";
|
|
5
|
+
/** Events API v2 transport. Public inputs and vendor responses are schema owned. */
|
|
6
|
+
export class PagerDutyEventsConnector {
|
|
7
|
+
runtime;
|
|
8
|
+
credentialReferences;
|
|
9
|
+
baseUrl;
|
|
10
|
+
constructor(runtime, options) {
|
|
11
|
+
this.runtime = runtime;
|
|
12
|
+
const parsed = admitPagerDutyInput(PagerDutyConnectorOptionsSchema, options);
|
|
13
|
+
this.credentialReferences = parsed.credentialReferences;
|
|
14
|
+
this.baseUrl = parsed.baseUrl;
|
|
15
|
+
if (this.credentialReferences.length === 0) {
|
|
16
|
+
throw new CapabilityError('PagerDuty routing credential is unavailable.', 'UNAVAILABLE', { reason: 'pagerduty-credential-missing' });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async enqueue(body) {
|
|
20
|
+
let response;
|
|
21
|
+
try {
|
|
22
|
+
response = await sendIntegrationAuthenticatedRequest(this.runtime, {
|
|
23
|
+
url: `${this.baseUrl.replace(/\/$/, '')}/enqueue`,
|
|
24
|
+
options: {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: { 'Content-Type': 'application/json' },
|
|
27
|
+
body: JSON.stringify(body),
|
|
28
|
+
credentialBindings: [{ kind: 'json-field', candidates: this.credentialReferences, path: ['routing_key'] }]
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (cause) {
|
|
33
|
+
if (cause instanceof CapabilityError && cause.code === 'NOT_FOUND' && cause.reason === 'credential-not-set') {
|
|
34
|
+
throw new CapabilityError('PagerDuty routing credential is unavailable.', 'UNAVAILABLE', { reason: 'pagerduty-credential-missing' });
|
|
35
|
+
}
|
|
36
|
+
if (cause instanceof CapabilityError)
|
|
37
|
+
throw cause;
|
|
38
|
+
throw new CapabilityError('PagerDuty request failed.', 'UNAVAILABLE', { reason: 'pagerduty-request-failed', cause });
|
|
39
|
+
}
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
const released = await settle(() => response.body?.cancel());
|
|
42
|
+
throw new CapabilityError('PagerDuty refused the event.', 'UNAVAILABLE', {
|
|
43
|
+
reason: 'pagerduty-upstream-failed', details: { status: response.status },
|
|
44
|
+
cause: released.ok ? undefined : released.cause
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const json = await settle(() => response.json());
|
|
48
|
+
if (!json.ok) {
|
|
49
|
+
if (json.cause instanceof CapabilityError)
|
|
50
|
+
throw json.cause;
|
|
51
|
+
throw new CapabilityError('Invalid PagerDuty response.', 'UNAVAILABLE', { reason: 'pagerduty-response-invalid' });
|
|
52
|
+
}
|
|
53
|
+
const parsed = PagerDutyVendorResponseSchema.safeParse(json.value);
|
|
54
|
+
if (!parsed.success) {
|
|
55
|
+
throw new CapabilityError('Invalid PagerDuty response.', 'UNAVAILABLE', { reason: 'pagerduty-response-invalid' });
|
|
56
|
+
}
|
|
57
|
+
return { status: parsed.data.status ?? '', message: parsed.data.message ?? '', dedupKey: parsed.data.dedup_key ?? '' };
|
|
58
|
+
}
|
|
59
|
+
async triggerIncident(options) {
|
|
60
|
+
const input = admitPagerDutyInput(TriggerIncidentOptionsSchema, options);
|
|
61
|
+
const body = {
|
|
62
|
+
event_action: 'trigger',
|
|
63
|
+
payload: { summary: input.summary, source: input.source, severity: input.severity }
|
|
64
|
+
};
|
|
65
|
+
if (input.dedupKey !== undefined)
|
|
66
|
+
body.dedup_key = input.dedupKey;
|
|
67
|
+
if (input.customDetails !== undefined && body.payload)
|
|
68
|
+
body.payload.custom_details = input.customDetails;
|
|
69
|
+
return this.enqueue(body);
|
|
70
|
+
}
|
|
71
|
+
async acknowledgeIncident(dedupKey) {
|
|
72
|
+
const input = admitPagerDutyInput(DedupKeyOptionsSchema, { dedupKey });
|
|
73
|
+
return this.enqueue({ event_action: 'acknowledge', dedup_key: input.dedupKey });
|
|
74
|
+
}
|
|
75
|
+
async resolveIncident(dedupKey) {
|
|
76
|
+
const input = admitPagerDutyInput(DedupKeyOptionsSchema, { dedupKey });
|
|
77
|
+
return this.enqueue({ event_action: 'resolve', dedup_key: input.dedupKey });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=pagerduty-connector.js.map
|