pepr 0.52.2-nightly.0 → 0.52.2-nightly.1

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 (40) hide show
  1. package/dist/cli/build.d.ts +4 -5
  2. package/dist/cli/build.d.ts.map +1 -1
  3. package/dist/cli/build.helpers.d.ts +2 -2
  4. package/dist/cli/build.helpers.d.ts.map +1 -1
  5. package/dist/cli/crd/generate/generators.d.ts +1 -28
  6. package/dist/cli/crd/generate/generators.d.ts.map +1 -1
  7. package/dist/cli/deploy.d.ts +2 -2
  8. package/dist/cli/deploy.d.ts.map +1 -1
  9. package/dist/cli/monitor.d.ts +3 -0
  10. package/dist/cli/monitor.d.ts.map +1 -1
  11. package/dist/cli/types.d.ts +2 -0
  12. package/dist/cli/types.d.ts.map +1 -1
  13. package/dist/cli.js +1 -1
  14. package/dist/controller.js +1 -1
  15. package/dist/lib/assets/yaml/generateAllYaml.d.ts +1 -2
  16. package/dist/lib/assets/yaml/generateAllYaml.d.ts.map +1 -1
  17. package/dist/lib/core/storage.d.ts +2 -1
  18. package/dist/lib/core/storage.d.ts.map +1 -1
  19. package/dist/lib/filter/adjudicators/binding.d.ts +2 -1
  20. package/dist/lib/filter/adjudicators/binding.d.ts.map +1 -1
  21. package/dist/lib/filter/adjudicators/kubernetesObject.d.ts +0 -1
  22. package/dist/lib/filter/adjudicators/kubernetesObject.d.ts.map +1 -1
  23. package/dist/lib/processors/mutate-processor.d.ts +2 -1
  24. package/dist/lib/processors/mutate-processor.d.ts.map +1 -1
  25. package/dist/lib/types.d.ts +0 -4
  26. package/dist/lib/types.d.ts.map +1 -1
  27. package/dist/lib.js.map +2 -2
  28. package/package.json +1 -1
  29. package/src/cli/build.helpers.ts +2 -2
  30. package/src/cli/build.ts +5 -5
  31. package/src/cli/crd/generate/generators.ts +6 -6
  32. package/src/cli/deploy.ts +3 -2
  33. package/src/cli/monitor.ts +2 -2
  34. package/src/cli/types.ts +3 -0
  35. package/src/lib/assets/yaml/generateAllYaml.ts +1 -1
  36. package/src/lib/core/storage.ts +1 -1
  37. package/src/lib/filter/adjudicators/binding.ts +2 -1
  38. package/src/lib/filter/adjudicators/kubernetesObject.ts +1 -1
  39. package/src/lib/processors/mutate-processor.ts +1 -1
  40. package/src/lib/types.ts +0 -4
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "!src/fixtures/**",
17
17
  "!dist/**/*.test.d.ts*"
18
18
  ],
19
- "version": "0.52.2-nightly.0",
19
+ "version": "0.52.2-nightly.1",
20
20
  "main": "dist/lib.js",
21
21
  "types": "dist/lib.d.ts",
