File tree Expand file tree Collapse file tree 6 files changed +22
-4
lines changed Expand file tree Collapse file tree 6 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 1- import type { StringSchema } from '../schema.js' ;
21import { IGNORED_FORMATS , TYPE_FORMATS , sortName } from '../../utils/index.js' ;
2+ import type { StringSchema } from '../schema.js' ;
33
44export function resolveStringFormat ( format : string , nsid : string ) : string {
55 if ( format === 'did' ) return TYPE_FORMATS . DID ;
66 if ( format === 'cid' ) return TYPE_FORMATS . CID ;
77 if ( format === 'handle' ) return TYPE_FORMATS . HANDLE ;
88 if ( format === 'at-uri' ) return TYPE_FORMATS . URI ;
9+ if ( format === 'tid' ) return TYPE_FORMATS . TID ;
10+ if ( format === 'record-key' ) return TYPE_FORMATS . RKEY ;
911 if ( IGNORED_FORMATS . has ( format ) ) return 'string' ;
1012
1113 console . warn ( `${ nsid } : unknown format ${ format } ` ) ;
Original file line number Diff line number Diff line change @@ -94,7 +94,11 @@ export const stringSchema: t.StrictValidator<
9494 maxGraphemes ?: number ;
9595 minGraphemes ?: number ;
9696 } => {
97- if ( value . format !== undefined && value . format !== 'uri' ) {
97+ if (
98+ value . format !== undefined &&
99+ value . format !== 'uri' &&
100+ value . format !== 'record-key'
101+ ) {
98102 if (
99103 value . maxLength !== undefined ||
100104 value . minLength !== undefined ||
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ export const TYPE_FORMATS = {
33 CID : 'At.CID' ,
44 HANDLE : 'At.Handle' ,
55 URI : 'At.Uri' ,
6+ TID : 'At.TID' ,
7+ RKEY : 'At.RKEY' ,
68} as const ;
79
810export const IGNORED_FORMATS = new Set ( [
Original file line number Diff line number Diff line change @@ -33,7 +33,13 @@ export declare namespace At {
3333 type Handle = string;
3434
3535 /** URI string */
36- type Uri = string;
36+ type Uri = string;
37+
38+ /** TID string */
39+ type TID = string;
40+
41+ /** RKEY string */
42+ type RKEY = string;
3743
3844 /** Object containing a CID string */
3945 interface CIDLink {
Original file line number Diff line number Diff line change 1+ {
2+ "extends" : " ../tsconfig.json" ,
3+ "include" : " *.ts"
4+ }
Original file line number Diff line number Diff line change 1313 "skipLibCheck" : true
1414 },
1515 "include" : [" index.ts" , " src/**/*" ],
16- "exclude" : [" node_modules" , " dist" , " scripts " ]
16+ "exclude" : [" node_modules" , " dist" ]
1717}
You can’t perform that action at this time.
0 commit comments