@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.
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +458 -0
- package/agents/README.md +66 -0
- package/agents/shared/business-app-benchmarks.md +111 -0
- package/agents/shared/zeyos-entity-map.md +142 -0
- package/agents/shared/zeyos-entity-reference.md +570 -0
- package/agents/shared/zeyos-query-patterns.md +89 -0
- package/agents/zeyos-account-intelligence/SKILL.md +34 -0
- package/agents/zeyos-account-intelligence/agents/openai.yaml +4 -0
- package/agents/zeyos-account-intelligence/references/workflows.md +84 -0
- package/agents/zeyos-billing-insights/SKILL.md +41 -0
- package/agents/zeyos-billing-insights/agents/openai.yaml +4 -0
- package/agents/zeyos-billing-insights/references/workflows.md +106 -0
- package/agents/zeyos-campaign-and-outreach/SKILL.md +44 -0
- package/agents/zeyos-campaign-and-outreach/agents/openai.yaml +4 -0
- package/agents/zeyos-campaign-and-outreach/references/workflows.md +100 -0
- package/agents/zeyos-collaboration-and-activity/SKILL.md +37 -0
- package/agents/zeyos-collaboration-and-activity/agents/openai.yaml +4 -0
- package/agents/zeyos-collaboration-and-activity/references/workflows.md +104 -0
- package/agents/zeyos-collections-and-dunning/SKILL.md +46 -0
- package/agents/zeyos-collections-and-dunning/agents/openai.yaml +4 -0
- package/agents/zeyos-collections-and-dunning/references/workflows.md +132 -0
- package/agents/zeyos-commerce-and-inventory/SKILL.md +38 -0
- package/agents/zeyos-commerce-and-inventory/agents/openai.yaml +4 -0
- package/agents/zeyos-commerce-and-inventory/references/workflows.md +101 -0
- package/agents/zeyos-mail-operations/SKILL.md +35 -0
- package/agents/zeyos-mail-operations/agents/openai.yaml +4 -0
- package/agents/zeyos-mail-operations/references/workflows.md +110 -0
- package/agents/zeyos-notes-and-sops/SKILL.md +31 -0
- package/agents/zeyos-notes-and-sops/agents/openai.yaml +4 -0
- package/agents/zeyos-notes-and-sops/references/workflows.md +85 -0
- package/agents/zeyos-platform-and-schema/SKILL.md +37 -0
- package/agents/zeyos-platform-and-schema/agents/openai.yaml +4 -0
- package/agents/zeyos-platform-and-schema/references/workflows.md +97 -0
- package/agents/zeyos-work-management/SKILL.md +45 -0
- package/agents/zeyos-work-management/agents/openai.yaml +4 -0
- package/agents/zeyos-work-management/references/workflows.md +148 -0
- package/docs/01-api-reference/01-data-retrieval.md +601 -0
- package/docs/01-api-reference/02-authentication.md +288 -0
- package/docs/01-api-reference/03-resources.md +270 -0
- package/docs/01-api-reference/04-schema.md +539 -0
- package/docs/01-api-reference/_category_.json +9 -0
- package/docs/02-javascript-client/01-getting-started.md +146 -0
- package/docs/02-javascript-client/02-authentication.md +287 -0
- package/docs/02-javascript-client/03-making-requests.md +572 -0
- package/docs/02-javascript-client/04-practical-guide.md +348 -0
- package/docs/02-javascript-client/_category_.json +9 -0
- package/docs/03-cli/01-getting-started.md +219 -0
- package/docs/03-cli/02-commands.md +407 -0
- package/docs/03-cli/03-configuration.md +220 -0
- package/docs/03-cli/_category_.json +9 -0
- package/docs/04-agent-workflows/00-coding-agents.md +35 -0
- package/docs/04-agent-workflows/01-agent-quickstart.md +147 -0
- package/docs/04-agent-workflows/02-agent-recipes.md +109 -0
- package/docs/04-agent-workflows/03-cli-coverage-and-escalation.md +65 -0
- package/docs/04-agent-workflows/_category_.json +9 -0
- package/docs/04-sample-apps/01-kanban.md +89 -0
- package/docs/04-sample-apps/02-crm.md +81 -0
- package/docs/04-sample-apps/03-dashboard.md +80 -0
- package/docs/04-sample-apps/_category_.json +9 -0
- package/docs/05-tutorials/00-application-developers.md +43 -0
- package/docs/05-tutorials/01-integration-architecture.md +60 -0
- package/docs/05-tutorials/02-build-your-own-zeyos-frontend.md +517 -0
- package/docs/05-tutorials/03-server-side-integrations.md +185 -0
- package/docs/05-tutorials/_category_.json +9 -0
- package/docs/intro.md +197 -0
- package/openapi/api.json +24308 -0
- package/openapi/auth.json +415 -0
- package/openapi/dbref.json +56223 -0
- package/openapi/oauth2.json +781 -0
- package/openapi/sdk.json +949 -0
- package/openapi/views.txt +642 -0
- package/package.json +49 -0
- package/samples/crm/README.md +28 -0
- package/samples/crm/index.html +327 -0
- package/samples/crm/js/api.js +208 -0
- package/samples/crm/js/auth.js +61 -0
- package/samples/crm/js/main.js +545 -0
- package/samples/crm/js/state.js +90 -0
- package/samples/crm/js/ui.js +51 -0
- package/samples/dashboard/README.md +28 -0
- package/samples/dashboard/index.html +280 -0
- package/samples/dashboard/js/api.js +197 -0
- package/samples/dashboard/js/auth.js +59 -0
- package/samples/dashboard/js/main.js +382 -0
- package/samples/dashboard/js/state.js +81 -0
- package/samples/dashboard/js/ui.js +48 -0
- package/samples/kanban/README.md +28 -0
- package/samples/kanban/index.html +263 -0
- package/samples/kanban/js/api.js +152 -0
- package/samples/kanban/js/auth.js +59 -0
- package/samples/kanban/js/constants.js +40 -0
- package/samples/kanban/js/kanban.js +246 -0
- package/samples/kanban/js/main.js +362 -0
- package/samples/kanban/js/modals.js +474 -0
- package/samples/kanban/js/settings.js +82 -0
- package/samples/kanban/js/state.js +118 -0
- package/samples/kanban/js/ui.js +49 -0
- package/scripts/generate-client.mjs +344 -0
- package/src/generated/operations.js +9772 -0
- package/src/generated/schema.js +8982 -0
- package/src/index.js +85 -0
- package/src/runtime/client.js +1208 -0
- package/src/runtime/error.js +29 -0
- package/src/runtime/http.js +174 -0
- package/src/runtime/request-shape.js +35 -0
- package/src/runtime/schema.js +206 -0
- package/src/runtime/suggest.js +74 -0
- package/src/runtime/token-store.js +105 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createZeyosClient } from './runtime/client.js';
|
|
2
|
+
import { ZeyosApiError, ZeyosValidationError } from './runtime/error.js';
|
|
3
|
+
import { MemoryTokenStore, normalizeTokenSet, tokenResponseToTokenSet } from './runtime/token-store.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {null|boolean|number|string|JsonValue[]|Record<string, JsonValue>} JsonValue
|
|
7
|
+
* @typedef {Record<string, JsonValue>} ZeyosRecord
|
|
8
|
+
* @typedef {ZeyosRecord[]|{ data?: ZeyosRecord[], count?: number }} ListResult
|
|
9
|
+
* @typedef {{ data: ZeyosRecord[], count?: number }} NormalizedListResult
|
|
10
|
+
* @typedef {number|string|ZeyosRecord[]|{ count?: number|string|null, data?: ZeyosRecord[] }|null|undefined} CountResult
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Normalise a list API response into a consistent `{ data, count? }` shape.
|
|
15
|
+
*
|
|
16
|
+
* ZeyOS list endpoints are not completely uniform across the full generated
|
|
17
|
+
* surface. This helper handles the common list-like cases where the response
|
|
18
|
+
* is either a plain array or an object wrapper that contains `data` and
|
|
19
|
+
* optional `count` metadata.
|
|
20
|
+
*
|
|
21
|
+
* @param {ListResult|null|undefined} result - The raw value returned by a list operation.
|
|
22
|
+
* @returns {NormalizedListResult}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const raw = await client.api.listTickets({ filters: { visibility: 0 } });
|
|
26
|
+
* const { data } = normalizeListResult(raw); // data is always an array
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const raw = await client.api.listTickets({ filters: { visibility: 0 }, count: true });
|
|
30
|
+
* const { data, count } = normalizeListResult(raw);
|
|
31
|
+
*/
|
|
32
|
+
export function normalizeListResult(result) {
|
|
33
|
+
if (Array.isArray(result)) {
|
|
34
|
+
return { data: result };
|
|
35
|
+
}
|
|
36
|
+
if (result != null && typeof result === 'object') {
|
|
37
|
+
const data = Array.isArray(result.data) ? result.data : [];
|
|
38
|
+
const out = { data };
|
|
39
|
+
// `count` may arrive as a number or a numeric string depending on endpoint;
|
|
40
|
+
// preserve it as a number when it is a finite numeric value.
|
|
41
|
+
if (typeof result.count === 'number' && Number.isFinite(result.count)) {
|
|
42
|
+
out.count = result.count;
|
|
43
|
+
} else if (typeof result.count === 'string' && result.count !== '') {
|
|
44
|
+
const parsed = Number(result.count);
|
|
45
|
+
if (Number.isFinite(parsed)) out.count = parsed;
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
return { data: [] };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Normalise a count response into a number.
|
|
54
|
+
*
|
|
55
|
+
* Count-capable endpoints may return `count` directly, an object with a
|
|
56
|
+
* `count` property, or a list fallback. This keeps sample apps and CLI code
|
|
57
|
+
* from reimplementing that shape handling at every call site.
|
|
58
|
+
*
|
|
59
|
+
* @param {CountResult} result - Raw value returned by a count request.
|
|
60
|
+
* @returns {number}
|
|
61
|
+
*/
|
|
62
|
+
export function normalizeCountResult(result) {
|
|
63
|
+
if (typeof result === 'number') {
|
|
64
|
+
return Number.isFinite(result) ? result : 0;
|
|
65
|
+
}
|
|
66
|
+
if (typeof result === 'string' && result !== '') {
|
|
67
|
+
const parsed = Number(result);
|
|
68
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(result)) {
|
|
71
|
+
return result.length;
|
|
72
|
+
}
|
|
73
|
+
if (result != null && typeof result === 'object') {
|
|
74
|
+
if (result.count != null) {
|
|
75
|
+
const parsed = Number(result.count);
|
|
76
|
+
return Number.isFinite(parsed) ? parsed : 0;
|
|
77
|
+
}
|
|
78
|
+
if (Array.isArray(result.data)) {
|
|
79
|
+
return result.data.length;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return 0;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export { createZeyosClient, ZeyosApiError, ZeyosValidationError, MemoryTokenStore, normalizeTokenSet, tokenResponseToTokenSet };
|