@zeyos/client 0.1.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +458 -0
  4. package/agents/README.md +66 -0
  5. package/agents/shared/business-app-benchmarks.md +111 -0
  6. package/agents/shared/zeyos-entity-map.md +142 -0
  7. package/agents/shared/zeyos-entity-reference.md +570 -0
  8. package/agents/shared/zeyos-query-patterns.md +89 -0
  9. package/agents/zeyos-account-intelligence/SKILL.md +34 -0
  10. package/agents/zeyos-account-intelligence/agents/openai.yaml +4 -0
  11. package/agents/zeyos-account-intelligence/references/workflows.md +84 -0
  12. package/agents/zeyos-billing-insights/SKILL.md +41 -0
  13. package/agents/zeyos-billing-insights/agents/openai.yaml +4 -0
  14. package/agents/zeyos-billing-insights/references/workflows.md +106 -0
  15. package/agents/zeyos-campaign-and-outreach/SKILL.md +44 -0
  16. package/agents/zeyos-campaign-and-outreach/agents/openai.yaml +4 -0
  17. package/agents/zeyos-campaign-and-outreach/references/workflows.md +100 -0
  18. package/agents/zeyos-collaboration-and-activity/SKILL.md +37 -0
  19. package/agents/zeyos-collaboration-and-activity/agents/openai.yaml +4 -0
  20. package/agents/zeyos-collaboration-and-activity/references/workflows.md +104 -0
  21. package/agents/zeyos-collections-and-dunning/SKILL.md +46 -0
  22. package/agents/zeyos-collections-and-dunning/agents/openai.yaml +4 -0
  23. package/agents/zeyos-collections-and-dunning/references/workflows.md +132 -0
  24. package/agents/zeyos-commerce-and-inventory/SKILL.md +38 -0
  25. package/agents/zeyos-commerce-and-inventory/agents/openai.yaml +4 -0
  26. package/agents/zeyos-commerce-and-inventory/references/workflows.md +101 -0
  27. package/agents/zeyos-mail-operations/SKILL.md +35 -0
  28. package/agents/zeyos-mail-operations/agents/openai.yaml +4 -0
  29. package/agents/zeyos-mail-operations/references/workflows.md +110 -0
  30. package/agents/zeyos-notes-and-sops/SKILL.md +31 -0
  31. package/agents/zeyos-notes-and-sops/agents/openai.yaml +4 -0
  32. package/agents/zeyos-notes-and-sops/references/workflows.md +85 -0
  33. package/agents/zeyos-platform-and-schema/SKILL.md +37 -0
  34. package/agents/zeyos-platform-and-schema/agents/openai.yaml +4 -0
  35. package/agents/zeyos-platform-and-schema/references/workflows.md +97 -0
  36. package/agents/zeyos-work-management/SKILL.md +45 -0
  37. package/agents/zeyos-work-management/agents/openai.yaml +4 -0
  38. package/agents/zeyos-work-management/references/workflows.md +148 -0
  39. package/docs/01-api-reference/01-data-retrieval.md +601 -0
  40. package/docs/01-api-reference/02-authentication.md +288 -0
  41. package/docs/01-api-reference/03-resources.md +270 -0
  42. package/docs/01-api-reference/04-schema.md +539 -0
  43. package/docs/01-api-reference/_category_.json +9 -0
  44. package/docs/02-javascript-client/01-getting-started.md +146 -0
  45. package/docs/02-javascript-client/02-authentication.md +287 -0
  46. package/docs/02-javascript-client/03-making-requests.md +572 -0
  47. package/docs/02-javascript-client/04-practical-guide.md +348 -0
  48. package/docs/02-javascript-client/_category_.json +9 -0
  49. package/docs/03-cli/01-getting-started.md +219 -0
  50. package/docs/03-cli/02-commands.md +407 -0
  51. package/docs/03-cli/03-configuration.md +220 -0
  52. package/docs/03-cli/_category_.json +9 -0
  53. package/docs/04-agent-workflows/00-coding-agents.md +35 -0
  54. package/docs/04-agent-workflows/01-agent-quickstart.md +147 -0
  55. package/docs/04-agent-workflows/02-agent-recipes.md +109 -0
  56. package/docs/04-agent-workflows/03-cli-coverage-and-escalation.md +65 -0
  57. package/docs/04-agent-workflows/_category_.json +9 -0
  58. package/docs/04-sample-apps/01-kanban.md +89 -0
  59. package/docs/04-sample-apps/02-crm.md +81 -0
  60. package/docs/04-sample-apps/03-dashboard.md +80 -0
  61. package/docs/04-sample-apps/_category_.json +9 -0
  62. package/docs/05-tutorials/00-application-developers.md +43 -0
  63. package/docs/05-tutorials/01-integration-architecture.md +60 -0
  64. package/docs/05-tutorials/02-build-your-own-zeyos-frontend.md +517 -0
  65. package/docs/05-tutorials/03-server-side-integrations.md +185 -0
  66. package/docs/05-tutorials/_category_.json +9 -0
  67. package/docs/intro.md +197 -0
  68. package/openapi/api.json +24308 -0
  69. package/openapi/auth.json +415 -0
  70. package/openapi/dbref.json +56223 -0
  71. package/openapi/oauth2.json +781 -0
  72. package/openapi/sdk.json +949 -0
  73. package/openapi/views.txt +642 -0
  74. package/package.json +49 -0
  75. package/samples/crm/README.md +28 -0
  76. package/samples/crm/index.html +327 -0
  77. package/samples/crm/js/api.js +208 -0
  78. package/samples/crm/js/auth.js +61 -0
  79. package/samples/crm/js/main.js +545 -0
  80. package/samples/crm/js/state.js +90 -0
  81. package/samples/crm/js/ui.js +51 -0
  82. package/samples/dashboard/README.md +28 -0
  83. package/samples/dashboard/index.html +280 -0
  84. package/samples/dashboard/js/api.js +197 -0
  85. package/samples/dashboard/js/auth.js +59 -0
  86. package/samples/dashboard/js/main.js +382 -0
  87. package/samples/dashboard/js/state.js +81 -0
  88. package/samples/dashboard/js/ui.js +48 -0
  89. package/samples/kanban/README.md +28 -0
  90. package/samples/kanban/index.html +263 -0
  91. package/samples/kanban/js/api.js +152 -0
  92. package/samples/kanban/js/auth.js +59 -0
  93. package/samples/kanban/js/constants.js +40 -0
  94. package/samples/kanban/js/kanban.js +246 -0
  95. package/samples/kanban/js/main.js +362 -0
  96. package/samples/kanban/js/modals.js +474 -0
  97. package/samples/kanban/js/settings.js +82 -0
  98. package/samples/kanban/js/state.js +118 -0
  99. package/samples/kanban/js/ui.js +49 -0
  100. package/scripts/generate-client.mjs +344 -0
  101. package/src/generated/operations.js +9772 -0
  102. package/src/generated/schema.js +8982 -0
  103. package/src/index.js +85 -0
  104. package/src/runtime/client.js +1208 -0
  105. package/src/runtime/error.js +29 -0
  106. package/src/runtime/http.js +174 -0
  107. package/src/runtime/request-shape.js +35 -0
  108. package/src/runtime/schema.js +206 -0
  109. package/src/runtime/suggest.js +74 -0
  110. package/src/runtime/token-store.js +105 -0
