@lynkoria/contracts 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/README.md +5 -2
- package/dist/catalog.d.ts +40 -0
- package/dist/catalog.js +370 -0
- package/dist/errors.d.ts +31 -0
- package/dist/errors.js +35 -0
- package/dist/events.d.ts +118 -0
- package/dist/events.js +32 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/schemas.d.ts +1457 -0
- package/dist/schemas.js +732 -0
- package/package.json +41 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @lynkoria/contracts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared Lynkoria contract: Zod schemas for REST bodies and responses, Socket.IO event maps
|
|
4
|
+
(`ServerToClientEvents`, `ClientToServerEvents`), outbound webhook types, error codes and the typed
|
|
5
|
+
`LynkoriaError`. Used by the API and every SDK; consumers usually import it through
|
|
6
|
+
`@lynkoria/server` or `@lynkoria/client`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared vocabulary for the documentation site and the admin console. The docs glossary page is
|
|
3
|
+
* generated from GLOSSARY, and the console uses the same definitions for labels and tooltips, so
|
|
4
|
+
* both say the same thing. Exported as `@lynkoria/contracts/catalog`; not part of the SDK API.
|
|
5
|
+
*/
|
|
6
|
+
export type Term = {
|
|
7
|
+
term: string;
|
|
8
|
+
definition: string;
|
|
9
|
+
/** Other names people use; the console and docs use `term`. */
|
|
10
|
+
aka?: string[];
|
|
11
|
+
/** Docs page (relative to docs/) that explains it. */
|
|
12
|
+
docs?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const GLOSSARY: readonly Term[];
|
|
15
|
+
/**
|
|
16
|
+
* Every metric the console displays, and the ones it deliberately does not. The console shows a
|
|
17
|
+
* metric only when it is listed here as `available`; the docs metrics catalog is generated from it.
|
|
18
|
+
*/
|
|
19
|
+
export type MetricDefinition = {
|
|
20
|
+
key: string;
|
|
21
|
+
label: string;
|
|
22
|
+
unit: 'count' | 'minutes' | 'percent' | 'seconds';
|
|
23
|
+
description: string;
|
|
24
|
+
/** Where the number comes from. */
|
|
25
|
+
source: string;
|
|
26
|
+
aggregation: 'sum' | 'max' | 'ratio' | 'count of current rows';
|
|
27
|
+
/** Bucket sizes the console uses. */
|
|
28
|
+
buckets: string;
|
|
29
|
+
/** Time ranges offered. */
|
|
30
|
+
ranges: string;
|
|
31
|
+
kind: 'historical' | 'live';
|
|
32
|
+
/** Expected delay between an event and the number reflecting it. */
|
|
33
|
+
delay: string;
|
|
34
|
+
limitations?: string;
|
|
35
|
+
status: 'available' | 'unavailable';
|
|
36
|
+
/** For unavailable metrics: what is needed first. */
|
|
37
|
+
prerequisite?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare const METRICS: readonly MetricDefinition[];
|
|
40
|
+
export declare const metric: (key: string) => MetricDefinition | undefined;
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
// src/catalog.ts
|
|
2
|
+
const GLOSSARY = [
|
|
3
|
+
{
|
|
4
|
+
term: "Organization",
|
|
5
|
+
definition: "The company account in the console. Console roles are granted for an organization or for one of its projects.",
|
|
6
|
+
docs: "concepts.md"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
term: "Project",
|
|
10
|
+
definition: "One product. Owns environments, service keys, usage and audit history. Projects can be disabled; deletion is not offered.",
|
|
11
|
+
aka: ["app", "application"],
|
|
12
|
+
docs: "projects-and-keys.md"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
term: "Environment",
|
|
16
|
+
definition: "Staging or production inside a project, with its own allowed origins, features, quotas, messaging policy and webhook endpoint. Data never crosses environments.",
|
|
17
|
+
docs: "concepts.md"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
term: "Tenant",
|
|
21
|
+
definition: "An optional partition inside an environment, such as a workspace. Conversations and presence stay within a tenant.",
|
|
22
|
+
docs: "concepts.md"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
term: "Service key",
|
|
26
|
+
definition: "The secret your backend uses for server-to-server calls (lynk_live_… or lynk_test_…). Shown once at creation; the console only shows its prefix, suffix, scopes and last use.",
|
|
27
|
+
aka: ["API key", "secret key"],
|
|
28
|
+
docs: "projects-and-keys.md"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
term: "Scope",
|
|
32
|
+
definition: "What a service key may do: calls:write, messaging:write or users:write.",
|
|
33
|
+
docs: "projects-and-keys.md"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
term: "Messaging token",
|
|
37
|
+
definition: "A 10-minute token your backend mints for one user and device; used for REST messaging, presence and the realtime socket.",
|
|
38
|
+
docs: "authentication.md"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
term: "Join token",
|
|
42
|
+
definition: "A 5-minute LiveKit token for one user and device in one call, with grants derived from the participant role.",
|
|
43
|
+
docs: "calls.md"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
term: "Call",
|
|
47
|
+
definition: "A media session of type one_to_one, group or livestream, created idempotently from your productCallId. Each call has one LiveKit room behind it.",
|
|
48
|
+
aka: ["room", "session"],
|
|
49
|
+
docs: "calls.md"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
term: "Room",
|
|
53
|
+
definition: "The LiveKit room that carries a call’s media. Lynkoria creates it; clients cannot.",
|
|
54
|
+
docs: "calls.md"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
term: "Livestream",
|
|
58
|
+
definition: "A call of type livestream: hosts and speakers publish, viewers only subscribe until promoted.",
|
|
59
|
+
docs: "livestreaming.md"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
term: "Participant",
|
|
63
|
+
definition: "One user on one device in a call. Identified by a LiveKit identity of the form project:user:device.",
|
|
64
|
+
docs: "calls.md"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
term: "Participant minutes",
|
|
68
|
+
definition: "Minutes participants spent in calls, summed per participant session and recorded when the session ends.",
|
|
69
|
+
aka: ["media minutes"],
|
|
70
|
+
docs: "console.md"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
term: "Conversation",
|
|
74
|
+
definition: "A durable, sequenced message thread with members.",
|
|
75
|
+
docs: "messaging.md"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
term: "Presence",
|
|
79
|
+
definition: "Whether a user has a live device lease in an environment and tenant (online, away, offline) and when they were last seen.",
|
|
80
|
+
docs: "presence.md"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
term: "Webhook delivery",
|
|
84
|
+
definition: "One signed POST of an event to your endpoint. Retried with backoff for up to 24 hours, then dead-lettered; admins can retry dead-lettered deliveries.",
|
|
85
|
+
docs: "webhooks.md"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
term: "Quota",
|
|
89
|
+
definition: "A per-environment limit enforced by the API: maximum room size, concurrent rooms and tokens per minute.",
|
|
90
|
+
aka: ["limit"],
|
|
91
|
+
docs: "limits.md"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
term: "Audit event",
|
|
95
|
+
definition: "An append-only record of a console or operator action: who, what, target, when, from where and the result.",
|
|
96
|
+
aka: ["audit log entry"],
|
|
97
|
+
docs: "console.md"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
term: "Console role",
|
|
101
|
+
definition: "owner, admin, developer or auditor, granted for an organization or one project. The API enforces it on every request.",
|
|
102
|
+
docs: "console.md"
|
|
103
|
+
}
|
|
104
|
+
];
|
|
105
|
+
const USAGE_SOURCE = "project_usage_hourly and project_usage_daily rollups, incremented by the API as events happen";
|
|
106
|
+
const USAGE_BUCKETS = "Hour (ranges up to 7 days) or UTC day";
|
|
107
|
+
const USAGE_RANGES = "Last 24 hours, 7, 30 or 90 days, or a custom range up to 400 days; hourly data covers the last 35 days";
|
|
108
|
+
const METRICS = [
|
|
109
|
+
{
|
|
110
|
+
key: "callCount",
|
|
111
|
+
label: "Calls created",
|
|
112
|
+
unit: "count",
|
|
113
|
+
description: "Calls (one-to-one, group and livestream) created by your backend. Repeating a create for an active productCallId returns the same call and is not counted again.",
|
|
114
|
+
source: USAGE_SOURCE,
|
|
115
|
+
aggregation: "sum",
|
|
116
|
+
buckets: USAGE_BUCKETS,
|
|
117
|
+
ranges: USAGE_RANGES,
|
|
118
|
+
kind: "historical",
|
|
119
|
+
delay: "About 15 seconds"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
key: "participantMinutes",
|
|
123
|
+
label: "Participant minutes",
|
|
124
|
+
unit: "minutes",
|
|
125
|
+
description: "Time participants spent in calls, summed over participant sessions. Livestream viewers count.",
|
|
126
|
+
source: USAGE_SOURCE,
|
|
127
|
+
aggregation: "sum",
|
|
128
|
+
buckets: USAGE_BUCKETS,
|
|
129
|
+
ranges: USAGE_RANGES,
|
|
130
|
+
kind: "historical",
|
|
131
|
+
delay: "Recorded when each participant session ends",
|
|
132
|
+
limitations: "Minutes are written when a participant session ends and are split across the hours and days in which they took place, so ongoing calls are not included until participants leave."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: "peakParticipants",
|
|
136
|
+
label: "Peak participants",
|
|
137
|
+
unit: "count",
|
|
138
|
+
description: "Highest number of participants connected at once in one environment during the bucket.",
|
|
139
|
+
source: USAGE_SOURCE,
|
|
140
|
+
aggregation: "max",
|
|
141
|
+
buckets: USAGE_BUCKETS,
|
|
142
|
+
ranges: USAGE_RANGES,
|
|
143
|
+
kind: "historical",
|
|
144
|
+
delay: "About 15 seconds",
|
|
145
|
+
limitations: "Across several environments or projects the console shows the highest single-environment peak, not a sum."
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
key: "messagesSent",
|
|
149
|
+
label: "Messages sent",
|
|
150
|
+
unit: "count",
|
|
151
|
+
description: "Messages stored. Edits, deletions and reactions are not counted; idempotent retries count once.",
|
|
152
|
+
source: USAGE_SOURCE,
|
|
153
|
+
aggregation: "sum",
|
|
154
|
+
buckets: USAGE_BUCKETS,
|
|
155
|
+
ranges: USAGE_RANGES,
|
|
156
|
+
kind: "historical",
|
|
157
|
+
delay: "About 15 seconds"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
key: "tokensIssued",
|
|
161
|
+
label: "Tokens issued",
|
|
162
|
+
unit: "count",
|
|
163
|
+
description: "Messaging tokens plus call join tokens minted by your backend.",
|
|
164
|
+
source: USAGE_SOURCE,
|
|
165
|
+
aggregation: "sum",
|
|
166
|
+
buckets: USAGE_BUCKETS,
|
|
167
|
+
ranges: USAGE_RANGES,
|
|
168
|
+
kind: "historical",
|
|
169
|
+
delay: "About 15 seconds"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
key: "apiRequests",
|
|
173
|
+
label: "API requests",
|
|
174
|
+
unit: "count",
|
|
175
|
+
description: "REST requests authenticated with a service key or a messaging token. Console and health requests are not counted.",
|
|
176
|
+
source: USAGE_SOURCE,
|
|
177
|
+
aggregation: "sum",
|
|
178
|
+
buckets: USAGE_BUCKETS,
|
|
179
|
+
ranges: USAGE_RANGES,
|
|
180
|
+
kind: "historical",
|
|
181
|
+
delay: "About 15 seconds",
|
|
182
|
+
limitations: "Requests rejected before authentication (bad or missing credentials) cannot be attributed to a project and are not counted."
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
key: "apiErrors",
|
|
186
|
+
label: "API errors",
|
|
187
|
+
unit: "count",
|
|
188
|
+
description: "Counted API requests answered with HTTP 4xx or 5xx.",
|
|
189
|
+
source: USAGE_SOURCE,
|
|
190
|
+
aggregation: "sum",
|
|
191
|
+
buckets: USAGE_BUCKETS,
|
|
192
|
+
ranges: USAGE_RANGES,
|
|
193
|
+
kind: "historical",
|
|
194
|
+
delay: "About 15 seconds",
|
|
195
|
+
limitations: "4xx responses include your own client errors (validation, quota), not only failures."
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
key: "errorRate",
|
|
199
|
+
label: "Error rate",
|
|
200
|
+
unit: "percent",
|
|
201
|
+
description: "API errors divided by API requests over the whole bucket or range.",
|
|
202
|
+
source: "Derived from the API requests and API errors sums (never an average of rates)",
|
|
203
|
+
aggregation: "ratio",
|
|
204
|
+
buckets: USAGE_BUCKETS,
|
|
205
|
+
ranges: USAGE_RANGES,
|
|
206
|
+
kind: "historical",
|
|
207
|
+
delay: "About 15 seconds"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
key: "activeCalls",
|
|
211
|
+
label: "Active calls",
|
|
212
|
+
unit: "count",
|
|
213
|
+
description: "Calls that have been created and not ended, by type.",
|
|
214
|
+
source: "call_sessions rows with status active",
|
|
215
|
+
aggregation: "count of current rows",
|
|
216
|
+
buckets: "None (current value)",
|
|
217
|
+
ranges: "Now",
|
|
218
|
+
kind: "live",
|
|
219
|
+
delay: "Immediate; the console refreshes every 15 seconds while visible",
|
|
220
|
+
limitations: "A call LiveKit has already closed stays active until the reconciler or the room_finished webhook ends it (normally within a minute)."
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
key: "activeParticipants",
|
|
224
|
+
label: "Connected participants",
|
|
225
|
+
unit: "count",
|
|
226
|
+
description: "Participant sessions that have joined and not left, across active calls.",
|
|
227
|
+
source: "media_participant_sessions rows without left_at (from LiveKit webhooks)",
|
|
228
|
+
aggregation: "count of current rows",
|
|
229
|
+
buckets: "None (current value)",
|
|
230
|
+
ranges: "Now",
|
|
231
|
+
kind: "live",
|
|
232
|
+
delay: "Seconds (LiveKit webhook delivery)"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
key: "livestreamAudience",
|
|
236
|
+
label: "Livestream audience",
|
|
237
|
+
unit: "count",
|
|
238
|
+
description: "Connected participants in active livestream calls (hosts, speakers and viewers).",
|
|
239
|
+
source: "media_participant_sessions joined to livestream call_sessions",
|
|
240
|
+
aggregation: "count of current rows",
|
|
241
|
+
buckets: "None (current value)",
|
|
242
|
+
ranges: "Now",
|
|
243
|
+
kind: "live",
|
|
244
|
+
delay: "Seconds (LiveKit webhook delivery)",
|
|
245
|
+
limitations: "Roles are not stored per session, so viewers and hosts are not split."
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
key: "roomUtilization",
|
|
249
|
+
label: "Concurrent room quota used",
|
|
250
|
+
unit: "percent",
|
|
251
|
+
description: "Active calls in an environment as a share of its maxConcurrentRooms limit, the same count the API uses to refuse new calls.",
|
|
252
|
+
source: "call_sessions (active) and the environment limits",
|
|
253
|
+
aggregation: "ratio",
|
|
254
|
+
buckets: "None (current value)",
|
|
255
|
+
ranges: "Now",
|
|
256
|
+
kind: "live",
|
|
257
|
+
delay: "Immediate"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
key: "staleCalls",
|
|
261
|
+
label: "Possibly stale calls",
|
|
262
|
+
unit: "count",
|
|
263
|
+
description: "Active calls with nobody connected that started more than 10 minutes ago. Normally ended by the reconciler; a growing number signals missed LiveKit webhooks.",
|
|
264
|
+
source: "call_sessions and media_participant_sessions",
|
|
265
|
+
aggregation: "count of current rows",
|
|
266
|
+
buckets: "None (current value)",
|
|
267
|
+
ranges: "Now",
|
|
268
|
+
kind: "live",
|
|
269
|
+
delay: "Immediate"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
key: "webhookPending",
|
|
273
|
+
label: "Webhook deliveries pending",
|
|
274
|
+
unit: "count",
|
|
275
|
+
description: "Outbound webhook events not yet delivered and not dead-lettered.",
|
|
276
|
+
source: "outbox_events",
|
|
277
|
+
aggregation: "count of current rows",
|
|
278
|
+
buckets: "None (current value)",
|
|
279
|
+
ranges: "Now",
|
|
280
|
+
kind: "live",
|
|
281
|
+
delay: "Immediate"
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
key: "webhookDead",
|
|
285
|
+
label: "Webhook deliveries dead-lettered",
|
|
286
|
+
unit: "count",
|
|
287
|
+
description: "Events that exhausted their retries (24 hours). Admins can retry them.",
|
|
288
|
+
source: "outbox_events",
|
|
289
|
+
aggregation: "count of current rows",
|
|
290
|
+
buckets: "None (current value)",
|
|
291
|
+
ranges: "Now",
|
|
292
|
+
kind: "live",
|
|
293
|
+
delay: "Immediate"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
key: "apiLatency",
|
|
297
|
+
label: "API latency (p50, p95, p99)",
|
|
298
|
+
unit: "seconds",
|
|
299
|
+
description: "Request latency percentiles computed from the lynkoria_http_request_duration_seconds histogram.",
|
|
300
|
+
source: "Prometheus",
|
|
301
|
+
aggregation: "max",
|
|
302
|
+
buckets: "—",
|
|
303
|
+
ranges: "—",
|
|
304
|
+
kind: "live",
|
|
305
|
+
delay: "—",
|
|
306
|
+
status: "unavailable",
|
|
307
|
+
prerequisite: "A monitoring backend scraping the API metrics port (PD-5), and a platform operator role to see it (PD-1)."
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
key: "onlineUsers",
|
|
311
|
+
label: "Users online",
|
|
312
|
+
unit: "count",
|
|
313
|
+
description: "Users with at least one live presence lease.",
|
|
314
|
+
source: "Redis presence leases",
|
|
315
|
+
aggregation: "count of current rows",
|
|
316
|
+
buckets: "—",
|
|
317
|
+
ranges: "—",
|
|
318
|
+
kind: "live",
|
|
319
|
+
delay: "—",
|
|
320
|
+
status: "unavailable",
|
|
321
|
+
prerequisite: "Presence is stored per user; an online counter per environment would have to be maintained by the presence service first."
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
key: "socketConnections",
|
|
325
|
+
label: "Realtime connections",
|
|
326
|
+
unit: "count",
|
|
327
|
+
description: "Connected Socket.IO clients across API instances.",
|
|
328
|
+
source: "lynkoria_sockets_connected gauge per instance",
|
|
329
|
+
aggregation: "sum",
|
|
330
|
+
buckets: "—",
|
|
331
|
+
ranges: "—",
|
|
332
|
+
kind: "live",
|
|
333
|
+
delay: "—",
|
|
334
|
+
status: "unavailable",
|
|
335
|
+
prerequisite: "A monitoring backend (PD-5); the gauge has no project label by design."
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
key: "infrastructure",
|
|
339
|
+
label: "CPU, memory, network, LiveKit node health",
|
|
340
|
+
unit: "percent",
|
|
341
|
+
description: "Host and media-server resource use.",
|
|
342
|
+
source: "Prometheus node and LiveKit exporters",
|
|
343
|
+
aggregation: "max",
|
|
344
|
+
buckets: "—",
|
|
345
|
+
ranges: "—",
|
|
346
|
+
kind: "live",
|
|
347
|
+
delay: "—",
|
|
348
|
+
status: "unavailable",
|
|
349
|
+
prerequisite: "A monitoring backend (PD-5) and a platform operator role (PD-1)."
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
key: "bandwidth",
|
|
353
|
+
label: "Bandwidth and egress",
|
|
354
|
+
unit: "count",
|
|
355
|
+
description: "Media and API bytes transferred per project.",
|
|
356
|
+
source: "Not recorded",
|
|
357
|
+
aggregation: "sum",
|
|
358
|
+
buckets: "—",
|
|
359
|
+
ranges: "—",
|
|
360
|
+
kind: "historical",
|
|
361
|
+
delay: "—",
|
|
362
|
+
status: "unavailable",
|
|
363
|
+
prerequisite: "LiveKit does not report bytes per room to the API today; would need Analytics or per-room stats collection."
|
|
364
|
+
}
|
|
365
|
+
].map((m) => {
|
|
366
|
+
m.status ??= "available";
|
|
367
|
+
return m;
|
|
368
|
+
});
|
|
369
|
+
const metric = (key) => METRICS.find((m) => m.key === key);
|
|
370
|
+
export { GLOSSARY, METRICS, metric };
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const ErrorCode: {
|
|
2
|
+
readonly BadRequest: 'bad_request';
|
|
3
|
+
readonly Unauthorized: 'unauthorized';
|
|
4
|
+
readonly Forbidden: 'forbidden';
|
|
5
|
+
readonly NotFound: 'not_found';
|
|
6
|
+
readonly Conflict: 'conflict';
|
|
7
|
+
readonly PayloadTooLarge: 'payload_too_large';
|
|
8
|
+
readonly RateLimited: 'rate_limited';
|
|
9
|
+
readonly QuotaExceeded: 'quota_exceeded';
|
|
10
|
+
readonly FeatureDisabled: 'feature_disabled';
|
|
11
|
+
readonly Internal: 'internal_error';
|
|
12
|
+
readonly Unavailable: 'service_unavailable';
|
|
13
|
+
};
|
|
14
|
+
export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
15
|
+
export type ErrorBody = {
|
|
16
|
+
error: {
|
|
17
|
+
code: ErrorCode;
|
|
18
|
+
message: string;
|
|
19
|
+
requestId?: string;
|
|
20
|
+
details?: unknown;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/** Typed error thrown by every Lynkoria SDK for non-2xx responses and socket failures. */
|
|
24
|
+
export declare class LynkoriaError extends Error {
|
|
25
|
+
readonly code: ErrorCode;
|
|
26
|
+
readonly status: number;
|
|
27
|
+
readonly requestId: string | undefined;
|
|
28
|
+
readonly details: unknown;
|
|
29
|
+
constructor(code: ErrorCode, message: string, status?: number, requestId?: string, details?: unknown);
|
|
30
|
+
static fromBody(status: number, body: unknown): LynkoriaError;
|
|
31
|
+
}
|