pepr 0.1.27 → 0.1.29

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/cli.ts +3 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +4 -0
  4. package/dist/index.d.ts +5 -0
  5. package/dist/index.js +14 -0
  6. package/dist/package.json +76 -0
  7. package/dist/src/cli/banner.d.ts +1 -0
  8. package/dist/{pepr-cli.js → src/cli/banner.js} +4 -1251
  9. package/dist/src/cli/build.d.ts +7 -0
  10. package/dist/src/cli/build.js +102 -0
  11. package/dist/src/cli/capability.d.ts +2 -0
  12. package/dist/src/cli/capability.js +15 -0
  13. package/dist/src/cli/deploy.d.ts +2 -0
  14. package/dist/src/cli/deploy.js +55 -0
  15. package/dist/src/cli/dev.d.ts +2 -0
  16. package/dist/src/cli/dev.js +96 -0
  17. package/dist/src/cli/index.d.ts +1 -0
  18. package/dist/src/cli/index.js +33 -0
  19. package/dist/src/cli/init/index.d.ts +2 -0
  20. package/dist/src/cli/init/index.js +54 -0
  21. package/dist/src/cli/init/templates.d.ts +82 -0
  22. package/dist/src/cli/init/templates.js +229 -0
  23. package/dist/src/cli/init/utils.d.ts +20 -0
  24. package/dist/src/cli/init/utils.js +56 -0
  25. package/dist/src/cli/init/walkthrough.d.ts +7 -0
  26. package/dist/src/cli/init/walkthrough.js +84 -0
  27. package/dist/src/cli/root.d.ts +4 -0
  28. package/dist/src/cli/root.js +21 -0
  29. package/dist/src/cli/test.d.ts +2 -0
  30. package/dist/src/cli/test.js +51 -0
  31. package/dist/src/lib/capability.d.ts +26 -0
  32. package/dist/src/lib/capability.js +119 -0
  33. package/dist/src/lib/controller.d.ts +13 -0
  34. package/dist/src/lib/controller.js +84 -0
  35. package/dist/src/lib/filter.d.ts +10 -0
  36. package/dist/src/lib/filter.js +48 -0
  37. package/dist/src/lib/k8s/index.d.ts +4 -0
  38. package/dist/src/lib/k8s/index.js +38 -0
  39. package/dist/src/lib/k8s/kinds.d.ts +3 -0
  40. package/dist/src/lib/k8s/kinds.js +431 -0
  41. package/dist/src/lib/k8s/tls.d.ts +17 -0
  42. package/dist/src/lib/k8s/tls.js +74 -0
  43. package/dist/src/lib/k8s/types.d.ts +136 -0
  44. package/dist/src/lib/k8s/types.js +12 -0
  45. package/dist/src/lib/k8s/upstream.d.ts +1 -0
  46. package/dist/src/lib/k8s/upstream.js +47 -0
  47. package/dist/src/lib/k8s/webhook.d.ts +33 -0
  48. package/dist/src/lib/k8s/webhook.js +497 -0
  49. package/dist/src/lib/logger.d.ts +54 -0
  50. package/dist/{types-1709b44f.js → src/lib/logger.js} +6 -39
  51. package/dist/src/lib/module.d.ts +22 -0
  52. package/dist/src/lib/module.js +39 -0
  53. package/dist/src/lib/processor.d.ts +4 -0
  54. package/dist/src/lib/processor.js +73 -0
  55. package/dist/src/lib/request.d.ts +77 -0
  56. package/dist/src/lib/request.js +144 -0
  57. package/dist/src/lib/types.d.ts +187 -0
  58. package/dist/src/lib/types.js +34 -0
  59. package/package.json +8 -11
  60. package/tsconfig.build.json +4 -0
  61. package/dist/pepr-core.js +0 -949
  62. package/tsconfig.json +0 -17
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.processor = void 0;
9
+ const fast_json_patch_1 = require("fast-json-patch");
10
+ const filter_1 = require("./filter");
11
+ const logger_1 = __importDefault(require("./logger"));
12
+ const request_1 = require("./request");
13
+ function processor(config, capabilities, req) {
14
+ const wrapped = new request_1.RequestWrapper(req);
15
+ const response = {
16
+ uid: req.uid,
17
+ patchType: "JSONPatch",
18
+ warnings: [],
19
+ allowed: false,
20
+ };
21
+ logger_1.default.info(`Processing '${req.uid}' for '${req.kind.kind}' '${req.name}'`);
22
+ for (const { name, bindings } of capabilities) {
23
+ const prefix = `${req.uid} ${req.name}: ${name}`;
24
+ logger_1.default.info(`Processing capability ${name}`, prefix);
25
+ for (const action of bindings) {
26
+ // Continue to the next action without doing anything if this one should be skipped
27
+ if ((0, filter_1.shouldSkipRequest)(action, req)) {
28
+ continue;
29
+ }
30
+ logger_1.default.info(`Processing matched action ${action.kind.kind}`, prefix);
31
+ // Add annotations to the request to indicate that the capability started processing
32
+ // this will allow tracking of failed mutations that were permitted to continue
33
+ const { metadata } = wrapped.Raw;
34
+ const identifier = `pepr.dev/${config.uuid}/${name}`;
35
+ metadata.annotations = metadata.annotations || {};
36
+ metadata.annotations[identifier] = "started";
37
+ try {
38
+ // Run the action
39
+ action.callback(wrapped);
40
+ // Add annotations to the request to indicate that the capability succeeded
41
+ metadata.annotations[identifier] = "succeeded";
42
+ }
43
+ catch (e) {
44
+ response.warnings.push(`Action failed: ${e}`);
45
+ // If errors are not allowed, note the failure in the Reponse
46
+ if (config.onError) {
47
+ logger_1.default.error(`Action failed: ${e}`, prefix);
48
+ response.result = "Pepr module configured to reject on error";
49
+ return response;
50
+ }
51
+ else {
52
+ logger_1.default.warn(`Action failed: ${e}`, prefix);
53
+ metadata.annotations[identifier] = "warning";
54
+ }
55
+ }
56
+ }
57
+ }
58
+ // If we've made it this far, the request is allowed
59
+ response.allowed = true;
60
+ // Compare the original request to the modified request to get the patches
61
+ const patches = (0, fast_json_patch_1.compare)(req.object, wrapped.Raw);
62
+ // Only add the patch if there are patches to apply
63
+ if (patches.length > 0) {
64
+ response.patch = JSON.stringify(patches);
65
+ }
66
+ // Remove the warnings array if it's empty
67
+ if (response.warnings.length < 1) {
68
+ delete response.warnings;
69
+ }
70
+ logger_1.default.debug(patches);
71
+ return response;
72
+ }
73
+ exports.processor = processor;
@@ -0,0 +1,77 @@
1
+ import { KubernetesObject, Request } from "./k8s";
2
+ import { DeepPartial } from "./types";
3
+ /**
4
+ * The RequestWrapper class provides methods to modify Kubernetes objects in the context
5
+ * of a mutating webhook request.
6
+ */
7
+ export declare class RequestWrapper<T extends KubernetesObject> {
8
+ private _input;
9
+ Raw: T;
10
+ get PermitSideEffects(): boolean;
11
+ /**
12
+ * Indicates whether the request is a dry run.
13
+ * @returns true if the request is a dry run, false otherwise.
14
+ */
15
+ get IsDryRun(): boolean;
16
+ /**
17
+ * Provides access to the old resource in the request if available.
18
+ * @returns The old Kubernetes resource object or null if not available.
19
+ */
20
+ get OldResource(): T;
21
+ /**
22
+ * Provides access to the request object.
23
+ * @returns The request object containing the Kubernetes resource.
24
+ */
25
+ get Request(): Request<T>;
26
+ /**
27
+ * Creates a new instance of the Action class.
28
+ * @param input - The request object containing the Kubernetes resource to modify.
29
+ */
30
+ constructor(input: Request<T>);
31
+ /**
32
+ * Deep merges the provided object with the current resource.
33
+ *
34
+ * @param obj - The object to merge with the current resource.
35
+ */
36
+ Merge(obj: DeepPartial<T>): void;
37
+ /**
38
+ * Updates a label on the Kubernetes resource.
39
+ * @param key - The key of the label to update.
40
+ * @param value - The value of the label.
41
+ * @returns The current Action instance for method chaining.
42
+ */
43
+ SetLabel(key: string, value: string): this;
44
+ /**
45
+ * Updates an annotation on the Kubernetes resource.
46
+ * @param key - The key of the annotation to update.
47
+ * @param value - The value of the annotation.
48
+ * @returns The current Action instance for method chaining.
49
+ */
50
+ SetAnnotation(key: string, value: string): this;
51
+ /**
52
+ * Removes a label from the Kubernetes resource.
53
+ * @param key - The key of the label to remove.
54
+ * @returns The current Action instance for method chaining.
55
+ */
56
+ RemoveLabel(key: string): this;
57
+ /**
58
+ * Removes an annotation from the Kubernetes resource.
59
+ * @param key - The key of the annotation to remove.
60
+ * @returns The current Action instance for method chaining.
61
+ */
62
+ RemoveAnnotation(key: string): this;
63
+ /**
64
+ * Check if a label exists on the Kubernetes resource.
65
+ *
66
+ * @param key the label key to check
67
+ * @returns
68
+ */
69
+ HasLabel(key: string): boolean;
70
+ /**
71
+ * Check if an annotation exists on the Kubernetes resource.
72
+ *
73
+ * @param key the annotation key to check
74
+ * @returns
75
+ */
76
+ HasAnnotation(key: string): boolean;
77
+ }
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.RequestWrapper = void 0;
29
+ const R = __importStar(require("ramda"));
30
+ /**
31
+ * The RequestWrapper class provides methods to modify Kubernetes objects in the context
32
+ * of a mutating webhook request.
33
+ */
34
+ class RequestWrapper {
35
+ get PermitSideEffects() {
36
+ return !this._input.dryRun;
37
+ }
38
+ /**
39
+ * Indicates whether the request is a dry run.
40
+ * @returns true if the request is a dry run, false otherwise.
41
+ */
42
+ get IsDryRun() {
43
+ return this._input.dryRun;
44
+ }
45
+ /**
46
+ * Provides access to the old resource in the request if available.
47
+ * @returns The old Kubernetes resource object or null if not available.
48
+ */
49
+ get OldResource() {
50
+ return this._input.oldObject;
51
+ }
52
+ /**
53
+ * Provides access to the request object.
54
+ * @returns The request object containing the Kubernetes resource.
55
+ */
56
+ get Request() {
57
+ return this._input;
58
+ }
59
+ /**
60
+ * Creates a new instance of the Action class.
61
+ * @param input - The request object containing the Kubernetes resource to modify.
62
+ */
63
+ constructor(input) {
64
+ // Deep clone the object to prevent mutation of the original object
65
+ this.Raw = R.clone(input.object);
66
+ // Store the input
67
+ this._input = input;
68
+ }
69
+ /**
70
+ * Deep merges the provided object with the current resource.
71
+ *
72
+ * @param obj - The object to merge with the current resource.
73
+ */
74
+ Merge(obj) {
75
+ this.Raw = R.mergeDeepRight(this.Raw, obj);
76
+ }
77
+ /**
78
+ * Updates a label on the Kubernetes resource.
79
+ * @param key - The key of the label to update.
80
+ * @param value - The value of the label.
81
+ * @returns The current Action instance for method chaining.
82
+ */
83
+ SetLabel(key, value) {
84
+ const ref = this.Raw;
85
+ ref.metadata = ref.metadata ?? {};
86
+ ref.metadata.labels = ref.metadata.labels ?? {};
87
+ ref.metadata.labels[key] = value;
88
+ return this;
89
+ }
90
+ /**
91
+ * Updates an annotation on the Kubernetes resource.
92
+ * @param key - The key of the annotation to update.
93
+ * @param value - The value of the annotation.
94
+ * @returns The current Action instance for method chaining.
95
+ */
96
+ SetAnnotation(key, value) {
97
+ const ref = this.Raw;
98
+ ref.metadata = ref.metadata ?? {};
99
+ ref.metadata.annotations = ref.metadata.annotations ?? {};
100
+ ref.metadata.annotations[key] = value;
101
+ return this;
102
+ }
103
+ /**
104
+ * Removes a label from the Kubernetes resource.
105
+ * @param key - The key of the label to remove.
106
+ * @returns The current Action instance for method chaining.
107
+ */
108
+ RemoveLabel(key) {
109
+ if (this.Raw.metadata?.labels?.[key]) {
110
+ delete this.Raw.metadata.labels[key];
111
+ }
112
+ return this;
113
+ }
114
+ /**
115
+ * Removes an annotation from the Kubernetes resource.
116
+ * @param key - The key of the annotation to remove.
117
+ * @returns The current Action instance for method chaining.
118
+ */
119
+ RemoveAnnotation(key) {
120
+ if (this.Raw.metadata?.annotations?.[key]) {
121
+ delete this.Raw.metadata.annotations[key];
122
+ }
123
+ return this;
124
+ }
125
+ /**
126
+ * Check if a label exists on the Kubernetes resource.
127
+ *
128
+ * @param key the label key to check
129
+ * @returns
130
+ */
131
+ HasLabel(key) {
132
+ return this.Raw?.metadata?.labels?.[key] !== undefined;
133
+ }
134
+ /**
135
+ * Check if an annotation exists on the Kubernetes resource.
136
+ *
137
+ * @param key the annotation key to check
138
+ * @returns
139
+ */
140
+ HasAnnotation(key) {
141
+ return this.Raw?.metadata?.annotations?.[key] !== undefined;
142
+ }
143
+ }
144
+ exports.RequestWrapper = RequestWrapper;
@@ -0,0 +1,187 @@
1
+ import { GroupVersionKind, KubernetesObject, WebhookIgnore } from "./k8s";
2
+ import { RequestWrapper } from "./request";
3
+ /**
4
+ * The behavior of this module when an error occurs.
5
+ */
6
+ export declare enum ErrorBehavior {
7
+ ignore = "ignore",
8
+ audit = "audit",
9
+ reject = "reject"
10
+ }
11
+ /**
12
+ * The phase of the Kubernetes admission webhook that the capability is registered for.
13
+ *
14
+ * Currently only `mutate` is supported.
15
+ */
16
+ export declare enum HookPhase {
17
+ mutate = "mutate",
18
+ valdiate = "validate"
19
+ }
20
+ /**
21
+ * Recursively make all properties in T optional.
22
+ */
23
+ export type DeepPartial<T> = {
24
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
25
+ };
26
+ /**
27
+ * The type of Kubernetes mutating webhook event ethat the capability action is registered for.
28
+ */
29
+ export declare enum Event {
30
+ Create = "create",
31
+ Update = "update",
32
+ Delete = "delete",
33
+ CreateOrUpdate = "createOrUpdate"
34
+ }
35
+ export interface CapabilityCfg {
36
+ /**
37
+ * The name of the capability. This should be unique.
38
+ */
39
+ name: string;
40
+ /**
41
+ * A description of the capability and what it does.
42
+ */
43
+ description: string;
44
+ /**
45
+ * List of namespaces that this capability applies to, if empty, applies to all namespaces (cluster-wide).
46
+ * This does not supersede the `alwaysIgnore` global configuration.
47
+ */
48
+ namespaces?: string[];
49
+ /**
50
+ * FUTURE USE.
51
+ *
52
+ * Declare if this capability should be used for mutation or validation. Currently this is not used
53
+ * and everything is considered a mutation.
54
+ */
55
+ mutateOrValidate?: HookPhase;
56
+ }
57
+ export type ModuleSigning = {
58
+ /**
59
+ * Specifies the signing policy.
60
+ * "requireAuthorizedKey" - only authorized keys are accepted.
61
+ * "requireAnyKey" - any key is accepted, as long as it's valid.
62
+ * "none" - no signing required.
63
+ */
64
+ signingPolicy?: "requireAuthorizedKey" | "requireAnyKey" | "none";
65
+ /**
66
+ * List of authorized keys for the "requireAuthorizedKey" policy.
67
+ * These keys are allowed to sign Pepr capabilities.
68
+ */
69
+ authorizedKeys?: string[];
70
+ };
71
+ /** Global configuration for the Pepr runtime. */
72
+ export type ModuleConfig = {
73
+ /** The user-defined name for the module */
74
+ name: string;
75
+ /** The version of Pepr that the module was originally generated with */
76
+ version: string;
77
+ /** A unique identifier for this Pepr module. This is automatically generated by Pepr. */
78
+ uuid: string;
79
+ /** A description of the Pepr module and what it does. */
80
+ description?: string;
81
+ /** Reject K8s resource AdmissionRequests on error. */
82
+ onError: ErrorBehavior | string;
83
+ /** Configure global exclusions that will never be processed by Pepr. */
84
+ alwaysIgnore: WebhookIgnore;
85
+ /**
86
+ * FUTURE USE.
87
+ *
88
+ * Configure the signing policy for Pepr capabilities.
89
+ * This setting determines the requirements for signing keys in Pepr.
90
+ */
91
+ signing?: ModuleSigning;
92
+ };
93
+ export type GenericClass = abstract new () => any;
94
+ export type WhenSelector<T extends GenericClass> = {
95
+ /** Register a capability action to be executed when a Kubernetes resource is created or updated. */
96
+ IsCreatedOrUpdated: () => BindingAll<T>;
97
+ /** Register a capability action to be executed when a Kubernetes resource is created. */
98
+ IsCreated: () => BindingAll<T>;
99
+ /** Register a capability action to be executed when a Kubernetes resource is updated. */
100
+ IsUpdated: () => BindingAll<T>;
101
+ /** Register a capability action to be executed when a Kubernetes resource is deleted. */
102
+ IsDeleted: () => BindingAll<T>;
103
+ };
104
+ export type Binding = {
105
+ event?: Event;
106
+ readonly kind: GroupVersionKind;
107
+ readonly filters: {
108
+ name: string;
109
+ namespaces: string[];
110
+ labels: Record<string, string>;
111
+ annotations: Record<string, string>;
112
+ };
113
+ readonly callback: CapabilityAction<GenericClass, InstanceType<GenericClass>>;
114
+ };
115
+ export type BindingFilter<T extends GenericClass> = BindToActionOrSet<T> & {
116
+ /**
117
+ * Only apply the capability action if the resource has the specified label. If no value is specified, the label must exist.
118
+ * Note multiple calls to this method will result in an AND condition. e.g.
119
+ *
120
+ * ```ts
121
+ * When(a.Deployment)
122
+ * .IsCreated()
123
+ * .WithLabel("foo", "bar")
124
+ * .WithLabel("baz", "qux")
125
+ * .Then(...)
126
+ * ```
127
+ *
128
+ * Will only apply the capability action if the resource has both the `foo=bar` and `baz=qux` labels.
129
+ *
130
+ * @param key
131
+ * @param value
132
+ */
133
+ WithLabel: (key: string, value?: string) => BindingFilter<T>;
134
+ /**
135
+ * Only apply the capability action if the resource has the specified annotation. If no value is specified, the annotation must exist.
136
+ * Note multiple calls to this method will result in an AND condition. e.g.
137
+ *
138
+ * ```ts
139
+ * When(a.Deployment)
140
+ * .IsCreated()
141
+ * .WithAnnotation("foo", "bar")
142
+ * .WithAnnotation("baz", "qux")
143
+ * .Then(...)
144
+ * ```
145
+ *
146
+ * Will only apply the capability action if the resource has both the `foo=bar` and `baz=qux` annotations.
147
+ *
148
+ * @param key
149
+ * @param value
150
+ */
151
+ WithAnnotation: (key: string, value?: string) => BindingFilter<T>;
152
+ };
153
+ export type BindingWithName<T extends GenericClass> = BindingFilter<T> & {
154
+ /** Only apply the capability action if the resource name matches the specified name. */
155
+ WithName: (name: string) => BindingFilter<T>;
156
+ };
157
+ export type BindingAll<T extends GenericClass> = BindingWithName<T> & {
158
+ /** Only apply the cabability action if the resource is in one of the specified namespaces.*/
159
+ InNamespace: (...namespaces: string[]) => BindingFilter<T>;
160
+ };
161
+ export type BindToAction<T extends GenericClass> = {
162
+ /**
163
+ * Create a new capability action with the specified callback function and previously specified
164
+ * filters.
165
+ * @param action The capability action to be executed when the Kubernetes resource is processed by the AdmissionController.
166
+ */
167
+ Then: (action: CapabilityAction<T, InstanceType<T>>) => BindToAction<T>;
168
+ };
169
+ export type BindToActionOrSet<T extends GenericClass> = BindToAction<T> & {
170
+ /**
171
+ * Merge the specified updates into the resource, this can only be used once per binding.
172
+ * Note this is just a convenience method for `request.Merge(values)`.
173
+ *
174
+ * Example change the `minReadySeconds` to 3 of a deployment when it is created:
175
+ *
176
+ * ```ts
177
+ * When(a.Deployment)
178
+ * .IsCreated()
179
+ * .ThenSet({ spec: { minReadySeconds: 3 } });
180
+ * ```
181
+ *
182
+ * @param merge
183
+ * @returns
184
+ */
185
+ ThenSet: (val: DeepPartial<InstanceType<T>>) => BindToAction<T>;
186
+ };
187
+ export type CapabilityAction<T extends GenericClass, K extends KubernetesObject = InstanceType<T>> = (req: RequestWrapper<K>) => void;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.Event = exports.HookPhase = exports.ErrorBehavior = void 0;
6
+ /**
7
+ * The behavior of this module when an error occurs.
8
+ */
9
+ var ErrorBehavior;
10
+ (function (ErrorBehavior) {
11
+ ErrorBehavior["ignore"] = "ignore";
12
+ ErrorBehavior["audit"] = "audit";
13
+ ErrorBehavior["reject"] = "reject";
14
+ })(ErrorBehavior = exports.ErrorBehavior || (exports.ErrorBehavior = {}));
15
+ /**
16
+ * The phase of the Kubernetes admission webhook that the capability is registered for.
17
+ *
18
+ * Currently only `mutate` is supported.
19
+ */
20
+ var HookPhase;
21
+ (function (HookPhase) {
22
+ HookPhase["mutate"] = "mutate";
23
+ HookPhase["valdiate"] = "validate";
24
+ })(HookPhase = exports.HookPhase || (exports.HookPhase = {}));
25
+ /**
26
+ * The type of Kubernetes mutating webhook event ethat the capability action is registered for.
27
+ */
28
+ var Event;
29
+ (function (Event) {
30
+ Event["Create"] = "create";
31
+ Event["Update"] = "update";
32
+ Event["Delete"] = "delete";
33
+ Event["CreateOrUpdate"] = "createOrUpdate";
34
+ })(Event = exports.Event || (exports.Event = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pepr",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "Kubernetes application engine",
5
5
  "author": "Defense Unicorns",
6
6
  "homepage": "https://github.com/defenseunicorns/pepr",
@@ -10,6 +10,8 @@
10
10
  "engines": {
11
11
  "node": ">=18.0.0"
12
12
  },
13
+ "main": "dist/index.js",
14
+ "types": "dist/index.d.ts",
13
15
  "pepr": {
14
16
  "name": "Development Module",
15
17
  "uuid": "20e17cf6-a2e4-46b2-b626-75d88d96c88b",
@@ -23,7 +25,7 @@
23
25
  },
24
26
  "scripts": {
25
27
  "preversion": "npm run prepublishOnly",
26
- "build": "rollup -c",
28
+ "build": "tsc -p tsconfig.build.json",
27
29
  "test": "ava",
28
30
  "lint": "npx eslint src",
29
31
  "lint:fix": "npm run lint -- --fix",
@@ -31,9 +33,7 @@
31
33
  "prettier:fix": "npm run prettier -- --write",
32
34
  "prepublishOnly": "rm -fr dist/* && npm run lint:fix && npm run prettier:fix && npm run test && npm run build",
33
35
  "e2e-dev-setup": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev",
34
- "e2e-dev": "npm run build && docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev && node dist/pepr-cli.js deploy -f -i pepr:dev",
35
- "prestart": "ts-node src/cli dev",
36
- "start": "chokidar 'src/**/*.ts' -c 'SSL_KEY_PATH=insecure-tls.key SSL_CERT_PATH=insecure-tls.crt ts-node src/controller/index.ts' --initial --silent"
36
+ "e2e-dev": "npm run build && docker buildx build --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev && node dist/pepr-cli.js deploy -f -i pepr:dev"
37
37
  },
38
38
  "dependencies": {
39
39
  "@kubernetes/client-node": "^0.18.1",
@@ -52,6 +52,7 @@
52
52
  "rollup": "^3.20.2",
53
53
  "tslib": "^2.5.0",
54
54
  "typescript": "^5.0.2",
55
+ "ts-node": "^10.9.1",
55
56
  "uuid": "^9.0.0"
56
57
  },
57
58
  "devDependencies": {
@@ -62,18 +63,14 @@
62
63
  "@typescript-eslint/eslint-plugin": "^5.57.0",
63
64
  "@typescript-eslint/parser": "^5.57.0",
64
65
  "ava": "^5.2.0",
65
- "chokidar-cli": "^3.0.0",
66
- "eslint": "^8.37.0",
67
- "ts-node": "^10.9.1",
68
- "tsconfig-paths": "^4.1.2"
66
+ "eslint": "^8.37.0"
69
67
  },
70
68
  "ava": {
71
69
  "extensions": [
72
70
  "ts"
73
71
  ],
74
72
  "require": [
75
- "ts-node/register",
76
- "tsconfig-paths/register"
73
+ "ts-node/register"
77
74
  ]
78
75
  }
79
76
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["node_modules", "dist", "fixtures", "**/*.test.ts"]
4
+ }