@thoughts-on-things/beacon-protocol 0.0.0-stage → 0.0.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 +27 -2
- package/dist/beacon-management.d.ts +203 -0
- package/dist/beacon-management.d.ts.map +1 -0
- package/dist/beacon-management.js +94 -0
- package/dist/beacon-management.js.map +1 -0
- package/dist/directory.d.ts +100 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +12 -0
- package/dist/directory.js.map +1 -0
- package/dist/fixtures.d.ts +141 -0
- package/dist/fixtures.d.ts.map +1 -0
- package/dist/fixtures.js +141 -0
- package/dist/fixtures.js.map +1 -0
- package/dist/index.d.ts +430 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +455 -0
- package/dist/index.js.map +1 -0
- package/dist/mod-relay.d.ts +26 -0
- package/dist/mod-relay.d.ts.map +1 -0
- package/dist/mod-relay.js +79 -0
- package/dist/mod-relay.js.map +1 -0
- package/dist/play.d.ts +57 -0
- package/dist/play.d.ts.map +1 -0
- package/dist/play.js +122 -0
- package/dist/play.js.map +1 -0
- package/dist/publish.d.ts +117 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/publish.js +133 -0
- package/dist/publish.js.map +1 -0
- package/package.json +66 -3
- package/src/beacon-management.ts +210 -0
- package/src/directory.ts +115 -0
- package/src/fixtures.ts +169 -0
- package/src/index.ts +538 -0
- package/src/mod-relay.ts +125 -0
- package/src/play.ts +152 -0
- package/src/publish.ts +237 -0
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,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @thoughts-on-things/beacon-protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The wire contract between a [Beacon](https://beacon-mc.io) server and Beacon
|
|
4
|
+
Atlas, the public directory: Zod schemas and TypeScript types for heartbeats,
|
|
5
|
+
directory listings, beacon management, `beacon://` play links and the mod
|
|
6
|
+
relay.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pnpm add @thoughts-on-things/beacon-protocol
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { heartbeatSchema } from "@thoughts-on-things/beacon-protocol";
|
|
14
|
+
import { parsePlayUri } from "@thoughts-on-things/beacon-protocol/play";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
| Entry point | Contents |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `.` | Core schemas shared by beacons and the Atlas |
|
|
20
|
+
| `./directory` | The Atlas's read-only public directory API |
|
|
21
|
+
| `./management` | What an operator can edit on their beacon's Atlas record |
|
|
22
|
+
| `./play` | `beacon://` play link parsing and building |
|
|
23
|
+
| `./mod-relay` | The beacon to Atlas mod-provider gateway |
|
|
24
|
+
| `./publish` | The beacon-side projector that turns runtime state into a heartbeat |
|
|
25
|
+
| `./fixtures` | Canonical heartbeats both sides test against |
|
|
26
|
+
|
|
27
|
+
Versioned with Beacon releases. Source and issues:
|
|
28
|
+
[thoughts-on-things/beacon-mc](https://github.com/thoughts-on-things/beacon-mc/tree/main/packages/beacon-protocol).
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type CommunityLocation, type Difficulty, type EventEntry, type JoinPolicy, type ProfilePrivacy, type ServerLocation } from "./index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Lifecycle of a beacon's directory presence. Staleness is NOT a value here: it
|
|
5
|
+
* is derived from the latest heartbeat timestamp at read time so it can't drift
|
|
6
|
+
* from a stored flag. `suspended` is the only non-`active` value written after
|
|
7
|
+
* first heartbeat (moderation).
|
|
8
|
+
*/
|
|
9
|
+
export declare const BEACON_STATUSES: readonly ["pending_verification", "active", "suspended"];
|
|
10
|
+
export type BeaconStatus = (typeof BEACON_STATUSES)[number];
|
|
11
|
+
/** Triage state of a public report filed against a beacon. */
|
|
12
|
+
export declare const REPORT_STATUSES: readonly ["open", "reviewed", "dismissed"];
|
|
13
|
+
export type ReportStatus = (typeof REPORT_STATUSES)[number];
|
|
14
|
+
/**
|
|
15
|
+
* Validation contract for every operator-editable field, run on both sides
|
|
16
|
+
* (dashboard before sending, Atlas endpoint before writing). All fields are
|
|
17
|
+
* optional: the editor submits one section at a time, so a partial patch is
|
|
18
|
+
* normal and only the fields sent are written. `status` is deliberately absent:
|
|
19
|
+
* a beacon can flip its own `listed` visibility but cannot self-suspend —
|
|
20
|
+
* moderation is Atlas-internal.
|
|
21
|
+
*/
|
|
22
|
+
export declare const beaconProfilePatchSchema: z.ZodObject<{
|
|
23
|
+
listed: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
name: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
25
|
+
description: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
26
|
+
mcAddress: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>]>>;
|
|
27
|
+
publicUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>]>>;
|
|
28
|
+
iconUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>]>>;
|
|
29
|
+
serverLocation: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
region: z.ZodEnum<{
|
|
31
|
+
na: "na";
|
|
32
|
+
sa: "sa";
|
|
33
|
+
eu: "eu";
|
|
34
|
+
uk: "uk";
|
|
35
|
+
africa: "africa";
|
|
36
|
+
asia: "asia";
|
|
37
|
+
oce: "oce";
|
|
38
|
+
other: "other";
|
|
39
|
+
}>;
|
|
40
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
41
|
+
subdivisionCode: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
42
|
+
locality: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
43
|
+
coordinates: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
lat: z.ZodNumber;
|
|
45
|
+
lon: z.ZodNumber;
|
|
46
|
+
precisionKm: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
communityLocation: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
region: z.ZodEnum<{
|
|
51
|
+
na: "na";
|
|
52
|
+
sa: "sa";
|
|
53
|
+
eu: "eu";
|
|
54
|
+
uk: "uk";
|
|
55
|
+
africa: "africa";
|
|
56
|
+
asia: "asia";
|
|
57
|
+
oce: "oce";
|
|
58
|
+
other: "other";
|
|
59
|
+
}>;
|
|
60
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
61
|
+
subdivisionCode: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
62
|
+
locality: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
63
|
+
coordinates: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
lat: z.ZodNumber;
|
|
65
|
+
lon: z.ZodNumber;
|
|
66
|
+
precisionKm: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
language: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
70
|
+
joinPolicy: z.ZodOptional<z.ZodEnum<{
|
|
71
|
+
gated: "gated";
|
|
72
|
+
open: "open";
|
|
73
|
+
}>>;
|
|
74
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
75
|
+
modpack: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>]>>;
|
|
76
|
+
profileEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
hostName: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>]>>;
|
|
78
|
+
vibe: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>]>>;
|
|
79
|
+
difficulty: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
80
|
+
peaceful: "peaceful";
|
|
81
|
+
easy: "easy";
|
|
82
|
+
normal: "normal";
|
|
83
|
+
hard: "hard";
|
|
84
|
+
hardcore: "hardcore";
|
|
85
|
+
}>>>;
|
|
86
|
+
discordUrl: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>]>>;
|
|
87
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>>;
|
|
88
|
+
noteBody: z.ZodOptional<z.ZodUnion<readonly [z.ZodNull, z.ZodString]>>;
|
|
89
|
+
events: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
90
|
+
at: z.ZodString;
|
|
91
|
+
title: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
92
|
+
detail: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
|
|
93
|
+
}, z.core.$strip>>>;
|
|
94
|
+
privacy: z.ZodOptional<z.ZodObject<{
|
|
95
|
+
coords: z.ZodDefault<z.ZodEnum<{
|
|
96
|
+
public: "public";
|
|
97
|
+
members: "members";
|
|
98
|
+
hidden: "hidden";
|
|
99
|
+
}>>;
|
|
100
|
+
roster: z.ZodDefault<z.ZodEnum<{
|
|
101
|
+
public: "public";
|
|
102
|
+
members: "members";
|
|
103
|
+
hidden: "hidden";
|
|
104
|
+
}>>;
|
|
105
|
+
activity: z.ZodDefault<z.ZodEnum<{
|
|
106
|
+
public: "public";
|
|
107
|
+
members: "members";
|
|
108
|
+
hidden: "hidden";
|
|
109
|
+
}>>;
|
|
110
|
+
mods: z.ZodDefault<z.ZodEnum<{
|
|
111
|
+
public: "public";
|
|
112
|
+
members: "members";
|
|
113
|
+
hidden: "hidden";
|
|
114
|
+
}>>;
|
|
115
|
+
perf: z.ZodDefault<z.ZodEnum<{
|
|
116
|
+
public: "public";
|
|
117
|
+
members: "members";
|
|
118
|
+
hidden: "hidden";
|
|
119
|
+
}>>;
|
|
120
|
+
}, z.core.$strip>>;
|
|
121
|
+
consentRoster: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
consentActivity: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
/** A partial edit to a beacon's management record. */
|
|
125
|
+
export type BeaconProfilePatch = z.infer<typeof beaconProfilePatchSchema>;
|
|
126
|
+
/**
|
|
127
|
+
* The fully-resolved profile content (JSON columns parsed, optional structures
|
|
128
|
+
* defaulted) the dashboard renders for editing and host-preview. No value is
|
|
129
|
+
* ever undefined.
|
|
130
|
+
*/
|
|
131
|
+
export interface BeaconProfile {
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
mcAddress: string | null;
|
|
135
|
+
publicUrl: string | null;
|
|
136
|
+
iconUrl: string | null;
|
|
137
|
+
serverLocation: ServerLocation;
|
|
138
|
+
communityLocation: CommunityLocation;
|
|
139
|
+
language: string;
|
|
140
|
+
joinPolicy: JoinPolicy;
|
|
141
|
+
tags: string[];
|
|
142
|
+
modpack: string | null;
|
|
143
|
+
profileEnabled: boolean;
|
|
144
|
+
hostName: string | null;
|
|
145
|
+
vibe: string | null;
|
|
146
|
+
difficulty: Difficulty | null;
|
|
147
|
+
discordUrl: string | null;
|
|
148
|
+
rules: string[];
|
|
149
|
+
noteBody: string | null;
|
|
150
|
+
events: EventEntry[];
|
|
151
|
+
privacy: ProfilePrivacy;
|
|
152
|
+
consentRoster: boolean;
|
|
153
|
+
consentActivity: boolean;
|
|
154
|
+
}
|
|
155
|
+
/** The latest heartbeat summary, surfaced so the dashboard can show liveness. */
|
|
156
|
+
export interface ManagementSnapshot {
|
|
157
|
+
/** Epoch ms of the last heartbeat, or null if the beacon has never sent one. */
|
|
158
|
+
lastHeartbeatAt: number | null;
|
|
159
|
+
online: boolean;
|
|
160
|
+
playersOnline: number;
|
|
161
|
+
playersMax: number;
|
|
162
|
+
}
|
|
163
|
+
/** A public report filed against this beacon, surfaced read-only to the host. */
|
|
164
|
+
export interface ManagementReport {
|
|
165
|
+
id: string;
|
|
166
|
+
reason: string;
|
|
167
|
+
detail: string | null;
|
|
168
|
+
status: ReportStatus;
|
|
169
|
+
/** Epoch ms. */
|
|
170
|
+
createdAt: number;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* The full management view of a beacon, returned by `GET /api/auth/beacon/me`:
|
|
174
|
+
* identity + visibility + parsed profile (unredacted — the host's own view) +
|
|
175
|
+
* latest liveness + reports. The dashboard renders entirely from this.
|
|
176
|
+
*/
|
|
177
|
+
export interface ManagementView {
|
|
178
|
+
/** The `client_id`: the beacon's single identity. */
|
|
179
|
+
id: string;
|
|
180
|
+
/** Display name (also the registration name). */
|
|
181
|
+
name: string;
|
|
182
|
+
/** Public directory slug; the `/b/<slug>` profile lives here when listed. */
|
|
183
|
+
slug: string;
|
|
184
|
+
/** Absolute `<issuer>/b/<slug>` deep-link to the public profile. */
|
|
185
|
+
profileUrl: string;
|
|
186
|
+
/** Registered OAuth redirect URIs. */
|
|
187
|
+
redirectUris: string[];
|
|
188
|
+
/** Directory lifecycle. */
|
|
189
|
+
status: BeaconStatus;
|
|
190
|
+
/** Whether the operator has opted into public directory listing. */
|
|
191
|
+
listed: boolean;
|
|
192
|
+
/** Epoch ms. */
|
|
193
|
+
createdAt: number;
|
|
194
|
+
/** Epoch ms of the last secret rotation, or null. */
|
|
195
|
+
rotatedAt: number | null;
|
|
196
|
+
/** The parsed, editable profile content (host's unredacted view). */
|
|
197
|
+
profile: BeaconProfile;
|
|
198
|
+
/** Latest heartbeat summary, or null if never seen. */
|
|
199
|
+
snapshot: ManagementSnapshot | null;
|
|
200
|
+
/** Public reports filed against this beacon, newest first. */
|
|
201
|
+
reports: ManagementReport[];
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=beacon-management.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beacon-management.d.ts","sourceRoot":"","sources":["../src/beacon-management.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAQL,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAMpB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,0DAIlB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,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AC;IACxB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,gFAAgF;IAChF,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,oEAAoE;IACpE,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,qEAAqE;IACrE,OAAO,EAAE,aAAa,CAAC;IACvB,uDAAuD;IACvD,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACpC,8DAA8D;IAC9D,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// The beacon management contract: what an operator can edit on their beacon's
|
|
2
|
+
// Atlas record, and the shape Atlas returns describing it. Single definition so
|
|
3
|
+
// `apps/web` (dashboard) and Beacon Atlas (endpoint) bind to one contract and
|
|
4
|
+
// can't drift. This is the authenticated control plane the operator drives by
|
|
5
|
+
// hand, separate from the per-tick wire heartbeat (`./publish`, `./index`).
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { communityLocationSchema, difficultySchema, eventEntrySchema, joinPolicySchema, privacySchema, sanitizeText, serverLocationSchema, } from "./index.js";
|
|
8
|
+
// ── Domain enums ─────────────────────────────────────────────────────────────
|
|
9
|
+
// Defined here (not in the Atlas schema) so table, endpoint, and dashboard all
|
|
10
|
+
// import one definition.
|
|
11
|
+
/**
|
|
12
|
+
* Lifecycle of a beacon's directory presence. Staleness is NOT a value here: it
|
|
13
|
+
* is derived from the latest heartbeat timestamp at read time so it can't drift
|
|
14
|
+
* from a stored flag. `suspended` is the only non-`active` value written after
|
|
15
|
+
* first heartbeat (moderation).
|
|
16
|
+
*/
|
|
17
|
+
export const BEACON_STATUSES = [
|
|
18
|
+
"pending_verification",
|
|
19
|
+
"active",
|
|
20
|
+
"suspended",
|
|
21
|
+
];
|
|
22
|
+
/** Triage state of a public report filed against a beacon. */
|
|
23
|
+
export const REPORT_STATUSES = ["open", "reviewed", "dismissed"];
|
|
24
|
+
// ── Field validators ────────────────────────────────────────────────────────
|
|
25
|
+
//
|
|
26
|
+
// A "single line" field collapses whitespace and strips control chars
|
|
27
|
+
// (`sanitizeText`) before length is measured. The host note stays multiline so
|
|
28
|
+
// paragraphs survive. These are the authoritative server-side checks; a form's
|
|
29
|
+
// `maxLength`/`<select>` attributes are only UX hints.
|
|
30
|
+
const singleLineText = (min, max) => z.string().transform(sanitizeText).pipe(z.string().min(min).max(max));
|
|
31
|
+
const optionalSingleLineText = (max) => z.union([z.null(), singleLineText(1, max)]).optional();
|
|
32
|
+
function isHttpsUrl(value) {
|
|
33
|
+
try {
|
|
34
|
+
return new URL(value).protocol === "https:";
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const optionalHttpsUrl = (max) => z
|
|
41
|
+
.union([
|
|
42
|
+
z.null(),
|
|
43
|
+
z
|
|
44
|
+
.string()
|
|
45
|
+
.transform((v) => v.trim())
|
|
46
|
+
.pipe(z
|
|
47
|
+
.string()
|
|
48
|
+
.min(1)
|
|
49
|
+
.max(max)
|
|
50
|
+
.refine(isHttpsUrl, { message: "must be a valid https:// URL" })),
|
|
51
|
+
])
|
|
52
|
+
.optional();
|
|
53
|
+
/**
|
|
54
|
+
* Validation contract for every operator-editable field, run on both sides
|
|
55
|
+
* (dashboard before sending, Atlas endpoint before writing). All fields are
|
|
56
|
+
* optional: the editor submits one section at a time, so a partial patch is
|
|
57
|
+
* normal and only the fields sent are written. `status` is deliberately absent:
|
|
58
|
+
* a beacon can flip its own `listed` visibility but cannot self-suspend —
|
|
59
|
+
* moderation is Atlas-internal.
|
|
60
|
+
*/
|
|
61
|
+
export const beaconProfilePatchSchema = z.object({
|
|
62
|
+
// Operator-controlled visibility. The primary public/private toggle.
|
|
63
|
+
listed: z.boolean().optional(),
|
|
64
|
+
// Directory identity.
|
|
65
|
+
name: singleLineText(3, 48).optional(),
|
|
66
|
+
description: z
|
|
67
|
+
.string()
|
|
68
|
+
.transform(sanitizeText)
|
|
69
|
+
.pipe(z.string().max(160))
|
|
70
|
+
.optional(),
|
|
71
|
+
mcAddress: optionalSingleLineText(120),
|
|
72
|
+
publicUrl: optionalHttpsUrl(200),
|
|
73
|
+
iconUrl: optionalHttpsUrl(300),
|
|
74
|
+
serverLocation: serverLocationSchema.optional(),
|
|
75
|
+
communityLocation: communityLocationSchema.optional(),
|
|
76
|
+
language: singleLineText(1, 16).optional(),
|
|
77
|
+
joinPolicy: joinPolicySchema.optional(),
|
|
78
|
+
tags: z.array(singleLineText(1, 40)).max(20).optional(),
|
|
79
|
+
modpack: optionalSingleLineText(80),
|
|
80
|
+
// Profile content.
|
|
81
|
+
profileEnabled: z.boolean().optional(),
|
|
82
|
+
hostName: optionalSingleLineText(48),
|
|
83
|
+
vibe: optionalSingleLineText(48),
|
|
84
|
+
difficulty: difficultySchema.nullable().optional(),
|
|
85
|
+
discordUrl: optionalHttpsUrl(200),
|
|
86
|
+
rules: z.array(singleLineText(1, 160)).max(40).optional(),
|
|
87
|
+
noteBody: z.union([z.null(), z.string().max(600)]).optional(),
|
|
88
|
+
events: z.array(eventEntrySchema).max(20).optional(),
|
|
89
|
+
privacy: privacySchema.optional(),
|
|
90
|
+
// Consent toggles for opt-in player-identity data the beacon may publish.
|
|
91
|
+
consentRoster: z.boolean().optional(),
|
|
92
|
+
consentActivity: z.boolean().optional(),
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=beacon-management.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"beacon-management.js","sourceRoot":"","sources":["../src/beacon-management.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,8EAA8E;AAC9E,4EAA4E;AAE5E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,oBAAoB,GAOrB,MAAM,YAAY,CAAC;AAEpB,gFAAgF;AAChF,+EAA+E;AAC/E,yBAAyB;AAEzB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,sBAAsB;IACtB,QAAQ;IACR,WAAW;CACH,CAAC;AAGX,8DAA8D;AAC9D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,WAAW,CAAU,CAAC;AAG1E,+EAA+E;AAC/E,EAAE;AACF,sEAAsE;AACtE,+EAA+E;AAC/E,+EAA+E;AAC/E,uDAAuD;AAEvD,MAAM,cAAc,GAAG,CAAC,GAAW,EAAE,GAAW,EAAE,EAAE,CAClD,CAAC,CAAC,MAAM,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C,QAAQ,EAAE;IAC7D,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IACpD,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IAEjC,0EAA0E;IAC1E,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACrC,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { CommunityLocation, JoinPolicy, Region, ServerLocation } from "./index.js";
|
|
2
|
+
/** One beacon as the public globe renders it: a pin with a derived place. */
|
|
3
|
+
export interface PublicGlobeBeacon {
|
|
4
|
+
/** Public slug: the `/b/[slug]` id and the globe pin key. */
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
serverLocation: ServerLocation;
|
|
8
|
+
communityLocation: CommunityLocation;
|
|
9
|
+
/** Short human label derived from tags / modpack. */
|
|
10
|
+
vibe: string;
|
|
11
|
+
/** Whether joining is invite-gated or open to any verified Atlas player. */
|
|
12
|
+
joinPolicy?: JoinPolicy;
|
|
13
|
+
/** Server-reported Minecraft version, when the latest heartbeat provided it. */
|
|
14
|
+
mcVersion?: string;
|
|
15
|
+
/** Public Minecraft connection address, when the operator published one. */
|
|
16
|
+
mcAddress?: string;
|
|
17
|
+
/** Players connected right now. */
|
|
18
|
+
online: number;
|
|
19
|
+
/** Player slot capacity. */
|
|
20
|
+
cap: number;
|
|
21
|
+
/** Whether the server itself is reachable: a beacon with zero players
|
|
22
|
+
* online may still be `isOnline: true`. Optional for forward-compat with
|
|
23
|
+
* older Atlas deployments that didn't carry it. */
|
|
24
|
+
isOnline?: boolean;
|
|
25
|
+
/** Map placement, derived deterministically from the slug + community location. */
|
|
26
|
+
lat: number;
|
|
27
|
+
lon: number;
|
|
28
|
+
/** Stable accent colour, keyed off the slug. */
|
|
29
|
+
color: string;
|
|
30
|
+
/** The beacon's public web-app origin (`https://play.example`), when the
|
|
31
|
+
* operator set one. The desktop launcher uses it to resolve the beacon's
|
|
32
|
+
* active play target (`GET <publicUrl>/api/play`) and to geo-match an
|
|
33
|
+
* installed server back to its pin. Absent when the operator left it blank. */
|
|
34
|
+
publicUrl?: string;
|
|
35
|
+
/** The `code` of the {@link PublicAtlasNode} that last ingested this
|
|
36
|
+
* beacon's heartbeat. Drives the transmission arc on selection.
|
|
37
|
+
* Optional for forward-compat with older Atlas deployments and beacons
|
|
38
|
+
* whose last heartbeat predates the introduction of node tracking. */
|
|
39
|
+
lastIngestNode?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* One Atlas node — a running directory process at a real location.
|
|
43
|
+
*
|
|
44
|
+
* Identity is derived from the location, so the `code` is the lower-cased
|
|
45
|
+
* country code plus a slug of the locality (`us-chicago`, `de-frankfurt`).
|
|
46
|
+
* Multiple machines in the same locality collapse to one node by design.
|
|
47
|
+
*/
|
|
48
|
+
export interface PublicAtlasNode {
|
|
49
|
+
/** Derived from location; never operator-typed. */
|
|
50
|
+
code: string;
|
|
51
|
+
/** Coarse social region for filtering (mirrors `Region` from the manifest). */
|
|
52
|
+
region: Region;
|
|
53
|
+
/** ISO 3166-1 α-2. */
|
|
54
|
+
countryCode: string;
|
|
55
|
+
/** ISO 3166-2 subdivision (optional). */
|
|
56
|
+
subdivisionCode?: string;
|
|
57
|
+
/** City / metro, the human-readable label. */
|
|
58
|
+
locality: string;
|
|
59
|
+
/** Approximate geographic point — the satellite's orbital anchor. */
|
|
60
|
+
lat: number;
|
|
61
|
+
lon: number;
|
|
62
|
+
}
|
|
63
|
+
/** Directory-wide counters for the globe HUD. */
|
|
64
|
+
export interface PublicDirectoryStats {
|
|
65
|
+
beacons: number;
|
|
66
|
+
online: number;
|
|
67
|
+
regions: number;
|
|
68
|
+
versions: number;
|
|
69
|
+
}
|
|
70
|
+
/** `GET /api/directory`: every publicly listed beacon, plus roll-up counters
|
|
71
|
+
* and the set of currently-live Atlas nodes. `nodes` is optional for
|
|
72
|
+
* forward-compat with older Atlas deployments. */
|
|
73
|
+
export interface DirectoryResponse {
|
|
74
|
+
beacons: PublicGlobeBeacon[];
|
|
75
|
+
stats: PublicDirectoryStats;
|
|
76
|
+
nodes?: PublicAtlasNode[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `GET /api/directory/[beaconId]`: one listing resolved by its opaque
|
|
80
|
+
* `beaconId`. Operator-typed identity (name, locations) is stored on the
|
|
81
|
+
* Atlas listing row, so every field is present from the moment the
|
|
82
|
+
* operator claims the listing — no heartbeat required.
|
|
83
|
+
*/
|
|
84
|
+
export interface BeaconLookupResponse {
|
|
85
|
+
/** The opaque `beaconId` that was looked up. */
|
|
86
|
+
id: string;
|
|
87
|
+
/** Canonical public slug minted by the Atlas. */
|
|
88
|
+
slug: string;
|
|
89
|
+
name: string;
|
|
90
|
+
/** Listing lifecycle status, e.g. `pending_verification` / `active`. */
|
|
91
|
+
status: string;
|
|
92
|
+
serverLocation: ServerLocation;
|
|
93
|
+
communityLocation: CommunityLocation;
|
|
94
|
+
/** Published globe placement, derived from the community location. */
|
|
95
|
+
lat: number;
|
|
96
|
+
lon: number;
|
|
97
|
+
/** Absolute URL of the public profile page on the Atlas. */
|
|
98
|
+
profileUrl: string;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=directory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../src/directory.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExF,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,cAAc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oB,CAAC;IAC5B,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,cAAc,CAAC;IAC/B,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// The Atlas public directory API contract.
|
|
2
|
+
//
|
|
3
|
+
// The Atlas exposes a small, friendly read-only API so a beacon's own
|
|
4
|
+
// onboarding flow can render the live globe and resolve where its draft
|
|
5
|
+
// listing will land. These are the response shapes for those endpoints —
|
|
6
|
+
// the single source of truth both the Atlas (which serves them) and a beacon
|
|
7
|
+
// (which fetches them) type against, so the two can never silently disagree.
|
|
8
|
+
//
|
|
9
|
+
// Everything here is *public*: it is derived from already-public listing
|
|
10
|
+
// facts. No credential, owner id, or secret has a field to ride on.
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=directory.js.map
|