@pithy-sh/core 0.11.0 → 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.
- package/dist/audit/composed.d.ts +18 -0
- package/dist/audit/composed.d.ts.map +1 -0
- package/dist/audit/composed.js +28 -0
- package/dist/audit/recorder.d.ts +10 -2
- package/dist/audit/recorder.d.ts.map +1 -1
- package/dist/capability/capability.d.ts +23 -0
- package/dist/capability/capability.d.ts.map +1 -1
- package/dist/capability/capability.js +2 -0
- package/dist/capability/purge.d.ts +122 -0
- package/dist/capability/purge.d.ts.map +1 -0
- package/dist/capability/purge.js +131 -0
- package/dist/cli/commandCatalog.generated.d.ts +54 -2
- package/dist/cli/commandCatalog.generated.d.ts.map +1 -1
- package/dist/cli/commandCatalog.generated.js +61 -0
- package/dist/cli/commandFacts.d.ts +1 -0
- package/dist/cli/commandFacts.d.ts.map +1 -1
- package/dist/cli/commandFacts.js +1 -0
- package/dist/controlPlane/capability.d.ts.map +1 -1
- package/dist/controlPlane/capability.js +7 -0
- package/dist/controlPlane/data/connection.d.ts +2 -12
- package/dist/controlPlane/data/connection.d.ts.map +1 -1
- package/dist/controlPlane/data/connection.js +1 -1
- package/dist/controlPlane/discovery/adminRoute.d.ts +29 -0
- package/dist/controlPlane/discovery/adminRoute.d.ts.map +1 -1
- package/dist/controlPlane/discovery/adminRoute.js +3 -0
- package/dist/controlPlane/error/errors.d.ts +4 -3
- package/dist/controlPlane/error/errors.d.ts.map +1 -1
- package/dist/controlPlane/http/guard.d.ts.map +1 -1
- package/dist/controlPlane/http/guard.js +40 -1
- package/dist/controlPlane/http/handlers.d.ts +79 -0
- package/dist/controlPlane/http/handlers.d.ts.map +1 -1
- package/dist/controlPlane/http/handlers.js +37 -3
- package/dist/controlPlane/http/responses.d.ts +98 -0
- package/dist/controlPlane/http/responses.d.ts.map +1 -1
- package/dist/controlPlane/http/responses.js +41 -1
- package/dist/controlPlane/http/routes.d.ts +1 -0
- package/dist/controlPlane/http/routes.d.ts.map +1 -1
- package/dist/controlPlane/http/routes.js +17 -3
- package/dist/controlPlane/scope/scope.d.ts +13 -3
- package/dist/controlPlane/scope/scope.d.ts.map +1 -1
- package/dist/controlPlane/scope/scope.js +14 -4
- package/dist/createBackend.d.ts.map +1 -1
- package/dist/createBackend.js +2 -0
- package/dist/createEntrypoint.d.ts +7 -1
- package/dist/createEntrypoint.d.ts.map +1 -1
- package/dist/createEntrypoint.js +15 -5
- package/dist/crypto/envelope.d.ts +86 -0
- package/dist/crypto/envelope.d.ts.map +1 -0
- package/dist/crypto/envelope.js +129 -0
- package/dist/crypto/fieldKeys.d.ts +41 -0
- package/dist/crypto/fieldKeys.d.ts.map +1 -0
- package/dist/crypto/fieldKeys.js +56 -0
- package/dist/data/codecs.d.ts +23 -10
- package/dist/data/codecs.d.ts.map +1 -1
- package/dist/data/codecs.js +50 -36
- package/dist/error/extend.d.ts +6 -5
- package/dist/error/extend.d.ts.map +1 -1
- package/dist/error/http.d.ts +72 -0
- package/dist/error/http.d.ts.map +1 -1
- package/dist/error/payload.d.ts +144 -0
- package/dist/error/payload.d.ts.map +1 -1
- package/dist/error/payload.js +48 -0
- package/dist/error/pithyError.d.ts +18 -7
- package/dist/error/pithyError.d.ts.map +1 -1
- package/dist/error/pithyError.js +6 -0
- package/dist/http/validation.d.ts +11 -2
- package/dist/http/validation.d.ts.map +1 -1
- package/dist/http/validation.js +20 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/logger/logger.d.ts +12 -5
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/record.d.ts +42 -0
- package/dist/logger/record.d.ts.map +1 -1
- package/dist/privacy/blindIndex.d.ts +27 -0
- package/dist/privacy/blindIndex.d.ts.map +1 -0
- package/dist/privacy/blindIndex.js +57 -0
- package/dist/privacy/classes.d.ts +142 -0
- package/dist/privacy/classes.d.ts.map +1 -0
- package/dist/privacy/classes.js +209 -0
- package/dist/privacy/classify.d.ts +336 -0
- package/dist/privacy/classify.d.ts.map +1 -0
- package/dist/privacy/classify.js +1024 -0
- package/dist/privacy/encrypted.d.ts +210 -0
- package/dist/privacy/encrypted.d.ts.map +1 -0
- package/dist/privacy/encrypted.js +350 -0
- package/dist/privacy/encryptedColumns.d.ts +64 -0
- package/dist/privacy/encryptedColumns.d.ts.map +1 -0
- package/dist/privacy/encryptedColumns.js +134 -0
- package/dist/privacy/fieldRotation.d.ts +34 -0
- package/dist/privacy/fieldRotation.d.ts.map +1 -0
- package/dist/privacy/fieldRotation.js +186 -0
- package/dist/privacy/inventory.d.ts +12 -0
- package/dist/privacy/inventory.d.ts.map +1 -0
- package/dist/privacy/inventory.js +154 -0
- package/dist/privacy/posture.d.ts +114 -0
- package/dist/privacy/posture.d.ts.map +1 -0
- package/dist/privacy/posture.js +136 -0
- package/dist/privacy/redact.d.ts +7 -0
- package/dist/privacy/redact.d.ts.map +1 -0
- package/dist/privacy/redact.js +404 -0
- package/dist/privacy/report.d.ts +58 -0
- package/dist/privacy/report.d.ts.map +1 -0
- package/dist/privacy/report.js +15 -0
- package/dist/privacy/retirement.d.ts +68 -0
- package/dist/privacy/retirement.d.ts.map +1 -0
- package/dist/privacy/retirement.js +72 -0
- package/dist/privacy/sealed.d.ts +87 -0
- package/dist/privacy/sealed.d.ts.map +1 -0
- package/dist/privacy/sealed.js +221 -0
- package/dist/privacy/types.d.ts +559 -0
- package/dist/privacy/types.d.ts.map +1 -0
- package/dist/privacy/types.js +2 -0
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +1 -1
- package/src/audit/composed.ts +30 -0
- package/src/audit/recorder.ts +10 -2
- package/src/capability/capability.ts +26 -0
- package/src/capability/purge.ts +187 -0
- package/src/cli/commandCatalog.generated.ts +65 -0
- package/src/cli/commandFacts.ts +1 -0
- package/src/controlPlane/capability.ts +11 -0
- package/src/controlPlane/discovery/adminRoute.ts +11 -0
- package/src/controlPlane/error/errors.ts +4 -3
- package/src/controlPlane/http/guard.ts +60 -1
- package/src/controlPlane/http/handlers.ts +57 -4
- package/src/controlPlane/http/responses.ts +100 -0
- package/src/controlPlane/http/routes.ts +31 -1
- package/src/controlPlane/scope/scope.ts +14 -3
- package/src/controlPlane/token/base64url.ts +1 -1
- package/src/createBackend.ts +4 -0
- package/src/createEntrypoint.ts +17 -2
- package/src/crypto/envelope.ts +196 -0
- package/src/crypto/fieldKeys.ts +76 -0
- package/src/data/codecs.ts +69 -37
- package/src/error/extend.ts +6 -5
- package/src/error/payload.ts +110 -0
- package/src/error/pithyError.ts +21 -7
- package/src/http/validation.ts +35 -3
- package/src/index.ts +1 -0
- package/src/logger/logger.ts +12 -5
- package/src/privacy/blindIndex.ts +81 -0
- package/src/privacy/classes.ts +277 -0
- package/src/privacy/classify.ts +1447 -0
- package/src/privacy/encrypted.ts +513 -0
- package/src/privacy/encryptedColumns.ts +185 -0
- package/src/privacy/fieldRotation.ts +234 -0
- package/src/privacy/inventory.ts +147 -0
- package/src/privacy/posture.ts +205 -0
- package/src/privacy/redact.ts +423 -0
- package/src/privacy/report.ts +64 -0
- package/src/privacy/retirement.ts +102 -0
- package/src/privacy/sealed.ts +323 -0
- package/src/privacy/types.ts +804 -0
- package/src/version.generated.ts +1 -1
package/dist/error/payload.d.ts
CHANGED
|
@@ -70,6 +70,16 @@ export declare const KitPublicErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
70
70
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
71
71
|
code: z.ZodLiteral<"auth/session_not_fresh">;
|
|
72
72
|
status: z.ZodLiteral<403>;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
message: z.ZodString;
|
|
75
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
76
|
+
code: z.ZodLiteral<"auth/account_suspended">;
|
|
77
|
+
status: z.ZodLiteral<403>;
|
|
78
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
+
message: z.ZodString;
|
|
80
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
81
|
+
code: z.ZodLiteral<"auth/account_deleted">;
|
|
82
|
+
status: z.ZodLiteral<403>;
|
|
73
83
|
}, z.core.$strip>, z.ZodObject<{
|
|
74
84
|
message: z.ZodString;
|
|
75
85
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -650,6 +660,26 @@ export declare const KitPublicErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
650
660
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
651
661
|
code: z.ZodLiteral<"organization/nomination_invalid">;
|
|
652
662
|
status: z.ZodLiteral<400>;
|
|
663
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
664
|
+
message: z.ZodString;
|
|
665
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
666
|
+
code: z.ZodLiteral<"organization/last_owner">;
|
|
667
|
+
status: z.ZodLiteral<409>;
|
|
668
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
669
|
+
message: z.ZodString;
|
|
670
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
671
|
+
code: z.ZodLiteral<"organization/already_member">;
|
|
672
|
+
status: z.ZodLiteral<409>;
|
|
673
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
674
|
+
message: z.ZodString;
|
|
675
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
676
|
+
code: z.ZodLiteral<"organization/seat_limit_reached">;
|
|
677
|
+
status: z.ZodLiteral<409>;
|
|
678
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
679
|
+
message: z.ZodString;
|
|
680
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
681
|
+
code: z.ZodLiteral<"organization/organization_suspended">;
|
|
682
|
+
status: z.ZodLiteral<403>;
|
|
653
683
|
}, z.core.$strip>, z.ZodObject<{
|
|
654
684
|
message: z.ZodString;
|
|
655
685
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -824,6 +854,20 @@ export declare const KitErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
824
854
|
detail: z.ZodOptional<z.ZodString>;
|
|
825
855
|
code: z.ZodLiteral<"auth/session_not_fresh">;
|
|
826
856
|
status: z.ZodLiteral<403>;
|
|
857
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
858
|
+
message: z.ZodString;
|
|
859
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
860
|
+
action: z.ZodOptional<z.ZodString>;
|
|
861
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
862
|
+
code: z.ZodLiteral<"auth/account_suspended">;
|
|
863
|
+
status: z.ZodLiteral<403>;
|
|
864
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
865
|
+
message: z.ZodString;
|
|
866
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
867
|
+
action: z.ZodOptional<z.ZodString>;
|
|
868
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
869
|
+
code: z.ZodLiteral<"auth/account_deleted">;
|
|
870
|
+
status: z.ZodLiteral<403>;
|
|
827
871
|
}, z.core.$strip>, z.ZodObject<{
|
|
828
872
|
message: z.ZodString;
|
|
829
873
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1636,6 +1680,34 @@ export declare const KitErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1636
1680
|
detail: z.ZodOptional<z.ZodString>;
|
|
1637
1681
|
code: z.ZodLiteral<"organization/nomination_invalid">;
|
|
1638
1682
|
status: z.ZodLiteral<400>;
|
|
1683
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1684
|
+
message: z.ZodString;
|
|
1685
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1686
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1687
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1688
|
+
code: z.ZodLiteral<"organization/last_owner">;
|
|
1689
|
+
status: z.ZodLiteral<409>;
|
|
1690
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1691
|
+
message: z.ZodString;
|
|
1692
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1693
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1694
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1695
|
+
code: z.ZodLiteral<"organization/already_member">;
|
|
1696
|
+
status: z.ZodLiteral<409>;
|
|
1697
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1698
|
+
message: z.ZodString;
|
|
1699
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1700
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1701
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1702
|
+
code: z.ZodLiteral<"organization/seat_limit_reached">;
|
|
1703
|
+
status: z.ZodLiteral<409>;
|
|
1704
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1705
|
+
message: z.ZodString;
|
|
1706
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1707
|
+
action: z.ZodOptional<z.ZodString>;
|
|
1708
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
1709
|
+
code: z.ZodLiteral<"organization/organization_suspended">;
|
|
1710
|
+
status: z.ZodLiteral<403>;
|
|
1639
1711
|
}, z.core.$strip>, z.ZodObject<{
|
|
1640
1712
|
message: z.ZodString;
|
|
1641
1713
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1853,6 +1925,16 @@ export declare const PublicErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminated
|
|
|
1853
1925
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1854
1926
|
code: z.ZodLiteral<"auth/session_not_fresh">;
|
|
1855
1927
|
status: z.ZodLiteral<403>;
|
|
1928
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1929
|
+
message: z.ZodString;
|
|
1930
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1931
|
+
code: z.ZodLiteral<"auth/account_suspended">;
|
|
1932
|
+
status: z.ZodLiteral<403>;
|
|
1933
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1934
|
+
message: z.ZodString;
|
|
1935
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1936
|
+
code: z.ZodLiteral<"auth/account_deleted">;
|
|
1937
|
+
status: z.ZodLiteral<403>;
|
|
1856
1938
|
}, z.core.$strip>, z.ZodObject<{
|
|
1857
1939
|
message: z.ZodString;
|
|
1858
1940
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -2433,6 +2515,26 @@ export declare const PublicErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminated
|
|
|
2433
2515
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2434
2516
|
code: z.ZodLiteral<"organization/nomination_invalid">;
|
|
2435
2517
|
status: z.ZodLiteral<400>;
|
|
2518
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2519
|
+
message: z.ZodString;
|
|
2520
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2521
|
+
code: z.ZodLiteral<"organization/last_owner">;
|
|
2522
|
+
status: z.ZodLiteral<409>;
|
|
2523
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2524
|
+
message: z.ZodString;
|
|
2525
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2526
|
+
code: z.ZodLiteral<"organization/already_member">;
|
|
2527
|
+
status: z.ZodLiteral<409>;
|
|
2528
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2529
|
+
message: z.ZodString;
|
|
2530
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2531
|
+
code: z.ZodLiteral<"organization/seat_limit_reached">;
|
|
2532
|
+
status: z.ZodLiteral<409>;
|
|
2533
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2534
|
+
message: z.ZodString;
|
|
2535
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2536
|
+
code: z.ZodLiteral<"organization/organization_suspended">;
|
|
2537
|
+
status: z.ZodLiteral<403>;
|
|
2436
2538
|
}, z.core.$strip>, z.ZodObject<{
|
|
2437
2539
|
message: z.ZodString;
|
|
2438
2540
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -2623,6 +2725,20 @@ export declare const ErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<
|
|
|
2623
2725
|
detail: z.ZodOptional<z.ZodString>;
|
|
2624
2726
|
code: z.ZodLiteral<"auth/session_not_fresh">;
|
|
2625
2727
|
status: z.ZodLiteral<403>;
|
|
2728
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2729
|
+
message: z.ZodString;
|
|
2730
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2731
|
+
action: z.ZodOptional<z.ZodString>;
|
|
2732
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
2733
|
+
code: z.ZodLiteral<"auth/account_suspended">;
|
|
2734
|
+
status: z.ZodLiteral<403>;
|
|
2735
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2736
|
+
message: z.ZodString;
|
|
2737
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2738
|
+
action: z.ZodOptional<z.ZodString>;
|
|
2739
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
2740
|
+
code: z.ZodLiteral<"auth/account_deleted">;
|
|
2741
|
+
status: z.ZodLiteral<403>;
|
|
2626
2742
|
}, z.core.$strip>, z.ZodObject<{
|
|
2627
2743
|
message: z.ZodString;
|
|
2628
2744
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -3435,6 +3551,34 @@ export declare const ErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<
|
|
|
3435
3551
|
detail: z.ZodOptional<z.ZodString>;
|
|
3436
3552
|
code: z.ZodLiteral<"organization/nomination_invalid">;
|
|
3437
3553
|
status: z.ZodLiteral<400>;
|
|
3554
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3555
|
+
message: z.ZodString;
|
|
3556
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3557
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3558
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
3559
|
+
code: z.ZodLiteral<"organization/last_owner">;
|
|
3560
|
+
status: z.ZodLiteral<409>;
|
|
3561
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3562
|
+
message: z.ZodString;
|
|
3563
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3564
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3565
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
3566
|
+
code: z.ZodLiteral<"organization/already_member">;
|
|
3567
|
+
status: z.ZodLiteral<409>;
|
|
3568
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3569
|
+
message: z.ZodString;
|
|
3570
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3571
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3572
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
3573
|
+
code: z.ZodLiteral<"organization/seat_limit_reached">;
|
|
3574
|
+
status: z.ZodLiteral<409>;
|
|
3575
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
3576
|
+
message: z.ZodString;
|
|
3577
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
3578
|
+
action: z.ZodOptional<z.ZodString>;
|
|
3579
|
+
detail: z.ZodOptional<z.ZodString>;
|
|
3580
|
+
code: z.ZodLiteral<"organization/organization_suspended">;
|
|
3581
|
+
status: z.ZodLiteral<403>;
|
|
3438
3582
|
}, z.core.$strip>, z.ZodObject<{
|
|
3439
3583
|
message: z.ZodString;
|
|
3440
3584
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/error/payload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AAEH,uFAAuF;AACvF,eAAO,MAAM,eAAe;;;;iBAQqD,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/error/payload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AAEH,uFAAuF;AACvF,eAAO,MAAM,eAAe;;;;iBAQqD,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAswD9D;;;;;GAKG;AACH,eAAO,MAAM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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAItB,CAAC;AACJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,mGAAmG;AACnG,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/error/payload.js
CHANGED
|
@@ -97,6 +97,16 @@ const AuthSessionNotFreshPublic = z.object({
|
|
|
97
97
|
status: z.literal(403).describe("Forbidden — a real, current credential was presented and is not sufficient for this particular decision. Not 401, which is what a caller with no credential gets: a client that cannot tell the two apart does not know whether to re-authenticate or to retry."),
|
|
98
98
|
...publicFields
|
|
99
99
|
}).describe("The session is authentic but the holder authenticated too long ago to attach a provider (403).");
|
|
100
|
+
const AuthAccountSuspendedPublic = z.object({
|
|
101
|
+
code: z.literal("auth/account_suspended").describe("The account this credential belongs to is suspended, so the request is refused whatever it carries. An operator suspended it on purpose, with a reason, and the reason is the `message`. When the suspension has an end, `params.suspendedUntil` names it as ISO-8601; a suspension past its end is no longer one, and nothing has to clear it. A separate code from `auth/forbidden` so a client can render the screen that says what happened rather than a generic refusal."),
|
|
102
|
+
status: z.literal(403).describe("Forbidden — the credential is genuine and the account behind it may not act. Not 401: signing in again cannot help, and a client that read it as an expired token would loop."),
|
|
103
|
+
...publicFields
|
|
104
|
+
}).describe("The account is suspended (403).");
|
|
105
|
+
const AuthAccountDeletedPublic = z.object({
|
|
106
|
+
code: z.literal("auth/account_deleted").describe("The account this credential belongs to is deleted and inside its purge window: it cannot sign in or act, and it can still be restored until the window closes. After the purge there is no account, and the credential is simply invalid."),
|
|
107
|
+
status: z.literal(403).describe("Forbidden — the account exists and may not act. Not 404, because until the purge runs it can come back, and not 401, because signing in again cannot help."),
|
|
108
|
+
...publicFields
|
|
109
|
+
}).describe("The account is deleted and awaiting its purge (403).");
|
|
100
110
|
const NotFoundPublic = z.object({
|
|
101
111
|
code: z.literal("core/not_found").describe("The requested resource does not exist."),
|
|
102
112
|
status: z.literal(404).describe("Not Found."),
|
|
@@ -677,6 +687,26 @@ const OrganizationNominationInvalidPublic = z.object({
|
|
|
677
687
|
status: z.literal(400).describe("Bad Request — no offer this caller may accept."),
|
|
678
688
|
...publicFields
|
|
679
689
|
}).describe("No standing ownership offer this caller may accept (400).");
|
|
690
|
+
const OrganizationLastOwnerPublic = z.object({
|
|
691
|
+
code: z.literal("organization/last_owner").describe("An operator write would leave the account with nobody holding the role a transfer of ownership confers: removing or demoting its only owner. An account with no owner is the unadministrable state membership administration exists to get out of, so the way out is to force ownership onto somebody else first, which `params.ownershipRoute` names."),
|
|
692
|
+
status: z.literal(409).describe("Conflict — an account nobody owns is not a state to arrive at."),
|
|
693
|
+
...publicFields
|
|
694
|
+
}).describe("The last owner cannot be removed or demoted (409).");
|
|
695
|
+
const OrganizationAlreadyMemberPublic = z.object({
|
|
696
|
+
code: z.literal("organization/already_member").describe("An operator tried to add somebody who already holds a membership in the account. One membership per person per organization, so this is a refusal rather than a second row — and `params.role` names the role they already hold, because the next step is a role change rather than an add."),
|
|
697
|
+
status: z.literal(409).describe("Conflict."),
|
|
698
|
+
...publicFields
|
|
699
|
+
}).describe("That person is already a member (409).");
|
|
700
|
+
const OrganizationSeatLimitReachedPublic = z.object({
|
|
701
|
+
code: z.literal("organization/seat_limit_reached").describe("The account holds as many members as its seat limit allows, so another one would exceed it. `params.seatLimit` names the limit. An operator add may override it, and the override is recorded; an invitation accepted against a full account is refused until a seat frees."),
|
|
702
|
+
status: z.literal(409).describe("Conflict."),
|
|
703
|
+
...publicFields
|
|
704
|
+
}).describe("The account has no free seat (409).");
|
|
705
|
+
const OrganizationSuspendedPublic = z.object({
|
|
706
|
+
code: z.literal("organization/organization_suspended").describe("The organization this request acts in is suspended by an operator, so nobody can act in it until it is reinstated (#623). The caller's own account is not affected, and their other organizations are not either. `params.suspendedUntil`, when present, is when the suspension ends by itself, ISO-8601. Not `organization/forbidden`, because no role would let them, and not `organization/not_found`, because the caller is a proved member and already knows the organization exists."),
|
|
707
|
+
status: z.literal(403).describe("Forbidden — the organization may not be acted in, whoever asks."),
|
|
708
|
+
...publicFields
|
|
709
|
+
}).describe("The organization is suspended (403).");
|
|
680
710
|
const ArtifactsNotFoundPublic = z.object({
|
|
681
711
|
code: z.literal("artifacts/not_found").describe("No such repository, **or** one the caller holds no grant on and does not own. One code for both, byte for byte: a repository's name is in its clone URL, and a refusal that told the two apart would hand it over. Also what the credential route answers for a repository with remote access off. Which it was survives in `detail`, which the HTTP codec strips."),
|
|
682
712
|
status: z.literal(404).describe("Not Found."),
|
|
@@ -797,6 +827,8 @@ const KitPublicErrorPayload = z.discriminatedUnion("code", [
|
|
|
797
827
|
ForbiddenPublic,
|
|
798
828
|
AuthProviderUnavailablePublic,
|
|
799
829
|
AuthSessionNotFreshPublic,
|
|
830
|
+
AuthAccountSuspendedPublic,
|
|
831
|
+
AuthAccountDeletedPublic,
|
|
800
832
|
NotFoundPublic,
|
|
801
833
|
ConflictPublic,
|
|
802
834
|
RateLimitPublic,
|
|
@@ -913,6 +945,10 @@ const KitPublicErrorPayload = z.discriminatedUnion("code", [
|
|
|
913
945
|
OrganizationLastAdministratorPublic,
|
|
914
946
|
OrganizationSlugTakenPublic,
|
|
915
947
|
OrganizationNominationInvalidPublic,
|
|
948
|
+
OrganizationLastOwnerPublic,
|
|
949
|
+
OrganizationAlreadyMemberPublic,
|
|
950
|
+
OrganizationSeatLimitReachedPublic,
|
|
951
|
+
OrganizationSuspendedPublic,
|
|
916
952
|
ArtifactsNotFoundPublic,
|
|
917
953
|
ArtifactsForbiddenPublic,
|
|
918
954
|
ArtifactsInvalidNamePublic,
|
|
@@ -943,6 +979,8 @@ const InvalidToken = InvalidTokenPublic.extend(internalFields).describe(InvalidT
|
|
|
943
979
|
const Forbidden = ForbiddenPublic.extend(internalFields).describe(ForbiddenPublic.description ?? "");
|
|
944
980
|
const AuthProviderUnavailable = AuthProviderUnavailablePublic.extend(internalFields).describe(AuthProviderUnavailablePublic.description ?? "");
|
|
945
981
|
const AuthSessionNotFresh = AuthSessionNotFreshPublic.extend(internalFields).describe(AuthSessionNotFreshPublic.description ?? "");
|
|
982
|
+
const AuthAccountSuspended = AuthAccountSuspendedPublic.extend(internalFields).describe(AuthAccountSuspendedPublic.description ?? "");
|
|
983
|
+
const AuthAccountDeleted = AuthAccountDeletedPublic.extend(internalFields).describe(AuthAccountDeletedPublic.description ?? "");
|
|
946
984
|
const NotFound = NotFoundPublic.extend(internalFields).describe(NotFoundPublic.description ?? "");
|
|
947
985
|
const Conflict = ConflictPublic.extend(internalFields).describe(ConflictPublic.description ?? "");
|
|
948
986
|
const RateLimit = RateLimitPublic.extend(internalFields).describe(RateLimitPublic.description ?? "");
|
|
@@ -1069,6 +1107,10 @@ const OrganizationInvitationInvalid = OrganizationInvitationInvalidPublic.extend
|
|
|
1069
1107
|
const OrganizationLastAdministrator = OrganizationLastAdministratorPublic.extend(internalFields).describe(OrganizationLastAdministratorPublic.description ?? "");
|
|
1070
1108
|
const OrganizationSlugTaken = OrganizationSlugTakenPublic.extend(internalFields).describe(OrganizationSlugTakenPublic.description ?? "");
|
|
1071
1109
|
const OrganizationNominationInvalid = OrganizationNominationInvalidPublic.extend(internalFields).describe(OrganizationNominationInvalidPublic.description ?? "");
|
|
1110
|
+
const OrganizationLastOwner = OrganizationLastOwnerPublic.extend(internalFields).describe(OrganizationLastOwnerPublic.description ?? "");
|
|
1111
|
+
const OrganizationAlreadyMember = OrganizationAlreadyMemberPublic.extend(internalFields).describe(OrganizationAlreadyMemberPublic.description ?? "");
|
|
1112
|
+
const OrganizationSeatLimitReached = OrganizationSeatLimitReachedPublic.extend(internalFields).describe(OrganizationSeatLimitReachedPublic.description ?? "");
|
|
1113
|
+
const OrganizationSuspended = OrganizationSuspendedPublic.extend(internalFields).describe(OrganizationSuspendedPublic.description ?? "");
|
|
1072
1114
|
const ArtifactsNotFound = ArtifactsNotFoundPublic.extend(internalFields).describe(ArtifactsNotFoundPublic.description ?? "");
|
|
1073
1115
|
const ArtifactsForbidden = ArtifactsForbiddenPublic.extend(internalFields).describe(ArtifactsForbiddenPublic.description ?? "");
|
|
1074
1116
|
const ArtifactsInvalidName = ArtifactsInvalidNamePublic.extend(internalFields).describe(ArtifactsInvalidNamePublic.description ?? "");
|
|
@@ -1094,6 +1136,8 @@ const KitErrorPayload = z.discriminatedUnion("code", [
|
|
|
1094
1136
|
Forbidden,
|
|
1095
1137
|
AuthProviderUnavailable,
|
|
1096
1138
|
AuthSessionNotFresh,
|
|
1139
|
+
AuthAccountSuspended,
|
|
1140
|
+
AuthAccountDeleted,
|
|
1097
1141
|
NotFound,
|
|
1098
1142
|
Conflict,
|
|
1099
1143
|
RateLimit,
|
|
@@ -1210,6 +1254,10 @@ const KitErrorPayload = z.discriminatedUnion("code", [
|
|
|
1210
1254
|
OrganizationLastAdministrator,
|
|
1211
1255
|
OrganizationSlugTaken,
|
|
1212
1256
|
OrganizationNominationInvalid,
|
|
1257
|
+
OrganizationLastOwner,
|
|
1258
|
+
OrganizationAlreadyMember,
|
|
1259
|
+
OrganizationSeatLimitReached,
|
|
1260
|
+
OrganizationSuspended,
|
|
1213
1261
|
ArtifactsNotFound,
|
|
1214
1262
|
ArtifactsForbidden,
|
|
1215
1263
|
ArtifactsInvalidName,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import type { z } from "zod";
|
|
4
4
|
import type { MessageParams } from "../i18n/catalog";
|
|
5
|
+
import type { UnmarkedString } from "../privacy/types";
|
|
5
6
|
import type { ValidationIssue } from "./payload";
|
|
6
7
|
import { ErrorPayload } from "./payload";
|
|
7
8
|
/**
|
|
@@ -15,18 +16,28 @@ import { ErrorPayload } from "./payload";
|
|
|
15
16
|
*/
|
|
16
17
|
export declare class PithyError extends Error {
|
|
17
18
|
readonly payload: ErrorPayload;
|
|
18
|
-
|
|
19
|
+
/**
|
|
20
|
+
* `message`, `action` and `detail` are each an {@link UnmarkedString} here and on every subclass's arguments
|
|
21
|
+
* (#132): a value marked with a privacy class is refused at compile time, because all three ride into every log
|
|
22
|
+
* line and audit row that carries this error. A template literal is a plain `string`, so interpolation is not caught — see
|
|
23
|
+
* `privacy/types.ts` for exactly what is.
|
|
24
|
+
*/
|
|
25
|
+
constructor(payload: ErrorPayload & {
|
|
26
|
+
message: UnmarkedString;
|
|
27
|
+
action?: UnmarkedString | undefined;
|
|
28
|
+
detail?: UnmarkedString | undefined;
|
|
29
|
+
}, options?: {
|
|
19
30
|
cause?: unknown;
|
|
20
31
|
});
|
|
21
32
|
}
|
|
22
33
|
/** Variable parts every subclass accepts; the `code`/`status` are fixed by the subclass. */
|
|
23
34
|
interface ErrorArgs {
|
|
24
|
-
/** Override the public, safe-to-expose message. Defaults to a per-code summary. */
|
|
25
|
-
message?:
|
|
26
|
-
/** A remediation hint (CLI action line). */
|
|
27
|
-
action?:
|
|
28
|
-
/** Internal context for logs + audit. Never serialized to clients. */
|
|
29
|
-
detail?:
|
|
35
|
+
/** Override the public, safe-to-expose message. Defaults to a per-code summary. Never a privacy-marked value. */
|
|
36
|
+
message?: UnmarkedString;
|
|
37
|
+
/** A remediation hint (CLI action line). Never a privacy-marked value. */
|
|
38
|
+
action?: UnmarkedString;
|
|
39
|
+
/** Internal context for logs + audit. Never serialized to clients, and never a privacy-marked value (#132). */
|
|
40
|
+
detail?: UnmarkedString;
|
|
30
41
|
/**
|
|
31
42
|
* Values a translating client interpolates into its own wording for this code. Client-facing, so —
|
|
32
43
|
* unlike `action` and `detail` — these cross the boundary with `message`. The `code` is the catalog
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pithyError.d.ts","sourceRoot":"","sources":["../../src/error/pithyError.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAE/B,
|
|
1
|
+
{"version":3,"file":"pithyError.d.ts","sourceRoot":"","sources":["../../src/error/pithyError.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAE/B;;;;;OAKG;IACH,YACE,OAAO,EAAE,YAAY,GAAG;QACtB,OAAO,EAAE,cAAc,CAAC;QACxB,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;QACpC,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;KACrC,EACD,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAM9B;C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CAAC,CAAC,QAAQ,EAAE,IAAI,GAAE,SAAc,GAAG,eAAe,CAarF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGjD"}
|
package/dist/error/pithyError.js
CHANGED
|
@@ -13,6 +13,12 @@ import { ErrorPayload } from "./payload.js";
|
|
|
13
13
|
*/
|
|
14
14
|
var PithyError = class extends Error {
|
|
15
15
|
payload;
|
|
16
|
+
/**
|
|
17
|
+
* `message`, `action` and `detail` are each an {@link UnmarkedString} here and on every subclass's arguments
|
|
18
|
+
* (#132): a value marked with a privacy class is refused at compile time, because all three ride into every log
|
|
19
|
+
* line and audit row that carries this error. A template literal is a plain `string`, so interpolation is not caught — see
|
|
20
|
+
* `privacy/types.ts` for exactly what is.
|
|
21
|
+
*/
|
|
16
22
|
constructor(payload, options) {
|
|
17
23
|
const parsed = ErrorPayload.parse(payload);
|
|
18
24
|
super(parsed.message, options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import type { ValidationTargets } from "hono";
|
|
3
|
+
import type { Context, MiddlewareHandler, ValidationTargets } from "hono";
|
|
4
4
|
import type { z } from "zod";
|
|
5
5
|
/**
|
|
6
6
|
* How a route declares what it accepts. Its sibling {@link ./verification.VerificationStrategy}
|
|
@@ -60,12 +60,21 @@ export interface RequestContract {
|
|
|
60
60
|
* app.post(path, requireAuth(), validate("param", BoardParam), validate("json", SubmitScoreBody), handler);
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export declare function validate<Target extends keyof ValidationTargets, Schema extends z.ZodType>(target: Target, schema: Schema):
|
|
63
|
+
export declare function validate<Target extends keyof ValidationTargets, Schema extends z.ZodType>(target: Target, schema: Schema, onInvalid?: InvalidRequestListener): MiddlewareHandler<import("hono").Env, string, {
|
|
64
64
|
in: (undefined extends (Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.core.input<Schema> : never) ? true : false) extends true ? { [K in Target]?: ([Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.core.input<Schema> : never] extends [ValidationTargets[K]] ? ValidationTargets[K] & (Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.core.input<Schema> : never) : import("hono/validator").InferInput<Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.core.input<Schema> : never, K, import("hono/types").ParsedFormValue>) | undefined; } : { [K in Target]: [Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.core.input<Schema> : never] extends [ValidationTargets[K]] ? ValidationTargets[K] & (Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.core.input<Schema> : never) : import("hono/validator").InferInput<Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").input<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.core.input<Schema> : never, K, import("hono/types").ParsedFormValue>; };
|
|
65
65
|
out: { [K in Target]: Schema extends import("zod/v3").ZodType<any, import("zod/v3").ZodTypeDef, any> ? import("zod/v3").output<Schema> : Schema extends z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>> ? z.infer<Schema> : never; };
|
|
66
66
|
}, never> & {
|
|
67
67
|
[REQUEST_CONTRACT]: RequestContract;
|
|
68
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Told when {@link validate} refuses a request — a body that does not parse, or one that fails the schema —
|
|
71
|
+
* before the refusal is thrown. A route whose every attempt must be on the audit trail records the refusal
|
|
72
|
+
* here. It cannot turn the refusal into anything else: the error is thrown after it returns, and a listener
|
|
73
|
+
* that throws replaces it. `input` is what the request sent for the validated part, as it arrived; it is
|
|
74
|
+
* `undefined` when there was nothing to read, as for a body that is not JSON. Input validated by an earlier
|
|
75
|
+
* {@link validate} on the same route is readable with `c.req.valid(target)`.
|
|
76
|
+
*/
|
|
77
|
+
export type InvalidRequestListener = (c: Context, error: unknown, input: unknown) => Promise<void> | void;
|
|
69
78
|
/** The contract a {@link validate} middleware carries, or `undefined` for any other handler. */
|
|
70
79
|
export declare function requestContractOf(handler: unknown): RequestContract | undefined;
|
|
71
80
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/http/validation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/http/validation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAC1E,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAA;CAAE,CAAC;AAEhG;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAG/D;AAED,6GAA6G;AAC7G,eAAO,MAAM,gBAAgB,eAAsC,CAAC;AAEpE,4GAA4G;AAC5G,MAAM,WAAW,eAAe;IAC9B,kGAAkG;IAClG,QAAQ,CAAC,MAAM,EAAE,MAAM,iBAAiB,CAAC;IACzC,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,MAAM,SAAS,MAAM,iBAAiB,EAAE,MAAM,SAAS,CAAC,CAAC,OAAO,EACvF,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,sBAAsB;;;;;EA0BnC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1G,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,SAAS,CAG/E"}
|
package/dist/http/validation.js
CHANGED
|
@@ -23,13 +23,30 @@ const REQUEST_CONTRACT = Symbol.for("pithy.requestContract");
|
|
|
23
23
|
* app.post(path, requireAuth(), validate("param", BoardParam), validate("json", SubmitScoreBody), handler);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
function validate(target, schema) {
|
|
27
|
-
const middleware = zValidator(target, schema, validationHook);
|
|
26
|
+
function validate(target, schema, onInvalid) {
|
|
28
27
|
const contract = {
|
|
29
28
|
target,
|
|
30
29
|
schema
|
|
31
30
|
};
|
|
32
|
-
return Object.assign(
|
|
31
|
+
if (!onInvalid) return Object.assign(zValidator(target, schema, validationHook), { [REQUEST_CONTRACT]: contract });
|
|
32
|
+
const refusedInput = /* @__PURE__ */ new WeakMap();
|
|
33
|
+
const middleware = zValidator(target, schema, (outcome, c) => {
|
|
34
|
+
if (!outcome.success) refusedInput.set(c, outcome.data);
|
|
35
|
+
validationHook(outcome);
|
|
36
|
+
});
|
|
37
|
+
const listened = async (c, next) => {
|
|
38
|
+
let reached = false;
|
|
39
|
+
try {
|
|
40
|
+
return await middleware(c, async () => {
|
|
41
|
+
reached = true;
|
|
42
|
+
await next();
|
|
43
|
+
});
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (!reached) await onInvalid(c, error, refusedInput.get(c));
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return Object.assign(listened, { [REQUEST_CONTRACT]: contract });
|
|
33
50
|
}
|
|
34
51
|
/** The contract a {@link validate} middleware carries, or `undefined` for any other handler. */
|
|
35
52
|
function requestContractOf(handler) {
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { type AdminRouteDrift, missingAdminRoutes } from "./controlPlane/discove
|
|
|
28
28
|
export { type CapabilityHealth, type CapabilityHealthInput, type CapabilityHealthSource, capabilityHealthSources, defineCapabilityHealth, readCapabilityHealth, } from "./controlPlane/discovery/health";
|
|
29
29
|
export { CapabilityHealthReport, type CapabilityHealthWire, HealthCountNominal, HealthNominal, type HealthStanding, HealthSummary, HealthSummaryKey, HealthSummaryValue, HealthValueCost, HealthValueKind, healthAttention, healthReport, healthWire, type NamedHealthValue, namedHealthValues, standingOf, } from "./controlPlane/discovery/healthSummary";
|
|
30
30
|
export { requireControlPlane } from "./controlPlane/http/guard";
|
|
31
|
-
export { ANY_VERIFIED_CALLER, type ControlPlaneRequirement, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, SEAM_SCOPES, } from "./controlPlane/scope/scope";
|
|
31
|
+
export { ANY_VERIFIED_CALLER, type ControlPlaneRequirement, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, PRIVACY_READ_SCOPE, SEAM_SCOPES, } from "./controlPlane/scope/scope";
|
|
32
32
|
export { exportPublicJwk, type MintControlPlaneToken, mintControlPlaneToken } from "./controlPlane/token/mint";
|
|
33
33
|
export { CONTROL_PLANE_HEADER, CONTROL_PLANE_VERSION_CREATED_HEADER, CONTROL_PLANE_VERSION_HEADER, type WorkerBuild, workerBuildChanged, } from "./controlPlane/wire";
|
|
34
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACtG,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,YAAY,EACZ,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACzG,OAAO,EACL,+BAA+B,EAC/B,KAAK,oBAAoB,EACzB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBA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X,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAI/G,OAAO,EACL,oBAAoB,EACpB,oCAAoC,EACpC,4BAA4B,EAC5B,KAAK,WAAW,EAChB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { ANY_VERIFIED_CALLER, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, SEAM_SCOPES } from "./controlPlane/scope/scope.js";
|
|
3
|
+
import { ANY_VERIFIED_CALLER, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, PRIVACY_READ_SCOPE, SEAM_SCOPES } from "./controlPlane/scope/scope.js";
|
|
4
4
|
import { ControlPlaneConfig } from "./controlPlane/config/config.js";
|
|
5
5
|
import { ControlPlaneConnection, Ed25519PublicJwk, RegisteredKey } from "./controlPlane/data/connection.js";
|
|
6
6
|
import { CONTROL_PLANE_CONNECTIONS_TABLE, controlPlaneDatabase } from "./controlPlane/data/tables.js";
|
|
@@ -16,4 +16,4 @@ import { CONTROL_PLANE_KV_BINDING } from "./controlPlane/replay/kvGuard.js";
|
|
|
16
16
|
import { CONTROLPLANE_MIGRATION_ORDER, controlplane, isControlPlaneCapability } from "./controlPlane/capability.js";
|
|
17
17
|
import { missingAdminRoutes } from "./controlPlane/discovery/drift.js";
|
|
18
18
|
import { exportPublicJwk, mintControlPlaneToken } from "./controlPlane/token/mint.js";
|
|
19
|
-
export { ANY_VERIFIED_CALLER, AdminRoute, CONTROLPLANE_MIGRATION_ORDER, CONTROL_PLANE_CONNECTIONS_TABLE, CONTROL_PLANE_HEADER, CONTROL_PLANE_KV_BINDING, CONTROL_PLANE_VERSION_CREATED_HEADER, CONTROL_PLANE_VERSION_HEADER, CapabilityDeclaration, CapabilityDescriptor, CapabilityHealthReport, ControlPlaneAuditActions, ControlPlaneConfig, ControlPlaneConnection, ControlPlaneContext, ControlPlaneManifest, ControlPlaneScope, Ed25519PublicJwk, HealthCountNominal, HealthNominal, HealthSummary, HealthSummaryKey, HealthSummaryValue, HealthValueCost, HealthValueKind, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, ManifestConfigKey, ManifestConfigValue, ManifestConfigValues, RegisteredKey, SEAM_SCOPES, capabilityHealthSources, controlPlaneDatabase, controlplane, defineCapabilityHealth, defineManifestConfig, exportPublicJwk, healthAttention, healthReport, healthWire, isControlPlaneCapability, mintControlPlaneToken, missingAdminRoutes, namedConfigValues, namedHealthValues, readCapabilityHealth, requireControlPlane, standingOf, workerBuildChanged };
|
|
19
|
+
export { ANY_VERIFIED_CALLER, AdminRoute, CONTROLPLANE_MIGRATION_ORDER, CONTROL_PLANE_CONNECTIONS_TABLE, CONTROL_PLANE_HEADER, CONTROL_PLANE_KV_BINDING, CONTROL_PLANE_VERSION_CREATED_HEADER, CONTROL_PLANE_VERSION_HEADER, CapabilityDeclaration, CapabilityDescriptor, CapabilityHealthReport, ControlPlaneAuditActions, ControlPlaneConfig, ControlPlaneConnection, ControlPlaneContext, ControlPlaneManifest, ControlPlaneScope, Ed25519PublicJwk, HealthCountNominal, HealthNominal, HealthSummary, HealthSummaryKey, HealthSummaryValue, HealthValueCost, HealthValueKind, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, ManifestConfigKey, ManifestConfigValue, ManifestConfigValues, PRIVACY_READ_SCOPE, RegisteredKey, SEAM_SCOPES, capabilityHealthSources, controlPlaneDatabase, controlplane, defineCapabilityHealth, defineManifestConfig, exportPublicJwk, healthAttention, healthReport, healthWire, isControlPlaneCapability, mintControlPlaneToken, missingAdminRoutes, namedConfigValues, namedHealthValues, readCapabilityHealth, requireControlPlane, standingOf, workerBuildChanged };
|
package/dist/logger/logger.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
import type { Loggable, UnmarkedString } from "../privacy/types";
|
|
3
4
|
import { type LogFields, type LogLevel, type LogRecord } from "./record";
|
|
4
5
|
/**
|
|
5
6
|
* The `Logger` seam. Four levels, each taking a message plus **structured fields** (not a formatted
|
|
@@ -11,22 +12,28 @@ import { type LogFields, type LogLevel, type LogRecord } from "./record";
|
|
|
11
12
|
* The reserved `error` field on any call may carry a `PithyError` or `ErrorPayload` — the engine lifts
|
|
12
13
|
* it into the record's `error`, `detail` and all. A log is internal; this is the inverse of the HTTP
|
|
13
14
|
* codec, which strips `detail`. The logger must never be wired to a client-facing surface.
|
|
15
|
+
*
|
|
16
|
+
* **A value marked with a privacy class does not compile here** (#132). Every method takes `F & Loggable<F>`,
|
|
17
|
+
* so a field holding a `pii()`/`phi()`/`secret()`/`pci()` value — the value itself, or one inside an object or
|
|
18
|
+
* an array, to the depth `privacy/types.ts` states — is refused at that key, and `redact(Schema, value)` is the
|
|
19
|
+
* way through. The message and a child's name take `UnmarkedString`, so `log.info(user.email)` is refused too. `LogFields` the schema stays permissive: a record that reaches a sink at runtime still parses,
|
|
20
|
+
* because a brand is a type and a parsed log line has none.
|
|
14
21
|
*/
|
|
15
22
|
export interface Logger {
|
|
16
23
|
/** Dev-time diagnostics. Dropped unless the logger's level is `debug`. */
|
|
17
|
-
debug(msg:
|
|
24
|
+
debug<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
|
|
18
25
|
/** Normal operational events. */
|
|
19
|
-
info(msg:
|
|
26
|
+
info<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
|
|
20
27
|
/** A recoverable problem worth attention. */
|
|
21
|
-
warn(msg:
|
|
28
|
+
warn<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
|
|
22
29
|
/** A failure that was observed. Pass `{ error }` (a PithyError) to carry its full payload. */
|
|
23
|
-
error(msg:
|
|
30
|
+
error<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
|
|
24
31
|
/**
|
|
25
32
|
* A namespaced sub-logger. `name` composes as `parent:child`; bound `fields` merge into every record
|
|
26
33
|
* the child emits. Omit `name` (pass `undefined`) to bind fields only — how request-correlation
|
|
27
34
|
* attaches `request`/`method`/`path` without renaming the logger.
|
|
28
35
|
*/
|
|
29
|
-
child(name?:
|
|
36
|
+
child<F extends LogFields = LogFields>(name?: UnmarkedString, fields?: F & Loggable<F>): Logger;
|
|
30
37
|
}
|
|
31
38
|
/** A sink receives a finished {@link LogRecord}. Adapters supply one; the engine builds records and calls it. */
|
|
32
39
|
export type LogSink = (record: LogRecord) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1F
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,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