@arkyc/core 2.0.0 → 2.1.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.
@@ -1,19 +1,18 @@
1
1
  import { Id, OrganizationScoped } from "@arkyc/types";
2
-
3
2
  //#region src/context.d.ts
4
3
  /** Identifies the organization + project a request or entity belongs to. */
5
- interface OrganizationProjectContext {
4
+ export interface OrganizationProjectContext {
6
5
  organizationId: Id;
7
6
  projectId: Id;
8
7
  }
9
8
  /**
10
9
  * Thrown when an entity is accessed outside its organization/project scope.
11
10
  */
12
- declare class OrganizationScopeError extends Error {
11
+ export declare class OrganizationScopeError extends Error {
13
12
  constructor(message?: string);
14
13
  }
15
14
  /** Organization/project scoping and storage-path helpers. */
16
- declare class OrganizationContext {
15
+ export declare class OrganizationContext {
17
16
  /**
18
17
  * Whether `entity` belongs to the given organization.
19
18
  *
@@ -44,5 +43,4 @@ declare class OrganizationContext {
44
43
  static storagePath(ctx: OrganizationProjectContext, sessionId: Id, ...parts: string[]): string;
45
44
  }
46
45
  //#endregion
47
- export { OrganizationContext, OrganizationProjectContext, OrganizationScopeError };
48
46
  //# sourceMappingURL=context.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.mts","names":[],"sources":["../src/context.ts"],"mappings":";;;;UAGiB,0BAAA;EACf,cAAA,EAAgB,EAAA;EAChB,SAAA,EAAW,EAAE;AAAA;;;;cAMF,sBAAA,SAA+B,KAAK;cACnC,OAAA;AAAA;AAPC;AAAA,cAcF,mBAAA;EARuB;;;;;;;EAAA,OAgB3B,SAAA,CAAU,MAAA,EAAQ,kBAAA,EAAoB,cAAA,EAAgB,EAAA;EARlD;;;;;;;;EAAA,OAoBJ,WAAA,WAAsB,kBAAA,EAAoB,MAAA,EAAQ,CAAA,EAAG,cAAA,EAAgB,EAAA,GAAK,CAAA;EAiBzD;;;;;;;;;;EAAA,OAAjB,WAAA,CAAY,GAAA,EAAK,0BAAA,EAA4B,SAAA,EAAW,EAAA,KAAO,KAAA;AAAA"}
1
+ {"version":3,"file":"context.d.mts","names":[],"sources":["../src/context.ts"],"mappings":";;;iBAGiB;EACf,gBAAgB;EAChB,WAAW;;;;;qBAMA,+BAA+B;EAC9B,YAAA;;;qBAOD;;;;;;;;SAQJ,UAAU,QAAQ,oBAAoB,gBAAgB;;;;;;;;;SAYtD,YAAY,UAAU,oBAAoB,QAAQ,GAAG,gBAAgB,KAAK;;;;;;;;;;;SAiB1E,YAAY,KAAK,4BAA4B,WAAW,OAAO"}
@@ -1,8 +1,7 @@
1
1
  import { DecisionReason, RiskSignal, VerificationDecision, VerificationThresholds } from "@arkyc/types";
2
-
3
2
  //#region src/decision.d.ts
4
3
  /** Document signals fed to the decision engine. */
5
- interface DecisionDocumentInput {
4
+ export interface DecisionDocumentInput {
6
5
  /** Document image quality in [0, 1]. */
7
6
  qualityScore: number;
8
7
  /** OCR extraction confidence in [0, 1]. */
@@ -11,7 +10,7 @@ interface DecisionDocumentInput {
11
10
  expired: boolean;
12
11
  }
13
12
  /** Liveness signals fed to the decision engine. */
14
- interface DecisionLivenessInput {
13
+ export interface DecisionLivenessInput {
15
14
  passed: boolean;
16
15
  /** Liveness confidence in [0, 1]. */
17
16
  score: number;
@@ -19,13 +18,13 @@ interface DecisionLivenessInput {
19
18
  multipleFaces?: boolean;
20
19
  }
21
20
  /** Face-match signals fed to the decision engine. */
22
- interface DecisionFaceMatchInput {
21
+ export interface DecisionFaceMatchInput {
23
22
  passed: boolean;
24
23
  /** Similarity between document portrait and selfie in [0, 1]. */
25
24
  similarityScore: number;
26
25
  }
27
26
  /** Address-verification signals fed to the decision engine. */
28
- interface DecisionAddressInput {
27
+ export interface DecisionAddressInput {
29
28
  passed: boolean;
30
29
  /** Overall address-verification confidence in [0, 1]. */
31
30
  score: number;
@@ -43,7 +42,7 @@ interface DecisionAddressInput {
43
42
  threshold?: number;
44
43
  }
45
44
  /** The complete set of signals the decision engine evaluates. */
46
- interface DecisionInput {
45
+ export interface DecisionInput {
47
46
  document: DecisionDocumentInput;
48
47
  liveness: DecisionLivenessInput;
49
48
  faceMatch: DecisionFaceMatchInput;
@@ -52,14 +51,14 @@ interface DecisionInput {
52
51
  signals?: RiskSignal[];
53
52
  }
54
53
  /** The decision engine's verdict for a session. */
55
- interface DecisionResult {
54
+ export interface DecisionResult {
56
55
  decision: VerificationDecision;
57
56
  reason: DecisionReason;
58
57
  /** Aggregate risk score in [0, 1] (higher = riskier). */
59
58
  riskScore: number;
60
59
  }
61
60
  /** Deterministic verification decision engine. */
62
- declare class DecisionEngine {
61
+ export declare class DecisionEngine {
63
62
  /**
64
63
  * Decide a verification outcome from the gathered signals.
65
64
  *
@@ -79,5 +78,4 @@ declare class DecisionEngine {
79
78
  static decide(input: DecisionInput, thresholds?: Partial<VerificationThresholds>): DecisionResult;
80
79
  }
81
80
  //#endregion
82
- export { DecisionAddressInput, DecisionDocumentInput, DecisionEngine, DecisionFaceMatchInput, DecisionInput, DecisionLivenessInput, DecisionResult };
83
81
  //# sourceMappingURL=decision.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decision.d.mts","names":[],"sources":["../src/decision.ts"],"mappings":";;;;UAOiB,qBAAA;EAAA;EAEf,YAAA;;EAEA,aAAA;EAFA;EAIA,OAAA;AAAA;;UAIe,qBAAA;EACf,MAAA;EADoC;EAGpC,KAAA;EAHoC;EAKpC,aAAA;AAAA;;UAIe,sBAAA;EACf,MAAA;EADe;EAGf,eAAe;AAAA;;UAIA,oBAAA;EACf,MAAA;EADmC;EAGnC,KAAA;EAHmC;;;;;EASnC,MAAA;EAMS;AAIX;;;;EAJE,SAAA;AAAA;;UAIe,aAAA;EACf,QAAA,EAAU,qBAAA;EACV,QAAA,EAAU,qBAAA;EACV,SAAA,EAAW,sBAAA;EACX,OAAA,EAAS,oBAAA;EAFT;EAIA,OAAA,GAAU,UAAA;AAAA;;UAIK,cAAA;EACf,QAAA,EAAU,oBAAA;EACV,MAAA,EAAQ,cAAc;EANZ;EAQV,SAAA;AAAA;AAJF;AAAA,cAQa,cAAA;;;;;;;;;AAJF;AAIX;;;;;;;SAiBS,MAAA,CAAO,KAAA,EAAO,aAAA,EAAe,UAAA,GAAa,OAAA,CAAQ,sBAAA,IAA0B,cAAA;AAAA"}
1
+ {"version":3,"file":"decision.d.mts","names":[],"sources":["../src/decision.ts"],"mappings":";;;iBAOiB;;EAEf;;EAEA;;EAEA;;;iBAIe;EACf;;EAEA;;EAEA;;;iBAIe;EACf;;EAEA;;;iBAIe;EACf;;EAEA;;;;;;EAMA;;;;;;EAMA;;;iBAIe;EACf,UAAU;EACV,UAAU;EACV,WAAW;EACX,SAAS;;EAET,UAAU;;;iBAIK;EACf,UAAU;EACV,QAAQ;;EAER;;;qBAIW;;;;;;;;;;;;;;;;;SAiBJ,OAAO,OAAO,eAAe,aAAa,QAAQ,0BAA0B"}
@@ -1,12 +1,11 @@
1
1
  import { DecisionInput } from "./decision.mjs";
2
2
  import { AddressOnFail, AddressResultData, FaceMatchResultData, IsoDateTime, LivenessResultData, OcrResultData, WebhookChecks } from "@arkyc/types";
3
-
4
3
  //#region src/normalize.d.ts
5
4
  /**
6
5
  * The raw provider outputs gathered for a session, plus the document quality.
7
6
  * `address` is only present when the (opt-in) address stage ran.
8
7
  */
9
- interface SessionSignals {
8
+ export interface SessionSignals {
10
9
  documentQualityScore: number;
11
10
  ocr: OcrResultData;
12
11
  liveness: LivenessResultData;
@@ -17,7 +16,7 @@ interface SessionSignals {
17
16
  addressOnFail?: AddressOnFail;
18
17
  }
19
18
  /** Normalisation of gathered provider results into engine/webhook shapes. */
20
- declare class Normalize {
19
+ export declare class Normalize {
21
20
  /**
22
21
  * Normalise gathered provider results into the flat {@link DecisionInput} the
23
22
  * decision engine consumes. Document expiry is derived from the OCR `expiryDate`
@@ -39,5 +38,4 @@ declare class Normalize {
39
38
  static toWebhookChecks(signals: SessionSignals, now: IsoDateTime | Date): WebhookChecks;
40
39
  }
41
40
  //#endregion
42
- export { Normalize, SessionSignals };
43
41
  //# sourceMappingURL=normalize.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.d.mts","names":[],"sources":["../src/normalize.ts"],"mappings":";;;;;;AAiBA;;UAAiB,cAAA;EACf,oBAAA;EACA,GAAA,EAAK,aAAA;EACL,QAAA,EAAU,kBAAA;EACV,SAAA,EAAW,mBAAA;EAIK;EAFhB,OAAA,GAAU,iBAAA;EAEmB;EAA7B,aAAA,GAAgB,aAAA;AAAA;;cAIL,SAAA;EATD;;;;;;;;AAKmB;EALnB,OAmBH,eAAA,CAAgB,OAAA,EAAS,cAAA,EAAgB,GAAA,EAAK,WAAA,GAAc,IAAA,GAAO,aAAA;EAVtD;;;;;;;;EAAA,OAyCb,eAAA,CAAgB,OAAA,EAAS,cAAA,EAAgB,GAAA,EAAK,WAAA,GAAc,IAAA,GAAO,aAAA;AAAA"}
1
+ {"version":3,"file":"normalize.d.mts","names":[],"sources":["../src/normalize.ts"],"mappings":";;;;;;;iBAiBiB;EACf;EACA,KAAK;EACL,UAAU;EACV,WAAW;;EAEX,UAAU;;EAEV,gBAAgB;;;qBAIL;;;;;;;;;;SAUJ,gBAAgB,SAAS,gBAAgB,KAAK,cAAc,OAAO;;;;;;;;;SA+BnE,gBAAgB,SAAS,gBAAgB,KAAK,cAAc,OAAO"}
package/dist/risk.d.mts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { DecisionInput } from "./decision.mjs";
2
-
3
2
  //#region src/risk.d.ts
4
3
  /** Aggregate risk scoring for a verification session. */
5
- declare class Risk {
4
+ export declare class Risk {
6
5
  /**
7
6
  * Clamp a number into the [0, 1] range.
8
7
  *
@@ -26,5 +25,4 @@ declare class Risk {
26
25
  static score(input: DecisionInput): number;
27
26
  }
28
27
  //#endregion
29
- export { Risk };
30
28
  //# sourceMappingURL=risk.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"risk.d.mts","names":[],"sources":["../src/risk.ts"],"mappings":";;;;cASa,IAAA;EAAA;;;;;;EAAA,OAOJ,OAAA,CAAQ,KAAA;EAkBK;;;AAAa;;;;;;;;;;EAAb,OAAb,KAAA,CAAM,KAAA,EAAO,aAAa;AAAA"}
1
+ {"version":3,"file":"risk.d.mts","names":[],"sources":["../src/risk.ts"],"mappings":";;;qBASa;;;;;;;SAOJ,QAAQ;;;;;;;;;;;;;;SAkBR,MAAM,OAAO"}
@@ -1,8 +1,7 @@
1
1
  import { IsoDate, IsoDateTime, VerificationStatus } from "@arkyc/types";
2
-
3
2
  //#region src/session.d.ts
4
3
  /** Pure session/document expiry rules. */
5
- declare class SessionRules {
4
+ export declare class SessionRules {
6
5
  /**
7
6
  * Whether a session has passed its `expires_at` instant.
8
7
  *
@@ -36,5 +35,4 @@ declare class SessionRules {
36
35
  static shouldExpire(status: VerificationStatus, expiresAt: IsoDateTime | Date, now: IsoDateTime | Date): boolean;
37
36
  }
38
37
  //#endregion
39
- export { SessionRules };
40
38
  //# sourceMappingURL=session.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.mts","names":[],"sources":["../src/session.ts"],"mappings":";;;;cAUa,YAAA;EAAA;;;;;;;;;EAAA,OAUJ,gBAAA,CAAiB,SAAA,EAAW,WAAA,GAAc,IAAA,EAAM,GAAA,EAAK,WAAA,GAAc,IAAA;EA8B9C;;;;;;;;;;EAAA,OAhBrB,iBAAA,CAAkB,UAAA,EAAY,OAAA,qBAA4B,GAAA,EAAK,WAAA,GAAc,IAAA;EAdxB;;;;;;;;;EAAA,OA8BrD,YAAA,CAAa,MAAA,EAAQ,kBAAA,EAAoB,SAAA,EAAW,WAAA,GAAc,IAAA,EAAM,GAAA,EAAK,WAAA,GAAc,IAAA;AAAA"}
1
+ {"version":3,"file":"session.d.mts","names":[],"sources":["../src/session.ts"],"mappings":";;;qBAUa;;;;;;;;;;SAUJ,iBAAiB,WAAW,cAAc,MAAM,KAAK,cAAc;;;;;;;;;;;SAcnE,kBAAkB,YAAY,4BAA4B,KAAK,cAAc;;;;;;;;;;SAgB7E,aAAa,QAAQ,oBAAoB,WAAW,cAAc,MAAM,KAAK,cAAc"}
@@ -1,8 +1,7 @@
1
1
  import { DecisionReason, RiskPolicyConfig, RiskSeverity, RiskSignal } from "@arkyc/types";
2
-
3
2
  //#region src/signals.d.ts
4
3
  /** Policy resolution and precedence for risk signals. */
5
- declare class RiskSignals {
4
+ export declare class RiskSignals {
6
5
  /**
7
6
  * Resolve each signal's severity from the workflow policy. `info` signals stay
8
7
  * informational, advisory and review-only signals never exceed review.
@@ -22,5 +21,4 @@ declare class RiskSignals {
22
21
  static reasonFor(signals: RiskSignal[], severity: Exclude<RiskSeverity, 'info'>): DecisionReason | null;
23
22
  }
24
23
  //#endregion
25
- export { RiskSignals };
26
24
  //# sourceMappingURL=signals.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signals.d.mts","names":[],"sources":["../src/signals.ts"],"mappings":";;;;cAmBa,WAAA;EAAA;;;;;;;;EAAA,OASJ,WAAA,WAAsB,UAAA,EAAY,OAAA,EAAS,CAAA,IAAK,MAAA,GAAQ,gBAAA,GAAwB,CAAA;EAmBrC;;;;;;;EAAA,OAA3C,SAAA,CAAU,OAAA,EAAS,UAAA,IAAc,QAAA,EAAU,OAAA,CAAQ,YAAA,YAAwB,cAAA;AAAA"}
1
+ {"version":3,"file":"signals.d.mts","names":[],"sources":["../src/signals.ts"],"mappings":";;;qBAmBa;;;;;;;;;SASJ,YAAY,UAAU,YAAY,SAAS,KAAK,SAAQ,mBAAwB;;;;;;;;SAmBhF,UAAU,SAAS,cAAc,UAAU,QAAQ,wBAAwB"}
package/dist/status.d.mts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { VerificationStatus } from "@arkyc/types";
2
-
3
2
  //#region src/status.d.ts
4
3
  /**
5
4
  * Thrown when an illegal status transition is attempted.
6
5
  */
7
- declare class InvalidStatusTransitionError extends Error {
6
+ export declare class InvalidStatusTransitionError extends Error {
8
7
  readonly from: VerificationStatus;
9
8
  readonly to: VerificationStatus;
10
9
  constructor(from: VerificationStatus, to: VerificationStatus);
@@ -12,7 +11,7 @@ declare class InvalidStatusTransitionError extends Error {
12
11
  /**
13
12
  * Verification session status-transition rules.
14
13
  */
15
- declare class StatusMachine {
14
+ export declare class StatusMachine {
16
15
  /**
17
16
  * Allowed status transitions for a verification session.
18
17
  *
@@ -52,5 +51,4 @@ declare class StatusMachine {
52
51
  static assert(from: VerificationStatus, to: VerificationStatus): VerificationStatus;
53
52
  }
54
53
  //#endregion
55
- export { InvalidStatusTransitionError, StatusMachine };
56
54
  //# sourceMappingURL=status.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.mts","names":[],"sources":["../src/status.ts"],"mappings":";;;;;AAKA;cAAa,4BAAA,SAAqC,KAAA;EAAA,SAE9B,IAAA,EAAM,kBAAA;EAAA,SACN,EAAA,EAAI,kBAAA;cADJ,IAAA,EAAM,kBAAA,EACN,EAAA,EAAI,kBAAA;AAAA;;;;cAUX,aAAA;EAbqC;;;;;;;;;;EAAA,gBAwBhC,WAAA,EAAa,QAAA,CAAS,MAAA,CAAO,kBAAA,WAA6B,kBAAA;EArBlC;EAAA,gBAwCxB,QAAA,WAAmB,kBAAA;EA9BX;;;;;;EAAA,OAsCjB,UAAA,CAAW,MAAA,EAAQ,kBAAA;EAAA;;;;;;;EAAA,OAWnB,aAAA,CAAc,IAAA,EAAM,kBAAA,EAAoB,EAAA,EAAI,kBAAA;EAtCnC;;;;;;;;EAAA,OAkDT,MAAA,CAAO,IAAA,EAAM,kBAAA,EAAoB,EAAA,EAAI,kBAAA,GAAqB,kBAAA;AAAA"}
1
+ {"version":3,"file":"status.d.mts","names":[],"sources":["../src/status.ts"],"mappings":";;;;;qBAKa,qCAAqC;WAE9B,MAAM;WACN,IAAI;EADJ,YAAA,MAAM,oBACN,IAAI;;;;;qBAUX;;;;;;;;;;;kBAWK,aAAa,SAAS,OAAO,6BAA6B;;kBAmB1D,mBAAmB;;;;;;;SAQ5B,WAAW,QAAQ;;;;;;;;SAWnB,cAAc,MAAM,oBAAoB,IAAI;;;;;;;;;SAY5C,OAAO,MAAM,oBAAoB,IAAI,qBAAqB"}
@@ -1,8 +1,7 @@
1
1
  import { VerificationThresholds } from "@arkyc/types";
2
-
3
2
  //#region src/thresholds.d.ts
4
3
  /** Verification threshold defaults and override resolution. */
5
- declare class Thresholds {
4
+ export declare class Thresholds {
6
5
  /**
7
6
  * Platform default verification thresholds. Projects may override any subset
8
7
  * via `ProjectSettings.thresholds`; {@link Thresholds.resolve} merges them.
@@ -17,5 +16,4 @@ declare class Thresholds {
17
16
  static resolve(overrides?: Partial<VerificationThresholds>): VerificationThresholds;
18
17
  }
19
18
  //#endregion
20
- export { Thresholds };
21
19
  //# sourceMappingURL=thresholds.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"thresholds.d.mts","names":[],"sources":["../src/thresholds.ts"],"mappings":";;;;cAGa,UAAA;EAAA;;;;EAAA,gBAKK,QAAA,EAAU,sBAAA;EAQC;;;;;;EAAA,OAApB,OAAA,CAAQ,SAAA,GAAY,OAAA,CAAQ,sBAAA,IAA0B,sBAAA;AAAA"}
1
+ {"version":3,"file":"thresholds.d.mts","names":[],"sources":["../src/thresholds.ts"],"mappings":";;;qBAGa;;;;;kBAKK,UAAU;;;;;;;SAQnB,QAAQ,YAAY,QAAQ,0BAA0B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyc/core",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Decision engine, status transitions, and scoring logic",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -36,7 +36,7 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@arkyc/types": "^2.0.0"
39
+ "@arkyc/types": "^2.1.0"
40
40
  },
41
41
  "scripts": {
42
42
  "typecheck": "tsc --noEmit",