cookunity-mcp-server 1.0.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 +113 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.d.ts +215 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +84 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/services/api.d.ts +35 -0
- package/dist/services/api.d.ts.map +1 -0
- package/dist/services/api.js +249 -0
- package/dist/services/api.js.map +1 -0
- package/dist/services/auth.d.ts +14 -0
- package/dist/services/auth.d.ts.map +1 -0
- package/dist/services/auth.js +96 -0
- package/dist/services/auth.js.map +1 -0
- package/dist/services/helpers.d.ts +23 -0
- package/dist/services/helpers.d.ts.map +1 -0
- package/dist/services/helpers.js +94 -0
- package/dist/services/helpers.js.map +1 -0
- package/dist/tools/cart.d.ts +4 -0
- package/dist/tools/cart.d.ts.map +1 -0
- package/dist/tools/cart.js +186 -0
- package/dist/tools/cart.js.map +1 -0
- package/dist/tools/deliveries.d.ts +4 -0
- package/dist/tools/deliveries.d.ts.map +1 -0
- package/dist/tools/deliveries.js +190 -0
- package/dist/tools/deliveries.js.map +1 -0
- package/dist/tools/menu.d.ts +4 -0
- package/dist/tools/menu.d.ts.map +1 -0
- package/dist/tools/menu.js +293 -0
- package/dist/tools/menu.js.map +1 -0
- package/dist/tools/pricing.d.ts +4 -0
- package/dist/tools/pricing.d.ts.map +1 -0
- package/dist/tools/pricing.js +116 -0
- package/dist/tools/pricing.js.map +1 -0
- package/dist/tools/user.d.ts +4 -0
- package/dist/tools/user.d.ts.map +1 -0
- package/dist/tools/user.js +97 -0
- package/dist/tools/user.js.map +1 -0
- package/dist/types.d.ts +228 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CookUnity MCP Server
|
|
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,113 @@
|
|
|
1
|
+
# cookunity-mcp-server
|
|
2
|
+
|
|
3
|
+
MCP server for [CookUnity](https://www.cookunity.com) meal delivery service. Browse menus, manage carts, confirm orders, skip/unskip deliveries, and view order history.
|
|
4
|
+
|
|
5
|
+
## Tools (14)
|
|
6
|
+
|
|
7
|
+
### Menu & Discovery
|
|
8
|
+
|
|
9
|
+
| Tool | Description | Read-only |
|
|
10
|
+
|------|-------------|-----------|
|
|
11
|
+
| `cookunity_get_menu` | Browse meals with filters (category, diet, price, rating) & pagination | ✅ |
|
|
12
|
+
| `cookunity_search_meals` | Search by keyword across name, description, cuisine, chef, ingredients, diet tags | ✅ |
|
|
13
|
+
| `cookunity_get_meal_details` | Full nutritional info, allergens, and ingredients for a specific meal | ✅ |
|
|
14
|
+
|
|
15
|
+
### Cart & Orders
|
|
16
|
+
|
|
17
|
+
| Tool | Description | Read-only |
|
|
18
|
+
|------|-------------|-----------|
|
|
19
|
+
| `cookunity_get_cart` | Cart contents for a specific delivery date | ✅ |
|
|
20
|
+
| `cookunity_add_to_cart` | Add meal to cart by inventory_id and date | ❌ |
|
|
21
|
+
| `cookunity_remove_from_cart` | Remove meal from cart by inventory_id | ❌ |
|
|
22
|
+
| `cookunity_clear_cart` | Clear all cart items for a delivery date | ❌ |
|
|
23
|
+
| `cookunity_confirm_order` | **Confirm/place order** — locks in cart items for delivery | ❌ |
|
|
24
|
+
|
|
25
|
+
### Deliveries & Scheduling
|
|
26
|
+
|
|
27
|
+
| Tool | Description | Read-only |
|
|
28
|
+
|------|-------------|-----------|
|
|
29
|
+
| `cookunity_list_deliveries` | Upcoming weeks with status, carts, cutoffs, skip state | ✅ |
|
|
30
|
+
| `cookunity_skip_delivery` | Skip a delivery week | ❌ |
|
|
31
|
+
| `cookunity_unskip_delivery` | Unskip a previously skipped week | ❌ |
|
|
32
|
+
|
|
33
|
+
### Account & Pricing
|
|
34
|
+
|
|
35
|
+
| Tool | Description | Read-only |
|
|
36
|
+
|------|-------------|-----------|
|
|
37
|
+
| `cookunity_get_user_info` | User profile, plan, delivery days, addresses, credits | ✅ |
|
|
38
|
+
| `cookunity_list_orders` | Order history with pagination | ✅ |
|
|
39
|
+
| `cookunity_get_price_breakdown` | Price estimate with taxes, fees, credits, and promo discounts | ✅ |
|
|
40
|
+
|
|
41
|
+
## Typical Workflow
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1. cookunity_list_deliveries → Find next editable delivery date + cutoff
|
|
45
|
+
2. cookunity_get_menu → Browse available meals for that date
|
|
46
|
+
3. cookunity_search_meals → Search for specific cuisines/proteins
|
|
47
|
+
4. cookunity_get_meal_details → Check nutrition/allergens
|
|
48
|
+
5. cookunity_add_to_cart → Add meals (repeat until plan is full)
|
|
49
|
+
6. cookunity_get_price_breakdown→ Verify total before confirming
|
|
50
|
+
7. cookunity_confirm_order → Lock in the order ✅
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
> **Important:** Without confirming, cart items are NOT locked in. CookUnity auto-fills with its own recommendations at the cutoff deadline.
|
|
54
|
+
|
|
55
|
+
## Setup
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install
|
|
59
|
+
npm run build
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Environment Variables
|
|
63
|
+
|
|
64
|
+
| Variable | Required | Description |
|
|
65
|
+
|----------|----------|-------------|
|
|
66
|
+
| `COOKUNITY_EMAIL` | Yes | CookUnity account email |
|
|
67
|
+
| `COOKUNITY_PASSWORD` | Yes | CookUnity account password |
|
|
68
|
+
| `TRANSPORT` | No | `stdio` (default) or `http` |
|
|
69
|
+
| `PORT` | No | HTTP port when using `http` transport (default: 3000) |
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
### Claude Desktop / OpenClaw (stdio)
|
|
74
|
+
|
|
75
|
+
```json
|
|
76
|
+
{
|
|
77
|
+
"mcpServers": {
|
|
78
|
+
"cookunity": {
|
|
79
|
+
"command": "node",
|
|
80
|
+
"args": ["/path/to/cookunity-mcp/dist/index.js"],
|
|
81
|
+
"env": {
|
|
82
|
+
"COOKUNITY_EMAIL": "your@email.com",
|
|
83
|
+
"COOKUNITY_PASSWORD": "your-password"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Streamable HTTP (remote)
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
COOKUNITY_EMAIL=your@email.com COOKUNITY_PASSWORD=your-password TRANSPORT=http PORT=3000 node dist/index.js
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## API Details
|
|
97
|
+
|
|
98
|
+
This server reverse-engineers CookUnity's internal GraphQL APIs:
|
|
99
|
+
|
|
100
|
+
- **Menu Service** (`https://menu-service.cookunity.com/graphql`) — meal browsing and search
|
|
101
|
+
- **Subscription Service** (`https://subscription-back.cookunity.com/graphql`) — cart, orders, deliveries, user info
|
|
102
|
+
|
|
103
|
+
Authentication uses Auth0 with the `cookunity` realm. Tokens are cached and refreshed automatically.
|
|
104
|
+
|
|
105
|
+
### Known Limitations
|
|
106
|
+
|
|
107
|
+
- GraphQL introspection is disabled — schemas were reverse-engineered from frontend JS bundles and error probing
|
|
108
|
+
- `createOrder` requires the exact number of meals matching the user's plan (e.g., 6 for a 6-meal plan)
|
|
109
|
+
- Delivery window is currently hardcoded to 11:00–20:00 (matches most US plans)
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const CHARACTER_LIMIT = 25000;
|
|
2
|
+
export declare const MENU_SERVICE_URL = "https://subscription.cookunity.com/menu-service/graphql";
|
|
3
|
+
export declare const SUBSCRIPTION_URL = "https://subscription.cookunity.com/subscription-back/graphql/user";
|
|
4
|
+
export declare const AUTH_BASE_URL = "https://auth.cookunity.com";
|
|
5
|
+
export declare const AUTH_CLIENT_ID = "E3AWy6rDb3S3ErYliO64fnY171Ec1xhf";
|
|
6
|
+
export declare const AUTH_REALM = "cookunity";
|
|
7
|
+
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
8
|
+
export declare const MAX_PAGE_SIZE = 50;
|
|
9
|
+
export declare enum ResponseFormat {
|
|
10
|
+
MARKDOWN = "markdown",
|
|
11
|
+
JSON = "json"
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,eAAO,MAAM,gBAAgB,4DAA4D,CAAC;AAC1F,eAAO,MAAM,gBAAgB,sEAAsE,CAAC;AAEpG,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAC1D,eAAO,MAAM,cAAc,qCAAqC,CAAC;AACjE,eAAO,MAAM,UAAU,cAAc,CAAC;AAEtC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const CHARACTER_LIMIT = 25000;
|
|
2
|
+
export const MENU_SERVICE_URL = "https://subscription.cookunity.com/menu-service/graphql";
|
|
3
|
+
export const SUBSCRIPTION_URL = "https://subscription.cookunity.com/subscription-back/graphql/user";
|
|
4
|
+
export const AUTH_BASE_URL = "https://auth.cookunity.com";
|
|
5
|
+
export const AUTH_CLIENT_ID = "E3AWy6rDb3S3ErYliO64fnY171Ec1xhf";
|
|
6
|
+
export const AUTH_REALM = "cookunity";
|
|
7
|
+
export const DEFAULT_PAGE_SIZE = 20;
|
|
8
|
+
export const MAX_PAGE_SIZE = 50;
|
|
9
|
+
export var ResponseFormat;
|
|
10
|
+
(function (ResponseFormat) {
|
|
11
|
+
ResponseFormat["MARKDOWN"] = "markdown";
|
|
12
|
+
ResponseFormat["JSON"] = "json";
|
|
13
|
+
})(ResponseFormat || (ResponseFormat = {}));
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,MAAM,CAAC,MAAM,gBAAgB,GAAG,yDAAyD,CAAC;AAC1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,mEAAmE,CAAC;AAEpG,MAAM,CAAC,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAC1D,MAAM,CAAC,MAAM,cAAc,GAAG,kCAAkC,CAAC;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CookUnity MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Provides tools to interact with CookUnity meal delivery service:
|
|
6
|
+
* browse menus, manage carts, skip/unskip deliveries, and view order history.
|
|
7
|
+
*/
|
|
8
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
|
+
import { CookUnityAPI } from "./services/api.js";
|
|
11
|
+
import { registerMenuTools } from "./tools/menu.js";
|
|
12
|
+
import { registerUserTools } from "./tools/user.js";
|
|
13
|
+
import { registerDeliveryTools } from "./tools/deliveries.js";
|
|
14
|
+
import { registerCartTools } from "./tools/cart.js";
|
|
15
|
+
import { registerPricingTools } from "./tools/pricing.js";
|
|
16
|
+
function createServer() {
|
|
17
|
+
const email = process.env.COOKUNITY_EMAIL;
|
|
18
|
+
const password = process.env.COOKUNITY_PASSWORD;
|
|
19
|
+
if (!email || !password) {
|
|
20
|
+
console.error("ERROR: COOKUNITY_EMAIL and COOKUNITY_PASSWORD environment variables are required.");
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
const server = new McpServer({
|
|
24
|
+
name: "cookunity-mcp-server",
|
|
25
|
+
version: "1.0.0",
|
|
26
|
+
});
|
|
27
|
+
const api = new CookUnityAPI(email, password);
|
|
28
|
+
registerMenuTools(server, api);
|
|
29
|
+
registerUserTools(server, api);
|
|
30
|
+
registerDeliveryTools(server, api);
|
|
31
|
+
registerCartTools(server, api);
|
|
32
|
+
registerPricingTools(server, api);
|
|
33
|
+
return server;
|
|
34
|
+
}
|
|
35
|
+
async function runStdio() {
|
|
36
|
+
const server = createServer();
|
|
37
|
+
const transport = new StdioServerTransport();
|
|
38
|
+
await server.connect(transport);
|
|
39
|
+
console.error("CookUnity MCP server running via stdio");
|
|
40
|
+
}
|
|
41
|
+
async function runHTTP() {
|
|
42
|
+
const { default: express } = await import("express");
|
|
43
|
+
const { StreamableHTTPServerTransport } = await import("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
44
|
+
const server = createServer();
|
|
45
|
+
const app = express();
|
|
46
|
+
app.use(express.json());
|
|
47
|
+
app.post("/mcp", async (req, res) => {
|
|
48
|
+
const transport = new StreamableHTTPServerTransport({
|
|
49
|
+
sessionIdGenerator: undefined,
|
|
50
|
+
enableJsonResponse: true,
|
|
51
|
+
});
|
|
52
|
+
res.on("close", () => {
|
|
53
|
+
void transport.close();
|
|
54
|
+
});
|
|
55
|
+
await server.connect(transport);
|
|
56
|
+
await transport.handleRequest(req, res, req.body);
|
|
57
|
+
});
|
|
58
|
+
const port = parseInt(process.env.PORT ?? "3000", 10);
|
|
59
|
+
app.listen(port, () => {
|
|
60
|
+
console.error(`CookUnity MCP server running on http://localhost:${port}/mcp`);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Signal handlers
|
|
64
|
+
process.on("SIGINT", () => process.exit(0));
|
|
65
|
+
process.on("SIGTERM", () => process.exit(0));
|
|
66
|
+
const transport = process.env.TRANSPORT ?? "stdio";
|
|
67
|
+
if (transport === "http") {
|
|
68
|
+
runHTTP().catch((err) => {
|
|
69
|
+
console.error("Server error:", err);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
runStdio().catch((err) => {
|
|
75
|
+
console.error("Server error:", err);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,SAAS,YAAY;IACnB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAEhD,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxB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ACN,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACvB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ResponseFormat } from "../constants.js";
|
|
3
|
+
export declare const DateSchema: z.ZodString;
|
|
4
|
+
export declare const ResponseFormatSchema: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
5
|
+
export declare const GetMenuSchema: z.ZodObject<{
|
|
6
|
+
date: z.ZodOptional<z.ZodString>;
|
|
7
|
+
category: z.ZodOptional<z.ZodString>;
|
|
8
|
+
diet: z.ZodOptional<z.ZodString>;
|
|
9
|
+
max_price: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
min_rating: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
14
|
+
}, "strict", z.ZodTypeAny, {
|
|
15
|
+
limit: number;
|
|
16
|
+
offset: number;
|
|
17
|
+
response_format: ResponseFormat;
|
|
18
|
+
date?: string | undefined;
|
|
19
|
+
category?: string | undefined;
|
|
20
|
+
diet?: string | undefined;
|
|
21
|
+
max_price?: number | undefined;
|
|
22
|
+
min_rating?: number | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
date?: string | undefined;
|
|
25
|
+
category?: string | undefined;
|
|
26
|
+
diet?: string | undefined;
|
|
27
|
+
max_price?: number | undefined;
|
|
28
|
+
min_rating?: number | undefined;
|
|
29
|
+
limit?: number | undefined;
|
|
30
|
+
offset?: number | undefined;
|
|
31
|
+
response_format?: ResponseFormat | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const SearchMealsSchema: z.ZodObject<{
|
|
34
|
+
query: z.ZodString;
|
|
35
|
+
date: z.ZodOptional<z.ZodString>;
|
|
36
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
37
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
38
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
39
|
+
}, "strict", z.ZodTypeAny, {
|
|
40
|
+
query: string;
|
|
41
|
+
limit: number;
|
|
42
|
+
offset: number;
|
|
43
|
+
response_format: ResponseFormat;
|
|
44
|
+
date?: string | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
query: string;
|
|
47
|
+
date?: string | undefined;
|
|
48
|
+
limit?: number | undefined;
|
|
49
|
+
offset?: number | undefined;
|
|
50
|
+
response_format?: ResponseFormat | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
export declare const GetUserInfoSchema: z.ZodObject<{
|
|
53
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
54
|
+
}, "strict", z.ZodTypeAny, {
|
|
55
|
+
response_format: ResponseFormat;
|
|
56
|
+
}, {
|
|
57
|
+
response_format?: ResponseFormat | undefined;
|
|
58
|
+
}>;
|
|
59
|
+
export declare const ListOrdersSchema: z.ZodObject<{
|
|
60
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
61
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
62
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
63
|
+
}, "strict", z.ZodTypeAny, {
|
|
64
|
+
limit: number;
|
|
65
|
+
offset: number;
|
|
66
|
+
response_format: ResponseFormat;
|
|
67
|
+
}, {
|
|
68
|
+
limit?: number | undefined;
|
|
69
|
+
offset?: number | undefined;
|
|
70
|
+
response_format?: ResponseFormat | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export declare const ListDeliveriesSchema: z.ZodObject<{
|
|
73
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
74
|
+
}, "strict", z.ZodTypeAny, {
|
|
75
|
+
response_format: ResponseFormat;
|
|
76
|
+
}, {
|
|
77
|
+
response_format?: ResponseFormat | undefined;
|
|
78
|
+
}>;
|
|
79
|
+
export declare const GetCartSchema: z.ZodObject<{
|
|
80
|
+
date: z.ZodOptional<z.ZodString>;
|
|
81
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
82
|
+
}, "strict", z.ZodTypeAny, {
|
|
83
|
+
response_format: ResponseFormat;
|
|
84
|
+
date?: string | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
date?: string | undefined;
|
|
87
|
+
response_format?: ResponseFormat | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
export declare const AddToCartSchema: z.ZodObject<{
|
|
90
|
+
date: z.ZodString;
|
|
91
|
+
inventory_id: z.ZodString;
|
|
92
|
+
quantity: z.ZodDefault<z.ZodNumber>;
|
|
93
|
+
batch_id: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
}, "strict", z.ZodTypeAny, {
|
|
95
|
+
date: string;
|
|
96
|
+
quantity: number;
|
|
97
|
+
inventory_id: string;
|
|
98
|
+
batch_id?: number | undefined;
|
|
99
|
+
}, {
|
|
100
|
+
date: string;
|
|
101
|
+
inventory_id: string;
|
|
102
|
+
batch_id?: number | undefined;
|
|
103
|
+
quantity?: number | undefined;
|
|
104
|
+
}>;
|
|
105
|
+
export declare const RemoveFromCartSchema: z.ZodObject<{
|
|
106
|
+
date: z.ZodString;
|
|
107
|
+
inventory_id: z.ZodString;
|
|
108
|
+
quantity: z.ZodDefault<z.ZodNumber>;
|
|
109
|
+
}, "strict", z.ZodTypeAny, {
|
|
110
|
+
date: string;
|
|
111
|
+
quantity: number;
|
|
112
|
+
inventory_id: string;
|
|
113
|
+
}, {
|
|
114
|
+
date: string;
|
|
115
|
+
inventory_id: string;
|
|
116
|
+
quantity?: number | undefined;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const ClearCartSchema: z.ZodObject<{
|
|
119
|
+
date: z.ZodString;
|
|
120
|
+
}, "strict", z.ZodTypeAny, {
|
|
121
|
+
date: string;
|
|
122
|
+
}, {
|
|
123
|
+
date: string;
|
|
124
|
+
}>;
|
|
125
|
+
export declare const SkipDeliverySchema: z.ZodObject<{
|
|
126
|
+
date: z.ZodString;
|
|
127
|
+
}, "strict", z.ZodTypeAny, {
|
|
128
|
+
date: string;
|
|
129
|
+
}, {
|
|
130
|
+
date: string;
|
|
131
|
+
}>;
|
|
132
|
+
export declare const UnskipDeliverySchema: z.ZodObject<{
|
|
133
|
+
date: z.ZodString;
|
|
134
|
+
}, "strict", z.ZodTypeAny, {
|
|
135
|
+
date: string;
|
|
136
|
+
}, {
|
|
137
|
+
date: string;
|
|
138
|
+
}>;
|
|
139
|
+
export declare const GetPriceBreakdownSchema: z.ZodObject<{
|
|
140
|
+
date: z.ZodOptional<z.ZodString>;
|
|
141
|
+
meals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
142
|
+
entityId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
143
|
+
quantity: z.ZodDefault<z.ZodNumber>;
|
|
144
|
+
inventoryId: z.ZodString;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
quantity: number;
|
|
147
|
+
entityId: string | number;
|
|
148
|
+
inventoryId: string;
|
|
149
|
+
}, {
|
|
150
|
+
entityId: string | number;
|
|
151
|
+
inventoryId: string;
|
|
152
|
+
quantity?: number | undefined;
|
|
153
|
+
}>, "many">>;
|
|
154
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
155
|
+
}, "strict", z.ZodTypeAny, {
|
|
156
|
+
response_format: ResponseFormat;
|
|
157
|
+
date?: string | undefined;
|
|
158
|
+
meals?: {
|
|
159
|
+
quantity: number;
|
|
160
|
+
entityId: string | number;
|
|
161
|
+
inventoryId: string;
|
|
162
|
+
}[] | undefined;
|
|
163
|
+
}, {
|
|
164
|
+
date?: string | undefined;
|
|
165
|
+
meals?: {
|
|
166
|
+
entityId: string | number;
|
|
167
|
+
inventoryId: string;
|
|
168
|
+
quantity?: number | undefined;
|
|
169
|
+
}[] | undefined;
|
|
170
|
+
response_format?: ResponseFormat | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
export type GetPriceBreakdownInput = z.infer<typeof GetPriceBreakdownSchema>;
|
|
173
|
+
export declare const GetMealDetailsSchema: z.ZodObject<{
|
|
174
|
+
meal_id: z.ZodOptional<z.ZodNumber>;
|
|
175
|
+
inventory_id: z.ZodOptional<z.ZodString>;
|
|
176
|
+
date: z.ZodOptional<z.ZodString>;
|
|
177
|
+
response_format: z.ZodDefault<z.ZodNativeEnum<typeof ResponseFormat>>;
|
|
178
|
+
}, "strict", z.ZodTypeAny, {
|
|
179
|
+
response_format: ResponseFormat;
|
|
180
|
+
date?: string | undefined;
|
|
181
|
+
inventory_id?: string | undefined;
|
|
182
|
+
meal_id?: number | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
date?: string | undefined;
|
|
185
|
+
inventory_id?: string | undefined;
|
|
186
|
+
response_format?: ResponseFormat | undefined;
|
|
187
|
+
meal_id?: number | undefined;
|
|
188
|
+
}>;
|
|
189
|
+
export type GetMenuInput = z.infer<typeof GetMenuSchema>;
|
|
190
|
+
export type SearchMealsInput = z.infer<typeof SearchMealsSchema>;
|
|
191
|
+
export type GetUserInfoInput = z.infer<typeof GetUserInfoSchema>;
|
|
192
|
+
export type ListOrdersInput = z.infer<typeof ListOrdersSchema>;
|
|
193
|
+
export type ListDeliveriesInput = z.infer<typeof ListDeliveriesSchema>;
|
|
194
|
+
export type GetCartInput = z.infer<typeof GetCartSchema>;
|
|
195
|
+
export type AddToCartInput = z.infer<typeof AddToCartSchema>;
|
|
196
|
+
export type RemoveFromCartInput = z.infer<typeof RemoveFromCartSchema>;
|
|
197
|
+
export type ClearCartInput = z.infer<typeof ClearCartSchema>;
|
|
198
|
+
export type SkipDeliveryInput = z.infer<typeof SkipDeliverySchema>;
|
|
199
|
+
export type UnskipDeliveryInput = z.infer<typeof UnskipDeliverySchema>;
|
|
200
|
+
export declare const ConfirmOrderSchema: z.ZodObject<{
|
|
201
|
+
date: z.ZodString;
|
|
202
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
203
|
+
tip: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
}, "strict", z.ZodTypeAny, {
|
|
205
|
+
date: string;
|
|
206
|
+
comment?: string | undefined;
|
|
207
|
+
tip?: number | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
date: string;
|
|
210
|
+
comment?: string | undefined;
|
|
211
|
+
tip?: number | undefined;
|
|
212
|
+
}>;
|
|
213
|
+
export type GetMealDetailsInput = z.infer<typeof GetMealDetailsSchema>;
|
|
214
|
+
export type ConfirmOrderInput = z.infer<typeof ConfirmOrderSchema>;
|
|
215
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAoC,MAAM,iBAAiB,CAAC;AAInF,eAAO,MAAM,UAAU,aAGkF,CAAC;AAE1G,eAAO,MAAM,oBAAoB,sDAGwD,CAAC;AAE1F,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;EASf,CAAC;AAEZ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAMnB,CAAC;AAEZ,eAAO,MAAM,iBAAiB;;;;;;EAEnB,CAAC;AAEZ,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAIlB,CAAC;AAEZ,eAAO,MAAM,oBAAoB;;;;;;EAEtB,CAAC;AAEZ,eAAO,MAAM,aAAa;;;;;;;;;EAGf,CAAC;AAEZ,eAAO,M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,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAIpB,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACvE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ResponseFormat, DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE } from "../constants.js";
|
|
3
|
+
const datePattern = /^\d{4}-\d{2}-\d{2}$/;
|
|
4
|
+
export const DateSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.regex(datePattern, "Date must be YYYY-MM-DD format")
|
|
7
|
+
.describe("Delivery date in YYYY-MM-DD format (must be a Monday). Defaults to next Monday if omitted.");
|
|
8
|
+
export const ResponseFormatSchema = z
|
|
9
|
+
.nativeEnum(ResponseFormat)
|
|
10
|
+
.default(ResponseFormat.MARKDOWN)
|
|
11
|
+
.describe("Output format: 'markdown' for human-readable or 'json' for structured data");
|
|
12
|
+
export const GetMenuSchema = z.object({
|
|
13
|
+
date: DateSchema.optional(),
|
|
14
|
+
category: z.string().optional().describe("Filter by category title (e.g. 'Bowls', 'Protein+')"),
|
|
15
|
+
diet: z.string().optional().describe("Filter by diet tag (e.g. 'gluten-free', 'vegan', 'dairy-free')"),
|
|
16
|
+
max_price: z.number().min(0).optional().describe("Maximum price filter in dollars"),
|
|
17
|
+
min_rating: z.number().min(0).max(5).optional().describe("Minimum rating filter (0-5)"),
|
|
18
|
+
limit: z.number().int().min(1).max(MAX_PAGE_SIZE).default(DEFAULT_PAGE_SIZE).describe("Results per page (max 50)"),
|
|
19
|
+
offset: z.number().int().min(0).default(0).describe("Number of results to skip for pagination"),
|
|
20
|
+
response_format: ResponseFormatSchema,
|
|
21
|
+
}).strict();
|
|
22
|
+
export const SearchMealsSchema = z.object({
|
|
23
|
+
query: z.string().min(1, "Search query is required").max(200).describe("Keyword to search across meal name, description, cuisine, chef, ingredients, diet tags"),
|
|
24
|
+
date: DateSchema.optional(),
|
|
25
|
+
limit: z.number().int().min(1).max(MAX_PAGE_SIZE).default(DEFAULT_PAGE_SIZE).describe("Results per page"),
|
|
26
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
27
|
+
response_format: ResponseFormatSchema,
|
|
28
|
+
}).strict();
|
|
29
|
+
export const GetUserInfoSchema = z.object({
|
|
30
|
+
response_format: ResponseFormatSchema,
|
|
31
|
+
}).strict();
|
|
32
|
+
export const ListOrdersSchema = z.object({
|
|
33
|
+
limit: z.number().int().min(1).max(100).default(20).describe("Number of orders to return"),
|
|
34
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset"),
|
|
35
|
+
response_format: ResponseFormatSchema,
|
|
36
|
+
}).strict();
|
|
37
|
+
export const ListDeliveriesSchema = z.object({
|
|
38
|
+
response_format: ResponseFormatSchema,
|
|
39
|
+
}).strict();
|
|
40
|
+
export const GetCartSchema = z.object({
|
|
41
|
+
date: DateSchema.optional(),
|
|
42
|
+
response_format: ResponseFormatSchema,
|
|
43
|
+
}).strict();
|
|
44
|
+
export const AddToCartSchema = z.object({
|
|
45
|
+
date: DateSchema,
|
|
46
|
+
inventory_id: z.string().min(1).describe("Inventory ID of the meal (from menu/search results)"),
|
|
47
|
+
quantity: z.number().int().min(1).max(10).default(1).describe("Number of portions to add"),
|
|
48
|
+
batch_id: z.number().int().optional().describe("Batch ID of the meal (optional, from menu results)"),
|
|
49
|
+
}).strict();
|
|
50
|
+
export const RemoveFromCartSchema = z.object({
|
|
51
|
+
date: DateSchema,
|
|
52
|
+
inventory_id: z.string().min(1).describe("Inventory ID of the meal to remove"),
|
|
53
|
+
quantity: z.number().int().min(1).max(10).default(1).describe("Number of portions to remove"),
|
|
54
|
+
}).strict();
|
|
55
|
+
export const ClearCartSchema = z.object({
|
|
56
|
+
date: DateSchema,
|
|
57
|
+
}).strict();
|
|
58
|
+
export const SkipDeliverySchema = z.object({
|
|
59
|
+
date: DateSchema,
|
|
60
|
+
}).strict();
|
|
61
|
+
export const UnskipDeliverySchema = z.object({
|
|
62
|
+
date: DateSchema,
|
|
63
|
+
}).strict();
|
|
64
|
+
export const GetPriceBreakdownSchema = z.object({
|
|
65
|
+
date: DateSchema.optional(),
|
|
66
|
+
meals: z.array(z.object({
|
|
67
|
+
entityId: z.union([z.string(), z.number()]).describe("Meal ID (numeric)"),
|
|
68
|
+
quantity: z.number().int().min(1).default(1).describe("Quantity"),
|
|
69
|
+
inventoryId: z.string().describe("Inventory ID (e.g. 'ii-135055242')"),
|
|
70
|
+
})).optional().describe("Meals to price. If omitted, uses current cart contents for the date."),
|
|
71
|
+
response_format: ResponseFormatSchema,
|
|
72
|
+
}).strict();
|
|
73
|
+
export const GetMealDetailsSchema = z.object({
|
|
74
|
+
meal_id: z.number().int().optional().describe("Numeric meal ID (e.g. 12272). Provide meal_id or inventory_id."),
|
|
75
|
+
inventory_id: z.string().optional().describe("Inventory ID string (e.g. 'ii-135055242'). Provide meal_id or inventory_id."),
|
|
76
|
+
date: DateSchema.optional(),
|
|
77
|
+
response_format: ResponseFormatSchema,
|
|
78
|
+
}).strict();
|
|
79
|
+
export const ConfirmOrderSchema = z.object({
|
|
80
|
+
date: DateSchema,
|
|
81
|
+
comment: z.string().optional().describe("Delivery instructions or comment"),
|
|
82
|
+
tip: z.number().min(0).optional().describe("Tip amount in dollars"),
|
|
83
|
+
}).strict();
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB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AC,CAAC,MAAM,EAAE,CAAC;AAIZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gEAAgE,CAAC;IAC/G,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IAC3H,IAAI,EAAE,UAAU,CAAC,QAAQ,EAAE;IAC3B,eAAe,EAAE,oBAAoB;CACtC,CAAC,CAAC,MAAM,EAAE,CAAC;AAaZ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC3E,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;CACpE,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Menu, Meal, DetailedMeal, UserInfo, Order, CartItem, UpcomingDay, SkipResult, MealInput, PriceBreakdown } from "../types.js";
|
|
2
|
+
export declare class CookUnityAPI {
|
|
3
|
+
private auth;
|
|
4
|
+
constructor(email: string, password: string);
|
|
5
|
+
getMenu(date: string, filters?: Record<string, unknown>): Promise<Menu>;
|
|
6
|
+
getMenuDetailed(date: string): Promise<DetailedMeal[]>;
|
|
7
|
+
getUserInfo(): Promise<UserInfo>;
|
|
8
|
+
getAllOrders(): Promise<Order[]>;
|
|
9
|
+
getUpcomingDays(): Promise<UpcomingDay[]>;
|
|
10
|
+
addMeal(date: string, inventoryId: string, quantity?: number, batchId?: number): Promise<CartItem>;
|
|
11
|
+
removeMeal(date: string, inventoryId: string, quantity?: number): Promise<CartItem>;
|
|
12
|
+
clearCart(date: string): Promise<boolean>;
|
|
13
|
+
skipDelivery(date: string): Promise<SkipResult>;
|
|
14
|
+
unskipDelivery(date: string): Promise<SkipResult>;
|
|
15
|
+
createOrder(deliveryDate: string, start: string, end: string, products: Array<{
|
|
16
|
+
qty: number;
|
|
17
|
+
inventoryId: string;
|
|
18
|
+
}>, options?: {
|
|
19
|
+
comment?: string;
|
|
20
|
+
tip?: number;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
__typename: string;
|
|
23
|
+
id?: string;
|
|
24
|
+
deliveryDate?: string;
|
|
25
|
+
paymentStatus?: string;
|
|
26
|
+
error?: string;
|
|
27
|
+
outOfStockIds?: string[];
|
|
28
|
+
}>;
|
|
29
|
+
getPriceBreakdown(date: string, meals: MealInput[]): Promise<PriceBreakdown>;
|
|
30
|
+
searchMeals(keyword: string, date: string): Promise<Meal[]>;
|
|
31
|
+
private queryMenu;
|
|
32
|
+
private querySubscription;
|
|
33
|
+
private executeGraphQL;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/services/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,WAAW,EACX,UAAU,EACV,SAAS,EACT,cAAc,EACf,MAAM,aAAa,CAAC;AAErB,qBAAa,YAAY;IACvB,OAAO,CAAC,IAAI,CAAgB;gBAEhB,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAIrC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB3E,eAAe,CAAC,IAAI,EAAE,MA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