@cloudexp-io/laudro-sdk 0.0.0-stage → 0.4.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 +21 -0
- package/README.md +54 -2
- package/dist/chunk-4ADLD5ZW.js +845 -0
- package/dist/chunk-6J7GJOQI.js +18 -0
- package/dist/chunk-6LTB3GRQ.js +357 -0
- package/dist/core.d.ts +1684 -0
- package/dist/core.js +178 -0
- package/dist/forms.d.ts +37 -0
- package/dist/forms.js +62 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +180 -0
- package/dist/next.d.ts +263 -0
- package/dist/next.js +180 -0
- package/dist/retry-BnQHOsTh.d.ts +409 -0
- package/package.json +52 -3
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,55 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @cloudexp-io/laudro-sdk
|
|
2
2
|
|
|
3
|
-
|
|
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 `RbApiError` with `status`, `problem` and `fieldErrors`.
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- Never send the site secret to the browser. A form posts to your own route, and that route calls the SDK.
|
|
44
|
+
- A booking request is not a booking. `bookingRequests.create` answers `status: "new"`; never show it as confirmed.
|
|
45
|
+
- Show only the allergens the API returns.
|
|
46
|
+
|
|
47
|
+
## More
|
|
48
|
+
|
|
49
|
+
- Docs: `https://developers.example.com/docs/sdk` (use the address of your Laudro developers site).
|
|
50
|
+
- Agent skill and references: `https://developers.example.com/docs/skill.md`, or `laudro init` writes it into a new site.
|
|
51
|
+
- Site logic and route handlers: `@cloudexp-io/laudro-site-kit`.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT. See [LICENSE](LICENSE).
|