@zeyos/client 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +31 -1
- package/agents/README.md +2 -0
- package/agents/shared/zeyos-entity-map.md +5 -1
- package/agents/shared/zeyos-entity-reference.md +89 -33
- package/docs/03-cli/02-commands.md +28 -0
- package/docs/06-okf/01-overview.md +70 -0
- package/docs/06-okf/02-producing-and-consuming.md +46 -0
- package/docs/06-okf/03-keeping-fresh.md +53 -0
- package/docs/06-okf/04-loops.md +58 -0
- package/docs/06-okf/_category_.json +9 -0
- package/okf/concepts/counting-and-sums.md +10 -0
- package/okf/concepts/dates-unix-seconds.md +12 -0
- package/okf/concepts/enums.md +14 -0
- package/okf/concepts/filters-vs-filter.md +14 -0
- package/okf/concepts/index.md +8 -0
- package/okf/concepts/operationid-vocabulary.md +17 -0
- package/okf/concepts/visibility-column.md +13 -0
- package/okf/entities/accounts.md +82 -0
- package/okf/entities/actionsteps.md +84 -0
- package/okf/entities/addresses.md +50 -0
- package/okf/entities/applicationassets.md +43 -0
- package/okf/entities/applications.md +62 -0
- package/okf/entities/appointments.md +79 -0
- package/okf/entities/associations.md +41 -0
- package/okf/entities/binfiles.md +32 -0
- package/okf/entities/campaigns.md +66 -0
- package/okf/entities/categories.md +55 -0
- package/okf/entities/channels.md +54 -0
- package/okf/entities/comments.md +44 -0
- package/okf/entities/components.md +46 -0
- package/okf/entities/contacts.md +96 -0
- package/okf/entities/contacts2contacts.md +42 -0
- package/okf/entities/contracts.md +83 -0
- package/okf/entities/couponcodes.md +58 -0
- package/okf/entities/coupons.md +69 -0
- package/okf/entities/customfields.md +59 -0
- package/okf/entities/davservers.md +74 -0
- package/okf/entities/devices.md +65 -0
- package/okf/entities/documents.md +76 -0
- package/okf/entities/dunning.md +82 -0
- package/okf/entities/dunning2transactions.md +46 -0
- package/okf/entities/entities2channels.md +42 -0
- package/okf/entities/events.md +57 -0
- package/okf/entities/feedservers.md +67 -0
- package/okf/entities/files.md +50 -0
- package/okf/entities/follows.md +40 -0
- package/okf/entities/forks.md +54 -0
- package/okf/entities/groups.md +48 -0
- package/okf/entities/groups2users.md +44 -0
- package/okf/entities/index.md +93 -0
- package/okf/entities/invitations.md +53 -0
- package/okf/entities/items.md +95 -0
- package/okf/entities/ledgers.md +56 -0
- package/okf/entities/likes.md +40 -0
- package/okf/entities/links.md +70 -0
- package/okf/entities/mailinglists.md +67 -0
- package/okf/entities/mailingrecipients.md +45 -0
- package/okf/entities/mailservers.md +77 -0
- package/okf/entities/messagereads.md +40 -0
- package/okf/entities/messages.md +104 -0
- package/okf/entities/notes.md +73 -0
- package/okf/entities/objects.md +70 -0
- package/okf/entities/opportunities.md +87 -0
- package/okf/entities/participants.md +52 -0
- package/okf/entities/payments.md +76 -0
- package/okf/entities/permissions.md +46 -0
- package/okf/entities/pricelists.md +70 -0
- package/okf/entities/pricelists2accounts.md +46 -0
- package/okf/entities/prices.md +49 -0
- package/okf/entities/projects.md +72 -0
- package/okf/entities/records.md +75 -0
- package/okf/entities/relateditems.md +43 -0
- package/okf/entities/resources.md +55 -0
- package/okf/entities/services.md +64 -0
- package/okf/entities/stocktransactions.md +72 -0
- package/okf/entities/storages.md +56 -0
- package/okf/entities/suppliers.md +51 -0
- package/okf/entities/tasks.md +86 -0
- package/okf/entities/tickets.md +86 -0
- package/okf/entities/transactions.md +118 -0
- package/okf/entities/users.md +66 -0
- package/okf/entities/weblets.md +66 -0
- package/okf/index.md +11 -0
- package/okf/log.md +4 -0
- package/okf/metrics/cash-received.md +10 -0
- package/okf/metrics/index.md +6 -0
- package/okf/metrics/invoiced-net-revenue.md +16 -0
- package/okf/metrics/open-customers.md +14 -0
- package/okf/metrics/overdue-receivables.md +12 -0
- package/okf/playbooks/customer-360.md +12 -0
- package/okf/playbooks/index.md +5 -0
- package/okf/playbooks/revenue-this-year.md +19 -0
- package/okf/playbooks/ticket-work-packet.md +11 -0
- package/package.json +9 -2
- package/scripts/data/okf-curation.mjs +258 -0
- package/scripts/generate-client.mjs +4 -275
- package/scripts/generate-okf.mjs +241 -0
- package/scripts/lib/okf.mjs +272 -0
- package/scripts/lib/spec-model.mjs +325 -0
- package/src/index.js +4 -0
- package/src/runtime/okf.js +237 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: ZeyOS Entity
|
|
3
|
+
title: Transactions
|
|
4
|
+
description: Billing, procurement, or production business transactions.
|
|
5
|
+
resource: zeyos://api/transactions
|
|
6
|
+
tags: [billing, generated]
|
|
7
|
+
api_backed: true
|
|
8
|
+
list_operation: listTransactions
|
|
9
|
+
visibility_column: false
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<!-- okf:generated:start — rewritten by scripts/generate-okf.mjs; do not edit by hand -->
|
|
13
|
+
# Schema
|
|
14
|
+
|
|
15
|
+
| Column | Type | Nullable | Default | Indexed | FK |
|
|
16
|
+
|---|---|---|---|---|---|
|
|
17
|
+
| `ID` | integer | no | — | yes | — |
|
|
18
|
+
| `fork` | integer | yes | — | yes | [forks](/entities/forks.md) |
|
|
19
|
+
| `ownergroup` | integer | yes | — | yes | [groups](/entities/groups.md) |
|
|
20
|
+
| `creator` | integer | yes | — | — | — |
|
|
21
|
+
| `assigneduser` | integer | yes | — | yes | [users](/entities/users.md) |
|
|
22
|
+
| `creationdate` | bigint | no | `date_part('epoch', now())` | — | — |
|
|
23
|
+
| `lastmodified` | bigint | no | `date_part('epoch', now())` | — | — |
|
|
24
|
+
| `account` | integer | yes | — | yes | [accounts](/entities/accounts.md) |
|
|
25
|
+
| `item` | integer | yes | — | yes | [items](/entities/items.md) |
|
|
26
|
+
| `contract` | integer | yes | — | yes | [contracts](/entities/contracts.md) |
|
|
27
|
+
| `transactionnum` | text | no | — | yes | — |
|
|
28
|
+
| `type` | smallint | no | `0` | yes | — |
|
|
29
|
+
| `date` | bigint | no | `date_part('epoch', now())` | yes | — |
|
|
30
|
+
| `duedate` | bigint | yes | — | — | — |
|
|
31
|
+
| `status` | smallint | no | `0` | — | — |
|
|
32
|
+
| `calculation` | smallint | no | `0` | — | — |
|
|
33
|
+
| `productionfactor` | integer | yes | — | — | — |
|
|
34
|
+
| `currency` | character varying(3) | no | — | — | — |
|
|
35
|
+
| `exchangerate` | double precision | no | `1` | — | — |
|
|
36
|
+
| `taxid` | text | no | `''` | — | — |
|
|
37
|
+
| `shippingrecipient` | text | no | `''` | — | — |
|
|
38
|
+
| `shippingaddress` | text | no | `''` | — | — |
|
|
39
|
+
| `shippingpostalcode` | text | no | `''` | — | — |
|
|
40
|
+
| `shippingcity` | text | no | `''` | — | — |
|
|
41
|
+
| `shippingregion` | text | no | `''` | — | — |
|
|
42
|
+
| `shippingcountry` | character varying(2) | no | `''` | — | — |
|
|
43
|
+
| `billingrecipient` | text | no | `''` | — | — |
|
|
44
|
+
| `billingaddress` | text | no | `''` | — | — |
|
|
45
|
+
| `billingpostalcode` | text | no | `''` | — | — |
|
|
46
|
+
| `billingcity` | text | no | `''` | — | — |
|
|
47
|
+
| `billingregion` | text | no | `''` | — | — |
|
|
48
|
+
| `billingcountry` | character varying(2) | no | `''` | — | — |
|
|
49
|
+
| `sellertaxid` | text | no | `''` | — | — |
|
|
50
|
+
| `sellername` | text | no | `''` | — | — |
|
|
51
|
+
| `selleraddress` | text | no | `''` | — | — |
|
|
52
|
+
| `sellerpostalcode` | text | no | `''` | — | — |
|
|
53
|
+
| `sellercity` | text | no | `''` | — | — |
|
|
54
|
+
| `sellerregion` | text | no | `''` | — | — |
|
|
55
|
+
| `sellercountry` | character varying(2) | no | `''` | — | — |
|
|
56
|
+
| `discount` | double precision | no | `0` | — | — |
|
|
57
|
+
| `netamount` | double precision | no | `0` | — | — |
|
|
58
|
+
| `tax` | double precision | no | `0` | — | — |
|
|
59
|
+
| `margin` | double precision | no | `0` | — | — |
|
|
60
|
+
| `weight` | double precision | no | `0` | — | — |
|
|
61
|
+
| `items` | json | yes | — | — | — |
|
|
62
|
+
|
|
63
|
+
# Foreign Keys
|
|
64
|
+
|
|
65
|
+
- `fork` → [forks](/entities/forks.md) (`forks.ID`)
|
|
66
|
+
- `ownergroup` → [groups](/entities/groups.md) (`groups.ID`)
|
|
67
|
+
- `assigneduser` → [users](/entities/users.md) (`users.ID`)
|
|
68
|
+
- `account` → [accounts](/entities/accounts.md) (`accounts.ID`)
|
|
69
|
+
- `item` → [items](/entities/items.md) (`items.ID`)
|
|
70
|
+
- `contract` → [contracts](/entities/contracts.md) (`contracts.ID`)
|
|
71
|
+
|
|
72
|
+
# Enums
|
|
73
|
+
|
|
74
|
+
### `type`
|
|
75
|
+
|
|
76
|
+
`0` = BILLING_QUOTE · `1` = BILLING_ORDER · `2` = BILLING_DELIVERY · `3` = BILLING_INVOICE · `4` = BILLING_CREDIT · `5` = PROCUREMENT_REQUEST · `6` = PROCUREMENT_ORDER · `7` = PROCUREMENT_DELIVERY · `8` = PROCUREMENT_INVOICE · `9` = PROCUREMENT_CREDIT · `10` = PRODUCTION_FABRICATION · `11` = PRODUCTION_DISASSEMBLY
|
|
77
|
+
|
|
78
|
+
### `status`
|
|
79
|
+
|
|
80
|
+
`0` = DRAFT · `1` = BOOKED · `2` = HOLD · `3` = CANCELLED · `4` = CLOSED · `5` = PARTLYORDERED · `6` = PARTLYORDERED_CANCELLED · `7` = PARTLYORDERED_CLOSED · `8` = ORDERED · `9` = PARTLYDELIVERED · `10` = PARTLYDELIVERED_CANCELLED · `11` = PARTLYDELIVERED_CLOSED · `12` = DELIVERED · `13` = PARTLYINVOICED · `14` = PARTLYINVOICED_CANCELLED · `15` = PARTLYINVOICED_CLOSED · `16` = INVOICED · `17` = PARTLYPAID · `18` = PARTLYPAID_CANCELLED · `19` = PARTLYPAID_CLOSED · `20` = PAID · `21` = OVERPAID · `22` = PROCESSED · `23` = PROCESSED_CANCELLED
|
|
81
|
+
|
|
82
|
+
### `calculation`
|
|
83
|
+
|
|
84
|
+
`0` = NET · `1` = GROSS · `2` = EXACT · `3` = LEGACY · `4` = EXTERNAL
|
|
85
|
+
|
|
86
|
+
# Indexes
|
|
87
|
+
|
|
88
|
+
- `fk_transactions_account` — btree, partial on `account`
|
|
89
|
+
- `fk_transactions_assigneduser` — gin, partial on `assigneduser`
|
|
90
|
+
- `fk_transactions_contract` — btree, partial on `contract`
|
|
91
|
+
- `fk_transactions_fork` — gin, partial on `fork`
|
|
92
|
+
- `fk_transactions_item` — btree, partial on `item`
|
|
93
|
+
- `fk_transactions_ownergroup` — gin on `ownergroup`
|
|
94
|
+
- `i_transactions_billing_date` — btree, partial on `date`
|
|
95
|
+
- `i_transactions_collection_date` — btree, partial on `date`
|
|
96
|
+
- `i_transactions_nofork` — gin, partial on `fork`
|
|
97
|
+
- `i_transactions_noowner` — gin, partial on `ownergroup`
|
|
98
|
+
- `i_transactions_procurement_date` — btree, partial on `date`
|
|
99
|
+
- `i_transactions_production_date` — btree, partial on `date`
|
|
100
|
+
- `i_transactions_transactionnum` — btree on `transactionnum`
|
|
101
|
+
- `s_transactions_transactionnum` — gin on `transactionnum`
|
|
102
|
+
- `u_transactions_transactionnum_type` — btree, unique, partial on `transactionnum, type`
|
|
103
|
+
|
|
104
|
+
> Partial/GIN indexes back the `filters` (plural) query form for foreign-key fields. See [filters-vs-filter](/concepts/filters-vs-filter.md).
|
|
105
|
+
|
|
106
|
+
# Operations
|
|
107
|
+
|
|
108
|
+
- list: `listTransactions`
|
|
109
|
+
- get: `getTransaction`
|
|
110
|
+
- create: `createTransaction`
|
|
111
|
+
- update: `updateTransaction`
|
|
112
|
+
- delete: `deleteTransaction`
|
|
113
|
+
- exists: `existsTransaction`
|
|
114
|
+
<!-- okf:generated:end -->
|
|
115
|
+
|
|
116
|
+
# Notes
|
|
117
|
+
|
|
118
|
+
NO `visibility` column — adding `"visibility":0` to a filter 400s. Use `type` 3=billing invoice, 4=billing credit. Use `netamount` for invoiced revenue; sum client-side (no server-side SUM). Use `date` for period reporting.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: ZeyOS Entity
|
|
3
|
+
title: Users
|
|
4
|
+
description: System users.
|
|
5
|
+
resource: zeyos://api/users
|
|
6
|
+
tags: [platform, generated]
|
|
7
|
+
api_backed: true
|
|
8
|
+
list_operation: listUsers
|
|
9
|
+
visibility_column: false
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<!-- okf:generated:start — rewritten by scripts/generate-okf.mjs; do not edit by hand -->
|
|
13
|
+
# Schema
|
|
14
|
+
|
|
15
|
+
| Column | Type | Nullable | Default | Indexed | FK |
|
|
16
|
+
|---|---|---|---|---|---|
|
|
17
|
+
| `ID` | integer | no | — | yes | — |
|
|
18
|
+
| `creator` | integer | yes | — | — | — |
|
|
19
|
+
| `creationdate` | bigint | no | `date_part('epoch', now())` | — | — |
|
|
20
|
+
| `lastmodified` | bigint | no | `date_part('epoch', now())` | — | — |
|
|
21
|
+
| `contact` | integer | yes | — | yes | [contacts](/entities/contacts.md) |
|
|
22
|
+
| `activity` | smallint | no | `0` | — | — |
|
|
23
|
+
| `name` | text | no | — | yes | — |
|
|
24
|
+
| `email` | text | no | — | yes | — |
|
|
25
|
+
| `nopublic` | smallint | no | `0` | — | — |
|
|
26
|
+
| `apionly` | smallint | no | `0` | — | — |
|
|
27
|
+
| `expdate` | bigint | yes | — | — | — |
|
|
28
|
+
| `password` | text | no | `''` | — | — |
|
|
29
|
+
| `resetlogintoken` | bytea | yes | — | — | — |
|
|
30
|
+
| `persistentlogintoken` | bytea | yes | — | yes | — |
|
|
31
|
+
| `signature` | bytea | yes | — | — | — |
|
|
32
|
+
| `description` | text | no | `''` | — | — |
|
|
33
|
+
| `otpsecret` | bytea | yes | — | — | — |
|
|
34
|
+
| `settings` | json | yes | — | — | — |
|
|
35
|
+
|
|
36
|
+
# Foreign Keys
|
|
37
|
+
|
|
38
|
+
- `contact` → [contacts](/entities/contacts.md) (`contacts.ID`)
|
|
39
|
+
|
|
40
|
+
# Enums
|
|
41
|
+
|
|
42
|
+
### `activity`
|
|
43
|
+
|
|
44
|
+
`0` = ACTIVE · `1` = DEACTIVATED · `2` = DELETED
|
|
45
|
+
|
|
46
|
+
# Indexes
|
|
47
|
+
|
|
48
|
+
- `fk_users_contact` — btree, partial on `contact`
|
|
49
|
+
- `s_users_email` — gin on `email`
|
|
50
|
+
- `s_users_name` — gin on `name`
|
|
51
|
+
- `u_users_email` — btree, unique on `lower(email)`
|
|
52
|
+
- `u_users_name` — btree, unique on `lower(name)`
|
|
53
|
+
- `u_users_persistentlogintoken` — btree, unique, partial on `persistentlogintoken`
|
|
54
|
+
|
|
55
|
+
> Partial/GIN indexes back the `filters` (plural) query form for foreign-key fields. See [filters-vs-filter](/concepts/filters-vs-filter.md).
|
|
56
|
+
|
|
57
|
+
# Operations
|
|
58
|
+
|
|
59
|
+
- list: `listUsers`
|
|
60
|
+
- get: `getUser`
|
|
61
|
+
- exists: `existsUser`
|
|
62
|
+
<!-- okf:generated:end -->
|
|
63
|
+
|
|
64
|
+
# Notes
|
|
65
|
+
|
|
66
|
+
Resolve assignees/ownership here; user names may not match contact names.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: ZeyOS Entity
|
|
3
|
+
title: Weblets
|
|
4
|
+
description: UI modules with view/type metadata.
|
|
5
|
+
resource: zeyos://api/weblets
|
|
6
|
+
tags: [platform, generated]
|
|
7
|
+
api_backed: true
|
|
8
|
+
list_operation: listWeblets
|
|
9
|
+
visibility_column: false
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<!-- okf:generated:start — rewritten by scripts/generate-okf.mjs; do not edit by hand -->
|
|
13
|
+
# Schema
|
|
14
|
+
|
|
15
|
+
| Column | Type | Nullable | Default | Indexed | FK |
|
|
16
|
+
|---|---|---|---|---|---|
|
|
17
|
+
| `ID` | integer | no | — | yes | — |
|
|
18
|
+
| `creator` | integer | yes | — | — | — |
|
|
19
|
+
| `creationdate` | bigint | no | `date_part('epoch', now())` | — | — |
|
|
20
|
+
| `lastmodified` | bigint | no | `date_part('epoch', now())` | — | — |
|
|
21
|
+
| `application` | integer | yes | — | yes | [applications](/entities/applications.md) |
|
|
22
|
+
| `activity` | smallint | no | `0` | — | — |
|
|
23
|
+
| `name` | text | no | — | yes | — |
|
|
24
|
+
| `identifier` | character varying(200) | no | — | yes | — |
|
|
25
|
+
| `view` | text | no | `''` | — | — |
|
|
26
|
+
| `type` | smallint | no | `0` | — | — |
|
|
27
|
+
| `width` | smallint | no | `0` | — | — |
|
|
28
|
+
| `height` | smallint | no | `0` | — | — |
|
|
29
|
+
| `svgpath` | text | no | `''` | — | — |
|
|
30
|
+
| `color` | character varying(6) | no | `''` | — | — |
|
|
31
|
+
| `mimetype` | text | no | `'text/x-zymba'` | — | — |
|
|
32
|
+
| `langaliases` | json | yes | — | — | — |
|
|
33
|
+
| `binfile` | integer | yes | — | yes | [binfiles](/entities/binfiles.md) |
|
|
34
|
+
| `url` | text | no | `''` | — | — |
|
|
35
|
+
|
|
36
|
+
# Foreign Keys
|
|
37
|
+
|
|
38
|
+
- `application` → [applications](/entities/applications.md) (`applications.ID`)
|
|
39
|
+
- `binfile` → [binfiles](/entities/binfiles.md) (`binfiles.ID`)
|
|
40
|
+
|
|
41
|
+
# Enums
|
|
42
|
+
|
|
43
|
+
### `activity`
|
|
44
|
+
|
|
45
|
+
`0` = ACTIVE · `1` = DEACTIVATED · `2` = DELETED
|
|
46
|
+
|
|
47
|
+
### `type`
|
|
48
|
+
|
|
49
|
+
`0` = INTEGRATED · `1` = STANDALONE · `2` = DETACHED · `3` = POPUP_FRAMED · `4` = POPUP_PLAIN · `5` = EMBEDDED_FRAMED · `6` = EMBEDDED_COLLAPSED · `7` = EMBEDDED_PLAIN
|
|
50
|
+
|
|
51
|
+
# Indexes
|
|
52
|
+
|
|
53
|
+
- `fk_weblets_application` — gin, partial on `application`
|
|
54
|
+
- `fk_weblets_binfile` — btree, partial on `binfile`
|
|
55
|
+
- `s_weblets_identifier` — gin on `identifier`
|
|
56
|
+
- `s_weblets_name` — gin on `name`
|
|
57
|
+
- `u_weblets_identifier` — btree, unique on `identifier`
|
|
58
|
+
|
|
59
|
+
> Partial/GIN indexes back the `filters` (plural) query form for foreign-key fields. See [filters-vs-filter](/concepts/filters-vs-filter.md).
|
|
60
|
+
|
|
61
|
+
# Operations
|
|
62
|
+
|
|
63
|
+
- list: `listWeblets`
|
|
64
|
+
- get: `getWeblet`
|
|
65
|
+
- exists: `existsWeblet`
|
|
66
|
+
<!-- okf:generated:end -->
|
package/okf/index.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
okf_version: 0.1
|
|
3
|
+
source_snapshot: 19d7df6ae9aa
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ZeyOS Knowledge Bundle
|
|
7
|
+
|
|
8
|
+
* [Entities](entities/) - 64 API-backed entity concepts (schema, foreign keys, enums, indexes, operations).
|
|
9
|
+
* [Metrics](metrics/) - Business metric definitions.
|
|
10
|
+
* [Playbooks](playbooks/) - Step-by-step query workflows.
|
|
11
|
+
* [Concepts](concepts/) - Cross-cutting query rules and footguns.
|
package/okf/log.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Metric
|
|
3
|
+
title: Cash Received
|
|
4
|
+
description: "Cash collected (settlement basis) over a date window."
|
|
5
|
+
tags: [billing, payments]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**Definition.** Sum of `amount` over [payments](/entities/payments.md) with `date` in the window. This is cash basis — distinct from [invoiced-net-revenue](/metrics/invoiced-net-revenue.md) (accrual/billed basis).
|
|
9
|
+
|
|
10
|
+
Separate direct account payments from transaction-linked payments if the answer needs it. Sum client-side; there is no server-side SUM.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Metrics
|
|
2
|
+
|
|
3
|
+
* [Cash Received](cash-received.md) - Cash collected (settlement basis) over a date window.
|
|
4
|
+
* [Invoiced Net Revenue](invoiced-net-revenue.md) - Net invoiced revenue from billing invoices over a date window.
|
|
5
|
+
* [Open Customers](open-customers.md) - Count of active customer accounts.
|
|
6
|
+
* [Overdue Receivables](overdue-receivables.md) - Receivables in collection, via dunning — not from transactions alone.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Metric
|
|
3
|
+
title: Invoiced Net Revenue
|
|
4
|
+
description: "Net invoiced revenue from billing invoices over a date window."
|
|
5
|
+
tags: [billing, revenue]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**Definition.** Sum of `netamount` over [transactions](/entities/transactions.md) where `type = 3` (billing invoice) and `date` falls in the window. For *net after credits*, also sum `type = 4` (billing credit) and subtract.
|
|
9
|
+
|
|
10
|
+
**Why `date`, not `lastmodified`.** `date` is the business-effective invoice date; `lastmodified` is change tracking. See [dates-unix-seconds](/concepts/dates-unix-seconds.md).
|
|
11
|
+
|
|
12
|
+
**No server-side SUM.** `list` the matching rows (high `--limit`, up to 10000) with `netamount` and add them up client-side. See [counting-and-sums](/concepts/counting-and-sums.md).
|
|
13
|
+
|
|
14
|
+
**Do not** add `"visibility":0` — `transactions` has no such column and it 400s. See [visibility-column](/concepts/visibility-column.md).
|
|
15
|
+
|
|
16
|
+
Related playbook: [revenue-this-year](/playbooks/revenue-this-year.md).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Metric
|
|
3
|
+
title: Open Customers
|
|
4
|
+
description: "Count of active customer accounts."
|
|
5
|
+
tags: [crm]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**Definition.** Count of [accounts](/entities/accounts.md) where `type = 1` (CUSTOMER), excluding archived (`visibility = 0`).
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
zeyos count accounts --filter '{"type":1,"visibility":0}'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Count server-side (`count`), never `list` + row length. See [counting-and-sums](/concepts/counting-and-sums.md). State the definition you used ("customer = type 1, excluding archived").
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Metric
|
|
3
|
+
title: Overdue Receivables
|
|
4
|
+
description: "Receivables in collection, via dunning — not from transactions alone."
|
|
5
|
+
tags: [collections]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**Definition.** Overdue/in-collection exposure is tracked through [dunning](/entities/dunning.md) notices and the [dunning2transactions](/entities/dunning2transactions.md) junction, not inferred from [transactions](/entities/transactions.md) alone.
|
|
9
|
+
|
|
10
|
+
**operationId trap.** Use `listDunningNotices` / `getDunningNotice` and `listDunningToTransactions`. See [operationid-vocabulary](/concepts/operationid-vocabulary.md).
|
|
11
|
+
|
|
12
|
+
Separate invoice exposure (the receivable) from collection stage and next action.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Playbook
|
|
3
|
+
title: Customer 360
|
|
4
|
+
description: "Assemble a cross-domain summary for one customer."
|
|
5
|
+
tags: [crm]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
1. Resolve the account first ([accounts](/entities/accounts.md) by `customernum`/`lastname`).
|
|
9
|
+
2. Open work: [tickets](/entities/tickets.md) for the account.
|
|
10
|
+
3. Billing: [transactions](/entities/transactions.md) (invoices/credits) and [payments](/entities/payments.md).
|
|
11
|
+
4. Mail: resolve [contacts](/entities/contacts.md) email, then [messages](/entities/messages.md) (no direct account FK — see the entity note).
|
|
12
|
+
5. Present facts and inference separately; state interpretations.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Playbooks
|
|
2
|
+
|
|
3
|
+
* [Customer 360](customer-360.md) - Assemble a cross-domain summary for one customer.
|
|
4
|
+
* [Revenue This Year](revenue-this-year.md) - Answer "what have we invoiced/collected this year?" end to end.
|
|
5
|
+
* [Ticket Work Packet](ticket-work-packet.md) - Trace a ticket down to its tasks and follow-ups.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Playbook
|
|
3
|
+
title: Revenue This Year
|
|
4
|
+
description: "Answer \"what have we invoiced/collected this year?\" end to end."
|
|
5
|
+
tags: [billing]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
1. Decide invoiced revenue vs cash received. If unspecified, state you are using invoiced net revenue ([invoiced-net-revenue](/metrics/invoiced-net-revenue.md)).
|
|
9
|
+
2. Normalize the window to Unix **seconds** (e.g. 2026-01-01 = 1767225600). See [dates-unix-seconds](/concepts/dates-unix-seconds.md).
|
|
10
|
+
3. `list` billing invoices ([transactions](/entities/transactions.md) `type = 3`) in the window with `netamount`; high `--limit`.
|
|
11
|
+
4. If net-after-credits, `list` `type = 4` and subtract.
|
|
12
|
+
5. Sum client-side and report the figure (do not describe the plan — run it).
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
zeyos list transactions \
|
|
16
|
+
--filter '{"type":3,"date":{">=":1767225600,"<":1798761600}}' \
|
|
17
|
+
--fields ID,transactionnum,date,netamount --limit 10000 --json \
|
|
18
|
+
| python3 -c 'import sys,json; r=json.load(sys.stdin); print(sum(x.get("netamount",0) for x in r.get("data",r)))'
|
|
19
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: Playbook
|
|
3
|
+
title: Ticket Work Packet
|
|
4
|
+
description: "Trace a ticket down to its tasks and follow-ups."
|
|
5
|
+
tags: [work]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
1. Resolve the [ticket](/entities/tickets.md) (`ticketnum`/`name`).
|
|
9
|
+
2. [tasks](/entities/tasks.md) where `ticket` = that ID (use the `filters` form for the FK — see [filters-vs-filter](/concepts/filters-vs-filter.md)).
|
|
10
|
+
3. [actionsteps](/entities/actionsteps.md) bound to the ticket/its tasks for smaller follow-ups.
|
|
11
|
+
4. Summarize open vs closed (closed ticket = `status` IN [9, 11]).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeyos/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Dependency-light JavaScript client for ZeyOS OpenAPI services",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,8 +29,12 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"src",
|
|
31
31
|
"scripts/generate-client.mjs",
|
|
32
|
+
"scripts/generate-okf.mjs",
|
|
33
|
+
"scripts/lib",
|
|
34
|
+
"scripts/data",
|
|
32
35
|
"openapi",
|
|
33
36
|
"docs",
|
|
37
|
+
"okf",
|
|
34
38
|
"samples/crm",
|
|
35
39
|
"samples/dashboard",
|
|
36
40
|
"samples/kanban",
|
|
@@ -43,7 +47,10 @@
|
|
|
43
47
|
"node": ">=18"
|
|
44
48
|
},
|
|
45
49
|
"scripts": {
|
|
46
|
-
"generate": "node scripts/generate-client.mjs",
|
|
50
|
+
"generate": "node scripts/generate-client.mjs && node scripts/generate-okf.mjs",
|
|
51
|
+
"okf:build": "node scripts/generate-okf.mjs",
|
|
52
|
+
"okf:check": "node --test test/okf.test.js",
|
|
53
|
+
"okf:refine": "node test/agent-protocol/harness/refine-okf.mjs",
|
|
47
54
|
"test": "node scripts/test.mjs",
|
|
48
55
|
"test:cli-integration": "node --test cli/test/integration.mjs",
|
|
49
56
|
"test:agent-protocol": "node test/agent-protocol/harness/run.mjs",
|