@payoutjp/core 0.1.0-alpha.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.
Files changed (55) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +11 -0
  3. package/dist/aggregation.d.ts +10 -0
  4. package/dist/aggregation.d.ts.map +1 -0
  5. package/dist/aggregation.js +63 -0
  6. package/dist/aggregation.js.map +1 -0
  7. package/dist/engine.d.ts +12 -0
  8. package/dist/engine.d.ts.map +1 -0
  9. package/dist/engine.js +101 -0
  10. package/dist/engine.js.map +1 -0
  11. package/dist/errors.d.ts +33 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/errors.js +73 -0
  14. package/dist/errors.js.map +1 -0
  15. package/dist/finding.d.ts +76 -0
  16. package/dist/finding.d.ts.map +1 -0
  17. package/dist/finding.js +63 -0
  18. package/dist/finding.js.map +1 -0
  19. package/dist/identifier-schema.d.ts +7 -0
  20. package/dist/identifier-schema.d.ts.map +1 -0
  21. package/dist/identifier-schema.js +24 -0
  22. package/dist/identifier-schema.js.map +1 -0
  23. package/dist/identifiers.d.ts +38 -0
  24. package/dist/identifiers.d.ts.map +1 -0
  25. package/dist/identifiers.js +53 -0
  26. package/dist/identifiers.js.map +1 -0
  27. package/dist/index.d.ts +14 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +13 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/profile.d.ts +69 -0
  32. package/dist/profile.d.ts.map +1 -0
  33. package/dist/profile.js +89 -0
  34. package/dist/profile.js.map +1 -0
  35. package/dist/redaction.d.ts +14 -0
  36. package/dist/redaction.d.ts.map +1 -0
  37. package/dist/redaction.js +41 -0
  38. package/dist/redaction.js.map +1 -0
  39. package/dist/registry.d.ts +64 -0
  40. package/dist/registry.d.ts.map +1 -0
  41. package/dist/registry.js +131 -0
  42. package/dist/registry.js.map +1 -0
  43. package/dist/report.d.ts +209 -0
  44. package/dist/report.d.ts.map +1 -0
  45. package/dist/report.js +160 -0
  46. package/dist/report.js.map +1 -0
  47. package/dist/rule.d.ts +32 -0
  48. package/dist/rule.d.ts.map +1 -0
  49. package/dist/rule.js +2 -0
  50. package/dist/rule.js.map +1 -0
  51. package/dist/status.d.ts +19 -0
  52. package/dist/status.d.ts.map +1 -0
  53. package/dist/status.js +27 -0
  54. package/dist/status.js.map +1 -0
  55. package/package.json +43 -0
