@peasant-labs/schema 0.29.0 → 0.29.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.
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./internal/generated/public-contract.gen.js";
|
|
2
2
|
export * from "./internal/generated/enums.gen.js";
|
|
3
|
+
export * from "./internal/generated/redaction-categories.gen.js";
|
|
3
4
|
export * from "./internal/generated/content-capabilities.gen.js";
|
|
4
5
|
export * from "./internal/generated/versions.gen.js";
|
|
5
6
|
import { type ProjectHash } from "./internal/generated/contract/zod.gen.js";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./internal/generated/public-contract.gen.js";
|
|
2
2
|
export * from "./internal/generated/enums.gen.js";
|
|
3
|
+
export * from "./internal/generated/redaction-categories.gen.js";
|
|
3
4
|
export * from "./internal/generated/content-capabilities.gen.js";
|
|
4
5
|
export * from "./internal/generated/versions.gen.js";
|
|
5
6
|
import { requiredContentCapabilities, KnownContentCapability } from "./internal/generated/content-capabilities.gen.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const RedactionCategory: Readonly<{
|
|
2
|
+
readonly Secrets: "secrets";
|
|
3
|
+
readonly PII: "pii";
|
|
4
|
+
readonly Paths: "paths";
|
|
5
|
+
readonly Project: "project";
|
|
6
|
+
}>;
|
|
7
|
+
export type RedactionCategory = (typeof RedactionCategory)[keyof typeof RedactionCategory];
|
|
8
|
+
export declare const AllRedactionCategories: readonly RedactionCategory[];
|
|
9
|
+
export declare const RedactionCategoryLabel: Readonly<{
|
|
10
|
+
readonly Credential: "CREDENTIAL";
|
|
11
|
+
readonly PII: "PII";
|
|
12
|
+
readonly Path: "PATH";
|
|
13
|
+
readonly Internal: "INTERNAL";
|
|
14
|
+
}>;
|
|
15
|
+
export type RedactionCategoryLabel = (typeof RedactionCategoryLabel)[keyof typeof RedactionCategoryLabel];
|
|
16
|
+
export declare const AllRedactionCategoryLabels: readonly RedactionCategoryLabel[];
|
|
17
|
+
export declare function isRedactionCategory(value: unknown): value is RedactionCategory;
|
|
18
|
+
export declare function parseRedactionCategory(value: unknown): RedactionCategory;
|
|
19
|
+
export declare function parseRedactionCategoryLabel(value: unknown): RedactionCategoryLabel;
|
|
20
|
+
export declare function redactionCategoryFromLabel(label: RedactionCategoryLabel): RedactionCategory;
|
|
21
|
+
export declare function redactionCategoryLabel(category: RedactionCategory): RedactionCategoryLabel;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Code generated from github.com/peasant-labs/redact@v0.1.6 (h1:Kk03w/5aGmagtuKrV2NLeRVeclA90UBghSXKjTbU4ls=). DO NOT EDIT.
|
|
2
|
+
// Authority: AllCategories(), Category.Validate(), Category.String().
|
|
3
|
+
export const RedactionCategory = Object.freeze({
|
|
4
|
+
Secrets: "secrets",
|
|
5
|
+
PII: "pii",
|
|
6
|
+
Paths: "paths",
|
|
7
|
+
Project: "project",
|
|
8
|
+
});
|
|
9
|
+
export const AllRedactionCategories = Object.freeze(Object.values(RedactionCategory));
|
|
10
|
+
export const RedactionCategoryLabel = Object.freeze({
|
|
11
|
+
Credential: "CREDENTIAL",
|
|
12
|
+
PII: "PII",
|
|
13
|
+
Path: "PATH",
|
|
14
|
+
Internal: "INTERNAL",
|
|
15
|
+
});
|
|
16
|
+
export const AllRedactionCategoryLabels = Object.freeze(Object.values(RedactionCategoryLabel));
|
|
17
|
+
const labels = Object.freeze({
|
|
18
|
+
"secrets": "CREDENTIAL",
|
|
19
|
+
"pii": "PII",
|
|
20
|
+
"paths": "PATH",
|
|
21
|
+
"project": "INTERNAL"
|
|
22
|
+
});
|
|
23
|
+
const categories = Object.freeze({
|
|
24
|
+
"CREDENTIAL": "secrets",
|
|
25
|
+
"PII": "pii",
|
|
26
|
+
"PATH": "paths",
|
|
27
|
+
"INTERNAL": "project"
|
|
28
|
+
});
|
|
29
|
+
function invalid(operation, allowed) {
|
|
30
|
+
throw new TypeError("Redaction category validation failed at @peasant-labs/schema " + operation + " during conversion: input is outside the exact case-sensitive closed set; review cannot safely identify sensitive content; pass a named binding or parse boundary data first. Allowed values: " + allowed.join(", ") + ".");
|
|
31
|
+
}
|
|
32
|
+
export function isRedactionCategory(value) {
|
|
33
|
+
return typeof value === "string" && Object.hasOwn(labels, value);
|
|
34
|
+
}
|
|
35
|
+
export function parseRedactionCategory(value) {
|
|
36
|
+
if (!isRedactionCategory(value))
|
|
37
|
+
invalid("parseRedactionCategory", AllRedactionCategories);
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
export function parseRedactionCategoryLabel(value) {
|
|
41
|
+
if (typeof value !== "string" || !Object.hasOwn(categories, value))
|
|
42
|
+
invalid("parseRedactionCategoryLabel", AllRedactionCategoryLabels);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
export function redactionCategoryFromLabel(label) {
|
|
46
|
+
if (typeof label !== "string" || !Object.hasOwn(categories, label))
|
|
47
|
+
invalid("redactionCategoryFromLabel", AllRedactionCategoryLabels);
|
|
48
|
+
return categories[label];
|
|
49
|
+
}
|
|
50
|
+
export function redactionCategoryLabel(category) {
|
|
51
|
+
if (!isRedactionCategory(category))
|
|
52
|
+
invalid("redactionCategoryLabel", AllRedactionCategories);
|
|
53
|
+
return labels[category];
|
|
54
|
+
}
|