pepr 0.14.1 → 0.15.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.
Files changed (62) hide show
  1. package/dist/cli.js +110 -43
  2. package/dist/controller.js +1 -1
  3. package/dist/lib/assets/deploy.d.ts.map +1 -1
  4. package/dist/lib/assets/index.d.ts +1 -1
  5. package/dist/lib/assets/index.d.ts.map +1 -1
  6. package/dist/lib/assets/rbac.d.ts +2 -1
  7. package/dist/lib/assets/rbac.d.ts.map +1 -1
  8. package/dist/lib/assets/yaml.d.ts +1 -1
  9. package/dist/lib/assets/yaml.d.ts.map +1 -1
  10. package/dist/lib/helpers.d.ts +11 -0
  11. package/dist/lib/helpers.d.ts.map +1 -0
  12. package/dist/lib/included-files.d.ts +2 -0
  13. package/dist/lib/included-files.d.ts.map +1 -0
  14. package/package.json +16 -14
  15. package/src/lib/assets/deploy.ts +4 -3
  16. package/src/lib/assets/index.ts +2 -2
  17. package/src/lib/assets/rbac.ts +27 -11
  18. package/src/lib/assets/yaml.ts +2 -2
  19. package/src/lib/helpers.ts +39 -0
  20. package/src/lib/included-files.ts +19 -0
  21. package/src/templates/capabilities/hello-pepr.ts +16 -11
  22. package/src/templates/package.json +2 -1
  23. package/website/.linkinator.config.json +8 -0
  24. package/website/.markdownlint.json +6 -0
  25. package/website/.prettierignore +12 -0
  26. package/website/LICENSE +201 -0
  27. package/website/README.md +50 -0
  28. package/website/archetypes/default.md +6 -0
  29. package/website/assets/img/doug.svg +345 -0
  30. package/website/assets/img/pepr.svg +212 -0
  31. package/website/assets/scss/_styles_project.scss +3 -0
  32. package/website/assets/scss/_variables_project.scss +1 -0
  33. package/website/content/en/docs/_index.md +9 -0
  34. package/website/content/en/docs/cli.md +64 -0
  35. package/website/content/en/docs/codeSample.txt +31 -0
  36. package/website/content/en/docs/concepts.md +238 -0
  37. package/website/content/en/docs/customresources.md +167 -0
  38. package/website/content/en/docs/diagrams.txt +18 -0
  39. package/website/content/en/docs/metrics.md +74 -0
  40. package/website/content/en/docs/rbac.md +153 -0
  41. package/website/content/en/docs/webassembly.md +189 -0
  42. package/website/go.mod +8 -0
  43. package/website/go.sum +4 -0
  44. package/website/package-lock.json +3907 -0
  45. package/website/package.json +30 -0
  46. package/website/renovate.json +16 -0
  47. package/website/static/favicons/android-144x144.png +0 -0
  48. package/website/static/favicons/android-192x192.png +0 -0
  49. package/website/static/favicons/android-36x36.png +0 -0
  50. package/website/static/favicons/android-48x48.png +0 -0
  51. package/website/static/favicons/android-72x72.png +0 -0
  52. package/website/static/favicons/android-96x96.png +0 -0
  53. package/website/static/favicons/android-chrome-192x192.png +0 -0
  54. package/website/static/favicons/android-chrome-512x512.png +0 -0
  55. package/website/static/favicons/android-chrome-maskable-192x192.png +0 -0
  56. package/website/static/favicons/android-chrome-maskable-512x512.png +0 -0
  57. package/website/static/favicons/apple-touch-icon-180x180.png +0 -0
  58. package/website/static/favicons/apple-touch-icon.png +0 -0
  59. package/website/static/favicons/favicon-16x16.png +0 -0
  60. package/website/static/favicons/favicon-32x32.png +0 -0
  61. package/website/static/favicons/favicon.ico +0 -0
  62. package/website/static/img/how-to-use.png +0 -0
package/dist/cli.js CHANGED
@@ -106,9 +106,25 @@ var banner = `\x1B[0m\x1B[38;2;96;96;96m \x1B[0m\x1B[38;2;96;96;96m \x1B[0m\x1B[
106
106
  // src/cli/build.ts
107
107
  var import_child_process2 = require("child_process");
108
108
  var import_esbuild = require("esbuild");
109
- var import_fs5 = require("fs");
109
+ var import_fs6 = require("fs");
110
110
  var import_path = require("path");
111
111
 
112
+ // src/lib/included-files.ts
113
+ var import_fs = require("fs");
114
+ async function createDockerfile(version3, description, includedFiles) {
115
+ const file = `
116
+ # Use an official Node.js runtime as the base image
117
+ FROM ghcr.io/defenseunicorns/pepr/controller:v${version3}
118
+
119
+ LABEL description="${description}"
120
+
121
+ # Add the included files to the image
122
+ ${includedFiles.map((f) => `ADD ${f} ${f}`).join("\n")}
123
+
124
+ `;
125
+ await import_fs.promises.writeFile("Dockerfile.controller", file, { encoding: "utf-8" });
126
+ }
127
+
112
128
  // src/lib/assets/index.ts
113
129
  var import_crypto3 = __toESM(require("crypto"));
114
130
 
@@ -171,7 +187,7 @@ function genCert(key, name2, issuer) {
171
187
 
172
188
  // src/lib/assets/deploy.ts
173
189
  var import_crypto = __toESM(require("crypto"));
174
- var import_fs = require("fs");
190
+ var import_fs2 = require("fs");
175
191
  var import_kubernetes_fluent_client2 = require("kubernetes-fluent-client");
176
192
 
177
193
  // src/lib/logger.ts
@@ -513,15 +529,45 @@ function moduleSecret(name2, data, hash) {
513
529
  };
514
530
  }
515
531
 
532
+ // src/lib/helpers.ts
533
+ var createRBACMap = (capabilities) => {
534
+ return capabilities.reduce((acc, capability) => {
535
+ capability.bindings.forEach((binding) => {
536
+ const key = `${binding.kind.group}/${binding.kind.version}/${binding.kind.kind}`;
537
+ acc["pepr.dev/v1/peprstore"] = {
538
+ verbs: ["create", "get", "patch", "watch"],
539
+ plural: "peprstores"
540
+ };
541
+ if (!acc[key] && binding.isWatch) {
542
+ acc[key] = {
543
+ verbs: ["watch"],
544
+ plural: binding.kind.plural || `${binding.kind.kind.toLowerCase()}s`
545
+ };
546
+ }
547
+ });
548
+ return acc;
549
+ }, {});
550
+ };
551
+
516
552
  // src/lib/assets/rbac.ts
517
- function clusterRole(name2) {
553
+ function clusterRole(name2, capabilities, rbacMode = "") {
554
+ const rbacMap = createRBACMap(capabilities);
518
555
  return {
519
556
  apiVersion: "rbac.authorization.k8s.io/v1",
520
557
  kind: "ClusterRole",
521
558
  metadata: { name: name2 },
522
- rules: [
559
+ rules: rbacMode === "scoped" ? [
560
+ ...Object.keys(rbacMap).map((key) => {
561
+ let group2;
562
+ key.split("/").length < 3 ? group2 = "" : group2 = key.split("/")[0];
563
+ return {
564
+ apiGroups: [group2],
565
+ resources: [rbacMap[key].plural],
566
+ verbs: rbacMap[key].verbs
567
+ };
568
+ })
569
+ ] : [
523
570
  {
524
- // @todo: make this configurable
525
571
  apiGroups: ["*"],
526
572
  resources: ["*"],
527
573
  verbs: ["create", "delete", "get", "list", "patch", "update", "watch"]
@@ -566,7 +612,7 @@ function storeRole(name2) {
566
612
  metadata: { name: name2, namespace: "pepr-system" },
567
613
  rules: [
568
614
  {
569
- apiGroups: ["pepr.dev/*"],
615
+ apiGroups: ["pepr.dev"],
570
616
  resources: ["peprstores"],
571
617
  resourceNames: [""],
572
618
  verbs: ["create", "get", "patch", "watch"]
@@ -769,21 +815,21 @@ async function deploy(assets, webhookTimeout) {
769
815
  if (host) {
770
816
  return;
771
817
  }
772
- const code = await import_fs.promises.readFile(path);
818
+ const code = await import_fs2.promises.readFile(path);
773
819
  const hash = import_crypto.default.createHash("sha256").update(code).digest("hex");
774
820
  if (code.length < 1) {
775
821
  throw new Error("No code provided");
776
822
  }
777
- await setupRBAC(name2);
823
+ await setupRBAC(name2, assets.capabilities);
778
824
  await setupController(assets, code, hash);
779
825
  await setupWatcher(assets, hash);
780
826
  }
781
- async function setupRBAC(name2) {
827
+ async function setupRBAC(name2, capabilities) {
782
828
  logger_default.info("Applying cluster role binding");
783
829
  const crb = clusterRoleBinding(name2);
784
830
  await (0, import_kubernetes_fluent_client2.K8s)(import_kubernetes_fluent_client2.kind.ClusterRoleBinding).Apply(crb);
785
831
  logger_default.info("Applying cluster role");
786
- const cr = clusterRole(name2);
832
+ const cr = clusterRole(name2, capabilities);
787
833
  await (0, import_kubernetes_fluent_client2.K8s)(import_kubernetes_fluent_client2.kind.ClusterRole).Apply(cr);
788
834
  logger_default.info("Applying service account");
789
835
  const sa = serviceAccount(name2);
@@ -851,7 +897,7 @@ function loadCapabilities(path) {
851
897
  // src/lib/assets/yaml.ts
852
898
  var import_client_node = require("@kubernetes/client-node");
853
899
  var import_crypto2 = __toESM(require("crypto"));
854
- var import_fs2 = require("fs");
900
+ var import_fs3 = require("fs");
855
901
  function zarfYaml({ name: name2, image, config }, path) {
856
902
  const zarfCfg = {
857
903
  kind: "ZarfPackageConfig",
@@ -878,16 +924,16 @@ function zarfYaml({ name: name2, image, config }, path) {
878
924
  };
879
925
  return (0, import_client_node.dumpYaml)(zarfCfg, { noRefs: true });
880
926
  }
881
- async function allYaml(assets) {
927
+ async function allYaml(assets, rbacMode) {
882
928
  const { name: name2, tls, apiToken, path } = assets;
883
- const code = await import_fs2.promises.readFile(path);
929
+ const code = await import_fs3.promises.readFile(path);
884
930
  const hash = import_crypto2.default.createHash("sha256").update(code).digest("hex");
885
931
  const mutateWebhook = await webhookConfig(assets, "mutate");
886
932
  const validateWebhook = await webhookConfig(assets, "validate");
887
933
  const watchDeployment = watcher(assets, hash);
888
934
  const resources = [
889
935
  namespace,
890
- clusterRole(name2),
936
+ clusterRole(name2, assets.capabilities, rbacMode),
891
937
  clusterRoleBinding(name2),
892
938
  serviceAccount(name2),
893
939
  apiTokenSecret(name2, apiToken),
@@ -933,9 +979,9 @@ var Assets = class {
933
979
  await deploy(this, webhookTimeout);
934
980
  };
935
981
  zarfYaml = (path) => zarfYaml(this, path);
936
- allYaml = async () => {
982
+ allYaml = async (rbacMode) => {
937
983
  this.capabilities = await loadCapabilities(this.path);
938
- return allYaml(this);
984
+ return allYaml(this, rbacMode);
939
985
  };
940
986
  };
941
987
 
@@ -1145,8 +1191,8 @@ var hello_pepr_samples_default = [
1145
1191
  var gitIgnore = "# Ignore node_modules and Pepr build artifacts\nnode_modules\ndist\ninsecure*\n";
1146
1192
  var readmeMd = '# Pepr Module\n\nThis is a Pepr Module. [Pepr](https://github.com/defenseunicorns/pepr) is a type-safe Kubernetes middleware system.\n\nThe `capabilities` directory contains all the capabilities for this module. By default,\na capability is a single typescript file in the format of `capability-name.ts` that is\nimported in the root `pepr.ts` file as `import { HelloPepr } from "./capabilities/hello-pepr";`.\nBecause this is typescript, you can organize this however you choose, e.g. creating a sub-folder\nper-capability or common logic in shared files or folders.\n\nExample Structure:\n\n```\nModule Root\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pepr.ts\n\u2514\u2500\u2500 capabilities\n \u251C\u2500\u2500 example-one.ts\n \u251C\u2500\u2500 example-three.ts\n \u2514\u2500\u2500 example-two.ts\n```\n';
1147
1193
  var peprTS = 'import { PeprModule } from "pepr";\n// cfg loads your pepr configuration from package.json\nimport cfg from "./package.json";\n\n// HelloPepr is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\nimport { HelloPepr } from "./capabilities/hello-pepr";\n\n/**\n * This is the main entrypoint for this Pepr module. It is run when the module is started.\n * This is where you register your Pepr configurations and capabilities.\n */\nnew PeprModule(cfg, [\n // "HelloPepr" is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\n HelloPepr,\n\n // Your additional capabilities go here\n]);\n';
1148
- var helloPeprTS = 'import {\n Capability,\n K8s,\n Log,\n PeprMutateRequest,\n RegisterKind,\n a,\n fetch,\n fetchStatus,\n kind,\n} from "pepr";\n\n/**\n * The HelloPepr Capability is an example capability to demonstrate some general concepts of Pepr.\n * To test this capability you run `pepr dev`and then run the following command:\n * `kubectl apply -f capabilities/hello-pepr.samples.yaml`\n */\nexport const HelloPepr = new Capability({\n name: "hello-pepr",\n description: "A simple example capability to show how things work.",\n namespaces: ["pepr-demo", "pepr-demo-2"],\n});\n\n// Use the \'When\' function to create a new action, use \'Store\' to persist data\nconst { When, Store } = HelloPepr;\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action removes the label `remove-me` when a Namespace is created.\n * Note we don\'t need to specify the namespace here, because we\'ve already specified\n * it in the Capability definition above.\n */\nWhen(a.Namespace)\n .IsCreated()\n .Mutate(ns => ns.RemoveLabel("remove-me"));\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Watch Action with K8s SSA (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action watches for the `pepr-demo-2` namespace to be created, then creates a ConfigMap with\n * the name `pepr-ssa-demo` and adds the namespace UID to the ConfigMap data. Because Pepr uses\n * server-side apply for this operation, the ConfigMap will be created or updated if it already exists.\n */\nWhen(a.Namespace)\n .IsCreated()\n .WithName("pepr-demo-2")\n .Watch(async ns => {\n Log.info("Namespace pepr-demo-2 was created.");\n\n // You can share data between actions using the Store, including between different types of actions\n Store.setItem("watch-data", "This data was stored by a Watch Action.");\n\n // Apply the ConfigMap using K8s server-side apply\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: "pepr-ssa-demo",\n namespace: "pepr-demo-2",\n },\n data: {\n "ns-uid": ns.metadata.uid,\n },\n });\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 1) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is a single action. They can be in the same file or put imported from other files.\n * In this example, when a ConfigMap is created with the name `example-1`, then add a label and annotation.\n *\n * Equivalent to manually running:\n * `kubectl label configmap example-1 pepr=was-here`\n * `kubectl annotate configmap example-1 pepr.dev=annotations-work-too`\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request\n .SetLabel("pepr", "was-here")\n .SetAnnotation("pepr.dev", "annotations-work-too");\n\n // Use the Store to persist data between requests and Pepr controller pods\n Store.setItem("example-1", "was-here");\n\n // This data is written asynchronously and can be read back via `Store.getItem()` or `Store.subscribe()`\n Store.setItem("example-1-data", JSON.stringify(request.Raw.data));\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate & Validate Actions (CM Example 2) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This combines 3 different types of actions: \'Mutate\', \'Validate\', and \'Watch\'. The order\n * of the actions is required, but each action is optional. In this example, when a ConfigMap is created\n * with the name `example-2`, then add a label and annotation, validate that the ConfigMap has the label\n * `pepr`, and log the request.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n // This Mutate Action will mutate the request before it is persisted to the cluster\n\n // Use `request.Merge()` to merge the new data with the existing data\n request.Merge({\n metadata: {\n labels: {\n pepr: "was-here",\n },\n annotations: {\n "pepr.dev": "annotations-work-too",\n },\n },\n });\n })\n .Validate(request => {\n // This Validate Action will validate the request before it is persisted to the cluster\n\n // Approve the request if the ConfigMap has the label \'pepr\'\n if (request.HasLabel("pepr")) {\n return request.Approve();\n }\n\n // Otherwise, deny the request with an error message (optional)\n return request.Deny("ConfigMap must have label \'pepr\'");\n })\n .Watch((cm, phase) => {\n // This Watch Action will watch the ConfigMap after it has been persisted to the cluster\n Log.info(cm, `ConfigMap was ${phase} with the name example-2`);\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 2a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action shows a simple validation that will deny any ConfigMap that has the\n * annotation `evil`. Note that the `Deny()` function takes an optional second parameter that is a\n * user-defined status code to return.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .Validate(request => {\n if (request.HasAnnotation("evil")) {\n return request.Deny("No evil CM annotations allowed.", 400);\n }\n\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 3) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action combines different styles. Unlike the previous actions, this one will look\n * for any ConfigMap in the `pepr-demo` namespace that has the label `change=by-label` during either\n * CREATE or UPDATE. Note that all conditions added such as `WithName()`, `WithLabel()`, `InNamespace()`,\n * are ANDs so all conditions must be true for the request to be processed.\n */\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("change", "by-label")\n .Mutate(request => {\n // The K8s object e are going to mutate\n const cm = request.Raw;\n\n // Get the username and uid of the K8s request\n const { username, uid } = request.Request.userInfo;\n\n // Store some data about the request in the configmap\n cm.data["username"] = username;\n cm.data["uid"] = uid;\n\n // You can still mix other ways of making changes too\n request.SetAnnotation("pepr.dev", "making-waves");\n });\n\n// This action validates the label `change=by-label` is deleted\nWhen(a.ConfigMap)\n .IsDeleted()\n .WithLabel("change", "by-label")\n .Validate(request => {\n // Log and then always approve the request\n Log.info("CM with label \'change=by-label\' was deleted.");\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action show how you can use the `Mutate()` function without an inline function.\n * This is useful if you want to keep your actions small and focused on a single task,\n * or if you want to reuse the same function in multiple actions.\n */\nWhen(a.ConfigMap).IsCreated().WithName("example-4").Mutate(example4Cb);\n\n// This function uses the complete type definition, but is not required.\nfunction example4Cb(cm: PeprMutateRequest<a.ConfigMap>) {\n cm.SetLabel("pepr.dev/first", "true");\n cm.SetLabel("pepr.dev/second", "true");\n cm.SetLabel("pepr.dev/third", "true");\n}\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is the same as Example 4, except this only operates on a CM in the `pepr-demo-2` namespace.\n * Note because the Capability defines namespaces, the namespace specified here must be one of those.\n * Alternatively, you can remove the namespace from the Capability definition and specify it here.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .InNamespace("pepr-demo-2")\n .WithName("example-4a")\n .Mutate(example4Cb);\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 5) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action is a bit more complex. It will look for any ConfigMap in the `pepr-demo`\n * namespace that has the label `chuck-norris` during CREATE. When it finds one, it will fetch a\n * random Chuck Norris joke from the API and add it to the ConfigMap. This is a great example of how\n * you can use Pepr to make changes to your K8s objects based on external data.\n *\n * Note the use of the `async` keyword. This is required for any action that uses `await` or `fetch()`.\n *\n * Also note we are passing a type to the `fetch()` function. This is optional, but it will help you\n * avoid mistakes when working with the data returned from the API. You can also use the `as` keyword to\n * cast the data returned from the API.\n *\n * These are equivalent:\n * ```ts\n * const joke = await fetch<TheChuckNorrisJoke>("https://api.chucknorris.io/jokes/random?category=dev");\n * const joke = await fetch("https://api.chucknorris.io/jokes/random?category=dev") as TheChuckNorrisJoke;\n * ```\n *\n * Alternatively, you can drop the type completely:\n *\n * ```ts\n * fetch("https://api.chucknorris.io/jokes/random?category=dev")\n * ```\n */\ninterface TheChuckNorrisJoke {\n icon_url: string;\n id: string;\n url: string;\n value: string;\n}\n\nWhen(a.ConfigMap)\n .IsCreated()\n .WithLabel("chuck-norris")\n .Mutate(async change => {\n // Try/catch is not needed as a response object will always be returned\n const response = await fetch<TheChuckNorrisJoke>(\n "https://api.chucknorris.io/jokes/random?category=dev",\n );\n\n // Instead, check the `response.ok` field\n if (response.ok) {\n // Add the Chuck Norris joke to the configmap\n change.Raw.data["chuck-says"] = response.data.value;\n return;\n }\n\n // You can also assert on different HTTP response codes\n if (response.status === fetchStatus.NOT_FOUND) {\n // Do something else\n return;\n }\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Secret Base64 Handling) *\n * ---------------------------------------------------------------------------------------------------\n *\n * The K8s JS client provides incomplete support for base64 encoding/decoding handling for secrets,\n * unlike the GO client. To make this less painful, Pepr automatically handles base64 encoding/decoding\n * secret data before and after the action is executed.\n */\nWhen(a.Secret)\n .IsCreated()\n .WithName("secret-1")\n .Mutate(request => {\n const secret = request.Raw;\n\n // This will be encoded at the end of all processing back to base64: "Y2hhbmdlLXdpdGhvdXQtZW5jb2Rpbmc="\n secret.data.magic = "change-without-encoding";\n\n // You can modify the data directly, and it will be encoded at the end of all processing\n secret.data.example += " - modified by Pepr";\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Untyped Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * Out of the box, Pepr supports all the standard Kubernetes objects. However, you can also create\n * your own types. This is useful if you are working with an Operator that creates custom resources.\n * There are two ways to do this, the first is to use the `When()` function with a `GenericKind`,\n * the second is to create a new class that extends `GenericKind` and use the `RegisterKind()` function.\n *\n * This example shows how to use the `When()` function with a `GenericKind`. Note that you\n * must specify the `group`, `version`, and `kind` of the object (if applicable). This is how Pepr knows\n * if the action should be triggered or not. Since we are using a `GenericKind`,\n * Pepr will not be able to provide any intellisense for the object, so you will need to refer to the\n * Kubernetes API documentation for the object you are working with.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-1\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```\n */\nWhen(a.GenericKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n})\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr without type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Typed Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This example shows how to use the `RegisterKind()` function to create a new type. This is useful\n * if you are working with an Operator that creates custom resources and you want to have intellisense\n * for the object. Note that you must specify the `group`, `version`, and `kind` of the object (if applicable)\n * as this is how Pepr knows if the action should be triggered or not.\n *\n * Once you register a new Kind with Pepr, you can use the `When()` function with the new Kind. Ideally,\n * you should register custom Kinds at the top of your Capability file or Pepr Module so they are available\n * to all actions, but we are putting it here for demonstration purposes.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-2\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```*\n */\nclass UnicornKind extends a.GenericKind {\n spec: {\n /**\n * JSDoc comments can be added to explain more details about the field.\n *\n * @example\n * ```ts\n * request.Raw.spec.message = "Hello Pepr!";\n * ```\n * */\n message: string;\n counter: number;\n };\n}\n\nRegisterKind(UnicornKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n});\n\nWhen(UnicornKind)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr with type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * A callback function that is called once the Pepr Store is fully loaded.\n */\nStore.onReady(data => {\n Log.info(data, "Pepr Store Ready");\n});\n';
1149
- var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, version: "0.14.1", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", build: "tsc && node build.mjs", test: "npm run test:unit && npm run test:journey", "test:unit": "npm run gen-data-json && jest src --coverage", "test:journey": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0'", "test:journey:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:run": "jest journey/entrypoint.test.ts", "format:check": "eslint src && prettier src --check", "format:fix": "eslint src --fix && prettier src --write" }, dependencies: { express: "4.18.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "1.6.0", pino: "8.16.0", "pino-pretty": "10.2.3", "prom-client": "15.0.0", ramda: "0.29.1" }, devDependencies: { "@commitlint/cli": "17.7.2", "@commitlint/config-conventional": "17.7.0", "@jest/globals": "29.7.0", "@types/eslint": "8.44.4", "@types/express": "4.17.19", "@types/node": "18.x.x", "@types/node-forge": "1.3.7", "@types/prompts": "2.4.6", "@types/ramda": "0.29.6", "@types/uuid": "9.0.5", jest: "29.7.0", nock: "13.3.4", "ts-jest": "29.1.1" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.7.3", "@typescript-eslint/parser": "6.7.3", commander: "11.0.0", esbuild: "0.19.4", eslint: "8.50.0", "node-forge": "1.3.1", prettier: "3.0.3", prompts: "2.4.2", typescript: "5.2.2", uuid: "9.0.1" } };
1194
+ var helloPeprTS = 'import {\n Capability,\n K8s,\n Log,\n PeprMutateRequest,\n RegisterKind,\n a,\n fetch,\n fetchStatus,\n kind,\n} from "pepr";\n\n/**\n * The HelloPepr Capability is an example capability to demonstrate some general concepts of Pepr.\n * To test this capability you run `pepr dev`and then run the following command:\n * `kubectl apply -f capabilities/hello-pepr.samples.yaml`\n */\nexport const HelloPepr = new Capability({\n name: "hello-pepr",\n description: "A simple example capability to show how things work.",\n namespaces: ["pepr-demo", "pepr-demo-2"],\n});\n\n// Use the \'When\' function to create a new action, use \'Store\' to persist data\nconst { When, Store } = HelloPepr;\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action removes the label `remove-me` when a Namespace is created.\n * Note we don\'t need to specify the namespace here, because we\'ve already specified\n * it in the Capability definition above.\n */\nWhen(a.Namespace)\n .IsCreated()\n .Mutate(ns => ns.RemoveLabel("remove-me"));\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Watch Action with K8s SSA (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action watches for the `pepr-demo-2` namespace to be created, then creates a ConfigMap with\n * the name `pepr-ssa-demo` and adds the namespace UID to the ConfigMap data. Because Pepr uses\n * server-side apply for this operation, the ConfigMap will be created or updated if it already exists.\n */\nWhen(a.Namespace)\n .IsCreated()\n .WithName("pepr-demo-2")\n .Watch(async ns => {\n Log.info("Namespace pepr-demo-2 was created.");\n\n try {\n // Apply the ConfigMap using K8s server-side apply\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: "pepr-ssa-demo",\n namespace: "pepr-demo-2",\n },\n data: {\n "ns-uid": ns.metadata.uid,\n },\n });\n } catch (error) {\n // You can use the Log object to log messages to the Pepr controller pod\n Log.error(error, "Failed to apply ConfigMap using server-side apply.");\n }\n\n // You can share data between actions using the Store, including between different types of actions\n Store.setItem("watch-data", "This data was stored by a Watch Action.");\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 1) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is a single action. They can be in the same file or put imported from other files.\n * In this example, when a ConfigMap is created with the name `example-1`, then add a label and annotation.\n *\n * Equivalent to manually running:\n * `kubectl label configmap example-1 pepr=was-here`\n * `kubectl annotate configmap example-1 pepr.dev=annotations-work-too`\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request\n .SetLabel("pepr", "was-here")\n .SetAnnotation("pepr.dev", "annotations-work-too");\n\n // Use the Store to persist data between requests and Pepr controller pods\n Store.setItem("example-1", "was-here");\n\n // This data is written asynchronously and can be read back via `Store.getItem()` or `Store.subscribe()`\n Store.setItem("example-1-data", JSON.stringify(request.Raw.data));\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate & Validate Actions (CM Example 2) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This combines 3 different types of actions: \'Mutate\', \'Validate\', and \'Watch\'. The order\n * of the actions is required, but each action is optional. In this example, when a ConfigMap is created\n * with the name `example-2`, then add a label and annotation, validate that the ConfigMap has the label\n * `pepr`, and log the request.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n // This Mutate Action will mutate the request before it is persisted to the cluster\n\n // Use `request.Merge()` to merge the new data with the existing data\n request.Merge({\n metadata: {\n labels: {\n pepr: "was-here",\n },\n annotations: {\n "pepr.dev": "annotations-work-too",\n },\n },\n });\n })\n .Validate(request => {\n // This Validate Action will validate the request before it is persisted to the cluster\n\n // Approve the request if the ConfigMap has the label \'pepr\'\n if (request.HasLabel("pepr")) {\n return request.Approve();\n }\n\n // Otherwise, deny the request with an error message (optional)\n return request.Deny("ConfigMap must have label \'pepr\'");\n })\n .Watch((cm, phase) => {\n // This Watch Action will watch the ConfigMap after it has been persisted to the cluster\n Log.info(cm, `ConfigMap was ${phase} with the name example-2`);\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 2a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action shows a simple validation that will deny any ConfigMap that has the\n * annotation `evil`. Note that the `Deny()` function takes an optional second parameter that is a\n * user-defined status code to return.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .Validate(request => {\n if (request.HasAnnotation("evil")) {\n return request.Deny("No evil CM annotations allowed.", 400);\n }\n\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 3) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action combines different styles. Unlike the previous actions, this one will look\n * for any ConfigMap in the `pepr-demo` namespace that has the label `change=by-label` during either\n * CREATE or UPDATE. Note that all conditions added such as `WithName()`, `WithLabel()`, `InNamespace()`,\n * are ANDs so all conditions must be true for the request to be processed.\n */\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("change", "by-label")\n .Mutate(request => {\n // The K8s object e are going to mutate\n const cm = request.Raw;\n\n // Get the username and uid of the K8s request\n const { username, uid } = request.Request.userInfo;\n\n // Store some data about the request in the configmap\n cm.data["username"] = username;\n cm.data["uid"] = uid;\n\n // You can still mix other ways of making changes too\n request.SetAnnotation("pepr.dev", "making-waves");\n });\n\n// This action validates the label `change=by-label` is deleted\nWhen(a.ConfigMap)\n .IsDeleted()\n .WithLabel("change", "by-label")\n .Validate(request => {\n // Log and then always approve the request\n Log.info("CM with label \'change=by-label\' was deleted.");\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action show how you can use the `Mutate()` function without an inline function.\n * This is useful if you want to keep your actions small and focused on a single task,\n * or if you want to reuse the same function in multiple actions.\n */\nWhen(a.ConfigMap).IsCreated().WithName("example-4").Mutate(example4Cb);\n\n// This function uses the complete type definition, but is not required.\nfunction example4Cb(cm: PeprMutateRequest<a.ConfigMap>) {\n cm.SetLabel("pepr.dev/first", "true");\n cm.SetLabel("pepr.dev/second", "true");\n cm.SetLabel("pepr.dev/third", "true");\n}\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is the same as Example 4, except this only operates on a CM in the `pepr-demo-2` namespace.\n * Note because the Capability defines namespaces, the namespace specified here must be one of those.\n * Alternatively, you can remove the namespace from the Capability definition and specify it here.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .InNamespace("pepr-demo-2")\n .WithName("example-4a")\n .Mutate(example4Cb);\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 5) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action is a bit more complex. It will look for any ConfigMap in the `pepr-demo`\n * namespace that has the label `chuck-norris` during CREATE. When it finds one, it will fetch a\n * random Chuck Norris joke from the API and add it to the ConfigMap. This is a great example of how\n * you can use Pepr to make changes to your K8s objects based on external data.\n *\n * Note the use of the `async` keyword. This is required for any action that uses `await` or `fetch()`.\n *\n * Also note we are passing a type to the `fetch()` function. This is optional, but it will help you\n * avoid mistakes when working with the data returned from the API. You can also use the `as` keyword to\n * cast the data returned from the API.\n *\n * These are equivalent:\n * ```ts\n * const joke = await fetch<TheChuckNorrisJoke>("https://api.chucknorris.io/jokes/random?category=dev");\n * const joke = await fetch("https://api.chucknorris.io/jokes/random?category=dev") as TheChuckNorrisJoke;\n * ```\n *\n * Alternatively, you can drop the type completely:\n *\n * ```ts\n * fetch("https://api.chucknorris.io/jokes/random?category=dev")\n * ```\n */\ninterface TheChuckNorrisJoke {\n icon_url: string;\n id: string;\n url: string;\n value: string;\n}\n\nWhen(a.ConfigMap)\n .IsCreated()\n .WithLabel("chuck-norris")\n .Mutate(async change => {\n // Try/catch is not needed as a response object will always be returned\n const response = await fetch<TheChuckNorrisJoke>(\n "https://api.chucknorris.io/jokes/random?category=dev",\n );\n\n // Instead, check the `response.ok` field\n if (response.ok) {\n // Add the Chuck Norris joke to the configmap\n change.Raw.data["chuck-says"] = response.data.value;\n return;\n }\n\n // You can also assert on different HTTP response codes\n if (response.status === fetchStatus.NOT_FOUND) {\n // Do something else\n return;\n }\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Secret Base64 Handling) *\n * ---------------------------------------------------------------------------------------------------\n *\n * The K8s JS client provides incomplete support for base64 encoding/decoding handling for secrets,\n * unlike the GO client. To make this less painful, Pepr automatically handles base64 encoding/decoding\n * secret data before and after the action is executed.\n */\nWhen(a.Secret)\n .IsCreated()\n .WithName("secret-1")\n .Mutate(request => {\n const secret = request.Raw;\n\n // This will be encoded at the end of all processing back to base64: "Y2hhbmdlLXdpdGhvdXQtZW5jb2Rpbmc="\n secret.data.magic = "change-without-encoding";\n\n // You can modify the data directly, and it will be encoded at the end of all processing\n secret.data.example += " - modified by Pepr";\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Untyped Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * Out of the box, Pepr supports all the standard Kubernetes objects. However, you can also create\n * your own types. This is useful if you are working with an Operator that creates custom resources.\n * There are two ways to do this, the first is to use the `When()` function with a `GenericKind`,\n * the second is to create a new class that extends `GenericKind` and use the `RegisterKind()` function.\n *\n * This example shows how to use the `When()` function with a `GenericKind`. Note that you\n * must specify the `group`, `version`, and `kind` of the object (if applicable). This is how Pepr knows\n * if the action should be triggered or not. Since we are using a `GenericKind`,\n * Pepr will not be able to provide any intellisense for the object, so you will need to refer to the\n * Kubernetes API documentation for the object you are working with.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-1\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```\n */\nWhen(a.GenericKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n})\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr without type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Typed Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This example shows how to use the `RegisterKind()` function to create a new type. This is useful\n * if you are working with an Operator that creates custom resources and you want to have intellisense\n * for the object. Note that you must specify the `group`, `version`, and `kind` of the object (if applicable)\n * as this is how Pepr knows if the action should be triggered or not.\n *\n * Once you register a new Kind with Pepr, you can use the `When()` function with the new Kind. Ideally,\n * you should register custom Kinds at the top of your Capability file or Pepr Module so they are available\n * to all actions, but we are putting it here for demonstration purposes.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-2\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```*\n */\nclass UnicornKind extends a.GenericKind {\n spec: {\n /**\n * JSDoc comments can be added to explain more details about the field.\n *\n * @example\n * ```ts\n * request.Raw.spec.message = "Hello Pepr!";\n * ```\n * */\n message: string;\n counter: number;\n };\n}\n\nRegisterKind(UnicornKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n});\n\nWhen(UnicornKind)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr with type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * A callback function that is called once the Pepr Store is fully loaded.\n */\nStore.onReady(data => {\n Log.info(data, "Pepr Store Ready");\n});\n';
1195
+ var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, version: "0.15.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", build: "tsc && node build.mjs", test: "npm run test:unit && npm run test:journey", "test:unit": "npm run gen-data-json && jest src --coverage", "test:journey": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run", "test:journey-wasm": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run-wasm", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "test:journey:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts", "test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts", "format:check": "eslint src && prettier src --check", "format:fix": "eslint src --fix && prettier src --write" }, dependencies: { express: "4.18.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "1.8.0", pino: "8.16.1", "pino-pretty": "10.2.3", "prom-client": "15.0.0", ramda: "0.29.1" }, devDependencies: { "@commitlint/cli": "18.2.0", "@commitlint/config-conventional": "18.1.0", "@jest/globals": "29.7.0", "@types/eslint": "8.44.6", "@types/express": "4.17.20", "@types/node": "18.x.x", "@types/node-forge": "1.3.8", "@types/prompts": "2.4.7", "@types/ramda": "0.29.7", "@types/uuid": "9.0.6", jest: "29.7.0", nock: "13.3.6", "ts-jest": "29.1.1" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.7.3", "@typescript-eslint/parser": "6.7.3", commander: "11.0.0", esbuild: "0.19.4", eslint: "8.50.0", "node-forge": "1.3.1", prettier: "3.0.3", prompts: "2.4.2", typescript: "5.2.2", uuid: "9.0.1" } };
1150
1196
 
1151
1197
  // src/templates/pepr.code-snippets.json
1152
1198
  var pepr_code_snippets_default = {
@@ -1204,7 +1250,7 @@ var tsconfig_module_default = {
1204
1250
  };
1205
1251
 
1206
1252
  // src/cli/init/utils.ts
1207
- var import_fs3 = require("fs");
1253
+ var import_fs4 = require("fs");
1208
1254
  function sanitizeName(name2) {
1209
1255
  let sanitized = name2.toLowerCase().replace(/[^a-z0-9-]+/gi, "-");
1210
1256
  sanitized = sanitized.replace(/^-+|-+$/g, "");
@@ -1213,7 +1259,7 @@ function sanitizeName(name2) {
1213
1259
  }
1214
1260
  async function createDir(dir) {
1215
1261
  try {
1216
- await import_fs3.promises.mkdir(dir);
1262
+ await import_fs4.promises.mkdir(dir);
1217
1263
  } catch (err) {
1218
1264
  if (err && err.code === "EEXIST") {
1219
1265
  throw new Error(`Directory ${dir} already exists`);
@@ -1226,7 +1272,7 @@ function write(path, data) {
1226
1272
  if (typeof data !== "string") {
1227
1273
  data = JSON.stringify(data, null, 2);
1228
1274
  }
1229
- return import_fs3.promises.writeFile(path, data);
1275
+ return import_fs4.promises.writeFile(path, data);
1230
1276
  }
1231
1277
 
1232
1278
  // src/cli/init/templates.ts
@@ -1250,7 +1296,8 @@ function genPkgJSON(opts, pgkVerOverride) {
1250
1296
  alwaysIgnore: {
1251
1297
  namespaces: [],
1252
1298
  labels: []
1253
- }
1299
+ },
1300
+ includedFiles: []
1254
1301
  },
1255
1302
  scripts: {
1256
1303
  "k3d-setup": scripts["test:journey:k3d"]
@@ -1313,7 +1360,7 @@ var eslint = {
1313
1360
 
1314
1361
  // src/cli/format.ts
1315
1362
  var import_eslint = require("eslint");
1316
- var import_fs4 = require("fs");
1363
+ var import_fs5 = require("fs");
1317
1364
  var import_prettier = require("prettier");
1318
1365
  function format_default(program2) {
1319
1366
  program2.command("format").description("Lint and format this Pepr module").option("-v, --validate-only", "Do not modify files, only validate formatting").action(async (opts) => {
@@ -1346,7 +1393,7 @@ async function peprFormat(validateOnly) {
1346
1393
  await import_eslint.ESLint.outputFixes(results);
1347
1394
  }
1348
1395
  for (const { filePath } of results) {
1349
- const content = await import_fs4.promises.readFile(filePath, "utf8");
1396
+ const content = await import_fs5.promises.readFile(filePath, "utf8");
1350
1397
  const cfg = await (0, import_prettier.resolveConfig)(filePath);
1351
1398
  const formatted = await (0, import_prettier.format)(content, { filepath: filePath, ...cfg });
1352
1399
  if (validateOnly) {
@@ -1355,7 +1402,7 @@ async function peprFormat(validateOnly) {
1355
1402
  console.error(`File ${filePath} is not formatted correctly`);
1356
1403
  }
1357
1404
  } else {
1358
- await import_fs4.promises.writeFile(filePath, formatted);
1405
+ await import_fs5.promises.writeFile(filePath, formatted);
1359
1406
  }
1360
1407
  }
1361
1408
  return !hasFailure;
@@ -1367,14 +1414,31 @@ async function peprFormat(validateOnly) {
1367
1414
  }
1368
1415
 
1369
1416
  // src/cli/build.ts
1417
+ var import_commander = require("commander");
1370
1418
  var peprTS2 = "pepr.ts";
1371
1419
  function build_default(program2) {
1372
1420
  program2.command("build").description("Build a Pepr Module for deployment").option(
1373
1421
  "-e, --entry-point [file]",
1374
1422
  "Specify the entry point file to build with. Note that changing this disables embedding of NPM packages.",
1375
1423
  peprTS2
1424
+ ).option(
1425
+ "-r, --registry-info [<registry>/<username>]",
1426
+ "Registry Info: Image registry and username. Note: You must be signed into the registry"
1427
+ ).addOption(
1428
+ new import_commander.Option("--rbac-mode [admin|scoped]", "Rbac Mode: admin, scoped (default: admin)").choices(["admin", "scoped"]).default("admin")
1376
1429
  ).action(async (opts) => {
1377
1430
  const { cfg, path, uuid } = await buildModule(void 0, opts.entryPoint);
1431
+ const { includedFiles } = cfg.pepr;
1432
+ let image = "";
1433
+ if (opts.registryInfo !== void 0) {
1434
+ console.info(`Including ${includedFiles.length} files in controller image.`);
1435
+ image = `${opts.registryInfo}/custom-pepr-controller:${cfg.dependencies.pepr}`;
1436
+ if (includedFiles.length > 0) {
1437
+ await createDockerfile(cfg.dependencies.pepr, cfg.description, includedFiles);
1438
+ (0, import_child_process2.execSync)(`docker build --tag ${image} -f Dockerfile.controller .`, { stdio: "inherit" });
1439
+ (0, import_child_process2.execSync)(`docker push ${image}`, { stdio: "inherit" });
1440
+ }
1441
+ }
1378
1442
  if (opts.entryPoint !== peprTS2) {
1379
1443
  console.info(`\u2705 Module built successfully at ${path}`);
1380
1444
  return;
@@ -1387,13 +1451,16 @@ function build_default(program2) {
1387
1451
  },
1388
1452
  path
1389
1453
  );
1454
+ if (image !== "") {
1455
+ assets.image = image;
1456
+ }
1390
1457
  const yamlFile = `pepr-module-${uuid}.yaml`;
1391
1458
  const yamlPath = (0, import_path.resolve)("dist", yamlFile);
1392
- const yaml = await assets.allYaml();
1459
+ const yaml = await assets.allYaml(opts.rbacMode);
1393
1460
  const zarfPath = (0, import_path.resolve)("dist", "zarf.yaml");
1394
1461
  const zarf = assets.zarfYaml(yamlFile);
1395
- await import_fs5.promises.writeFile(yamlPath, yaml);
1396
- await import_fs5.promises.writeFile(zarfPath, zarf);
1462
+ await import_fs6.promises.writeFile(yamlPath, yaml);
1463
+ await import_fs6.promises.writeFile(zarfPath, zarf);
1397
1464
  console.info(`\u2705 K8s resource for the module saved to ${yamlPath}`);
1398
1465
  });
1399
1466
  }
@@ -1404,15 +1471,15 @@ async function loadModule(entryPoint = peprTS2) {
1404
1471
  const cfgPath = (0, import_path.resolve)(".", "package.json");
1405
1472
  const input = (0, import_path.resolve)(".", entryPoint);
1406
1473
  try {
1407
- await import_fs5.promises.access(cfgPath);
1408
- await import_fs5.promises.access(input);
1474
+ await import_fs6.promises.access(cfgPath);
1475
+ await import_fs6.promises.access(input);
1409
1476
  } catch (e) {
1410
1477
  console.error(
1411
1478
  `Could not find ${cfgPath} or ${input} in the current directory. Please run this command from the root of your module's directory.`
