-
Notifications
You must be signed in to change notification settings - Fork 5
/
jsonv3.ts
67 lines (59 loc) · 1.47 KB
/
jsonv3.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* Copyright (c) 2023, J2 Innovations. All Rights Reserved
*/
/* eslint @typescript-eslint/no-empty-interface: "off" */
/**
* Haystack version 3 JSON format types.
*
* As described in https://project-haystack.org/doc/docHaystack/Json
*
* Please note, this has been supplanted by the newer `Hayson` JSON format...
*
* https://bitbucket.org/finproducts/hayson/src/master/
*
* @module
*/
export type JsonV3Num = `n:${string}`
export type JsonV3Marker = 'm:'
export type JsonV3Na = 'z:'
export type JsonV3Remove = '-:'
export type JsonV3Ref = `r:${string}`
export type JsonV3Uri = `u:${string}`
export type JsonV3Symbol = `y:${string}`
export type JsonV3Time = `h:${string}`
export type JsonV3Date = `d:${string}`
export type JsonV3DateTime = `t:${string}`
export type JsonV3Coord = `c:${string}`
export type JsonV3XStr = `x:${string}`
export type JsonV3Val =
| boolean
| string
| JsonV3Num
| JsonV3Ref
| JsonV3Time
| JsonV3Date
| JsonV3Uri
| JsonV3DateTime
| JsonV3Symbol
| JsonV3Coord
| JsonV3XStr
| JsonV3List
| JsonV3Dict
| JsonV3Grid
| JsonV3Marker
| JsonV3Na
| JsonV3Remove
| null
export interface JsonV3List extends Array<JsonV3Val> {}
export interface JsonV3Dict {
[prop: string]: JsonV3Val
}
export interface JsonV3Grid {
meta?: JsonV3Dict
cols?: { name: string; [prop: string]: JsonV3Val }[]
rows?: JsonV3Dict[]
}
/**
* The MIME type for the older Haystack version 3 JSON.
*/
export const JSON_V3_MIME_TYPE = 'application/vnd.haystack+json;version=3'