📄 types/StandardAdapter.ts
D-OPEN SOVEREIGN
1/*
2 * /*
3 *    * Copyright (c) 2026 DataPond D-Library Pty Ltd. ("The Sanctuary")
4 *    * Non-Profit Public Library — The World Library
5 *    * 
6 *    * D-SAFE Certification issued by POND Enterprise.
7 *    * Published under the D-Open Code Sovereign Licence v1.0 framework
8 *    * DataPond D-Library All exclusive Right reserved on modifiying the code - CC Attribution to data pond, Non modifiable, Non Commercial.   
9 *    * https://registry.world.bibliotech.com/licence
10 *    * Source code donated to DataPond D-Library by it's author: data pond.
11 *    
12 *    * 
13 *    * Technical Guardian ("The Shield"): Pond Enterprise Pty Ltd. (ACN 694 747 987)
14 *    * All liability claims about D-SAFE certification issues coming from the published D-Safe direction must be addressed with Pond Enterprise Pty Ltd.
15 *    * Code Modification automatically voids the certified liability protection provided by Pond Enterprise.
16 *    
17 *
18 */
19export interface ValidationResult {
20  valid: boolean;
21  error?: string;
22}
23
24export interface StandardApiAdapter<TProps, TResult> {
25  readonly apiId: string;
26  readonly name: string;
27  fetch(props: TProps): Promise<TResult>;
28}
29
30export interface StandardAdapter<
31  TProps extends Record<string, string | null>,
32  TApis extends Record<string, StandardApiAdapter<TProps, unknown>> = Record<string, StandardApiAdapter<TProps, unknown>>
33> {
34  readonly standardId: string;
35  readonly uriScheme: string | null;
36  readonly apis: TApis;
37  normalize(value: string): string;
38  display(value: string): string;
39  validate(value: string | null | undefined): ValidationResult;
40  toLinkedDataUri(value: string): string;
41}
42