diff --git a/libs/typescript/package.json b/libs/typescript/package.json index 27bbcde..81c069f 100644 --- a/libs/typescript/package.json +++ b/libs/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@txtdot/dalet", - "version": "1.0.0-pre2", + "version": "1.0.0-pre3", "description": "Dalet implementation in typescript", "main": "dist/lib.js", "types": "dist/lib.d.ts", diff --git a/libs/typescript/src/daletl/types.ts b/libs/typescript/src/daletl/types.ts index 9c01fec..795b88f 100644 --- a/libs/typescript/src/daletl/types.ts +++ b/libs/typescript/src/daletl/types.ts @@ -1,4 +1,6 @@ -export type Page = Tag[]; +export interface Page { + data: Tag[]; +} export type Body = string | Tag[] | null; export type Argument = string | number | null; diff --git a/specification/daletl.md b/specification/daletl.md index 955e562..e6d0eba 100644 --- a/specification/daletl.md +++ b/specification/daletl.md @@ -6,10 +6,12 @@ Daletl is data representation of serialized/deserialized [DaletPack](./daletpack ### Page -Daletl page is array of tags. For convenience, we will use the typescript notation. +Daletl page is struct. For convenience, we will use the typescript notation. ```typescript -type Page = Tag[]; +interface Page = { + data: Tag[] +} ``` ### Tag diff --git a/specification/daletpack.md b/specification/daletpack.md index ecb7245..6647ad6 100644 --- a/specification/daletpack.md +++ b/specification/daletpack.md @@ -34,16 +34,15 @@ Mime type: `application/dalet-pack` | name | id | | ------------------------ | --- | -| int 8 | 1 | -| str 8 | 4 | -| str 16 | 5 | -| str 32 | 6 | -| tag array | 7 | -| tag array end | 8 | -| tag (id) | 12 | -| tag (id, body) | 13 | -| tag (id, argument) | 14 | -| tag (id, body, argument) | 15 | +| str end | 0 | +| str | 1 | +| int | 2 | +| tag array | 3 | +| tag array end | 4 | +| tag (id) | 5 | +| tag (id, body) | 6 | +| tag (id, argument) | 7 | +| tag (id, body, argument) | 8 | ### Notation in diagrams @@ -66,7 +65,17 @@ variable number of objects stored in DaletPack format: X - unknown bit ``` -### Integer format +### Str format + +```txt + +str: ++--------+=========+--------+ +| 1 | utf-8 | 0 | ++--------+=========+--------+ +``` + +### Int format ```txt +--------+----------+ @@ -74,32 +83,12 @@ X - unknown bit +--------+----------+ ``` -### String format - -```txt - -str 8 (up to 256 bytes): -+--------+----------+=========+ -| 4 | XXXXXXXX | utf-8 | -+--------+----------+=========+ - -str 16 (up to 2^16 bytes): -+--------+----------+----------+=========+ -| 5 | XXXXXXXX | XXXXXXXX | utf-8 | -+--------+----------+----------+=========+ - -str 32 (up to 2^32 bytes): -+--------+----------+----------+----------+----------+=========+ -| 6 | XXXXXXXX | XXXXXXXX | XXXXXXXX | XXXXXXXX | utf-8 | -+--------+----------+----------+----------+----------+=========+ -``` - ### Tag array format ```txt tag array: +--------+~~~~~~~~~~~~+------+ -| 7 | elements | 8 | +| 3 | elements | 4 | +--------+~~~~~~~~~~~~+------+ ``` @@ -111,21 +100,21 @@ id = XXXXX (5 bits) (can change before release) tag (id): +--------+----+ -| 12 | id | +| 5 | id | +--------+----+ tag (id, body): +--------+----+~~~~~~~~+ -| 13 | id | body | +| 6 | id | body | +--------+----+~~~~~~~~+ tag (id, argument): +--------+----+~~~~~~~~~~~~+ -| 14 | id | argument | +| 7 | id | argument | +--------+----+~~~~~~~~~~~~+ tag (id, body, argument): +--------+----+~~~~~~~~+~~~~~~~~~~~~+ -| 15 | id | body | argument | +| 8 | id | body | argument | +--------+----+~~~~~~~~+~~~~~~~~~~~~+ ```