@@ -0,0 +1,147 @@
1
+ ---
2
+ sidebar_position: 2
3
+ sidebar_label: Agent Quickstart
4
+ ---
5
+
6
+ # Agent Quickstart
7
+
8
+ This guide gets a coding agent from zero to authenticated CRUD access with the ZeyOS CLI.
9
+
10
+ ## Install or Run the CLI
11
+
12
+ From this repository:
13
+
14
+ ```bash
15
+ npm install
16
+ node cli/bin/zeyos.mjs --help
17
+ ```
18
+
19
+ For a global `zeyos` command during development:
20
+
21
+ ```bash
22
+ npm link cli/
23
+ zeyos --help
24
+ ```
25
+
26
+ ## Load the ZeyOS Skills
27
+
28
+ Before doing real work, install the bundled skill packs so the agent picks up ZeyOS's query conventions (entity model, `filters` usage, safe writes):
29
+
30
+ ```bash
31
+ zeyos skills list # see what's available
32
+ zeyos skills install # install all into .claude/skills (or .codex)
33
+ ```
34
+
35
+ This is the recommended entry point for an agent: the skills encode how to resolve names to IDs, which resource to query first, and how to escalate from the CLI to `@zeyos/client`.
36
+
37
+ ## Authenticate
38
+
39
+ Interactive login:
40
+
41
+ ```bash
42
+ zeyos login
43
+ ```
44
+
45
+ Pre-fill login parameters:
46
+
47
+ ```bash
48
+ zeyos login \
49
+ --base-url https://cloud.zeyos.com/demo \
50
+ --client-id myapp \
51
+ --secret "$ZEYOS_CLIENT_SECRET"
52
+ ```
53
+
54
+ This still starts the OAuth authorization-code flow and requires a browser redirect or pasted code. For fully unattended agents, inject `ZEYOS_BASE_URL`, `ZEYOS_TOKEN`, and optionally `ZEYOS_REFRESH_TOKEN`, `ZEYOS_CLIENT_ID`, and `ZEYOS_CLIENT_SECRET` through the environment.
55
+
56
+ The CLI stores credentials in `.zeyos/auth.json` in the current project tree, or in `~/.config/zeyos/credentials.json` when `--global` is used.
57
+
58
+ ## Verify the Session
59
+
60
+ Check the current user:
61
+
62
+ ```bash
63
+ zeyos whoami --json
64
+ ```
65
+
66
+ `whoami` hides access tokens by default. Use `zeyos whoami --show-token --json` only when the token must be handed to another local tool.
67
+
68
+ Discover which curated resources the CLI can operate on directly:
69
+
70
+ ```bash
71
+ zeyos resources
72
+ ```
73
+
74
+ Inspect a resource's fields, types and enum values before querying (works offline, no login needed):
75
+
76
+ ```bash
77
+ zeyos describe tickets
78
+ ```
79
+
80
+ ## Read Data
81
+
82
+ List tickets in machine-readable form:
83
+
84
+ ```bash
85
+ zeyos list tickets --json
86
+ ```
87
+
88
+ List only the fields an agent needs:
89
+
90
+ ```bash
91
+ zeyos list tickets \
92
+ --fields ID,ticketnum,name,status,priority,lastmodified \
93
+ --filter '{"visibility":0}' \
94
+ --sort -lastmodified \
95
+ --limit 20 \
96
+ --json
97
+ ```
98
+
99
+ Fetch one record:
100
+
101
+ ```bash
102
+ zeyos get ticket 42 --all --json
103
+ ```
104
+
105
+ Count matching records:
106
+
107
+ ```bash
108
+ zeyos count tickets --filter '{"visibility":0,"status":4}' --json
109
+ ```
110
+
111
+ ## Write Data
112
+
113
+ Create with JSON-first input:
114
+
115
+ ```bash
116
+ zeyos create ticket \
117
+ --data '{"name":"Follow up with customer","status":0,"priority":2,"visibility":0}' \
118
+ --json
119
+ ```
120
+
121
+ Update with JSON-first input:
122
+
123
+ ```bash
124
+ zeyos update ticket 42 \
125
+ --data '{"status":4,"priority":3}' \
126
+ --json
127
+ ```
128
+
129
+ Delete interactively:
130
+
131
+ ```bash
132
+ zeyos delete ticket 42
133
+ ```
134
+
135
+ Delete non-interactively only when the automation has already decided the record must be removed:
136
+
137
+ ```bash
138
+ zeyos delete ticket 42 --force
139
+ ```
140
+
141
+ ## Safe Defaults for Agents
142
+
143
+ - Use `--json` unless a human is actively reading the output.
144
+ - Include `visibility: 0` in filters for normal business views.
145
+ - Prefer `--data '<json>'` over many separate flags in automation.
146
+ - Run `zeyos resources` before assuming a resource is CLI-supported.
147
+ - Escalate to [`@zeyos/client`](./03-cli-coverage-and-escalation.md) when the CLI resource registry is not enough.
@@ -0,0 +1,109 @@
1
+ ---
2
+ sidebar_position: 3
3
+ sidebar_label: Agent Recipes
4
+ ---
5
+
6
+ # Agent Recipes
7
+
8
+ These workflows are designed for coding agents and shell automation. Every example is safe to convert into CI jobs, local scripts, or ad hoc operational tooling.
9
+
10
+ ## Work a Ticket Queue
11
+
12
+ List active tickets with only the fields you need:
13
+
14
+ ```bash
15
+ zeyos list tickets \
16
+ --fields ID,ticketnum,name,status,priority,assigneduser,lastmodified \
17
+ --filter '{"visibility":0,"status":4}' \
18
+ --sort -lastmodified \
19
+ --limit 50 \
20
+ --json
21
+ ```
22
+
23
+ Count the backlog before acting:
24
+
25
+ ```bash
26
+ zeyos count tickets --filter '{"visibility":0,"status":0}' --json
27
+ ```
28
+
29
+ Move a ticket to a new status:
30
+
31
+ ```bash
32
+ zeyos update ticket 42 --data '{"status":7}' --json
33
+ ```
34
+
35
+ ## Create a Follow-up Ticket
36
+
37
+ ```bash
38
+ zeyos create ticket \
39
+ --data '{"name":"Escalate billing issue","status":0,"priority":3,"account":15,"visibility":0}' \
40
+ --json
41
+ ```
42
+
43
+ Use `zeyos get ticket <id> --json` immediately after creation if the workflow needs server-confirmed fields or related data.
44
+
45
+ ## Query Accounts for an Agent-Facing CRM View
46
+
47
+ Use field aliases and joins when you need a compact response:
48
+
49
+ ```bash
50
+ zeyos list accounts \
51
+ --fields '{"Id":"ID","Name":"lastname","City":"contact.city","Agent":"assigneduser.name"}' \
52
+ --filter '{"visibility":0}' \
53
+ --sort +lastname \
54
+ --limit 25 \
55
+ --json
56
+ ```
57
+
58
+ ## Pull Tasks for a Project or Ticket
59
+
60
+ ```bash
61
+ zeyos list tasks \
62
+ --fields ID,tasknum,name,status,priority,duedate \
63
+ --filter '{"visibility":0,"project":123}' \
64
+ --sort +duedate \
65
+ --json
66
+ ```
67
+
68
+ ```bash
69
+ zeyos list tasks \
70
+ --fields ID,tasknum,name,status,priority,duedate \
71
+ --filter '{"visibility":0,"ticket":42}' \
72
+ --json
73
+ ```
74
+
75
+ ## Paginate Deterministically
76
+
77
+ ```bash
78
+ zeyos list tickets \
79
+ --filter '{"visibility":0}' \
80
+ --sort -lastmodified \
81
+ --limit 100 \
82
+ --offset 0 \
83
+ --json
84
+ ```
85
+
86
+ Advance by incrementing `--offset` yourself. For long-running jobs, always keep the sort explicit so the ordering stays stable.
87
+
88
+ ## Pipe to `jq`
89
+
90
+ Extract IDs:
91
+
92
+ ```bash
93
+ zeyos list tickets --fields ID,name --filter '{"visibility":0}' --json | jq '.[].ID'
94
+ ```
95
+
96
+ Extract the current access token for another tool:
97
+
98
+ ```bash
99
+ zeyos whoami --show-token --json | jq -r '.accessToken'
100
+ ```
101
+
102
+ Treat printed access tokens as secrets. Avoid writing them to logs, shared shell history, or agent transcripts.
103
+
104
+ ## Destructive Guardrails
105
+
106
+ - `zeyos delete` prompts by default. Keep that behavior in human-in-the-loop sessions.
107
+ - Use `--force` only in automation that already has a clear selection rule.
108
+ - Prefer `count` or a dry-run `list` before a bulk action.
109
+ - If a workflow needs unsupported resources, raw request control, or custom retry logic, move it to [`@zeyos/client`](./03-cli-coverage-and-escalation.md).
@@ -0,0 +1,65 @@
1
+ ---
2
+ sidebar_position: 4
3
+ sidebar_label: CLI Coverage and Escalation
4
+ ---
5
+
6
+ # CLI Coverage and Escalation
7
+
8
+ The CLI is the default interface for coding agents, but it intentionally covers a curated registry instead of the full API surface.
9
+
10
+ ## What the CLI Covers Directly
11
+
12
+ The command `zeyos resources` is the source of truth for CLI-supported resource types. At the time of writing, the curated registry includes:
13
+
14
+ | Resource | Operations |
15
+ |----------|------------|
16
+ | `account`, `appointment`, `campaign`, `contact`, `document`, `event`, `file`, `invitation`, `item`, `message`, `note`, `opportunity`, `payment`, `project`, `storage`, `task`, `ticket`, `transaction` | `list`, `get`, `create`, `update`, `delete` |
17
+ | `group`, `user` | `list`, `get` |
18
+
19
+ Plural names and common aliases such as `tickets`, `docs`, `invoice`, and `crm` are resolved by the CLI, but the underlying coverage boundary is still the registry above.
20
+
21
+ ## What the CLI Does Not Try to Cover
22
+
23
+ Switch away from the CLI when you need:
24
+
25
+ - Resources that are present in the generated API client but missing from `zeyos resources`
26
+ - Low-level request control beyond the registry-backed commands
27
+ - Browser session behavior or embedded app flows
28
+ - Full access to generated operations such as `listApplications`, `listServices`, `listResources`, `listPermissions`, or `listWeblets`
29
+ - Custom auth overrides, raw responses, or path-and-method requests
30
+
31
+ ## Escalation Path
32
+
33
+ ### 1. Stay on the CLI if the resource exists in the registry
34
+
35
+ This remains the best option for shell automation, quick operational tooling, and JSON-first CRUD workflows.
36
+
37
+ ### 2. Move to `@zeyos/client` for the full generated API surface
38
+
39
+ ```js
40
+ import { createZeyosClient, MemoryTokenStore } from '@zeyos/client';
41
+
42
+ const client = createZeyosClient({
43
+ platform: 'https://cloud.zeyos.com/demo/',
44
+ auth: {
45
+ mode: 'oauth',
46
+ oauth: {
47
+ tokenStore: new MemoryTokenStore({ accessToken: process.env.ZEYOS_TOKEN }),
48
+ },
49
+ },
50
+ });
51
+
52
+ const services = await client.api.listServices({ limit: 20 });
53
+ ```
54
+
55
+ Use the JavaScript client whenever the CLI registry is insufficient or the workflow needs request-level control.
56
+
57
+ ### 3. Drop to raw REST/OpenAPI when your runtime is not JavaScript
58
+
59
+ Use the API reference and OpenAPI files when you are implementing integrations in another language or building a custom SDK.
60
+
61
+ ## Rule of Thumb
62
+
63
+ - If `zeyos resources` shows the resource and the built-in command shape is enough, stay with the CLI.
64
+ - If the resource exists in the API but not in the CLI registry, move to `@zeyos/client`.
65
+ - If you are not using JavaScript at all, use the REST/OpenAPI reference directly.
@@ -0,0 +1,9 @@
1
+ {
2
+ "label": "Agent Workflows",
3
+ "position": 5,
4
+ "collapsed": false,
5
+ "link": {
6
+ "type": "generated-index",
7
+ "description": "CLI-first workflows for coding agents, automation scripts, and operational tooling built on top of ZeyOS."
8
+ }
9
+ }
@@ -0,0 +1,89 @@
1
+ ---
2
+ sidebar_position: 1
3
+ sidebar_label: Kanban Board
4
+ ---
5
+
6
+ # Kanban Board
7
+
8
+ The `samples/kanban/` application shows how to build a browser-based work queue on top of ZeyOS using plain ES modules and the generated JavaScript client.
9
+
10
+ ## Problem Solved
11
+
12
+ Use this sample when you need a UI for operators who move work through statuses, inspect details, and create follow-up work without leaving a lightweight browser app.
13
+
14
+ ## Auth Model
15
+
16
+ The sample supports both browser auth models used throughout this docs set:
17
+
18
+ - **Token mode** using a pre-obtained access token and optional stored refresh token
19
+ - **Session mode** by probing `/oauth2/v1/userinfo` with `credentials: 'include'`
20
+
21
+ Configuration can come from:
22
+
23
+ - `data-zeyos-*` attributes in `samples/kanban/index.html`
24
+ - persisted `localStorage` values
25
+ - the `window.ZeyOS` console API
26
+
27
+ For long-lived browser sessions, prefer session mode or move OAuth refresh to a backend. Session mode only works from the same origin or when the ZeyOS instance allows credentialed CORS, so token mode is usually the local-development path. The sample does not embed client credentials for browser-side refresh.
28
+
29
+ ## Main API Calls
30
+
31
+ | Operation | Usage in the sample |
32
+ |-----------|---------------------|
33
+ | `listTickets` | Load the board columns and context-filtered ticket lists |
34
+ | `getTicket` | Fetch the full ticket for the detail dialog |
35
+ | `createTicket` | Create new tickets from the modal |
36
+ | `updateTicket` | Move tickets between columns and edit ticket details |
37
+ | `deleteTicket` | Remove tickets from the board |
38
+ | `listTasks` | Load tasks linked to a ticket |
39
+ | `listProjects` | Populate the project context dropdown |
40
+
41
+ ## Reusable Patterns
42
+
43
+ - **Auth boot sequence**: URL resolution, token detection, session probe, then app boot
44
+ - **Optimistic UI update**: move the card first, then confirm with `updateTicket`, then revert on failure
45
+ - **Explicit update body**: all ticket updates in this sample use `{ ID, body }` for clarity (the flat spread form `{ ID, status }` also works)
46
+ - **Context filtering**: a single filter object drives board views such as “all tickets” or “project tickets”
47
+ - **Persistent UI settings**: board columns and runtime config live in `localStorage`
48
+
49
+ ## Safe to Copy
50
+
51
+ The following pieces are good starting points for a new UI:
52
+
53
+ - the token/session boot sequence in `samples/kanban/js/main.js`
54
+ - the session detection helper in `samples/kanban/js/auth.js`
55
+ - the optimistic update pattern around `updateTicket`
56
+ - the `window.ZeyOS` console API for local development and troubleshooting
57
+
58
+ When copying code outside this repository, replace source-tree imports such as `../../../src/index.js` with an import path that exists in your app: an npm package import, a vendored copy of `src/`, or a local symlink.
59
+
60
+ ## Run Locally
61
+
62
+ Serve the repository root with any static file server:
63
+
64
+ ```bash
65
+ cd /path/to/zeyos/client
66
+ python3 -m http.server 8080
67
+ ```
68
+
69
+ Then open:
70
+
71
+ ```text
72
+ http://localhost:8080/samples/kanban/
73
+ ```
74
+
75
+ ## Console API
76
+
77
+ | Method | Description |
78
+ |--------|-------------|
79
+ | `ZeyOS.setUrl(url)` | Set the ZeyOS instance URL |
80
+ | `ZeyOS.setToken(access, refresh?)` | Persist access and optional refresh tokens |
81
+ | `ZeyOS.status()` | Print effective connection state |
82
+ | `ZeyOS.logout()` | Clear stored config and reload |
83
+ | `ZeyOS.reconnect()` | Reload and re-run the auth boot sequence |
84
+
85
+ ## What to Read Next
86
+
87
+ - [Browser UI Playbook](../05-tutorials/02-build-your-own-zeyos-frontend.md)
88
+ - [Practical Guide](../02-javascript-client/04-practical-guide.md)
89
+ - [Kanban sample README](../../samples/kanban/README.md)
@@ -0,0 +1,81 @@
1
+ ---
2
+ sidebar_position: 2
3
+ sidebar_label: CRM Account List
4
+ ---
5
+
6
+ # CRM Account List
7
+
8
+ The `samples/crm/` application shows how to build a read-heavy account UI with server-side search, joined contact fields, modal editing, and predictable pagination.
9
+
10
+ ## Problem Solved
11
+
12
+ Use this sample when you need a compact CRUD interface for operational data such as accounts or contacts and you want the server, not the browser, to do the filtering and sorting work.
13
+
14
+ ## Auth Model
15
+
16
+ The sample uses the same dual browser model as the Kanban app:
17
+
18
+ - **Token mode** with a pre-obtained access token and optional stored refresh token
19
+ - **Session mode** with a `/oauth2/v1/userinfo` probe
20
+
21
+ Configuration can come from `data-zeyos-*` attributes, `localStorage`, or the `window.ZeyOS` console API.
22
+
23
+ For long-lived browser sessions, prefer session mode or move OAuth refresh to a backend. Session mode only works from the same origin or when the ZeyOS instance allows credentialed CORS, so token mode is usually the local-development path. The sample keeps browser code free of client credentials.
24
+
25
+ ## Main API Calls
26
+
27
+ | Operation | Usage in the sample |
28
+ |-----------|---------------------|
29
+ | `listAccounts` | Fetch paginated CRM rows with aliased and joined fields |
30
+ | `getAccount` | Load the full record before editing |
31
+ | `createAccount` | Create new accounts from the modal |
32
+ | `updateAccount` | Apply modal edits via `{ ID, body: data }` |
33
+ | `deleteAccount` | Remove records from the dataset |
34
+
35
+ ## Reusable Patterns
36
+
37
+ - **Object-form `fields`**: the UI requests aliased fields such as `City: 'contact.city'`
38
+ - **Server-side search**: full-text queries use the `query` parameter instead of client-side filtering
39
+ - **Server-side sorting**: column headers map friendly names back to raw API fields
40
+ - **Update helpers**: update helpers use `{ ID, body: data }` to keep path parameters separate from changed fields
41
+ - **Token persistence**: runtime tokens are stored in `localStorage` for the next page load
42
+
43
+ ## Safe to Copy
44
+
45
+ The sample is a strong reference for:
46
+
47
+ - dot-notation joins with aliased output fields
48
+ - building sort maps from UI column names to API field paths
49
+ - debounced search that resets pagination
50
+ - small browser apps that still keep auth, state, API, and UI concerns separate
51
+
52
+ When copying code outside this repository, replace source-tree imports such as `../../../src/index.js` with an import path that exists in your app: an npm package import, a vendored copy of `src/`, or a local symlink.
53
+
54
+ ## Run Locally
55
+
56
+ ```bash
57
+ cd /path/to/zeyos/client
58
+ python3 -m http.server 8080
59
+ ```
60
+
61
+ Open:
62
+
63
+ ```text
64
+ http://localhost:8080/samples/crm/
65
+ ```
66
+
67
+ ## Console API
68
+
69
+ | Method | Description |
70
+ |--------|-------------|
71
+ | `ZeyOS.setUrl(url)` | Set the ZeyOS instance URL |
72
+ | `ZeyOS.setToken(access, refresh?)` | Persist access and optional refresh tokens |
73
+ | `ZeyOS.status()` | Print connection state, search, sort, and page info |
74
+ | `ZeyOS.logout()` | Clear stored config and reload |
75
+ | `ZeyOS.reconnect()` | Reload and re-run the auth boot sequence |
76
+
77
+ ## What to Read Next
78
+
79
+ - [Browser UI Playbook](../05-tutorials/02-build-your-own-zeyos-frontend.md)
80
+ - [Making Requests](../02-javascript-client/03-making-requests.md)
81
+ - [CRM sample README](../../samples/crm/README.md)
@@ -0,0 +1,80 @@
1
+ ---
2
+ sidebar_position: 3
3
+ sidebar_label: Dashboard
4
+ ---
5
+
6
+ # Dashboard
7
+
8
+ The `samples/dashboard/` application shows how to build a read-only operational dashboard that combines multiple ZeyOS queries into one browser view.
9
+
10
+ ## Problem Solved
11
+
12
+ Use this sample when you need KPI cards, summary charts, and recent-activity panels without building a heavy frontend stack.
13
+
14
+ ## Auth Model
15
+
16
+ The dashboard follows the same browser auth model as the other samples:
17
+
18
+ - **Token mode** with a pre-obtained access token and optional stored refresh token
19
+ - **Session mode** via `/oauth2/v1/userinfo`
20
+
21
+ Configuration can come from `data-zeyos-*` attributes, `localStorage`, or the `window.ZeyOS` console API.
22
+
23
+ For long-lived browser sessions, prefer session mode or move OAuth refresh to a backend. Session mode only works from the same origin or when the ZeyOS instance allows credentialed CORS, so token mode is usually the local-development path. The sample avoids shipping client credentials in browser code.
24
+
25
+ ## Main API Calls
26
+
27
+ | Operation | Usage in the sample |
28
+ |-----------|---------------------|
29
+ | `listTickets` with `count: true` | Build total, active, and overdue KPI cards |
30
+ | `listTickets` with explicit fields | Render recent ticket activity |
31
+ | `listAccounts` with `count: true` | Build total account KPIs |
32
+ | `listAccounts` with joins | Render recent account activity |
33
+
34
+ ## Reusable Patterns
35
+
36
+ - **Parallel data loading**: the dashboard fires independent queries with `Promise.all`
37
+ - **Count-first dashboards**: KPI cards use count-enabled requests instead of loading full datasets
38
+ - **Defensive count handling**: the sample treats count-enabled responses conservatively instead of assuming a single wrapper shape
39
+ - **Read-only browser views**: the app demonstrates a useful UI that never mutates records
40
+ - **Minimal field selection**: each summary query requests only the fields needed for display
41
+
42
+ ## Safe to Copy
43
+
44
+ The dashboard is a good template for:
45
+
46
+ - status or backlog overview pages
47
+ - home pages for internal operator portals
48
+ - management dashboards that aggregate a few targeted ZeyOS queries
49
+ - small browser apps that need strong perceived performance from parallel loading
50
+
51
+ When copying code outside this repository, replace source-tree imports such as `../../../src/index.js` with an import path that exists in your app: an npm package import, a vendored copy of `src/`, or a local symlink.
52
+
53
+ ## Run Locally
54
+
55
+ ```bash
56
+ cd /path/to/zeyos/client
57
+ python3 -m http.server 8080
58
+ ```
59
+
60
+ Open:
61
+
62
+ ```text
63
+ http://localhost:8080/samples/dashboard/
64
+ ```
65
+
66
+ ## Console API
67
+
68
+ | Method | Description |
69
+ |--------|-------------|
70
+ | `ZeyOS.setUrl(url)` | Set the ZeyOS instance URL |
71
+ | `ZeyOS.setToken(access, refresh?)` | Persist access and optional refresh tokens |
72
+ | `ZeyOS.status()` | Print effective connection state |
73
+ | `ZeyOS.logout()` | Clear stored config and reload |
74
+ | `ZeyOS.reconnect()` | Reload and re-run the auth boot sequence |
75
+
76
+ ## What to Read Next
77
+
78
+ - [Server-Side Integrations](../05-tutorials/03-server-side-integrations.md)
79
+ - [Making Requests](../02-javascript-client/03-making-requests.md)
80
+ - [Dashboard sample README](../../samples/dashboard/README.md)
@@ -0,0 +1,9 @@
1
+ {
2
+ "label": "Sample Applications",
3
+ "position": 7,
4
+ "collapsed": false,
5
+ "link": {
6
+ "type": "generated-index",
7
+ "description": "Three ready-to-run sample applications demonstrating different ZeyOS API integration patterns."
8
+ }
9
+ }
@@ -0,0 +1,43 @@
1
+ ---
2
+ sidebar_position: 1
3
+ sidebar_label: Application Developers
4
+ ---
5
+
6
+ # Application Developers
7
+
8
+ This path is for developers building external applications that use ZeyOS as the central source of business data and business logic.
9
+
10
+ For v1, the scope is explicitly **external integrations**:
11
+
12
+ - browser UIs
13
+ - server-side services
14
+ - automation backends
15
+ - connected internal tools
16
+
17
+ These docs do **not** cover authoring native ZeyOS platform artifacts.
18
+
19
+ ## Choose Your Starting Point
20
+
21
+ | Goal | Start here | Why |
22
+ |------|------------|-----|
23
+ | Decide between browser, token, and server architectures | [Integration Architecture](./01-integration-architecture.md) | Compares auth and deployment models before you write code |
24
+ | Build a browser UI or internal tool | [Browser UI Playbook](./02-build-your-own-zeyos-frontend.md) | Covers session mode, controlled browser token mode, list queries, CRUD, and UI-safe patterns |
25
+ | Build a backend, worker, or scheduled integration | [Server-Side Integrations](./03-server-side-integrations.md) | Covers token storage, refresh, low-level requests, and sync jobs |
26
+ | Reuse working implementation patterns | [Sample Applications](../04-sample-apps/01-kanban.md) | Shows reusable frontend patterns without framework lock-in |
27
+ | Need the full generated surface | [JavaScript Client](../02-javascript-client/01-getting-started.md) | Full API coverage and low-level request escape hatch |
28
+
29
+ ## Recommended Defaults
30
+
31
+ - Prefer `@zeyos/client` for JavaScript applications.
32
+ - Use `filters` in client code unless you have a reason to stay with raw API `filter`.
33
+ - Include `visibility: 0` for normal business views.
34
+ - Use explicit `body` objects for update operations that also include path parameters such as `ID`.
35
+ - Treat `extdata` and `expand` as separate concepts:
36
+ - `extdata` exposes custom fields
37
+ - `expand` inlines JSON or binary columns
38
+
39
+ ## Next Steps
40
+
41
+ - Read [Integration Architecture](./01-integration-architecture.md)
42
+ - Pick either the [Browser UI Playbook](./02-build-your-own-zeyos-frontend.md) or [Server-Side Integrations](./03-server-side-integrations.md)
43
+ - Use the [API Reference](../01-api-reference/01-data-retrieval.md) and [JavaScript Client docs](../02-javascript-client/03-making-requests.md) as the detailed reference layers