@cloudexp-io/laudro-sdk 0.0.0-stage → 0.5.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 cloudexp-io
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 CHANGED
@@ -1,3 +1,57 @@
1
- # Temporary Holding Version
1
+ # @cloudexp-io/laudro-sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Typed client for the Laudro `/v1` API, the backend for restaurant websites. One method per endpoint: `site`, `locations`, `hours`, `menus`, `lunch`, `page`, `packages`, `booking`, `checkPreview`, `bookingRequests.create`, `eventRequests.create`, `contact.create` and `track`.
4
+
5
+ It runs on your server and keeps the site secret out of the browser. It also exports the zod schemas and types of the API (`@cloudexp-io/laudro-contracts`), `openNow`, `signFormToken`, `verifyWebhook` and `expandCacheTags`.
6
+
7
+ ## Install
8
+
9
+ ```sh
10
+ pnpm add @cloudexp-io/laudro-sdk
11
+ ```
12
+
13
+ The package is public on npmjs.com. No token is needed.
14
+
15
+ ## Entries
16
+
17
+ | Import | Use |
18
+ | ------------------------------- | ---------------------------------------------------------------------------- |
19
+ | `@cloudexp-io/laudro-sdk/next` | Next.js: adds cache tags and revalidate to reads. Imports `server-only`. |
20
+ | `@cloudexp-io/laudro-sdk/core` | Any runtime (Node script, CLI, MCP server). No framework code. |
21
+ | `@cloudexp-io/laudro-sdk/forms` | Browser-safe: the form schemas and `submitForm`. It never sees the secret. |
22
+
23
+ ## Example
24
+
25
+ ```ts
26
+ import { createClient, openNow } from "@cloudexp-io/laudro-sdk/next";
27
+
28
+ const laudro = createClient({
29
+ apiUrl: process.env.LAUDRO_API_URL!, // https://api.example.com/v1
30
+ secret: process.env.LAUDRO_SITE_SECRET!, // REPLACE_ME
31
+ });
32
+
33
+ const site = await laudro.site({ lang: "en" });
34
+ const { menus } = await laudro.menus({ lang: "en" });
35
+ const hours = await laudro.hours({ from: "2026-01-01", to: "2026-01-14" });
36
+ const status = openNow(hours.locations[0]!); // { open, closes_at, next_opens_at }
37
+ ```
38
+
39
+ Errors throw `LaudroApiError` with `status`, `problem` and `fieldErrors`. The client type is `LaudroClient`. The old `RbApiError` and `RbClient` names still work but are deprecated.
40
+
41
+ Form and write calls take `onResponse(headers)`, called with the headers of a good response (server side only). Site-kit reads the demo `laudro-debug` header there.
42
+
43
+ ## Rules
44
+
45
+ - Never send the site secret to the browser. A form posts to your own route, and that route calls the SDK.
46
+ - A booking request is not a booking. `bookingRequests.create` answers `status: "new"`; never show it as confirmed.
47
+ - Show only the allergens the API returns.
48
+
49
+ ## More
50
+
51
+ - Docs: `https://developers.example.com/docs/sdk` (use the address of your Laudro developers site).
52
+ - Agent skill and references: `https://developers.example.com/docs/skill.md`, or `laudro init` writes it into a new site.
53
+ - Site logic and route handlers: `@cloudexp-io/laudro-site-kit`.
54
+
55
+ ## License
56
+
57
+ MIT. See [LICENSE](LICENSE).