1412
1479
  );
1413
1480
  process.exit(1);
1414
1481
  }
1415
- const moduleText = await import_fs5.promises.readFile(cfgPath, { encoding: "utf-8" });
1482
+ const moduleText = await import_fs6.promises.readFile(cfgPath, { encoding: "utf-8" });
1416
1483
  const cfg = JSON.parse(moduleText);
1417
1484
  const { uuid } = cfg.pepr;
1418
1485
  const name2 = `pepr-${uuid}.js`;
@@ -1555,7 +1622,7 @@ function deploy_default(program2) {
1555
1622
 
1556
1623
  // src/cli/dev.ts
1557
1624
  var import_child_process3 = require("child_process");
1558
- var import_fs6 = require("fs");
1625
+ var import_fs7 = require("fs");
1559
1626
  var import_prompts2 = __toESM(require("prompts"));
1560
1627
  function dev_default(program2) {
1561
1628
  program2.command("dev").description("Setup a local webhook development environment").option("-h, --host [host]", "Host to listen on", "host.k3d.internal").option("--confirm", "Skip confirmation prompt").action(async (opts) => {
@@ -1578,8 +1645,8 @@ function dev_default(program2) {
1578
1645
  path,
1579
1646
  opts.host
1580
1647
  );
1581
- await import_fs6.promises.writeFile("insecure-tls.crt", webhook.tls.pem.crt);
1582
- await import_fs6.promises.writeFile("insecure-tls.key", webhook.tls.pem.key);
1648
+ await import_fs7.promises.writeFile("insecure-tls.crt", webhook.tls.pem.crt);
1649
+ await import_fs7.promises.writeFile("insecure-tls.key", webhook.tls.pem.key);
1583
1650
  try {
1584
1651
  let program3;
1585
1652
  const runFork = async () => {
@@ -1623,7 +1690,7 @@ var import_path2 = require("path");
1623
1690
  var import_prompts4 = __toESM(require("prompts"));
1624
1691
 
1625
1692
  // src/cli/init/walkthrough.ts
1626
- var import_fs7 = require("fs");
1693
+ var import_fs8 = require("fs");
1627
1694
  var import_prompts3 = __toESM(require("prompts"));
1628
1695
 
1629
1696
  // src/lib/errors.ts
@@ -1643,7 +1710,7 @@ function walkthrough() {
1643
1710
  validate: async (val) => {
1644
1711
  try {
1645
1712
  const name2 = sanitizeName(val);
1646
- await import_fs7.promises.access(name2, import_fs7.promises.constants.F_OK);
1713
+ await import_fs8.promises.access(name2, import_fs8.promises.constants.F_OK);
1647
1714
  return "A directory with this name already exists";
1648
1715
  } catch (e) {
1649
1716
  return val.length > 2 || "The name must be at least 3 characters long";
@@ -1763,11 +1830,11 @@ function init_default(program2) {
1763
1830
  }
1764
1831
 
1765
1832
  // src/cli/root.ts
1766
- var import_commander = require("commander");
1767
- var RootCmd = class extends import_commander.Command {
1833
+ var import_commander2 = require("commander");
1834
+ var RootCmd = class extends import_commander2.Command {
1768
1835
  // eslint-disable-next-line class-methods-use-this
1769
1836
  createCommand(name2) {
1770
- const cmd = new import_commander.Command(name2);
1837
+ const cmd = new import_commander2.Command(name2);
1771
1838
  cmd.option("-l, --log-level [level]", "Log level: debug, info, warn, error", "info");
1772
1839
  cmd.hook("preAction", (run) => {
1773
1840
  logger_default.level = run.opts().logLevel;
@@ -1778,7 +1845,7 @@ var RootCmd = class extends import_commander.Command {
1778
1845
 
1779
1846
  // src/cli/update.ts
1780
1847
  var import_child_process5 = require("child_process");
1781
- var import_fs8 = __toESM(require("fs"));
1848
+ var import_fs9 = __toESM(require("fs"));
1782
1849
  var import_path3 = require("path");
1783
1850
  var import_prompts5 = __toESM(require("prompts"));
1784
1851
  function update_default(program2) {
@@ -1818,12 +1885,12 @@ function update_default(program2) {
1818
1885
  await write((0, import_path3.resolve)(".vscode", snippet.path), snippet.data);
1819
1886
  await write((0, import_path3.resolve)(".vscode", codeSettings.path), codeSettings.data);
1820
1887
  const samplePath = (0, import_path3.resolve)("capabilities", samplesYaml.path);
1821
- if (import_fs8.default.existsSync(samplePath)) {
1822
- import_fs8.default.unlinkSync(samplePath);
1888
+ if (import_fs9.default.existsSync(samplePath)) {
1889
+ import_fs9.default.unlinkSync(samplePath);
1823
1890
  await write(samplePath, samplesYaml.data);
1824
1891
  }
1825
1892
  const tsPath = (0, import_path3.resolve)("capabilities", helloPepr.path);
1826
- if (import_fs8.default.existsSync(tsPath)) {
1893
+ if (import_fs9.default.existsSync(tsPath)) {
1827
1894
  await write(tsPath, helloPepr.data);
1828
1895
  }
1829
1896
  }
@@ -48,7 +48,7 @@ if (process.env.LOG_LEVEL) {
48
48
  var logger_default = Log;
49
49
 
50
50
  // src/templates/data.json
51
- var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, version: "0.14.1", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", build: "tsc && node build.mjs", test: "npm run test:unit && npm run test:journey", "test:unit": "npm run gen-data-json && jest src --coverage", "test:journey": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0'", "test:journey:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:run": "jest journey/entrypoint.test.ts", "format:check": "eslint src && prettier src --check", "format:fix": "eslint src --fix && prettier src --write" }, dependencies: { express: "4.18.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "1.6.0", pino: "8.16.0", "pino-pretty": "10.2.3", "prom-client": "15.0.0", ramda: "0.29.1" }, devDependencies: { "@commitlint/cli": "17.7.2", "@commitlint/config-conventional": "17.7.0", "@jest/globals": "29.7.0", "@types/eslint": "8.44.4", "@types/express": "4.17.19", "@types/node": "18.x.x", "@types/node-forge": "1.3.7", "@types/prompts": "2.4.6", "@types/ramda": "0.29.6", "@types/uuid": "9.0.5", jest: "29.7.0", nock: "13.3.4", "ts-jest": "29.1.1" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.7.3", "@typescript-eslint/parser": "6.7.3", commander: "11.0.0", esbuild: "0.19.4", eslint: "8.50.0", "node-forge": "1.3.1", prettier: "3.0.3", prompts: "2.4.2", typescript: "5.2.2", uuid: "9.0.1" } };
51
+ var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, version: "0.15.0", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", build: "tsc && node build.mjs", test: "npm run test:unit && npm run test:journey", "test:unit": "npm run gen-data-json && jest src --coverage", "test:journey": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run", "test:journey-wasm": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run-wasm", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "test:journey:build": "npm run build && npm pack", "test:journey:image": "docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts", "test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts", "format:check": "eslint src && prettier src --check", "format:fix": "eslint src --fix && prettier src --write" }, dependencies: { express: "4.18.2", "fast-json-patch": "3.1.1", "kubernetes-fluent-client": "1.8.0", pino: "8.16.1", "pino-pretty": "10.2.3", "prom-client": "15.0.0", ramda: "0.29.1" }, devDependencies: { "@commitlint/cli": "18.2.0", "@commitlint/config-conventional": "18.1.0", "@jest/globals": "29.7.0", "@types/eslint": "8.44.6", "@types/express": "4.17.20", "@types/node": "18.x.x", "@types/node-forge": "1.3.8", "@types/prompts": "2.4.7", "@types/ramda": "0.29.7", "@types/uuid": "9.0.6", jest: "29.7.0", nock: "13.3.6", "ts-jest": "29.1.1" }, peerDependencies: { "@typescript-eslint/eslint-plugin": "6.7.3", "@typescript-eslint/parser": "6.7.3", commander: "11.0.0", esbuild: "0.19.4", eslint: "8.50.0", "node-forge": "1.3.1", prettier: "3.0.3", prompts: "2.4.2", typescript: "5.2.2", uuid: "9.0.1" } };
52
52
 
53
53
  // src/runtime/controller.ts
54
54
  var { version } = packageJSON;
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/deploy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAQ3B,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,iBA8CnE"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/deploy.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAS3B,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,iBA8CnE"}
@@ -13,6 +13,6 @@ export declare class Assets {
13
13
  constructor(config: ModuleConfig, path: string, host?: string | undefined);
14
14
  deploy: (webhookTimeout?: number) => Promise<void>;
15
15
  zarfYaml: (path: string) => string;
16
- allYaml: () => Promise<string>;
16
+ allYaml: (rbacMode: string) => Promise<string>;
17
17
  }
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C,qBAAa,MAAM;IAQf,QAAQ,CAAC,MAAM,EAAE,YAAY;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,CAAC;IAThB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAG,gBAAgB,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;gBAGH,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,oBAAQ;IAaxB,MAAM,oBAA2B,MAAM,mBAGrC;IAEF,QAAQ,SAAU,MAAM,YAA0B;IAElD,OAAO,wBAGL;CACH"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C,qBAAa,MAAM;IAQf,QAAQ,CAAC,MAAM,EAAE,YAAY;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,IAAI,CAAC;IAThB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAG,gBAAgB,EAAE,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;gBAGH,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,oBAAQ;IAaxB,MAAM,oBAA2B,MAAM,mBAGrC;IAEF,QAAQ,SAAU,MAAM,YAA0B;IAElD,OAAO,aAAoB,MAAM,qBAG/B;CACH"}
@@ -1,11 +1,12 @@
1
1
  import { kind } from "kubernetes-fluent-client";
2
+ import { CapabilityExport } from "../types";
2
3
  /**
3
4
  * Grants the controller access to cluster resources beyond the mutating webhook.
4
5
  *
5
6
  * @todo: should dynamically generate this based on resources used by the module. will also need to explore how this should work for multiple modules.
6
7
  * @returns
7
8
  */
8
- export declare function clusterRole(name: string): kind.ClusterRole;
9
+ export declare function clusterRole(name: string, capabilities: CapabilityExport[], rbacMode?: string): kind.ClusterRole;
9
10
  export declare function clusterRoleBinding(name: string): kind.ClusterRoleBinding;
10
11
  export declare function serviceAccount(name: string): kind.ServiceAccount;
11
12
  export declare function storeRole(name: string): kind.Role;
@@ -1 +1 @@
1
- {"version":3,"file":"rbac.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/rbac.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAEhD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,WAAW,CAc1D;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAkBxE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,cAAc,CAShE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,IAAI,CAejD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,WAAW,CAmB/D"}
1
+ {"version":3,"file":"rbac.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/rbac.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,EAAE,QAAQ,GAAE,MAAW,GAAG,IAAI,CAAC,WAAW,CA6BnH;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAkBxE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,cAAc,CAShE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,IAAI,CAejD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,WAAW,CAmB/D"}
@@ -1,4 +1,4 @@
1
1
  import { Assets } from ".";
2
2
  export declare function zarfYaml({ name, image, config }: Assets, path: string): string;
3
- export declare function allYaml(assets: Assets): Promise<string>;
3
+ export declare function allYaml(assets: Assets, rbacMode: string): Promise<string>;
4
4
  //# sourceMappingURL=yaml.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/yaml.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAO3B,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UA0BrE;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,mBA0C3C"}
1
+ {"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../../src/lib/assets/yaml.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAO3B,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UA0BrE;AAED,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,mBA0C7D"}
@@ -0,0 +1,11 @@
1
+ import { CapabilityExport } from "./types";
2
+ type RBACMap = {
3
+ [key: string]: {
4
+ verbs: string[];
5
+ plural: string;
6
+ };
7
+ };
8
+ export declare const addVerbIfNotExists: (verbs: string[], verb: string) => void;
9
+ export declare const createRBACMap: (capabilities: CapabilityExport[]) => RBACMap;
10
+ export {};
11
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/lib/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,KAAK,OAAO,GAAG;IACb,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,kBAAkB,UAAW,MAAM,EAAE,QAAQ,MAAM,SAI/D,CAAC;AAEF,eAAO,MAAM,aAAa,iBAAkB,gBAAgB,EAAE,KAAG,OAoBhE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function createDockerfile(version: string, description: string, includedFiles: string[]): Promise<void>;
2
+ //# sourceMappingURL=included-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"included-files.d.ts","sourceRoot":"","sources":["../../src/lib/included-files.ts"],"names":[],"mappings":"AAKA,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,iBAanG"}
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "engines": {
10
10
  "node": ">=18.0.0"
11
11
  },
12
- "version": "0.14.1",
12
+ "version": "0.15.0",
13
13
  "main": "dist/lib.js",
14
14
  "types": "dist/lib.d.ts",
15
15
  "scripts": {
@@ -19,35 +19,37 @@
19
19
  "test": "npm run test:unit && npm run test:journey",
20
20
  "test:unit": "npm run gen-data-json && jest src --coverage",
21
21
  "test:journey": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run",
22
- "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0'",
22
+ "test:journey-wasm": "npm run test:journey:k3d && npm run test:journey:build && npm run test:journey:image && npm run test:journey:run-wasm",
23
+ "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system",
23
24
  "test:journey:build": "npm run build && npm pack",
24
25
  "test:journey:image": "docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
25
- "test:journey:run": "jest journey/entrypoint.test.ts",
26
+ "test:journey:run": "jest --detectOpenHandles journey/entrypoint.test.ts",
27
+ "test:journey:run-wasm": "jest --detectOpenHandles journey/entrypoint-wasm.test.ts",
26
28
  "format:check": "eslint src && prettier src --check",
27
29
  "format:fix": "eslint src --fix && prettier src --write"
28
30
  },
29
31
  "dependencies": {
30
32
  "express": "4.18.2",
31
33
  "fast-json-patch": "3.1.1",
32
- "kubernetes-fluent-client": "1.6.0",
33
- "pino": "8.16.0",
34
+ "kubernetes-fluent-client": "1.8.0",
35
+ "pino": "8.16.1",
34
36
  "pino-pretty": "10.2.3",
35
37
  "prom-client": "15.0.0",
36
38
  "ramda": "0.29.1"
37
39
  },
38
40
  "devDependencies": {
39
- "@commitlint/cli": "17.7.2",
40
- "@commitlint/config-conventional": "17.7.0",
41
+ "@commitlint/cli": "18.2.0",
42
+ "@commitlint/config-conventional": "18.1.0",
41
43
  "@jest/globals": "29.7.0",
42
- "@types/eslint": "8.44.4",
43
- "@types/express": "4.17.19",
44
+ "@types/eslint": "8.44.6",
45
+ "@types/express": "4.17.20",
44
46
  "@types/node": "18.x.x",
45
- "@types/node-forge": "1.3.7",
46
- "@types/prompts": "2.4.6",
47
- "@types/ramda": "0.29.6",
48
- "@types/uuid": "9.0.5",
47
+ "@types/node-forge": "1.3.8",
48
+ "@types/prompts": "2.4.7",
49
+ "@types/ramda": "0.29.7",
50
+ "@types/uuid": "9.0.6",
49
51
  "jest": "29.7.0",
50
- "nock": "13.3.4",
52
+ "nock": "13.3.6",
51
53
  "ts-jest": "29.1.1"
52
54
  },
53
55
  "peerDependencies": {