@atlas-kitchen/atlas-mcp 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/.env.example +8 -0
- package/CLAUDE.md +135 -0
- package/README.md +161 -0
- package/dist/auth.d.ts +24 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +78 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +22 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +1142 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +83 -0
- package/dist/index.js.map +1 -0
- package/dist/polyfills.d.ts +2 -0
- package/dist/polyfills.d.ts.map +1 -0
- package/dist/tools/auth.d.ts +11 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +155 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/menu.d.ts +11 -0
- package/dist/tools/menu.d.ts.map +1 -0
- package/dist/tools/menu.js +161 -0
- package/dist/tools/menu.js.map +1 -0
- package/dist/tools/orders.d.ts +11 -0
- package/dist/tools/orders.d.ts.map +1 -0
- package/dist/tools/orders.js +170 -0
- package/dist/tools/orders.js.map +1 -0
- package/dist/tools/reports.d.ts +11 -0
- package/dist/tools/reports.d.ts.map +1 -0
- package/dist/tools/reports.js +151 -0
- package/dist/tools/reports.js.map +1 -0
- package/dist/types/atlas.d.ts +125 -0
- package/dist/types/atlas.d.ts.map +1 -0
- package/dist/types/atlas.js +2 -0
- package/dist/types/atlas.js.map +1 -0
- package/package.json +55 -0
package/.env.example
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Atlas GraphQL base URL (production by default)
|
|
2
|
+
ATLAS_GRAPHQL_ENDPOINT=https://atlas-api.food.wearelion.com
|
|
3
|
+
|
|
4
|
+
# Client identification headers
|
|
5
|
+
ATLAS_CLIENT_NAME=atlas-mcp-1.0.0
|
|
6
|
+
|
|
7
|
+
# Optional: Override default Atlas endpoint for development
|
|
8
|
+
# ATLAS_GRAPHQL_ENDPOINT=http://localhost:3000
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
Atlas MCP Server - A Model Context Protocol (MCP) server that provides integration with the Atlas restaurant management system's GraphQL API. This server enables Claude to interact with restaurant orders, menus, sales reports, and other restaurant management features.
|
|
8
|
+
|
|
9
|
+
## Development Commands
|
|
10
|
+
|
|
11
|
+
### Setup
|
|
12
|
+
```bash
|
|
13
|
+
npm install
|
|
14
|
+
cp .env.example .env # Configure with your Atlas credentials
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Build & Run
|
|
18
|
+
```bash
|
|
19
|
+
npm run build # Compile TypeScript to dist/
|
|
20
|
+
npm run dev # Run source directly with tsx (development)
|
|
21
|
+
npm start # Run compiled JavaScript (production)
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Requirements
|
|
25
|
+
- Node.js >= 18.0.0 (required for native fetch and Headers APIs)
|
|
26
|
+
- Environment variables configured in .env file
|
|
27
|
+
|
|
28
|
+
## Architecture
|
|
29
|
+
|
|
30
|
+
### Core Structure
|
|
31
|
+
```
|
|
32
|
+
src/
|
|
33
|
+
├── index.ts # MCP server setup and tool registration
|
|
34
|
+
├── auth.ts # Authentication state manager (JWT tokens)
|
|
35
|
+
├── client.ts # GraphQL client wrapper with auth handling
|
|
36
|
+
├── types/ # TypeScript type definitions
|
|
37
|
+
└── tools/ # MCP tool implementations by domain
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Key Components
|
|
41
|
+
|
|
42
|
+
1. **Authentication Manager** (auth.ts)
|
|
43
|
+
- Stateful JWT token management
|
|
44
|
+
- Automatic token refresh on 401 errors
|
|
45
|
+
- Multi-merchant context switching
|
|
46
|
+
|
|
47
|
+
2. **GraphQL Client** (client.ts)
|
|
48
|
+
- Wrapper around graphql-request
|
|
49
|
+
- Automatic auth header injection
|
|
50
|
+
- Error handling with retry on auth failures
|
|
51
|
+
|
|
52
|
+
3. **Tool Organization**
|
|
53
|
+
- `tools/auth.ts` - Login, logout, token refresh, merchant switching
|
|
54
|
+
- `tools/orders.ts` - Order and cart management
|
|
55
|
+
- `tools/menu.ts` - Menu and item queries
|
|
56
|
+
- `tools/reports.ts` - Sales analytics and insights
|
|
57
|
+
|
|
58
|
+
### Authentication Flow
|
|
59
|
+
1. Use `atlas_login` tool with email/password
|
|
60
|
+
2. Tokens are stored in AuthManager singleton
|
|
61
|
+
3. All subsequent API calls use stored tokens
|
|
62
|
+
4. On 401, automatically attempts token refresh
|
|
63
|
+
5. Use `atlas_switch_merchant` to change merchant context
|
|
64
|
+
|
|
65
|
+
### IMPORTANT: Outlet Context Requirements
|
|
66
|
+
Many API endpoints require an outlet context to be set. Always use `atlas_switch_merchant` with an `outletId` after login:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
// After login, switch to a merchant WITH an outlet ID
|
|
70
|
+
atlas_switch_merchant({
|
|
71
|
+
merchantId: "1",
|
|
72
|
+
outletId: "1" // REQUIRED for many endpoints!
|
|
73
|
+
})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Endpoints that REQUIRE outlet context:**
|
|
77
|
+
- `atlas_get_pos_carts` - Uses `context[:current_outlet].id` in backend
|
|
78
|
+
- `atlas_get_product_insights` - Needs outlet context for data filtering
|
|
79
|
+
- Most POS-related operations
|
|
80
|
+
|
|
81
|
+
**Common error if outlet not set:**
|
|
82
|
+
- 500 server error
|
|
83
|
+
- GraphQL execution errors
|
|
84
|
+
|
|
85
|
+
Always check if an endpoint is returning 500 errors - it likely needs outlet context!
|
|
86
|
+
|
|
87
|
+
### GraphQL Endpoint
|
|
88
|
+
Default: `https://api.atlas.kitchen`
|
|
89
|
+
Configurable via `ATLAS_GRAPHQL_ENDPOINT` environment variable (base URL only, paths are appended automatically)
|
|
90
|
+
|
|
91
|
+
## Type Safety
|
|
92
|
+
|
|
93
|
+
All GraphQL operations use TypeScript types defined in `src/types/atlas.ts`. When adding new queries/mutations:
|
|
94
|
+
1. Define input/output types in atlas.ts
|
|
95
|
+
2. Use Zod schemas for runtime validation of tool inputs
|
|
96
|
+
3. Ensure GraphQL fragments match expected response types
|
|
97
|
+
|
|
98
|
+
## Common Development Tasks
|
|
99
|
+
|
|
100
|
+
### Adding a New Tool
|
|
101
|
+
1. Create tool definition in appropriate file under `src/tools/`
|
|
102
|
+
2. Define Zod schema for input validation
|
|
103
|
+
3. Implement GraphQL query/mutation
|
|
104
|
+
4. Add corresponding TypeScript types in `src/types/atlas.ts`
|
|
105
|
+
5. Register tool in `src/index.ts`
|
|
106
|
+
|
|
107
|
+
### Debugging GraphQL Requests
|
|
108
|
+
The GraphQL client logs errors to console. Check for:
|
|
109
|
+
- Authentication failures (401)
|
|
110
|
+
- GraphQL validation errors
|
|
111
|
+
- Network connectivity issues
|
|
112
|
+
|
|
113
|
+
### Testing Authentication
|
|
114
|
+
```bash
|
|
115
|
+
# Start in dev mode
|
|
116
|
+
npm run dev
|
|
117
|
+
|
|
118
|
+
# In Claude, test login
|
|
119
|
+
# Use atlas_login tool with valid credentials
|
|
120
|
+
# Then test other tools like atlas_get_orders
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Environment Variables
|
|
124
|
+
|
|
125
|
+
Required in .env:
|
|
126
|
+
- `ATLAS_GRAPHQL_ENDPOINT` - GraphQL API endpoint (optional, has default)
|
|
127
|
+
- `ATLAS_CLIENT_NAME` - Client identifier for API requests
|
|
128
|
+
- `ATLAS_PLATFORM` - Platform identifier (defaults to "mcp")
|
|
129
|
+
|
|
130
|
+
## Integration with Claude Code
|
|
131
|
+
|
|
132
|
+
The server is configured via MCP settings. See README.md for the exact configuration needed. Key points:
|
|
133
|
+
- Must use Node.js 18+ for the command path
|
|
134
|
+
- Environment variables can be set in MCP config
|
|
135
|
+
- For development, use tsx to run TypeScript directly
|
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Atlas MCP Server
|
|
2
|
+
|
|
3
|
+
An MCP (Model Context Protocol) server for integrating with the Atlas restaurant management system.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 18.0.0 or higher (required for native fetch and Headers APIs)
|
|
8
|
+
|
|
9
|
+
## Quick Start with npx
|
|
10
|
+
|
|
11
|
+
The easiest way to use this MCP server is with npx (no installation required):
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @atlas-kitchen/atlas-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Using with Claude Desktop
|
|
18
|
+
|
|
19
|
+
Add this to your Claude Desktop MCP configuration:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"atlas-mcp": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "@atlas-kitchen/atlas-mcp"],
|
|
26
|
+
"env": {
|
|
27
|
+
"ATLAS_GRAPHQL_ENDPOINT": "https://api.atlas.kitchen/v1/restaurants/graphql",
|
|
28
|
+
"ATLAS_CLIENT_NAME": "atlas-mcp",
|
|
29
|
+
"ATLAS_PLATFORM": "mcp"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Environment Variables
|
|
36
|
+
|
|
37
|
+
The following environment variables can be configured:
|
|
38
|
+
|
|
39
|
+
- `ATLAS_GRAPHQL_ENDPOINT` - GraphQL API base URL (default: `https://api.atlas.kitchen`)
|
|
40
|
+
- `ATLAS_CLIENT_NAME` - Client identifier for API requests (default: `atlas-mcp`)
|
|
41
|
+
- `ATLAS_PLATFORM` - Platform identifier (default: `mcp`)
|
|
42
|
+
|
|
43
|
+
## Local Installation
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install atlas-mcp
|
|
47
|
+
# or globally
|
|
48
|
+
npm install -g atlas-mcp
|
|
49
|
+
|
|
50
|
+
# Then run
|
|
51
|
+
atlas-mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
### Environment Variables
|
|
57
|
+
|
|
58
|
+
The server accepts the following environment variables:
|
|
59
|
+
|
|
60
|
+
- `ATLAS_GRAPHQL_ENDPOINT` - Atlas GraphQL API endpoint (default: `https://atlas-api.food.wearelion.com/v1/restaurants/graphql`)
|
|
61
|
+
- `ATLAS_CLIENT_NAME` - Client identifier for API requests (default: `atlas-mcp`)
|
|
62
|
+
- `ATLAS_PLATFORM` - Platform identifier (default: `mcp`)
|
|
63
|
+
|
|
64
|
+
### Local Development
|
|
65
|
+
|
|
66
|
+
For local development, copy `.env.example` to `.env` and configure as needed:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cp .env.example .env
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Adding to Claude Desktop
|
|
73
|
+
|
|
74
|
+
To use this MCP server with Claude Desktop, update your configuration file:
|
|
75
|
+
|
|
76
|
+
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
77
|
+
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
78
|
+
|
|
79
|
+
### Option 1: Using npx (Recommended)
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"atlas-mcp": {
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["-y", "@atlas-kitchen/atlas-mcp"],
|
|
87
|
+
"env": {
|
|
88
|
+
"ATLAS_GRAPHQL_ENDPOINT": "https://atlas-api.food.wearelion.com/v1/restaurants/graphql",
|
|
89
|
+
"ATLAS_CLIENT_NAME": "atlas-mcp",
|
|
90
|
+
"ATLAS_PLATFORM": "mcp"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Option 2: Local Development
|
|
98
|
+
|
|
99
|
+
For development with source code:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"atlas-mcp": {
|
|
105
|
+
"command": "npx",
|
|
106
|
+
"args": ["tsx", "/path/to/atlas-mcp/src/index.ts"],
|
|
107
|
+
"env": {
|
|
108
|
+
"ATLAS_GRAPHQL_ENDPOINT": "https://atlas-api.food.wearelion.com/v1/restaurants/graphql",
|
|
109
|
+
"ATLAS_CLIENT_NAME": "atlas-mcp",
|
|
110
|
+
"ATLAS_PLATFORM": "mcp"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Note:** Ensure you have Node.js 18+ installed. You can verify with `node --version`.
|
|
118
|
+
|
|
119
|
+
## Development
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
npm run dev
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Building
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
npm run build
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Available Tools
|
|
132
|
+
|
|
133
|
+
### Authentication
|
|
134
|
+
- `atlas_login` - Login to Atlas with email/password
|
|
135
|
+
- `atlas_logout` - Logout and clear authentication
|
|
136
|
+
- `atlas_refresh_token` - Refresh access token
|
|
137
|
+
- `atlas_switch_merchant` - Switch active merchant context (⚠️ **IMPORTANT**: Always provide `outletId` for POS operations)
|
|
138
|
+
|
|
139
|
+
### Usage Example
|
|
140
|
+
```javascript
|
|
141
|
+
// 1. Login first
|
|
142
|
+
atlas_login({ email: "user@example.com", password: "password" })
|
|
143
|
+
|
|
144
|
+
// 2. CRITICAL: Switch merchant WITH outlet ID
|
|
145
|
+
atlas_switch_merchant({
|
|
146
|
+
merchantId: "1",
|
|
147
|
+
outletId: "1" // Required for POS carts, product insights, etc.
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
// 3. Now you can use POS endpoints
|
|
151
|
+
atlas_get_pos_carts()
|
|
152
|
+
```
|
|
153
|
+
- `atlas_get_orders` - List orders with filters
|
|
154
|
+
- `atlas_get_order` - Get detailed order information
|
|
155
|
+
- `atlas_get_cart` - Get cart information
|
|
156
|
+
- `atlas_get_pos_carts` - List open POS carts
|
|
157
|
+
- `atlas_get_menus` - List available menus
|
|
158
|
+
- `atlas_get_optimized_menus` - Get optimized menu structure with sections and items
|
|
159
|
+
- `atlas_get_items` - List menu items
|
|
160
|
+
- `atlas_get_sales_report` - Get sales analytics
|
|
161
|
+
- `atlas_get_product_insights` - Product performance data
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AuthTokens } from './types/atlas.js';
|
|
2
|
+
export declare class AuthManager {
|
|
3
|
+
private tokens;
|
|
4
|
+
private merchantId;
|
|
5
|
+
private outletId;
|
|
6
|
+
private brandId;
|
|
7
|
+
private clientUuid;
|
|
8
|
+
private pinToken;
|
|
9
|
+
constructor();
|
|
10
|
+
setTokens(tokens: AuthTokens): void;
|
|
11
|
+
getTokens(): AuthTokens | null;
|
|
12
|
+
getAccessToken(): string | null;
|
|
13
|
+
setPinToken(pinToken: string): void;
|
|
14
|
+
getPinToken(): string | null;
|
|
15
|
+
setMerchantContext(merchantId: string, outletId?: string, brandId?: string): void;
|
|
16
|
+
getMerchantId(): string | null;
|
|
17
|
+
getOutletId(): string | null;
|
|
18
|
+
getBrandId(): string | null;
|
|
19
|
+
getClientUuid(): string;
|
|
20
|
+
getHeaders(): Record<string, string>;
|
|
21
|
+
clear(): void;
|
|
22
|
+
isAuthenticated(): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAG7D,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAuB;;IAOvC,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAInC,SAAS,IAAI,UAAU,GAAG,IAAI;IAI9B,cAAc,IAAI,MAAM,GAAG,IAAI;IAI/B,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC,WAAW,IAAI,MAAM,GAAG,IAAI;IAI5B,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAMjF,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B,WAAW,IAAI,MAAM,GAAG,IAAI;IAI5B,UAAU,IAAI,MAAM,GAAG,IAAI;IAI3B,aAAa,IAAI,MAAM;IAIvB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IA0BpC,KAAK,IAAI,IAAI;IAUb,eAAe,IAAI,OAAO;CAG3B"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
export class AuthManager {
|
|
3
|
+
tokens = null;
|
|
4
|
+
merchantId = null;
|
|
5
|
+
outletId = null;
|
|
6
|
+
brandId = null;
|
|
7
|
+
clientUuid;
|
|
8
|
+
pinToken = null;
|
|
9
|
+
constructor() {
|
|
10
|
+
// Generate a persistent client UUID for this session
|
|
11
|
+
this.clientUuid = uuidv4();
|
|
12
|
+
}
|
|
13
|
+
setTokens(tokens) {
|
|
14
|
+
this.tokens = tokens;
|
|
15
|
+
}
|
|
16
|
+
getTokens() {
|
|
17
|
+
return this.tokens;
|
|
18
|
+
}
|
|
19
|
+
getAccessToken() {
|
|
20
|
+
return this.tokens?.accessToken || null;
|
|
21
|
+
}
|
|
22
|
+
setPinToken(pinToken) {
|
|
23
|
+
this.pinToken = pinToken;
|
|
24
|
+
}
|
|
25
|
+
getPinToken() {
|
|
26
|
+
return this.pinToken;
|
|
27
|
+
}
|
|
28
|
+
setMerchantContext(merchantId, outletId, brandId) {
|
|
29
|
+
this.merchantId = merchantId;
|
|
30
|
+
this.outletId = outletId || null;
|
|
31
|
+
this.brandId = brandId || null;
|
|
32
|
+
}
|
|
33
|
+
getMerchantId() {
|
|
34
|
+
return this.merchantId;
|
|
35
|
+
}
|
|
36
|
+
getOutletId() {
|
|
37
|
+
return this.outletId;
|
|
38
|
+
}
|
|
39
|
+
getBrandId() {
|
|
40
|
+
return this.brandId;
|
|
41
|
+
}
|
|
42
|
+
getClientUuid() {
|
|
43
|
+
return this.clientUuid;
|
|
44
|
+
}
|
|
45
|
+
getHeaders() {
|
|
46
|
+
const headers = {
|
|
47
|
+
'Content-Type': 'application/json',
|
|
48
|
+
};
|
|
49
|
+
// Add authorization header
|
|
50
|
+
if (this.tokens?.accessToken) {
|
|
51
|
+
headers['Authorization'] = `Bearer ${this.tokens.accessToken}`;
|
|
52
|
+
}
|
|
53
|
+
// Add merchant context headers
|
|
54
|
+
if (this.merchantId) {
|
|
55
|
+
headers['X-Merchant-ID'] = this.merchantId;
|
|
56
|
+
}
|
|
57
|
+
if (this.outletId) {
|
|
58
|
+
headers['X-Outlet-ID'] = this.outletId;
|
|
59
|
+
}
|
|
60
|
+
// Add client identification headers (matching restaurant-web format)
|
|
61
|
+
headers['X-Client-UUID'] = this.clientUuid;
|
|
62
|
+
headers['X-Client-Name'] = process.env.ATLAS_CLIENT_NAME || 'atlas-mcp-1.0.0';
|
|
63
|
+
return headers;
|
|
64
|
+
}
|
|
65
|
+
clear() {
|
|
66
|
+
this.tokens = null;
|
|
67
|
+
this.merchantId = null;
|
|
68
|
+
this.outletId = null;
|
|
69
|
+
this.brandId = null;
|
|
70
|
+
this.pinToken = null;
|
|
71
|
+
// Generate new client UUID on clear
|
|
72
|
+
this.clientUuid = uuidv4();
|
|
73
|
+
}
|
|
74
|
+
isAuthenticated() {
|
|
75
|
+
return this.tokens !== null && this.tokens.accessToken !== null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,MAAM,OAAO,WAAW;IACd,MAAM,GAAsB,IAAI,CAAC;IACjC,UAAU,GAAkB,IAAI,CAAC;IACjC,QAAQ,GAAkB,IAAI,CAAC;IAC/B,OAAO,GAAkB,IAAI,CAAC;IAC9B,UAAU,CAAS;IACnB,QAAQ,GAAkB,IAAI,CAAC;IAEvC;QACE,qDAAqD;QACrD,IAAI,CAAC,UAAU,GAAG,MAAM,EAAE,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,MAAkB;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,MAAM,EAAE,WAAW,IAAI,IAAI,CAAC;IAC1C,CAAC;IAED,WAAW,CAAC,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,kBAAkB,CAAC,UAAkB,EAAE,QAAiB,EAAE,OAAgB;QACxE,IAA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AAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,oCAAoC;QACpC,IAAI,CAAC,UAAU,GAAG,MAAM,EAAE,CAAC;IAC7B,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,MAAM,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,IAAI,CAAC;IAClE,CAAC;CACF"}
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuthManager } from './auth.js';
|
|
2
|
+
export declare class AtlasClient {
|
|
3
|
+
private restaurantClient;
|
|
4
|
+
private accountClient;
|
|
5
|
+
private authManager;
|
|
6
|
+
private baseUrl;
|
|
7
|
+
constructor(authManager: AuthManager);
|
|
8
|
+
request<T = any>(query: string, variables?: any, context?: 'restaurants' | 'accounts'): Promise<T>;
|
|
9
|
+
login(email: string, password: string): Promise<any>;
|
|
10
|
+
logout(): Promise<any>;
|
|
11
|
+
refreshToken(refreshToken: string): Promise<any>;
|
|
12
|
+
getOrders(filters?: any): Promise<any>;
|
|
13
|
+
getOrder(orderId: string): Promise<any>;
|
|
14
|
+
getCart(cartId: string): Promise<any>;
|
|
15
|
+
getOpenPosCarts(): Promise<any>;
|
|
16
|
+
getMenus(outletId?: number, servingDate?: string, timeslotType?: string): Promise<any>;
|
|
17
|
+
getOptimizedMenus(outletId: number, servingDate: string): Promise<any>;
|
|
18
|
+
getItems(filter?: any): Promise<any>;
|
|
19
|
+
getSalesReport(filters: any, dateRange: any): Promise<any>;
|
|
20
|
+
getProductInsights(params: any): Promise<any>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,WAAW;IACtB,OAAO,C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