@danypops/vehicle-core 0.12.5 → 0.13.0

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.
@@ -4,6 +4,17 @@ export type JsonValue = JsonPrimitive | readonly JsonValue[] | {
4
4
  readonly [key: string]: JsonValue;
5
5
  };
6
6
  export type JsonSchema = Readonly<Record<string, JsonValue>>;
7
+ /** Shared defense-in-depth vocabulary for credential-shaped fields at every Vehicle projection boundary. */
8
+ export declare const VEHICLE_CREDENTIAL_FIELD_NAMES: readonly ["password", "token", "accessToken", "refreshToken", "apiKey", "secret", "authorization", "credential"];
9
+ /** Case/separator-insensitive credential-name check used as a fallback when a schema annotation is missing. */
10
+ export declare function isVehicleCredentialFieldName(name: string): boolean;
11
+ /**
12
+ * JSON Schema property annotation consumed by human-facing Vehicle adapters.
13
+ * `omit` hides the field; `summarize` may show shape/size but never its value.
14
+ * Standard `writeOnly: true` and `format: "password"` always imply omission.
15
+ */
16
+ export declare const VEHICLE_SCHEMA_PRESENTATION_EXTENSION: "x-vehicle-presentation";
17
+ export type VehicleSchemaPresentation = "omit" | "summarize";
7
18
  export interface VehicleSchemaIssue {
8
19
  readonly path: readonly (string | number)[];
9
20
  readonly message: string;
@@ -1,3 +1,25 @@
1
+ /** Shared defense-in-depth vocabulary for credential-shaped fields at every Vehicle projection boundary. */
2
+ export const VEHICLE_CREDENTIAL_FIELD_NAMES = Object.freeze([
3
+ "password",
4
+ "token",
5
+ "accessToken",
6
+ "refreshToken",
7
+ "apiKey",
8
+ "secret",
9
+ "authorization",
10
+ "credential",
11
+ ]);
12
+ const NORMALIZED_VEHICLE_CREDENTIAL_FIELD_NAMES = new Set(VEHICLE_CREDENTIAL_FIELD_NAMES.map((name) => name.replace(/[^a-z0-9]/gi, "").toLowerCase()));
13
+ /** Case/separator-insensitive credential-name check used as a fallback when a schema annotation is missing. */
14
+ export function isVehicleCredentialFieldName(name) {
15
+ return NORMALIZED_VEHICLE_CREDENTIAL_FIELD_NAMES.has(name.replace(/[^a-z0-9]/gi, "").toLowerCase());
16
+ }
17
+ /**
18
+ * JSON Schema property annotation consumed by human-facing Vehicle adapters.
19
+ * `omit` hides the field; `summarize` may show shape/size but never its value.
20
+ * Standard `writeOnly: true` and `format: "password"` always imply omission.
21
+ */
22
+ export const VEHICLE_SCHEMA_PRESENTATION_EXTENSION = "x-vehicle-presentation";
1
23
  export function defineVehicleSchema(codec) {
2
24
  return Object.freeze({
3
25
  jsonSchema: cloneJson(codec.jsonSchema),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/vehicle-core",
3
- "version": "0.12.5",
3
+ "version": "0.13.0",
4
4
  "description": "Vehicle's runtime-neutral wire contract: operation descriptors, schema codecs, failure shapes. Zero runtime dependencies, zero Bun-specific code -- the one thing every Vehicle client and server package depends on.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -4,6 +4,35 @@ export type JsonPrimitive = string | number | boolean | null;
4
4
  export type JsonValue = JsonPrimitive | readonly JsonValue[] | { readonly [key: string]: JsonValue };
5
5
  export type JsonSchema = Readonly<Record<string, JsonValue>>;
6
6
 
7
+ /** Shared defense-in-depth vocabulary for credential-shaped fields at every Vehicle projection boundary. */
8
+ export const VEHICLE_CREDENTIAL_FIELD_NAMES = Object.freeze([
9
+ "password",
10
+ "token",
11
+ "accessToken",
12
+ "refreshToken",
13
+ "apiKey",
14
+ "secret",
15
+ "authorization",
16
+ "credential",
17
+ ] as const);
18
+
19
+ const NORMALIZED_VEHICLE_CREDENTIAL_FIELD_NAMES = new Set(
20
+ VEHICLE_CREDENTIAL_FIELD_NAMES.map((name) => name.replace(/[^a-z0-9]/gi, "").toLowerCase()),
21
+ );
22
+
23
+ /** Case/separator-insensitive credential-name check used as a fallback when a schema annotation is missing. */
24
+ export function isVehicleCredentialFieldName(name: string): boolean {
25
+ return NORMALIZED_VEHICLE_CREDENTIAL_FIELD_NAMES.has(name.replace(/[^a-z0-9]/gi, "").toLowerCase());
26
+ }
27
+
28
+ /**
29
+ * JSON Schema property annotation consumed by human-facing Vehicle adapters.
30
+ * `omit` hides the field; `summarize` may show shape/size but never its value.
31
+ * Standard `writeOnly: true` and `format: "password"` always imply omission.
32
+ */
33
+ export const VEHICLE_SCHEMA_PRESENTATION_EXTENSION = "x-vehicle-presentation" as const;
34
+ export type VehicleSchemaPresentation = "omit" | "summarize";
35
+
7
36
  export interface VehicleSchemaIssue {
8
37
  readonly path: readonly (string | number)[];
9
38
  readonly message: string;