-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fix circular dependency between types and mutate-request (#1332)
## Description We would like to remove the circular dependency between types.ts and mutate-request.ts ... End to End Test: <!-- if applicable --> (See [Pepr Excellent Examples](https://github.com/defenseunicorns/pepr-excellent-examples)) ## Related Issue Fixes # <!-- or --> Relates to # ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [x] Other (security config, docs update, etc) ## Checklist before merging - [ ] Unit, [Journey](https://github.com/defenseunicorns/pepr/tree/main/journey), [E2E Tests](https://github.com/defenseunicorns/pepr-excellent-examples), [docs](https://github.com/defenseunicorns/pepr/tree/main/docs), [adr](https://github.com/defenseunicorns/pepr/tree/main/adr) added or updated as needed - [ ] [Contributor Guide Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request) followed --------- Co-authored-by: Sam Mayer <[email protected]>
- Loading branch information
1 parent
2b0d353
commit 97c2845
Showing
13 changed files
with
86 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors | ||
|
||
import { KubernetesObject } from "kubernetes-fluent-client"; | ||
import { GroupVersionKind } from "kubernetes-fluent-client"; | ||
|
||
// Operation type for mutation operations | ||
export enum Operation { | ||
CREATE = "CREATE", | ||
UPDATE = "UPDATE", | ||
DELETE = "DELETE", | ||
CONNECT = "CONNECT", | ||
} | ||
|
||
// AdmissionRequest interface for handling admission requests in mutation context | ||
export interface AdmissionRequest<T = KubernetesObject> { | ||
readonly uid: string; | ||
readonly kind: GroupVersionKind; | ||
readonly resource: GroupVersionResource; | ||
readonly subResource?: string; | ||
readonly requestKind?: GroupVersionKind; | ||
readonly requestResource?: GroupVersionResource; | ||
readonly requestSubResource?: string; | ||
readonly name: string; | ||
readonly namespace?: string; | ||
readonly operation: Operation; | ||
readonly userInfo: { | ||
username?: string; | ||
uid?: string; | ||
groups?: string[]; | ||
extra?: { [key: string]: string[] }; | ||
}; | ||
readonly object: T; | ||
readonly oldObject?: T; | ||
readonly dryRun?: boolean; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
readonly options?: any; | ||
} | ||
|
||
// DeepPartial utility type for deep optional properties | ||
export type DeepPartial<T> = { | ||
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]; | ||
}; | ||
|
||
// GroupVersionResource interface for resource identification | ||
export interface GroupVersionResource { | ||
readonly group: string; | ||
readonly version: string; | ||
readonly resource: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters