📄 types/StandardDefinition.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 StandardProp {
20  name: string;
21  type: 'string' | 'uint32' | 'uint64';
22  nullable?: boolean;
23  normalize: string;
24  display?: string;
25  checkDigit?: {
26    algorithm: string;
27    position: 'last' | 'embedded';
28  };
29  pattern?: string;
30  description?: string;
31}
32
33export interface FieldMapping {
34  source: string;
35  target: string;
36  overwrite: 'always' | 'if-empty' | 'never';
37}
38
39export interface ExternalApiEntry {
40  id: string;
41  name: string;
42  kind: 'lookup' | 'search';
43  maxResults?: number;
44  requiresApiKey?: boolean;
45  rateLimit: { requests: number; windowSeconds: number } | null;
46  fieldMapping: FieldMapping[];
47}
48
49export type RevisionCycle = 'annual' | 'triennial' | 'decennial' | 'irregular' | 'continuous' | 'frozen';
50export type StandardStatus = 'active' | 'deprecated' | `superseded-by:${string}`;
51
52export interface StandardDefinition {
53  $schema: string;
54  id: string;
55  version: string;
56  label: string;
57  description?: string;
58  governingBody: string;
59  isoReference?: string | null;
60  revisionCycle: RevisionCycle;
61  status: StandardStatus;
62  props: StandardProp[];
63  pk?: string;
64  uriScheme?: string | null;
65  linkedDataUri?: string | null;
66  externalApis?: ExternalApiEntry[];
67  translations?: Record<string, { props?: Record<string, string> }>;
68}
69