@@ -0,0 +1,63 @@
1
+ import { z } from "zod";
2
+ import { ProfileIdSchema, RuleIdSchema } from "./identifier-schema.js";
3
+ import { severityValues } from "./status.js";
4
+ function isNormalizedRelativePath(value) {
5
+ if (value.length === 0 || value.startsWith("/") || value.includes("\\")) {
6
+ return false;
7
+ }
8
+ if (/^[A-Za-z]:\//u.test(value)) {
9
+ return false;
10
+ }
11
+ return value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
12
+ }
13
+ const NormalizedRelativePathSchema = z
14
+ .string()
15
+ .refine(isNormalizedRelativePath, "Expected a normalized relative path");
16
+ const JsonPointerSchema = z
17
+ .string()
18
+ .refine((value) => value === "" || value.startsWith("/"), "Expected a JSON Pointer");
19
+ /** Runtime schema for a safe source or item location attached to a finding. */
20
+ export const FindingLocationV1Schema = z.strictObject({
21
+ file: NormalizedRelativePathSchema.optional(),
22
+ line: z.number().int().positive().optional(),
23
+ column: z.number().int().positive().optional(),
24
+ itemIndex: z.number().int().nonnegative().optional(),
25
+ jsonPointer: JsonPointerSchema.optional(),
26
+ });
27
+ /** Allowed disclosure classifications for already-safe observed values. */
28
+ export const safeObservedValueClassificationValues = Object.freeze([
29
+ "public",
30
+ "masked-bank-account",
31
+ "redacted-account-holder",
32
+ "short-wallet-address",
33
+ "metadata-only",
34
+ ]);
35
+ /**
36
+ * Runtime schema for an observed value that has already passed the applicable redaction policy.
37
+ * Shape validation does not itself redact or prove that `display` is safe.
38
+ */
39
+ export const SafeObservedValueV1Schema = z.strictObject({
40
+ classification: z.enum(safeObservedValueClassificationValues),
41
+ display: z.string(),
42
+ });
43
+ /** Runtime schema for deterministic remediation guidance. */
44
+ export const RemediationV1Schema = z.strictObject({
45
+ code: z.string(),
46
+ message: z.string(),
47
+ });
48
+ /** Runtime schema for the version 1 validation finding contract. */
49
+ export const FindingV1Schema = z.strictObject({
50
+ schemaVersion: z.literal("1"),
51
+ ruleId: RuleIdSchema,
52
+ severity: z.enum(severityValues),
53
+ messageKey: z.string(),
54
+ message: z.string(),
55
+ path: z.string(),
56
+ location: FindingLocationV1Schema.optional(),
57
+ actual: SafeObservedValueV1Schema.optional(),
58
+ expected: z.string().optional(),
59
+ remediation: RemediationV1Schema.optional(),
60
+ profileId: ProfileIdSchema,
61
+ profileVersion: z.string(),
62
+ });
63
+ //# sourceMappingURL=finding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"finding.js","sourceRoot":"","sources":["../src/finding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,SAAS,wBAAwB,CAAC,KAAa;IAC7C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,4BAA4B,GAAG,CAAC;KACnC,M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CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAKH,oEAAoE;AACpE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,YAAY,CAAC;IAC5C,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IAC7B,MAAM,EAAE,YAAY;IACpB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,uBAAuB,CAAC,QAAQ,EAAE;IAC5C,MAAM,EAAE,yBAAyB,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IAC3C,SAAS,EAAE,eAAe;IAC1B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;CAC3B,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ import { type ItemId, type ProfileId, type RegistryId, type RuleId } from "./identifiers.js";
3
+ export declare const RuleIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<RuleId, string>>;
4
+ export declare const ProfileIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ProfileId, string>>;
5
+ export declare const RegistryIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<RegistryId, string>>;
6
+ export declare const ItemIdSchema: z.ZodPipe<z.ZodString, z.ZodTransform<ItemId, string>>;
7
+ //# sourceMappingURL=identifier-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier-schema.d.ts","sourceRoot":"","sources":["../src/identifier-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,MAAM,EACZ,MAAM,kBAAkB,CAAC;AAgB1B,eAAO,MAAM,YAAY,wDAEwE,CAAC;AAElG,eAAO,MAAM,eAAe,2DAIzB,CAAC;AAEJ,eAAO,MAAM,gBAAgB,4DAI1B,CAAC;AAEJ,eAAO,MAAM,YAAY,wDAEwE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { z } from "zod";
2
+ import { createItemId, createProfileId, createRegistryId, createRuleId, } from "./identifiers.js";
3
+ function parseIdentifier(value, context, create, kind) {
4
+ try {
5
+ return create(value);
6
+ }
7
+ catch {
8
+ context.addIssue({ code: "custom", message: `Invalid ${kind}` });
9
+ return z.NEVER;
10
+ }
11
+ }
12
+ export const RuleIdSchema = z
13
+ .string()
14
+ .transform((value, context) => parseIdentifier(value, context, createRuleId, "RuleId"));
15
+ export const ProfileIdSchema = z
16
+ .string()
17
+ .transform((value, context) => parseIdentifier(value, context, createProfileId, "ProfileId"));
18
+ export const RegistryIdSchema = z
19
+ .string()
20
+ .transform((value, context) => parseIdentifier(value, context, createRegistryId, "RegistryId"));
21
+ export const ItemIdSchema = z
22
+ .string()
23
+ .transform((value, context) => parseIdentifier(value, context, createItemId, "ItemId"));
24
+ //# sourceMappingURL=identifier-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier-schema.js","sourceRoot":"","sources":["../src/identifier-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,GAKb,MAAM,kBAAkB,CAAC;AAE1B,SAAS,eAAe,CACtB,KAAa,EACb,OAAwB,EACxB,MAAqC,EACrC,IAAY;IAEZ,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,IAAI,EAAE,EAAE,CAAC,CAAC;QACjE,OAAO,CAAC,CAAC,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,SAAS,CAAC,CAAC,KAAK,EAAE,OAAO,EAAU,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;AAElG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,SAAS,CACR,CAAC,KAAK,EAAE,OAAO,EAAa,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,CAAC,CAC7F,CAAC;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,SAAS,CACR,CAAC,KAAK,EAAE,OAAO,EAAc,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAChG,CAAC;AAEJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,SAAS,CAAC,CAAC,KAAK,EAAE,OAAO,EAAU,EAAE,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,38 @@
1
+ declare const identifierBrand: unique symbol;
2
+ type BrandedIdentifier<Name extends string> = string & {
3
+ readonly [identifierBrand]: Name;
4
+ };
5
+ /** Stable identifier for a validation rule. */
6
+ export type RuleId = BrandedIdentifier<"RuleId">;
7
+ /** Identifier for a compatibility profile, excluding its version. */
8
+ export type ProfileId = BrandedIdentifier<"ProfileId">;
9
+ /** Identifier for a versioned registry, excluding its version. */
10
+ export type RegistryId = BrandedIdentifier<"RegistryId">;
11
+ /** Caller-supplied or deterministically generated validation item identifier. */
12
+ export type ItemId = BrandedIdentifier<"ItemId">;
13
+ /**
14
+ * Creates a stable uppercase, hyphen-separated rule identifier.
15
+ *
16
+ * @throws {TypeError} When the value is empty, malformed, or contains unsafe whitespace/control characters.
17
+ */
18
+ export declare function createRuleId(value: string): RuleId;
19
+ /**
20
+ * Creates a compatibility profile identifier without imposing provider-specific naming rules.
21
+ *
22
+ * @throws {TypeError} When the value is empty or contains surrounding whitespace/control characters.
23
+ */
24
+ export declare function createProfileId(value: string): ProfileId;
25
+ /**
26
+ * Creates a registry identifier without imposing source-specific naming rules.
27
+ *
28
+ * @throws {TypeError} When the value is empty or contains surrounding whitespace/control characters.
29
+ */
30
+ export declare function createRegistryId(value: string): RegistryId;
31
+ /**
32
+ * Creates an item identifier while preserving the caller's non-sensitive stable value.
33
+ *
34
+ * @throws {TypeError} When the value is empty or contains surrounding whitespace/control characters.
35
+ */
36
+ export declare function createItemId(value: string): ItemId;
37
+ export {};
38
+ //# sourceMappingURL=identifiers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAE7C,KAAK,iBAAiB,CAAC,IAAI,SAAS,MAAM,IAAI,MAAM,GAAG;IACrD,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC;CAClC,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAEjD,qEAAqE;AACrE,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAEvD,kEAAkE;AAClE,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;AAEzD,iFAAiF;AACjF,MAAM,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AA8BjD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAExD;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -0,0 +1,53 @@
1
+ const ruleIdPattern = /^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/u;
2
+ function containsControlCharacter(value) {
3
+ for (const character of value) {
4
+ const codePoint = character.codePointAt(0);
5
+ if (codePoint !== undefined && (codePoint <= 0x1f || codePoint === 0x7f)) {
6
+ return true;
7
+ }
8
+ }
9
+ return false;
10
+ }
11
+ function createIdentifier(value, kind) {
12
+ if (value.length === 0 || value !== value.trim() || containsControlCharacter(value)) {
13
+ throw new TypeError(`${kind} must be a non-empty string without surrounding whitespace or control characters`);
14
+ }
15
+ return value;
16
+ }
17
+ /**
18
+ * Creates a stable uppercase, hyphen-separated rule identifier.
19
+ *
20
+ * @throws {TypeError} When the value is empty, malformed, or contains unsafe whitespace/control characters.
21
+ */
22
+ export function createRuleId(value) {
23
+ const id = createIdentifier(value, "RuleId");
24
+ if (!ruleIdPattern.test(id)) {
25
+ throw new TypeError("RuleId must be an uppercase hyphen-separated identifier");
26
+ }
27
+ return id;
28
+ }
29
+ /**
30
+ * Creates a compatibility profile identifier without imposing provider-specific naming rules.
31
+ *
32
+ * @throws {TypeError} When the value is empty or contains surrounding whitespace/control characters.
33
+ */
34
+ export function createProfileId(value) {
35
+ return createIdentifier(value, "ProfileId");
36
+ }
37
+ /**
38
+ * Creates a registry identifier without imposing source-specific naming rules.
39
+ *
40
+ * @throws {TypeError} When the value is empty or contains surrounding whitespace/control characters.
41
+ */
42
+ export function createRegistryId(value) {
43
+ return createIdentifier(value, "RegistryId");
44
+ }
45
+ /**
46
+ * Creates an item identifier while preserving the caller's non-sensitive stable value.
47
+ *
48
+ * @throws {TypeError} When the value is empty or contains surrounding whitespace/control characters.
49
+ */
50
+ export function createItemId(value) {
51
+ return createIdentifier(value, "ItemId");
52
+ }
53
+ //# sourceMappingURL=identifiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAoBA,MAAM,aAAa,GAAG,kCAAkC,CAAC;AAEzD,SAAS,wBAAwB,CAAC,KAAa;IAC7C,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,SAAS,IAAI,IAAI,IAAI,SAAS,KAAK,IAAI,CAAC,EAAE,CAAC;YACzE,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CACvB,KAAa,EACb,IAAU;IAEV,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,KAAK,KAAK,CAAC,IAAI,EAAE,IAAI,wBAAwB,CAAC,KAAK,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,SAAS,CACjB,GAAG,IAAI,kFAAkF,CAC1F,CAAC;IACJ,CAAC;IAED,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE7C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,SAAS,CAAC,yDAAyD,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,gBAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** Placeholder package version for the repository bootstrap. */
2
+ export declare const version = "0.0.0";
3
+ export { aggregateItemStatus, aggregateReportStatus, summarizeValidationItems, } from "./aggregation.js";
4
+ export { compareFindings, executeRules, sortFindings } from "./engine.js";
5
+ export { isPayoutJpError, PayoutJpConfigurationError, type PayoutJpConfigurationErrorCode, PayoutJpError, type PayoutJpErrorCode, payoutJpErrorCodeValues, type PayoutJpErrorExitCode, PayoutJpInputError, PayoutJpIntegrityError, type PayoutJpIntegrityErrorCode, PayoutJpInternalError, } from "./errors.js";
6
+ export { type FindingLocationV1, FindingLocationV1Schema, type FindingV1, FindingV1Schema, type RemediationV1, RemediationV1Schema, type SafeObservedValueV1, SafeObservedValueV1Schema, safeObservedValueClassificationValues, } from "./finding.js";
7
+ export { createItemId, createProfileId, createRegistryId, createRuleId, type ItemId, type ProfileId, type RegistryId, type RuleId, } from "./identifiers.js";
8
+ export { type CompatibilityProfileV1, CompatibilityProfileV1Schema, type LoadCompatibilityProfileV1Options, loadCompatibilityProfileV1, type ProfileRuleParameterParser, type RuleConfigurationV1, RuleConfigurationV1Schema, } from "./profile.js";
9
+ export { type CreateValidationReportV1Input, createValidationReportV1, type ProfileReferenceV1, ProfileReferenceV1Schema, type Rail, railValues, type RegistryReferenceV1, RegistryReferenceV1Schema, type ToolReferenceV1, ToolReferenceV1Schema, type ValidationItemInputV1, type ValidationItemReportV1, ValidationItemReportV1Schema, type ValidationReportV1, ValidationReportV1Schema, type ValidationSummaryV1, ValidationSummaryV1Schema, sortProfileReferences, sortRegistryReferences, } from "./report.js";
10
+ export { createMetadataObservedValue, createPublicObservedValue, maskBankAccountNumber, redactAccountHolder, shortenTokenContract, shortenWalletAddress, } from "./redaction.js";
11
+ export { calculateRegistryEnvelopeSha256, canonicalizeJson, createRegistryEnvelopeV1Schema, type RegistryEnvelopeV1, RegistryEnvelopeV1Schema, type SourceMetadataV1, SourceMetadataV1Schema, loadRegistryEnvelopeV1, } from "./registry.js";
12
+ export type { Rule, RuleContextV1 } from "./rule.js";
13
+ export { isItemStatus, isProfileStatus, isSeverity, type ItemStatus, itemStatusValues, type ProfileStatus, profileStatusValues, type Severity, severityValues, } from "./status.js";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,EACL,eAAe,EACf,0BAA0B,EAC1B,KAAK,8BAA8B,EACnC,aAAa,EACb,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,0BAA0B,EAC/B,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,SAAS,EACd,eAAe,EACf,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,qCAAqC,GACtC,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,MAAM,GACZ,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,iCAAiC,EACtC,0BAA0B,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,6BAA6B,EAClC,wBAAwB,EACxB,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,IAAI,EACT,UAAU,EACV,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,KAAK,eAAe,EACpB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,+BAA+B,EAC/B,gBAAgB,EAChB,8BAA8B,EAC9B,KAAK,kBAAkB,EACvB,wBAAwB,EACxB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EACL,YAAY,EACZ,eAAe,EACf,UAAU,EACV,KAAK,UAAU,EACf,gBAAgB,EAChB,KAAK,aAAa,EAClB,mBAAmB,EACnB,KAAK,QAAQ,EACb,cAAc,GACf,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /** Placeholder package version for the repository bootstrap. */
2
+ export const version = "0.0.0";
3
+ export { aggregateItemStatus, aggregateReportStatus, summarizeValidationItems, } from "./aggregation.js";
4
+ export { compareFindings, executeRules, sortFindings } from "./engine.js";
5
+ export { isPayoutJpError, PayoutJpConfigurationError, PayoutJpError, payoutJpErrorCodeValues, PayoutJpInputError, PayoutJpIntegrityError, PayoutJpInternalError, } from "./errors.js";
6
+ export { FindingLocationV1Schema, FindingV1Schema, RemediationV1Schema, SafeObservedValueV1Schema, safeObservedValueClassificationValues, } from "./finding.js";
7
+ export { createItemId, createProfileId, createRegistryId, createRuleId, } from "./identifiers.js";
8
+ export { CompatibilityProfileV1Schema, loadCompatibilityProfileV1, RuleConfigurationV1Schema, } from "./profile.js";
9
+ export { createValidationReportV1, ProfileReferenceV1Schema, railValues, RegistryReferenceV1Schema, ToolReferenceV1Schema, ValidationItemReportV1Schema, ValidationReportV1Schema, ValidationSummaryV1Schema, sortProfileReferences, sortRegistryReferences, } from "./report.js";
10
+ export { createMetadataObservedValue, createPublicObservedValue, maskBankAccountNumber, redactAccountHolder, shortenTokenContract, shortenWalletAddress, } from "./redaction.js";
11
+ export { calculateRegistryEnvelopeSha256, canonicalizeJson, createRegistryEnvelopeV1Schema, RegistryEnvelopeV1Schema, SourceMetadataV1Schema, loadRegistryEnvelopeV1, } from "./registry.js";
12
+ export { isItemStatus, isProfileStatus, isSeverity, itemStatusValues, profileStatusValues, severityValues, } from "./status.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,EACL,eAAe,EACf,0BAA0B,EAE1B,aAAa,EAEb,uBAAuB,EAEvB,kBAAkB,EAClB,sBAAsB,EAEtB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,uBAAuB,EAEvB,eAAe,EAEf,mBAAmB,EAEnB,yBAAyB,EACzB,qCAAqC,GACtC,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,GAKb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAEL,4BAA4B,EAE5B,0BAA0B,EAG1B,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAEL,wBAAwB,EAExB,wBAAwB,EAExB,UAAU,EAEV,yBAAyB,EAEzB,qBAAqB,EAGrB,4BAA4B,EAE5B,wBAAwB,EAExB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,+BAA+B,EAC/B,gBAAgB,EAChB,8BAA8B,EAE9B,wBAAwB,EAExB,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,UAAU,EAEV,gBAAgB,EAEhB,mBAAmB,EAEnB,cAAc,GACf,MAAM,aAAa,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { z } from "zod";
2
+ /** Runtime schema for one rule entry in a compatibility profile. */
3
+ export declare const RuleConfigurationV1Schema: z.ZodObject<{
4
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").RuleId, string>>;
5
+ enabled: z.ZodBoolean;
6
+ severity: z.ZodOptional<z.ZodEnum<{
7
+ error: "error";
8
+ info: "info";
9
+ warning: "warning";
10
+ }>>;
11
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
12
+ }, z.core.$strict>;
13
+ /** One rule entry in a compatibility profile. */
14
+ export type RuleConfigurationV1 = z.infer<typeof RuleConfigurationV1Schema>;
15
+ /** Runtime schema for an immutable version 1 compatibility profile artifact. */
16
+ export declare const CompatibilityProfileV1Schema: z.ZodObject<{
17
+ schemaVersion: z.ZodLiteral<"1">;
18
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").ProfileId, string>>;
19
+ version: z.ZodString;
20
+ status: z.ZodEnum<{
21
+ deprecated: "deprecated";
22
+ experimental: "experimental";
23
+ retired: "retired";
24
+ verified: "verified";
25
+ }>;
26
+ rail: z.ZodEnum<{
27
+ bank_transfer: "bank_transfer";
28
+ jpyc: "jpyc";
29
+ }>;
30
+ title: z.ZodString;
31
+ description: z.ZodString;
32
+ rules: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").RuleId, string>>;
34
+ enabled: z.ZodBoolean;
35
+ severity: z.ZodOptional<z.ZodEnum<{
36
+ error: "error";
37
+ info: "info";
38
+ warning: "warning";
39
+ }>>;
40
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
41
+ }, z.core.$strict>>;
42
+ registries: z.ZodArray<z.ZodObject<{
43
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<import("./identifiers.js").RegistryId, string>>;
44
+ version: z.ZodString;
45
+ sha256: z.ZodString;
46
+ }, z.core.$strict>>;
47
+ sourceNotes: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ }, z.core.$strict>;
49
+ /** Version 1 compatibility profile inferred from {@link CompatibilityProfileV1Schema}. */
50
+ export type CompatibilityProfileV1 = z.infer<typeof CompatibilityProfileV1Schema>;
51
+ /** Minimal rule capability required while loading a Profile. */
52
+ export interface ProfileRuleParameterParser {
53
+ readonly id: RuleConfigurationV1["id"];
54
+ parseParams(input: unknown): unknown;
55
+ }
56
+ /** Explicit policy and rule catalog used to load one Profile artifact. */
57
+ export interface LoadCompatibilityProfileV1Options {
58
+ readonly rules: Iterable<ProfileRuleParameterParser>;
59
+ readonly allowExperimental?: boolean;
60
+ readonly allowRetired?: boolean;
61
+ }
62
+ /**
63
+ * Loads and validates a decoded Profile without file or network access.
64
+ *
65
+ * Rule-specific parameter errors are deliberately replaced with a fixed safe
66
+ * message so a parser cannot leak raw Profile values through this boundary.
67
+ */
68
+ export declare function loadCompatibilityProfileV1(input: unknown, options: LoadCompatibilityProfileV1Options): CompatibilityProfileV1;
69
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,oEAAoE;AACpE,eAAO,MAAM,yBAAyB;;;;;;;;;kBAKpC,CAAC;AAEH,iDAAiD;AACjD,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AA6B5E,gFAAgF;AAChF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAWvC,CAAC;AAEH,0FAA0F;AAC1F,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,gEAAgE;AAChE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACvC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;CACtC;AAED,0EAA0E;AAC1E,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,0BAA0B,CAAC,CAAC;IACrD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC;AAiBD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,iCAAiC,GACzC,sBAAsB,CA8BxB"}
@@ -0,0 +1,89 @@
1
+ import { z } from "zod";
2
+ import { PayoutJpConfigurationError } from "./errors.js";
3
+ import { ProfileIdSchema, RuleIdSchema } from "./identifier-schema.js";
4
+ import { railValues, RegistryReferenceV1Schema } from "./report.js";
5
+ import { profileStatusValues, severityValues } from "./status.js";
6
+ const NonEmptyStringSchema = z.string().min(1);
7
+ /** Runtime schema for one rule entry in a compatibility profile. */
8
+ export const RuleConfigurationV1Schema = z.strictObject({
9
+ id: RuleIdSchema,
10
+ enabled: z.boolean(),
11
+ severity: z.enum(severityValues).optional(),
12
+ params: z.record(z.string(), z.unknown()).optional(),
13
+ });
14
+ function rejectDuplicateIds(entries, context, kind) {
15
+ const seen = new Set();
16
+ entries.forEach((entry, index) => {
17
+ if (seen.has(entry.id)) {
18
+ context.addIssue({
19
+ code: "custom",
20
+ message: `Duplicate ${kind} ID`,
21
+ path: [index, "id"],
22
+ });
23
+ }
24
+ seen.add(entry.id);
25
+ });
26
+ }
27
+ const ProfileRulesSchema = z
28
+ .array(RuleConfigurationV1Schema)
29
+ .superRefine((rules, context) => rejectDuplicateIds(rules, context, "rule"));
30
+ const ProfileRegistriesSchema = z
31
+ .array(RegistryReferenceV1Schema)
32
+ .superRefine((registries, context) => rejectDuplicateIds(registries, context, "registry"));
33
+ /** Runtime schema for an immutable version 1 compatibility profile artifact. */
34
+ export const CompatibilityProfileV1Schema = z.strictObject({
35
+ schemaVersion: z.literal("1"),
36
+ id: ProfileIdSchema,
37
+ version: NonEmptyStringSchema,
38
+ status: z.enum(profileStatusValues),
39
+ rail: z.enum(railValues),
40
+ title: NonEmptyStringSchema,
41
+ description: NonEmptyStringSchema,
42
+ rules: ProfileRulesSchema,
43
+ registries: ProfileRegistriesSchema,
44
+ sourceNotes: z.array(NonEmptyStringSchema).optional(),
45
+ });
46
+ function indexRuleParsers(rules) {
47
+ const parsers = new Map();
48
+ for (const rule of rules) {
49
+ if (parsers.has(rule.id)) {
50
+ throw new PayoutJpConfigurationError("PJP_RULE_DUPLICATE");
51
+ }
52
+ parsers.set(rule.id, rule);
53
+ }
54
+ return parsers;
55
+ }
56
+ /**
57
+ * Loads and validates a decoded Profile without file or network access.
58
+ *
59
+ * Rule-specific parameter errors are deliberately replaced with a fixed safe
60
+ * message so a parser cannot leak raw Profile values through this boundary.
61
+ */
62
+ export function loadCompatibilityProfileV1(input, options) {
63
+ const parsed = CompatibilityProfileV1Schema.safeParse(input);
64
+ if (!parsed.success) {
65
+ throw new PayoutJpConfigurationError("PJP_PROFILE_INVALID");
66
+ }
67
+ const profile = parsed.data;
68
+ if (profile.status === "experimental" && options.allowExperimental !== true) {
69
+ throw new PayoutJpConfigurationError("PJP_PROFILE_STATUS_NOT_ALLOWED");
70
+ }
71
+ if (profile.status === "retired" && options.allowRetired !== true) {
72
+ throw new PayoutJpConfigurationError("PJP_PROFILE_STATUS_NOT_ALLOWED");
73
+ }
74
+ const parsers = indexRuleParsers(options.rules);
75
+ for (const configuration of profile.rules) {
76
+ const rule = parsers.get(configuration.id);
77
+ if (rule === undefined) {
78
+ throw new PayoutJpConfigurationError("PJP_RULE_UNKNOWN");
79
+ }
80
+ try {
81
+ rule.parseParams(configuration.params);
82
+ }
83
+ catch {
84
+ throw new PayoutJpConfigurationError("PJP_RULE_PARAMS_INVALID");
85
+ }
86
+ }
87
+ return profile;
88
+ }
89
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,U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AAC;IAC7D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,0BAA0B,CAAC,qBAAqB,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;IAE5B,IAAI,OAAO,CAAC,MAAM,KAAK,cAAc,IAAI,OAAO,CAAC,iBAAiB,KAAK,IAAI,EAAE,CAAC;QAC5E,MAAM,IAAI,0BAA0B,CAAC,gCAAgC,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;QAClE,MAAM,IAAI,0BAA0B,CAAC,gCAAgC,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAEhD,KAAK,MAAM,aAAa,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAC3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,IAAI,0BAA0B,CAAC,kBAAkB,CAAC,CAAC;QAC3D,CAAC;QAED,IAAI,CAAC;YACH,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,0BAA0B,CAAC,yBAAyB,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { SafeObservedValueV1 } from "./finding.js";
2
+ /** Marks an explicitly public value as safe for finding output. */
3
+ export declare function createPublicObservedValue(display: string): SafeObservedValueV1;
4
+ /** Emits caller-provided non-sensitive metadata without attaching a source value. */
5
+ export declare function createMetadataObservedValue(display: string): SafeObservedValueV1;
6
+ /** Fully redacts an account holder value regardless of its content or length. */
7
+ export declare function redactAccountHolder(_value: unknown): SafeObservedValueV1;
8
+ /** Masks a bank account number while preserving at most its final two characters. */
9
+ export declare function maskBankAccountNumber(value: string): SafeObservedValueV1;
10
+ /** Shortens a public wallet address for normal finding output. */
11
+ export declare function shortenWalletAddress(value: string): SafeObservedValueV1;
12
+ /** Shortens a public token contract address using the wallet-address disclosure policy. */
13
+ export declare function shortenTokenContract(value: string): SafeObservedValueV1;
14
+ //# sourceMappingURL=redaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAMxD,mEAAmE;AACnE,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAE9E;AAED,qFAAqF;AACrF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAEhF;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CAExE;AAED,qFAAqF;AACrF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAQxE;AAaD,kEAAkE;AAClE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAEvE;AAED,2FAA2F;AAC3F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAEvE"}
@@ -0,0 +1,41 @@
1
+ const redactedDisplay = "<redacted>";
2
+ const maskCharacter = "*";
3
+ const shortenedSeparator = "…";
4
+ /** Marks an explicitly public value as safe for finding output. */
5
+ export function createPublicObservedValue(display) {
6
+ return { classification: "public", display };
7
+ }
8
+ /** Emits caller-provided non-sensitive metadata without attaching a source value. */
9
+ export function createMetadataObservedValue(display) {
10
+ return { classification: "metadata-only", display };
11
+ }
12
+ /** Fully redacts an account holder value regardless of its content or length. */
13
+ export function redactAccountHolder(_value) {
14
+ return { classification: "redacted-account-holder", display: redactedDisplay };
15
+ }
16
+ /** Masks a bank account number while preserving at most its final two characters. */
17
+ export function maskBankAccountNumber(value) {
18
+ const characters = [...value];
19
+ const visibleCharacters = characters.length > 2 ? characters.slice(-2) : [];
20
+ const maskedLength = characters.length - visibleCharacters.length;
21
+ const display = `${maskCharacter.repeat(maskedLength)}${visibleCharacters.join("")}` || redactedDisplay;
22
+ return { classification: "masked-bank-account", display };
23
+ }
24
+ function shortenAddress(value) {
25
+ const prefixLength = 6;
26
+ const suffixLength = 4;
27
+ const minimumAddressLikeLength = 20;
28
+ if (value.length < minimumAddressLikeLength) {
29
+ return redactedDisplay;
30
+ }
31
+ return `${value.slice(0, prefixLength)}${shortenedSeparator}${value.slice(-suffixLength)}`;
32
+ }
33
+ /** Shortens a public wallet address for normal finding output. */
34
+ export function shortenWalletAddress(value) {
35
+ return { classification: "short-wallet-address", display: shortenAddress(value) };
36
+ }
37
+ /** Shortens a public token contract address using the wallet-address disclosure policy. */
38
+ export function shortenTokenContract(value) {
39
+ return { classification: "short-wallet-address", display: shortenAddress(value) };
40
+ }
41
+ //# sourceMappingURL=redaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction.js","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,mEAAmE;AACnE,MAAM,UAAU,yBAAyB,CAAC,OAAe;IACvD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AAC/C,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,2BAA2B,CAAC,OAAe;IACzD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;AACtD,CAAC;AAED,iFAAiF;A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,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;AACpF,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ import type { RegistryId } from "./identifiers.js";
3
+ /** Runtime schema for provenance attached to a Registry snapshot. */
4
+ export declare const SourceMetadataV1Schema: z.ZodObject<{
5
+ publisher: z.ZodString;
6
+ uri: z.ZodString;
7
+ retrievedAt: z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>;
8
+ effectiveAsOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
9
+ license: z.ZodOptional<z.ZodString>;
10
+ notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ }, z.core.$strict>;
12
+ /** Provenance attached to a Registry snapshot. */
13
+ export type SourceMetadataV1 = z.infer<typeof SourceMetadataV1Schema>;
14
+ /** Immutable version 1 Registry envelope with a payload-specific type. */
15
+ export interface RegistryEnvelopeV1<TPayload = unknown> {
16
+ readonly schemaVersion: "1";
17
+ readonly id: RegistryId;
18
+ readonly version: string;
19
+ readonly kind: string;
20
+ readonly sha256: string;
21
+ readonly source: SourceMetadataV1;
22
+ readonly payload: TPayload;
23
+ }
24
+ /** Creates a strict Registry envelope schema for one payload contract. */
25
+ export declare function createRegistryEnvelopeV1Schema<TPayload>(payloadSchema: z.ZodType<TPayload>): z.ZodObject<{
26
+ schemaVersion: z.ZodLiteral<"1">;
27
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<RegistryId, string>>;
28
+ version: z.ZodString;
29
+ kind: z.ZodString;
30
+ sha256: z.ZodString;
31
+ source: z.ZodObject<{
32
+ publisher: z.ZodString;
33
+ uri: z.ZodString;
34
+ retrievedAt: z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>;
35
+ effectiveAsOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
36
+ license: z.ZodOptional<z.ZodString>;
37
+ notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
+ }, z.core.$strict>;
39
+ payload: z.ZodType<TPayload, unknown, z.core.$ZodTypeInternals<TPayload, unknown>>;
40
+ }, z.core.$strict>;
41
+ /** Runtime schema for a Registry envelope whose payload contract is not yet selected. */
42
+ export declare const RegistryEnvelopeV1Schema: z.ZodObject<{
43
+ schemaVersion: z.ZodLiteral<"1">;
44
+ id: z.ZodPipe<z.ZodString, z.ZodTransform<RegistryId, string>>;
45
+ version: z.ZodString;
46
+ kind: z.ZodString;
47
+ sha256: z.ZodString;
48
+ source: z.ZodObject<{
49
+ publisher: z.ZodString;
50
+ uri: z.ZodString;
51
+ retrievedAt: z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>;
52
+ effectiveAsOf: z.ZodOptional<z.ZodUnion<readonly [z.ZodISODate, z.ZodISODateTime]>>;
53
+ license: z.ZodOptional<z.ZodString>;
54
+ notes: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
+ }, z.core.$strict>;
56
+ payload: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
57
+ }, z.core.$strict>;
58
+ /** Serializes finite JSON data with recursively sorted object keys and preserved array order. */
59
+ export declare function canonicalizeJson(value: unknown): string;
60
+ /** Calculates the lowercase SHA-256 for a Registry envelope with its digest field omitted. */
61
+ export declare function calculateRegistryEnvelopeSha256(input: unknown): string;
62
+ /** Loads a decoded local Registry and verifies its payload contract and content digest. */
63
+ export declare function loadRegistryEnvelopeV1<TPayload = unknown>(input: unknown, payloadSchema?: z.ZodType<TPayload>): RegistryEnvelopeV1<TPayload>;
64
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EA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