@sentry/junior-plugin-api 0.158.0 → 0.160.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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Deny provider egress when a plugin policy does not allow the request.
3
+ *
4
+ * Call from a plugin `grantForEgress` hook before returning a write grant.
5
+ */
6
+ export declare function enforceEgressPolicy(input: {
7
+ allowed: boolean;
8
+ denialMessage: string;
9
+ }): void;
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from "./tasks";
10
10
  export * from "./tools";
11
11
  export * from "./operations";
12
12
  export * from "./credentials";
13
+ export * from "./egress-policy";
13
14
  export * from "./hooks";
14
15
  export * from "./cli";
15
16
  export * from "./manifest";
package/dist/index.js CHANGED
@@ -666,6 +666,13 @@ var EgressPolicyDenied = class extends Error {
666
666
  }
667
667
  };
668
668
 
669
+ // src/egress-policy.ts
670
+ function enforceEgressPolicy(input) {
671
+ if (!input.allowed) {
672
+ throw new EgressPolicyDenied(input.denialMessage);
673
+ }
674
+ }
675
+
669
676
  // src/registration.ts
670
677
  var PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
671
678
  var USER_PAGE_ID_RE = /^[a-z][a-z0-9-]*$/;
@@ -852,6 +859,7 @@ export {
852
859
  destinationSchema,
853
860
  destinationVisibilitySchema,
854
861
  dispatchOptionsSchema,
862
+ enforceEgressPolicy,
855
863
  getSourceKey,
856
864
  identitySchema,
857
865
  isPrivateSource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-plugin-api",
3
- "version": "0.158.0",
3
+ "version": "0.160.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -0,0 +1,15 @@
1
+ import { EgressPolicyDenied } from "./credentials";
2
+
3
+ /**
4
+ * Deny provider egress when a plugin policy does not allow the request.
5
+ *
6
+ * Call from a plugin `grantForEgress` hook before returning a write grant.
7
+ */
8
+ export function enforceEgressPolicy(input: {
9
+ allowed: boolean;
10
+ denialMessage: string;
11
+ }): void {
12
+ if (!input.allowed) {
13
+ throw new EgressPolicyDenied(input.denialMessage);
14
+ }
15
+ }
package/src/index.ts CHANGED
@@ -20,6 +20,7 @@ export * from "./tasks";
20
20
  export * from "./tools";
21
21
  export * from "./operations";
22
22
  export * from "./credentials";
23
+ export * from "./egress-policy";
23
24
  export * from "./hooks";
24
25
  export * from "./cli";
25
26
  export * from "./manifest";