@pickleball/server-sdk 0.1.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 +13 -0
- package/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/chunk-HBTNLURN.js +618 -0
- package/dist/index.cjs +654 -0
- package/dist/index.d.cts +206 -0
- package/dist/index.d.ts +206 -0
- package/dist/index.js +26 -0
- package/dist/proxy.cjs +1018 -0
- package/dist/proxy.d.cts +39 -0
- package/dist/proxy.d.ts +39 -0
- package/dist/proxy.js +403 -0
- package/package.json +65 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @pickleball/server-sdk
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7718e9a: Prepare the first canary release of the foreground Expo livestream SDK, server
|
|
8
|
+
control-plane client, config plugin, webhook verification, and First VOD guide.
|
|
9
|
+
|
|
10
|
+
## 0.1.0
|
|
11
|
+
|
|
12
|
+
- Initial canary: framework-free API v2 client for Node/Edge and Web Crypto
|
|
13
|
+
webhook verification.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pickleball Live contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# `@pickleball/server-sdk`
|
|
2
|
+
|
|
3
|
+
Framework-free TypeScript client for the Pickleball Live control plane. It uses
|
|
4
|
+
the standard Fetch and Web Crypto APIs, so the same build works in Node.js 20+
|
|
5
|
+
and Edge runtimes.
|
|
6
|
+
|
|
7
|
+
## Client
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createPickleballLiveClient } from "@pickleball/server-sdk";
|
|
11
|
+
|
|
12
|
+
const live = createPickleballLiveClient({
|
|
13
|
+
baseUrl: process.env.PICKLEBALL_API_BASE_URL!,
|
|
14
|
+
appId: process.env.PICKLEBALL_APP_ID!,
|
|
15
|
+
apiKey: process.env.PICKLEBALL_API_KEY!,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const bootstrap = await live.apps.bootstrap({
|
|
19
|
+
sdkVersion: "0.1.0",
|
|
20
|
+
platform: "ios",
|
|
21
|
+
bundleId: "com.example.matches",
|
|
22
|
+
installationId: "existing-installation-id",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const grant = await live.sessions.start({
|
|
26
|
+
sdkVersion: "0.1.0",
|
|
27
|
+
platform: "ios",
|
|
28
|
+
bundleId: "com.example.matches",
|
|
29
|
+
installationId: "existing-installation-id",
|
|
30
|
+
externalSessionId: "match-42",
|
|
31
|
+
title: "Court 1",
|
|
32
|
+
consentVersion: "2026-07",
|
|
33
|
+
visibility: "private",
|
|
34
|
+
idempotencyKey: "stable-key-created-by-your-server",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
await live.sessions.refresh(grant.sessionId, {
|
|
38
|
+
sdkVersion: "0.1.0",
|
|
39
|
+
platform: "ios",
|
|
40
|
+
bundleId: "com.example.matches",
|
|
41
|
+
installationId: "existing-installation-id",
|
|
42
|
+
});
|
|
43
|
+
await live.sessions.end({ sessionId: grant.sessionId, reason: "user" });
|
|
44
|
+
|
|
45
|
+
const session = await live.sessions.get(grant.sessionId);
|
|
46
|
+
const recordings = await live.sessions.getRecordings(grant.sessionId);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Bootstrap, an idempotency-keyed start, end, and GET requests retry bounded
|
|
50
|
+
transient network/HTTP failures. Token refresh is not retried automatically.
|
|
51
|
+
All requests have an abort timeout; failures use typed
|
|
52
|
+
`PickleballLiveError` subclasses. Unknown backend error codes are normalized to
|
|
53
|
+
`UNKNOWN`.
|
|
54
|
+
|
|
55
|
+
Never expose this package's API key to a native/web bundle or log it. Put the
|
|
56
|
+
client in a server route, Worker, serverless function, or other trusted runtime.
|
|
57
|
+
The SDK never logs the API key, participant token, or webhook secret.
|
|
58
|
+
|
|
59
|
+
## Webhook verification
|
|
60
|
+
|
|
61
|
+
Verify the exact raw request bytes before parsing. Delivery is at-least-once:
|
|
62
|
+
store `dedupeKey` under a unique constraint and acknowledge an existing key as
|
|
63
|
+
success.
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
const rawBody = new Uint8Array(await request.arrayBuffer());
|
|
67
|
+
const verified = await live.webhooks.verify(
|
|
68
|
+
rawBody,
|
|
69
|
+
request.headers,
|
|
70
|
+
process.env.PICKLEBALL_WEBHOOK_SECRET!,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (await alreadyProcessed(verified.dedupeKey)) {
|
|
74
|
+
return new Response(null, { status: 204 });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
await transaction(async () => {
|
|
78
|
+
await saveEvent(verified.dedupeKey, verified.body);
|
|
79
|
+
if (verified.event === "recording.ready") {
|
|
80
|
+
await handleRecording(verified.body.data);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return new Response(null, { status: 204 });
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`transportId` is unsigned transport metadata and is useful for tracing only.
|
|
87
|
+
`dedupeKey` is derived from the authenticated raw body, so it remains stable
|
|
88
|
+
when a retry gets a new timestamp/signature or transport ID.
|
|
89
|
+
|
|
90
|
+
See the [First VOD guide](https://github.com/Cabinfood/livestream-pickleball/blob/main/docs/sdk/first-vod.md)
|
|
91
|
+
and [compatibility matrix](https://github.com/Cabinfood/livestream-pickleball/blob/main/docs/sdk/compatibility.md).
|