@sockethub/schemas 3.0.0-alpha.9 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity-stream-helper.d.ts +5 -0
- package/dist/activity-stream-helper.js +36 -0
- package/dist/activity-stream-helper.js.map +10 -0
- package/dist/context.d.ts +56 -0
- package/dist/context.js +80 -0
- package/dist/context.js.map +10 -0
- package/dist/contexts/platform/caldav/v1.jsonld +8 -0
- package/dist/contexts/platform/carddav/v1.jsonld +8 -0
- package/dist/contexts/platform/dummy/v1.jsonld +8 -0
- package/dist/contexts/platform/error/v1.jsonld +8 -0
- package/dist/contexts/platform/feeds/v1.jsonld +8 -0
- package/dist/contexts/platform/irc/v1.jsonld +8 -0
- package/dist/contexts/platform/metadata/v1.jsonld +8 -0
- package/dist/contexts/platform/sockethub%3Ainternal/v1.jsonld +8 -0
- package/dist/contexts/platform/xmpp/v1.jsonld +8 -0
- package/dist/contexts/v1.jsonld +7 -0
- package/dist/helpers/error-parser.d.ts +13 -0
- package/dist/helpers/objects.d.ts +157 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1235 -1143
- package/dist/index.js.map +15 -17
- package/dist/maps/context-map.json +41 -0
- package/dist/object-types.d.ts +2 -0
- package/dist/object-types.js +299 -0
- package/dist/object-types.js.map +12 -0
- package/dist/schema-id.d.ts +11 -0
- package/dist/schemas/activity-stream.d.ts +196 -0
- package/{src/schemas/json/activity-object.json → dist/schemas/json/activity-stream.json} +99 -158
- package/dist/schemas/json/platform.json +52 -0
- package/dist/schemas/json/service-descriptor.json +58 -0
- package/dist/schemas/json/sockethub-config.json +500 -0
- package/dist/schemas/platform/caldav/v1/credentials.schema.json +71 -0
- package/dist/schemas/platform/caldav/v1/messages.schema.json +769 -0
- package/dist/schemas/platform/carddav/v1/credentials.schema.json +67 -0
- package/dist/schemas/platform/carddav/v1/messages.schema.json +375 -0
- package/dist/schemas/platform/dummy/v1/credentials.schema.json +1 -0
- package/dist/schemas/platform/dummy/v1/messages.schema.json +22 -0
- package/dist/schemas/platform/error/v1/credentials.schema.json +1 -0
- package/dist/schemas/platform/error/v1/messages.schema.json +1 -0
- package/dist/schemas/platform/feeds/v1/credentials.schema.json +1 -0
- package/dist/schemas/platform/feeds/v1/messages.schema.json +27 -0
- package/dist/schemas/platform/irc/v1/credentials.schema.json +118 -0
- package/dist/schemas/platform/irc/v1/messages.schema.json +149 -0
- package/dist/schemas/platform/metadata/v1/credentials.schema.json +1 -0
- package/dist/schemas/platform/metadata/v1/messages.schema.json +14 -0
- package/dist/schemas/platform/sockethub%3Ainternal/v1/credentials.schema.json +1 -0
- package/dist/schemas/platform/sockethub%3Ainternal/v1/messages.schema.json +1 -0
- package/dist/schemas/platform/xmpp/v1/credentials.schema.json +43 -0
- package/dist/schemas/platform/xmpp/v1/messages.schema.json +129 -0
- package/dist/schemas/platform.d.ts +62 -0
- package/dist/schemas/service-descriptor.d.ts +84 -0
- package/dist/schemas/sockethub-config.d.ts +466 -0
- package/dist/service-descriptor.d.ts +4 -0
- package/dist/service-descriptor.js +6280 -0
- package/dist/service-descriptor.js.map +77 -0
- package/{src/types.ts → dist/types.d.ts} +52 -53
- package/dist/validator.d.ts +26 -0
- package/package.json +32 -11
- package/src/helpers/error-parser.ts +0 -113
- package/src/helpers/objects.ts +0 -227
- package/src/index.test.data.credentials.ts +0 -71
- package/src/index.test.data.objects.ts +0 -241
- package/src/index.test.data.platform.ts +0 -45
- package/src/index.test.data.streams.ts +0 -498
- package/src/index.test.ts +0 -99
- package/src/index.ts +0 -27
- package/src/schemas/activity-object.ts +0 -19
- package/src/schemas/activity-stream.ts +0 -54
- package/src/schemas/json/activity-stream.json +0 -469
- package/src/schemas/json/platform.json +0 -28
- package/src/schemas/json/sockethub-config.json +0 -144
- package/src/schemas/platform.ts +0 -47
- package/src/schemas/sockethub-config.ts +0 -140
- package/src/validator.ts +0 -94
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"required": [
|
|
3
|
+
"type"
|
|
4
|
+
],
|
|
5
|
+
"properties": {
|
|
6
|
+
"type": {
|
|
7
|
+
"enum": [
|
|
8
|
+
"connect",
|
|
9
|
+
"update",
|
|
10
|
+
"join",
|
|
11
|
+
"leave",
|
|
12
|
+
"send",
|
|
13
|
+
"query",
|
|
14
|
+
"announce",
|
|
15
|
+
"disconnect"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"object": {
|
|
19
|
+
"oneOf": [
|
|
20
|
+
{
|
|
21
|
+
"$ref": "#/definitions/objectTypes/message"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"$ref": "#/definitions/objectTypes/topic"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"$ref": "#/definitions/objectTypes/address"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"$ref": "#/definitions/objectTypes/attendance"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"$ref": "#/definitions/objectTypes/channels"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"target": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"if": {
|
|
40
|
+
"required": [
|
|
41
|
+
"type"
|
|
42
|
+
],
|
|
43
|
+
"properties": {
|
|
44
|
+
"type": {
|
|
45
|
+
"const": "room"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"then": {
|
|
50
|
+
"required": [
|
|
51
|
+
"id"
|
|
52
|
+
],
|
|
53
|
+
"properties": {
|
|
54
|
+
"id": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"pattern": "^#[^\\s]+@[^\\s@]+$"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"definitions": {
|
|
63
|
+
"objectTypes": {
|
|
64
|
+
"message": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"required": [
|
|
67
|
+
"type",
|
|
68
|
+
"content"
|
|
69
|
+
],
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"properties": {
|
|
72
|
+
"type": {
|
|
73
|
+
"enum": [
|
|
74
|
+
"message"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"content": {
|
|
78
|
+
"type": "string"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"topic": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"required": [
|
|
85
|
+
"type",
|
|
86
|
+
"content"
|
|
87
|
+
],
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"properties": {
|
|
90
|
+
"type": {
|
|
91
|
+
"enum": [
|
|
92
|
+
"topic"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"content": {
|
|
96
|
+
"type": "string"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"address": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"required": [
|
|
103
|
+
"type"
|
|
104
|
+
],
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"properties": {
|
|
107
|
+
"type": {
|
|
108
|
+
"enum": [
|
|
109
|
+
"address"
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"attendance": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"required": [
|
|
117
|
+
"type"
|
|
118
|
+
],
|
|
119
|
+
"additionalProperties": false,
|
|
120
|
+
"properties": {
|
|
121
|
+
"type": {
|
|
122
|
+
"enum": [
|
|
123
|
+
"attendance"
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"channels": {
|
|
129
|
+
"type": "object",
|
|
130
|
+
"required": [
|
|
131
|
+
"type"
|
|
132
|
+
],
|
|
133
|
+
"additionalProperties": false,
|
|
134
|
+
"properties": {
|
|
135
|
+
"type": {
|
|
136
|
+
"enum": [
|
|
137
|
+
"channels"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"name": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"minLength": 1,
|
|
143
|
+
"pattern": "^[^\\s]+$"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"required": [
|
|
3
|
+
"object"
|
|
4
|
+
],
|
|
5
|
+
"properties": {
|
|
6
|
+
"actor": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"required": [
|
|
9
|
+
"id"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"object": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"required": [
|
|
15
|
+
"type",
|
|
16
|
+
"userAddress",
|
|
17
|
+
"resource",
|
|
18
|
+
"password"
|
|
19
|
+
],
|
|
20
|
+
"additionalProperties": false,
|
|
21
|
+
"properties": {
|
|
22
|
+
"type": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
},
|
|
25
|
+
"userAddress": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
"password": {
|
|
29
|
+
"type": "string"
|
|
30
|
+
},
|
|
31
|
+
"server": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"port": {
|
|
35
|
+
"type": "number"
|
|
36
|
+
},
|
|
37
|
+
"resource": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
{
|
|
2
|
+
"required": [
|
|
3
|
+
"type"
|
|
4
|
+
],
|
|
5
|
+
"properties": {
|
|
6
|
+
"type": {
|
|
7
|
+
"enum": [
|
|
8
|
+
"connect",
|
|
9
|
+
"join",
|
|
10
|
+
"leave",
|
|
11
|
+
"send",
|
|
12
|
+
"update",
|
|
13
|
+
"request-friend",
|
|
14
|
+
"remove-friend",
|
|
15
|
+
"make-friend",
|
|
16
|
+
"query",
|
|
17
|
+
"disconnect"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"object": {
|
|
21
|
+
"oneOf": [
|
|
22
|
+
{
|
|
23
|
+
"$ref": "#/definitions/objectTypes/message"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"$ref": "#/definitions/objectTypes/presence"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"$ref": "#/definitions/objectTypes/attendance"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"$ref": "#/definitions/objectTypes/room-info"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"definitions": {
|
|
38
|
+
"objectTypes": {
|
|
39
|
+
"message": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"required": [
|
|
42
|
+
"type",
|
|
43
|
+
"content"
|
|
44
|
+
],
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"properties": {
|
|
47
|
+
"type": {
|
|
48
|
+
"enum": [
|
|
49
|
+
"message"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"id": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
},
|
|
55
|
+
"content": {
|
|
56
|
+
"type": "string"
|
|
57
|
+
},
|
|
58
|
+
"xmpp:replace": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"required": [
|
|
61
|
+
"id"
|
|
62
|
+
],
|
|
63
|
+
"additionalProperties": false,
|
|
64
|
+
"properties": {
|
|
65
|
+
"id": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"presence": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"required": [
|
|
75
|
+
"type"
|
|
76
|
+
],
|
|
77
|
+
"additionalProperties": false,
|
|
78
|
+
"properties": {
|
|
79
|
+
"type": {
|
|
80
|
+
"enum": [
|
|
81
|
+
"presence"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"presence": {
|
|
85
|
+
"enum": [
|
|
86
|
+
"away",
|
|
87
|
+
"chat",
|
|
88
|
+
"dnd",
|
|
89
|
+
"xa",
|
|
90
|
+
"offline",
|
|
91
|
+
"online"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"content": {
|
|
95
|
+
"type": "string"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"attendance": {
|
|
100
|
+
"type": "object",
|
|
101
|
+
"required": [
|
|
102
|
+
"type"
|
|
103
|
+
],
|
|
104
|
+
"additionalProperties": false,
|
|
105
|
+
"properties": {
|
|
106
|
+
"type": {
|
|
107
|
+
"enum": [
|
|
108
|
+
"attendance"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"room-info": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"required": [
|
|
116
|
+
"type"
|
|
117
|
+
],
|
|
118
|
+
"additionalProperties": false,
|
|
119
|
+
"properties": {
|
|
120
|
+
"type": {
|
|
121
|
+
"enum": [
|
|
122
|
+
"room-info"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of Sockethub.
|
|
3
|
+
*
|
|
4
|
+
* Developed by Nick Jennings (https://github.com/silverbucket)
|
|
5
|
+
*
|
|
6
|
+
* server is licensed under the LGPL.
|
|
7
|
+
* See the LICENSE file for details.
|
|
8
|
+
*
|
|
9
|
+
* The latest version of server can be found here:
|
|
10
|
+
* git://github.com/sockethub/sockethub.git
|
|
11
|
+
*
|
|
12
|
+
* For more information about Sockethub visit https://sockethub.org/.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PlatformSchema: {
|
|
19
|
+
$id: string;
|
|
20
|
+
type: string;
|
|
21
|
+
required: string[];
|
|
22
|
+
additionalProperties: boolean;
|
|
23
|
+
properties: {
|
|
24
|
+
contextUrl: {
|
|
25
|
+
title: string;
|
|
26
|
+
type: string;
|
|
27
|
+
format: string;
|
|
28
|
+
};
|
|
29
|
+
contextVersion: {
|
|
30
|
+
title: string;
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
schemaVersion: {
|
|
34
|
+
title: string;
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
messageConstraints: {
|
|
38
|
+
title: string;
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
credentials: {
|
|
42
|
+
title: string;
|
|
43
|
+
type: string;
|
|
44
|
+
};
|
|
45
|
+
messages: {
|
|
46
|
+
title: string;
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
responses: {
|
|
50
|
+
title: string;
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
53
|
+
name: {
|
|
54
|
+
title: string;
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
version: {
|
|
58
|
+
title: string;
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public service descriptor served on a bare GET of the HTTP actions
|
|
3
|
+
* path and on `GET /` with `Accept: application/json`. It carries API
|
|
4
|
+
* versions only (the SemVer major of the server package and of each platform
|
|
5
|
+
* package), never exact package versions, plus the public connection
|
|
6
|
+
* endpoints so a client needs nothing but the server's base URL.
|
|
7
|
+
*/
|
|
8
|
+
export interface ServiceDescriptor {
|
|
9
|
+
name: "sockethub";
|
|
10
|
+
apiVersion: number;
|
|
11
|
+
/**
|
|
12
|
+
* Where to connect. Absent from descriptors written by servers that
|
|
13
|
+
* predate endpoint discovery.
|
|
14
|
+
*/
|
|
15
|
+
endpoints?: ServiceEndpoints;
|
|
16
|
+
platforms: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
apiVersion: number;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Where to connect, as server-absolute paths (leading `/`) on the origin the
|
|
23
|
+
* descriptor was fetched from. No origin is advertised: a client has already
|
|
24
|
+
* reached the server, and resolving paths against that same origin cannot be
|
|
25
|
+
* misdirected by a misconfigured `public` block.
|
|
26
|
+
*/
|
|
27
|
+
export interface ServiceEndpoints {
|
|
28
|
+
/**
|
|
29
|
+
* The Socket.IO server path, to be passed as the `path` option of `io()`
|
|
30
|
+
* (a path appended to the URL would select a namespace instead).
|
|
31
|
+
*/
|
|
32
|
+
socketIO: string;
|
|
33
|
+
/** The HTTP actions path. Present only when that transport is enabled. */
|
|
34
|
+
httpActions?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const ServiceDescriptorSchema: {
|
|
37
|
+
readonly $id: "https://sockethub.org/schemas/v/service-descriptor.json";
|
|
38
|
+
readonly description: "Sockethub service descriptor";
|
|
39
|
+
readonly type: "object";
|
|
40
|
+
readonly required: readonly ["name", "apiVersion", "platforms"];
|
|
41
|
+
readonly additionalProperties: true;
|
|
42
|
+
readonly properties: {
|
|
43
|
+
readonly name: {
|
|
44
|
+
readonly const: "sockethub";
|
|
45
|
+
};
|
|
46
|
+
readonly apiVersion: {
|
|
47
|
+
readonly type: "integer";
|
|
48
|
+
readonly minimum: 0;
|
|
49
|
+
};
|
|
50
|
+
readonly endpoints: {
|
|
51
|
+
readonly type: "object";
|
|
52
|
+
readonly required: readonly ["socketIO"];
|
|
53
|
+
readonly additionalProperties: true;
|
|
54
|
+
readonly properties: {
|
|
55
|
+
readonly socketIO: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
readonly pattern: "^/(?![/\\\\])[^\\s\\\\]*$";
|
|
58
|
+
};
|
|
59
|
+
readonly httpActions: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly pattern: "^/(?![/\\\\])[^\\s\\\\]*$";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly platforms: {
|
|
66
|
+
readonly type: "array";
|
|
67
|
+
readonly items: {
|
|
68
|
+
readonly type: "object";
|
|
69
|
+
readonly required: readonly ["id", "apiVersion"];
|
|
70
|
+
readonly additionalProperties: true;
|
|
71
|
+
readonly properties: {
|
|
72
|
+
readonly id: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
readonly minLength: 1;
|
|
75
|
+
};
|
|
76
|
+
readonly apiVersion: {
|
|
77
|
+
readonly type: "integer";
|
|
78
|
+
readonly minimum: 0;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|