@wirecat/amo-cli 0.5.0 → 0.7.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 +33 -0
- package/README.md +2 -2
- package/contracts/wirecat.json +14 -0
- package/dist/amo/button.js +1 -1
- package/dist/amo/json.js +1 -1
- package/dist/amo/oauth.js +3 -5
- package/dist/amo/transport.js +3 -7
- package/dist/api-keys.js +1 -1
- package/dist/bin/amo.js +11 -11
- package/dist/bundle/amo.js +5 -183
- package/dist/bundle/{chunk-3PYE55JY.js → chunk-3HWD4BKU.js} +4 -6
- package/dist/bundle/{chunk-M6VZXAJC.js → chunk-4EXURQQQ.js} +21 -19
- package/dist/bundle/chunk-AEWYRB6F.js +8 -0
- package/dist/bundle/{chunk-WUFX4TKA.js → chunk-GL7CRTHR.js} +3 -3
- package/dist/bundle/chunk-N2UB32VN.js +76 -0
- package/dist/bundle/{chunk-KZ2FIDI3.js → chunk-PVVSHDMQ.js} +7 -15
- package/dist/bundle/program-SQH3SPOW.js +2352 -0
- package/dist/bundle/{instructions-AMH5RWVJ.js → source-C65ZJUTW.js} +5 -6
- package/dist/bundle/store-SJ2TOUGU.js +12 -0
- package/dist/bundle/writer-I7GBI3VE.js +12 -0
- package/dist/commands/account.js +1 -1
- package/dist/commands/api.js +1 -3
- package/dist/commands/crm-shared.js +2 -3
- package/dist/commands/schedule.js +1 -1
- package/dist/commands/session.js +1 -8
- package/dist/commands/write.js +1 -2
- package/dist/config.js +1 -2
- package/dist/context.js +1 -2
- package/dist/crm/activities.js +1 -1
- package/dist/crm/records.js +1 -1
- package/dist/crm/source.js +1 -1
- package/dist/crm/writer.js +1 -1
- package/dist/identity.js +4 -0
- package/dist/program.js +1 -2
- package/dist/setup/flow.js +1 -1
- package/dist/store.js +1 -1
- package/dist/version.js +1 -1
- package/dist/whoami.js +1 -1
- package/package.json +3 -3
- package/scenarios/first-sync.md +13 -11
- package/scenarios/keep-in-sync.md +7 -6
- package/scenarios/safe-agent-writes.md +10 -9
- package/dist/amo/account.d.ts +0 -18
- package/dist/amo/account.d.ts.map +0 -1
- package/dist/amo/account.js.map +0 -1
- package/dist/amo/allow-list.d.ts +0 -31
- package/dist/amo/allow-list.d.ts.map +0 -1
- package/dist/amo/allow-list.js.map +0 -1
- package/dist/amo/button.d.ts +0 -53
- package/dist/amo/button.d.ts.map +0 -1
- package/dist/amo/button.js.map +0 -1
- package/dist/amo/errors.d.ts +0 -12
- package/dist/amo/errors.d.ts.map +0 -1
- package/dist/amo/errors.js.map +0 -1
- package/dist/amo/json.d.ts +0 -3
- package/dist/amo/json.d.ts.map +0 -1
- package/dist/amo/json.js.map +0 -1
- package/dist/amo/oauth.d.ts +0 -64
- package/dist/amo/oauth.d.ts.map +0 -1
- package/dist/amo/oauth.js.map +0 -1
- package/dist/amo/operation.d.ts +0 -45
- package/dist/amo/operation.d.ts.map +0 -1
- package/dist/amo/operation.js.map +0 -1
- package/dist/amo/operations.d.ts +0 -3
- package/dist/amo/operations.d.ts.map +0 -1
- package/dist/amo/operations.js.map +0 -1
- package/dist/amo/routes.d.ts +0 -67
- package/dist/amo/routes.d.ts.map +0 -1
- package/dist/amo/routes.js.map +0 -1
- package/dist/amo/transport.d.ts +0 -62
- package/dist/amo/transport.d.ts.map +0 -1
- package/dist/amo/transport.js.map +0 -1
- package/dist/api-keys.d.ts +0 -47
- package/dist/api-keys.d.ts.map +0 -1
- package/dist/api-keys.js.map +0 -1
- package/dist/bin/amo.d.ts +0 -3
- package/dist/bin/amo.d.ts.map +0 -1
- package/dist/bin/amo.js.map +0 -1
- package/dist/bundle/agent-EFMUK732.js +0 -41
- package/dist/bundle/all-profiles-PIWUQWBA.js +0 -320
- package/dist/bundle/anthropic-47CMXBPQ.js +0 -90
- package/dist/bundle/app-server-QRBQODF2.js +0 -257
- package/dist/bundle/areas-QVHVU57Z.js +0 -63
- package/dist/bundle/bun-OPDGMZZQ.js +0 -169
- package/dist/bundle/bun-sqlite-7I4X7CZW.js +0 -75
- package/dist/bundle/chunk-2JHVQMVC.js +0 -16
- package/dist/bundle/chunk-2XBDILVW.js +0 -53
- package/dist/bundle/chunk-3DEQUYEG.js +0 -185
- package/dist/bundle/chunk-3GX6KM2E.js +0 -5302
- package/dist/bundle/chunk-3HC5F3P7.js +0 -24
- package/dist/bundle/chunk-3YM4B2GT.js +0 -63
- package/dist/bundle/chunk-43OW5NTG.js +0 -338
- package/dist/bundle/chunk-43PMSR33.js +0 -357
- package/dist/bundle/chunk-4N7PP76S.js +0 -6848
- package/dist/bundle/chunk-4VN7RI4I.js +0 -1718
- package/dist/bundle/chunk-57HFPNMF.js +0 -189
- package/dist/bundle/chunk-5UTB3ADZ.js +0 -360
- package/dist/bundle/chunk-633NQY2R.js +0 -80
- package/dist/bundle/chunk-63N46DJU.js +0 -12278
- package/dist/bundle/chunk-6D4VWSJD.js +0 -259
- package/dist/bundle/chunk-6JTHXWPE.js +0 -64
- package/dist/bundle/chunk-6QGUK3H7.js +0 -161
- package/dist/bundle/chunk-6WS6GJ4V.js +0 -30
- package/dist/bundle/chunk-7IR2G5XY.js +0 -559
- package/dist/bundle/chunk-7IWIFVXH.js +0 -52
- package/dist/bundle/chunk-ABX7BBS4.js +0 -388
- package/dist/bundle/chunk-ADLS6FVG.js +0 -24600
- package/dist/bundle/chunk-ADTI5RUO.js +0 -1007
- package/dist/bundle/chunk-AKRIUNYP.js +0 -1197
- package/dist/bundle/chunk-BIKOE2IW.js +0 -614
- package/dist/bundle/chunk-BVVMIAQ6.js +0 -37727
- package/dist/bundle/chunk-CGW5R4UD.js +0 -362
- package/dist/bundle/chunk-D4NE7EON.js +0 -170
- package/dist/bundle/chunk-D72URWJE.js +0 -532
- package/dist/bundle/chunk-DFDN6AUB.js +0 -21
- package/dist/bundle/chunk-DNCLQPOM.js +0 -7
- package/dist/bundle/chunk-DPV53EZC.js +0 -206
- package/dist/bundle/chunk-DQ6S5TFZ.js +0 -9539
- package/dist/bundle/chunk-DSJ6EAOA.js +0 -4172
- package/dist/bundle/chunk-DVZ75WZJ.js +0 -3752
- package/dist/bundle/chunk-EH6ZEJGT.js +0 -932
- package/dist/bundle/chunk-EHK73OSW.js +0 -2017
- package/dist/bundle/chunk-FNV5HLHX.js +0 -1068
- package/dist/bundle/chunk-FV4GQNIK.js +0 -136
- package/dist/bundle/chunk-G2TU5RYY.js +0 -332
- package/dist/bundle/chunk-GDK7ETSB.js +0 -218
- package/dist/bundle/chunk-GGMAIIVE.js +0 -38
- package/dist/bundle/chunk-GLYWZQY4.js +0 -86
- package/dist/bundle/chunk-H4AFNENN.js +0 -1343
- package/dist/bundle/chunk-HOF7GQWW.js +0 -142
- package/dist/bundle/chunk-HSPEU6S7.js +0 -209
- package/dist/bundle/chunk-IA7LLLEI.js +0 -100
- package/dist/bundle/chunk-IB55P46L.js +0 -334
- package/dist/bundle/chunk-IG2TJQJ7.js +0 -79
- package/dist/bundle/chunk-JG6LCSEX.js +0 -407
- package/dist/bundle/chunk-JLXXUEAM.js +0 -72
- package/dist/bundle/chunk-JXT6GY4V.js +0 -1023
- package/dist/bundle/chunk-K7YY6SXR.js +0 -738
- package/dist/bundle/chunk-KEKXERBE.js +0 -67181
- package/dist/bundle/chunk-KZN2BG3P.js +0 -721
- package/dist/bundle/chunk-LKH3UKLO.js +0 -230
- package/dist/bundle/chunk-LZPKBN3C.js +0 -193
- package/dist/bundle/chunk-MDEPJZYJ.js +0 -106
- package/dist/bundle/chunk-NB7EOAUZ.js +0 -123
- package/dist/bundle/chunk-NISH4UXM.js +0 -58
- package/dist/bundle/chunk-NSKMNIY6.js +0 -460
- package/dist/bundle/chunk-PL5P7UKW.js +0 -25216
- package/dist/bundle/chunk-PPSAWFJD.js +0 -1293
- package/dist/bundle/chunk-Q7ICVP25.js +0 -18
- package/dist/bundle/chunk-QFOP3KUP.js +0 -2603
- package/dist/bundle/chunk-R53XXHEI.js +0 -76
- package/dist/bundle/chunk-RIMPFMZE.js +0 -1251
- package/dist/bundle/chunk-RN6RT5CB.js +0 -58
- package/dist/bundle/chunk-RRTMPSQR.js +0 -29
- package/dist/bundle/chunk-S4ZHQMNM.js +0 -133
- package/dist/bundle/chunk-S6JG4YUH.js +0 -72
- package/dist/bundle/chunk-TAVI73RW.js +0 -288
- package/dist/bundle/chunk-TLG6ECZ2.js +0 -54
- package/dist/bundle/chunk-TXDR6YSF.js +0 -23
- package/dist/bundle/chunk-TY7NDMFY.js +0 -46
- package/dist/bundle/chunk-U5RJJ2EC.js +0 -353
- package/dist/bundle/chunk-UDSL3MUU.js +0 -2333
- package/dist/bundle/chunk-V2CNGXWX.js +0 -798
- package/dist/bundle/chunk-VB7FZOYX.js +0 -633
- package/dist/bundle/chunk-VZ5PPYDG.js +0 -77
- package/dist/bundle/chunk-W5JRXIG6.js +0 -27995
- package/dist/bundle/chunk-WIHN3ELW.js +0 -2793
- package/dist/bundle/chunk-WOPVBRPV.js +0 -29
- package/dist/bundle/chunk-WXJYMMEL.js +0 -95
- package/dist/bundle/chunk-XCCU2E3Z.js +0 -274
- package/dist/bundle/chunk-XEQQJBBO.js +0 -92
- package/dist/bundle/chunk-XUT7DSM5.js +0 -108
- package/dist/bundle/chunk-Y5E2WNWB.js +0 -35
- package/dist/bundle/chunk-YWDFYQOU.js +0 -82
- package/dist/bundle/chunk-ZLUIRFJX.js +0 -780
- package/dist/bundle/chunk-ZVVMGPBJ.js +0 -50
- package/dist/bundle/cli-3NXOSENF.js +0 -1239
- package/dist/bundle/command-contract-LNSAV5LA.js +0 -39
- package/dist/bundle/command-server-entry-4ZQPNUL4.js +0 -168
- package/dist/bundle/decode-K7U7X5EL.js +0 -296
- package/dist/bundle/dispatch-56FECRCU.js +0 -411
- package/dist/bundle/dist-PAKDDIBT.js +0 -191
- package/dist/bundle/dist-T54K3FJV.js +0 -7577
- package/dist/bundle/echarts-O3TNDAXJ.js +0 -42501
- package/dist/bundle/embed-SWLVG73O.js +0 -37
- package/dist/bundle/embedder-EJN75BPV.js +0 -110
- package/dist/bundle/failure-WDSX6H3B.js +0 -24
- package/dist/bundle/first-run-WPGUUC4Z.js +0 -28
- package/dist/bundle/first-screen-JMNEUQ46.js +0 -40
- package/dist/bundle/mcp-5HFPWC3W.js +0 -167
- package/dist/bundle/meeting-combined-5TKG2RYD.js +0 -24
- package/dist/bundle/meeting-model-YXXNETKC.js +0 -24
- package/dist/bundle/meeting-semantic-U7EUB3ET.js +0 -21
- package/dist/bundle/node-EGMCBAO7.js +0 -176
- package/dist/bundle/node-P4E63KXA.js +0 -2340
- package/dist/bundle/node-TLZSIHIJ.js +0 -21
- package/dist/bundle/node-sqlite-YVOGMDSP.js +0 -73
- package/dist/bundle/oauth-2SNRBIJM.js +0 -19
- package/dist/bundle/open-ABCPY5IH.js +0 -22
- package/dist/bundle/openai-4D6PXJR7.js +0 -237
- package/dist/bundle/process-SGHEN6MQ.js +0 -91
- package/dist/bundle/program-CBDQBZZ3.js +0 -4971
- package/dist/bundle/prompt-2QUK5QST.js +0 -16
- package/dist/bundle/recognize-QMQSJRIH.js +0 -25
- package/dist/bundle/remote-U7TC2BLZ.js +0 -30
- package/dist/bundle/rerank-5UPVXGVV.js +0 -51
- package/dist/bundle/serve-VX6GUM6J.js +0 -198
- package/dist/bundle/server-FOPC6DJ3.js +0 -219
- package/dist/bundle/server-OIVNOMVK.js +0 -87
- package/dist/bundle/source-HWS5SJIV.js +0 -46
- package/dist/bundle/sqlite-runtime-77NKDEXN.js +0 -19
- package/dist/bundle/state-X2HU6GB2.js +0 -35
- package/dist/bundle/store-2U4U6KL4.js +0 -184
- package/dist/bundle/store-3CHPHFP7.js +0 -301
- package/dist/bundle/store-Z3747L5F.js +0 -34
- package/dist/bundle/store-maintenance-command-UOSZJTVP.js +0 -74
- package/dist/bundle/surface-MUT72QON.js +0 -73
- package/dist/bundle/writer-RBKQ64ZM.js +0 -48
- package/dist/commands/account.d.ts +0 -4
- package/dist/commands/account.d.ts.map +0 -1
- package/dist/commands/account.js.map +0 -1
- package/dist/commands/api.d.ts +0 -3
- package/dist/commands/api.d.ts.map +0 -1
- package/dist/commands/api.js.map +0 -1
- package/dist/commands/crm-shared.d.ts +0 -8
- package/dist/commands/crm-shared.d.ts.map +0 -1
- package/dist/commands/crm-shared.js.map +0 -1
- package/dist/commands/schedule.d.ts +0 -3
- package/dist/commands/schedule.d.ts.map +0 -1
- package/dist/commands/schedule.js.map +0 -1
- package/dist/commands/session.d.ts +0 -35
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/write.d.ts +0 -14
- package/dist/commands/write.d.ts.map +0 -1
- package/dist/commands/write.js.map +0 -1
- package/dist/config.d.ts +0 -4
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context.d.ts +0 -62
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/crm/activities.d.ts +0 -32
- package/dist/crm/activities.d.ts.map +0 -1
- package/dist/crm/activities.js.map +0 -1
- package/dist/crm/records.d.ts +0 -20
- package/dist/crm/records.d.ts.map +0 -1
- package/dist/crm/records.js.map +0 -1
- package/dist/crm/source.d.ts +0 -41
- package/dist/crm/source.d.ts.map +0 -1
- package/dist/crm/source.js.map +0 -1
- package/dist/crm/writer.d.ts +0 -14
- package/dist/crm/writer.d.ts.map +0 -1
- package/dist/crm/writer.js.map +0 -1
- package/dist/identity.d.ts +0 -7
- package/dist/identity.d.ts.map +0 -1
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/program.d.ts +0 -6
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js.map +0 -1
- package/dist/reasons.d.ts +0 -10
- package/dist/reasons.d.ts.map +0 -1
- package/dist/reasons.js.map +0 -1
- package/dist/setup/flow.d.ts +0 -2
- package/dist/setup/flow.d.ts.map +0 -1
- package/dist/setup/flow.js.map +0 -1
- package/dist/store.d.ts +0 -15
- package/dist/store.d.ts.map +0 -1
- package/dist/store.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/wcat.d.ts +0 -3
- package/dist/wcat.d.ts.map +0 -1
- package/dist/wcat.js.map +0 -1
- package/dist/whoami.d.ts +0 -24
- package/dist/whoami.d.ts.map +0 -1
- package/dist/whoami.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to `@wirecat/amo-cli`. One section per version, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.7.0 — 28.11.2026
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **WireCat Desktop reads amo's sign-in and MCP port from amo itself.** The manifest (`amo --wcat-describe`) now names
|
|
10
|
+
the MCP server's port, 8761, and the sign-in Desktop runs: a long-lived token, typed on stdin. Built on
|
|
11
|
+
`@wirecat/cli-base` 1.2.0.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- `amo guide` puts the example profile `work` in every step, so a step runs as you copy it. The first-sync scenario
|
|
16
|
+
names the one-click sign-in beside the token.
|
|
17
|
+
- The guides say that an amoCRM administrator signs in with one click, and that the list of colleagues whose deals a
|
|
18
|
+
sync copies replaces your own.
|
|
19
|
+
- amo's package is smaller: it no longer carries its own copy of cli-core. Built on @wirecat/cli-core 3.0.0 and
|
|
20
|
+
@wirecat/cli-base 2.1.1. Needed for the WireCat store version 79 (memo became wcat).
|
|
21
|
+
|
|
22
|
+
## 0.6.0 — 27.11.2026
|
|
23
|
+
|
|
24
|
+
### Changed — may break callers
|
|
25
|
+
|
|
26
|
+
- **amo is built on cli-core 2.0.0.** After its first run the store is at version 78, and only tools on cli-core 2.0
|
|
27
|
+
open it: upgrade every WireCat CLI and WireCat Desktop on this computer together, and stop `serve`, `mcp` and syncs
|
|
28
|
+
while it migrates. The migration keeps a rollback copy first. In `--json`, an agent that wrote a deal's task or
|
|
29
|
+
note is `type: "agent"` where it was `"bot"`, and a sender bot ref is `bot:<id>` where it was `sender-bot:<id>`.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- **A store another process holds is `store.busy`, not a crash** (`@wirecat/cli-core` 1.3.0). When a scheduled sync
|
|
34
|
+
of one profile kept the write lock, a second run failed with SQLite's raw `database is locked` as a bug. It now
|
|
35
|
+
answers `conflict` (exit 15) with the reason `store.busy`.
|
|
36
|
+
- The first help screen names `amo session list` (cli-core 1.3.0).
|
|
37
|
+
|
|
5
38
|
## 0.5.0 — 25.11.2026
|
|
6
39
|
|
|
7
40
|
### Added
|
package/README.md
CHANGED
|
@@ -89,7 +89,7 @@ amo work deals list status:open
|
|
|
89
89
|
and none is ever assumed. `amo work setup` asks for the account's address. An administrator of an amoCRM account then
|
|
90
90
|
clicks **Sign in with amoCRM** and allows access in the browser. Otherwise it shows each click to make a private
|
|
91
91
|
integration and its long-lived token, checks them against the account and keeps the token in the system keyring. A
|
|
92
|
-
sync copies the deals assigned to the user
|
|
92
|
+
sync copies the deals assigned to the user who signed in. To copy a colleague's too, see
|
|
93
93
|
[which deals sync copies](https://github.com/WireCatLabs/amo-cli/blob/main/docs/configuration.md#which-deals-sync-copies).
|
|
94
94
|
|
|
95
95
|
You need Node.js 22.16 or a later 22.x, or Node.js 24 or later. `amo doctor` needs no network and shows what is set
|
|
@@ -219,7 +219,7 @@ More: [permissions](https://github.com/WireCatLabs/amo-cli/blob/main/docs/permis
|
|
|
219
219
|
- `amo` is tested against a fake account built from the Kommo API reference, and each release passes a check on a
|
|
220
220
|
live test account: it syncs, reads, and creates, moves and closes a deal.
|
|
221
221
|
- amoCRM's API v4 has no call that deletes a deal, so there is no `deals delete`. Close the deal as lost instead.
|
|
222
|
-
- Files on deals and contacts are not
|
|
222
|
+
- Files on deals and contacts are not available.
|
|
223
223
|
- Without amoCRM's paid API filter add-on, `sync` reads a contact or company one request at a time, and a live list
|
|
224
224
|
of contacts or companies cannot be narrowed by owner or time. A search by words still works.
|
|
225
225
|
- The Chats API, Drive and amoCRM's AI agent API live on other hosts, and `amo` does not reach them.
|
package/contracts/wirecat.json
CHANGED
|
@@ -1260,6 +1260,19 @@
|
|
|
1260
1260
|
"signIn": {
|
|
1261
1261
|
"gives": "Lets your agent read and change the account's CRM with the rights of the administrator who made the token, or of the user who signed in through your own integration.",
|
|
1262
1262
|
"asks": "The account's address and a long-lived token from a private integration's Keys and scopes tab, or that integration's ID and secret key.",
|
|
1263
|
+
"methods": [
|
|
1264
|
+
{
|
|
1265
|
+
"id": "token",
|
|
1266
|
+
"label": "Long-lived token",
|
|
1267
|
+
"words": [
|
|
1268
|
+
"{profile}",
|
|
1269
|
+
"session",
|
|
1270
|
+
"start",
|
|
1271
|
+
"--json"
|
|
1272
|
+
],
|
|
1273
|
+
"stdin": true
|
|
1274
|
+
}
|
|
1275
|
+
],
|
|
1263
1276
|
"setupFrom": "0.0.0"
|
|
1264
1277
|
},
|
|
1265
1278
|
"skill": {
|
|
@@ -1284,6 +1297,7 @@
|
|
|
1284
1297
|
]
|
|
1285
1298
|
},
|
|
1286
1299
|
"mcpServer": {
|
|
1300
|
+
"port": 8761,
|
|
1287
1301
|
"start": [
|
|
1288
1302
|
"mcp",
|
|
1289
1303
|
"server",
|
package/dist/amo/button.js
CHANGED
|
@@ -2,7 +2,7 @@ import { randomBytes } from "node:crypto";
|
|
|
2
2
|
import { createServer } from "node:http";
|
|
3
3
|
import { CliError, isCliError } from "@wirecat/cli-base";
|
|
4
4
|
import { hostFetch } from "@wirecat/cli-base/http";
|
|
5
|
-
import { tokenKeeper } from "@wirecat/cli-core
|
|
5
|
+
import { tokenKeeper } from "@wirecat/cli-core";
|
|
6
6
|
import { IDENTITY } from "../identity.js";
|
|
7
7
|
import { isRecord } from "./json.js";
|
|
8
8
|
import { appProvider, appStorage, BUTTON_RELAY_URL, CLAIM_URL, CONNECT_PAGE_URL, fetchFor, lockDirOf, } from "./oauth.js";
|
package/dist/amo/json.js
CHANGED
package/dist/amo/oauth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliError, Credentials, isMovedRun, resolvePaths, systemKeyring, } from "@wirecat/cli-base";
|
|
2
2
|
import { hostFetch } from "@wirecat/cli-base/http";
|
|
3
|
-
import { accountTokenCodec, credentialStorage, oauthAccount, tokenKeeper, } from "@wirecat/cli-core
|
|
3
|
+
import { accountTokenCodec, credentialStorage, oauthAccount, timeLimit, tokenKeeper, } from "@wirecat/cli-core";
|
|
4
4
|
import { IDENTITY } from "../identity.js";
|
|
5
5
|
import { accountOrigin } from "./account.js";
|
|
6
6
|
import { isRecord } from "./json.js";
|
|
@@ -90,9 +90,7 @@ const exchange = async (origin, redirectUri, params, context) => {
|
|
|
90
90
|
...(refresh ? { refresh_token: params.refresh_token ?? "" } : { code: params.code ?? "" }),
|
|
91
91
|
redirect_uri: redirectUri,
|
|
92
92
|
};
|
|
93
|
-
const deadline =
|
|
94
|
-
const timer = setTimeout(() => deadline.abort(), REQUEST_MS);
|
|
95
|
-
timer.unref();
|
|
93
|
+
const deadline = timeLimit(REQUEST_MS);
|
|
96
94
|
const signal = context.signal ? AbortSignal.any([context.signal, deadline.signal]) : deadline.signal;
|
|
97
95
|
try {
|
|
98
96
|
let response;
|
|
@@ -135,7 +133,7 @@ const exchange = async (origin, redirectUri, params, context) => {
|
|
|
135
133
|
};
|
|
136
134
|
}
|
|
137
135
|
finally {
|
|
138
|
-
|
|
136
|
+
deadline.clear();
|
|
139
137
|
}
|
|
140
138
|
};
|
|
141
139
|
export const appProvider = (origin, client, redirectUri = RELAY_URL) => ({
|
package/dist/amo/transport.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CliError, isCliError, realSleep } from "@wirecat/cli-base";
|
|
2
2
|
import { hostFetch, providerWaitMs, readJsonResponse } from "@wirecat/cli-base/http";
|
|
3
|
-
import { apiJson, currentAttempt, providerEvent, providerRequest } from "@wirecat/cli-core
|
|
4
|
-
import { providerCall } from "@wirecat/cli-core/crm";
|
|
3
|
+
import { apiJson, currentAttempt, providerCall, providerEvent, providerRequest, timeLimit, } from "@wirecat/cli-core";
|
|
5
4
|
import { employeeRuleOf } from "../api-keys.js";
|
|
6
5
|
import { amoError, isBlock } from "./errors.js";
|
|
7
6
|
import { isRecord } from "./json.js";
|
|
@@ -159,10 +158,7 @@ export class AmoTransport {
|
|
|
159
158
|
}
|
|
160
159
|
async #once(route, request, write, attempt) {
|
|
161
160
|
const { operation } = route;
|
|
162
|
-
|
|
163
|
-
const deadline = new AbortController();
|
|
164
|
-
const timer = setTimeout(() => deadline.abort(new DOMException(`${operation.name} timed out`, "TimeoutError")), this.#timeoutMs);
|
|
165
|
-
timer.unref();
|
|
161
|
+
const deadline = timeLimit(this.#timeoutMs);
|
|
166
162
|
const end = providerRequest(operation.name, this.#events ?? providerEvent, {
|
|
167
163
|
method: operation.method,
|
|
168
164
|
endpointTemplate: operation.template,
|
|
@@ -183,7 +179,7 @@ export class AmoTransport {
|
|
|
183
179
|
return { status: response.status, body };
|
|
184
180
|
}
|
|
185
181
|
finally {
|
|
186
|
-
|
|
182
|
+
deadline.clear();
|
|
187
183
|
}
|
|
188
184
|
}
|
|
189
185
|
async #send(route, request, write, signal, end) {
|
package/dist/api-keys.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CRM_ASSIGN_OTHERS_KEY } from "@wirecat/cli-core
|
|
1
|
+
import { CRM_ASSIGN_OTHERS_KEY } from "@wirecat/cli-core";
|
|
2
2
|
import { isRecord } from "./amo/json.js";
|
|
3
3
|
import { matchOperation, OPERATIONS } from "./amo/operation.js";
|
|
4
4
|
import { ENTITIES } from "./amo/routes.js";
|
package/dist/bin/amo.js
CHANGED
|
@@ -9,15 +9,13 @@ if (
|
|
|
9
9
|
(words[0] === "--version" || words[0] === "-V") &&
|
|
10
10
|
!Object.keys(process.env).some((key) => key.endsWith("_TEST_ARGV_LOG"))
|
|
11
11
|
) {
|
|
12
|
-
process.stdout.write("0.
|
|
12
|
+
process.stdout.write("0.7.0\n")
|
|
13
13
|
} else {
|
|
14
14
|
// Before the bundle compiles: the bundle's own call comes after its chunks.
|
|
15
15
|
module.enableCompileCache()
|
|
16
16
|
const serves = ((words) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.slice(0, 4)
|
|
20
|
-
.some((word, at) => word === "serve" || word === "watch" || (word === "mcp" && plain[at + 1] === undefined));
|
|
17
|
+
const plain = words.filter((word) => !word.startsWith("-"));
|
|
18
|
+
return plain.slice(0, 4).some((word, at) => word === "serve" || word === "watch" || word === "mcp" && plain[at + 1] === void 0);
|
|
21
19
|
})(words)
|
|
22
20
|
if (serves && module.registerHooks) {
|
|
23
21
|
const bundle = new URL("../bundle/", import.meta.url).href
|
|
@@ -28,13 +26,15 @@ if (
|
|
|
28
26
|
: next(specifier, context),
|
|
29
27
|
})
|
|
30
28
|
}
|
|
31
|
-
const chunks = ["../bundle/
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
const chunks = ["../bundle/program-SQH3SPOW.js","../bundle/source-C65ZJUTW.js","../bundle/store-SJ2TOUGU.js","../bundle/writer-I7GBI3VE.js"]
|
|
30
|
+
const preload = () =>
|
|
31
|
+
Promise.allSettled([
|
|
32
|
+
...chunks.map((chunk) => import(chunk)),
|
|
33
|
+
...["@wirecat/cli-core/preload","@wirecat/cli-base/preload"].map((name) => import(name).then((loaded) => loaded.preload())),
|
|
34
|
+
])
|
|
35
|
+
if (((words) => words.filter((word) => !word.startsWith("-")).slice(0, 2).includes("upgrade"))(words)) await preload()
|
|
36
36
|
const running = import("../bundle/amo.js")
|
|
37
37
|
// After the server answers its first request, so it starts no later.
|
|
38
|
-
if (serves) setTimeout(() => void
|
|
38
|
+
if (serves) setTimeout(() => void preload(), 2000).unref()
|
|
39
39
|
await running
|
|
40
40
|
}
|
package/dist/bundle/amo.js
CHANGED
|
@@ -3,198 +3,20 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
3
3
|
const require = __bundleRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
DESKTOP
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-LZPKBN3C.js";
|
|
9
|
-
import "./chunk-EH6ZEJGT.js";
|
|
10
|
-
import "./chunk-JXT6GY4V.js";
|
|
11
|
-
import "./chunk-NSKMNIY6.js";
|
|
12
|
-
import {
|
|
13
|
-
installerOf
|
|
14
|
-
} from "./chunk-TXDR6YSF.js";
|
|
15
|
-
import "./chunk-BIKOE2IW.js";
|
|
16
|
-
import "./chunk-EHK73OSW.js";
|
|
17
|
-
import "./chunk-IG2TJQJ7.js";
|
|
18
|
-
import "./chunk-2JHVQMVC.js";
|
|
19
|
-
import "./chunk-ZLUIRFJX.js";
|
|
20
|
-
import "./chunk-XEQQJBBO.js";
|
|
21
|
-
import "./chunk-RRTMPSQR.js";
|
|
22
|
-
import "./chunk-DSJ6EAOA.js";
|
|
23
|
-
import "./chunk-DNCLQPOM.js";
|
|
24
|
-
import "./chunk-AKRIUNYP.js";
|
|
25
|
-
import {
|
|
26
|
-
DESCRIBE_FLAG,
|
|
27
|
-
DISPATCH_FLAG,
|
|
28
|
-
PROGRAM_PREFIX,
|
|
29
|
-
SHIM_FORMAT,
|
|
30
|
-
describeAnswer,
|
|
31
|
-
exists,
|
|
32
|
-
fileState,
|
|
33
|
-
shimFiles,
|
|
34
|
-
writeShim
|
|
35
|
-
} from "./chunk-DPV53EZC.js";
|
|
36
|
-
import "./chunk-IA7LLLEI.js";
|
|
37
|
-
import "./chunk-YWDFYQOU.js";
|
|
38
|
-
import "./chunk-TLG6ECZ2.js";
|
|
39
|
-
import "./chunk-WIHN3ELW.js";
|
|
40
|
-
import {
|
|
41
|
-
catchCrashes
|
|
42
|
-
} from "./chunk-QFOP3KUP.js";
|
|
43
|
-
import "./chunk-Y5E2WNWB.js";
|
|
44
|
-
import "./chunk-S6JG4YUH.js";
|
|
45
|
-
import {
|
|
46
|
-
__name
|
|
47
|
-
} from "./chunk-ZVVMGPBJ.js";
|
|
6
|
+
} from "./chunk-N2UB32VN.js";
|
|
7
|
+
import "./chunk-AEWYRB6F.js";
|
|
48
8
|
|
|
49
9
|
// dist/bin/amo.js
|
|
50
10
|
import { enableCompileCache } from "node:module";
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
import { createHash } from "node:crypto";
|
|
54
|
-
import { existsSync, readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
55
|
-
import { dirname as dirname2, join as join2 } from "node:path";
|
|
56
|
-
import { fileURLToPath } from "node:url";
|
|
57
|
-
|
|
58
|
-
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/launcher.js
|
|
59
|
-
import { readFileSync } from "node:fs";
|
|
60
|
-
import { basename, dirname, join, resolve } from "node:path";
|
|
61
|
-
var posix = /* @__PURE__ */ __name((path) => path.replaceAll("\\", "/"), "posix");
|
|
62
|
-
var pnpmHome = /* @__PURE__ */ __name((path, env) => {
|
|
63
|
-
const home = env.PNPM_HOME;
|
|
64
|
-
return home && path.startsWith(`${posix(home).replace(/\/+$/, "")}/`) ? home : void 0;
|
|
65
|
-
}, "pnpmHome");
|
|
66
|
-
var layoutFolders = /* @__PURE__ */ __name((script, env) => {
|
|
67
|
-
const path = posix(script);
|
|
68
|
-
const home = pnpmHome(path, env);
|
|
69
|
-
if (home)
|
|
70
|
-
return [join(home, "bin"), home];
|
|
71
|
-
switch (installerOf(script)) {
|
|
72
|
-
case "bun":
|
|
73
|
-
return [`${path.slice(0, path.indexOf("/install/global/node_modules/"))}/bin`];
|
|
74
|
-
case "npm": {
|
|
75
|
-
const root = path.slice(0, path.indexOf("/node_modules/"));
|
|
76
|
-
return [basename(root) === "lib" ? join(dirname(root), "bin") : root];
|
|
77
|
-
}
|
|
78
|
-
default:
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
}, "layoutFolders");
|
|
82
|
-
var binFolder = /* @__PURE__ */ __name(({ name, argv1, script, env, platform }) => {
|
|
83
|
-
if (!["npm", "pnpm", "bun"].includes(installerOf(script)) && !pnpmHome(posix(script), env))
|
|
84
|
-
return void 0;
|
|
85
|
-
const extensions = platform === "win32" ? [".cmd", ".exe"] : [""];
|
|
86
|
-
const candidates = [argv1 ? dirname(argv1) : void 0, ...layoutFolders(script, env)];
|
|
87
|
-
for (const dir of new Set(candidates)) {
|
|
88
|
-
if (dir === void 0 || basename(dir) === ".bin")
|
|
89
|
-
continue;
|
|
90
|
-
for (const extension of extensions) {
|
|
91
|
-
const program = `${PROGRAM_PREFIX}${name}${extension}`;
|
|
92
|
-
if (exists(join(dir, program)))
|
|
93
|
-
return { dir, program };
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return void 0;
|
|
97
|
-
}, "binFolder");
|
|
98
|
-
var installed = /* @__PURE__ */ __name((dir, program) => {
|
|
99
|
-
if (!exists(join(dir, program)))
|
|
100
|
-
return false;
|
|
101
|
-
if (!program.toLowerCase().endsWith(".exe"))
|
|
102
|
-
return true;
|
|
103
|
-
let script;
|
|
104
|
-
try {
|
|
105
|
-
script = readFileSync(join(dir, `${program.slice(0, -4)}.bunx`)).toString("utf16le").split('"')[0] ?? "";
|
|
106
|
-
} catch {
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
if (script === "" || exists(resolve(dir, script)))
|
|
110
|
-
return true;
|
|
111
|
-
const at = posix(script).lastIndexOf("/install/global/node_modules/");
|
|
112
|
-
return at < 0 || exists(join(dirname(dir), posix(script).slice(at + 1)));
|
|
113
|
-
}, "installed");
|
|
114
|
-
var NAME = "wcat";
|
|
115
|
-
var ensureLauncher = /* @__PURE__ */ __name(({ dir, program, platform }) => {
|
|
116
|
-
try {
|
|
117
|
-
if (!exists(join(dir, program)))
|
|
118
|
-
return "failed";
|
|
119
|
-
const mine = shimFiles("launcher", { dir, name: NAME, target: program, platform });
|
|
120
|
-
const states = mine.map((file) => fileState(file.path));
|
|
121
|
-
if (states.some((one) => one.state === "foreign"))
|
|
122
|
-
return "foreign";
|
|
123
|
-
const ours = states.flatMap((one) => one.state === "ours" ? [one] : []);
|
|
124
|
-
if (ours.some(({ mark }) => mark.format > SHIM_FORMAT))
|
|
125
|
-
return "newer";
|
|
126
|
-
if (ours.some(({ mark }) => mark.kind !== "launcher"))
|
|
127
|
-
return "foreign";
|
|
128
|
-
const current = ours.find(({ mark }) => installed(dir, mark.target))?.mark.target;
|
|
129
|
-
const wanted = shimFiles("launcher", { dir, name: NAME, target: current ?? program, platform });
|
|
130
|
-
const stale = wanted.filter((file, at) => {
|
|
131
|
-
const state = states[at];
|
|
132
|
-
return state?.state !== "ours" || state.text !== file.text;
|
|
133
|
-
});
|
|
134
|
-
if (stale.length === 0)
|
|
135
|
-
return "kept";
|
|
136
|
-
for (const file of stale)
|
|
137
|
-
writeShim(file);
|
|
138
|
-
return "written";
|
|
139
|
-
} catch {
|
|
140
|
-
return "failed";
|
|
141
|
-
}
|
|
142
|
-
}, "ensureLauncher");
|
|
143
|
-
|
|
144
|
-
// node_modules/.pnpm/@wirecat+cli-base@1.0.0_commander@15.0.0_esbuild@0.28.2_typescript@7.0.2_vitest@5.0.5/node_modules/@wirecat/cli-base/dist/wcat/start.js
|
|
145
|
-
var wcatStart = /* @__PURE__ */ __name(async (tool, io = {}) => {
|
|
146
|
-
const argv = io.argv ?? process.argv;
|
|
147
|
-
const env = io.env ?? process.env;
|
|
148
|
-
const platform = io.platform ?? process.platform;
|
|
149
|
-
const stdout = io.stdout ?? process.stdout;
|
|
150
|
-
const [first, ...rest] = argv.slice(2);
|
|
151
|
-
if (first === DESCRIBE_FLAG) {
|
|
152
|
-
stdout.write(`${JSON.stringify(describeAnswer(tool, shippedManifest(argv[1])))}
|
|
153
|
-
`);
|
|
154
|
-
return { code: 0 };
|
|
155
|
-
}
|
|
156
|
-
if (first === DISPATCH_FLAG) {
|
|
157
|
-
const { runWcat } = await import("./dispatch-56FECRCU.js");
|
|
158
|
-
const code = await runWcat(rest, { env, platform, stdout, stderr: io.stderr ?? process.stderr, self: tool });
|
|
159
|
-
return { code };
|
|
160
|
-
}
|
|
161
|
-
const folder = binFolder({
|
|
162
|
-
name: tool.command,
|
|
163
|
-
argv1: argv[1],
|
|
164
|
-
script: io.script ?? fileURLToPath(new URL("wcat/start.js", import.meta.resolve("@wirecat/cli-base")).href),
|
|
165
|
-
env,
|
|
166
|
-
platform
|
|
167
|
-
});
|
|
168
|
-
return folder ? { launcher: ensureLauncher({ ...folder, platform }) } : {};
|
|
169
|
-
}, "wcatStart");
|
|
170
|
-
var shippedManifest = /* @__PURE__ */ __name((bin) => {
|
|
171
|
-
if (!bin)
|
|
172
|
-
return void 0;
|
|
173
|
-
try {
|
|
174
|
-
for (let dir = dirname2(realpathSync(bin)); ; dir = dirname2(dir)) {
|
|
175
|
-
if (existsSync(join2(dir, "package.json"))) {
|
|
176
|
-
const bytes = readFileSync2(join2(dir, "contracts", "wirecat.json"));
|
|
177
|
-
const { wcat_manifest: format, desktop } = JSON.parse(bytes.toString("utf8"));
|
|
178
|
-
if (format !== 2 || typeof desktop !== "object" || desktop === null)
|
|
179
|
-
return void 0;
|
|
180
|
-
return { desktop, sha256: createHash("sha256").update(bytes).digest("hex") };
|
|
181
|
-
}
|
|
182
|
-
if (dirname2(dir) === dir)
|
|
183
|
-
return void 0;
|
|
184
|
-
}
|
|
185
|
-
} catch {
|
|
186
|
-
return void 0;
|
|
187
|
-
}
|
|
188
|
-
}, "shippedManifest");
|
|
189
|
-
|
|
190
|
-
// dist/bin/amo.js
|
|
11
|
+
import { catchCrashes } from "@wirecat/cli-base";
|
|
12
|
+
import { wcatStart } from "@wirecat/cli-base/wcat/start";
|
|
191
13
|
enableCompileCache();
|
|
192
14
|
var stopCatching = catchCrashes({ cli: DESKTOP.command, interactive: process.stdout.isTTY === true });
|
|
193
15
|
var wcat = await wcatStart(DESKTOP);
|
|
194
16
|
if (wcat.code !== void 0) {
|
|
195
17
|
process.exitCode = wcat.code;
|
|
196
18
|
} else {
|
|
197
|
-
const { run } = await import("./program-
|
|
19
|
+
const { run } = await import("./program-SQH3SPOW.js");
|
|
198
20
|
process.exitCode = await run(process.argv.slice(2));
|
|
199
21
|
}
|
|
200
22
|
stopCatching();
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
-
import {
|
|
4
|
-
values_exports
|
|
5
|
-
} from "./chunk-3GX6KM2E.js";
|
|
6
3
|
import {
|
|
7
4
|
__name
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AEWYRB6F.js";
|
|
9
6
|
|
|
10
7
|
// dist/amo/routes.js
|
|
11
8
|
var ROUTES = {
|
|
@@ -66,7 +63,8 @@ var ENTITIES = {
|
|
|
66
63
|
};
|
|
67
64
|
|
|
68
65
|
// dist/crm/records.js
|
|
69
|
-
|
|
66
|
+
import { crmValues } from "@wirecat/cli-core";
|
|
67
|
+
var { amountOf, epoch, fieldOf, id, isRaw, rawsOf, text } = crmValues;
|
|
70
68
|
var WON = "142";
|
|
71
69
|
var LOST = "143";
|
|
72
70
|
var LISTS = /* @__PURE__ */ new Set(["select", "multiselect", "radiobutton"]);
|
|
@@ -123,7 +121,7 @@ var valuesOf = /* @__PURE__ */ __name((raw) => {
|
|
|
123
121
|
}
|
|
124
122
|
return { phones, emails, contactTypes, custom };
|
|
125
123
|
}, "valuesOf");
|
|
126
|
-
var metadataOf = /* @__PURE__ */ __name((custom, fields) => Object.keys(custom).length ? { metadata:
|
|
124
|
+
var metadataOf = /* @__PURE__ */ __name((custom, fields) => Object.keys(custom).length ? { metadata: crmValues.crmValuesOf(custom, fields) } : {}, "metadataOf");
|
|
127
125
|
var embedded = /* @__PURE__ */ __name((raw, key) => rawsOf(fieldOf(raw._embedded, key)), "embedded");
|
|
128
126
|
var day = /* @__PURE__ */ __name((at, timeZone) => {
|
|
129
127
|
const ms = epoch(at);
|
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
toPerson,
|
|
10
10
|
toPipeline,
|
|
11
11
|
toUser
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import {
|
|
14
|
-
values_exports
|
|
15
|
-
} from "./chunk-3GX6KM2E.js";
|
|
16
|
-
import {
|
|
17
|
-
CliError,
|
|
18
|
-
isCliError
|
|
19
|
-
} from "./chunk-S6JG4YUH.js";
|
|
12
|
+
} from "./chunk-3HWD4BKU.js";
|
|
20
13
|
import {
|
|
21
14
|
__name
|
|
22
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AEWYRB6F.js";
|
|
16
|
+
|
|
17
|
+
// dist/crm/source.js
|
|
18
|
+
import { CliError as CliError2, isCliError as isCliError2 } from "@wirecat/cli-base";
|
|
19
|
+
import { crmValues as crmValues2 } from "@wirecat/cli-core";
|
|
20
|
+
|
|
21
|
+
// dist/amo/operation.js
|
|
22
|
+
import { CliError } from "@wirecat/cli-base";
|
|
23
23
|
|
|
24
24
|
// dist/amo/allow-list.js
|
|
25
25
|
var LINKS = "https://www.amocrm.ru/developers/content/crm_platform/entity-links-api";
|
|
@@ -1586,7 +1586,9 @@ var withEveryId = /* @__PURE__ */ __name((matched) => {
|
|
|
1586
1586
|
var pathOf = /* @__PURE__ */ __name(({ operation, ids }) => operation.template.replace(/\{(\w+)\}/g, (_, name) => encodeURIComponent(ids[name] ?? "")), "pathOf");
|
|
1587
1587
|
|
|
1588
1588
|
// dist/crm/activities.js
|
|
1589
|
-
|
|
1589
|
+
import { isCliError } from "@wirecat/cli-base";
|
|
1590
|
+
import { crmValues } from "@wirecat/cli-core";
|
|
1591
|
+
var { fieldOf, id, isRaw, text } = crmValues;
|
|
1590
1592
|
var OVERLAP_MS = 10 * 6e4;
|
|
1591
1593
|
var seconds = /* @__PURE__ */ __name((ms) => Math.floor(ms / 1e3), "seconds");
|
|
1592
1594
|
var msOf = /* @__PURE__ */ __name((value) => typeof value === "number" && value > 0 ? value * 1e3 : null, "msOf");
|
|
@@ -1742,7 +1744,7 @@ var readActivities = /* @__PURE__ */ __name(async (list, { since, page, now, siz
|
|
|
1742
1744
|
}, "readActivities");
|
|
1743
1745
|
|
|
1744
1746
|
// dist/crm/source.js
|
|
1745
|
-
var { fieldOf: fieldOf2, id: id2, isRaw: isRaw2, rawsOf, text: text2 } =
|
|
1747
|
+
var { fieldOf: fieldOf2, id: id2, isRaw: isRaw2, rawsOf, text: text2 } = crmValues2;
|
|
1746
1748
|
var OVERLAP_MS2 = 10 * 6e4;
|
|
1747
1749
|
var PAGE = 250;
|
|
1748
1750
|
var EVENTS_PAGE2 = 100;
|
|
@@ -1754,7 +1756,7 @@ var listPage = /* @__PURE__ */ __name(async (caller, route, name, query) => {
|
|
|
1754
1756
|
return { rows: [], more: false };
|
|
1755
1757
|
const rows = fieldOf2(fieldOf2(body, "_embedded"), name);
|
|
1756
1758
|
if (!Array.isArray(rows))
|
|
1757
|
-
throw new
|
|
1759
|
+
throw new CliError2("invalid_response", `amoCRM answered ${route} without its ${name}`);
|
|
1758
1760
|
return { rows: rows.filter(isRaw2), more: fieldOf2(fieldOf2(body, "_links"), "next") !== void 0 };
|
|
1759
1761
|
}, "listPage");
|
|
1760
1762
|
var readAll = /* @__PURE__ */ __name(async (caller, route, name, query = {}) => {
|
|
@@ -1774,7 +1776,7 @@ var readOne = /* @__PURE__ */ __name(async (caller, route, externalId, query = {
|
|
|
1774
1776
|
const { body } = await caller.request({ route, ids: { id: externalId }, query });
|
|
1775
1777
|
return isRaw2(body) ? body : null;
|
|
1776
1778
|
} catch (error) {
|
|
1777
|
-
if (
|
|
1779
|
+
if (isCliError2(error) && error.code === "not_found")
|
|
1778
1780
|
return null;
|
|
1779
1781
|
throw error;
|
|
1780
1782
|
}
|
|
@@ -1811,7 +1813,7 @@ var filtersOf = /* @__PURE__ */ __name((kind, conditions, self) => {
|
|
|
1811
1813
|
const query = {};
|
|
1812
1814
|
const set = /* @__PURE__ */ __name((name, value) => {
|
|
1813
1815
|
if (!declared.has(name))
|
|
1814
|
-
throw new
|
|
1816
|
+
throw new CliError2("validation_error", `amoCRM cannot filter ${ENTITIES[kind].name} by ${name}`, {
|
|
1815
1817
|
reason: "crm.record-field"
|
|
1816
1818
|
});
|
|
1817
1819
|
query[name] = value;
|
|
@@ -1821,7 +1823,7 @@ var filtersOf = /* @__PURE__ */ __name((kind, conditions, self) => {
|
|
|
1821
1823
|
const users = (Array.isArray(value) ? value : [value]).map((one) => one === "me" ? self : String(one));
|
|
1822
1824
|
for (const user of users)
|
|
1823
1825
|
if (!user || !/^[1-9][0-9]*$/.test(user))
|
|
1824
|
-
throw new
|
|
1826
|
+
throw new CliError2("validation_error", "assigned_to takes me or an amoCRM user id, such as 7", {
|
|
1825
1827
|
reason: "crm.owner-unknown"
|
|
1826
1828
|
});
|
|
1827
1829
|
set("filter[responsible_user_id][]", users.map(Number));
|
|
@@ -1835,7 +1837,7 @@ var filtersOf = /* @__PURE__ */ __name((kind, conditions, self) => {
|
|
|
1835
1837
|
set(`filter[${field}][to]`, op === "<" ? Math.ceil(ms / 1e3) - 1 : seconds2(ms));
|
|
1836
1838
|
continue;
|
|
1837
1839
|
}
|
|
1838
|
-
throw new
|
|
1840
|
+
throw new CliError2("validation_error", `amoCRM cannot filter ${ENTITIES[kind].name} by ${field} ${op}`, {
|
|
1839
1841
|
reason: "crm.record-field"
|
|
1840
1842
|
});
|
|
1841
1843
|
}
|
|
@@ -1998,7 +2000,7 @@ var amoCrmSource = /* @__PURE__ */ __name((account, options = {}) => {
|
|
|
1998
2000
|
const { mode, setting, chosen } = await asked();
|
|
1999
2001
|
if (mode === "mine")
|
|
2000
2002
|
return (await accountOf()).userId;
|
|
2001
|
-
throw new
|
|
2003
|
+
throw new CliError2("configuration_error", `${setting} is all, and amo never copies the whole CRM: "config set ${setting} mine" copies the deals of the users you choose in ${chosen}, and their clients. Find any other client with "people list" or "organizations list"`, { setting, reason: "amo.scope-all-refused" });
|
|
2002
2004
|
},
|
|
2003
2005
|
// Only an administrator may copy a colleague's deals: anyone else cannot list the users to tell who is who.
|
|
2004
2006
|
async unassigned(users) {
|
|
@@ -2285,7 +2287,7 @@ var amoCrmSource = /* @__PURE__ */ __name((account, options = {}) => {
|
|
|
2285
2287
|
const me = query.conditions.some((one) => one.field === "assigned_to" && [one.value].flat().includes("me"));
|
|
2286
2288
|
const filters = filtersOf(kind, query.conditions, me ? (await accountOf(caller)).userId : void 0);
|
|
2287
2289
|
if (Object.keys(filters).length && !(await accountOf(caller)).filters)
|
|
2288
|
-
throw new
|
|
2290
|
+
throw new CliError2("validation_error", "this account has no API filter add-on (is_api_filter_enabled is off), so amoCRM cannot narrow the list by owner or time; search by name instead", { reason: "amo.filters-off" });
|
|
2289
2291
|
const entity = ENTITIES[kind];
|
|
2290
2292
|
const { rows, more } = await listPage(caller, entity.list, entity.name, {
|
|
2291
2293
|
...filters,
|
|
@@ -2314,7 +2316,7 @@ var amoCrmSource = /* @__PURE__ */ __name((account, options = {}) => {
|
|
|
2314
2316
|
async item(externalId) {
|
|
2315
2317
|
const raw = await readOne(account(), ROUTES.lead, externalId, { with: WITH.deal });
|
|
2316
2318
|
if (!raw)
|
|
2317
|
-
throw new
|
|
2319
|
+
throw new CliError2("not_found", `amoCRM has no deal ${externalId}`);
|
|
2318
2320
|
return (await mapped("deal", [raw], account()))[0];
|
|
2319
2321
|
},
|
|
2320
2322
|
async lossReasons() {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
__name
|
|
8
|
+
};
|
|
@@ -2,10 +2,10 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
IDENTITY
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-N2UB32VN.js";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AEWYRB6F.js";
|
|
9
9
|
|
|
10
10
|
// dist/store.js
|
|
11
11
|
var PROVIDER = {
|
|
@@ -15,7 +15,7 @@ var PROVIDER = {
|
|
|
15
15
|
command: IDENTITY.command
|
|
16
16
|
};
|
|
17
17
|
var openAmoStore = /* @__PURE__ */ __name(async (env, { readOnly = false } = {}) => {
|
|
18
|
-
const { openAppStore } = await import("
|
|
18
|
+
const { openAppStore } = await import("@wirecat/cli-core");
|
|
19
19
|
return openAppStore(env, { app: IDENTITY, provider: PROVIDER, readOnly });
|
|
20
20
|
}, "openAmoStore");
|
|
21
21
|
|