@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.
@@ -0,0 +1,409 @@
1
+ import { z } from 'zod';
2
+
3
+ /** UUID (any version). */
4
+ declare const Uuid: z.ZodUUID;
5
+ type Uuid = z.infer<typeof Uuid>;
6
+ /** ISO 8601 date-time with offset, e.g. 2026-11-16T10:02:11+02:00 or ...Z */
7
+ declare const IsoDateTime: z.ZodISODateTime;
8
+ type IsoDateTime = z.infer<typeof IsoDateTime>;
9
+ /** ISO date, e.g. 2026-11-16 */
10
+ declare const IsoDate: z.ZodISODate;
11
+ type IsoDate = z.infer<typeof IsoDate>;
12
+ /** Site and guest languages. Estonian is the default. */
13
+ declare const Lang: z.ZodEnum<{
14
+ et: "et";
15
+ en: "en";
16
+ }>;
17
+ type Lang = z.infer<typeof Lang>;
18
+ declare const DEFAULT_LANG: Lang;
19
+ /** Money is always integer cents in EUR. Never floats. */
20
+ declare const Currency: z.ZodLiteral<"EUR">;
21
+ declare const Money: z.ZodObject<{
22
+ cents: z.ZodInt;
23
+ currency: z.ZodLiteral<"EUR">;
24
+ }, z.core.$strip>;
25
+ type Money = z.infer<typeof Money>;
26
+ declare function eur(cents: number): Money;
27
+ /** One field problem inside a Problem response. `path` is a JSON pointer-ish dotted path. */
28
+ declare const ProblemFieldError: z.ZodObject<{
29
+ path: z.ZodString;
30
+ code: z.ZodString;
31
+ message: z.ZodString;
32
+ }, z.core.$strip>;
33
+ type ProblemFieldError = z.infer<typeof ProblemFieldError>;
34
+ /** RFC 9457 problem details (application/problem+json). */
35
+ declare const Problem: z.ZodObject<{
36
+ type: z.ZodString;
37
+ title: z.ZodString;
38
+ status: z.ZodInt;
39
+ detail: z.ZodOptional<z.ZodString>;
40
+ instance: z.ZodOptional<z.ZodString>;
41
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
+ path: z.ZodString;
43
+ code: z.ZodString;
44
+ message: z.ZodString;
45
+ }, z.core.$strip>>>;
46
+ }, z.core.$strip>;
47
+ type Problem = z.infer<typeof Problem>;
48
+ declare const PROBLEM_CONTENT_TYPE = "application/problem+json";
49
+ /** Local wall-clock time, 24 h, "HH:MM". Seconds are not used. */
50
+ declare const LocalTime: z.ZodString;
51
+ type LocalTime = z.infer<typeof LocalTime>;
52
+ /** ISO week, e.g. 2026-W47. */
53
+ declare const IsoWeek: z.ZodString;
54
+ type IsoWeek = z.infer<typeof IsoWeek>;
55
+ /** `?lang=` on every read. Default `et`. */
56
+ declare const LangQuery: z.ZodObject<{
57
+ lang: z.ZodDefault<z.ZodEnum<{
58
+ et: "et";
59
+ en: "en";
60
+ }>>;
61
+ }, z.core.$strip>;
62
+ type LangQuery = z.input<typeof LangQuery>;
63
+ /**
64
+ * True when `lang=en` was asked for and at least one text of this object had no English
65
+ * translation, so the Estonian text was returned instead.
66
+ */
67
+ declare const LangFallback: z.ZodBoolean;
68
+ /** A public image. `url` is the public storage URL; sites resize with next/image. */
69
+ declare const Media: z.ZodObject<{
70
+ id: z.ZodUUID;
71
+ url: z.ZodURL;
72
+ width: z.ZodNullable<z.ZodInt>;
73
+ height: z.ZodNullable<z.ZodInt>;
74
+ alt: z.ZodNullable<z.ZodString>;
75
+ blurhash: z.ZodNullable<z.ZodString>;
76
+ lang_fallback: z.ZodBoolean;
77
+ }, z.core.$strip>;
78
+ type Media = z.infer<typeof Media>;
79
+ /** Allergen codes (EU 1169/2011, the 14). Names come from the API in the asked language. */
80
+ declare const AllergenCode: z.ZodEnum<{
81
+ gluten: "gluten";
82
+ crustaceans: "crustaceans";
83
+ eggs: "eggs";
84
+ fish: "fish";
85
+ peanuts: "peanuts";
86
+ soybeans: "soybeans";
87
+ milk: "milk";
88
+ nuts: "nuts";
89
+ celery: "celery";
90
+ mustard: "mustard";
91
+ sesame: "sesame";
92
+ sulphites: "sulphites";
93
+ lupin: "lupin";
94
+ molluscs: "molluscs";
95
+ }>;
96
+ type AllergenCode = z.infer<typeof AllergenCode>;
97
+ /** Only allergens confirmed by staff are public. AI guesses are never returned. */
98
+ declare const Allergen: z.ZodObject<{
99
+ code: z.ZodEnum<{
100
+ gluten: "gluten";
101
+ crustaceans: "crustaceans";
102
+ eggs: "eggs";
103
+ fish: "fish";
104
+ peanuts: "peanuts";
105
+ soybeans: "soybeans";
106
+ milk: "milk";
107
+ nuts: "nuts";
108
+ celery: "celery";
109
+ mustard: "mustard";
110
+ sesame: "sesame";
111
+ sulphites: "sulphites";
112
+ lupin: "lupin";
113
+ molluscs: "molluscs";
114
+ }>;
115
+ name: z.ZodString;
116
+ icon: z.ZodNullable<z.ZodString>;
117
+ state: z.ZodEnum<{
118
+ contains: "contains";
119
+ may_contain: "may_contain";
120
+ }>;
121
+ }, z.core.$strip>;
122
+ type Allergen = z.infer<typeof Allergen>;
123
+ declare const DietTag: z.ZodEnum<{
124
+ kids: "kids";
125
+ vegan: "vegan";
126
+ vegetarian: "vegetarian";
127
+ gluten_free: "gluten_free";
128
+ lactose_free: "lactose_free";
129
+ spicy: "spicy";
130
+ new: "new";
131
+ popular: "popular";
132
+ chef_choice: "chef_choice";
133
+ }>;
134
+ type DietTag = z.infer<typeof DietTag>;
135
+ /** Hidden honeypot field. Real users leave it empty. */
136
+ declare const Honeypot: z.ZodOptional<z.ZodString>;
137
+ /**
138
+ * Signed form time stamp from when the form rendered: `<unix seconds>.<hex HMAC-SHA256>`.
139
+ * Make it on the site server with `signFormToken(secret)` from the SDK.
140
+ */
141
+ declare const FormToken: z.ZodString;
142
+ /** Cloudflare Turnstile token. Required only when the site has Turnstile switched on. */
143
+ declare const TurnstileToken: z.ZodOptional<z.ZodString>;
144
+ declare const Email: z.ZodEmail;
145
+ /** Free-form phone input. The API normalises it to E.164 (default region EE). */
146
+ declare const PhoneInput: z.ZodString;
147
+
148
+ declare const EventPackage: z.ZodObject<{
149
+ id: z.ZodUUID;
150
+ name: z.ZodString;
151
+ description: z.ZodNullable<z.ZodString>;
152
+ min_guests: z.ZodNullable<z.ZodInt>;
153
+ max_guests: z.ZodNullable<z.ZodInt>;
154
+ price: z.ZodNullable<z.ZodObject<{
155
+ cents: z.ZodInt;
156
+ currency: z.ZodLiteral<"EUR">;
157
+ }, z.core.$strip>>;
158
+ price_unit: z.ZodEnum<{
159
+ per_person: "per_person";
160
+ total: "total";
161
+ }>;
162
+ lang_fallback: z.ZodBoolean;
163
+ }, z.core.$strip>;
164
+ type EventPackage = z.infer<typeof EventPackage>;
165
+ /** GET /v1/events/packages */
166
+ declare const EventPackagesResponse: z.ZodObject<{
167
+ packages: z.ZodArray<z.ZodObject<{
168
+ id: z.ZodUUID;
169
+ name: z.ZodString;
170
+ description: z.ZodNullable<z.ZodString>;
171
+ min_guests: z.ZodNullable<z.ZodInt>;
172
+ max_guests: z.ZodNullable<z.ZodInt>;
173
+ price: z.ZodNullable<z.ZodObject<{
174
+ cents: z.ZodInt;
175
+ currency: z.ZodLiteral<"EUR">;
176
+ }, z.core.$strip>>;
177
+ price_unit: z.ZodEnum<{
178
+ per_person: "per_person";
179
+ total: "total";
180
+ }>;
181
+ lang_fallback: z.ZodBoolean;
182
+ }, z.core.$strip>>;
183
+ lang: z.ZodEnum<{
184
+ et: "et";
185
+ en: "en";
186
+ }>;
187
+ }, z.core.$strip>;
188
+ type EventPackagesResponse = z.infer<typeof EventPackagesResponse>;
189
+ declare const EventKind: z.ZodEnum<{
190
+ company: "company";
191
+ birthday: "birthday";
192
+ wedding: "wedding";
193
+ other: "other";
194
+ }>;
195
+ type EventKind = z.infer<typeof EventKind>;
196
+ /** POST /v1/event-requests */
197
+ declare const EventRequestCreate: z.ZodObject<{
198
+ location_id: z.ZodOptional<z.ZodUUID>;
199
+ event_date: z.ZodISODate;
200
+ guests: z.ZodInt;
201
+ kind: z.ZodEnum<{
202
+ company: "company";
203
+ birthday: "birthday";
204
+ wedding: "wedding";
205
+ other: "other";
206
+ }>;
207
+ budget: z.ZodOptional<z.ZodInt>;
208
+ package_id: z.ZodOptional<z.ZodUUID>;
209
+ name: z.ZodString;
210
+ company: z.ZodOptional<z.ZodString>;
211
+ phone: z.ZodString;
212
+ email: z.ZodEmail;
213
+ message: z.ZodString;
214
+ lang: z.ZodDefault<z.ZodEnum<{
215
+ et: "et";
216
+ en: "en";
217
+ }>>;
218
+ hp: z.ZodOptional<z.ZodString>;
219
+ t: z.ZodString;
220
+ turnstile_token: z.ZodOptional<z.ZodString>;
221
+ }, z.core.$strip>;
222
+ type EventRequestCreate = z.input<typeof EventRequestCreate>;
223
+
224
+ declare const BookingProvider: z.ZodEnum<{
225
+ tableonline: "tableonline";
226
+ zenchef: "zenchef";
227
+ quandoo: "quandoo";
228
+ }>;
229
+ declare const WeeklyHours: z.ZodObject<{
230
+ weekday: z.ZodInt;
231
+ opens: z.ZodString;
232
+ closes: z.ZodString;
233
+ }, z.core.$strip>;
234
+ type WeeklyHours = z.infer<typeof WeeklyHours>;
235
+ declare const BookingLocation: z.ZodObject<{
236
+ location_id: z.ZodUUID;
237
+ mode: z.ZodEnum<{
238
+ provider: "provider";
239
+ request: "request";
240
+ both: "both";
241
+ phone_only: "phone_only";
242
+ }>;
243
+ provider: z.ZodNullable<z.ZodEnum<{
244
+ tableonline: "tableonline";
245
+ zenchef: "zenchef";
246
+ quandoo: "quandoo";
247
+ }>>;
248
+ provider_url: z.ZodNullable<z.ZodString>;
249
+ min_party: z.ZodInt;
250
+ max_party: z.ZodInt;
251
+ min_lead_minutes: z.ZodInt;
252
+ max_days_ahead: z.ZodInt;
253
+ confirm_text: z.ZodNullable<z.ZodString>;
254
+ phone: z.ZodNullable<z.ZodString>;
255
+ booking_hours: z.ZodArray<z.ZodObject<{
256
+ weekday: z.ZodInt;
257
+ opens: z.ZodString;
258
+ closes: z.ZodString;
259
+ }, z.core.$strip>>;
260
+ booking_hours_kind: z.ZodEnum<{
261
+ open: "open";
262
+ booking: "booking";
263
+ }>;
264
+ lang_fallback: z.ZodBoolean;
265
+ }, z.core.$strip>;
266
+ type BookingLocation = z.infer<typeof BookingLocation>;
267
+ /** GET /v1/booking */
268
+ declare const BookingResponse: z.ZodObject<{
269
+ mode: z.ZodNullable<z.ZodEnum<{
270
+ provider: "provider";
271
+ request: "request";
272
+ both: "both";
273
+ phone_only: "phone_only";
274
+ }>>;
275
+ locations: z.ZodArray<z.ZodObject<{
276
+ location_id: z.ZodUUID;
277
+ mode: z.ZodEnum<{
278
+ provider: "provider";
279
+ request: "request";
280
+ both: "both";
281
+ phone_only: "phone_only";
282
+ }>;
283
+ provider: z.ZodNullable<z.ZodEnum<{
284
+ tableonline: "tableonline";
285
+ zenchef: "zenchef";
286
+ quandoo: "quandoo";
287
+ }>>;
288
+ provider_url: z.ZodNullable<z.ZodString>;
289
+ min_party: z.ZodInt;
290
+ max_party: z.ZodInt;
291
+ min_lead_minutes: z.ZodInt;
292
+ max_days_ahead: z.ZodInt;
293
+ confirm_text: z.ZodNullable<z.ZodString>;
294
+ phone: z.ZodNullable<z.ZodString>;
295
+ booking_hours: z.ZodArray<z.ZodObject<{
296
+ weekday: z.ZodInt;
297
+ opens: z.ZodString;
298
+ closes: z.ZodString;
299
+ }, z.core.$strip>>;
300
+ booking_hours_kind: z.ZodEnum<{
301
+ open: "open";
302
+ booking: "booking";
303
+ }>;
304
+ lang_fallback: z.ZodBoolean;
305
+ }, z.core.$strip>>;
306
+ lang: z.ZodEnum<{
307
+ et: "et";
308
+ en: "en";
309
+ }>;
310
+ }, z.core.$strip>;
311
+ type BookingResponse = z.infer<typeof BookingResponse>;
312
+ /** POST /v1/booking-requests */
313
+ declare const BookingRequestCreate: z.ZodObject<{
314
+ location_id: z.ZodOptional<z.ZodUUID>;
315
+ date: z.ZodISODate;
316
+ time: z.ZodString;
317
+ party_size: z.ZodInt;
318
+ name: z.ZodString;
319
+ phone: z.ZodString;
320
+ email: z.ZodOptional<z.ZodEmail>;
321
+ note: z.ZodOptional<z.ZodString>;
322
+ lang: z.ZodDefault<z.ZodEnum<{
323
+ et: "et";
324
+ en: "en";
325
+ }>>;
326
+ hp: z.ZodOptional<z.ZodString>;
327
+ t: z.ZodString;
328
+ turnstile_token: z.ZodOptional<z.ZodString>;
329
+ }, z.core.$strip>;
330
+ type BookingRequestCreate = z.input<typeof BookingRequestCreate>;
331
+ /** Response of the three form endpoints. */
332
+ declare const RequestCreated: z.ZodObject<{
333
+ id: z.ZodUUID;
334
+ status: z.ZodLiteral<"new">;
335
+ }, z.core.$strip>;
336
+ type RequestCreated = z.infer<typeof RequestCreated>;
337
+
338
+ /** POST /v1/contact */
339
+ declare const ContactCreate: z.ZodObject<{
340
+ name: z.ZodString;
341
+ email: z.ZodEmail;
342
+ phone: z.ZodOptional<z.ZodString>;
343
+ message: z.ZodString;
344
+ lang: z.ZodDefault<z.ZodEnum<{
345
+ et: "et";
346
+ en: "en";
347
+ }>>;
348
+ hp: z.ZodOptional<z.ZodString>;
349
+ t: z.ZodString;
350
+ turnstile_token: z.ZodOptional<z.ZodString>;
351
+ }, z.core.$strip>;
352
+ type ContactCreate = z.input<typeof ContactCreate>;
353
+
354
+ declare const TrackName: z.ZodEnum<{
355
+ page_view: "page_view";
356
+ visit: "visit";
357
+ menu_view: "menu_view";
358
+ lunch_view: "lunch_view";
359
+ item_view: "item_view";
360
+ call_tap: "call_tap";
361
+ map_tap: "map_tap";
362
+ booking_open: "booking_open";
363
+ booking_provider_tap: "booking_provider_tap";
364
+ form_submit: "form_submit";
365
+ }>;
366
+ type TrackName = z.infer<typeof TrackName>;
367
+ /** POST /v1/track. Returns 204. No cookies, no IP stored: only daily counters. */
368
+ declare const TrackEvent: z.ZodObject<{
369
+ name: z.ZodEnum<{
370
+ page_view: "page_view";
371
+ visit: "visit";
372
+ menu_view: "menu_view";
373
+ lunch_view: "lunch_view";
374
+ item_view: "item_view";
375
+ call_tap: "call_tap";
376
+ map_tap: "map_tap";
377
+ booking_open: "booking_open";
378
+ booking_provider_tap: "booking_provider_tap";
379
+ form_submit: "form_submit";
380
+ }>;
381
+ path: z.ZodString;
382
+ lang: z.ZodDefault<z.ZodEnum<{
383
+ et: "et";
384
+ en: "en";
385
+ }>>;
386
+ ref: z.ZodOptional<z.ZodString>;
387
+ device: z.ZodOptional<z.ZodEnum<{
388
+ mobile: "mobile";
389
+ desktop: "desktop";
390
+ }>>;
391
+ }, z.core.$strip>;
392
+ type TrackEvent = z.input<typeof TrackEvent>;
393
+
394
+ /** Retry policy for 429 and 5xx. Shared by the server client and the browser form helper. */
395
+ interface RetryOptions {
396
+ /** Extra attempts after the first one. Default 2. 0 turns retries off. */
397
+ retries?: number;
398
+ /** First backoff in ms; doubles each attempt, with jitter. Default 250. */
399
+ baseDelayMs?: number;
400
+ /** Upper bound for one wait, also for Retry-After. Default 5000. */
401
+ maxDelayMs?: number;
402
+ /** Override the wait (tests). */
403
+ sleep?: (ms: number) => Promise<void>;
404
+ }
405
+ /** Seconds or an HTTP date. Returns ms, or null when absent or unreadable. */
406
+ declare function parseRetryAfter(value: string | null, now?: number): number | null;
407
+
408
+ export { Allergen as A, BookingRequestCreate as B, ContactCreate as C, DEFAULT_LANG as D, EventRequestCreate as E, FormToken as F, Honeypot as H, IsoDate as I, LangQuery as L, Media as M, Problem as P, RequestCreated as R, TrackEvent as T, Uuid as U, WeeklyHours as W, ProblemFieldError as b, AllergenCode as c, BookingLocation as d, BookingProvider as e, BookingResponse as f, Currency as g, DietTag as h, Email as i, EventKind as j, EventPackage as k, EventPackagesResponse as l, IsoDateTime as m, IsoWeek as n, Lang as o, LangFallback as p, LocalTime as q, Money as r, PROBLEM_CONTENT_TYPE as s, PhoneInput as t, TrackName as u, TurnstileToken as v, eur as w, parseRetryAfter as x };
409
+ export type { RetryOptions as a };
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@cloudexp-io/laudro-sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.4.0",
4
+ "description": "Typed client for the Laudro /v1 API: framework-free core, a Next.js entry and a browser-safe forms entry.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/cloudexp-io/laudro.git",
11
+ "directory": "packages/sdk"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ },
18
+ "./core": {
19
+ "types": "./dist/core.d.ts",
20
+ "import": "./dist/core.js"
21
+ },
22
+ "./next": {
23
+ "types": "./dist/next.d.ts",
24
+ "import": "./dist/next.js"
25
+ },
26
+ "./forms": {
27
+ "types": "./dist/forms.d.ts",
28
+ "import": "./dist/forms.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "publishConfig": {
35
+ "registry": "https://registry.npmjs.org",
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "server-only": "^0.0.1",
40
+ "zod": "^4.6.7"
41
+ },
42
+ "devDependencies": {
43
+ "@types/node": "^22.20.5",
44
+ "tsup": "^9.0.0",
45
+ "typescript": "~6.0.3",
46
+ "vitest": "^5.1.0",
47
+ "@cloudexp-io/laudro-contracts": "0.0.0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup",
51
+ "typecheck": "tsc --noEmit",
52
+ "test": "vitest run"
53
+ },
54
+ "types": "./dist/index.d.ts"
6
55
  }