@wirecat/amo-cli 0.2.0 → 0.3.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 +28 -0
- package/README.md +11 -10
- package/contracts/wirecat.json +45 -6
- package/dist/amo/button.d.ts +53 -0
- package/dist/amo/button.d.ts.map +1 -0
- package/dist/amo/button.js +234 -0
- package/dist/amo/button.js.map +1 -0
- package/dist/amo/oauth.d.ts +12 -3
- package/dist/amo/oauth.d.ts.map +1 -1
- package/dist/amo/oauth.js +19 -6
- package/dist/amo/oauth.js.map +1 -1
- package/dist/bin/amo.js +2 -2
- package/dist/bundle/agent-FDNP27SW.js +40 -0
- package/dist/bundle/{all-profiles-3KQVWDV4.js → all-profiles-PPUN52SP.js} +63 -21
- package/dist/bundle/amo.js +28 -26
- package/dist/bundle/{anthropic-N5NOX7K7.js → anthropic-RDNDT6ZP.js} +5 -5
- package/dist/bundle/{app-server-2MST5EZ5.js → app-server-MMALJDBP.js} +79 -68
- package/dist/bundle/{bun-4NHWOFX2.js → bun-Y4FRPURU.js} +2 -2
- package/dist/bundle/{bun-sqlite-DRSXPWPR.js → bun-sqlite-7NXJGZCO.js} +6 -6
- package/dist/bundle/{chunk-GNTJMB6X.js → chunk-2YEDK2XV.js} +4 -4
- package/dist/bundle/chunk-3NDMVXGS.js +80 -0
- package/dist/bundle/{chunk-Y37A3232.js → chunk-3RP57VDS.js} +114 -7
- package/dist/bundle/{chunk-ODNQU7DH.js → chunk-3YOZTGZ6.js} +43 -64
- package/dist/bundle/{chunk-ESZSMZKT.js → chunk-4EYPFFTN.js} +2 -2
- package/dist/bundle/{chunk-5QFHNBGB.js → chunk-4MVTSMWP.js} +2 -2
- package/dist/bundle/{chunk-LJQUYECN.js → chunk-5DPMNYQT.js} +1 -1
- package/dist/bundle/{chunk-7PKFYX7V.js → chunk-5POLHHDZ.js} +8 -8
- package/dist/bundle/{chunk-A33TIM5D.js → chunk-5RXH35ZA.js} +225 -225
- package/dist/bundle/{chunk-BVMNXI53.js → chunk-77FP6AWC.js} +25 -25
- package/dist/bundle/{chunk-L6AFE73L.js → chunk-7E6QSIRQ.js} +1 -1
- package/dist/bundle/chunk-7SBAHYZW.js +734 -0
- package/dist/bundle/{chunk-GQ7VFIYM.js → chunk-7USADF2W.js} +23 -7
- package/dist/bundle/{chunk-AHJ4W2IL.js → chunk-7VSYOMEH.js} +2 -2
- package/dist/bundle/chunk-7Z6NYSAN.js +52 -0
- package/dist/bundle/chunk-AYR6FIXN.js +30 -0
- package/dist/bundle/{chunk-ADEWU4P4.js → chunk-B4ITT55D.js} +1 -1
- package/dist/bundle/{chunk-AUBB72VF.js → chunk-BKTLAXUK.js} +41 -10
- package/dist/bundle/{chunk-63F65DHU.js → chunk-BYVDMPLX.js} +2 -2
- package/dist/bundle/{chunk-V77XNPXG.js → chunk-CQ472K6W.js} +11 -11
- package/dist/bundle/{chunk-FKR3M62D.js → chunk-CUZISGWH.js} +13 -13
- package/dist/bundle/{chunk-LDEBZ3IX.js → chunk-D6UPCAPD.js} +1 -1
- package/dist/bundle/{chunk-P3WQRTYZ.js → chunk-E2DLRLJ5.js} +1 -1
- package/dist/bundle/{chunk-NJYAL3UW.js → chunk-EHULZEXQ.js} +1 -1
- package/dist/bundle/chunk-EKNP326Q.js +108 -0
- package/dist/bundle/{chunk-DJD7TBYG.js → chunk-ELJGALVX.js} +76 -74
- package/dist/bundle/{chunk-RPWAJYI6.js → chunk-FI2TP6TY.js} +3 -3
- package/dist/bundle/{chunk-CDY2NJFE.js → chunk-FPDTIQOK.js} +2 -2
- package/dist/bundle/{chunk-NC76INB2.js → chunk-FPIUFSWK.js} +3099 -2266
- package/dist/bundle/{chunk-SZ2V62HB.js → chunk-GCUFGDKE.js} +2 -2
- package/dist/bundle/{chunk-LRBPT7LQ.js → chunk-GKP7CKW2.js} +6 -6
- package/dist/bundle/chunk-H34RBRS3.js +209 -0
- package/dist/bundle/{chunk-O2UCU52O.js → chunk-HQH4YPO5.js} +134 -569
- package/dist/bundle/{chunk-TNUFLULO.js → chunk-I4QCJZW7.js} +8 -8
- package/dist/bundle/{chunk-DXGGCGRP.js → chunk-IDQ7BNCZ.js} +14 -14
- package/dist/bundle/{chunk-JMDLPBXK.js → chunk-IEAPNTHT.js} +17 -17
- package/dist/bundle/{chunk-XQL7FEF4.js → chunk-ILUREFWJ.js} +9 -9
- package/dist/bundle/{chunk-QRQYUHCZ.js → chunk-IYUWVMGP.js} +12 -12
- package/dist/bundle/chunk-JTFAG3BX.js +338 -0
- package/dist/bundle/{chunk-CHUKWON6.js → chunk-JZ2AITOE.js} +3 -3
- package/dist/bundle/{chunk-JR6TSMFX.js → chunk-KEOKH2OZ.js} +103 -70
- package/dist/bundle/{chunk-UMVRT7VQ.js → chunk-KKXF6TSS.js} +1 -1
- package/dist/bundle/{chunk-5E5R65CA.js → chunk-KTLCQ7GC.js} +2 -2
- package/dist/bundle/{chunk-QDMXZZG4.js → chunk-KZDBO2FT.js} +18 -8
- package/dist/bundle/{chunk-VX37MPTJ.js → chunk-L2ZQDTDU.js} +1 -1
- package/dist/bundle/{chunk-CUZRHF34.js → chunk-L3JDQNBC.js} +4 -4
- package/dist/bundle/{chunk-3IRJDH2U.js → chunk-L72UALL5.js} +2 -100
- package/dist/bundle/{chunk-XRTD2GCU.js → chunk-LOSOWTAZ.js} +19 -258
- package/dist/bundle/{chunk-LGQXGOPJ.js → chunk-LYRICHEK.js} +2 -2
- package/dist/bundle/{chunk-UBRREVLJ.js → chunk-MMOEAH5G.js} +2 -2
- package/dist/bundle/{chunk-EQ7A6NA6.js → chunk-MPXKBF37.js} +1 -1
- package/dist/bundle/{chunk-SMSTGO2G.js → chunk-MYMBPQPQ.js} +4 -4
- package/dist/bundle/chunk-N4A6E2LL.js +559 -0
- package/dist/bundle/{chunk-5HGGG3QO.js → chunk-NJ2LJKNH.js} +16 -3
- package/dist/bundle/{chunk-TGEQNS6G.js → chunk-OMH3WP7F.js} +1 -1
- package/dist/bundle/{chunk-ULXQ5MJM.js → chunk-ORFLQGWH.js} +4 -4
- package/dist/bundle/{chunk-DQV2IKCF.js → chunk-PFZ7WG2B.js} +10 -3
- package/dist/bundle/{chunk-5D4AEUVA.js → chunk-PL5P7UKW.js} +434 -1
- package/dist/bundle/{chunk-6RS7OYTD.js → chunk-Q2YVY7IR.js} +3 -3
- package/dist/bundle/{chunk-DOSJONCX.js → chunk-QHA33ZS6.js} +7 -7
- package/dist/bundle/{chunk-JH3UOHRE.js → chunk-QQT7WUR4.js} +4 -4
- package/dist/bundle/{chunk-EROSAUNP.js → chunk-R23DRW2T.js} +5 -5
- package/dist/bundle/{chunk-WCYCUTSK.js → chunk-SBQ5MFHM.js} +7 -7
- package/dist/bundle/{chunk-DAY6TSPF.js → chunk-SJYVKR54.js} +62 -50
- package/dist/bundle/{chunk-T2UDLX76.js → chunk-SJZ52MZE.js} +6 -6
- package/dist/bundle/{chunk-ZM7I52EP.js → chunk-T6D34X5S.js} +3 -4
- package/dist/bundle/{chunk-P5LYZRKW.js → chunk-TCDER3G7.js} +1586 -749
- package/dist/bundle/{chunk-2I5UVMLW.js → chunk-TWZF7VO6.js} +1726 -1159
- package/dist/bundle/{chunk-VVHRQ46X.js → chunk-UA7C57IB.js} +2 -2
- package/dist/bundle/{chunk-5SBLU7D7.js → chunk-UM6SDFB6.js} +1 -1
- package/dist/bundle/{chunk-7U5HJEPZ.js → chunk-UOPP6ORQ.js} +21 -19
- package/dist/bundle/{chunk-U7RLVJ34.js → chunk-UT3ODJMI.js} +4 -4
- package/dist/bundle/{chunk-7GTUZY7M.js → chunk-UZLT6VSP.js} +3 -3
- package/dist/bundle/{chunk-5RLUHTK6.js → chunk-V3ZWYMXT.js} +1 -1
- package/dist/bundle/{chunk-LSND5QYI.js → chunk-VD7HD25M.js} +9 -9
- package/dist/bundle/{chunk-PFO76YFP.js → chunk-VEGNZPQU.js} +18 -18
- package/dist/bundle/{chunk-5Z5PEEKP.js → chunk-VFU25P57.js} +4 -4
- package/dist/bundle/{chunk-4ZAK773N.js → chunk-VJHOBOJR.js} +3 -3
- package/dist/bundle/{chunk-PM77PRB6.js → chunk-VPBSZ4HQ.js} +185 -162
- package/dist/bundle/{chunk-Q2VNBY4Y.js → chunk-VY27K2SH.js} +746 -1205
- package/dist/bundle/{chunk-XEFAMLSD.js → chunk-W4KY5JF5.js} +3 -3
- package/dist/bundle/{chunk-73CXFE36.js → chunk-WBWVBEHH.js} +29 -1
- package/dist/bundle/{chunk-NHXJYS4R.js → chunk-XDT74W5P.js} +32 -28
- package/dist/bundle/{chunk-EPOV5UIO.js → chunk-XI75EKLG.js} +11 -11
- package/dist/bundle/{chunk-CHH42KI4.js → chunk-XM2G62YF.js} +8 -6
- package/dist/bundle/{chunk-5D4Z2B5B.js → chunk-YSOGGUK3.js} +9 -9
- package/dist/bundle/chunk-YVO2YGML.js +353 -0
- package/dist/bundle/{chunk-EQUKVVHX.js → chunk-ZIFEIJRK.js} +7 -7
- package/dist/bundle/{cli-QVWTXADI.js → cli-GAO7LDDA.js} +150 -103
- package/dist/bundle/command-contract-RLIBGIDT.js +39 -0
- package/dist/bundle/{command-server-entry-5VL5U5EE.js → command-server-entry-BCDJP7XE.js} +28 -28
- package/dist/bundle/{decode-SQ5WGNDX.js → decode-OY2GR442.js} +5 -5
- package/dist/bundle/{dispatch-LA4DFXJD.js → dispatch-JWEJCBTF.js} +8 -8
- package/dist/bundle/dist-PAKDDIBT.js +191 -0
- package/dist/bundle/{echarts-25Z3RINX.js → echarts-AHEPEA5P.js} +2 -2
- package/dist/bundle/{embed-BNOTNXMA.js → embed-RVSUV54Z.js} +6 -6
- package/dist/bundle/{embedder-BCUT7KKV.js → embedder-GRZXZUXR.js} +9 -9
- package/dist/bundle/{failure-PKAC6XCT.js → failure-DDCSR54L.js} +2 -2
- package/dist/bundle/{first-run-EO5K5GME.js → first-run-G3WI4DH4.js} +12 -12
- package/dist/bundle/first-screen-6MLCMW2U.js +39 -0
- package/dist/bundle/{instructions-VLM3QAYB.js → instructions-NWQC5IP4.js} +1 -1
- package/dist/bundle/{mcp-7ILNMJH5.js → mcp-KGWT6TGO.js} +2 -2
- package/dist/bundle/meeting-combined-SVTFVZNJ.js +24 -0
- package/dist/bundle/{meeting-model-GHMMUQ34.js → meeting-model-I6T5HIZ5.js} +11 -11
- package/dist/bundle/{meeting-semantic-BMP6323L.js → meeting-semantic-47UA5JBF.js} +6 -6
- package/dist/bundle/{node-CT3N3TNL.js → node-7VXN7F4B.js} +2 -2
- package/dist/bundle/{node-sqlite-MELD2SBX.js → node-sqlite-BSEON57L.js} +7 -7
- package/dist/bundle/{oauth-YBH5OKC2.js → oauth-V6UAT4YD.js} +8 -8
- package/dist/bundle/{open-WNSBWTAG.js → open-7LVAY7ZU.js} +5 -5
- package/dist/bundle/{openai-XSNMNLW6.js → openai-OIEH342H.js} +15 -15
- package/dist/bundle/{process-I2QKOMM7.js → process-PTUCNLZ7.js} +1 -1
- package/dist/bundle/{program-G6O3IJR2.js → program-S5WY5IZP.js} +640 -852
- package/dist/bundle/{prompt-SOG4AKPM.js → prompt-7XWTEQ62.js} +5 -5
- package/dist/bundle/{recognize-WMQLWMXH.js → recognize-HGIAJXDR.js} +4 -4
- package/dist/bundle/{remote-4BTFOLFY.js → remote-X4SVEMHS.js} +9 -9
- package/dist/bundle/{rerank-LJ3TWRNV.js → rerank-QWM3DQMU.js} +7 -7
- package/dist/bundle/{serve-B6UANKXN.js → serve-VVG3TXYT.js} +10 -10
- package/dist/bundle/{server-YRH6GJ5Z.js → server-EHYK62BJ.js} +73 -61
- package/dist/bundle/server-WRPTBVNW.js +86 -0
- package/dist/bundle/source-YISMYLBQ.js +44 -0
- package/dist/bundle/{sqlite-runtime-R7QFWFE7.js → sqlite-runtime-MCKXDNYC.js} +6 -6
- package/dist/bundle/{state-DIJ5YUOE.js → state-MYNYQJCT.js} +6 -6
- package/dist/bundle/store-A7R2SZVD.js +34 -0
- package/dist/bundle/{store-MYTYDV6A.js → store-B7O3F3QB.js} +28 -21
- package/dist/bundle/{store-6WFWW7EC.js → store-FPIU2546.js} +24 -23
- package/dist/bundle/store-maintenance-command-D55FRTIK.js +73 -0
- package/dist/bundle/surface-3EX6IGHW.js +72 -0
- package/dist/bundle/writer-XDHZ54JD.js +46 -0
- package/dist/commands/session.d.ts +23 -0
- package/dist/commands/session.d.ts.map +1 -1
- package/dist/commands/session.js +115 -45
- package/dist/commands/session.js.map +1 -1
- package/dist/identity.js +1 -1
- package/dist/identity.js.map +1 -1
- package/dist/reasons.d.ts.map +1 -1
- package/dist/reasons.js +2 -0
- package/dist/reasons.js.map +1 -1
- package/dist/setup/flow.d.ts.map +1 -1
- package/dist/setup/flow.js +74 -4
- package/dist/setup/flow.js.map +1 -1
- package/dist/setup/texts.en.json +22 -1
- package/dist/setup/texts.es.json +22 -1
- package/dist/setup/texts.ru.json +22 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/skills/amo-cli/references/setup.md +8 -2
- package/dist/bundle/command-contract-QBUQBXH7.js +0 -39
- package/dist/bundle/first-screen-GMN3T6RW.js +0 -39
- package/dist/bundle/meeting-combined-LAMF7S2B.js +0 -24
- package/dist/bundle/server-S6XD6V6E.js +0 -77
- package/dist/bundle/source-DGFTA2TN.js +0 -42
- package/dist/bundle/store-CHWY2USQ.js +0 -32
- package/dist/bundle/store-maintenance-command-B5TMKFMG.js +0 -68
- package/dist/bundle/writer-GP7VIMAU.js +0 -44
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { createRequire as __bundleRequire } from "node:module";
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
AMO_WRITES
|
|
5
|
+
} from "./chunk-JZ2AITOE.js";
|
|
3
6
|
import {
|
|
4
7
|
ProfileTokenStore,
|
|
5
8
|
REPORT_FORMAT,
|
|
6
|
-
SECTION_CAPS,
|
|
7
9
|
accountRemoveCommand,
|
|
8
|
-
|
|
10
|
+
accountTokenCodec,
|
|
9
11
|
appDoctorCommand,
|
|
10
12
|
appMcpCommand,
|
|
11
13
|
commandLevel,
|
|
12
14
|
commandsCommand,
|
|
13
15
|
configCommand,
|
|
14
16
|
createProgram,
|
|
17
|
+
credentialStorage,
|
|
15
18
|
defineSetup,
|
|
16
19
|
deniedKinds,
|
|
17
20
|
guideCommand,
|
|
18
21
|
honoursDryRun,
|
|
22
|
+
oauthAccount,
|
|
19
23
|
openBrowser,
|
|
20
24
|
ownerLanguageOf,
|
|
21
|
-
parseApiJson,
|
|
22
25
|
providerEvent,
|
|
23
26
|
providerRequest,
|
|
24
27
|
run,
|
|
@@ -28,45 +31,51 @@ import {
|
|
|
28
31
|
setupCommand,
|
|
29
32
|
signInSteps,
|
|
30
33
|
skillCommand,
|
|
34
|
+
tokenKeeper,
|
|
31
35
|
upgradeCommand,
|
|
32
36
|
writeCsv
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-FPIUFSWK.js";
|
|
38
|
+
import "./chunk-E2DLRLJ5.js";
|
|
34
39
|
import {
|
|
35
40
|
PROVIDER
|
|
36
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4MVTSMWP.js";
|
|
37
42
|
import {
|
|
38
43
|
OPERATIONS,
|
|
39
44
|
amoCrmSource,
|
|
40
45
|
matchOperation,
|
|
41
46
|
pathOf,
|
|
42
47
|
withEveryId
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import {
|
|
45
|
-
AMO_WRITES
|
|
46
|
-
} from "./chunk-CHUKWON6.js";
|
|
48
|
+
} from "./chunk-FI2TP6TY.js";
|
|
47
49
|
import {
|
|
48
50
|
ENTITIES,
|
|
49
51
|
ROUTES
|
|
50
|
-
} from "./chunk-
|
|
51
|
-
import "./chunk-
|
|
52
|
+
} from "./chunk-D6UPCAPD.js";
|
|
53
|
+
import "./chunk-T6D34X5S.js";
|
|
52
54
|
import {
|
|
53
55
|
SOURCE_SEARCHED,
|
|
54
56
|
allAnswer,
|
|
55
57
|
historySkipsOf,
|
|
56
58
|
offsetOf,
|
|
57
59
|
refuseOffline
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import "./chunk-
|
|
60
|
-
import "./chunk-
|
|
61
|
-
import "./chunk-
|
|
60
|
+
} from "./chunk-XDT74W5P.js";
|
|
61
|
+
import "./chunk-LOSOWTAZ.js";
|
|
62
|
+
import "./chunk-5POLHHDZ.js";
|
|
63
|
+
import "./chunk-7E6QSIRQ.js";
|
|
62
64
|
import {
|
|
63
65
|
addStoreMaintenanceCommands
|
|
64
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-KEOKH2OZ.js";
|
|
65
67
|
import {
|
|
66
68
|
commandPathKey,
|
|
67
69
|
commandPermissions,
|
|
68
70
|
terminalAsker
|
|
69
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-UOPP6ORQ.js";
|
|
72
|
+
import "./chunk-YVO2YGML.js";
|
|
73
|
+
import "./chunk-ZIFEIJRK.js";
|
|
74
|
+
import "./chunk-IDQ7BNCZ.js";
|
|
75
|
+
import "./chunk-7VSYOMEH.js";
|
|
76
|
+
import "./chunk-7Z6NYSAN.js";
|
|
77
|
+
import "./chunk-JTFAG3BX.js";
|
|
78
|
+
import "./chunk-H34RBRS3.js";
|
|
70
79
|
import {
|
|
71
80
|
crmAccounts,
|
|
72
81
|
extractText,
|
|
@@ -75,13 +84,11 @@ import {
|
|
|
75
84
|
personMeetings,
|
|
76
85
|
readableAccounts,
|
|
77
86
|
searchAll,
|
|
78
|
-
taskAccount
|
|
79
|
-
|
|
80
|
-
} from "./chunk-Q2VNBY4Y.js";
|
|
87
|
+
taskAccount
|
|
88
|
+
} from "./chunk-VY27K2SH.js";
|
|
81
89
|
import {
|
|
82
|
-
acquireLock,
|
|
83
90
|
safeName
|
|
84
|
-
} from "./chunk-
|
|
91
|
+
} from "./chunk-CUZISGWH.js";
|
|
85
92
|
import {
|
|
86
93
|
CRM_ASSIGN_OTHERS_KEY,
|
|
87
94
|
CRM_WRITE_DEFAULTS,
|
|
@@ -90,8 +97,8 @@ import {
|
|
|
90
97
|
RECORD_ID,
|
|
91
98
|
SYNCED_FROM,
|
|
92
99
|
SYNC_FAILED,
|
|
100
|
+
apiJson,
|
|
93
101
|
closeCrmItem,
|
|
94
|
-
commandPath,
|
|
95
102
|
conditionsOf,
|
|
96
103
|
createCrmItem,
|
|
97
104
|
createCrmRecord,
|
|
@@ -100,62 +107,64 @@ import {
|
|
|
100
107
|
crmViewerOf,
|
|
101
108
|
customConditions,
|
|
102
109
|
customNames,
|
|
103
|
-
dateWindow,
|
|
104
110
|
fieldPairsOf,
|
|
105
111
|
filterableFields,
|
|
106
112
|
foreignContacts,
|
|
107
113
|
foreignContactsPathFor,
|
|
108
114
|
guardFor,
|
|
109
115
|
keyedGuard,
|
|
110
|
-
listQuery,
|
|
111
116
|
moveCrmItem,
|
|
112
|
-
nativeField,
|
|
113
|
-
nativeTerms,
|
|
114
117
|
newOperationId,
|
|
115
118
|
ownerOf,
|
|
116
119
|
pacePathFor,
|
|
120
|
+
parseApiJson,
|
|
117
121
|
parseCrmFileId,
|
|
118
122
|
pipelineOf,
|
|
119
123
|
providerCall,
|
|
120
|
-
queryTerms,
|
|
121
124
|
refuseForeignClientReads,
|
|
122
125
|
removeCrmItem,
|
|
123
|
-
searchText,
|
|
124
126
|
selectedCodes,
|
|
125
127
|
shortened,
|
|
126
128
|
syncRecorded,
|
|
127
|
-
termField,
|
|
128
|
-
timeBounds,
|
|
129
|
-
typedQuery,
|
|
130
|
-
unfilteredQuery,
|
|
131
129
|
updateCrmItem,
|
|
132
130
|
updateCrmRecord,
|
|
133
131
|
values_exports,
|
|
134
132
|
viewerOf,
|
|
135
133
|
wantedCodes,
|
|
136
134
|
withCustomFields,
|
|
137
|
-
withQuery,
|
|
138
135
|
withReadableDeal,
|
|
139
136
|
withoutFileLinks
|
|
140
|
-
} from "./chunk-
|
|
141
|
-
import "./chunk-
|
|
142
|
-
import "./chunk-73CXFE36.js";
|
|
143
|
-
import "./chunk-DXGGCGRP.js";
|
|
137
|
+
} from "./chunk-TWZF7VO6.js";
|
|
138
|
+
import "./chunk-WBWVBEHH.js";
|
|
144
139
|
import {
|
|
145
140
|
latestVersion,
|
|
146
141
|
runUpdate,
|
|
147
142
|
updateNotice
|
|
148
|
-
} from "./chunk-
|
|
149
|
-
import "./chunk-
|
|
150
|
-
import "./chunk-
|
|
151
|
-
import
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
143
|
+
} from "./chunk-2YEDK2XV.js";
|
|
144
|
+
import "./chunk-KKXF6TSS.js";
|
|
145
|
+
import "./chunk-AYR6FIXN.js";
|
|
146
|
+
import {
|
|
147
|
+
commandPath,
|
|
148
|
+
dateWindow,
|
|
149
|
+
listQuery,
|
|
150
|
+
nativeField,
|
|
151
|
+
nativeTerms,
|
|
152
|
+
queryTerms,
|
|
153
|
+
searchText,
|
|
154
|
+
termField,
|
|
155
|
+
timeBounds,
|
|
156
|
+
typedQuery,
|
|
157
|
+
unfilteredQuery,
|
|
158
|
+
withQuery,
|
|
159
|
+
withWords
|
|
160
|
+
} from "./chunk-7SBAHYZW.js";
|
|
161
|
+
import "./chunk-ORFLQGWH.js";
|
|
162
|
+
import "./chunk-SJZ52MZE.js";
|
|
163
|
+
import "./chunk-CQ472K6W.js";
|
|
164
|
+
import "./chunk-UZLT6VSP.js";
|
|
165
|
+
import "./chunk-QQT7WUR4.js";
|
|
166
|
+
import "./chunk-NJ2LJKNH.js";
|
|
167
|
+
import "./chunk-R23DRW2T.js";
|
|
159
168
|
import {
|
|
160
169
|
Argument,
|
|
161
170
|
Command,
|
|
@@ -202,13 +211,13 @@ import {
|
|
|
202
211
|
sharedCommand,
|
|
203
212
|
snakeKeys,
|
|
204
213
|
snakeKeysKeeping
|
|
205
|
-
} from "./chunk-
|
|
206
|
-
import "./chunk-
|
|
207
|
-
import "./chunk-
|
|
208
|
-
import "./chunk-
|
|
209
|
-
import "./chunk-
|
|
210
|
-
import "./chunk-
|
|
211
|
-
import "./chunk-
|
|
214
|
+
} from "./chunk-VPBSZ4HQ.js";
|
|
215
|
+
import "./chunk-SBQ5MFHM.js";
|
|
216
|
+
import "./chunk-MYMBPQPQ.js";
|
|
217
|
+
import "./chunk-YSOGGUK3.js";
|
|
218
|
+
import "./chunk-UM6SDFB6.js";
|
|
219
|
+
import "./chunk-IEAPNTHT.js";
|
|
220
|
+
import "./chunk-Q2YVY7IR.js";
|
|
212
221
|
import {
|
|
213
222
|
CRM_CHANGES,
|
|
214
223
|
CRM_SCOPES,
|
|
@@ -216,53 +225,54 @@ import {
|
|
|
216
225
|
attachmentMaxBytes,
|
|
217
226
|
crmIdentityId,
|
|
218
227
|
crmSettingKey,
|
|
219
|
-
dayIn,
|
|
220
228
|
seenBy,
|
|
221
229
|
viewerSql
|
|
222
|
-
} from "./chunk-
|
|
223
|
-
import "./chunk-
|
|
224
|
-
import
|
|
230
|
+
} from "./chunk-TCDER3G7.js";
|
|
231
|
+
import "./chunk-I4QCJZW7.js";
|
|
232
|
+
import {
|
|
233
|
+
dayIn
|
|
234
|
+
} from "./chunk-3NDMVXGS.js";
|
|
235
|
+
import "./chunk-ILUREFWJ.js";
|
|
225
236
|
import {
|
|
226
237
|
count,
|
|
227
238
|
createTaskService,
|
|
228
239
|
currentAttempt,
|
|
229
240
|
text,
|
|
230
241
|
time
|
|
231
|
-
} from "./chunk-
|
|
232
|
-
import "./chunk-
|
|
233
|
-
import "./chunk-
|
|
242
|
+
} from "./chunk-77FP6AWC.js";
|
|
243
|
+
import "./chunk-MMOEAH5G.js";
|
|
244
|
+
import "./chunk-XI75EKLG.js";
|
|
234
245
|
import {
|
|
235
246
|
hostFetch,
|
|
236
247
|
providerWaitMs,
|
|
237
248
|
readJsonResponse,
|
|
238
249
|
retryableStatus,
|
|
239
250
|
statusToCode
|
|
240
|
-
} from "./chunk-
|
|
241
|
-
import "./chunk-
|
|
242
|
-
import "./chunk-
|
|
243
|
-
import "./chunk-U7RLVJ34.js";
|
|
251
|
+
} from "./chunk-7USADF2W.js";
|
|
252
|
+
import "./chunk-3YOZTGZ6.js";
|
|
253
|
+
import "./chunk-UT3ODJMI.js";
|
|
244
254
|
import {
|
|
245
255
|
IDENTITY,
|
|
246
256
|
PACKAGE,
|
|
247
257
|
SKILL
|
|
248
|
-
} from "./chunk-
|
|
249
|
-
import "./chunk-
|
|
250
|
-
import "./chunk-
|
|
251
|
-
import "./chunk-VVHRQ46X.js";
|
|
252
|
-
import "./chunk-LSND5QYI.js";
|
|
258
|
+
} from "./chunk-XM2G62YF.js";
|
|
259
|
+
import "./chunk-FPDTIQOK.js";
|
|
260
|
+
import "./chunk-UA7C57IB.js";
|
|
253
261
|
import "./chunk-EH6ZEJGT.js";
|
|
262
|
+
import "./chunk-3RP57VDS.js";
|
|
263
|
+
import "./chunk-VD7HD25M.js";
|
|
254
264
|
import {
|
|
255
265
|
installerOf
|
|
256
|
-
} from "./chunk-
|
|
266
|
+
} from "./chunk-V3ZWYMXT.js";
|
|
257
267
|
import {
|
|
258
268
|
fieldsOf,
|
|
259
269
|
levelFor
|
|
260
|
-
} from "./chunk-
|
|
270
|
+
} from "./chunk-KZDBO2FT.js";
|
|
261
271
|
import {
|
|
262
272
|
foldName
|
|
263
|
-
} from "./chunk-
|
|
264
|
-
import "./chunk-
|
|
265
|
-
import "./chunk-
|
|
273
|
+
} from "./chunk-VEGNZPQU.js";
|
|
274
|
+
import "./chunk-PFZ7WG2B.js";
|
|
275
|
+
import "./chunk-OMH3WP7F.js";
|
|
266
276
|
import {
|
|
267
277
|
CRM_ACTIVITY_KINDS,
|
|
268
278
|
CRM_KINDS,
|
|
@@ -273,34 +283,35 @@ import {
|
|
|
273
283
|
normalCrmUserId,
|
|
274
284
|
parseDecimal,
|
|
275
285
|
scaleOf
|
|
276
|
-
} from "./chunk-
|
|
277
|
-
import "./chunk-
|
|
278
|
-
import "./chunk-
|
|
286
|
+
} from "./chunk-IYUWVMGP.js";
|
|
287
|
+
import "./chunk-EHULZEXQ.js";
|
|
288
|
+
import "./chunk-BYVDMPLX.js";
|
|
279
289
|
import {
|
|
280
290
|
SAVE_HELP,
|
|
281
291
|
defineQuery,
|
|
282
292
|
queryFieldsOf,
|
|
283
293
|
timezoneOf,
|
|
284
294
|
zonedMoment
|
|
285
|
-
} from "./chunk-
|
|
286
|
-
import "./chunk-
|
|
295
|
+
} from "./chunk-5RXH35ZA.js";
|
|
296
|
+
import "./chunk-L2ZQDTDU.js";
|
|
297
|
+
import "./chunk-QHA33ZS6.js";
|
|
287
298
|
import "./chunk-D72URWJE.js";
|
|
288
299
|
import {
|
|
289
300
|
readSecret
|
|
290
|
-
} from "./chunk-
|
|
291
|
-
import "./chunk-
|
|
292
|
-
import "./chunk-
|
|
293
|
-
import "./chunk-
|
|
294
|
-
import "./chunk-
|
|
301
|
+
} from "./chunk-VJHOBOJR.js";
|
|
302
|
+
import "./chunk-4EYPFFTN.js";
|
|
303
|
+
import "./chunk-KTLCQ7GC.js";
|
|
304
|
+
import "./chunk-GKP7CKW2.js";
|
|
305
|
+
import "./chunk-B4ITT55D.js";
|
|
295
306
|
import {
|
|
296
307
|
Credentials,
|
|
297
308
|
isMovedRun,
|
|
298
|
-
|
|
309
|
+
monotonic,
|
|
299
310
|
realSleep,
|
|
300
311
|
renderPretty,
|
|
301
312
|
resolvePaths,
|
|
302
313
|
systemKeyring
|
|
303
|
-
} from "./chunk-
|
|
314
|
+
} from "./chunk-ELJGALVX.js";
|
|
304
315
|
import {
|
|
305
316
|
array,
|
|
306
317
|
boolean,
|
|
@@ -319,22 +330,22 @@ import {
|
|
|
319
330
|
union,
|
|
320
331
|
unknown,
|
|
321
332
|
variant
|
|
322
|
-
} from "./chunk-
|
|
333
|
+
} from "./chunk-BKTLAXUK.js";
|
|
323
334
|
import "./chunk-Y5E2WNWB.js";
|
|
324
335
|
import {
|
|
325
336
|
CliError,
|
|
326
337
|
isCliError
|
|
327
|
-
} from "./chunk-
|
|
328
|
-
import "./chunk-
|
|
338
|
+
} from "./chunk-GCUFGDKE.js";
|
|
339
|
+
import "./chunk-5DPMNYQT.js";
|
|
329
340
|
import {
|
|
330
341
|
__name
|
|
331
342
|
} from "./chunk-ZVVMGPBJ.js";
|
|
332
343
|
|
|
333
344
|
// dist/program.js
|
|
334
|
-
import { join as
|
|
345
|
+
import { join as join4 } from "node:path";
|
|
335
346
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
336
347
|
|
|
337
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
348
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/update/index.js
|
|
338
349
|
import { realpathSync } from "node:fs";
|
|
339
350
|
import { fileURLToPath } from "node:url";
|
|
340
351
|
var npmRegistry = /* @__PURE__ */ __name(() => hostFetch({ hosts: ["registry.npmjs.org"] }), "npmRegistry");
|
|
@@ -399,643 +410,6 @@ var appUpdate = /* @__PURE__ */ __name((app) => {
|
|
|
399
410
|
};
|
|
400
411
|
}, "appUpdate");
|
|
401
412
|
|
|
402
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/oauth/authorize.js
|
|
403
|
-
import { createHash, randomBytes } from "node:crypto";
|
|
404
|
-
import { createServer } from "node:http";
|
|
405
|
-
var DEFAULT_TIMEOUT_MS = 3e5;
|
|
406
|
-
var pkce = /* @__PURE__ */ __name(() => {
|
|
407
|
-
const codeVerifier = randomBytes(48).toString("base64url");
|
|
408
|
-
return { codeVerifier, codeChallenge: createHash("sha256").update(codeVerifier).digest("base64url") };
|
|
409
|
-
}, "pkce");
|
|
410
|
-
var queryOf = /* @__PURE__ */ __name((text4) => {
|
|
411
|
-
const trimmed = text4.trim();
|
|
412
|
-
const start = trimmed.indexOf("?");
|
|
413
|
-
return new URLSearchParams(start >= 0 ? trimmed.slice(start + 1).split("#")[0] : trimmed);
|
|
414
|
-
}, "queryOf");
|
|
415
|
-
var authorize = /* @__PURE__ */ __name(async (options) => {
|
|
416
|
-
const { provider } = options;
|
|
417
|
-
const cancelled = /* @__PURE__ */ __name(() => isCliError(options.signal?.reason) ? options.signal.reason : new CliError("cancelled", `${provider.name} sign-in was cancelled`), "cancelled");
|
|
418
|
-
if (options.signal?.aborted)
|
|
419
|
-
throw cancelled();
|
|
420
|
-
const { codeVerifier, codeChallenge } = pkce();
|
|
421
|
-
const paste = new AbortController();
|
|
422
|
-
let state = "";
|
|
423
|
-
let settled = false;
|
|
424
|
-
let accept = /* @__PURE__ */ __name(() => {
|
|
425
|
-
}, "accept");
|
|
426
|
-
let fail = /* @__PURE__ */ __name(() => {
|
|
427
|
-
}, "fail");
|
|
428
|
-
const code = new Promise((resolve2, reject) => {
|
|
429
|
-
accept = /* @__PURE__ */ __name((value) => {
|
|
430
|
-
settled = true;
|
|
431
|
-
resolve2(value);
|
|
432
|
-
}, "accept");
|
|
433
|
-
fail = /* @__PURE__ */ __name((error) => {
|
|
434
|
-
settled = true;
|
|
435
|
-
reject(error);
|
|
436
|
-
}, "fail");
|
|
437
|
-
});
|
|
438
|
-
void code.catch(() => {
|
|
439
|
-
});
|
|
440
|
-
const settle = /* @__PURE__ */ __name((query) => {
|
|
441
|
-
const value = query.get("code");
|
|
442
|
-
if (value)
|
|
443
|
-
accept(value);
|
|
444
|
-
else
|
|
445
|
-
fail(new CliError("authentication_error", `${provider.name} sign-in was declined`, { reason: "oauth.declined" }));
|
|
446
|
-
}, "settle");
|
|
447
|
-
const handler = /* @__PURE__ */ __name((request, response) => {
|
|
448
|
-
let url;
|
|
449
|
-
try {
|
|
450
|
-
url = new URL(request.url ?? "/", "http://127.0.0.1");
|
|
451
|
-
} catch {
|
|
452
|
-
response.writeHead(400).end();
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
if (request.method !== "GET" || url.pathname !== "/callback") {
|
|
456
|
-
response.writeHead(404).end();
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
if (settled || !state || url.searchParams.get("state") !== state) {
|
|
460
|
-
response.writeHead(400).end("This sign-in link does not belong to the waiting sign-in");
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
if (!url.searchParams.get("code") && !url.searchParams.get("error")) {
|
|
464
|
-
response.writeHead(400).end("Missing sign-in result");
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
response.end("Sign-in received; you can close this tab");
|
|
468
|
-
settle(url.searchParams);
|
|
469
|
-
}, "handler");
|
|
470
|
-
const server = createServer(handler);
|
|
471
|
-
const localhost = provider.redirect.kind === "loopback" && provider.redirect.host === "localhost";
|
|
472
|
-
const server6 = localhost ? createServer(handler) : void 0;
|
|
473
|
-
const onAbort = /* @__PURE__ */ __name(() => fail(cancelled()), "onAbort");
|
|
474
|
-
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
475
|
-
const timer = setTimeout(() => fail(new CliError("timeout", `${provider.name} sign-in timed out`, { reason: "oauth.timeout" })), options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
476
|
-
try {
|
|
477
|
-
await new Promise((resolve2, reject) => {
|
|
478
|
-
server.once("error", reject);
|
|
479
|
-
server.listen(0, "127.0.0.1", resolve2);
|
|
480
|
-
});
|
|
481
|
-
const address = server.address();
|
|
482
|
-
if (!address || typeof address === "string")
|
|
483
|
-
throw new CliError("configuration_error", "could not start the local sign-in listener");
|
|
484
|
-
if (server6) {
|
|
485
|
-
server6.on("error", () => {
|
|
486
|
-
});
|
|
487
|
-
await new Promise((resolve2) => {
|
|
488
|
-
server6.once("error", () => resolve2());
|
|
489
|
-
server6.listen(address.port, "::1", () => resolve2());
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
const random = randomBytes(32).toString("base64url");
|
|
493
|
-
const relay = provider.redirect.kind === "relay";
|
|
494
|
-
state = relay ? `${address.port}.${random}` : random;
|
|
495
|
-
const redirectUri = provider.redirect.kind === "relay" ? provider.redirect.url : `http://${localhost ? "localhost" : "127.0.0.1"}:${address.port}/callback`;
|
|
496
|
-
const url = new URL(provider.authorizeUrl);
|
|
497
|
-
for (const [key, value] of Object.entries({
|
|
498
|
-
...provider.authorizeParams,
|
|
499
|
-
response_type: "code",
|
|
500
|
-
client_id: provider.client.clientId,
|
|
501
|
-
redirect_uri: redirectUri,
|
|
502
|
-
...options.scopes.length ? { scope: options.scopes.join(" ") } : {},
|
|
503
|
-
state,
|
|
504
|
-
code_challenge: codeChallenge,
|
|
505
|
-
code_challenge_method: "S256"
|
|
506
|
-
}))
|
|
507
|
-
url.searchParams.set(key, value);
|
|
508
|
-
options.showUrl?.(url.toString());
|
|
509
|
-
options.readPaste?.(paste.signal).then((text4) => {
|
|
510
|
-
if (settled)
|
|
511
|
-
return;
|
|
512
|
-
const query = queryOf(text4);
|
|
513
|
-
if (query.get("state") !== state || !query.get("code") && !query.get("error"))
|
|
514
|
-
fail(new CliError("authentication_error", "the pasted sign-in result does not match this sign-in", {
|
|
515
|
-
reason: "oauth.mismatch"
|
|
516
|
-
}));
|
|
517
|
-
else
|
|
518
|
-
settle(query);
|
|
519
|
-
}).catch(() => {
|
|
520
|
-
});
|
|
521
|
-
void Promise.resolve().then(() => options.openBrowser(url.toString())).catch(() => {
|
|
522
|
-
if (!options.readPaste && !options.showUrl)
|
|
523
|
-
fail(new CliError("configuration_error", "could not open the browser, and no sign-in link can be shown"));
|
|
524
|
-
});
|
|
525
|
-
return { code: await code, redirectUri, codeVerifier };
|
|
526
|
-
} finally {
|
|
527
|
-
clearTimeout(timer);
|
|
528
|
-
options.signal?.removeEventListener("abort", onAbort);
|
|
529
|
-
paste.abort();
|
|
530
|
-
for (const each of server6 ? [server, server6] : [server]) {
|
|
531
|
-
each.closeAllConnections();
|
|
532
|
-
if (each.listening)
|
|
533
|
-
await new Promise((resolve2) => each.close(() => resolve2()));
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}, "authorize");
|
|
537
|
-
|
|
538
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/oauth/keeper.js
|
|
539
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
540
|
-
import { join } from "node:path";
|
|
541
|
-
import { setTimeout as delay } from "node:timers/promises";
|
|
542
|
-
|
|
543
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/oauth/requests.js
|
|
544
|
-
var REQUEST_LIMIT_MS = 3e4;
|
|
545
|
-
var TOKEN_LOG_EVENT = "oauth.token";
|
|
546
|
-
var object = /* @__PURE__ */ __name((value) => {
|
|
547
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
548
|
-
throw new Error("not an object");
|
|
549
|
-
return value;
|
|
550
|
-
}, "object");
|
|
551
|
-
var requestSignal = /* @__PURE__ */ __name((deadline, signal) => signal ? AbortSignal.any([signal, deadline]) : deadline, "requestSignal");
|
|
552
|
-
var cancelledBy = /* @__PURE__ */ __name((signal) => {
|
|
553
|
-
if (!signal?.aborted)
|
|
554
|
-
return;
|
|
555
|
-
throw isCliError(signal.reason) ? signal.reason : new CliError("cancelled", "sign-in was cancelled");
|
|
556
|
-
}, "cancelledBy");
|
|
557
|
-
var TRANSIENT = /* @__PURE__ */ new Set([
|
|
558
|
-
"EAI_AGAIN",
|
|
559
|
-
"ENOTFOUND",
|
|
560
|
-
"ECONNRESET",
|
|
561
|
-
"ECONNREFUSED",
|
|
562
|
-
"ETIMEDOUT",
|
|
563
|
-
"EPIPE",
|
|
564
|
-
"UND_ERR_SOCKET"
|
|
565
|
-
]);
|
|
566
|
-
var ATTEMPTS = 3;
|
|
567
|
-
var transientNetworkError = /* @__PURE__ */ __name((error) => {
|
|
568
|
-
if (isCliError(error))
|
|
569
|
-
return error.code === "network_error";
|
|
570
|
-
for (let at2 = error, depth = 0; at2 instanceof Error && depth < 4; at2 = at2.cause, depth++) {
|
|
571
|
-
const code = at2.code;
|
|
572
|
-
if (typeof code === "string" && TRANSIENT.has(code))
|
|
573
|
-
return true;
|
|
574
|
-
}
|
|
575
|
-
return false;
|
|
576
|
-
}, "transientNetworkError");
|
|
577
|
-
var post = /* @__PURE__ */ __name(async (url, body, context, deadline) => {
|
|
578
|
-
const signal = requestSignal(deadline, context.signal);
|
|
579
|
-
for (let attempt = 1; ; attempt++) {
|
|
580
|
-
cancelledBy(context.signal);
|
|
581
|
-
try {
|
|
582
|
-
return await context.fetch(url, {
|
|
583
|
-
method: "POST",
|
|
584
|
-
headers: { "content-type": "application/x-www-form-urlencoded", accept: "application/json" },
|
|
585
|
-
body,
|
|
586
|
-
signal,
|
|
587
|
-
redirect: "error"
|
|
588
|
-
});
|
|
589
|
-
} catch (error) {
|
|
590
|
-
cancelledBy(context.signal);
|
|
591
|
-
if (attempt >= ATTEMPTS || signal.aborted || !transientNetworkError(error))
|
|
592
|
-
return void 0;
|
|
593
|
-
const waited = await realSleep(500 * attempt, signal).then(() => true, () => false);
|
|
594
|
-
cancelledBy(context.signal);
|
|
595
|
-
if (!waited)
|
|
596
|
-
return void 0;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
}, "post");
|
|
600
|
-
var clientFields = /* @__PURE__ */ __name(({ client }) => ({
|
|
601
|
-
client_id: client.clientId,
|
|
602
|
-
...client.clientSecret ? { client_secret: client.clientSecret } : {}
|
|
603
|
-
}), "clientFields");
|
|
604
|
-
var requestTokens = /* @__PURE__ */ __name((provider, params, context) => withTimeLimit(REQUEST_LIMIT_MS, (deadline) => exchangeTokens(provider, params, context, deadline)), "requestTokens");
|
|
605
|
-
var exchangeTokens = /* @__PURE__ */ __name(async (provider, params, context, deadline) => {
|
|
606
|
-
const operation = params.grant_type ?? "unknown";
|
|
607
|
-
const record2 = /* @__PURE__ */ __name((level, fields) => context.log?.[level]({ event: TOKEN_LOG_EVENT, provider: provider.id, operation, pid: process.pid, ...fields }), "record");
|
|
608
|
-
const again = `run ${context.signInCommand} again`;
|
|
609
|
-
const response = await post(provider.tokenUrl, new URLSearchParams({ ...params, ...clientFields(context) }), context, deadline);
|
|
610
|
-
if (!response) {
|
|
611
|
-
record2("warn", { outcome: "no_response" });
|
|
612
|
-
throw new CliError("outcome_unknown", `${provider.name} token request did not finish; ${again} if it keeps failing`, {
|
|
613
|
-
reason: "oauth.no-response"
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
if (!response.ok) {
|
|
617
|
-
record2("warn", { outcome: "rejected", status: response.status });
|
|
618
|
-
if (response.status === 429 || response.status >= 500)
|
|
619
|
-
throw new CliError("provider_unavailable", `${provider.name} token request failed (HTTP ${response.status})`, {
|
|
620
|
-
status: response.status,
|
|
621
|
-
retryable: true,
|
|
622
|
-
reason: "oauth.unavailable"
|
|
623
|
-
});
|
|
624
|
-
throw new CliError("authentication_error", `${provider.name} sign-in was refused (HTTP ${response.status}); ${again}`, {
|
|
625
|
-
status: response.status,
|
|
626
|
-
reason: "oauth.expired"
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
let body;
|
|
630
|
-
try {
|
|
631
|
-
body = object(await response.json());
|
|
632
|
-
} catch {
|
|
633
|
-
record2("error", { outcome: "unreadable_response", status: response.status });
|
|
634
|
-
throw new CliError("invalid_response", `${provider.name} returned an unreadable token response; ${again}`, {
|
|
635
|
-
reason: "oauth.invalid-response"
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
const previous = context.previous;
|
|
639
|
-
const refreshToken = typeof body.refresh_token === "string" && body.refresh_token ? body.refresh_token : previous?.refreshToken;
|
|
640
|
-
const expiresIn = body.expires_in;
|
|
641
|
-
if (typeof body.access_token !== "string" || !body.access_token || expiresIn !== void 0 && (typeof expiresIn !== "number" || !Number.isFinite(expiresIn) || expiresIn <= 0) || body.scope !== void 0 && typeof body.scope !== "string" || body.token_type !== void 0 && typeof body.token_type !== "string") {
|
|
642
|
-
record2("error", { outcome: "invalid_response", status: response.status });
|
|
643
|
-
throw new CliError("invalid_response", `${provider.name} returned an invalid token response; ${again}`, {
|
|
644
|
-
reason: "oauth.invalid-response"
|
|
645
|
-
});
|
|
646
|
-
}
|
|
647
|
-
if (!refreshToken) {
|
|
648
|
-
record2("error", { outcome: "no_refresh_token", status: response.status });
|
|
649
|
-
throw new CliError("authentication_error", `${provider.name} returned no offline refresh token; ${again}`, {
|
|
650
|
-
reason: "oauth.failed"
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
const scopes = typeof body.scope === "string" ? body.scope.split(/\s+/).filter(Boolean) : previous?.scopes ?? [];
|
|
654
|
-
const tokenType = typeof body.token_type === "string" ? body.token_type : previous?.tokenType;
|
|
655
|
-
record2("info", {
|
|
656
|
-
outcome: "received",
|
|
657
|
-
status: response.status,
|
|
658
|
-
...previous ? { rotated: refreshToken !== previous.refreshToken } : {}
|
|
659
|
-
});
|
|
660
|
-
return {
|
|
661
|
-
accessToken: body.access_token,
|
|
662
|
-
refreshToken,
|
|
663
|
-
...typeof expiresIn === "number" ? { expiresAt: context.now() + expiresIn * 1e3 } : {},
|
|
664
|
-
scopes,
|
|
665
|
-
...tokenType ? { tokenType } : {}
|
|
666
|
-
};
|
|
667
|
-
}, "exchangeTokens");
|
|
668
|
-
var alreadyRevoked = /* @__PURE__ */ __name(async (response) => {
|
|
669
|
-
if (response.status !== 400)
|
|
670
|
-
return false;
|
|
671
|
-
try {
|
|
672
|
-
return object(JSON.parse(await response.text())).error === "invalid_token";
|
|
673
|
-
} catch {
|
|
674
|
-
return false;
|
|
675
|
-
}
|
|
676
|
-
}, "alreadyRevoked");
|
|
677
|
-
var revokeToken = /* @__PURE__ */ __name(async (provider, tokens, context) => {
|
|
678
|
-
if (provider.revoke)
|
|
679
|
-
return provider.revoke(tokens, context);
|
|
680
|
-
if (!provider.revokeUrl)
|
|
681
|
-
throw new CliError("validation_error", `${provider.name} declares no way to revoke a sign-in`);
|
|
682
|
-
const { revokeUrl } = provider;
|
|
683
|
-
const form = new URLSearchParams({ token: tokens.refreshToken, ...clientFields(context) });
|
|
684
|
-
const { response, gone } = await withTimeLimit(REQUEST_LIMIT_MS, async (deadline) => {
|
|
685
|
-
const response2 = await post(revokeUrl, form, context, deadline);
|
|
686
|
-
return { response: response2, gone: response2 ? await alreadyRevoked(response2) : false };
|
|
687
|
-
});
|
|
688
|
-
const done = response?.ok || gone;
|
|
689
|
-
context.log?.[done ? "info" : "warn"]({
|
|
690
|
-
event: TOKEN_LOG_EVENT,
|
|
691
|
-
provider: provider.id,
|
|
692
|
-
operation: "revoke",
|
|
693
|
-
pid: process.pid,
|
|
694
|
-
outcome: response?.ok ? "revoked" : gone ? "already_revoked" : response ? "rejected" : "no_response",
|
|
695
|
-
...response ? { status: response.status } : {}
|
|
696
|
-
});
|
|
697
|
-
if (!done)
|
|
698
|
-
throw new CliError("outcome_unknown", `${provider.name} did not confirm the revoke`, {
|
|
699
|
-
reason: "oauth.revoke-failed",
|
|
700
|
-
...response ? { status: response.status } : {}
|
|
701
|
-
});
|
|
702
|
-
}, "revokeToken");
|
|
703
|
-
|
|
704
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/oauth/keeper.js
|
|
705
|
-
var inFlight = /* @__PURE__ */ new Map();
|
|
706
|
-
var refreshedInMemory = /* @__PURE__ */ new Map();
|
|
707
|
-
var tokenKeeper = /* @__PURE__ */ __name((options) => {
|
|
708
|
-
const { provider, storage, signal, log } = options;
|
|
709
|
-
const now = options.now ?? Date.now;
|
|
710
|
-
const fresh = /* @__PURE__ */ __name((tokens2) => Boolean(tokens2.accessToken) && tokens2.expiresAt !== void 0 && tokens2.expiresAt > now() + (options.freshForMs ?? 6e4), "fresh");
|
|
711
|
-
const lockPath = join(options.lockDir, `oauth-${createHash2("sha256").update(storage.key).digest("hex").slice(0, 16)}.lock`);
|
|
712
|
-
const clientOf = /* @__PURE__ */ __name((stored) => {
|
|
713
|
-
const saved = stored?.client;
|
|
714
|
-
if (!saved || saved.clientSecret || saved.clientId !== provider.client.clientId)
|
|
715
|
-
return saved ?? provider.client;
|
|
716
|
-
return provider.client;
|
|
717
|
-
}, "clientOf");
|
|
718
|
-
const context = /* @__PURE__ */ __name((client, previous) => ({
|
|
719
|
-
fetch: options.fetch,
|
|
720
|
-
client,
|
|
721
|
-
now,
|
|
722
|
-
signInCommand: options.signInCommand,
|
|
723
|
-
...signal ? { signal } : {},
|
|
724
|
-
...log ? { log } : {},
|
|
725
|
-
...previous ? { previous } : {}
|
|
726
|
-
}), "context");
|
|
727
|
-
const exchange2 = /* @__PURE__ */ __name((params, ctx) => provider.exchange ? provider.exchange(params, ctx) : requestTokens(provider, params, ctx), "exchange");
|
|
728
|
-
const notSignedIn = /* @__PURE__ */ __name(() => new CliError("authentication_error", `not signed in to ${provider.name}; run ${options.signInCommand}`, {
|
|
729
|
-
reason: "session.missing"
|
|
730
|
-
}), "notSignedIn");
|
|
731
|
-
const busy = /* @__PURE__ */ __name((error) => isCliError(error) && error.details.reason === "file.locked", "busy");
|
|
732
|
-
const acquire = /* @__PURE__ */ __name(async () => {
|
|
733
|
-
const started = performance.now();
|
|
734
|
-
let waiting = false;
|
|
735
|
-
for (; ; ) {
|
|
736
|
-
try {
|
|
737
|
-
return await acquireLock(lockPath, signal ? { signal } : {});
|
|
738
|
-
} catch (error) {
|
|
739
|
-
if (!busy(error))
|
|
740
|
-
throw error;
|
|
741
|
-
if (!waiting) {
|
|
742
|
-
waiting = true;
|
|
743
|
-
log?.info({
|
|
744
|
-
event: TOKEN_LOG_EVENT,
|
|
745
|
-
provider: provider.id,
|
|
746
|
-
operation: "lock",
|
|
747
|
-
outcome: "waiting",
|
|
748
|
-
pid: process.pid
|
|
749
|
-
});
|
|
750
|
-
}
|
|
751
|
-
if (performance.now() - started > (options.lockWaitMs ?? 45e3))
|
|
752
|
-
throw new CliError("provider_unavailable", `another process holds this ${provider.name} sign-in; retry`, {
|
|
753
|
-
reason: "oauth.locked",
|
|
754
|
-
retryable: true
|
|
755
|
-
});
|
|
756
|
-
await delay(options.lockRetryMs ?? 50, void 0, signal ? { signal } : {}).catch(() => {
|
|
757
|
-
throw new CliError("cancelled", `${provider.name} sign-in was cancelled`);
|
|
758
|
-
});
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
}, "acquire");
|
|
762
|
-
const locked = /* @__PURE__ */ __name(async (work) => {
|
|
763
|
-
const lock = await acquire();
|
|
764
|
-
try {
|
|
765
|
-
return await work();
|
|
766
|
-
} finally {
|
|
767
|
-
await lock.release().catch(() => {
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
}, "locked");
|
|
771
|
-
const shared2 = /* @__PURE__ */ __name((work) => {
|
|
772
|
-
const running = inFlight.get(lockPath);
|
|
773
|
-
if (running)
|
|
774
|
-
return running;
|
|
775
|
-
const started = locked(work).finally(() => inFlight.delete(lockPath));
|
|
776
|
-
inFlight.set(lockPath, started);
|
|
777
|
-
return started;
|
|
778
|
-
}, "shared");
|
|
779
|
-
const remembered = /* @__PURE__ */ __name((saved) => {
|
|
780
|
-
const kept = refreshedInMemory.get(lockPath);
|
|
781
|
-
return kept && fresh(kept) && kept.refreshToken === saved.refreshToken ? kept : void 0;
|
|
782
|
-
}, "remembered");
|
|
783
|
-
const forget = /* @__PURE__ */ __name(() => refreshedInMemory.delete(lockPath), "forget");
|
|
784
|
-
let answered;
|
|
785
|
-
const answer2 = /* @__PURE__ */ __name((given) => {
|
|
786
|
-
answered = given;
|
|
787
|
-
return given;
|
|
788
|
-
}, "answer");
|
|
789
|
-
const tokens = /* @__PURE__ */ __name(async ({ refresh = false } = {}) => {
|
|
790
|
-
const seen = storage.read();
|
|
791
|
-
if (!seen)
|
|
792
|
-
throw notSignedIn();
|
|
793
|
-
if (!refresh) {
|
|
794
|
-
const kept = remembered(seen.tokens);
|
|
795
|
-
if (kept)
|
|
796
|
-
return answer2(kept);
|
|
797
|
-
if (fresh(seen.tokens))
|
|
798
|
-
return answer2(seen.tokens);
|
|
799
|
-
}
|
|
800
|
-
const refused2 = answered ?? remembered(seen.tokens) ?? seen.tokens;
|
|
801
|
-
return answer2(await shared2(async () => {
|
|
802
|
-
const current = storage.read();
|
|
803
|
-
if (!current)
|
|
804
|
-
throw notSignedIn();
|
|
805
|
-
const latest = remembered(current.tokens) ?? current.tokens;
|
|
806
|
-
if (refresh) {
|
|
807
|
-
if (latest.accessToken !== refused2.accessToken && fresh(latest))
|
|
808
|
-
return latest;
|
|
809
|
-
} else {
|
|
810
|
-
if (latest !== current.tokens)
|
|
811
|
-
return latest;
|
|
812
|
-
if (fresh(current.tokens) || current.tokens.refreshToken !== seen.tokens.refreshToken)
|
|
813
|
-
return current.tokens;
|
|
814
|
-
}
|
|
815
|
-
if (storage.moved && storage.rotating)
|
|
816
|
-
throw new CliError("authentication_error", `the sign-in to ${provider.name} needs a refresh, which a run with moved folders never makes: the provider rotates its refresh token, and the owner's own sign-in would keep a dead one; run this in the normal run, or sign in again there`, { reason: "oauth.moved-rotating" });
|
|
817
|
-
const client = clientOf(current);
|
|
818
|
-
const refreshed = await exchange2({ grant_type: "refresh_token", refresh_token: current.tokens.refreshToken }, context(client, current.tokens));
|
|
819
|
-
if (storage.moved && refreshed.refreshToken === current.tokens.refreshToken)
|
|
820
|
-
refreshedInMemory.set(lockPath, refreshed);
|
|
821
|
-
else
|
|
822
|
-
storage.write({ tokens: refreshed, client });
|
|
823
|
-
return refreshed;
|
|
824
|
-
}));
|
|
825
|
-
}, "tokens");
|
|
826
|
-
return {
|
|
827
|
-
tokens,
|
|
828
|
-
accessToken: /* @__PURE__ */ __name(async (tokensOptions) => {
|
|
829
|
-
const current = await tokens(tokensOptions);
|
|
830
|
-
if (!current.accessToken)
|
|
831
|
-
throw notSignedIn();
|
|
832
|
-
return current.accessToken;
|
|
833
|
-
}, "accessToken"),
|
|
834
|
-
signIn: /* @__PURE__ */ __name(async ({ accept, ...authorizeOptions }) => {
|
|
835
|
-
storage.probe();
|
|
836
|
-
const authorization = await authorize({ ...authorizeOptions, provider, ...signal ? { signal } : {} });
|
|
837
|
-
const client = provider.client;
|
|
838
|
-
const received = await exchange2({
|
|
839
|
-
grant_type: "authorization_code",
|
|
840
|
-
code: authorization.code,
|
|
841
|
-
redirect_uri: authorization.redirectUri,
|
|
842
|
-
code_verifier: authorization.codeVerifier
|
|
843
|
-
}, context(client));
|
|
844
|
-
const extra = await accept?.(received) ?? void 0;
|
|
845
|
-
await locked(async () => {
|
|
846
|
-
forget();
|
|
847
|
-
storage.write({ tokens: received, client, ...extra ? { extra } : {} }, { signIn: true });
|
|
848
|
-
});
|
|
849
|
-
return { scopes: received.scopes };
|
|
850
|
-
}, "signIn"),
|
|
851
|
-
save: /* @__PURE__ */ __name((saved, extra) => locked(async () => {
|
|
852
|
-
forget();
|
|
853
|
-
storage.write({ tokens: saved, client: clientOf(storage.read()), ...extra ? { extra } : {} }, { signIn: true });
|
|
854
|
-
}), "save"),
|
|
855
|
-
signOut: /* @__PURE__ */ __name(({ revoke = false } = {}) => locked(async () => {
|
|
856
|
-
forget();
|
|
857
|
-
const current = storage.read();
|
|
858
|
-
let revoked = false;
|
|
859
|
-
if (revoke && current) {
|
|
860
|
-
await revokeToken(provider, current.tokens, context(clientOf(current)));
|
|
861
|
-
revoked = true;
|
|
862
|
-
}
|
|
863
|
-
return { revoked, removed: storage.remove() };
|
|
864
|
-
}), "signOut")
|
|
865
|
-
};
|
|
866
|
-
}, "tokenKeeper");
|
|
867
|
-
|
|
868
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.691.0_@wirecat+cli-base@0.113.0_commander@15.0.0_esbuild@0.28.2_typ_9a2e508bb6f63e7e29f0d776540ec8fd/node_modules/@wirecat/cli-core/dist/oauth/storage.js
|
|
869
|
-
var invalid = /* @__PURE__ */ __name(() => new CliError("authentication_error", "the saved sign-in cannot be read; sign in again", { reason: "oauth.invalid" }), "invalid");
|
|
870
|
-
var parse = /* @__PURE__ */ __name((raw) => {
|
|
871
|
-
let value;
|
|
872
|
-
try {
|
|
873
|
-
value = JSON.parse(raw);
|
|
874
|
-
} catch {
|
|
875
|
-
throw invalid();
|
|
876
|
-
}
|
|
877
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
878
|
-
throw invalid();
|
|
879
|
-
return value;
|
|
880
|
-
}, "parse");
|
|
881
|
-
var text2 = /* @__PURE__ */ __name((value) => typeof value === "string" && value ? value : void 0, "text");
|
|
882
|
-
var finite = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) ? value : void 0, "finite");
|
|
883
|
-
var previousOf = /* @__PURE__ */ __name((raw) => {
|
|
884
|
-
if (raw === void 0)
|
|
885
|
-
return {};
|
|
886
|
-
try {
|
|
887
|
-
return parse(raw);
|
|
888
|
-
} catch {
|
|
889
|
-
return {};
|
|
890
|
-
}
|
|
891
|
-
}, "previousOf");
|
|
892
|
-
var defined = /* @__PURE__ */ __name((value) => Object.fromEntries(Object.entries(value).filter(([, field]) => field !== void 0)), "defined");
|
|
893
|
-
var oauthAccount = /* @__PURE__ */ __name((providerId, profile) => {
|
|
894
|
-
if (!profile.trim())
|
|
895
|
-
throw new CliError("validation_error", "name a profile: a sign-in always belongs to one", {
|
|
896
|
-
reason: "profile.missing"
|
|
897
|
-
});
|
|
898
|
-
return `oauth:${providerId}:${profile}`;
|
|
899
|
-
}, "oauthAccount");
|
|
900
|
-
var standardCodec = /* @__PURE__ */ __name((providerId) => ({
|
|
901
|
-
decode: /* @__PURE__ */ __name((raw) => {
|
|
902
|
-
const value = parse(raw);
|
|
903
|
-
const refreshToken = text2(value.refreshToken);
|
|
904
|
-
const clientId = text2(value.clientId);
|
|
905
|
-
if (value.version !== 1 || value.provider !== providerId || !refreshToken || !clientId)
|
|
906
|
-
throw invalid();
|
|
907
|
-
if (!Array.isArray(value.scopes) || !value.scopes.every((scope) => typeof scope === "string"))
|
|
908
|
-
throw invalid();
|
|
909
|
-
const source = text2(value.clientSource);
|
|
910
|
-
return {
|
|
911
|
-
client: defined({ clientId, clientSecret: text2(value.clientSecret), source }),
|
|
912
|
-
tokens: defined({
|
|
913
|
-
accessToken: text2(value.accessToken),
|
|
914
|
-
refreshToken,
|
|
915
|
-
expiresAt: finite(value.expiresAt),
|
|
916
|
-
scopes: value.scopes,
|
|
917
|
-
tokenType: text2(value.tokenType)
|
|
918
|
-
})
|
|
919
|
-
};
|
|
920
|
-
}, "decode"),
|
|
921
|
-
encode: /* @__PURE__ */ __name(({ tokens, client, previous, extra }) => JSON.stringify(defined({
|
|
922
|
-
...previousOf(previous),
|
|
923
|
-
...extra,
|
|
924
|
-
version: 1,
|
|
925
|
-
provider: providerId,
|
|
926
|
-
clientId: client.clientId,
|
|
927
|
-
// Only WireCat's secret, which is public: a later release may ship another default app, and a refresh needs
|
|
928
|
-
// the secret of the app that signed in. An owner's own secret stays where the owner keeps it.
|
|
929
|
-
clientSecret: client.source === "constants" ? client.clientSecret : void 0,
|
|
930
|
-
clientSource: client.source,
|
|
931
|
-
accessToken: tokens.accessToken,
|
|
932
|
-
refreshToken: tokens.refreshToken,
|
|
933
|
-
expiresAt: tokens.expiresAt,
|
|
934
|
-
scopes: tokens.scopes,
|
|
935
|
-
tokenType: tokens.tokenType
|
|
936
|
-
})), "encode")
|
|
937
|
-
}), "standardCodec");
|
|
938
|
-
var googleStandard = standardCodec("google");
|
|
939
|
-
var accountTokenCodec = /* @__PURE__ */ __name((providerId) => {
|
|
940
|
-
const standard = standardCodec(providerId);
|
|
941
|
-
return {
|
|
942
|
-
rotating: true,
|
|
943
|
-
decode: /* @__PURE__ */ __name((raw) => {
|
|
944
|
-
const stored = standard.decode(raw);
|
|
945
|
-
const value = parse(raw);
|
|
946
|
-
const clientSecret = text2(value.clientSecret);
|
|
947
|
-
const host = text2(value.host);
|
|
948
|
-
const userId = text2(value.userId);
|
|
949
|
-
if (!host || !userId || !clientSecret)
|
|
950
|
-
throw invalid();
|
|
951
|
-
return { ...stored, client: { ...stored.client, clientSecret }, account: { host, userId } };
|
|
952
|
-
}, "decode"),
|
|
953
|
-
encode: /* @__PURE__ */ __name((input) => {
|
|
954
|
-
const entry = parse(standard.encode(input));
|
|
955
|
-
const from = input.signIn ? input.extra ?? {} : entry;
|
|
956
|
-
if (!input.client.clientSecret || typeof from.host !== "string" || typeof from.userId !== "string")
|
|
957
|
-
throw new CliError("configuration_error", "an account-bound sign-in needs the app's secret, its host and user");
|
|
958
|
-
entry.clientSecret = input.client.clientSecret;
|
|
959
|
-
return JSON.stringify(entry);
|
|
960
|
-
}, "encode")
|
|
961
|
-
};
|
|
962
|
-
}, "accountTokenCodec");
|
|
963
|
-
var keyringFailure = /* @__PURE__ */ __name((thrown, secret) => {
|
|
964
|
-
const failure = new CliError("configuration_error", "could not reach the saved sign-in; use an available keyring or file storage", { reason: "oauth.not-saved" });
|
|
965
|
-
const words = thrown instanceof Error ? thrown.message : String(thrown);
|
|
966
|
-
failure.cause = new Error(secret ? words.replaceAll(secret, "[secret]") : words);
|
|
967
|
-
return failure;
|
|
968
|
-
}, "keyringFailure");
|
|
969
|
-
var credentialStorage = /* @__PURE__ */ __name((options) => {
|
|
970
|
-
if (!options.credentials.keyring)
|
|
971
|
-
throw new CliError("configuration_error", "a sign-in store needs its keyring passed in, never a default");
|
|
972
|
-
const credentials = new Credentials(options.credentials);
|
|
973
|
-
const { account: account2, codec } = options;
|
|
974
|
-
const moved = options.credentials.isolated === true || options.credentials.keyring === systemKeyring && isMovedRun({ appName: options.credentials.service, env: options.credentials.env ?? process.env });
|
|
975
|
-
const service = keyringService(options.credentials.service, options.credentials.configDir, options.credentials.isolated);
|
|
976
|
-
const raw = /* @__PURE__ */ __name((name) => {
|
|
977
|
-
try {
|
|
978
|
-
return credentials.read(name)?.secret;
|
|
979
|
-
} catch (error) {
|
|
980
|
-
if (error instanceof CliError)
|
|
981
|
-
throw error;
|
|
982
|
-
throw keyringFailure(error);
|
|
983
|
-
}
|
|
984
|
-
}, "raw");
|
|
985
|
-
const fallsBack = options.credentials.storage !== "keyring";
|
|
986
|
-
const replaced = /* @__PURE__ */ __name((name) => {
|
|
987
|
-
try {
|
|
988
|
-
return raw(name);
|
|
989
|
-
} catch (error) {
|
|
990
|
-
if (fallsBack && error instanceof CliError && error.details.reason === "keyring.unreachable")
|
|
991
|
-
return void 0;
|
|
992
|
-
throw error;
|
|
993
|
-
}
|
|
994
|
-
}, "replaced");
|
|
995
|
-
const save = /* @__PURE__ */ __name((value, writeOptions) => {
|
|
996
|
-
try {
|
|
997
|
-
credentials.write(account2, value, writeOptions);
|
|
998
|
-
} catch (error) {
|
|
999
|
-
throw keyringFailure(error, value);
|
|
1000
|
-
}
|
|
1001
|
-
}, "save");
|
|
1002
|
-
const current = /* @__PURE__ */ __name(() => {
|
|
1003
|
-
const own = raw(account2);
|
|
1004
|
-
if (own !== void 0)
|
|
1005
|
-
return own;
|
|
1006
|
-
for (const legacy of options.legacyAccounts ?? []) {
|
|
1007
|
-
const found = raw(legacy);
|
|
1008
|
-
if (found === void 0)
|
|
1009
|
-
continue;
|
|
1010
|
-
codec.decode(found);
|
|
1011
|
-
if (!moved)
|
|
1012
|
-
save(found);
|
|
1013
|
-
return found;
|
|
1014
|
-
}
|
|
1015
|
-
return void 0;
|
|
1016
|
-
}, "current");
|
|
1017
|
-
return {
|
|
1018
|
-
key: `${service}\0${account2}`,
|
|
1019
|
-
moved,
|
|
1020
|
-
...codec.rotating ? { rotating: true } : {},
|
|
1021
|
-
probe: /* @__PURE__ */ __name(() => {
|
|
1022
|
-
replaced(account2);
|
|
1023
|
-
}, "probe"),
|
|
1024
|
-
read: /* @__PURE__ */ __name(() => {
|
|
1025
|
-
const value = current();
|
|
1026
|
-
return value === void 0 ? void 0 : codec.decode(value);
|
|
1027
|
-
}, "read"),
|
|
1028
|
-
write: /* @__PURE__ */ __name((input, writeOptions) => save(codec.encode({ ...input, previous: replaced(account2), ...writeOptions?.signIn ? { signIn: true } : {} }), writeOptions), "write"),
|
|
1029
|
-
remove: /* @__PURE__ */ __name(() => {
|
|
1030
|
-
try {
|
|
1031
|
-
return credentials.remove(account2);
|
|
1032
|
-
} catch (error) {
|
|
1033
|
-
throw keyringFailure(error);
|
|
1034
|
-
}
|
|
1035
|
-
}, "remove")
|
|
1036
|
-
};
|
|
1037
|
-
}, "credentialStorage");
|
|
1038
|
-
|
|
1039
413
|
// dist/amo/json.js
|
|
1040
414
|
var isRecord = values_exports.isRaw;
|
|
1041
415
|
|
|
@@ -1044,10 +418,10 @@ var ACCOUNT_DOMAINS = ["amocrm.ru", "amocrm.com", "kommo.com"];
|
|
|
1044
418
|
var HOST = new RegExp(`^(?!www\\.)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.(${ACCOUNT_DOMAINS.join("|").replaceAll(".", "\\.")})$`);
|
|
1045
419
|
var accountOrigin = /* @__PURE__ */ __name((raw) => {
|
|
1046
420
|
const refused2 = /* @__PURE__ */ __name((why) => new CliError("validation_error", `--host takes the account's address, such as https://example.amocrm.ru or https://example.kommo.com: ${why}`, { reason: "account.malformed", param: "--host" }), "refused");
|
|
1047
|
-
const
|
|
421
|
+
const text3 = raw.trim();
|
|
1048
422
|
let url;
|
|
1049
423
|
try {
|
|
1050
|
-
url = new URL(/^[a-z]+:\/\//i.test(
|
|
424
|
+
url = new URL(/^[a-z]+:\/\//i.test(text3) ? text3 : `https://${text3}`);
|
|
1051
425
|
} catch {
|
|
1052
426
|
throw refused2("it is not an address");
|
|
1053
427
|
}
|
|
@@ -1081,6 +455,10 @@ var decodeSignIn = /* @__PURE__ */ __name((secret) => {
|
|
|
1081
455
|
// dist/amo/oauth.js
|
|
1082
456
|
var PROVIDER2 = "amocrm";
|
|
1083
457
|
var RELAY_URL = "https://wirecat.dev/webhooks/apps/amo-callback";
|
|
458
|
+
var CONNECT_ORIGIN = "https://connect.wirecat.dev";
|
|
459
|
+
var BUTTON_RELAY_URL = `${CONNECT_ORIGIN}/webhooks/apps/amo-callback`;
|
|
460
|
+
var CONNECT_PAGE_URL = `${CONNECT_ORIGIN}/connect/amo.html`;
|
|
461
|
+
var CLAIM_URL = `${CONNECT_ORIGIN}/api/amo/claim`;
|
|
1084
462
|
var REQUEST_MS = 3e4;
|
|
1085
463
|
var HINT = /^[\w .,:'`-]{1,200}$/;
|
|
1086
464
|
var account = accountTokenCodec(PROVIDER2);
|
|
@@ -1091,10 +469,11 @@ var appCodec = {
|
|
|
1091
469
|
const stored = account.decode(raw);
|
|
1092
470
|
const entry = JSON.parse(raw);
|
|
1093
471
|
const redirectUri = isRecord(entry) && typeof entry.redirectUri === "string" ? entry.redirectUri : RELAY_URL;
|
|
1094
|
-
return Object.assign(stored, { redirectUri });
|
|
472
|
+
return Object.assign(stored, { redirectUri, browser: isRecord(entry) && entry.browser === true });
|
|
1095
473
|
}, "decode")
|
|
1096
474
|
};
|
|
1097
475
|
var paths = /* @__PURE__ */ __name((env) => resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }), "paths");
|
|
476
|
+
var lockDirOf = /* @__PURE__ */ __name((env) => paths(env).config, "lockDirOf");
|
|
1098
477
|
var credentialsOf = /* @__PURE__ */ __name((env, keyring, storage) => ({
|
|
1099
478
|
configDir: paths(env).config,
|
|
1100
479
|
service: IDENTITY.appName,
|
|
@@ -1226,7 +605,7 @@ var appAuthOf = /* @__PURE__ */ __name((options) => {
|
|
|
1226
605
|
storage,
|
|
1227
606
|
lockDir: paths(options.env).config,
|
|
1228
607
|
fetch: fetchFor(origin, options.fetch),
|
|
1229
|
-
signInCommand: `${IDENTITY.command} ${options.profile} session start --host ${origin} --client-id ${stored.client.clientId}`,
|
|
608
|
+
signInCommand: `${IDENTITY.command} ${options.profile} session start --host ${origin} ${stored.browser ? "--one-click" : `--client-id ${stored.client.clientId}`}`,
|
|
1230
609
|
...options.signal ? { signal: options.signal } : {}
|
|
1231
610
|
});
|
|
1232
611
|
return { origin, userId: stored.account.userId, accessToken: /* @__PURE__ */ __name((refresh) => keeper.accessToken({ refresh }), "accessToken") };
|
|
@@ -1234,7 +613,7 @@ var appAuthOf = /* @__PURE__ */ __name((options) => {
|
|
|
1234
613
|
|
|
1235
614
|
// dist/commands/account.js
|
|
1236
615
|
import { readFileSync } from "node:fs";
|
|
1237
|
-
import { join
|
|
616
|
+
import { join } from "node:path";
|
|
1238
617
|
|
|
1239
618
|
// dist/api-keys.js
|
|
1240
619
|
var PREFIX = "/api/v4/";
|
|
@@ -1407,9 +786,9 @@ var permissions = commandPermissions({
|
|
|
1407
786
|
extra: [.../* @__PURE__ */ new Set([...CRM_WRITE_KEYS, ...API_KEYS])],
|
|
1408
787
|
defaults: { ...CRM_WRITE_DEFAULTS, ...API_DEFAULTS }
|
|
1409
788
|
});
|
|
1410
|
-
var isAccount = /* @__PURE__ */ __name((
|
|
789
|
+
var isAccount = /* @__PURE__ */ __name((text3) => {
|
|
1411
790
|
try {
|
|
1412
|
-
accountOrigin(
|
|
791
|
+
accountOrigin(text3);
|
|
1413
792
|
return true;
|
|
1414
793
|
} catch {
|
|
1415
794
|
return false;
|
|
@@ -1473,7 +852,7 @@ var amoError = /* @__PURE__ */ __name((operation, status, body, { json, waitMs,
|
|
|
1473
852
|
}, "amoError");
|
|
1474
853
|
|
|
1475
854
|
// dist/amo/transport.js
|
|
1476
|
-
var
|
|
855
|
+
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
1477
856
|
var LARGEST_ANSWER = 16 * 1024 * 1024;
|
|
1478
857
|
var LONGEST_PACE_WAIT_MS = 2e4;
|
|
1479
858
|
var REQUEST_MARGIN_MS = 1e3;
|
|
@@ -1512,7 +891,7 @@ var AmoTransport = class {
|
|
|
1512
891
|
#admin;
|
|
1513
892
|
constructor(options) {
|
|
1514
893
|
this.#signIn = options.signIn;
|
|
1515
|
-
this.#timeoutMs = options.timeoutMs ??
|
|
894
|
+
this.#timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
1516
895
|
this.#fetch = hostFetch({
|
|
1517
896
|
hosts: [new URL(options.signIn.origin).hostname],
|
|
1518
897
|
...options.fetch ? { fetch: options.fetch } : {},
|
|
@@ -1796,8 +1175,210 @@ var transportFor = /* @__PURE__ */ __name((command, signIn, events) => {
|
|
|
1796
1175
|
}, "transportFor");
|
|
1797
1176
|
var withAccount = /* @__PURE__ */ __name((command, body) => contextOf(command).run((events) => body(transportFor(command, signInOf(command), events))), "withAccount");
|
|
1798
1177
|
|
|
1178
|
+
// dist/amo/button.js
|
|
1179
|
+
import { randomBytes } from "node:crypto";
|
|
1180
|
+
import { createServer } from "node:http";
|
|
1181
|
+
var CONNECT_VARIABLE = `${IDENTITY.envPrefix}_CONNECT_URL`;
|
|
1182
|
+
var CALLBACK_MS = 6e5;
|
|
1183
|
+
var CLAIM_MS = 6e4;
|
|
1184
|
+
var CLAIM_PAUSES_MS = [500, 1e3, 2e3, 4e3];
|
|
1185
|
+
var REQUEST_MS2 = 3e4;
|
|
1186
|
+
var AMOCRM_HOST = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.amocrm\.ru$/;
|
|
1187
|
+
var connectUrls = /* @__PURE__ */ __name((env) => {
|
|
1188
|
+
const given = env[CONNECT_VARIABLE]?.trim();
|
|
1189
|
+
if (!given)
|
|
1190
|
+
return { page: CONNECT_PAGE_URL, claim: CLAIM_URL };
|
|
1191
|
+
let url;
|
|
1192
|
+
try {
|
|
1193
|
+
url = new URL(given);
|
|
1194
|
+
} catch {
|
|
1195
|
+
url = void 0;
|
|
1196
|
+
}
|
|
1197
|
+
if (url?.protocol !== "https:" || url.username || url.password)
|
|
1198
|
+
throw new CliError("configuration_error", `${CONNECT_VARIABLE} must be an https address, such as https://connect.wirecat.dev`, {
|
|
1199
|
+
reason: "connect.url-invalid"
|
|
1200
|
+
});
|
|
1201
|
+
const { origin } = url;
|
|
1202
|
+
const moved = /* @__PURE__ */ __name((address) => `${origin}${new URL(address).pathname}`, "moved");
|
|
1203
|
+
return { page: moved(CONNECT_PAGE_URL), claim: moved(CLAIM_URL) };
|
|
1204
|
+
}, "connectUrls");
|
|
1205
|
+
var refuseKommo = /* @__PURE__ */ __name((origin) => {
|
|
1206
|
+
if (AMOCRM_HOST.test(new URL(origin).hostname))
|
|
1207
|
+
return;
|
|
1208
|
+
throw new CliError("validation_error", "the browser sign-in works only for amoCRM accounts at amocrm.ru for now; sign in to Kommo with a long-lived token or --client-id", { reason: "oauth.browser-amocrm-only", param: "--host" });
|
|
1209
|
+
}, "refuseKommo");
|
|
1210
|
+
var queryOf = /* @__PURE__ */ __name((text3) => {
|
|
1211
|
+
const trimmed = text3.trim();
|
|
1212
|
+
const start = trimmed.indexOf("?");
|
|
1213
|
+
return new URLSearchParams(start >= 0 ? trimmed.slice(start + 1).split("#")[0] : trimmed);
|
|
1214
|
+
}, "queryOf");
|
|
1215
|
+
var awaitRedirect = /* @__PURE__ */ __name(async (open2, steps, signal) => {
|
|
1216
|
+
if (signal?.aborted)
|
|
1217
|
+
throw new CliError("cancelled", "the amoCRM sign-in was cancelled");
|
|
1218
|
+
const paste = new AbortController();
|
|
1219
|
+
let state = "";
|
|
1220
|
+
let settled = false;
|
|
1221
|
+
let accept = /* @__PURE__ */ __name(() => {
|
|
1222
|
+
}, "accept");
|
|
1223
|
+
let fail = /* @__PURE__ */ __name(() => {
|
|
1224
|
+
}, "fail");
|
|
1225
|
+
const redirect = new Promise((resolve2, reject) => {
|
|
1226
|
+
accept = /* @__PURE__ */ __name((query) => {
|
|
1227
|
+
settled = true;
|
|
1228
|
+
resolve2(query);
|
|
1229
|
+
}, "accept");
|
|
1230
|
+
fail = /* @__PURE__ */ __name((error) => {
|
|
1231
|
+
settled = true;
|
|
1232
|
+
reject(error);
|
|
1233
|
+
}, "fail");
|
|
1234
|
+
});
|
|
1235
|
+
void redirect.catch(() => {
|
|
1236
|
+
});
|
|
1237
|
+
const handler = /* @__PURE__ */ __name((request, response) => {
|
|
1238
|
+
const url = new URL(request.url ?? "/", "http://localhost");
|
|
1239
|
+
if (request.method !== "GET" || url.pathname !== "/callback")
|
|
1240
|
+
return void response.writeHead(404).end();
|
|
1241
|
+
if (settled || !state || url.searchParams.get("state") !== state)
|
|
1242
|
+
return void response.writeHead(400).end("This sign-in link does not belong to the waiting sign-in");
|
|
1243
|
+
response.end("Sign-in received; you can close this tab");
|
|
1244
|
+
accept(url.searchParams);
|
|
1245
|
+
}, "handler");
|
|
1246
|
+
const server = createServer(handler);
|
|
1247
|
+
const onAbort = /* @__PURE__ */ __name(() => fail(new CliError("cancelled", "the amoCRM sign-in was cancelled")), "onAbort");
|
|
1248
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1249
|
+
const timer = setTimeout(() => fail(new CliError("timeout", "the amoCRM sign-in timed out", { reason: "oauth.timeout" })), CALLBACK_MS);
|
|
1250
|
+
timer.unref();
|
|
1251
|
+
try {
|
|
1252
|
+
await new Promise((resolve2, reject) => {
|
|
1253
|
+
server.once("error", reject);
|
|
1254
|
+
server.listen(0, "127.0.0.1", resolve2);
|
|
1255
|
+
});
|
|
1256
|
+
const address = server.address();
|
|
1257
|
+
if (!address || typeof address === "string")
|
|
1258
|
+
throw new CliError("configuration_error", "could not start the local sign-in listener");
|
|
1259
|
+
state = `${address.port}.${randomBytes(32).toString("base64url")}`;
|
|
1260
|
+
const url = open2(state);
|
|
1261
|
+
steps.showUrl(url);
|
|
1262
|
+
steps.readPaste?.(paste.signal).then((text3) => {
|
|
1263
|
+
if (settled)
|
|
1264
|
+
return;
|
|
1265
|
+
const query = queryOf(text3);
|
|
1266
|
+
if (query.get("state") !== state)
|
|
1267
|
+
fail(new CliError("authentication_error", "the pasted sign-in result does not match this sign-in", {
|
|
1268
|
+
reason: "oauth.mismatch"
|
|
1269
|
+
}));
|
|
1270
|
+
else
|
|
1271
|
+
accept(query);
|
|
1272
|
+
}).catch(() => {
|
|
1273
|
+
});
|
|
1274
|
+
void Promise.resolve().then(() => steps.openBrowser(url)).catch(() => {
|
|
1275
|
+
});
|
|
1276
|
+
return { state, query: await redirect };
|
|
1277
|
+
} finally {
|
|
1278
|
+
clearTimeout(timer);
|
|
1279
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1280
|
+
paste.abort();
|
|
1281
|
+
server.closeAllConnections();
|
|
1282
|
+
if (server.listening)
|
|
1283
|
+
await new Promise((resolve2) => server.close(() => resolve2()));
|
|
1284
|
+
}
|
|
1285
|
+
}, "awaitRedirect");
|
|
1286
|
+
var refuseOtherAccount = /* @__PURE__ */ __name((origin, query) => {
|
|
1287
|
+
const given = (query.get("referer") ?? "").trim().toLowerCase();
|
|
1288
|
+
const host = given.replace(/^https?:\/\//, "").replace(/\/.*$/, "");
|
|
1289
|
+
const expected = new URL(origin).hostname;
|
|
1290
|
+
if (host === expected)
|
|
1291
|
+
return;
|
|
1292
|
+
const named = AMOCRM_HOST.test(host) ? host : void 0;
|
|
1293
|
+
throw new CliError("authentication_error", named ? `access was allowed in ${named}, not in ${expected}; run this again with --host https://${named}, or choose ${expected} in amoCRM's window` : `amoCRM did not say which account access was allowed in, so nothing was sent to ${expected}; run this again`, { reason: "oauth.mismatch", ...named ? { account: named } : {} });
|
|
1294
|
+
}, "refuseOtherAccount");
|
|
1295
|
+
var claimKeys = /* @__PURE__ */ __name(async (options) => {
|
|
1296
|
+
const host = new URL(options.claim).hostname;
|
|
1297
|
+
const request = hostFetch({
|
|
1298
|
+
hosts: [host],
|
|
1299
|
+
timeoutMs: REQUEST_MS2,
|
|
1300
|
+
...options.fetch ? { fetch: options.fetch } : {}
|
|
1301
|
+
});
|
|
1302
|
+
const again = "start the browser sign-in again";
|
|
1303
|
+
const deadline = options.now() + CLAIM_MS;
|
|
1304
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
1305
|
+
let response;
|
|
1306
|
+
try {
|
|
1307
|
+
response = await request(options.claim, {
|
|
1308
|
+
method: "POST",
|
|
1309
|
+
headers: { accept: "application/json", "content-type": "application/json" },
|
|
1310
|
+
body: JSON.stringify({ state: options.state }),
|
|
1311
|
+
redirect: "error",
|
|
1312
|
+
...options.signal ? { signal: options.signal } : {}
|
|
1313
|
+
});
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
if (options.signal?.aborted)
|
|
1316
|
+
throw new CliError("cancelled", "the amoCRM sign-in was cancelled");
|
|
1317
|
+
if (isCliError(error))
|
|
1318
|
+
throw error;
|
|
1319
|
+
throw new CliError("provider_unavailable", `could not reach ${host} for the integration's keys; ${again}`, {
|
|
1320
|
+
retryable: true,
|
|
1321
|
+
reason: "oauth.unavailable"
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
const answer2 = await response.json().catch(() => void 0);
|
|
1325
|
+
if (response.ok) {
|
|
1326
|
+
const id = isRecord(answer2) ? answer2.client_id : void 0;
|
|
1327
|
+
const secret = isRecord(answer2) ? answer2.client_secret : void 0;
|
|
1328
|
+
if (typeof id !== "string" || !id || typeof secret !== "string" || !secret)
|
|
1329
|
+
throw new CliError("invalid_response", `${host} returned keys amo cannot use; ${again}`, {
|
|
1330
|
+
reason: "oauth.invalid-response"
|
|
1331
|
+
});
|
|
1332
|
+
return { clientId: id, clientSecret: secret };
|
|
1333
|
+
}
|
|
1334
|
+
const notReady = response.status === 404 && isRecord(answer2) && answer2.error === "not_ready";
|
|
1335
|
+
if (!notReady)
|
|
1336
|
+
throw new CliError("provider_unavailable", `${host} did not hand over the integration's keys (HTTP ${response.status}); ${again}`, { status: response.status, reason: "oauth.unavailable" });
|
|
1337
|
+
if (options.now() >= deadline)
|
|
1338
|
+
throw new CliError("timeout", `amoCRM did not send the integration's keys to ${host} within a minute; ${again}`, {
|
|
1339
|
+
reason: "oauth.timeout"
|
|
1340
|
+
});
|
|
1341
|
+
await options.sleep(CLAIM_PAUSES_MS[Math.min(attempt, CLAIM_PAUSES_MS.length - 1)] ?? 4e3, options.signal, "retry");
|
|
1342
|
+
}
|
|
1343
|
+
}, "claimKeys");
|
|
1344
|
+
var browserSignIn = /* @__PURE__ */ __name(async (options) => {
|
|
1345
|
+
const { origin } = options;
|
|
1346
|
+
refuseKommo(origin);
|
|
1347
|
+
const connect = connectUrls(options.env);
|
|
1348
|
+
const storage = appStorage(options.env, options.profile, options.keyring, options.storage === "file" ? "file" : "auto");
|
|
1349
|
+
storage.probe();
|
|
1350
|
+
const { state, query } = await awaitRedirect((made) => `${connect.page}#state=${made}`, options.steps, options.signal);
|
|
1351
|
+
if (!query.get("code"))
|
|
1352
|
+
throw new CliError("authentication_error", "amoCRM sign-in was declined", { reason: "oauth.declined" });
|
|
1353
|
+
refuseOtherAccount(origin, query);
|
|
1354
|
+
const client = await claimKeys({
|
|
1355
|
+
claim: connect.claim,
|
|
1356
|
+
state,
|
|
1357
|
+
fetch: options.fetch,
|
|
1358
|
+
sleep: options.sleep,
|
|
1359
|
+
now: options.now,
|
|
1360
|
+
signal: options.signal
|
|
1361
|
+
});
|
|
1362
|
+
const signInCommand = `${IDENTITY.command} ${options.profile} session start --host ${origin} --one-click`;
|
|
1363
|
+
const provider = appProvider(origin, client, BUTTON_RELAY_URL);
|
|
1364
|
+
const fetch = fetchFor(origin, options.fetch);
|
|
1365
|
+
const tokens = await provider.exchange?.({ grant_type: "authorization_code", code: query.get("code") ?? "" }, { fetch, client, now: Date.now, signInCommand, ...options.signal ? { signal: options.signal } : {} });
|
|
1366
|
+
if (!tokens)
|
|
1367
|
+
throw new CliError("authentication_error", "amoCRM did not answer the sign-in");
|
|
1368
|
+
const access = tokens.accessToken ?? "";
|
|
1369
|
+
const user = await options.check({ origin, userId: "", accessToken: /* @__PURE__ */ __name(async () => access, "accessToken") });
|
|
1370
|
+
storage.remove();
|
|
1371
|
+
await tokenKeeper({ provider, storage, lockDir: lockDirOf(options.env), fetch, signInCommand }).save(tokens, {
|
|
1372
|
+
host: origin,
|
|
1373
|
+
userId: user.id,
|
|
1374
|
+
redirectUri: BUTTON_RELAY_URL,
|
|
1375
|
+
browser: true
|
|
1376
|
+
});
|
|
1377
|
+
return user;
|
|
1378
|
+
}, "browserSignIn");
|
|
1379
|
+
|
|
1799
1380
|
// dist/whoami.js
|
|
1800
|
-
var { text:
|
|
1381
|
+
var { text: text2 } = values_exports;
|
|
1801
1382
|
var accountUser = /* @__PURE__ */ __name(async (account2) => {
|
|
1802
1383
|
const { body } = await account2.request({ route: ROUTES.account });
|
|
1803
1384
|
const about = isRecord(body) ? body : {};
|
|
@@ -1815,8 +1396,8 @@ var accountUser = /* @__PURE__ */ __name(async (account2) => {
|
|
|
1815
1396
|
const admin = typeof rights.is_admin === "boolean" ? rights.is_admin : null;
|
|
1816
1397
|
return {
|
|
1817
1398
|
account: new URL(account2.origin).host,
|
|
1818
|
-
account_info: { id: String(about.id ?? ""), name:
|
|
1819
|
-
user: { id: userId, name:
|
|
1399
|
+
account_info: { id: String(about.id ?? ""), name: text2(about.name), subdomain: text2(about.subdomain) },
|
|
1400
|
+
user: { id: userId, name: text2(user.name), admin, manager: admin }
|
|
1820
1401
|
};
|
|
1821
1402
|
}, "accountUser");
|
|
1822
1403
|
|
|
@@ -1870,24 +1451,84 @@ var keepHost = /* @__PURE__ */ __name((command, origin) => {
|
|
|
1870
1451
|
configuration.changeSetting(settings.configPath, { profile, setting: "host", value: JSON.stringify(origin) });
|
|
1871
1452
|
}, "keepHost");
|
|
1872
1453
|
var PASTE = "If the browser did not come back here, paste the address it ended on: ";
|
|
1873
|
-
var
|
|
1874
|
-
const { env,
|
|
1875
|
-
const clientId = (args.clientId ?? env[CLIENT_ID] ?? "").trim();
|
|
1876
|
-
const clientSecret = env[CLIENT_SECRET]?.trim() || (await readSecret("amoCRM integration secret key: ", secretInputOf(command))).trim();
|
|
1877
|
-
if (!clientSecret)
|
|
1878
|
-
throw new CliError("validation_error", "no secret key was given");
|
|
1454
|
+
var browserStepsOf = /* @__PURE__ */ __name((command, steps, purpose) => {
|
|
1455
|
+
const { env, environment } = contextOf(command);
|
|
1879
1456
|
const flags = command.optsWithGlobals();
|
|
1880
1457
|
const machine = flags.json === true || flags.jsonl === true;
|
|
1881
1458
|
const person = !machine && flags.input !== false && !env.CI && (environment.tty ?? process.stdout.isTTY) === true;
|
|
1882
1459
|
const { streams } = outputFor(command);
|
|
1883
|
-
const
|
|
1460
|
+
const input = secretInputOf(command).input ?? process.stdin;
|
|
1461
|
+
const given = environment.answer;
|
|
1462
|
+
return {
|
|
1463
|
+
openBrowser: /* @__PURE__ */ __name(async (url) => {
|
|
1464
|
+
if (environment.openBrowser)
|
|
1465
|
+
return environment.openBrowser(url);
|
|
1466
|
+
if (person)
|
|
1467
|
+
await openBrowser(url);
|
|
1468
|
+
}, "openBrowser"),
|
|
1469
|
+
showUrl: /* @__PURE__ */ __name((url) => {
|
|
1470
|
+
steps.openUrl(url, purpose);
|
|
1471
|
+
streams.diagnostic(`Open the amoCRM sign-in: ${url}
|
|
1472
|
+
`);
|
|
1473
|
+
}, "showUrl"),
|
|
1474
|
+
// A pipe was the secret, and an empty answer would end the sign-in before the browser came back.
|
|
1475
|
+
...given ? {
|
|
1476
|
+
readPaste: /* @__PURE__ */ __name(async () => {
|
|
1477
|
+
const text3 = await given(PASTE);
|
|
1478
|
+
if (text3 === null)
|
|
1479
|
+
throw new CliError("cancelled", "nobody is at a terminal to paste");
|
|
1480
|
+
return text3;
|
|
1481
|
+
}, "readPaste")
|
|
1482
|
+
} : input.isTTY && !machine ? {
|
|
1483
|
+
readPaste: /* @__PURE__ */ __name((signal) => readSecret(PASTE, { ...secretInputOf(command), echo: true, signal }), "readPaste")
|
|
1484
|
+
} : {}
|
|
1485
|
+
};
|
|
1486
|
+
}, "browserStepsOf");
|
|
1487
|
+
var stepsOf = /* @__PURE__ */ __name((command) => {
|
|
1488
|
+
const { environment } = contextOf(command);
|
|
1489
|
+
const flags = command.optsWithGlobals();
|
|
1490
|
+
const machine = flags.json === true || flags.jsonl === true;
|
|
1491
|
+
const { streams } = outputFor(command);
|
|
1492
|
+
return signInSteps({
|
|
1884
1493
|
diagnostic: /* @__PURE__ */ __name((line) => streams.diagnostic(`${line}
|
|
1885
1494
|
`), "diagnostic"),
|
|
1886
1495
|
json: machine || environment.tty === false,
|
|
1887
1496
|
answers: false
|
|
1888
1497
|
});
|
|
1889
|
-
|
|
1890
|
-
|
|
1498
|
+
}, "stepsOf");
|
|
1499
|
+
var checkedUser = /* @__PURE__ */ __name((command, events) => async (auth) => {
|
|
1500
|
+
const { env, keyring, profile } = contextOf(command);
|
|
1501
|
+
const found = await accountUser(transportFor(command, auth, events));
|
|
1502
|
+
refuseDuplicate(env, keyring, profile, { host: found.account, userId: found.user.id });
|
|
1503
|
+
return { ...found, id: found.user.id };
|
|
1504
|
+
}, "checkedUser");
|
|
1505
|
+
var signInWithButton = /* @__PURE__ */ __name(async (command, origin, steps, storage = "keyring") => {
|
|
1506
|
+
const { env, profile, tokens, keyring, run: run3, environment } = contextOf(command);
|
|
1507
|
+
refuseKommo(origin);
|
|
1508
|
+
const who = await run3((events) => browserSignIn({
|
|
1509
|
+
env,
|
|
1510
|
+
profile,
|
|
1511
|
+
origin,
|
|
1512
|
+
storage,
|
|
1513
|
+
keyring,
|
|
1514
|
+
fetch: environment.fetch,
|
|
1515
|
+
sleep: environment.sleep ?? realSleep,
|
|
1516
|
+
now: environment.now ?? monotonic,
|
|
1517
|
+
signal: environment.signal,
|
|
1518
|
+
steps: browserStepsOf(command, steps, "Choose the amoCRM account and allow WireCat's integration"),
|
|
1519
|
+
check: checkedUser(command, events)
|
|
1520
|
+
}));
|
|
1521
|
+
tokens.remove(profile);
|
|
1522
|
+
rememberAccount(IDENTITY, profile, `${who.account}:${who.user.id}`, env);
|
|
1523
|
+
const { id: _id, ...found } = who;
|
|
1524
|
+
return { found, storedIn: appSourceOf(env, profile, keyring) ?? storage };
|
|
1525
|
+
}, "signInWithButton");
|
|
1526
|
+
var startWithApp = /* @__PURE__ */ __name(async (command, args, origin) => {
|
|
1527
|
+
const { env, profile, tokens, keyring, run: run3, environment } = contextOf(command);
|
|
1528
|
+
const clientId = (args.clientId ?? env[CLIENT_ID] ?? "").trim();
|
|
1529
|
+
const clientSecret = env[CLIENT_SECRET]?.trim() || (await readSecret("amoCRM integration secret key: ", secretInputOf(command))).trim();
|
|
1530
|
+
if (!clientSecret)
|
|
1531
|
+
throw new CliError("validation_error", "no secret key was given");
|
|
1891
1532
|
const signInCommand = `${AMO} ${profile} session start --host ${origin} --client-id ${clientId}`;
|
|
1892
1533
|
const who = await run3((events) => appSignIn({
|
|
1893
1534
|
env,
|
|
@@ -1899,35 +1540,8 @@ var startWithApp = /* @__PURE__ */ __name(async (command, args, origin) => {
|
|
|
1899
1540
|
fetch: environment.fetch,
|
|
1900
1541
|
signal: environment.signal,
|
|
1901
1542
|
signInCommand,
|
|
1902
|
-
steps:
|
|
1903
|
-
|
|
1904
|
-
if (environment.openBrowser)
|
|
1905
|
-
return environment.openBrowser(url);
|
|
1906
|
-
if (person)
|
|
1907
|
-
await openBrowser(url);
|
|
1908
|
-
}, "openBrowser"),
|
|
1909
|
-
showUrl: /* @__PURE__ */ __name((url) => {
|
|
1910
|
-
steps.openUrl(url, "Sign in to amoCRM and allow the integration");
|
|
1911
|
-
streams.diagnostic(`Open the amoCRM sign-in: ${url}
|
|
1912
|
-
`);
|
|
1913
|
-
}, "showUrl"),
|
|
1914
|
-
// A pipe was the secret, and an empty answer would end the sign-in before the browser came back.
|
|
1915
|
-
...given ? {
|
|
1916
|
-
readPaste: /* @__PURE__ */ __name(async () => {
|
|
1917
|
-
const text4 = await given(PASTE);
|
|
1918
|
-
if (text4 === null)
|
|
1919
|
-
throw new CliError("cancelled", "nobody is at a terminal to paste");
|
|
1920
|
-
return text4;
|
|
1921
|
-
}, "readPaste")
|
|
1922
|
-
} : input.isTTY && !machine ? {
|
|
1923
|
-
readPaste: /* @__PURE__ */ __name((signal) => readSecret(PASTE, { ...secretInputOf(command), echo: true, signal }), "readPaste")
|
|
1924
|
-
} : {}
|
|
1925
|
-
},
|
|
1926
|
-
check: /* @__PURE__ */ __name(async (auth) => {
|
|
1927
|
-
const found2 = await accountUser(transportFor(command, auth, events));
|
|
1928
|
-
refuseDuplicate(env, keyring, profile, { host: found2.account, userId: found2.user.id });
|
|
1929
|
-
return { ...found2, id: found2.user.id };
|
|
1930
|
-
}, "check")
|
|
1543
|
+
steps: browserStepsOf(command, stepsOf(command), "Sign in to amoCRM and allow the integration"),
|
|
1544
|
+
check: checkedUser(command, events)
|
|
1931
1545
|
}));
|
|
1932
1546
|
tokens.remove(profile);
|
|
1933
1547
|
keepHost(command, origin);
|
|
@@ -1942,6 +1556,18 @@ var startWithApp = /* @__PURE__ */ __name(async (command, args, origin) => {
|
|
|
1942
1556
|
...found
|
|
1943
1557
|
};
|
|
1944
1558
|
}, "startWithApp");
|
|
1559
|
+
var startWithButton = /* @__PURE__ */ __name(async (command, args, origin) => {
|
|
1560
|
+
const { found, storedIn } = await signInWithButton(command, origin, stepsOf(command), args.credentialStorage);
|
|
1561
|
+
keepHost(command, origin);
|
|
1562
|
+
return {
|
|
1563
|
+
profile: contextOf(command).profile,
|
|
1564
|
+
state: "saved",
|
|
1565
|
+
kind: "app",
|
|
1566
|
+
stored_in: storedIn,
|
|
1567
|
+
verified: true,
|
|
1568
|
+
...found
|
|
1569
|
+
};
|
|
1570
|
+
}, "startWithButton");
|
|
1945
1571
|
var CLIENT_ID = `${IDENTITY.envPrefix}_AMOCRM_CLIENT_ID`;
|
|
1946
1572
|
var CLIENT_SECRET = `${IDENTITY.envPrefix}_AMOCRM_CLIENT_SECRET`;
|
|
1947
1573
|
var startCommand = /* @__PURE__ */ __name(() => logsInOrOut(annotate(new Command("start"), {
|
|
@@ -1950,14 +1576,21 @@ var startCommand = /* @__PURE__ */ __name(() => logsInOrOut(annotate(new Command
|
|
|
1950
1576
|
mcp: false,
|
|
1951
1577
|
examples: [
|
|
1952
1578
|
`${AMO} work session start --host https://example.amocrm.ru`,
|
|
1953
|
-
`${AMO} work session start --host https://example.
|
|
1579
|
+
`${AMO} work session start --host https://example.amocrm.ru --one-click`,
|
|
1954
1580
|
`${AMO} work session start --host https://example.amocrm.ru --client-id 0123abcd-4567-89ef-0123-456789abcdef`
|
|
1955
1581
|
]
|
|
1956
|
-
})).summary("sign in
|
|
1582
|
+
})).summary("sign in with one click, a long-lived token or your own integration").description(`sign this profile in: --host names the account, and its long-lived token (a private integration \u2192 Keys and scopes \u2192 Generate a long-lived token) is asked hidden or read from stdin, never taken as an argument, checked against the account, and only then kept in the keyring with the address, or in a private file. The token acts with the rights of the administrator who made it. With --client-id it signs in through that integration in the browser instead: its secret key is asked hidden or read from stdin, and the tokens act with the rights of the user who signs in; the integration's Redirect URI must be ${RELAY_URL}. With --one-click, amoCRM's button on connect.wirecat.dev creates a WireCat integration in the account you choose, and nothing is copied by hand: amoCRM sends the integration's secret key to connect.wirecat.dev, which hands it to amo once and keeps no copy; amocrm.ru accounts only for now. amoCRM lets only an account administrator allow either browser sign-in, so a user who is not one signs in with a token an administrator made. Each sign-in forgets the profile's other kind`).requiredOption("--host <address>", "the account's address, such as https://example.amocrm.ru, kept as given").option("--client-id <id>", `the integration's ID (client_id), or ${CLIENT_ID}; its secret key comes from ${CLIENT_SECRET}, a hidden prompt or stdin`).option("--one-click", "sign in with one click in the browser: amoCRM creates WireCat's integration in the account; only an administrator can allow it").option("--credential-storage <storage>", "where the sign-in is kept: keyring, which falls back to a private file by itself, or file", storageOf, "keyring").action(async function(args) {
|
|
1957
1583
|
const { env, profile, tokens, keyring } = contextOf(this);
|
|
1958
1584
|
refuseCommandName(profile, commandWords(rootOf(this)), AMO);
|
|
1959
1585
|
refuseOffline(this, "the amoCRM account");
|
|
1960
1586
|
const origin = accountOrigin(args.host);
|
|
1587
|
+
if (args.oneClick) {
|
|
1588
|
+
if (args.clientId !== void 0)
|
|
1589
|
+
throw new CliError("validation_error", "--one-click makes its own integration; leave out --client-id", {
|
|
1590
|
+
param: "--client-id"
|
|
1591
|
+
});
|
|
1592
|
+
return answer(this, await startWithButton(this, args, origin));
|
|
1593
|
+
}
|
|
1961
1594
|
if (args.clientId !== void 0 || env[CLIENT_ID])
|
|
1962
1595
|
return answer(this, await startWithApp(this, args, origin));
|
|
1963
1596
|
const token = (await readSecret("amoCRM long-lived token: ", secretInputOf(this))).trim();
|
|
@@ -2064,7 +1697,7 @@ var removal = {
|
|
|
2064
1697
|
}
|
|
2065
1698
|
], "secrets"),
|
|
2066
1699
|
stateFiles: /* @__PURE__ */ __name((profile, { env }) => [
|
|
2067
|
-
|
|
1700
|
+
join(resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }).state, "crm", profile)
|
|
2068
1701
|
], "stateFiles")
|
|
2069
1702
|
};
|
|
2070
1703
|
var refuseSharedDelete = /* @__PURE__ */ __name((command) => {
|
|
@@ -2151,10 +1784,10 @@ var scalar = /* @__PURE__ */ __name((value) => {
|
|
|
2151
1784
|
return String(value.value);
|
|
2152
1785
|
return void 0;
|
|
2153
1786
|
}, "scalar");
|
|
2154
|
-
var queryOf2 = /* @__PURE__ */ __name((
|
|
2155
|
-
if (
|
|
1787
|
+
var queryOf2 = /* @__PURE__ */ __name((text3) => {
|
|
1788
|
+
if (text3 === void 0)
|
|
2156
1789
|
return {};
|
|
2157
|
-
const parsed = parseApiJson(
|
|
1790
|
+
const parsed = parseApiJson(text3);
|
|
2158
1791
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
2159
1792
|
throw refused("--params takes a JSON object of parameter names and values", "--params");
|
|
2160
1793
|
return Object.fromEntries(Object.entries(parsed).map(([name, value]) => {
|
|
@@ -2164,12 +1797,12 @@ var queryOf2 = /* @__PURE__ */ __name((text4) => {
|
|
|
2164
1797
|
return [name, Array.isArray(value) ? values : values[0]];
|
|
2165
1798
|
}));
|
|
2166
1799
|
}, "queryOf");
|
|
2167
|
-
var bodyOf = /* @__PURE__ */ __name((operation,
|
|
2168
|
-
if (
|
|
1800
|
+
var bodyOf = /* @__PURE__ */ __name((operation, text3) => {
|
|
1801
|
+
if (text3 === void 0)
|
|
2169
1802
|
return void 0;
|
|
2170
1803
|
if (!operation.body)
|
|
2171
1804
|
throw refused(`${operation.name} takes no body`, "--body");
|
|
2172
|
-
return parseApiJson(
|
|
1805
|
+
return parseApiJson(text3);
|
|
2173
1806
|
}, "bodyOf");
|
|
2174
1807
|
var listCommand2 = /* @__PURE__ */ __name(() => withQuery(answerEntity(annotate(new Command("list"), {
|
|
2175
1808
|
effects: NO_EFFECTS,
|
|
@@ -2299,7 +1932,7 @@ var callCommand = /* @__PURE__ */ __name(() => annotate(new Command("call"), {
|
|
|
2299
1932
|
}), "callCommand");
|
|
2300
1933
|
var apiCommand = /* @__PURE__ */ __name(() => annotate(new Command("api"), { effects: LOCAL_READ }).description("see and call the amoCRM API v4 operations directly").addCommand(listCommand2()).addCommand(showCommand()).addCommand(callCommand()), "apiCommand");
|
|
2301
1934
|
|
|
2302
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1935
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/stage-tasks.js
|
|
2303
1936
|
var DAY = 864e5;
|
|
2304
1937
|
var openStageTasks = /* @__PURE__ */ __name(async (store, account2, now, { history = false } = {}) => {
|
|
2305
1938
|
const rules = await store.crm.stageTasks(account2);
|
|
@@ -2336,8 +1969,9 @@ var openStageTasks = /* @__PURE__ */ __name(async (store, account2, now, { histo
|
|
|
2336
1969
|
return opened;
|
|
2337
1970
|
}, "openStageTasks");
|
|
2338
1971
|
|
|
2339
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
1972
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/digest.js
|
|
2340
1973
|
var HOUR = 36e5;
|
|
1974
|
+
var SHOWN = 7;
|
|
2341
1975
|
var STALE_HOURS = 24;
|
|
2342
1976
|
var WORDS = {
|
|
2343
1977
|
en: {
|
|
@@ -2373,7 +2007,7 @@ var endOfDay = /* @__PURE__ */ __name((now, zone) => {
|
|
|
2373
2007
|
var crmDigest = /* @__PURE__ */ __name(async (store, account2, options) => {
|
|
2374
2008
|
const { since, until, now, zone, viewer } = options;
|
|
2375
2009
|
const words = WORDS[options.language] ?? WORDS.en;
|
|
2376
|
-
const cap =
|
|
2010
|
+
const cap = SHOWN;
|
|
2377
2011
|
const window = { since, until, ...viewer ? { viewer } : {} };
|
|
2378
2012
|
const counts = await store.crm.changeCounts(account2, window);
|
|
2379
2013
|
const changesOf = /* @__PURE__ */ __name(async (kind) => counts[kind] ? (await store.crm.changes(account2, { ...window, changes: [kind], limit: cap, offset: 0 })).items : [], "changesOf");
|
|
@@ -2456,7 +2090,7 @@ var crmDigest = /* @__PURE__ */ __name(async (store, account2, options) => {
|
|
|
2456
2090
|
}, "crmDigest");
|
|
2457
2091
|
var EMAIL = /[\p{L}\p{N}._%+-]+@[\p{L}\p{N}-]+(?:\.[\p{L}\p{N}-]+)+/gu;
|
|
2458
2092
|
var PHONE = /\+?\d[\d\s().-]{5,}\d/g;
|
|
2459
|
-
var maskText = /* @__PURE__ */ __name((
|
|
2093
|
+
var maskText = /* @__PURE__ */ __name((text3) => text3.replace(EMAIL, "[e-mail]").replace(PHONE, (found) => {
|
|
2460
2094
|
const digits = found.replace(/\D/g, "").length;
|
|
2461
2095
|
return digits >= 9 || found.startsWith("+") && digits >= 7 ? "[phone]" : found;
|
|
2462
2096
|
}), "maskText");
|
|
@@ -2479,7 +2113,7 @@ var healthOf = /* @__PURE__ */ __name(async (store, account2, { now, profile })
|
|
|
2479
2113
|
return stale > STALE_HOURS ? [{ ...named, stale_hours: Math.floor(stale) }] : [];
|
|
2480
2114
|
}, "healthOf");
|
|
2481
2115
|
|
|
2482
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2116
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/csv.js
|
|
2483
2117
|
var csvFormatOption = /* @__PURE__ */ __name(() => annotateOption(new Option("--format <format>", "csv: this page as a table for a spreadsheet; --json=a,b picks its columns").choices(["csv"]), { mcp: false }), "csvFormatOption");
|
|
2484
2118
|
var DEAL_CSV_COLUMNS = [
|
|
2485
2119
|
"ref",
|
|
@@ -2601,7 +2235,7 @@ var renderCsv = /* @__PURE__ */ __name((command, open2, read, defaults = DEAL_CS
|
|
|
2601
2235
|
});
|
|
2602
2236
|
}, "renderCsv");
|
|
2603
2237
|
|
|
2604
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2238
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/records.js
|
|
2605
2239
|
var time2 = nullable(isoTime);
|
|
2606
2240
|
var metadata = optional(record(string(), strictObject({
|
|
2607
2241
|
label: nullable(string()),
|
|
@@ -2776,13 +2410,16 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
|
|
|
2776
2410
|
const stored = await run3.store.crm.fields(run3.account, kind);
|
|
2777
2411
|
return stored.length ? stored : await run3.source().fields?.(kind) ?? [];
|
|
2778
2412
|
}, "liveFields");
|
|
2413
|
+
const words = options.liveQuery === "words";
|
|
2779
2414
|
const records = /* @__PURE__ */ __name((noun) => {
|
|
2780
2415
|
const group = annotate(program.command(noun.noun), { effects: REMOTE_READ }).description(`the CRM's ${noun.what}, read live: the copy holds only your own`);
|
|
2781
|
-
|
|
2416
|
+
const query = words ? { ...noun.query, fields: noun.query.fields.filter(({ name }) => name === "name") } : noun.query;
|
|
2417
|
+
const list = answerEntity(annotate(group.command("list"), { effects: REMOTE_READ, offline: false }), noun.entity, noun.schema);
|
|
2418
|
+
example((words ? withWords(list, query, `words the CRM's own search looks for in ${noun.what}`) : withQuery(list, query).addHelpText("after", CUSTOM_HELP)).description(`${noun.what} in the CRM, newest first; another client is found here, never in the copy`).option("--limit <n>", `${noun.what} per page, 1\u2013${MOST}`, integer(MOST), 50).option("--page <n>", "which page, starting at 1", integer(1e6), 1).addOption(csvFormatOption()), `${noun.noun} list`, words ? `${noun.noun} list anna --json` : `${noun.noun} list name:anna* --json`, `${noun.noun} list --format csv > ${noun.noun}.csv`).action(async (words2, opts, command) => {
|
|
2782
2419
|
const csv = opts.format === "csv";
|
|
2783
2420
|
const path = commandPath(command);
|
|
2784
|
-
const
|
|
2785
|
-
const names = customNames(
|
|
2421
|
+
const text3 = typedQuery(words2);
|
|
2422
|
+
const names = customNames(text3, query, path, "name");
|
|
2786
2423
|
const columns = command.optsWithGlobals().fields;
|
|
2787
2424
|
const wanted = csv && columns === void 0 ? "all" : wantedCodes(columns);
|
|
2788
2425
|
const read = /* @__PURE__ */ __name(async (run3) => {
|
|
@@ -2790,7 +2427,7 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
|
|
|
2790
2427
|
const fields = names.length || wanted !== void 0 || csv ? await liveFields(run3, noun.kind) : [];
|
|
2791
2428
|
const chosen = filterableFields(fields, names);
|
|
2792
2429
|
selectedCodes(fields, wanted);
|
|
2793
|
-
const terms = nativeTerms(listQuery(
|
|
2430
|
+
const terms = nativeTerms(listQuery(text3, withCustomFields(query, chosen), path, { defaultField: "name" }), path);
|
|
2794
2431
|
const custom = customConditions(terms, chosen);
|
|
2795
2432
|
const name = searchText(terms.get("name"));
|
|
2796
2433
|
terms.delete("name");
|
|
@@ -2815,7 +2452,7 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
|
|
|
2815
2452
|
limit: opts.limit,
|
|
2816
2453
|
page: opts.page,
|
|
2817
2454
|
has_more: found.hasMore,
|
|
2818
|
-
...
|
|
2455
|
+
...words2.length ? { args: { query: words2 } } : {}
|
|
2819
2456
|
});
|
|
2820
2457
|
});
|
|
2821
2458
|
});
|
|
@@ -2834,9 +2471,18 @@ var addCrmRecordCommands = /* @__PURE__ */ __name((program, options) => {
|
|
|
2834
2471
|
if (options.live.includes("user"))
|
|
2835
2472
|
users(program, options);
|
|
2836
2473
|
}, "addCrmRecordCommands");
|
|
2474
|
+
var byIdOrNone = /* @__PURE__ */ __name(async (run3, noun, id) => {
|
|
2475
|
+
try {
|
|
2476
|
+
return await sourceWith(run3, "get", noun.what).get(noun.kind, id);
|
|
2477
|
+
} catch (error) {
|
|
2478
|
+
if (isCliError(error) && error.code === "validation_error")
|
|
2479
|
+
return null;
|
|
2480
|
+
throw error;
|
|
2481
|
+
}
|
|
2482
|
+
}, "byIdOrNone");
|
|
2837
2483
|
var recordNamed = /* @__PURE__ */ __name(async (run3, noun, given) => {
|
|
2838
2484
|
const id = given.trim();
|
|
2839
|
-
const byId = RECORD_ID.test(id) ? await
|
|
2485
|
+
const byId = RECORD_ID.test(id) ? await byIdOrNone(run3, noun, id) : null;
|
|
2840
2486
|
if (byId)
|
|
2841
2487
|
return byId;
|
|
2842
2488
|
const want = foldName(id);
|
|
@@ -2970,7 +2616,7 @@ var addRecordWrites = /* @__PURE__ */ __name((group, noun, { within, example, wr
|
|
|
2970
2616
|
}, "addRecordWrites");
|
|
2971
2617
|
var idOf = /* @__PURE__ */ __name((opts) => opts.operationId === void 0 ? {} : { operationId: opts.operationId }, "idOf");
|
|
2972
2618
|
|
|
2973
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2619
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/activities.js
|
|
2974
2620
|
var MOST2 = 500;
|
|
2975
2621
|
var nullableText = nullable(text);
|
|
2976
2622
|
var REFS = ["deal", "lead", "person", "organization"];
|
|
@@ -3083,7 +2729,7 @@ var addCrmActivityCommands = /* @__PURE__ */ __name((program, options) => {
|
|
|
3083
2729
|
}, "addCrmActivityCommands");
|
|
3084
2730
|
var refOf = /* @__PURE__ */ __name((kind, value) => value.includes(":") ? value : `${kind}:${value}`, "refOf");
|
|
3085
2731
|
|
|
3086
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
2732
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/changes.js
|
|
3087
2733
|
var MOST3 = 500;
|
|
3088
2734
|
var DAY2 = 864e5;
|
|
3089
2735
|
var nullableText2 = nullable(text);
|
|
@@ -3187,10 +2833,11 @@ var positionOf = /* @__PURE__ */ __name((cursor) => {
|
|
|
3187
2833
|
var digestState = /* @__PURE__ */ __name((schedule) => `crm:digest:${schedule}`, "digestState");
|
|
3188
2834
|
var addCrmChangeCommands = /* @__PURE__ */ __name((program, options) => {
|
|
3189
2835
|
const { within, example, now, ownerOf: ownerOf2, pathOf: pathOf3 } = options;
|
|
2836
|
+
const deals = options.leads === false ? "deals" : "deals and leads";
|
|
3190
2837
|
if (options.activities)
|
|
3191
2838
|
addCrmActivityCommands(program, { within, example, now, ownerOf: ownerOf2, pathOf: pathOf3 });
|
|
3192
|
-
const group = annotate(program.command("changes"), { effects: NO_EFFECTS }).description(
|
|
3193
|
-
example(withQuery(answerEntity(annotate(group.command("list"), { effects: LOCAL_READ }), "crm_change", crmChange).description(
|
|
2839
|
+
const group = annotate(program.command("changes"), { effects: NO_EFFECTS }).description(`what changed in the CRM's ${options.leads === false ? "deals" : "deals, leads"}, activities and contacts, as the syncs copied it`);
|
|
2840
|
+
example(withQuery(answerEntity(annotate(group.command("list"), { effects: LOCAL_READ }), "crm_change", crmChange).description(`${deals} made, moved, won, lost and given another owner, activities added and done, and contacts added, newest first; the last day unless at: says otherwise`).option("--limit <n>", `changes per page, 1\u2013${MOST3}`, integer(MOST3), 50).option("--cursor <cursor>", "the next page, as the last answer's page.next gave it").addOption(annotateOption(new Option("--format <format>", "csv: this page as a table; report: the window as a morning digest document, for schedule command. Run by a schedule, the report starts where that schedule's last one ended").choices(["csv", "report"]), { mcp: false })), CHANGES_QUERY), 'changes list "at>=1d"', "changes list change:won at>=7d --json", 'changes list "at>=1d" --format report').action(async (words, opts, command) => {
|
|
3194
2841
|
const name = "changes list";
|
|
3195
2842
|
const terms = queryTerms(words, CHANGES_QUERY, name, ["at"]);
|
|
3196
2843
|
const zone = timezoneOf();
|
|
@@ -3302,11 +2949,11 @@ var pipelineOf2 = /* @__PURE__ */ __name(async (run3, value) => {
|
|
|
3302
2949
|
}) : new CliError("not_found", `no pipeline ${value} in this account`, { reason: "pipeline.not-found" });
|
|
3303
2950
|
}, "pipelineOf");
|
|
3304
2951
|
|
|
3305
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3306
|
-
import { createHash
|
|
2952
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/files.js
|
|
2953
|
+
import { createHash } from "node:crypto";
|
|
3307
2954
|
import { chmodSync, constants, copyFileSync, existsSync, linkSync, mkdirSync, readFileSync as readFileSync2, renameSync, rmSync } from "node:fs";
|
|
3308
2955
|
import { open } from "node:fs/promises";
|
|
3309
|
-
import { join as
|
|
2956
|
+
import { join as join2, resolve, sep } from "node:path";
|
|
3310
2957
|
var MB = 1024 * 1024;
|
|
3311
2958
|
var PAGE = 500;
|
|
3312
2959
|
var DAY3 = 24 * 60 * 60 * 1e3;
|
|
@@ -3355,8 +3002,8 @@ var OWNER_FLAGS = [
|
|
|
3355
3002
|
["organization", "--organization <id>"]
|
|
3356
3003
|
];
|
|
3357
3004
|
var iso4 = /* @__PURE__ */ __name((ms) => ms === null ? null : new Date(ms).toISOString(), "iso");
|
|
3358
|
-
var segment = /* @__PURE__ */ __name((
|
|
3359
|
-
var accountFolder = /* @__PURE__ */ __name((app, run3) =>
|
|
3005
|
+
var segment = /* @__PURE__ */ __name((text3) => text3.replace(/[^\w.-]+/gu, "_"), "segment");
|
|
3006
|
+
var accountFolder = /* @__PURE__ */ __name((app, run3) => join2(resolvePaths({ appName: app.appName, prefix: app.envPrefix, env: run3.env ?? process.env }).state, "crm", "files", segment(`${run3.account.provider}-${run3.account.account}`)), "accountFolder");
|
|
3360
3007
|
var ownFolder = /* @__PURE__ */ __name((top, folder) => {
|
|
3361
3008
|
mkdirSync(folder, { recursive: true, mode: 448 });
|
|
3362
3009
|
for (let at2 = resolve(folder); at2.startsWith(resolve(top)); at2 = resolve(at2, "..")) {
|
|
@@ -3395,7 +3042,7 @@ var placeNew = /* @__PURE__ */ __name((part, target) => {
|
|
|
3395
3042
|
var saveStream = /* @__PURE__ */ __name(async (stream, target, { cap, signal, exclusive }) => {
|
|
3396
3043
|
const part = `${target}.part-${process.pid}`;
|
|
3397
3044
|
const handle = await open(part, "wx", 384);
|
|
3398
|
-
const hash =
|
|
3045
|
+
const hash = createHash("sha256");
|
|
3399
3046
|
const reader = stream.getReader();
|
|
3400
3047
|
let bytes = 0;
|
|
3401
3048
|
try {
|
|
@@ -3473,12 +3120,12 @@ var targetOf = /* @__PURE__ */ __name((folder, file, earlier, held, capped) => {
|
|
|
3473
3120
|
const providerId = segment(parseCrmFileId(file.id).providerId);
|
|
3474
3121
|
const name = safeName(file.name) ?? `file-${providerId}`;
|
|
3475
3122
|
const free = /* @__PURE__ */ __name((path) => path === earlier || !held.has(path) && !existsSync(path), "free");
|
|
3476
|
-
for (const candidate of [
|
|
3123
|
+
for (const candidate of [join2(folder, name), join2(folder, `${providerId}-${name}`)])
|
|
3477
3124
|
if (free(candidate))
|
|
3478
3125
|
return candidate;
|
|
3479
3126
|
if (capped)
|
|
3480
3127
|
for (let at2 = 2; ; at2 += 1) {
|
|
3481
|
-
const candidate =
|
|
3128
|
+
const candidate = join2(folder, `${providerId}-${at2}-${name}`);
|
|
3482
3129
|
if (free(candidate))
|
|
3483
3130
|
return candidate;
|
|
3484
3131
|
}
|
|
@@ -3492,14 +3139,14 @@ var downloadCrmFile = /* @__PURE__ */ __name(async (context, file, assignee, { c
|
|
|
3492
3139
|
if (file.size !== null && file.size > capBytes)
|
|
3493
3140
|
throw tooLarge(file.id, file.size, capMb, flag);
|
|
3494
3141
|
const top = accountFolder(app, run3);
|
|
3495
|
-
const folder = dir ? resolve(dir) :
|
|
3142
|
+
const folder = dir ? resolve(dir) : join2(top, segment(`${file.owner.kind}-${file.owner.id}`));
|
|
3496
3143
|
const setting = `crm.${run3.account.provider}:${run3.account.account}.files.max_total_mb`;
|
|
3497
3144
|
const capped = dir === void 0;
|
|
3498
3145
|
const room = /* @__PURE__ */ __name((need, target2, drop) => roomFor(context, top, { need, capBytes: limits.max_total_mb * MB, own: file.id, target: target2, drop }), "room");
|
|
3499
3146
|
if (capped && !await room(file.size ?? 0, null, false))
|
|
3500
3147
|
throw diskFull(limits, top, setting);
|
|
3501
3148
|
if (capped)
|
|
3502
|
-
ownFolder(
|
|
3149
|
+
ownFolder(join2(top, ".."), folder);
|
|
3503
3150
|
else
|
|
3504
3151
|
mkdirSync(folder, { recursive: true, mode: 448 });
|
|
3505
3152
|
const earlier = await run3.store.crmFiles.get(run3.account, file.id);
|
|
@@ -3662,13 +3309,13 @@ var addCrmFileCommands = /* @__PURE__ */ __name((program, options) => {
|
|
|
3662
3309
|
limits: await run3.store.crmFiles.limits(run3.account),
|
|
3663
3310
|
...opts.dir === void 0 ? {} : { dir: opts.dir }
|
|
3664
3311
|
});
|
|
3665
|
-
const
|
|
3312
|
+
const text3 = done.row.text;
|
|
3666
3313
|
return itemOf({
|
|
3667
3314
|
...itemOfFile(file, done.row),
|
|
3668
3315
|
size: done.row.size,
|
|
3669
3316
|
text_status: done.textStatus,
|
|
3670
|
-
text:
|
|
3671
|
-
text_truncated:
|
|
3317
|
+
text: text3 === null ? null : text3.slice(0, SHOWN_TEXT),
|
|
3318
|
+
text_truncated: text3 !== null && text3.length > SHOWN_TEXT,
|
|
3672
3319
|
untrusted: ["name", "mime", "path", "text"]
|
|
3673
3320
|
});
|
|
3674
3321
|
});
|
|
@@ -3839,7 +3486,7 @@ var syncFiles = /* @__PURE__ */ __name(async (context, outOfTime, deadline = (ms
|
|
|
3839
3486
|
return report;
|
|
3840
3487
|
}, "syncFiles");
|
|
3841
3488
|
|
|
3842
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3489
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/pipeline-view.js
|
|
3843
3490
|
var sumOf = /* @__PURE__ */ __name((amounts) => amounts.map(({ amount, currency }) => `${groupDigits(amount)} ${currency}`).join(", ") || "\u2014", "sumOf");
|
|
3844
3491
|
var percent = /* @__PURE__ */ __name((share) => share === null ? "\u2014" : `${Math.round(share * 100)}%`, "percent");
|
|
3845
3492
|
var openStages = /* @__PURE__ */ __name((stages) => {
|
|
@@ -3885,11 +3532,12 @@ ${outcomes.join("\n")}`
|
|
|
3885
3532
|
].join("\n\n");
|
|
3886
3533
|
}, "pipelineView");
|
|
3887
3534
|
|
|
3888
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3535
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/search-all.js
|
|
3889
3536
|
var SEARCHED = ["crm", ...SOURCE_SEARCHED];
|
|
3890
3537
|
var DEFAULT_LIMIT = 20;
|
|
3891
|
-
var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example, viewerOf: viewerOf2 }) => {
|
|
3892
|
-
const
|
|
3538
|
+
var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example, viewerOf: viewerOf2, leads = true }) => {
|
|
3539
|
+
const deals = leads ? "deals and leads" : "deals";
|
|
3540
|
+
const all = annotate(new Command("all"), { effects: LOCAL_READ, partial: true, output: { entity: "hit" } }).summary(`search stored ${deals}, messages, notes, calendar events and meetings`).description(`search the CRM's ${deals} by the words of their title, company, contacts and activities, and the messages, notes, calendar events and meetings other WireCat tools stored \u2014 best match first. Use it when you do not know where something was written`).argument("<query...>", `words and "phrases"; ${deals} match the words of their title, company, contacts and activities`).addHelpText("after", SAVE_HELP);
|
|
3893
3541
|
searches.addCommand(searchAllOptions(all, SEARCHED));
|
|
3894
3542
|
example(all, "search all Example LLC", "search all website --only crm --json");
|
|
3895
3543
|
all.action(async (words, _opts, leaf) => {
|
|
@@ -3932,7 +3580,7 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
|
|
|
3932
3580
|
...opts.source === void 0 ? {} : { source: opts.source },
|
|
3933
3581
|
...alone ? { scope: { crm: [run3.account] } } : {}
|
|
3934
3582
|
}, { app, hintCommand: commandAt(rootOf2(leaf), "models download") ? app.command : null }, void 0, meaningLane({ env, messenger: { app }, store: /* @__PURE__ */ __name(async () => run3.store, "store") }));
|
|
3935
|
-
const note = /* @__PURE__ */ __name((
|
|
3583
|
+
const note = /* @__PURE__ */ __name((text3) => outputFor(leaf).renderer.note(text3), "note");
|
|
3936
3584
|
for (const { why } of denied)
|
|
3937
3585
|
note(why);
|
|
3938
3586
|
for (const { resource, source, reason } of found.skipped)
|
|
@@ -3951,11 +3599,11 @@ var addCrmSearchAll = /* @__PURE__ */ __name((searches, { within, app, example,
|
|
|
3951
3599
|
});
|
|
3952
3600
|
}, "addCrmSearchAll");
|
|
3953
3601
|
|
|
3954
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3602
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/cli/profile-store.js
|
|
3955
3603
|
import { mkdtempSync, rmSync as rmSync2 } from "node:fs";
|
|
3956
3604
|
import { tmpdir } from "node:os";
|
|
3957
|
-
import { join as
|
|
3958
|
-
var
|
|
3605
|
+
import { join as join3 } from "node:path";
|
|
3606
|
+
var openProfileStore = /* @__PURE__ */ __name(async (options) => {
|
|
3959
3607
|
const { app, env, profile, readOnly, open: open2 } = options;
|
|
3960
3608
|
const locked = readOnly && readOnlyLockOf(app, env) !== void 0;
|
|
3961
3609
|
if (readOnly) {
|
|
@@ -3973,10 +3621,10 @@ var openCrmStore = /* @__PURE__ */ __name(async (options) => {
|
|
|
3973
3621
|
}
|
|
3974
3622
|
if (!locked)
|
|
3975
3623
|
return withProfile(options, env, options.account());
|
|
3976
|
-
const folder = mkdtempSync(
|
|
3624
|
+
const folder = mkdtempSync(join3(tmpdir(), `${app.command}-empty-`));
|
|
3977
3625
|
const removing = /* @__PURE__ */ __name(() => rmSync2(folder, { recursive: true, force: true }), "removing");
|
|
3978
3626
|
try {
|
|
3979
|
-
const empty = await withProfile(options, { ...env, MESSAGING_STORE:
|
|
3627
|
+
const empty = await withProfile(options, { ...env, MESSAGING_STORE: join3(folder, "wirecat.db") }, {
|
|
3980
3628
|
provider: options.provider,
|
|
3981
3629
|
account: profile
|
|
3982
3630
|
});
|
|
@@ -3987,7 +3635,7 @@ var openCrmStore = /* @__PURE__ */ __name(async (options) => {
|
|
|
3987
3635
|
removing();
|
|
3988
3636
|
throw error;
|
|
3989
3637
|
}
|
|
3990
|
-
}, "
|
|
3638
|
+
}, "openProfileStore");
|
|
3991
3639
|
var withProfile = /* @__PURE__ */ __name(async ({ app, profile, open: open2 }, env, account2) => {
|
|
3992
3640
|
const store = await open2(env);
|
|
3993
3641
|
try {
|
|
@@ -4000,7 +3648,10 @@ var withProfile = /* @__PURE__ */ __name(async ({ app, profile, open: open2 }, e
|
|
|
4000
3648
|
}
|
|
4001
3649
|
}, "withProfile");
|
|
4002
3650
|
|
|
4003
|
-
// node_modules/.pnpm/@wirecat+cli-core@0.
|
|
3651
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/store.js
|
|
3652
|
+
var openCrmStore = openProfileStore;
|
|
3653
|
+
|
|
3654
|
+
// node_modules/.pnpm/@wirecat+cli-core@0.720.0_@wirecat+cli-base@0.126.1_commander@15.0.0_esbuild@0.28.2_typ_891204b7e0cfbcc49dd71e2850e8663f/node_modules/@wirecat/cli-core/dist/crm/cli/index.js
|
|
4004
3655
|
var MOST4 = 500;
|
|
4005
3656
|
var STAGE_REF = /^stage:\d+$/;
|
|
4006
3657
|
var timeField = /* @__PURE__ */ __name((name, example, relation) => nativeField({ name, type: "time", operators: ["term", "range"], example, relation }), "timeField");
|
|
@@ -4022,7 +3673,7 @@ var LEADS_QUERY = { entity: "lead", backend: "native", fields: DEAL_FIELDS };
|
|
|
4022
3673
|
var PIPELINES_QUERY = {
|
|
4023
3674
|
entity: "pipeline",
|
|
4024
3675
|
backend: "native",
|
|
4025
|
-
fields: [termField("kind", "enum", "kind:
|
|
3676
|
+
fields: [termField("kind", "enum", "kind:deal", { values: DEAL_KINDS })]
|
|
4026
3677
|
};
|
|
4027
3678
|
var STAGES_QUERY = {
|
|
4028
3679
|
entity: "stage",
|
|
@@ -4168,7 +3819,10 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4168
3819
|
renderAnswer(command, outputFor(command), body, view);
|
|
4169
3820
|
}), "within");
|
|
4170
3821
|
const example = /* @__PURE__ */ __name((command, ...lines) => annotate(command, { examples: lines.map((line) => `${options.app.command} work ${line}`) }), "example");
|
|
4171
|
-
|
|
3822
|
+
const hasLeads = options.leads !== false;
|
|
3823
|
+
const dealsAndLeads = hasLeads ? "deals and leads" : "deals";
|
|
3824
|
+
example(answerEntity(annotate(program.command("sync"), { effects: FETCH, offline: false, cooperative: true, partial: true }), "crm_sync", crmSync).description(`bring the CRM's copy in the local store up to date: pipelines, companies, contacts, ${dealsAndLeads} that changed since the last sync, or everything with --rescan; a run stops before its deadline or --max-pages and the next one goes on from there`).addHelpText("after", `
|
|
3825
|
+
With the activities setting on, it also copies the activities and tasks on the ${dealsAndLeads} it keeps. Then each ${hasLeads ? "deal or lead" : "deal"} that moved into a stage the stage-tasks setting names opens a local task, once per move.`), "sync", "sync --rescan", "sync --max-pages 20").option("--rescan", "list everything again, every id too, dropping a round in progress").option("--max-pages <pages>", "at most this many requests to the CRM in this run", integer(1e5)).action(async (opts, command) => {
|
|
4172
3826
|
const { signal } = environmentOf(command);
|
|
4173
3827
|
await within(command, async (run3) => {
|
|
4174
3828
|
const source = run3.source();
|
|
@@ -4225,7 +3879,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4225
3879
|
await within(command, async (run3) => {
|
|
4226
3880
|
const status = await crmStatus(run3.store, run3.account, { profile: run3.profile, now: now() });
|
|
4227
3881
|
if (await viewerOf(run3))
|
|
4228
|
-
outputFor(command).renderer.note(
|
|
3882
|
+
outputFor(command).renderer.note(`stored counts the whole copy, more than the ${dealsAndLeads} you may read`);
|
|
4229
3883
|
return listOf(pathOf2(command).join(" "), {
|
|
4230
3884
|
items: status.items,
|
|
4231
3885
|
limit: status.limit,
|
|
@@ -4234,7 +3888,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4234
3888
|
});
|
|
4235
3889
|
});
|
|
4236
3890
|
});
|
|
4237
|
-
example(answerEntity(annotate(store.command("apply"), { effects: LOCAL_WRITE }), "crm_contacts_removed", crmContactsApplied).description(
|
|
3891
|
+
example(answerEntity(annotate(store.command("apply"), { effects: LOCAL_WRITE }), "crm_contacts_removed", crmContactsApplied).description(`apply scope mine to the contacts already stored: remove those no ${hasLeads ? "deal or lead" : "deal"} of the chosen users and no kept company names, and the people they leave empty; counts only unless --yes, under scope all too. A sync that narrows the scope, or sync --rescan under mine, does this itself`), "store apply", "store apply --yes").option("--yes", "remove the contacts it counts; otherwise only count them").action(async (opts, command) => {
|
|
4238
3892
|
const yes = opts.yes === true;
|
|
4239
3893
|
await within(command, async (run3) => {
|
|
4240
3894
|
const scope = crmSettingKey(run3.account, "scope");
|
|
@@ -4409,7 +4063,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4409
4063
|
const run3 = /* @__PURE__ */ __name((command, work) => within(command, (opened) => work(contextOf3(opened, command))), "run");
|
|
4410
4064
|
const create = write2("create", "create", `make a ${kind} in the CRM, then store the CRM's copy of it`);
|
|
4411
4065
|
if (create)
|
|
4412
|
-
example(fields2(create), `${plural} create --title "Example kitchen" --amount 15000 --currency EUR`, `${plural} create --title "Example office" --pipeline Sales --stage "Quote sent" --field
|
|
4066
|
+
example(fields2(create), `${plural} create --title "Example kitchen" --amount 15000 --currency EUR`, `${plural} create --title "Example office" --pipeline Sales --stage "Quote sent" --field Source=web`).action(async (opts, command) => {
|
|
4413
4067
|
await run3(command, async (context) => {
|
|
4414
4068
|
const done = await createCrmItem(context, kind, inputOf(opts), idOf2(opts));
|
|
4415
4069
|
return answered(done.operationId, done.item);
|
|
@@ -4417,7 +4071,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4417
4071
|
});
|
|
4418
4072
|
const update2 = write2("update", "update", `change a ${kind} in the CRM; what is left out keeps its value; the CRM's copy is stored again`);
|
|
4419
4073
|
if (update2)
|
|
4420
|
-
example(fields2(reference(update2)), `${plural} update ${kind}:12 --amount 18000`, `${plural} update ${kind}:12 --field
|
|
4074
|
+
example(fields2(reference(update2)), `${plural} update ${kind}:12 --amount 18000`, `${plural} update ${kind}:12 --field Source=`).action(async (ref, opts, command) => {
|
|
4421
4075
|
await run3(command, async (context) => {
|
|
4422
4076
|
const done = await updateCrmItem(context, kind, ref, inputOf(opts), idOf2(opts));
|
|
4423
4077
|
return answered(done.operationId, done.item);
|
|
@@ -4460,7 +4114,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4460
4114
|
if (options.leads !== false)
|
|
4461
4115
|
items("lead");
|
|
4462
4116
|
const pipelines = annotate(program.command("pipelines"), { effects: NO_EFFECTS }).description("the CRM's pipelines and their stages, as last synced");
|
|
4463
|
-
example(withQuery(annotate(pipelines.command("list"), { effects: LOCAL_READ, output: { entity: "pipeline" } }).description("pipelines copied from the CRM, with their stages in order and how many are open in each"), PIPELINES_QUERY), "pipelines list --json", "pipelines list kind:lead").action(async (words, _opts, command) => {
|
|
4117
|
+
example(withQuery(annotate(pipelines.command("list"), { effects: LOCAL_READ, output: { entity: "pipeline" } }).description("pipelines copied from the CRM, with their stages in order and how many are open in each"), PIPELINES_QUERY), "pipelines list --json", ...hasLeads ? ["pipelines list kind:lead"] : []).action(async (words, _opts, command) => {
|
|
4464
4118
|
const terms = queryTerms(words, PIPELINES_QUERY, "pipelines list");
|
|
4465
4119
|
await within(command, async (run3) => {
|
|
4466
4120
|
const found = await run3.store.deals.pipelines({
|
|
@@ -4495,7 +4149,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4495
4149
|
}, (body) => pipelineView(body, outputFor(command).color));
|
|
4496
4150
|
});
|
|
4497
4151
|
const stages = annotate(program.command("stages"), { effects: NO_EFFECTS }).description("the stages of the CRM's pipelines, as last synced");
|
|
4498
|
-
example(withQuery(annotate(stages.command("list"), { effects: LOCAL_READ, output: { entity: "stage" } }).description("every stage of the CRM's pipelines in order, with its outcome and how many are open in it"), STAGES_QUERY), "stages list --json", "stages list kind:lead").action(async (words, _opts, command) => {
|
|
4152
|
+
example(withQuery(annotate(stages.command("list"), { effects: LOCAL_READ, output: { entity: "stage" } }).description("every stage of the CRM's pipelines in order, with its outcome and how many are open in it"), STAGES_QUERY), "stages list --json", ...hasLeads ? ["stages list kind:lead"] : []).action(async (words, _opts, command) => {
|
|
4499
4153
|
const terms = queryTerms(words, STAGES_QUERY, "stages list");
|
|
4500
4154
|
await within(command, async (run3) => {
|
|
4501
4155
|
const kind = terms.has("kind") ? terms.get("kind") : void 0;
|
|
@@ -4538,6 +4192,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4538
4192
|
open: options.open,
|
|
4539
4193
|
app: options.app,
|
|
4540
4194
|
live: options.live ?? [],
|
|
4195
|
+
...options.liveQuery ? { liveQuery: options.liveQuery } : {},
|
|
4541
4196
|
...writes ? { writes } : {},
|
|
4542
4197
|
now
|
|
4543
4198
|
});
|
|
@@ -4545,7 +4200,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4545
4200
|
if (options.files)
|
|
4546
4201
|
addCrmFileCommands(program, { ...options, within, example, now });
|
|
4547
4202
|
const fieldKinds = Object.keys(FIELD_KINDS).filter((word) => word !== "leads" || options.leads !== false);
|
|
4548
|
-
const fields = annotate(program.command("fields"), { effects: NO_EFFECTS }).description(
|
|
4203
|
+
const fields = annotate(program.command("fields"), { effects: NO_EFFECTS }).description(`the CRM's own fields on ${hasLeads ? "deals, leads" : "deals"}, people and organizations, as last synced`);
|
|
4549
4204
|
example(withQuery(answerEntity(annotate(fields.command("list"), { effects: LOCAL_READ }), "crm_field", crmField).description("the CRM's custom fields of one kind, in its order, with a list field's options").argument("<kind>", fieldKinds.join(", ")).option("--limit <n>", `fields per page, 1\u2013${MOST4}`, integer(MOST4), 50).option("--page <n>", "which page, starting at 1", integer(1e6)).option("--all", "every field, no paging"), FIELDS_QUERY), "fields list deals", "fields list people --json").action(async (kind, words, opts, command) => {
|
|
4550
4205
|
if (!fieldKinds.includes(kind))
|
|
4551
4206
|
throw new CliError("validation_error", `fields are listed for ${fieldKinds.join(", ")}; got ${kind}`, {
|
|
@@ -4568,7 +4223,7 @@ var addCrmCommandsDefinition = /* @__PURE__ */ __name((program, options) => {
|
|
|
4568
4223
|
});
|
|
4569
4224
|
});
|
|
4570
4225
|
const search = program.commands.find((one) => one.name() === "search") ?? annotate(program.command("search"), { effects: NO_EFFECTS }).description("search what the local store holds");
|
|
4571
|
-
addCrmSearchAll(search, { within, app: options.app, example, viewerOf });
|
|
4226
|
+
addCrmSearchAll(search, { within, app: options.app, example, viewerOf, leads: hasLeads });
|
|
4572
4227
|
}, "addCrmCommandsDefinition");
|
|
4573
4228
|
var addCrmCommands = honoursDryRun(sharedCommand(addCrmCommandsDefinition));
|
|
4574
4229
|
|
|
@@ -4593,9 +4248,9 @@ var userOf = /* @__PURE__ */ __name(async (command, amo) => {
|
|
|
4593
4248
|
var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
|
|
4594
4249
|
const { env, profile } = contextOf(command);
|
|
4595
4250
|
const [{ openAmoStore, PROVIDER: PROVIDER3 }, { amoCrmSource: amoCrmSource2 }, { amoCrmWriter }] = await Promise.all([
|
|
4596
|
-
import("./store-
|
|
4597
|
-
import("./source-
|
|
4598
|
-
import("./writer-
|
|
4251
|
+
import("./store-A7R2SZVD.js"),
|
|
4252
|
+
import("./source-YISMYLBQ.js"),
|
|
4253
|
+
import("./writer-XDHZ54JD.js")
|
|
4599
4254
|
]);
|
|
4600
4255
|
const accountOf = /* @__PURE__ */ __name(() => {
|
|
4601
4256
|
const signIn = storedSignIn(command) ?? signInOf(command);
|
|
@@ -4614,7 +4269,7 @@ var openProfile = /* @__PURE__ */ __name(async (command, { readOnly }) => {
|
|
|
4614
4269
|
const amo = /* @__PURE__ */ __name(() => transport ??= transportFor(command, signInOf(command)), "amo");
|
|
4615
4270
|
let source;
|
|
4616
4271
|
const asked = /* @__PURE__ */ __name(async () => {
|
|
4617
|
-
const { crmSettingKey: crmSettingKey2 } = await import("./store-
|
|
4272
|
+
const { crmSettingKey: crmSettingKey2 } = await import("./store-FPIU2546.js");
|
|
4618
4273
|
const scope = await store.crm.scope(account2);
|
|
4619
4274
|
return {
|
|
4620
4275
|
mode: scope.mode,
|
|
@@ -4692,7 +4347,28 @@ var texts_en_default = {
|
|
|
4692
4347
|
"done.title": "Connected",
|
|
4693
4348
|
"done.body": "The profile is ready. Copy your deals and their clients into WireCat, then list the open ones:",
|
|
4694
4349
|
"done.oauth.title": "Advanced: sign in through the integration instead",
|
|
4695
|
-
"done.oauth": "
|
|
4350
|
+
"done.oauth": "Instead of a token, an administrator can sign in through the integration in the browser, with its ID and secret key, and amo renews that sign-in itself. amoCRM lets only an account's administrators allow access this way. Run this in a terminal; the secret key is asked hidden:",
|
|
4351
|
+
"role.title": "Are you an administrator of this account?",
|
|
4352
|
+
"role.intro": "Only an amoCRM account administrator can create the integration and its token. If you are not one, an administrator makes the token for you.",
|
|
4353
|
+
"role.admin": "Yes, I am an administrator",
|
|
4354
|
+
"role.admin.hint": "You see \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442 in the menu on the left and can create integrations.",
|
|
4355
|
+
"role.member": "No, I am a user",
|
|
4356
|
+
"role.member.hint": "There is no \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442 in your menu. An administrator sends you the token.",
|
|
4357
|
+
"ask.title": "Ask an administrator for the token",
|
|
4358
|
+
"ask.body": "Send an administrator of your account this request:\n\n> Please create a private WireCat integration in \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442 and send me its long-lived token. How: https://wirecat.dev/en/docs/amo/installation\n\nThe administrator creates the integration, clicks **\xAB\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0442\u043E\u043A\u0435\u043D\xBB** on its **\xAB\u041A\u043B\u044E\u0447\u0438\xBB** tab and passes you the token. The token works like a password: pass it through a password manager, not a group chat.",
|
|
4359
|
+
"ask.rights": "An amoCRM long-lived token acts with the rights of the administrator who made it. With it you see and can change what that administrator can. amo still stops agents' changes with its permissions.",
|
|
4360
|
+
"ask.later": "When you have the token, go on to the next step and paste it.",
|
|
4361
|
+
"token.member": "Paste the token the administrator sent you. If it is lost, the administrator can make a new one on the **\xAB\u041A\u043B\u044E\u0447\u0438\xBB** tab of the same integration.",
|
|
4362
|
+
"done.own": "The token is the administrator's, so a sync copies the administrator's deals at first. Find your own id in the list of users and put it in place of 7001, and your account's address in place of example.amocrm.ru. Only you can change this setting; an agent cannot.",
|
|
4363
|
+
"method.title": "How do you want to sign in?",
|
|
4364
|
+
"method.intro": "Signing in with amoCRM takes one click in the browser and copies nothing by hand. It works for accounts at amocrm.ru; for Kommo, use a token.",
|
|
4365
|
+
"method.browser": "Sign in with amoCRM",
|
|
4366
|
+
"method.browser.hint": "amoCRM creates a WireCat integration in the account, and amo renews the sign-in itself.",
|
|
4367
|
+
"method.token": "With a long-lived token",
|
|
4368
|
+
"method.token.hint": "You create a private integration and paste its token here.",
|
|
4369
|
+
"connect.title": "Allow access in amoCRM",
|
|
4370
|
+
"connect.body": "Open the link below. On connect.wirecat.dev, click amoCRM's button, choose the account and click **\xAB\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C\xBB**. amoCRM creates the WireCat integration in it and sends the integration's secret key to connect.wirecat.dev, which passes it to amo once and keeps no copy. amo saves the sign-in only after the account answers.",
|
|
4371
|
+
"connect.admin": "amoCRM lets only an account administrator allow this. The integration then shows in \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442, where an administrator can switch it off."
|
|
4696
4372
|
};
|
|
4697
4373
|
|
|
4698
4374
|
// dist/setup/texts.es.json
|
|
@@ -4719,7 +4395,28 @@ var texts_es_default = {
|
|
|
4719
4395
|
"done.title": "Conectado",
|
|
4720
4396
|
"done.body": "El perfil est\xE1 listo. Copia tus negocios y sus clientes a WireCat y luego muestra los abiertos:",
|
|
4721
4397
|
"done.oauth.title": "Avanzado: entrar con la integraci\xF3n",
|
|
4722
|
-
"done.oauth": "
|
|
4398
|
+
"done.oauth": "En lugar de un token, un administrador puede iniciar sesi\xF3n con la integraci\xF3n en el navegador, con su ID y su clave secreta, y amo renueva ese acceso solo. amoCRM solo deja dar acceso as\xED a los administradores de la cuenta. Ejecuta esto en una terminal; la clave secreta se pide oculta:",
|
|
4399
|
+
"role.title": "\xBFEres administrador de esta cuenta?",
|
|
4400
|
+
"role.intro": "Solo un administrador de la cuenta de amoCRM puede crear la integraci\xF3n y su token. Si no lo eres, un administrador crea el token para ti.",
|
|
4401
|
+
"role.admin": "S\xED, soy administrador",
|
|
4402
|
+
"role.admin.hint": "Ves \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442 en el men\xFA de la izquierda y puedes crear integraciones.",
|
|
4403
|
+
"role.member": "No, soy usuario",
|
|
4404
|
+
"role.member.hint": "No hay \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442 en tu men\xFA. Un administrador te env\xEDa el token.",
|
|
4405
|
+
"ask.title": "Pide el token a un administrador",
|
|
4406
|
+
"ask.body": "Env\xEDa esta petici\xF3n a un administrador de tu cuenta:\n\n> Crea, por favor, una integraci\xF3n privada WireCat en \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442 y env\xEDame su token de larga duraci\xF3n. C\xF3mo hacerlo: https://wirecat.dev/es/docs/amo/installation\n\nEl administrador crea la integraci\xF3n, pulsa **\xAB\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0442\u043E\u043A\u0435\u043D\xBB** en su pesta\xF1a **\xAB\u041A\u043B\u044E\u0447\u0438\xBB** y te pasa el token. El token funciona como una contrase\xF1a: p\xE1salo con un gestor de contrase\xF1as, no en un chat de grupo.",
|
|
4407
|
+
"ask.rights": "Un token de larga duraci\xF3n de amoCRM act\xFAa con los permisos del administrador que lo cre\xF3. Con \xE9l ves y puedes cambiar lo mismo que ese administrador. amo sigue limitando los cambios de los agentes con sus permisos.",
|
|
4408
|
+
"ask.later": "Cuando tengas el token, pasa al siguiente paso y p\xE9galo.",
|
|
4409
|
+
"token.member": "Pega el token que te envi\xF3 el administrador. Si se perdi\xF3, el administrador puede crear otro en la pesta\xF1a **\xAB\u041A\u043B\u044E\u0447\u0438\xBB** de la misma integraci\xF3n.",
|
|
4410
|
+
"done.own": "El token es del administrador, as\xED que al principio la sincronizaci\xF3n copia los negocios del administrador. Busca tu id en la lista de usuarios y ponlo en lugar de 7001, y la direcci\xF3n de tu cuenta en lugar de example.amocrm.ru. Solo t\xFA puedes cambiar este ajuste; un agente no.",
|
|
4411
|
+
"method.title": "\xBFC\xF3mo quieres entrar?",
|
|
4412
|
+
"method.intro": "Entrar con amoCRM es un clic en el navegador, sin copiar nada a mano. Funciona con cuentas en amocrm.ru; para Kommo, usa un token.",
|
|
4413
|
+
"method.browser": "Entrar con amoCRM",
|
|
4414
|
+
"method.browser.hint": "amoCRM crea una integraci\xF3n de WireCat en la cuenta, y amo renueva el acceso por s\xED mismo.",
|
|
4415
|
+
"method.token": "Con un token de larga duraci\xF3n",
|
|
4416
|
+
"method.token.hint": "Creas una integraci\xF3n privada y pegas aqu\xED su token.",
|
|
4417
|
+
"connect.title": "Permite el acceso en amoCRM",
|
|
4418
|
+
"connect.body": "Abre el enlace de abajo. En connect.wirecat.dev, pulsa el bot\xF3n de amoCRM, elige la cuenta y pulsa **\xAB\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C\xBB**. amoCRM crea en ella la integraci\xF3n de WireCat y env\xEDa su clave secreta a connect.wirecat.dev, que se la pasa a amo una vez y no guarda copia. amo guarda el acceso solo si la cuenta responde.",
|
|
4419
|
+
"connect.admin": "amoCRM solo deja hacerlo a un administrador de la cuenta. La integraci\xF3n aparece luego en \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442, donde un administrador puede desactivarla."
|
|
4723
4420
|
};
|
|
4724
4421
|
|
|
4725
4422
|
// dist/setup/texts.ru.json
|
|
@@ -4746,14 +4443,39 @@ var texts_ru_default = {
|
|
|
4746
4443
|
"done.title": "\u041F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u043E",
|
|
4747
4444
|
"done.body": "\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u0433\u043E\u0442\u043E\u0432. \u0421\u043A\u043E\u043F\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u0432\u043E\u0438 \u0441\u0434\u0435\u043B\u043A\u0438 \u0438 \u0438\u0445 \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u0432 \u0432 WireCat, \u0437\u0430\u0442\u0435\u043C \u0432\u044B\u0432\u0435\u0434\u0438\u0442\u0435 \u043E\u0442\u043A\u0440\u044B\u0442\u044B\u0435:",
|
|
4748
4445
|
"done.oauth.title": "\u0414\u043B\u044F \u043E\u043F\u044B\u0442\u043D\u044B\u0445: \u0432\u0445\u043E\u0434 \u0447\u0435\u0440\u0435\u0437 \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E",
|
|
4749
|
-
"done.oauth": "\
|
|
4446
|
+
"done.oauth": "\u0412\u043C\u0435\u0441\u0442\u043E \u0442\u043E\u043A\u0435\u043D\u0430 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u043C\u043E\u0436\u0435\u0442 \u0432\u0445\u043E\u0434\u0438\u0442\u044C \u0447\u0435\u0440\u0435\u0437 \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u0441 \u0435\u0451 ID \u0438 \u0441\u0435\u043A\u0440\u0435\u0442\u043D\u044B\u043C \u043A\u043B\u044E\u0447\u043E\u043C, \u0438 amo \u0441\u0430\u043C \u043F\u0440\u043E\u0434\u043B\u0435\u0432\u0430\u0435\u0442 \u0442\u0430\u043A\u043E\u0439 \u0432\u0445\u043E\u0434. amoCRM \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u0442\u0430\u043A \u0434\u0430\u0432\u0430\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430\u043C \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430. \u0412\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u0432 \u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B\u0435; \u0441\u0435\u043A\u0440\u0435\u0442\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0441\u043F\u0440\u043E\u0441\u044F\u0442 \u0441\u043A\u0440\u044B\u0442\u043E:",
|
|
4447
|
+
"role.title": "\u0412\u044B \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430?",
|
|
4448
|
+
"role.intro": "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E \u0438 \u0435\u0451 \u0442\u043E\u043A\u0435\u043D \u0432 amoCRM \u043C\u043E\u0436\u0435\u0442 \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430. \u0415\u0441\u043B\u0438 \u0432\u044B \u043D\u0435 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440, \u0442\u043E\u043A\u0435\u043D \u0434\u043B\u044F \u0432\u0430\u0441 \u0441\u0434\u0435\u043B\u0430\u0435\u0442 \u043E\u043D.",
|
|
4449
|
+
"role.admin": "\u0414\u0430, \u044F \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440",
|
|
4450
|
+
"role.admin.hint": "\u0412 \u043C\u0435\u043D\u044E \u0441\u043B\u0435\u0432\u0430 \u0435\u0441\u0442\u044C \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442, \u0438 \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0441\u043E\u0437\u0434\u0430\u0432\u0430\u0442\u044C \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.",
|
|
4451
|
+
"role.member": "\u041D\u0435\u0442, \u044F \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A",
|
|
4452
|
+
"role.member.hint": "\u0412 \u043C\u0435\u043D\u044E \u043D\u0435\u0442 \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442\u0430. \u0422\u043E\u043A\u0435\u043D \u0432\u0430\u043C \u043F\u0440\u0438\u0448\u043B\u0451\u0442 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440.",
|
|
4453
|
+
"ask.title": "\u041F\u043E\u043F\u0440\u043E\u0441\u0438\u0442\u0435 \u0442\u043E\u043A\u0435\u043D \u0443 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430",
|
|
4454
|
+
"ask.body": "\u041E\u0442\u043F\u0440\u0430\u0432\u044C\u0442\u0435 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 \u0442\u0430\u043A\u0443\u044E \u043F\u0440\u043E\u0441\u044C\u0431\u0443:\n\n> \u0421\u043E\u0437\u0434\u0430\u0439, \u043F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u0440\u0438\u0432\u0430\u0442\u043D\u0443\u044E \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E WireCat \u0432 \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442\u0435 \u0438 \u043F\u0440\u0438\u0448\u043B\u0438 \u043C\u043D\u0435 \u0435\u0451 \u0434\u043E\u043B\u0433\u043E\u0441\u0440\u043E\u0447\u043D\u044B\u0439 \u0442\u043E\u043A\u0435\u043D. \u041A\u0430\u043A \u044D\u0442\u043E \u0441\u0434\u0435\u043B\u0430\u0442\u044C: https://wirecat.dev/ru/docs/amo/installation\n\n\u0410\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0441\u043E\u0437\u0434\u0430\u0451\u0442 \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E, \u043D\u0430 \u0435\u0451 \u0432\u043A\u043B\u0430\u0434\u043A\u0435 **\xAB\u041A\u043B\u044E\u0447\u0438\xBB** \u043D\u0430\u0436\u0438\u043C\u0430\u0435\u0442 **\xAB\u0421\u0433\u0435\u043D\u0435\u0440\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0442\u043E\u043A\u0435\u043D\xBB** \u0438 \u043F\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0432\u0430\u043C \u0442\u043E\u043A\u0435\u043D. \u0422\u043E\u043A\u0435\u043D \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043A\u0430\u043A \u043F\u0430\u0440\u043E\u043B\u044C: \u043F\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043E \u0447\u0435\u0440\u0435\u0437 \u043C\u0435\u043D\u0435\u0434\u0436\u0435\u0440 \u043F\u0430\u0440\u043E\u043B\u0435\u0439, \u0430 \u043D\u0435 \u0432 \u043E\u0431\u0449\u0435\u043C \u0447\u0430\u0442\u0435.",
|
|
4455
|
+
"ask.rights": "\u0414\u043E\u043B\u0433\u043E\u0441\u0440\u043E\u0447\u043D\u044B\u0439 \u0442\u043E\u043A\u0435\u043D amoCRM \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0441 \u043F\u0440\u0430\u0432\u0430\u043C\u0438 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u0435\u0433\u043E \u0441\u043E\u0437\u0434\u0430\u043B. \u0421 \u043D\u0438\u043C \u0432\u044B \u0432\u0438\u0434\u0438\u0442\u0435 \u0438 \u043C\u043E\u0436\u0435\u0442\u0435 \u043C\u0435\u043D\u044F\u0442\u044C \u0442\u043E \u0436\u0435, \u0447\u0442\u043E \u0438 \u043E\u043D. \u0418\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u044F \u0430\u0433\u0435\u043D\u0442\u043E\u0432 amo \u0432\u0441\u0451 \u0440\u0430\u0432\u043D\u043E \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D\u0438\u044F\u043C\u0438.",
|
|
4456
|
+
"ask.later": "\u041A\u043E\u0433\u0434\u0430 \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u0435 \u0442\u043E\u043A\u0435\u043D, \u043F\u0435\u0440\u0435\u0445\u043E\u0434\u0438\u0442\u0435 \u043A \u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0435\u043C\u0443 \u0448\u0430\u0433\u0443 \u0438 \u0432\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u0435\u0433\u043E.",
|
|
4457
|
+
"token.member": "\u0412\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u0442\u043E\u043A\u0435\u043D, \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u043F\u0440\u0438\u0441\u043B\u0430\u043B \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440. \u0415\u0441\u043B\u0438 \u0442\u043E\u043A\u0435\u043D \u043F\u043E\u0442\u0435\u0440\u044F\u043B\u0441\u044F, \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0441\u0434\u0435\u043B\u0430\u0435\u0442 \u043D\u043E\u0432\u044B\u0439 \u043D\u0430 \u0432\u043A\u043B\u0430\u0434\u043A\u0435 **\xAB\u041A\u043B\u044E\u0447\u0438\xBB** \u0442\u043E\u0439 \u0436\u0435 \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438.",
|
|
4458
|
+
"done.own": "\u0422\u043E\u043A\u0435\u043D \u043F\u0440\u0438\u043D\u0430\u0434\u043B\u0435\u0436\u0438\u0442 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443, \u043F\u043E\u044D\u0442\u043E\u043C\u0443 \u0441\u0438\u043D\u0445\u0440\u043E\u043D\u0438\u0437\u0430\u0446\u0438\u044F \u0441\u043D\u0430\u0447\u0430\u043B\u0430 \u043A\u043E\u043F\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043E \u0441\u0434\u0435\u043B\u043A\u0438. \u041D\u0430\u0439\u0434\u0438\u0442\u0435 \u0441\u0432\u043E\u0439 \u043D\u043E\u043C\u0435\u0440 \u0432 \u0441\u043F\u0438\u0441\u043A\u0435 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439 \u0438 \u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u0435\u0433\u043E \u0432\u043C\u0435\u0441\u0442\u043E 7001, \u0430 \u0430\u0434\u0440\u0435\u0441 \u0441\u0432\u043E\u0435\u0433\u043E \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430 \u0432\u043C\u0435\u0441\u0442\u043E example.amocrm.ru. \u042D\u0442\u0443 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0443 \u043C\u0435\u043D\u044F\u0435\u0442\u0435 \u0442\u043E\u043B\u044C\u043A\u043E \u0432\u044B, \u0430\u0433\u0435\u043D\u0442\u0443 \u0435\u0451 \u043C\u0435\u043D\u044F\u0442\u044C \u043D\u0435\u043B\u044C\u0437\u044F.",
|
|
4459
|
+
"method.title": "\u041A\u0430\u043A \u0432\u043E\u0439\u0442\u0438?",
|
|
4460
|
+
"method.intro": "\u0412\u0445\u043E\u0434 \u0447\u0435\u0440\u0435\u0437 amoCRM \u2014 \u043E\u0434\u0438\u043D \u043A\u043B\u0438\u043A \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435, \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0443\u0436\u043D\u043E \u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C. \u041E\u043D \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0434\u043B\u044F \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u043E\u0432 \u043D\u0430 amocrm.ru; \u0434\u043B\u044F Kommo \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u0442\u043E\u043A\u0435\u043D.",
|
|
4461
|
+
"method.browser": "\u0412\u043E\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 amoCRM",
|
|
4462
|
+
"method.browser.hint": "amoCRM \u0441\u043E\u0437\u0434\u0430\u0441\u0442 \u0432 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0435 \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E WireCat, \u0430 amo \u0441\u0430\u043C \u0431\u0443\u0434\u0435\u0442 \u043F\u0440\u043E\u0434\u043B\u0435\u0432\u0430\u0442\u044C \u0432\u0445\u043E\u0434.",
|
|
4463
|
+
"method.token": "\u0414\u043E\u043B\u0433\u043E\u0441\u0440\u043E\u0447\u043D\u044B\u043C \u0442\u043E\u043A\u0435\u043D\u043E\u043C",
|
|
4464
|
+
"method.token.hint": "\u0412\u044B \u0441\u043E\u0437\u0434\u0430\u0451\u0442\u0435 \u043F\u0440\u0438\u0432\u0430\u0442\u043D\u0443\u044E \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E \u0438 \u0432\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442\u0435 \u0441\u044E\u0434\u0430 \u0435\u0451 \u0442\u043E\u043A\u0435\u043D.",
|
|
4465
|
+
"connect.title": "\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u0435 \u0434\u043E\u0441\u0442\u0443\u043F \u0432 amoCRM",
|
|
4466
|
+
"connect.body": "\u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0441\u0441\u044B\u043B\u043A\u0443 \u043D\u0438\u0436\u0435. \u041D\u0430 connect.wirecat.dev \u043D\u0430\u0436\u043C\u0438\u0442\u0435 \u043A\u043D\u043E\u043F\u043A\u0443 amoCRM, \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0430\u043A\u043A\u0430\u0443\u043D\u0442 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 **\xAB\u0420\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044C\xBB**. amoCRM \u0441\u043E\u0437\u0434\u0430\u0441\u0442 \u0432 \u043D\u0451\u043C \u0438\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044E WireCat \u0438 \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442 \u0435\u0451 \u0441\u0435\u043A\u0440\u0435\u0442\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u043D\u0430 connect.wirecat.dev, \u0430 \u0442\u043E\u0442 \u043E\u0434\u0438\u043D \u0440\u0430\u0437 \u043F\u0435\u0440\u0435\u0434\u0430\u0441\u0442 \u0435\u0433\u043E amo \u0438 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442 \u043A\u043E\u043F\u0438\u044E. amo \u0441\u043E\u0445\u0440\u0430\u043D\u0438\u0442 \u0432\u0445\u043E\u0434, \u0442\u043E\u043B\u044C\u043A\u043E \u0435\u0441\u043B\u0438 \u0430\u043A\u043A\u0430\u0443\u043D\u0442 \u043E\u0442\u0432\u0435\u0442\u0438\u0442.",
|
|
4467
|
+
"connect.admin": "amoCRM \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u044D\u0442\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0443 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430. \u0418\u043D\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044F \u043F\u043E\u044F\u0432\u0438\u0442\u0441\u044F \u0432 \u0430\u043C\u043E\u041C\u0430\u0440\u043A\u0435\u0442\u0435, \u0438 \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440 \u0441\u043C\u043E\u0436\u0435\u0442 \u0435\u0451 \u043E\u0442\u043A\u043B\u044E\u0447\u0438\u0442\u044C."
|
|
4750
4468
|
};
|
|
4751
4469
|
|
|
4752
4470
|
// dist/setup/flow.js
|
|
4753
|
-
var check2 = /* @__PURE__ */ __name(async ({ command, settings, secrets }) => {
|
|
4471
|
+
var check2 = /* @__PURE__ */ __name(async ({ command, settings, secrets, answers, steps }) => {
|
|
4754
4472
|
refuseCommandName(contextOf(command).profile, commandWords(rootOf(command)), IDENTITY.command);
|
|
4755
4473
|
refuseOffline(command, "the amoCRM account");
|
|
4756
4474
|
const origin = accountOrigin(String(settings.configured.host ?? ""));
|
|
4475
|
+
if (answers.method === "browser") {
|
|
4476
|
+
const { found } = await signInWithButton(command, origin, steps);
|
|
4477
|
+
return { ...found, keep: { account: `${found.account}:${found.user.id}` } };
|
|
4478
|
+
}
|
|
4757
4479
|
const typed = secrets.token?.trim();
|
|
4758
4480
|
if (typed) {
|
|
4759
4481
|
const { who: who2, signIn, account: account2 } = await checkedToken(command, origin, typed);
|
|
@@ -4771,6 +4493,9 @@ var check2 = /* @__PURE__ */ __name(async ({ command, settings, secrets }) => {
|
|
|
4771
4493
|
const who = await withAccount(command, accountUser);
|
|
4772
4494
|
return { ...who, keep: { account: `${who.account}:${who.user.id}` } };
|
|
4773
4495
|
}, "check");
|
|
4496
|
+
var MEMBER = { field: "role", is: "member" };
|
|
4497
|
+
var BROWSER = { field: "method", is: "browser" };
|
|
4498
|
+
var OWN_DEALS = "amo <profile> users list\namo <profile> config set crm.amocrm:example.amocrm.ru.unassigned 7001";
|
|
4774
4499
|
var OAUTH_COMMAND = "amo <profile> session start --host https://<subdomain>.amocrm.ru --client-id <integration ID>";
|
|
4775
4500
|
var amoSetup = defineSetup({
|
|
4776
4501
|
app: IDENTITY,
|
|
@@ -4792,7 +4517,66 @@ var amoSetup = defineSetup({
|
|
|
4792
4517
|
placeholder: "account.host.placeholder"
|
|
4793
4518
|
}
|
|
4794
4519
|
],
|
|
4795
|
-
next: "
|
|
4520
|
+
next: "role"
|
|
4521
|
+
},
|
|
4522
|
+
role: {
|
|
4523
|
+
title: "role.title",
|
|
4524
|
+
blocks: [
|
|
4525
|
+
{ type: "text", text: "role.intro" },
|
|
4526
|
+
{
|
|
4527
|
+
type: "choice",
|
|
4528
|
+
id: "role",
|
|
4529
|
+
optional: true,
|
|
4530
|
+
options: [
|
|
4531
|
+
{ value: "admin", label: "role.admin", hint: "role.admin.hint" },
|
|
4532
|
+
{ value: "member", label: "role.member", hint: "role.member.hint" }
|
|
4533
|
+
]
|
|
4534
|
+
}
|
|
4535
|
+
],
|
|
4536
|
+
next: [{ when: MEMBER, to: "ask-admin" }, { to: "method" }]
|
|
4537
|
+
},
|
|
4538
|
+
method: {
|
|
4539
|
+
title: "method.title",
|
|
4540
|
+
blocks: [
|
|
4541
|
+
{ type: "text", text: "method.intro" },
|
|
4542
|
+
{
|
|
4543
|
+
type: "choice",
|
|
4544
|
+
id: "method",
|
|
4545
|
+
optional: true,
|
|
4546
|
+
options: [
|
|
4547
|
+
{ value: "browser", label: "method.browser", hint: "method.browser.hint" },
|
|
4548
|
+
{ value: "token", label: "method.token", hint: "method.token.hint" }
|
|
4549
|
+
]
|
|
4550
|
+
}
|
|
4551
|
+
],
|
|
4552
|
+
next: [{ when: BROWSER, to: "connect" }, { to: "integration" }]
|
|
4553
|
+
},
|
|
4554
|
+
connect: {
|
|
4555
|
+
kind: "run",
|
|
4556
|
+
title: "connect.title",
|
|
4557
|
+
action: "apply",
|
|
4558
|
+
blocks: [
|
|
4559
|
+
{ type: "text", text: "connect.body" },
|
|
4560
|
+
{ type: "note", role: "warning", text: "connect.admin" }
|
|
4561
|
+
],
|
|
4562
|
+
next: [
|
|
4563
|
+
{ when: { result: "connect", is: "ok" }, to: "done" },
|
|
4564
|
+
{ when: { result: "connect", error: "conflict" }, to: "account" },
|
|
4565
|
+
{ when: { result: "connect", error: "authentication_error" }, to: "method" },
|
|
4566
|
+
{ when: { result: "connect", error: "validation_error" }, to: "method" },
|
|
4567
|
+
{ when: { result: "connect", error: "timeout" }, to: "method" },
|
|
4568
|
+
{ to: "failed" }
|
|
4569
|
+
],
|
|
4570
|
+
back: false
|
|
4571
|
+
},
|
|
4572
|
+
"ask-admin": {
|
|
4573
|
+
title: "ask.title",
|
|
4574
|
+
blocks: [
|
|
4575
|
+
{ type: "text", text: "ask.body" },
|
|
4576
|
+
{ type: "note", role: "warning", text: "ask.rights" },
|
|
4577
|
+
{ type: "text", text: "ask.later" }
|
|
4578
|
+
],
|
|
4579
|
+
next: "token"
|
|
4796
4580
|
},
|
|
4797
4581
|
integration: {
|
|
4798
4582
|
title: "integration.title",
|
|
@@ -4811,7 +4595,8 @@ var amoSetup = defineSetup({
|
|
|
4811
4595
|
token: {
|
|
4812
4596
|
title: "token.title",
|
|
4813
4597
|
blocks: [
|
|
4814
|
-
{ type: "text", text: "token.where" },
|
|
4598
|
+
{ type: "text", text: "token.where", when: { not: MEMBER } },
|
|
4599
|
+
{ type: "text", text: "token.member", when: MEMBER },
|
|
4815
4600
|
{ type: "input", id: "token", secret: "token", input: "password", label: "token.label", hint: "token.hint" },
|
|
4816
4601
|
{ type: "note", role: "tip", text: "token.rights" }
|
|
4817
4602
|
],
|
|
@@ -4841,10 +4626,13 @@ var amoSetup = defineSetup({
|
|
|
4841
4626
|
kind: "done",
|
|
4842
4627
|
title: "done.title",
|
|
4843
4628
|
blocks: [
|
|
4629
|
+
{ type: "text", text: "done.own", when: MEMBER },
|
|
4630
|
+
{ type: "code", code: OWN_DEALS, copy: true, when: MEMBER },
|
|
4844
4631
|
{ type: "text", text: "done.body" },
|
|
4845
4632
|
{ type: "code", code: "amo <profile> sync\namo <profile> deals list status:open", copy: true },
|
|
4846
4633
|
{
|
|
4847
4634
|
type: "group",
|
|
4635
|
+
when: { all: [{ not: MEMBER }, { not: BROWSER }] },
|
|
4848
4636
|
role: "details",
|
|
4849
4637
|
title: "done.oauth.title",
|
|
4850
4638
|
blocks: [
|
|
@@ -4864,7 +4652,7 @@ var update = appUpdate({
|
|
|
4864
4652
|
command: IDENTITY.command,
|
|
4865
4653
|
version: IDENTITY.version,
|
|
4866
4654
|
entry: new URL("../program.js", import.meta.url).href,
|
|
4867
|
-
statePath: /* @__PURE__ */ __name((env) =>
|
|
4655
|
+
statePath: /* @__PURE__ */ __name((env) => join4(resolvePaths({ appName: IDENTITY.appName, prefix: IDENTITY.envPrefix, env }).state, "update-check.json"), "statePath"),
|
|
4868
4656
|
// biome-ignore lint/plugin/no-own-settings: the update check runs before any command exists to give baseContext
|
|
4869
4657
|
enabled: /* @__PURE__ */ __name((env) => configuration.resolveSettings({}, { env, needsProfile: false }).updateCheck, "enabled"),
|
|
4870
4658
|
offVariables: [`${IDENTITY.envPrefix}_NO_UPDATE_CHECK`]
|