open-index/open-npm huggingface dataset:
npm package: @jspolicy/example-policies
Description: A simple project that shows how to use typescript with jspolicy
Author: Loft Labs Inc.
Latest version: 0.0.2

# Example Policies for jsPolicy

The goal for this project is to provide a simple boilerplate to create custom js policies as npm packages that can be reused by other polices.

# Compile

You can compile the policies via:

```bash
# Install dependencies
npm install

# Package the policies
npm run compile
```

# Example Use Case

Use the policies in a webhook directly:

```yaml
apiVersion: policy.jspolicy.com/v1beta1
kind: JsPolicy
metadata:
  name: "pod-policy.example.com"
spec:
  operations: ["CREATE"]
  resources: ["pods"]
  dependencies:
    "@jspolicy/example-policies": "^0.0.1" 
  javascript: |
    import {denyPodAddCapabilities} from '@jspolicy/example-policies';

    // Call the example policy that denies pods that try to add capabilities
    denyPodAddCapabilities(request, deny);
```