Skip to content

Commit ef3e26f

Browse files
committed
fix(lexicons): support tid and record-key format has length and grapheme restriction
1 parent 7277731 commit ef3e26f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

packages/lex-cli/src/generator/resolvers/string.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import type { StringSchema } from '../schema.js';
21
import { IGNORED_FORMATS, TYPE_FORMATS, sortName } from '../../utils/index.js';
2+
import type { StringSchema } from '../schema.js';
33

44
export 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}`);

packages/lex-cli/src/utils/formats.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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

810
export const IGNORED_FORMATS = new Set([

packages/lex-cli/src/utils/prelude.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)