Skip to content

Commit

Permalink
Move deep-partial type to common-types
Browse files Browse the repository at this point in the history
  • Loading branch information
samayer12 committed Mar 6, 2025
1 parent d59bace commit 9a0f0e6
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
5 changes: 5 additions & 0 deletions src/lib/common-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,8 @@ export type ValidateActionResponse = {
statusCode?: number;
statusMessage?: string;
};

// DeepPartial utility type for deep optional properties
export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};
2 changes: 1 addition & 1 deletion src/lib/filter/adjudicators/bindingAdjudicators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
carriedLabels,
carriesLabels,
} from "./kubernetesObject";
import { DeepPartial } from "../../utility-types";
import { DeepPartial } from "../../common-types";
import { ValidateActionResponse } from "../../common-types";

describe("definesDeletionTimestamp", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/filter/adjudicators/mismatch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
mismatchedNamespaceRegex,
} from "./mismatch";
import { Event, Operation } from "../../enums";
import { DeepPartial } from "../../utility-types";
import { DeepPartial } from "../../common-types";
import { AdmissionRequest } from "../../common-types";

describe("mismatchedName", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/filter/adjudicators/postCollection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { KubernetesObject } from "kubernetes-fluent-client";
import { Binding } from "../../types";
import { Event, Operation } from "../../enums";
import { defaultBinding, defaultFilters } from "./defaultTestObjects";
import { DeepPartial } from "../../utility-types";
import { DeepPartial } from "../../common-types";

describe("bindsToKind", () => {
//[ Binding, Kind, result ]
Expand Down
2 changes: 1 addition & 1 deletion src/lib/finalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Log from "./telemetry/logger";
import { Binding } from "./types";
import { Operation } from "./enums";
import { PeprMutateRequest } from "./mutate-request";
import { DeepPartial } from "./utility-types";
import { DeepPartial } from "./common-types";

export function addFinalizer<K extends KubernetesObject>(request: PeprMutateRequest<K>): void {
// if a DELETE is being processed, don't add a finalizer
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mutate-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Operation } from "./enums";
import { KubernetesObject } from "kubernetes-fluent-client";
import { clone, mergeDeepRight } from "ramda";
import { AdmissionRequest } from "./common-types";
import { DeepPartial } from "./utility-types";
import { DeepPartial } from "./common-types";

// PeprMutateRequest class for mutation request handling
export class PeprMutateRequest<T extends KubernetesObject> {
Expand Down
4 changes: 0 additions & 4 deletions src/lib/utility-types.ts

This file was deleted.

0 comments on commit 9a0f0e6

Please sign in to comment.