@q9labsai/chalk-client 5.1.0 → 5.2.1
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/CHANGELOG.md +125 -0
- package/dist/chat-files/types.d.ts +3 -0
- package/dist/chunk-6LNRDKJF.js +162 -0
- package/dist/{chunk-3ZN7IXOZ.js → chunk-GA3JDPFI.js} +252 -2
- package/dist/{chunk-RJRSLXVT.js → chunk-RVUN6LW4.js} +764 -265
- package/dist/{chunk-K7PNW3KI.js → chunk-TVNI2XUZ.js} +172 -18
- package/dist/client.d.ts +205 -0
- package/dist/connection/dependencies.d.ts +3 -0
- package/dist/connection/diagnostics.d.ts +3 -2
- package/dist/connection/index.d.ts +1 -0
- package/dist/connection/lifecycle.d.ts +1 -0
- package/dist/connection/types.d.ts +2 -0
- package/dist/effect.js +62 -4
- package/dist/generated/http-api.d.ts +201 -0
- package/dist/generated/schemas.d.ts +373 -0
- package/dist/generated/sync.d.ts +74 -3
- package/dist/generated/whiteboard-v1.d.ts +71 -9
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -14
- package/dist/public-invites/code.d.ts +1 -0
- package/dist/public-invites/index.d.ts +1 -0
- package/dist/public-invites/index.js +6 -4
- package/dist/public-invites/words.d.ts +2 -0
- package/dist/space-client/reload-rejoin.d.ts +1 -1
- package/dist/space-client/types.d.ts +10 -1
- package/dist/sync/connect-diagnostics.d.ts +10 -0
- package/dist/sync/index.js +1 -1
- package/dist/sync/types.d.ts +1 -0
- package/dist/sync/v1-client.d.ts +2 -0
- package/dist/sync/v1-types.d.ts +8 -0
- package/dist/whiteboard/index.d.ts +2 -5
- package/dist/whiteboard/types.d.ts +26 -3
- package/dist/whiteboard/v1-client.d.ts +3 -1
- package/dist/whiteboard/v1-codec.d.ts +5 -1
- package/dist/whiteboard/v1-multipart.d.ts +1 -1
- package/dist/whiteboard/view-bounds.d.ts +5 -0
- package/dist/whiteboard/view-versions.d.ts +9 -0
- package/package.json +1 -1
- package/dist/chunk-KHHULLBZ.js +0 -142
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,130 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.2.0
|
|
4
|
+
|
|
5
|
+
### board-draw-policy
|
|
6
|
+
|
|
7
|
+
Add a call-wide drawing policy for the board: everyone, only hosts, or picked people.
|
|
8
|
+
Hosts set it with `setDrawPolicy` on the whiteboard transport and pick people with the
|
|
9
|
+
existing `setDrawPermission`. Sync computes each person's permission and sends it with
|
|
10
|
+
the policy over the new `draw_policy_v1` extension, so the summary and
|
|
11
|
+
`useWhiteboard().access` now carry `canDraw`, `drawPolicy` and the host's per-person
|
|
12
|
+
choices. The React board follows that permission instead of the role capability, and
|
|
13
|
+
hosts get a "Who can draw" section with a person picker in the board menu.
|
|
14
|
+
|
|
15
|
+
The whiteboard client now steps its hello down only when Sync can't decode it (close
|
|
16
|
+
1009). A rejected token or a late hello (close 1008) is retried at the same level up to
|
|
17
|
+
four times, so a brief token problem no longer hides the drawing policy for the rest of
|
|
18
|
+
the connection. On a Sync without the drawing policy, a host's waiting policy change is
|
|
19
|
+
refused as `unavailable`, and also reported on the summary, instead of being replayed.
|
|
20
|
+
|
|
21
|
+
### confirmed-call-entry
|
|
22
|
+
|
|
23
|
+
Count a person in a call only after they have fully entered it. The built-in
|
|
24
|
+
browser and React Native Sync clients ask Sync for entry confirmation on the Sync
|
|
25
|
+
URL (`entry_confirmation=1`). When Sync's `welcome` grants it, the client sends
|
|
26
|
+
`entered` once Sync is live and media has started, so a failed connection no
|
|
27
|
+
longer leaves a ghost participant or an attendance record. Against an older Sync,
|
|
28
|
+
the client sends the previous hello and Sync confirms entry at hello as before.
|
|
29
|
+
|
|
30
|
+
`confirmEntered()` on a custom `createSyncClient` implementation is optional.
|
|
31
|
+
Implementing it, and building `V1SyncClient` with `entryConfirmation: true`, adds
|
|
32
|
+
the confirmed entry above. Without it, the client never asks for entry
|
|
33
|
+
confirmation and Sync confirms the entry at hello, as in 5.0.x. `V1SyncClient`
|
|
34
|
+
asks only when it is built with `entryConfirmation: true`.
|
|
35
|
+
|
|
36
|
+
When entry fails, the client cancels the pending admission through the new
|
|
37
|
+
`cancelEpisodeParticipantJoin` endpoint (`POST .../participants/:participant_id/cancel-join`),
|
|
38
|
+
and a retry keeps the same person. If Sync reports `entry timeout` because the
|
|
39
|
+
pending seat expired before entry, the connection fails as a retryable
|
|
40
|
+
`sync_start_failed` instead of rejected access, and the client does not reconnect
|
|
41
|
+
the expired seat with the same grant.
|
|
42
|
+
|
|
43
|
+
The admission contract declares the 409 `participant.not_active` response when
|
|
44
|
+
a retried admission names a participant that has already left. The public
|
|
45
|
+
`AdmitEpisodeParticipantError` union stays compatible with 5.1.0; this response
|
|
46
|
+
uses the existing `HttpClientError` channel, with its code in the response body.
|
|
47
|
+
The dashboard reads that code and retries once with a fresh join key.
|
|
48
|
+
|
|
49
|
+
Sync assigns each entry a participant-local generation and returns it in
|
|
50
|
+
`welcome`. The client resumes that generation through the `entry_generation`
|
|
51
|
+
WebSocket query, even after refreshing its credential. Confirmation advances
|
|
52
|
+
ownership only forward and voids older pending Leaves. Acceptance and completion
|
|
53
|
+
both fence a Leave against the confirmed generation, so reattaching the same
|
|
54
|
+
seat cannot let the previous mount remove it. Previous Sync ignores this query.
|
|
55
|
+
Legacy sockets receive a server generation internally without changing their
|
|
56
|
+
welcome frame, and still confirm at hello. Participants created before seat
|
|
57
|
+
storage acquire it on their first live hello. When recovery replaces the Sync
|
|
58
|
+
client, it confirms the replacement entry before reporting recovery complete.
|
|
59
|
+
Completed startup also survives reconnecting from an older Sync to an upgraded
|
|
60
|
+
one. Recovery can finish while a previous entry's Leave is pending, and an
|
|
61
|
+
uncertain confirmation reply checks that entry's generation before acknowledging it.
|
|
62
|
+
A claimed Leave blocks later entry
|
|
63
|
+
admission until its provider work settles. An entry admitted before that claim
|
|
64
|
+
defers the older provider work until confirmation or its two-minute startup
|
|
65
|
+
lease expires, preventing old cleanup from closing the new entry's media.
|
|
66
|
+
|
|
67
|
+
Rollout: apply the database migrations first, then upgrade Sync, then the API and
|
|
68
|
+
this client. This client also works with an older Sync, and published 5.0.x
|
|
69
|
+
clients keep hello confirmation with the new Sync.
|
|
70
|
+
|
|
71
|
+
### follow-view-owner
|
|
72
|
+
|
|
73
|
+
Converge Follow views on one Episode owner, recover from its canonical snapshot,
|
|
74
|
+
and preserve real camera moves during recovery and tab switches. Zoom controls
|
|
75
|
+
and keyboard moves now consistently leave Follow and lead the person's view.
|
|
76
|
+
|
|
77
|
+
Keep all 500 active people's views using internal schema-generated limits in the client and React caches. The client's public bounds, event unions and decoded-frame unions are unchanged. The client now exports `ChalkWhiteboardViewVersions`, which the React SDK uses to order view moves, and whiteboard view events now carry `ownerId`, `ownerSequence` and `originEpoch`, so both releases are minor.
|
|
78
|
+
|
|
79
|
+
### honest-chat-file-errors
|
|
80
|
+
|
|
81
|
+
Report chat attachment network and browser access failures without blaming storage.
|
|
82
|
+
Keep token acquisition failures separate with a diagnostic stage while preserving
|
|
83
|
+
the published error codes and original cause. Preserve recoverable access and
|
|
84
|
+
connection failures through SpaceClient, including signed storage uploads. Show
|
|
85
|
+
the storage-unavailable message only when a readable 503 response confirms
|
|
86
|
+
`chat.storage_unavailable`.
|
|
87
|
+
|
|
88
|
+
### problem-reporting
|
|
89
|
+
|
|
90
|
+
Add the problem-report API contract and reusable report dialog, with opt-in diagnostics,
|
|
91
|
+
editable delivery failures and bounded Unicode input. Call details and failed or ended
|
|
92
|
+
call screens can expose reporting when an integration supplies a delivery callback.
|
|
93
|
+
Use `reportUnavailableReason` to show expired access inside an editable report.
|
|
94
|
+
Live report drafts survive call termination. Integrations with their own terminal
|
|
95
|
+
screens can use `onOpenReportProblem` to keep one app-owned dialog across those screens.
|
|
96
|
+
Give `ReportProblemDialog` a `focusScope` containing the current call or terminal screen,
|
|
97
|
+
so closing it returns focus to its usable opener, or to a visible current control
|
|
98
|
+
when the opener has disappeared. Hidden, inert and disabled targets are skipped.
|
|
99
|
+
|
|
100
|
+
### recording-auto-render
|
|
101
|
+
|
|
102
|
+
Expose recording expiry reasons through additive failure fields while preserving the existing export status enum.
|
|
103
|
+
|
|
104
|
+
Add the Tenant recording_render_mode setting, defaulting to on_demand, with opt-in automatic MP4 rendering.
|
|
105
|
+
|
|
106
|
+
### recording-transcription-expiry
|
|
107
|
+
|
|
108
|
+
Recordings now report when their transcription source expires, as
|
|
109
|
+
`transcription_preparation.expires_at`. A transcript can be requested only
|
|
110
|
+
while `transcription_preparation.status` is `ready` and this time is ahead. It
|
|
111
|
+
is never later than `source.expires_at`, and it can be much earlier, because a
|
|
112
|
+
Space's transcription source window is often shorter than its video retention. The field is
|
|
113
|
+
absent when transcription is disabled or no transcription source exists yet.
|
|
114
|
+
|
|
115
|
+
### space-activity-read
|
|
116
|
+
|
|
117
|
+
Add `spaces.listSpaceActivity` (`GET /v1/tenants/{tenant_id}/space-activity`) and
|
|
118
|
+
its generated schemas and types. One read returns, for up to 300 Spaces, whether each
|
|
119
|
+
is archived, the live Episode with its full participant count and first five Participants, the latest
|
|
120
|
+
Episode with its status and start and end times, and up to five Participants who
|
|
121
|
+
most recently joined that Episode. It needs `episodes:read`; an unknown or other
|
|
122
|
+
Tenant's Space returns `404` for the whole batch. Existing operations are unchanged.
|
|
123
|
+
|
|
124
|
+
### sync-connect-diagnostics
|
|
125
|
+
|
|
126
|
+
Report Sync connection failures with the existing `connection.sync_hello_timeout` code without adding values to the public `ErrorCode` union. Add the current attempt's safe diagnostics to client errors, telemetry, and the call failure reference: opening/hello stage, close code and bounded reason, whether the socket opened, and elapsed time. Earlier attempts remain in the diagnostic history. Browsers do not expose DNS, TCP, or TLS progress. Unrecognized peer reasons are redacted. This is a compatible patch for the next client and React releases; released 5.1.0 files are unchanged.
|
|
127
|
+
|
|
3
128
|
## 5.1.0
|
|
4
129
|
|
|
5
130
|
- Add shared board views: `ChalkWhiteboardView`, `ChalkWhiteboardViewBounds`, and the whiteboard client's `supportsViews` and `sendView()`, so participants can follow a person's board view or bring everyone to theirs. The board stream also carries a `view` event.
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { ChalkChatAttachment, ChalkChatAttachmentMimeType } from "../collaboration/types";
|
|
2
2
|
export type ChalkChatFileOperation = "initiate_upload" | "finalize_upload" | "get_download";
|
|
3
|
+
export declare const CHAT_FILE_REACHABILITY_MESSAGE = "Could not reach the chat attachment service (network or browser access failure).";
|
|
3
4
|
export type ChalkChatFileErrorCode = "access.invalid" | "unavailable" | "permission_denied" | "invalid_payload" | "conflict" | "not_found" | "expired" | "file_transfer_failed";
|
|
4
5
|
export type ChalkChatFileFailure = {
|
|
5
6
|
readonly operation: ChalkChatFileOperation;
|
|
6
7
|
readonly code: ChalkChatFileErrorCode;
|
|
7
8
|
readonly recoverable: boolean;
|
|
8
9
|
readonly message: string;
|
|
10
|
+
readonly stage?: "token" | "request";
|
|
9
11
|
};
|
|
10
12
|
export declare class ChalkChatFileError extends Error {
|
|
11
13
|
readonly operation: ChalkChatFileOperation;
|
|
12
14
|
readonly code: ChalkChatFileErrorCode;
|
|
13
15
|
readonly recoverable: boolean;
|
|
16
|
+
readonly stage: "token" | "request";
|
|
14
17
|
constructor(failure: ChalkChatFileFailure, options?: ErrorOptions);
|
|
15
18
|
}
|
|
16
19
|
export type ChalkChatFileTransport = {
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createChalkEffectClient,
|
|
3
|
+
parseAccessGrant
|
|
4
|
+
} from "./chunk-GA3JDPFI.js";
|
|
5
|
+
|
|
6
|
+
// src/public-invites/client.ts
|
|
7
|
+
import { Effect } from "effect";
|
|
8
|
+
function createChalkPublicClient(options) {
|
|
9
|
+
const baseClientOptions = {
|
|
10
|
+
baseUrl: options.baseUrl,
|
|
11
|
+
credentials: options.credentials ?? (options.runtime === "react-native" ? void 0 : "include"),
|
|
12
|
+
fetch: options.fetch
|
|
13
|
+
};
|
|
14
|
+
const createClient = (guestCredential, requestInit) => createChalkEffectClient({
|
|
15
|
+
...baseClientOptions,
|
|
16
|
+
...requestInit ? { fetch: requestInitFetch(options.fetch, requestInit) } : {},
|
|
17
|
+
headers: requestHeaders(options, guestCredential)
|
|
18
|
+
});
|
|
19
|
+
const createPublicSpace = async (input, idempotency) => {
|
|
20
|
+
const client = await Effect.runPromise(createClient(void 0));
|
|
21
|
+
const response = await Effect.runPromise(
|
|
22
|
+
client.spaces.createPublicSpace({
|
|
23
|
+
headers: { "Idempotency-Key": idempotencyKey(idempotency) },
|
|
24
|
+
payload: { display_name: required(input.displayName, "displayName") }
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
return publicSpaceCreated(response);
|
|
28
|
+
};
|
|
29
|
+
const arriveBySpacePublicInvite = async (input, arrival) => {
|
|
30
|
+
const client = await Effect.runPromise(createClient(arrival?.guestCredential ?? options.guestCredential));
|
|
31
|
+
const response = await Effect.runPromise(
|
|
32
|
+
client.spaces.arriveBySpacePublicInvite({
|
|
33
|
+
headers: {
|
|
34
|
+
"Idempotency-Key": idempotencyKey(arrival),
|
|
35
|
+
...arrival?.arrivalHandle === void 0 ? {} : { "X-Chalk-Arrival-Handle": required(arrival.arrivalHandle, "arrivalHandle") }
|
|
36
|
+
},
|
|
37
|
+
payload: {
|
|
38
|
+
display_name: required(input.displayName, "displayName"),
|
|
39
|
+
space_invite_token: required(input.spaceInviteToken, "spaceInviteToken")
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
return publicSpaceArrival(response);
|
|
44
|
+
};
|
|
45
|
+
const getSpacePublicInviteArrival = async (reference) => {
|
|
46
|
+
const normalized = arrivalReference(reference);
|
|
47
|
+
const client = await Effect.runPromise(createClient(normalized.guestCredential ?? options.guestCredential));
|
|
48
|
+
const response = await Effect.runPromise(
|
|
49
|
+
client.spaces.getSpacePublicInviteArrival({
|
|
50
|
+
headers: { "X-Chalk-Arrival-Handle": normalized.arrivalHandle }
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
return publicSpaceArrival(response);
|
|
54
|
+
};
|
|
55
|
+
const refreshSpacePublicInviteAccess = async (input, arrival) => {
|
|
56
|
+
const normalized = refreshInput(input, arrival);
|
|
57
|
+
const client = await Effect.runPromise(createClient(normalized.guestCredential ?? options.guestCredential, normalized.signal ? { signal: normalized.signal } : void 0));
|
|
58
|
+
const response = await Effect.runPromise(
|
|
59
|
+
client.spaces.refreshSpacePublicInviteAccess({
|
|
60
|
+
headers: { "X-Chalk-Arrival-Handle": normalized.arrivalHandle },
|
|
61
|
+
payload: { media_proof: required(normalized.mediaProof, "mediaProof"), replace_media_connection: normalized.replaceMediaConnection ?? false }
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
return parseAccessGrant(response);
|
|
65
|
+
};
|
|
66
|
+
const leaveSpacePublicInviteArrival = async (reference, leaveOptions) => {
|
|
67
|
+
const normalized = arrivalReference(reference);
|
|
68
|
+
const client = await Effect.runPromise(createClient(normalized.guestCredential ?? options.guestCredential, requestInitForLeave(leaveOptions)));
|
|
69
|
+
await Effect.runPromise(
|
|
70
|
+
client.spaces.leaveSpacePublicInviteArrival({
|
|
71
|
+
headers: { "X-Chalk-Arrival-Handle": normalized.arrivalHandle }
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
prepareSpaceEntrance: async (spaceInviteToken) => {
|
|
77
|
+
const client = await Effect.runPromise(createClient(void 0));
|
|
78
|
+
await Effect.runPromise(client.spaces.preparePublicSpaceEntrance({ payload: { space_invite_token: required(spaceInviteToken, "spaceInviteToken") } }));
|
|
79
|
+
},
|
|
80
|
+
arrive: arriveBySpacePublicInvite,
|
|
81
|
+
arriveBySpacePublicInvite,
|
|
82
|
+
create: createPublicSpace,
|
|
83
|
+
createPublicSpace,
|
|
84
|
+
getSpacePublicInviteArrival,
|
|
85
|
+
leave: leaveSpacePublicInviteArrival,
|
|
86
|
+
leaveSpacePublicInviteArrival,
|
|
87
|
+
refresh: refreshSpacePublicInviteAccess,
|
|
88
|
+
refreshSpacePublicInviteAccess,
|
|
89
|
+
status: getSpacePublicInviteArrival
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
var createChalkPublicInviteClient = createChalkPublicClient;
|
|
93
|
+
function requestHeaders(options, guestCredential) {
|
|
94
|
+
const headers = { ...options.headers };
|
|
95
|
+
if (options.runtime === "react-native") {
|
|
96
|
+
headers["X-Chalk-Client"] = "react-native";
|
|
97
|
+
const credential = guestCredential ?? options.guestCredential;
|
|
98
|
+
if (credential !== void 0) headers.Authorization = `ChalkGuest ${required(credential, "guestCredential")}`;
|
|
99
|
+
}
|
|
100
|
+
return headers;
|
|
101
|
+
}
|
|
102
|
+
function idempotencyKey(options) {
|
|
103
|
+
return options?.idempotencyKey === void 0 ? globalThis.crypto.randomUUID() : required(options.idempotencyKey, "idempotencyKey");
|
|
104
|
+
}
|
|
105
|
+
function arrivalReference(reference) {
|
|
106
|
+
if (typeof reference === "string") return { arrivalHandle: required(reference, "arrivalHandle") };
|
|
107
|
+
return { arrivalHandle: required(reference.arrivalHandle, "arrivalHandle"), guestCredential: reference.guestCredential };
|
|
108
|
+
}
|
|
109
|
+
function refreshInput(input, arrival) {
|
|
110
|
+
const values = typeof input === "string" ? { arrivalHandle: arrival?.arrivalHandle, guestCredential: arrival?.guestCredential, mediaProof: input } : { arrivalHandle: input.arrivalHandle ?? arrival?.arrivalHandle, guestCredential: input.guestCredential ?? arrival?.guestCredential, mediaProof: input.mediaProof, replaceMediaConnection: input.replaceMediaConnection, signal: input.signal };
|
|
111
|
+
return {
|
|
112
|
+
...values,
|
|
113
|
+
arrivalHandle: required(values.arrivalHandle ?? "", "arrivalHandle")
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function requestInitForLeave(options) {
|
|
117
|
+
if (options?.keepalive === void 0) return void 0;
|
|
118
|
+
return { keepalive: options.keepalive };
|
|
119
|
+
}
|
|
120
|
+
function requestInitFetch(fetchImplementation, requestInit) {
|
|
121
|
+
const implementation = fetchImplementation ?? globalThis.fetch;
|
|
122
|
+
return (input, init) => implementation(input, { ...init, ...requestInit });
|
|
123
|
+
}
|
|
124
|
+
function publicSpaceCreated(value) {
|
|
125
|
+
const { arrival, ...created } = value;
|
|
126
|
+
return { ...created, arrival: publicSpaceArrival(arrival) };
|
|
127
|
+
}
|
|
128
|
+
function publicSpaceArrival(value) {
|
|
129
|
+
const { access, ...arrival } = value;
|
|
130
|
+
if (access === void 0) return arrival;
|
|
131
|
+
return { ...arrival, access: access === null ? null : parseAccessGrant(access) };
|
|
132
|
+
}
|
|
133
|
+
function required(value, name) {
|
|
134
|
+
const normalized = value.trim();
|
|
135
|
+
if (!normalized) throw new TypeError(`${name} is required`);
|
|
136
|
+
return normalized;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// src/public-invites/words.ts
|
|
140
|
+
var INVITE_WORD_COUNT = 4;
|
|
141
|
+
var INVITE_WORDS = new Set(
|
|
142
|
+
"abacus able accent acorn acoustic acre acrobat active actor adore aerial agenda agent agile ahead aim airport album alike alive almond aloe aloha alone alpaca alto alumni amber amend ample amuse anchor angle animal anthem antique anvil apple april apron aqua arcade arctic area arena arise aroma array art artist aspire astute atlas atom attach attain attic audio autumn avenue avocado awake award awning bacon badge bagel baked baker bakery bamboo banana banjo banner barge barn basil basket batch baton beacon beetle blank blanket blaze blend blink blog blossom bluebird boat bobcat bolt bonsai bonus book booth boots boss botany both bottle boulder bounce bowler branch breeze brick bright brim bring brisk broil bronze brook broom brush bubble bucket budget buffalo builder bulb bulk bunch bundle bunny busy butter button buzz cabana cable cactus cake calm cameo camera camper campus canal canary candle candy canopy canyon cape captain carbon card cargo carrot carry cartoon case castle catalog cedar celery chair charm cheer cheese chef cherry chess chief chill chip chunk churn cinema circle circus citrus city civic civil claim clamp clap clasp class clay clean clear clever click cling clip cloak clock clone closet cloth cloud clover clump coach coast coat cobalt cocoa coconut coffee coil cola cold colony comfy comic compass concert condor cone cookie cope copper copy coral cork corner cosmic cost cotton couch cover craft crane crate crave crawl crayon create cricket crisp crop crowd crown crumb crust crystal cub cube cupcake curl curry cursor curve cut cycle daffodil daily daisy dance dash date dawn deal debug decaf deck decor delta deluxe denim depth desk device dial diary dice dig dime diner dinner disco dish dock doing doll dolphin domain dome donut dot down dragon dragonfly drama draw drawing dress dried drift drill drive drizzle drove drum dry duck duke duo dusk dust duty eagle early earth easel east echo eclipse edge editor eel effort elder elf elk elm email ember emblem emboss emerald encore energy engine enrich enter entry equal equator eraser errand even evolve exact exit expert fable fabric fact factory falcon fall fame family fancy feast feather feed fence fern ferry fetch fiber fiddle figure film filter final finale finch firefly fit five flag flame flap flick flight flip float flock flower foam fog foil folk font food forest fossil found fountain fox frame fresh fridge friend from front frost fruit gala galaxy game gap garage garden garlic gave gazebo gear gecko gem gerbil giant gift gig ginger giraffe glacier glad glass glide glitter glory gloss glove glow glue goal going golden golf good gown grab grain granite grant grape graph grasp grass gravy green greet grew grid grill grip groom groove guide guitar gulf gummy gush habit half hamster happy harvest hatch haven hazel hazy heap heat hedge helium helmet help heron hickory holiday honey horizon hub hula hull human humid hurry hut ice iceberg icing icon igloo image insect iron island item ivory ivy jacket jaguar jam jasmine jazz jelly jersey jet jigsaw job jog jolly jolt journal joy judge juice juicy july jumbo jump jungle keep kettle kilt king kite kitten kiwi koala ladder lady lagoon lake lamp land lantern laptop large latch laurel lavender leaflet legend lemon length lens leopard letter lettuce level lever library lid life lift lilac lily limit line linen lint lion liquid list little lively lizard lobster locket lotus luggage lumber lunar lunch lyric magnet maker mango manor many map maple marble marine market mascot mash match math meadow melon mercury meteor mitten mocha monkey mop mosaic motor motto mount mouse move movie mud muffin mug mural muse museum mushroom music nacho nail name nap napkin nature neat nectar neon nest net next nickel noodle nugget nutmeg nylon oak oasis oat oatmeal ocean octagon octopus oil olive onion opal open opera orchid origami otter outdoor outer oval oven owl oxygen oyster ozone pace packet pager palace palm panda panther pantry pants papaya paper parade parcel park parrot parsley party pasta pastel patch path patio pebble pecan pelican pencil penguin penny pepper perch petal photo picnic pigeon pillow plank plant plaza plenty pluck plug plus pod poem poet point polar polka polo pond pony poppy portal poster pouch pound power press print prism prize proof pug pull pulp pulse puma pupil puppet puppy purse push puzzle quiet quilt quota quote race rack radar radio radish raft rail rake rally ramp ranch range ranger rank raven reach react recap relax relay relic remix repay reply rerun reset rhyme ribbon rice rich ride rinse ripple rise river robe robin rock rocket rope rover royal ruby rug rule rush safari sage salad salon salsa salt sample sandy satin say scale scan scarf scoop scoot scope score scout scrap screen script scrub scuba scuff sedan send serve seven shack shade shaky shape shed sheep shelf shell shine shiny ship shirt shop shore sift silk silly silver simple single sip size skate sketch skid skip skirt sky slab slack slate sled sleek sleep slice slick sling slip slush small smile snack snap snowy speak speed spend spent spill spiny spoke sponge spool spoon sport spot spout spray spring sprint sprout spruce spur squad squid stack staff stage stall stamp stand staple start state statue steam steep stem step stereo stew stick sting stir stock stool stop storm stove straw stream street strut stuck studio stuff stump stunt subway sugar surf sushi swan sway sweep swell swim swing swipe swirl swoop syrup tablet taco tag take tall task taste tasty thaw theme think thread thumb tiara tidal tidy tiger tile tilt tint tiny trace track trade train travel tray treat tree trek trend trial trick trio trophy trout truck trunk try tug tulip turf turtle tutor tweak tweet twice twins twirl twist uncle undo unify unit untie update upper urban user valley value velvet venue verify verse vest video view violet vista vocal voice volt vowel voyage wafer wagon wake walk walnut wand watch water wavy wheat whoop widen width willow wing wink wipe wise wish wizard wok wolf wool word work woven yam yard year yelp yield yoga yogurt yummy zebra zero zesty zippy zone zoom".split(
|
|
143
|
+
" "
|
|
144
|
+
)
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// src/public-invites/code.ts
|
|
148
|
+
var INVITE_CODE_PATTERN = /^(?:[a-z]{10}|[a-z]{3}-[a-z]{4}-[a-z]{3})$/;
|
|
149
|
+
function parseInviteCode(value) {
|
|
150
|
+
const normalized = value.trim().toLowerCase();
|
|
151
|
+
const words = normalized.split(/[-.\s]+/u);
|
|
152
|
+
if (words.length === INVITE_WORD_COUNT && words.every((word) => INVITE_WORDS.has(word))) return words.join("-");
|
|
153
|
+
if (!INVITE_CODE_PATTERN.test(normalized)) return void 0;
|
|
154
|
+
const code = normalized.replaceAll("-", "");
|
|
155
|
+
return `${code.slice(0, 3)}-${code.slice(3, 7)}-${code.slice(7)}`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
createChalkPublicClient,
|
|
160
|
+
createChalkPublicInviteClient,
|
|
161
|
+
parseInviteCode
|
|
162
|
+
};
|