22
22
  "scripts": {
@@ -4,7 +4,7 @@ import { createDockerfile } from "../lib/included-files";
4
4
  import { execSync } from "child_process";
5
5
  import { CapabilityExport } from "../lib/types";
6
6
  import { validateCapabilityNames } from "../lib/helpers";
7
- import { BuildOptions, BuildResult, context, BuildContext } from "esbuild";
7
+ import { BuildOptions, context, BuildContext } from "esbuild";
8
8
  import { Assets } from "../lib/assets/assets";
9
9
  import { resolve } from "path";
10
10
  import { promises as fs } from "fs";
@@ -18,6 +18,7 @@ import {
18
18
  service,
19
19
  watcherService,
20
20
  } from "../lib/assets/k8sObjects";
21
+ import { Reloader } from "./types";
21
22
 
22
23
  interface ImageOptions {
23
24
  customImage?: string;
@@ -47,7 +48,6 @@ export function assignImage(imageOptions: ImageOptions): string {
47
48
  return "";
48
49
  }
49
50
 
50
- export type Reloader = (opts: BuildResult<BuildOptions>) => void | Promise<void>;
51
51
  /**
52
52
  * Determine the RBAC mode based on the CLI options and the module's config
53
53
  * @param opts CLI options
package/src/cli/build.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
3
 
4
4
  import { execFileSync } from "child_process";
5
- import { BuildContext, BuildOptions, BuildResult, analyzeMetafile } from "esbuild";
5
+ import { BuildContext, BuildOptions, analyzeMetafile } from "esbuild";
6
6
  import { promises as fs } from "fs";
7
7
  import { basename, dirname, extname, resolve } from "path";
8
8
  import { Assets } from "../lib/assets/assets";
@@ -22,11 +22,11 @@ import {
22
22
  validImagePullSecret,
23
23
  generateYamlAndWriteToDisk,
24
24
  } from "./build.helpers";
25
+ import { Reloader } from "./types";
25
26
 
26
27
  const peprTS = "pepr.ts";
27
28
  let outputDir: string = "dist";
28
- export type Reloader = (opts: BuildResult<BuildOptions>) => void | Promise<void>;
29
- export type PeprNestedFields = Pick<
29
+ type PeprNestedFields = Pick<
30
30
  ModuleConfig,
31
31
  | "uuid"
32
32
  | "onError"
@@ -40,7 +40,7 @@ export type PeprNestedFields = Pick<
40
40
  peprVersion: string;
41
41
  };
42
42
 
43
- export type PeprConfig = Omit<ModuleConfig, keyof PeprNestedFields> & {
43
+ type PeprConfig = Omit<ModuleConfig, keyof PeprNestedFields> & {
44
44
  pepr: PeprNestedFields & {
45
45
  includedFiles: string[];
46
46
  };
@@ -363,7 +363,7 @@ function handleModuleBuildError(e: BuildModuleResult): void {
363
363
  }
364
364
  }
365
365
 
366
- export async function checkFormat(): Promise<void> {
366
+ async function checkFormat(): Promise<void> {
367
367
  const validFormat = await peprFormat(true);
368
368
 
369
369
  if (!validFormat) {
@@ -16,7 +16,7 @@ import { kind as k } from "kubernetes-fluent-client";
16
16
  import { V1JSONSchemaProps } from "@kubernetes/client-node";
17
17
  import { WarningMessages, ErrorMessages } from "./messages";
18
18
 
19
- export function extractCRDDetails(
19
+ function extractCRDDetails(
20
20
  content: string,
21
21
  sourceFile: SourceFile,
22
22
  ): {
@@ -145,7 +145,7 @@ export function extractDetails(sourceFile: SourceFile): {
145
145
  throw new Error(ErrorMessages.INVALID_SCOPE(scope));
146
146
  }
147
147
 
148
- export function getJsDocDescription(node: Node): string {
148
+ function getJsDocDescription(node: Node): string {
149
149
  if (!Node.isPropertySignature(node) && !Node.isPropertyDeclaration(node)) return "";
150
150
  return node
151
151
  .getJsDocs()
@@ -155,7 +155,7 @@ export function getJsDocDescription(node: Node): string {
155
155
  .trim();
156
156
  }
157
157
 
158
- export function getSchemaFromType(decl: InterfaceDeclaration | TypeAliasDeclaration): {
158
+ function getSchemaFromType(decl: InterfaceDeclaration | TypeAliasDeclaration): {
159
159
  properties: Record<string, V1JSONSchemaProps>;
160
160
  required: string[];
161
161
  } {
@@ -183,7 +183,7 @@ export function getSchemaFromType(decl: InterfaceDeclaration | TypeAliasDeclarat
183
183
  return { properties, required };
184
184
  }
185
185
 
186
- export function mapTypeToSchema(type: Type): V1JSONSchemaProps {
186
+ function mapTypeToSchema(type: Type): V1JSONSchemaProps {
187
187
  if (type.getText() === "Date") return { type: "string", format: "date-time" };
188
188
  if (type.isString()) return { type: "string" };
189
189
  if (type.isNumber()) return { type: "number" };
@@ -199,7 +199,7 @@ export function mapTypeToSchema(type: Type): V1JSONSchemaProps {
199
199
  return { type: "string" };
200
200
  }
201
201
 
202
- export function buildObjectSchema(type: Type): V1JSONSchemaProps {
202
+ function buildObjectSchema(type: Type): V1JSONSchemaProps {
203
203
  const props: Record<string, V1JSONSchemaProps> = {};
204
204
  const required: string[] = [];
205
205
 
@@ -249,7 +249,7 @@ interface CRDConfig {
249
249
  conditionSchema: ReturnType<typeof getSchemaFromType>;
250
250
  }
251
251
 
252
- export function buildCRD(config: CRDConfig): k.CustomResourceDefinition {
252
+ function buildCRD(config: CRDConfig): k.CustomResourceDefinition {
253
253
  return {
254
254
  apiVersion: "apiextensions.k8s.io/v1",
255
255
  kind: "CustomResourceDefinition",
package/src/cli/deploy.ts CHANGED
@@ -13,7 +13,8 @@ import { sanitizeName } from "./init/utils";
13
13
  import { validateCapabilityNames } from "../lib/helpers";
14
14
  import { namespaceComplianceValidator } from "../lib/helpers";
15
15
  import { loadCapabilities } from "../lib/assets/loader";
16
- export interface ImagePullSecretDetails {
16
+
17
+ interface ImagePullSecretDetails {
17
18
  pullSecret?: string;
18
19
  dockerServer?: string;
19
20
  dockerUsername?: string;
@@ -61,7 +62,7 @@ export function validateImagePullSecretDetails(details: ImagePullSecretDetails):
61
62
  return { valid: true };
62
63
  }
63
64
 
64
- export type ValidatedImagePullSecretDetails = Required<ImagePullSecretDetails>;
65
+ type ValidatedImagePullSecretDetails = Required<ImagePullSecretDetails>;
65
66
 
66
67
  function generateImagePullSecret(details: ValidatedImagePullSecretDetails): ImagePullSecret {
67
68
  const auth = Buffer.from(`${details.dockerUsername}:${details.dockerPassword}`).toString(
@@ -81,7 +81,7 @@ export function getK8sLogFromKubeConfig(): K8sLog {
81
81
  return new K8sLog(kc);
82
82
  }
83
83
 
84
- function createLogStream(): stream.PassThrough {
84
+ export function createLogStream(): stream.PassThrough {
85
85
  const logStream = new stream.PassThrough();
86
86
 
87
87
  logStream.on("data", async chunk => {
@@ -97,7 +97,7 @@ function createLogStream(): stream.PassThrough {
97
97
  return logStream;
98
98
  }
99
99
 
100
- function processLogLine(line: string): void {
100
+ export function processLogLine(line: string): void {
101
101
  try {
102
102
  const payload: LogPayload = JSON.parse(line.trim());
103
103
  const isMutate = payload.res.patchType || payload.res.warnings;
package/src/cli/types.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { BuildResult, BuildOptions } from "esbuild";
1
2
  import { Answers } from "prompts";
2
3
 
3
4
  export type InitOptions = Answers<"name" | "description" | "errorBehavior" | "uuid">;
5
+
6
+ export type Reloader = (opts: BuildResult<BuildOptions>) => void | Promise<void>;
@@ -23,7 +23,7 @@ type services = {
23
23
  watch: V1Service | null;
24
24
  };
25
25
 
26
- export function pushControllerManifests(
26
+ function pushControllerManifests(
27
27
  resources: KubernetesObject[],
28
28
  deployments: deployments,
29
29
  services: services,
@@ -6,7 +6,7 @@ import pointer from "json-pointer";
6
6
  export type DataOp = "add" | "remove";
7
7
  export type DataStore = Record<string, string>;
8
8
  export type DataSender = (op: DataOp, keys: string[], value?: string) => void;
9
- export type DataReceiver = (data: DataStore) => void;
9
+ type DataReceiver = (data: DataStore) => void;
10
10
  export type Unsubscribe = () => void;
11
11
 
12
12
  const MAX_WAIT_TIME = 15000;
@@ -74,7 +74,8 @@ export const definedCategory = (binding: Partial<Binding>): string => {
74
74
 
75
75
  return Object.keys(categories).find(key => categories[key]) || "";
76
76
  };
77
- export type DefinedCallbackReturnType =
77
+
78
+ type DefinedCallbackReturnType =
78
79
  | FinalizeAction<GenericClass, InstanceType<GenericClass>>
79
80
  | WatchLogAction<GenericClass, InstanceType<GenericClass>>
80
81
  | MutateAction<GenericClass, InstanceType<GenericClass>>
@@ -4,7 +4,7 @@
4
4
  import { __, allPass, complement, defaultTo, equals, length, gt, not, nthArg, pipe } from "ramda";
5
5
  import { KubernetesObject } from "kubernetes-fluent-client";
6
6
 
7
- export const carriesDeletionTimestamp = pipe(
7
+ const carriesDeletionTimestamp = pipe(
8
8
  kubernetesObject => !!kubernetesObject.metadata?.deletionTimestamp,
9
9
  defaultTo(false),
10
10
  );
@@ -30,7 +30,7 @@ export interface Bindable {
30
30
  actMeta: Record<string, string>;
31
31
  }
32
32
 
33
- export interface Result {
33
+ interface Result {
34
34
  wrapped: PeprMutateRequest<KubernetesObject>;
35
35
  response: MutateResponse;
36
36
  }
package/src/lib/types.ts CHANGED
@@ -68,10 +68,6 @@ export type WhenSelector<T extends GenericClass> = {
68
68
  /** Register an action to be executed when a Kubernetes resource is deleted. */
69
69
  IsDeleted: () => BindingAll<T>;
70
70
  };
71
- export interface RegExpFilter {
72
- obj: RegExp;
73
- source: string;
74
- }
75
71
 
76
72
  export type Filters = {
77
73
  annotations: Record<string, string>;