odant-work 1.0.55 → 1.0.57
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/#system/certs/russian_trusted_root_ca.pem +32 -32
- package/#system/mail.json.example +9 -9
- package/#system/package-manifest.json +32 -38
- package/#system/settings.json.example +3 -3
- package/$server/$folder/$class/$device/class.js +2 -2
- package/$server/$folder/$class/$domain/class.js +4 -4
- package/$server/$folder/$class/$domain/readme.md +5 -5
- package/$server/$folder/$class/$handler/$task/class.js +2 -2
- package/$server/$folder/$class/$handler/$trigger/class.js +3 -3
- package/$server/$folder/$class/$handler/class.js +9 -9
- package/$server/$folder/$class/$handler/handlers/pages/editor/$handler/class.js +5 -5
- package/$server/$folder/$class/$handler/readme.md +23 -23
- package/$server/$folder/$class/$service/$class/$service/class.js +3 -3
- package/$server/$folder/$class/$structure/$base/class.js +9 -9
- package/$server/$folder/$class/$structure/$server/class.js +17 -1
- package/$server/$folder/$class/$structure/$user/class.js +2 -2
- package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +4 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/readme.md +40 -40
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +34 -34
- package/$server/$folder/$class/ai/config.js +19 -19
- package/$server/$folder/$class/ai/prompt/$method/class.js +41 -41
- package/$server/$folder/$class/ai/skills/approval-flow.md +14 -14
- package/$server/$folder/$class/ai/skills/backup-check.md +13 -13
- package/$server/$folder/$class/ai/skills/computer.md +27 -27
- package/$server/$folder/$class/ai/skills/delegate-task.md +15 -15
- package/$server/$folder/$class/ai/skills/external-signup.md +14 -14
- package/$server/$folder/$class/ai/skills/lan-inventory.md +16 -16
- package/$server/$folder/$class/ai/skills/onboarding.md +15 -15
- package/$server/$folder/$class/ai/skills/orchestration.md +41 -41
- package/$server/$folder/$class/handlers/pages/form/builder/$handler/builder.js +259 -259
- package/$server/$folder/$class/handlers/pages/form/editor/$handler/editor.js +19 -19
- package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +20 -20
- package/$server/$folder/$file/$audio/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$audio/handlers/preview/$handler/preview.js +88 -88
- package/$server/$folder/$file/$call/class.js +10 -10
- package/$server/$folder/$file/$call/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$call/triggers/on_save/$trigger/class.js +48 -48
- package/$server/$folder/$file/$data/class.js +16 -16
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +5 -5
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +26 -26
- package/$server/$folder/$file/$devs/$js/class.js +2 -2
- package/$server/$folder/$file/$devs/$json/class.js +2 -2
- package/$server/$folder/$file/$devs/$ts/class.js +2 -2
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +30 -30
- package/$server/$folder/$file/$eml/class.js +17 -17
- package/$server/$folder/$file/$eml/triggers/on_save/$trigger/class.js +97 -97
- package/$server/$folder/$file/$ics/class.js +44 -44
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +10 -10
- package/$server/$folder/$file/$ics/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$ics/handlers/preview/$handler/preview.js +67 -67
- package/$server/$folder/$file/$ics/readme.md +21 -21
- package/$server/$folder/$file/$image/$svg/class.js +11 -11
- package/$server/$folder/$file/$image/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$image/handlers/preview/$handler/preview.js +33 -33
- package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$logs/class.js +39 -39
- package/$server/$folder/$file/$logs/handlers/methods/txt-test/$handler/class.js +4 -4
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +63 -63
- package/$server/$folder/$file/$office/$outlook/$ics/class.js +227 -227
- package/$server/$folder/$file/$office/$word/$rtf/template.rtf +159 -159
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/voice-ui.js +94 -94
- package/$server/$folder/$file/$task/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$task/progress.md +20 -20
- package/$server/$folder/$file/$task/readme.md +32 -32
- package/$server/$folder/$file/$txt/handlers/preview/$handler/class.js +3 -3
- package/$server/$folder/$file/$txt/handlers/preview/$handler/preview.js +41 -41
- package/$server/$folder/$file/$video/handlers/preview/$handler/class.js +4 -4
- package/$server/$folder/$file/$video/handlers/preview/$handler/preview.js +13 -13
- package/$server/$folder/$file/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/methods/download/$handler/download.js +4 -4
- package/$server/$folder/$file/handlers/pages/form/$handler/class.js +2 -2
- package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +3 -3
- package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +28 -28
- package/$server/$folder/$file/readme.md +31 -31
- package/$server/$folder/class.js +11 -11
- package/$server/$folder/handlers/methods/create/progress.md +15 -15
- package/$server/$folder/handlers/pages/form/$handler/class.js +5 -5
- package/$server/$folder/handlers/readme.md +24 -24
- package/$server/$folder/lib/calendar-form/calendar-form.js +296 -296
- package/$server/$folder/lib/dialogs/confirm/confirm.js +30 -30
- package/$server/$folder/lib/dialogs/input/input.js +57 -57
- package/$server/$folder/lib/email/settings.js +82 -82
- package/$server/$folder/lib/file-viewer/file-viewer.js +8 -8
- package/$server/$folder/lib/icon/user/user.js +6 -6
- package/$server/$folder/lib/item-data-grid/item-data-grid.js +48 -48
- package/$server/$folder/lib/item-form/item-form.js +84 -84
- package/$server/$folder/lib/menu/progress.md +13 -13
- package/$server/$folder/lib/menu/readme.md +29 -29
- package/$server/$folder/lib/node/progress.md +13 -13
- package/$server/$folder/lib/node/readme.md +29 -29
- package/$server/$folder/lib/pack/pack.js +4 -4
- package/$server/$folder/lib/prompt-bar/progress.md +13 -13
- package/$server/$folder/lib/security/admin/admin.js +30 -30
- package/$server/$folder/lib/site-loc/readme.md +16 -16
- package/$server/$folder/lib/site-loc/site-loc.js +80 -80
- package/$server/$folder/lib/tree/progress.md +16 -16
- package/$server/$folder/readme.md +18 -18
- package/$server/readme.md +13 -13
- package/.cursor/rules/work.mdc +8 -8
- package/.github/workflows/ci.yml +39 -39
- package/MODELS/$ai/$folder/$class/$ai/handlers/pages/form/trainer/$handler/trainer.js +26 -1
- package/MODELS/$ai/$folder/$class/$provider/handlers/pages/form/trainer/$handler/trainer.js +8 -1
- package/MODELS/$ai/$folder/$class/$provider/readme.md +16 -16
- package/MODELS/GigaChat/$provider/readme.md +24 -24
- package/MODULES/Register/$module/$folder/$class/$register/class.js +4 -4
- package/MODULES/Register/$module/$folder/$class/$struct/class.js +4 -4
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/class.js +14 -14
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213//320/244/320/270/320/267. /320/273/320/270/321/206/320/260/$catalog/class.js" +11 -11
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/241/321/207/321/221/321/202 /320/275/320/260 /320/276/320/277/320/273/320/260/321/202/321/203.html" +40 -40
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217//320/237/320/276/320/272/321/203/320/277/320/260/321/202/320/265/320/273/321/216/$operation/print//320/242/320/276/320/262/320/260/321/200/320/275/320/260/321/217 /320/275/320/260/320/272/320/273/320/260/320/264/320/275/320/260/321/217.html" +56 -56
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/class.js +18 -18
- package/MODULES/Register/REGISTER/$register/$folder/$class/$register/class.js +11 -11
- package/MODULES/Register/REGISTER/68/01/$account/class.js +1 -1
- package/MODULES/Register/REGISTER/68/02/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/320/276/320/262/321/213/320/271 /321/200/320/265/320/267/320/265/321/200/320/262/$account/class.js" +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/222 /320/276/321/202/320/277/321/203/321/201/320/272/320/265/$account/class.js" +1 -1
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213//320/240/320/260/320/261/320/276/321/202/320/260/321/216/321/202/$account/class.js +1 -1
- package/MODULES/Register/REGISTER//320/242/320/265/321/205/320/275/320/270/321/207/320/265/321/201/320/272/320/270/320/271/$account/class.js +1 -1
- package/MODULES/Register/STRUCTS/$struct/$folder/$class/$struct/class.js +4 -4
- package/MODULES/Register/STRUCTS/$struct/class.js +4 -4
- package/MODULES/Register/STRUCTS//320/220/320/264/321/200/320/265/321/201/$struct/class.js +11 -11
- package/MODULES/Register/STRUCTS//320/225/320/264/320/270/320/275/320/270/321/206/320/260 /320/270/320/267/320/274/320/265/321/200/320/265/320/275/320/270/321/217/$struct/class.js" +11 -11
- package/MODULES/Register/STRUCTS//320/237/320/260/321/201/320/277/320/276/321/200/321/202/$struct/class.js +11 -11
- package/NODES/$node/$folder/$class/$node/class.js +35 -35
- package/NODES/$node/class.js +5 -5
- package/NODES/$node/handlers/pages/form/network/$handler/class.js +5 -5
- package/NODES/$node/handlers/pages/form/network/$handler/network.js +110 -110
- package/NODES/teewtew/$node/class.js +2 -2
- package/NODES/work.odant.org/$node/class.js +3 -3
- package/ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base/class.js +17 -17
- package/ORGANIZATIONS/$domain/$folder/$class/$base/class.js +4 -4
- package/SERVICES/$service/$folder/$storage/$service/class.js +8 -8
- package/SERVICES/$service/$folder/$storage/$service/handlers/pages/form/mcp/$handler/mcp.js +22 -4
- package/SERVICES/1C/$service/class.js +209 -0
- package/SERVICES/Bitrix24/$service/class.js +180 -0
- package/SERVICES/CBR/$service/class.js +263 -0
- package/SERVICES/DaData/$service/class.js +352 -0
- package/SERVICES/DuckDuckGo/$service/class.js +3 -2
- package/SERVICES/RuCalendar/$service/class.js +289 -0
- package/SERVICES/SearXNG/$service/class.js +3 -1
- package/SERVICES/Telegram/$service/class.js +170 -114
- package/SERVICES/Weather/$service/class.js +3 -1
- package/SERVICES/Yandex/$service/class.js +4 -2
- package/SERVICES/YandexDisk/$service/class.js +191 -0
- package/SERVICES/readme.md +31 -43
- package/USERS/$users/class.js +2 -2
- package/eslint.config.js +51 -51
- package/jsconfig.json +37 -37
- package/oda/benchmarks/dbmon/lib/ENV.js +213 -213
- package/oda/benchmarks/dbmon/lib/ga.js +11 -11
- package/oda/benchmarks/dbmon/lib/memory-stats.js +105 -105
- package/oda/benchmarks/dbmon/lib/monitor.js +69 -69
- package/oda/benchmarks/sierpinski/sierpinski.js +149 -149
- package/oda/components/editors/code-editor/code-editor.js +387 -387
- package/oda/components/editors/code-editor/src/ace.js +16 -16
- package/oda/components/editors/code-editor/src/beautify-css.js +1625 -1625
- package/oda/components/editors/code-editor/src/beautify-html.js +3122 -3122
- package/oda/components/editors/code-editor/src/beautify.js +4005 -4005
- package/oda/components/editors/code-editor/src/ext-beautify.js +7 -7
- package/oda/components/editors/code-editor/src/ext-code_lens.js +7 -7
- package/oda/components/editors/code-editor/src/ext-elastic_tabstops_lite.js +7 -7
- package/oda/components/editors/code-editor/src/ext-emmet.js +7 -7
- package/oda/components/editors/code-editor/src/ext-error_marker.js +7 -7
- package/oda/components/editors/code-editor/src/ext-hardwrap.js +7 -7
- package/oda/components/editors/code-editor/src/ext-keybinding_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-language_tools.js +7 -7
- package/oda/components/editors/code-editor/src/ext-linking.js +7 -7
- package/oda/components/editors/code-editor/src/ext-modelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-options.js +7 -7
- package/oda/components/editors/code-editor/src/ext-prompt.js +7 -7
- package/oda/components/editors/code-editor/src/ext-rtl.js +7 -7
- package/oda/components/editors/code-editor/src/ext-searchbox.js +7 -7
- package/oda/components/editors/code-editor/src/ext-settings_menu.js +7 -7
- package/oda/components/editors/code-editor/src/ext-spellcheck.js +7 -7
- package/oda/components/editors/code-editor/src/ext-split.js +7 -7
- package/oda/components/editors/code-editor/src/ext-static_highlight.js +7 -7
- package/oda/components/editors/code-editor/src/ext-statusbar.js +7 -7
- package/oda/components/editors/code-editor/src/ext-textarea.js +7 -7
- package/oda/components/editors/code-editor/src/ext-themelist.js +7 -7
- package/oda/components/editors/code-editor/src/ext-whitespace.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-emacs.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-sublime.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vim.js +7 -7
- package/oda/components/editors/code-editor/src/keybinding-vscode.js +7 -7
- package/oda/components/editors/code-editor/src/mode-css.js +7 -7
- package/oda/components/editors/code-editor/src/mode-html.js +7 -7
- package/oda/components/editors/code-editor/src/mode-javascript.js +7 -7
- package/oda/components/editors/code-editor/src/mode-json.js +7 -7
- package/oda/components/editors/code-editor/src/mode-markdown.js +7 -7
- package/oda/components/editors/code-editor/src/mode-svg.js +7 -7
- package/oda/components/editors/code-editor/src/mode-text.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xml.js +7 -7
- package/oda/components/editors/code-editor/src/mode-xquery.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/css.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/html.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/javascript.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/json.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/markdown.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/svg.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/text.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xml.js +7 -7
- package/oda/components/editors/code-editor/src/snippets/xquery.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_dark.js +7 -7
- package/oda/components/editors/code-editor/src/theme-solarized_light.js +7 -7
- package/oda/components/editors/markdown/markdown-editor/lib/font-awesome.min.css +3 -3
- package/oda/components/editors/markdown/markdown-editor/lib/readme.md +332 -332
- package/oda/components/editors/markdown/markdown-editor/markdown-editor.js +78 -78
- package/oda/components/editors/markdown/markdown-viewer/test.md +239 -239
- package/oda/components/editors/markdown/markdown.js +76 -76
- package/oda/components/inputs/block/readme.md +39 -39
- package/oda/components/inputs/checkbox/checkbox.js +92 -92
- package/oda/components/inputs/color/color.js +83 -83
- package/oda/components/inputs/date/date.js +40 -40
- package/oda/components/inputs/input/input.js +219 -219
- package/oda/components/inputs/link/readme.md +42 -42
- package/oda/components/inputs/markdown-input/markdown-input.js +77 -77
- package/oda/components/inputs/numeric/numeric.js +141 -141
- package/oda/components/inputs/table-input/readme.md +39 -39
- package/oda/components/inputs/text/text.js +88 -88
- package/oda/components/inputs/toggle/toggle.js +101 -101
- package/oda/components/layouts/hexagon-layout/hexagon-layout.js +218 -218
- package/oda/components/menus/menu/index_old.html +140 -140
- package/oda/components/menus/menu/menu.js +238 -238
- package/oda/components/structure/controls-map.js +56 -56
- package/oda/components/structure/controls.js +29 -29
- package/oda/components/structure/readme.md +31 -31
- package/oda/components/structure/structure.js +64 -64
- package/oda/components/table/index.html +210 -210
- package/oda/components/table/lib/coerce.js +68 -68
- package/oda/components/table/lib/column.js +568 -568
- package/oda/components/table/readme.md +120 -120
- package/oda/components/table/router.js +86 -86
- package/oda/components/table/settings.js +89 -89
- package/oda/index.html +159 -159
- package/oda/tools/icons/icons-set/icons-set.js +60 -60
- package/oda/tools/icons/lib/svg/_makeSVG.html +41 -41
- package/oda/tools/icons/lib/svg/aws.svg +2679 -2679
- package/oda/tools/icons/lib/svg/info.json +46 -46
- package/oda/tools/jupyter/demo.ipynb +160 -160
- package/oda/tools/jupyter/lib/print_elements.js +73 -73
- package/oda/tools/jupyter/test-2.ipynb +305 -305
- package/oda/tools/jupyter/test.ipynb +603 -603
- package/oda/tools/styles/adoptedStyleSheets.js +333 -333
- package/oda/tools/tester/device-preview/devices.json +9 -9
- package/opencode.json +9 -9
- package/package.json +1 -1
- package/publish.cmd +2 -2
- package/readme.md +164 -164
- package/rules/rules.md +445 -445
- package/scripts/SYNC-README.md +107 -107
- package/scripts/agent-eval.mjs +223 -223
- package/scripts/dump-svn-chat.mjs +9 -9
- package/scripts/extract-chat-day.mjs +21 -21
- package/scripts/rag-bench.mjs +166 -166
- package/scripts/restore-chat.mjs +166 -166
- package/scripts/sync-svn-git.bat +129 -129
- package/scripts/test-merge.mjs +75 -75
- package/scripts/work-desktop-bridge.mjs +101 -101
- package/sources/client/field.js +168 -168
- package/sources/client/index.js +32 -32
- package/sources/client/readme.md +16 -16
- package/sources/core.js +91 -91
- package/sources/data/choices.js +125 -125
- package/sources/data/progress.md +14 -0
- package/sources/host/babel-merge.js +353 -353
- package/sources/host/config.js +48 -48
- package/sources/host/email-utils.js +269 -269
- package/sources/host/index-db.js +94 -94
- package/sources/host/net-guard.js +228 -228
- package/sources/host/package-install.js +63 -63
- package/sources/host/progress.md +14 -14
- package/sources/host/push.js +86 -86
- package/sources/host/readme.md +41 -41
- package/sources/host/secret-box.js +93 -93
- package/sources/host/server-id.js +26 -26
- package/sources/host/stun.js +33 -33
- package/sources/host/tls-ca.js +60 -60
- package/sources/host/vapid.js +14 -14
- package/sources/index.html +49 -49
- package/sources/manifest.json +49 -49
- package/sources/modules/a2a/server.js +608 -608
- package/sources/modules/agent/connections.js +442 -442
- package/sources/modules/agent/diff.js +69 -69
- package/sources/modules/agent/eval.js +222 -222
- package/sources/modules/agent/extensions.js +118 -39
- package/sources/modules/agent/hooks.js +131 -131
- package/sources/modules/agent/log.js +43 -43
- package/sources/modules/agent/mcp-pool.js +253 -253
- package/sources/modules/agent/plugins.js +343 -343
- package/sources/modules/agent/recovery.js +89 -89
- package/sources/modules/agent/taint.js +100 -100
- package/sources/modules/agent/tools/branch.js +311 -311
- package/sources/modules/agent/tools/browser.js +254 -254
- package/sources/modules/agent/tools/computer.js +120 -120
- package/sources/modules/agent/tools/connect.js +316 -316
- package/sources/modules/agent/tools/dev/lsp.js +334 -334
- package/sources/modules/agent/tools/dev/patch.js +564 -564
- package/sources/modules/agent/tools/memory.js +153 -153
- package/sources/modules/agent/tools/os-files.js +358 -358
- package/sources/modules/agent/tools/plugins.js +80 -80
- package/sources/modules/agent/tools/sandbox.js +268 -268
- package/sources/modules/agent/types.d.ts +183 -183
- package/sources/modules/agent/undo.js +254 -254
- package/sources/modules/agent/util.js +179 -179
- package/sources/modules/agent/voice.js +1 -1
- package/sources/modules/contacts/contacts.js +200 -200
- package/sources/modules/contacts/index.html +546 -546
- package/sources/modules/lan/discovery.js +192 -192
- package/sources/modules/lan/store.js +62 -62
- package/sources/modules/mcp/readme.md +70 -70
- package/sources/modules/mcp/server.js +525 -525
- package/sources/modules/mcp/tokens.js +140 -140
- package/sources/modules/nodes/identity.js +123 -123
- package/sources/modules/nodes/inbound.js +172 -172
- package/sources/modules/nodes/outbound.js +105 -105
- package/sources/modules/nodes/signing.js +71 -71
- package/sources/modules/rag/embed-worker.js +36 -36
- package/sources/modules/rag/readme.md +70 -70
- package/sources/modules/readme.md +21 -21
- package/sources/modules/sandbox/config.js +74 -74
- package/sources/modules/sandbox/driver.js +100 -100
- package/sources/modules/sandbox/images/work-computer/Dockerfile +34 -34
- package/sources/modules/sandbox/images/work-computer/entrypoint.sh +24 -24
- package/sources/modules/sandbox/manager.js +1089 -1089
- package/sources/modules/sandbox/readme.md +63 -63
- package/sources/modules/sandbox/vnc-proxy.js +296 -296
- package/sources/modules/trainer/halogen.js +24 -3
- package/sources/modules/trainer/huggingface.js +73 -11
- package/sources/modules/trainer/index.js +54 -28
- package/sources/modules/trainer/local-engine.js +38 -8
- package/sources/modules/trainer/paths.js +8 -0
- package/sources/modules/trainer/providers.js +14 -0
- package/sources/modules/trainer/worker/local_infer_worker.py +160 -1
- package/sources/readme.md +216 -216
- package/sources/server/access/audit.js +138 -138
- package/sources/server/access/gateway.js +1 -0
- package/sources/server/access/refs.js +106 -106
- package/sources/server/assert-class-id.js +23 -23
- package/sources/server/external-source.js +90 -90
- package/sources/server/index.js +12 -12
- package/sources/server/memory-mark.js +34 -34
- package/sources/server/readme.md +110 -110
- package/sources/server/safe-node-name.js +67 -67
- package/sources/server/upload-mark.js +24 -24
- package/sources/server/zip-guard.js +81 -81
- package/sources/tester.html +54 -54
- package/whitepaper.md +568 -568
- package/SERVICES/ArgoCD/$service/$folder/$class/$service/class.js +0 -356
- package/SERVICES/ArgoCD/$service/$folder/$class/$service/handlers/pages/form/orders/$handler/class.js +0 -244
- package/SERVICES/ArgoCD/$service/$folder/$class/$service/handlers/pages/form/settings/$handler/class.js +0 -135
- package/SERVICES/ArgoCD/$service/class.js +0 -4
- package/SERVICES/ArgoCD/$service/readme.md +0 -63
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/class.js +0 -10
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/checkDomain/$method/class.js +0 -33
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/provision/$method/class.js +0 -225
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/methods/submitOrder/$method/class.js +0 -77
- package/SERVICES/ArgoCD/PaaS/$service/$folder/$class/$service/readme.md +0 -33
- package/SERVICES/ArgoCD/PaaS/$service/class.js +0 -347
- package/SERVICES/ArgoCD/PaaS/$service/order/pass.order +0 -9
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 1С:Предприятие (OData) — интеграция с типовыми конфигурациями 1С
|
|
3
|
+
* (1С:Бухгалтерия 3.0, 1С:УНФ, 1С:Управление торговлей 11, 1С:КА, 1С:ERP)
|
|
4
|
+
* через стандартный REST-интерфейс OData (`/odata/standard.odata`).
|
|
5
|
+
*
|
|
6
|
+
* Настройка подключения:
|
|
7
|
+
* - `baseUrl`: адрес опубликованной базы 1С, например `http://localhost/buh/odata/standard.odata`;
|
|
8
|
+
* - учётные данные: в `#secret/1c.json` (`{ "url": "...", "user": "Администратор", "password": "..." }`)
|
|
9
|
+
* или `apiKey` (Basic-строка `user:password` / Bearer).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
async function resolve1CConfig(service) {
|
|
13
|
+
let sec = null;
|
|
14
|
+
try {
|
|
15
|
+
sec = await service.read_secret({ filename: '1c.json' });
|
|
16
|
+
}
|
|
17
|
+
catch { /* ignore */ }
|
|
18
|
+
let baseUrl = String(sec?.url || sec?.baseUrl || service?.baseUrl || service?.DATA?.baseUrl || '').trim();
|
|
19
|
+
if (baseUrl && !/\/odata\/standard\.odata\/?$/i.test(baseUrl))
|
|
20
|
+
baseUrl = baseUrl.replace(/\/+$/, '') + '/odata/standard.odata';
|
|
21
|
+
baseUrl = baseUrl.replace(/\/+$/, '');
|
|
22
|
+
|
|
23
|
+
const user = String(sec?.user || sec?.username || '').trim();
|
|
24
|
+
const password = String(sec?.password ?? '');
|
|
25
|
+
const apiKey = String(sec?.token || service?.apiKey || service?.DATA?.apiKey || '').trim();
|
|
26
|
+
|
|
27
|
+
let authHeader = '';
|
|
28
|
+
if (user) {
|
|
29
|
+
authHeader = 'Basic ' + Buffer.from(`${user}:${password}`, 'utf8').toString('base64');
|
|
30
|
+
}
|
|
31
|
+
else if (apiKey && !apiKey.startsWith('secret:')) {
|
|
32
|
+
authHeader = apiKey.includes(':')
|
|
33
|
+
? 'Basic ' + Buffer.from(apiKey, 'utf8').toString('base64')
|
|
34
|
+
: (apiKey.startsWith('Basic ') || apiKey.startsWith('Bearer ') ? apiKey : `Basic ${apiKey}`);
|
|
35
|
+
}
|
|
36
|
+
return { baseUrl, authHeader };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function odataRequest(service, relPath = '', { method = 'GET', query = {}, body = null } = {}) {
|
|
40
|
+
const { baseUrl, authHeader } = await resolve1CConfig(service);
|
|
41
|
+
if (!baseUrl || baseUrl.includes('example.com')) {
|
|
42
|
+
return {
|
|
43
|
+
notConfigured: true,
|
|
44
|
+
hint: 'Укажите адрес публикации OData вашей базы 1С в поле baseUrl сервиса /SERVICES/1C (например http://1c-server/buh/odata/standard.odata) и учётные данные в #secret/1c.json ({ "user": "...", "password": "..." }).',
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const qs = new URLSearchParams({ $format: 'json', ...query });
|
|
48
|
+
const sep = relPath.startsWith('/') ? '' : '/';
|
|
49
|
+
const url = `${baseUrl}${relPath ? sep + relPath : ''}?${qs.toString()}`;
|
|
50
|
+
const headers = {
|
|
51
|
+
Accept: 'application/json',
|
|
52
|
+
...(authHeader ? { Authorization: authHeader } : {}),
|
|
53
|
+
...(body ? { 'Content-Type': 'application/json; charset=utf-8' } : {}),
|
|
54
|
+
};
|
|
55
|
+
const res = await fetch(url, {
|
|
56
|
+
method,
|
|
57
|
+
headers,
|
|
58
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
59
|
+
signal: AbortSignal.timeout(20000),
|
|
60
|
+
});
|
|
61
|
+
const raw = await res.text();
|
|
62
|
+
if (!res.ok)
|
|
63
|
+
return { error: `1С OData HTTP ${res.status}: ${raw.slice(0, 300)}` };
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(raw);
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return { raw: raw.slice(0, 2000) };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default {
|
|
73
|
+
icon: 'carbon:data-share',
|
|
74
|
+
label: '1С:Предприятие (OData)',
|
|
75
|
+
description: 'Обмен справочниками, контрагентами, номенклатурой и документами с 1С:Бухгалтерия / УНФ / УТ / ERP через стандартный REST-интерфейс OData',
|
|
76
|
+
baseUrl: '',
|
|
77
|
+
apiKey: '',
|
|
78
|
+
capabilities: ['1c', 'erp', 'odata', 'accounting'],
|
|
79
|
+
enabled: true,
|
|
80
|
+
|
|
81
|
+
SCHEMA: {
|
|
82
|
+
list_entities: {
|
|
83
|
+
readonly: true,
|
|
84
|
+
description: 'Получить список опубликованных в 1С справочников (Catalog_*), документов (Document_*), планов счетов и регистров (InformationRegister_*, AccumulationRegister_*).',
|
|
85
|
+
params: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: {
|
|
88
|
+
filter: { type: 'string', description: 'Фильтр по названию коллекции (например "Контрагенты", "Номенклатура", "Реализация")' },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
query_entities: {
|
|
93
|
+
readonly: true,
|
|
94
|
+
description: 'Выбрать объекты из справочника, документа или регистра 1С по протоколу OData ($filter, $select, $top, $orderby).',
|
|
95
|
+
params: {
|
|
96
|
+
type: 'object',
|
|
97
|
+
properties: {
|
|
98
|
+
entity: { type: 'string', description: 'Имя коллекции OData в 1С, например "Catalog_Контрагенты", "Catalog_Номенклатура" или "Document_РеализацияТоваровУслуг"' },
|
|
99
|
+
filter: { type: 'string', description: 'Выражение OData $filter, например "ИНН eq \'7707083893\' and DeletionMark eq false"' },
|
|
100
|
+
select: { type: 'string', description: 'Поля через запятую ($select), например "Ref_Key,Code,Description,ИНН,КПП"' },
|
|
101
|
+
orderby: { type: 'string', description: 'Сортировка ($orderby), например "Date desc"' },
|
|
102
|
+
top: { type: 'number', description: 'Максимальное количество записей ($top, по умолчанию 25)' },
|
|
103
|
+
},
|
|
104
|
+
required: ['entity'],
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
get_counterparty_by_inn: {
|
|
108
|
+
readonly: true,
|
|
109
|
+
description: 'Найти контрагента в справочнике Catalog_Контрагенты базы 1С по ИНН.',
|
|
110
|
+
params: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
inn: { type: 'string', description: 'ИНН контрагента (10 или 12 цифр)' },
|
|
114
|
+
},
|
|
115
|
+
required: ['inn'],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
create_entity: {
|
|
119
|
+
readonly: false,
|
|
120
|
+
description: 'Создать новый элемент справочника или документ в 1С через POST /odata/standard.odata/<entity>.',
|
|
121
|
+
params: {
|
|
122
|
+
type: 'object',
|
|
123
|
+
properties: {
|
|
124
|
+
entity: { type: 'string', description: 'Имя коллекции OData в 1С, например "Catalog_Контрагенты"' },
|
|
125
|
+
data: { type: 'object', description: 'Поля создаваемого объекта 1С в формате JSON' },
|
|
126
|
+
},
|
|
127
|
+
required: ['entity', 'data'],
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
async list_entities(params = {}) {
|
|
133
|
+
try {
|
|
134
|
+
const res = await odataRequest(this, '');
|
|
135
|
+
if (res?.notConfigured || res?.error)
|
|
136
|
+
return res;
|
|
137
|
+
const sets = (res?.value || []).map(v => ({
|
|
138
|
+
name: v.name || v.url,
|
|
139
|
+
kind: v.kind || 'EntitySet',
|
|
140
|
+
}));
|
|
141
|
+
const q = String(params.filter || '').trim().toLowerCase();
|
|
142
|
+
const filtered = q ? sets.filter(s => String(s.name).toLowerCase().includes(q)) : sets;
|
|
143
|
+
return {
|
|
144
|
+
source: '1C OData',
|
|
145
|
+
total: filtered.length,
|
|
146
|
+
entities: filtered.slice(0, 100),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (e) {
|
|
150
|
+
return { error: String(e?.message || e) };
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
async query_entities(params = {}) {
|
|
155
|
+
const entity = String(params.entity || '').trim();
|
|
156
|
+
if (!entity)
|
|
157
|
+
return { error: 'query_entities: укажите имя коллекции entity (например Catalog_Контрагенты)' };
|
|
158
|
+
const top = Math.min(Math.max(Number(params.top) || 25, 1), 200);
|
|
159
|
+
const query = { $top: String(top) };
|
|
160
|
+
if (params.filter) query.$filter = String(params.filter).trim();
|
|
161
|
+
if (params.select) query.$select = String(params.select).trim();
|
|
162
|
+
if (params.orderby) query.$orderby = String(params.orderby).trim();
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
const res = await odataRequest(this, encodeURI(entity), { query });
|
|
166
|
+
if (res?.notConfigured || res?.error)
|
|
167
|
+
return res;
|
|
168
|
+
const items = Array.isArray(res?.value) ? res.value : [];
|
|
169
|
+
return {
|
|
170
|
+
source: '1C OData',
|
|
171
|
+
entity,
|
|
172
|
+
count: items.length,
|
|
173
|
+
items,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
return { error: String(e?.message || e) };
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
async get_counterparty_by_inn(params = {}) {
|
|
182
|
+
const inn = String(params.inn || '').replace(/\D+/g, '');
|
|
183
|
+
if (!inn)
|
|
184
|
+
return { error: 'get_counterparty_by_inn: укажите ИНН' };
|
|
185
|
+
return this.query_entities({
|
|
186
|
+
entity: 'Catalog_Контрагенты',
|
|
187
|
+
filter: `ИНН eq '${inn}' and DeletionMark eq false`,
|
|
188
|
+
select: 'Ref_Key,Code,Description,НаименованиеПолное,ИНН,КПП,ЮрФизЛицо',
|
|
189
|
+
top: 10,
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
async create_entity(params = {}) {
|
|
194
|
+
const entity = String(params.entity || '').trim();
|
|
195
|
+
const data = params.data;
|
|
196
|
+
if (!entity || !data || typeof data !== 'object')
|
|
197
|
+
return { error: 'create_entity: укажите entity и объект data' };
|
|
198
|
+
try {
|
|
199
|
+
const res = await odataRequest(this, encodeURI(entity), {
|
|
200
|
+
method: 'POST',
|
|
201
|
+
body: data,
|
|
202
|
+
});
|
|
203
|
+
return res;
|
|
204
|
+
}
|
|
205
|
+
catch (e) {
|
|
206
|
+
return { error: String(e?.message || e) };
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitrix24 — интеграция с CRM и задачами «Битрикс24» через стандартный входящий вебхук.
|
|
3
|
+
*
|
|
4
|
+
* Настройка подключения:
|
|
5
|
+
* - Создайте в Битрикс24 («Разработчикам» -> «Другое» -> «Входящий вебхук») вебхук с правами `crm` и `task`;
|
|
6
|
+
* - Сохраните URL вебхука (`https://<портал>.bitrix24.ru/rest/<user>/<код>/`) в `#secret/bitrix24.json`
|
|
7
|
+
* (`{ "webhookUrl": "https://..." }`) или в поле `baseUrl` сервиса `/SERVICES/Bitrix24`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
async function resolveBitrixWebhook(service) {
|
|
11
|
+
try {
|
|
12
|
+
const sec = await service.read_secret({ filename: 'bitrix24.json' });
|
|
13
|
+
if (sec?.webhookUrl || sec?.url)
|
|
14
|
+
return String(sec.webhookUrl || sec.url).trim().replace(/\/+$/, '');
|
|
15
|
+
}
|
|
16
|
+
catch { /* ignore */ }
|
|
17
|
+
const direct = String(service?.baseUrl || service?.DATA?.baseUrl || '').trim().replace(/\/+$/, '');
|
|
18
|
+
if (direct && /^https?:\/\/.+\/rest\//i.test(direct))
|
|
19
|
+
return direct;
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function callBitrix(service, method, payload = {}) {
|
|
24
|
+
const webhook = await resolveBitrixWebhook(service);
|
|
25
|
+
if (!webhook) {
|
|
26
|
+
return {
|
|
27
|
+
notConfigured: true,
|
|
28
|
+
hint: 'Укажите URL входящего вебхука Битрикс24 (https://<портал>.bitrix24.ru/rest/<id>/<код>/) в #secret/bitrix24.json ({ "webhookUrl": "..." }) или в поле baseUrl сервиса /SERVICES/Bitrix24.',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const url = `${webhook}/${method}.json`;
|
|
32
|
+
const res = await fetch(url, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
|
35
|
+
body: JSON.stringify(payload),
|
|
36
|
+
signal: AbortSignal.timeout(15000),
|
|
37
|
+
});
|
|
38
|
+
const data = await res.json().catch(() => null);
|
|
39
|
+
if (!res.ok || data?.error) {
|
|
40
|
+
return { error: `Битрикс24 (${method}): ${data?.error_description || data?.error || ('HTTP ' + res.status)}` };
|
|
41
|
+
}
|
|
42
|
+
return data;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
icon: 'carbon:collaborate',
|
|
47
|
+
label: 'Битрикс24 CRM',
|
|
48
|
+
description: 'Работа с лидами, сделками, клиентами и задачами в корпоративном портале Битрикс24 через входящий вебхук',
|
|
49
|
+
baseUrl: '',
|
|
50
|
+
capabilities: ['crm', 'bitrix24', 'leads', 'deals', 'tasks'],
|
|
51
|
+
enabled: true,
|
|
52
|
+
|
|
53
|
+
SCHEMA: {
|
|
54
|
+
list_deals: {
|
|
55
|
+
readonly: true,
|
|
56
|
+
description: 'Получить список сделок из CRM Битрикс24 (crm.deal.list) с суммами, стадиями и ответственными.',
|
|
57
|
+
params: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
stageId: { type: 'string', description: 'Фильтр по стадии сделки (STAGE_ID), если нужен' },
|
|
61
|
+
search: { type: 'string', description: 'Поиск по названию сделки (TITLE)' },
|
|
62
|
+
limit: { type: 'number', description: 'Максимум записей (по умолчанию 20)' },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
list_leads: {
|
|
67
|
+
readonly: true,
|
|
68
|
+
description: 'Получить список лидов из CRM Битрикс24 (crm.lead.list).',
|
|
69
|
+
params: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {
|
|
72
|
+
statusId: { type: 'string', description: 'Статус лида (STATUS_ID), например NEW, IN_PROCESS' },
|
|
73
|
+
search: { type: 'string', description: 'Поиск по названию или имени' },
|
|
74
|
+
limit: { type: 'number', description: 'Максимум записей (по умолчанию 20)' },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
create_lead: {
|
|
79
|
+
readonly: false,
|
|
80
|
+
description: 'Создать новый лид в CRM Битрикс24 (crm.lead.add).',
|
|
81
|
+
params: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
title: { type: 'string', description: 'Название лида' },
|
|
85
|
+
name: { type: 'string', description: 'Имя контактного лица' },
|
|
86
|
+
phone: { type: 'string', description: 'Телефон клиента' },
|
|
87
|
+
email: { type: 'string', description: 'Email клиента' },
|
|
88
|
+
companyTitle: { type: 'string', description: 'Название компании клиента' },
|
|
89
|
+
opportunity: { type: 'number', description: 'Предполагаемая сумма сделки в рублях' },
|
|
90
|
+
comments: { type: 'string', description: 'Комментарий к лиду' },
|
|
91
|
+
},
|
|
92
|
+
required: ['title'],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
create_task: {
|
|
96
|
+
readonly: false,
|
|
97
|
+
description: 'Поставить задачу сотруднику в Битрикс24 (tasks.task.add).',
|
|
98
|
+
params: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
properties: {
|
|
101
|
+
title: { type: 'string', description: 'Название задачи' },
|
|
102
|
+
description: { type: 'string', description: 'Подробное описание задачи' },
|
|
103
|
+
responsibleId: { type: 'number', description: 'ID ответственного сотрудника в Битрикс24 (по умолчанию 1)' },
|
|
104
|
+
deadline: { type: 'string', description: 'Крайний срок YYYY-MM-DD' },
|
|
105
|
+
},
|
|
106
|
+
required: ['title'],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
async list_deals(params = {}) {
|
|
112
|
+
const filter = {};
|
|
113
|
+
if (params.stageId) filter.STAGE_ID = String(params.stageId).trim();
|
|
114
|
+
if (params.search) filter['%TITLE'] = String(params.search).trim();
|
|
115
|
+
const limit = Math.min(Math.max(Number(params.limit) || 20, 1), 50);
|
|
116
|
+
const res = await callBitrix(this, 'crm.deal.list', {
|
|
117
|
+
order: { ID: 'DESC' },
|
|
118
|
+
filter,
|
|
119
|
+
select: ['ID', 'TITLE', 'STAGE_ID', 'OPPORTUNITY', 'CURRENCY_ID', 'COMPANY_ID', 'CONTACT_ID', 'ASSIGNED_BY_ID', 'DATE_CREATE'],
|
|
120
|
+
});
|
|
121
|
+
if (res?.notConfigured || res?.error)
|
|
122
|
+
return res;
|
|
123
|
+
const deals = Array.isArray(res?.result) ? res.result.slice(0, limit) : [];
|
|
124
|
+
return { source: 'Bitrix24', count: deals.length, total: res?.total ?? deals.length, deals };
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
async list_leads(params = {}) {
|
|
128
|
+
const filter = {};
|
|
129
|
+
if (params.statusId) filter.STATUS_ID = String(params.statusId).trim();
|
|
130
|
+
if (params.search) filter['%TITLE'] = String(params.search).trim();
|
|
131
|
+
const limit = Math.min(Math.max(Number(params.limit) || 20, 1), 50);
|
|
132
|
+
const res = await callBitrix(this, 'crm.lead.list', {
|
|
133
|
+
order: { ID: 'DESC' },
|
|
134
|
+
filter,
|
|
135
|
+
select: ['ID', 'TITLE', 'NAME', 'LAST_NAME', 'COMPANY_TITLE', 'STATUS_ID', 'OPPORTUNITY', 'CURRENCY_ID', 'DATE_CREATE'],
|
|
136
|
+
});
|
|
137
|
+
if (res?.notConfigured || res?.error)
|
|
138
|
+
return res;
|
|
139
|
+
const leads = Array.isArray(res?.result) ? res.result.slice(0, limit) : [];
|
|
140
|
+
return { source: 'Bitrix24', count: leads.length, total: res?.total ?? leads.length, leads };
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
async create_lead(params = {}) {
|
|
144
|
+
const title = String(params.title || '').trim();
|
|
145
|
+
if (!title)
|
|
146
|
+
return { error: 'create_lead: укажите название лида title' };
|
|
147
|
+
const fields = {
|
|
148
|
+
TITLE: title,
|
|
149
|
+
CURRENCY_ID: 'RUB',
|
|
150
|
+
};
|
|
151
|
+
if (params.name) fields.NAME = String(params.name).trim();
|
|
152
|
+
if (params.companyTitle) fields.COMPANY_TITLE = String(params.companyTitle).trim();
|
|
153
|
+
if (params.opportunity != null) fields.OPPORTUNITY = Number(params.opportunity) || 0;
|
|
154
|
+
if (params.comments) fields.COMMENTS = String(params.comments).trim();
|
|
155
|
+
if (params.phone) fields.PHONE = [{ VALUE: String(params.phone).trim(), VALUE_TYPE: 'WORK' }];
|
|
156
|
+
if (params.email) fields.EMAIL = [{ VALUE: String(params.email).trim(), VALUE_TYPE: 'WORK' }];
|
|
157
|
+
|
|
158
|
+
const res = await callBitrix(this, 'crm.lead.add', { fields });
|
|
159
|
+
if (res?.notConfigured || res?.error)
|
|
160
|
+
return res;
|
|
161
|
+
return { ok: true, leadId: res?.result, title };
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
async create_task(params = {}) {
|
|
165
|
+
const title = String(params.title || '').trim();
|
|
166
|
+
if (!title)
|
|
167
|
+
return { error: 'create_task: укажите название задачи title' };
|
|
168
|
+
const fields = {
|
|
169
|
+
TITLE: title,
|
|
170
|
+
DESCRIPTION: String(params.description || '').trim(),
|
|
171
|
+
RESPONSIBLE_ID: Number(params.responsibleId) || 1,
|
|
172
|
+
};
|
|
173
|
+
if (params.deadline)
|
|
174
|
+
fields.DEADLINE = String(params.deadline).trim();
|
|
175
|
+
const res = await callBitrix(this, 'tasks.task.add', { fields });
|
|
176
|
+
if (res?.notConfigured || res?.error)
|
|
177
|
+
return res;
|
|
178
|
+
return { ok: true, task: res?.result?.task || res?.result };
|
|
179
|
+
},
|
|
180
|
+
};
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBR — официальные курсы валют, конвертация и ключевая ставка Банка России (ЦБ РФ).
|
|
3
|
+
*
|
|
4
|
+
* Работает сразу «из коробки» без ключей через официальные сервисы cbr.ru
|
|
5
|
+
* (XML_daily.asp / KeyRate) с резервным зеркалом cbr-xml-daily.ru.
|
|
6
|
+
*/
|
|
7
|
+
const CBR_XML_URL = 'https://www.cbr.ru/scripts/XML_daily.asp';
|
|
8
|
+
const CBR_DAILY_JSON_URL = 'https://www.cbr-xml-daily.ru/daily_json.js';
|
|
9
|
+
const CBR_MAIN_URL = 'https://www.cbr.ru/';
|
|
10
|
+
|
|
11
|
+
const POPULAR_CODES = ['USD', 'EUR', 'CNY', 'BYN', 'KZT', 'AED', 'TRY', 'GBP', 'CHF', 'JPY', 'INR'];
|
|
12
|
+
|
|
13
|
+
/** Форматирование даты YYYY-MM-DD или DD.MM.YYYY в формат ЦБ РФ DD/MM/YYYY */
|
|
14
|
+
function toCbrDateParam(raw = '') {
|
|
15
|
+
const s = String(raw || '').trim();
|
|
16
|
+
if (!s)
|
|
17
|
+
return '';
|
|
18
|
+
const iso = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
19
|
+
if (iso)
|
|
20
|
+
return `${iso[3]}/${iso[2]}/${iso[1]}`;
|
|
21
|
+
const ru = /^(\d{2})[./](\d{2})[./](\d{4})$/.exec(s);
|
|
22
|
+
if (ru)
|
|
23
|
+
return `${ru[1]}/${ru[2]}/${ru[3]}`;
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function xmlTag(block, tag) {
|
|
28
|
+
const m = String(block || '').match(new RegExp(`<${tag}[^>]*>([\\s\\S]*?)</${tag}>`, 'i'));
|
|
29
|
+
return m ? m[1].trim() : '';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function parseCbrXml(xmlText = '') {
|
|
33
|
+
const dateMatch = /Date="([^"]+)"/i.exec(xmlText);
|
|
34
|
+
const rateDate = dateMatch ? dateMatch[1] : new Date().toISOString().slice(0, 10);
|
|
35
|
+
const rates = {};
|
|
36
|
+
const valuteRe = /<Valute\b[\s\S]*?<\/Valute>/gi;
|
|
37
|
+
let m;
|
|
38
|
+
while ((m = valuteRe.exec(xmlText))) {
|
|
39
|
+
const block = m[0];
|
|
40
|
+
const code = xmlTag(block, 'CharCode').toUpperCase();
|
|
41
|
+
if (!code)
|
|
42
|
+
continue;
|
|
43
|
+
const numCode = xmlTag(block, 'NumCode');
|
|
44
|
+
const nominal = Number(xmlTag(block, 'Nominal').replace(',', '.')) || 1;
|
|
45
|
+
const name = xmlTag(block, 'Name');
|
|
46
|
+
const value = Number(xmlTag(block, 'Value').replace(',', '.'));
|
|
47
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
48
|
+
continue;
|
|
49
|
+
rates[code] = {
|
|
50
|
+
code,
|
|
51
|
+
numCode,
|
|
52
|
+
name,
|
|
53
|
+
nominal,
|
|
54
|
+
value,
|
|
55
|
+
unitRate: Number((value / nominal).toFixed(6)),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return { date: rateDate, source: 'cbr.ru', rates };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function fetchCbrRates(dateStr = '') {
|
|
62
|
+
const dateReq = toCbrDateParam(dateStr);
|
|
63
|
+
const url = dateReq ? `${CBR_XML_URL}?date_req=${encodeURIComponent(dateReq)}` : CBR_XML_URL;
|
|
64
|
+
try {
|
|
65
|
+
const res = await fetch(url, {
|
|
66
|
+
headers: { 'User-Agent': 'Mozilla/5.0 ODANT-WORK/2.0', Accept: 'application/xml,text/xml,*/*' },
|
|
67
|
+
signal: AbortSignal.timeout(10000),
|
|
68
|
+
});
|
|
69
|
+
if (res.ok) {
|
|
70
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
71
|
+
// ЦБ РФ отдаёт XML в windows-1251 или utf-8
|
|
72
|
+
let text = buf.toString('utf8');
|
|
73
|
+
if (/encoding=["']windows-1251["']/i.test(text)) {
|
|
74
|
+
try {
|
|
75
|
+
text = new TextDecoder('windows-1251').decode(buf);
|
|
76
|
+
}
|
|
77
|
+
catch { /* fallback utf8 */ }
|
|
78
|
+
}
|
|
79
|
+
const parsed = parseCbrXml(text);
|
|
80
|
+
if (Object.keys(parsed.rates).length > 0)
|
|
81
|
+
return parsed;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch { /* резервный JSON ниже */ }
|
|
85
|
+
|
|
86
|
+
if (!dateReq) {
|
|
87
|
+
const res = await fetch(CBR_DAILY_JSON_URL, {
|
|
88
|
+
headers: { Accept: 'application/json' },
|
|
89
|
+
signal: AbortSignal.timeout(10000),
|
|
90
|
+
});
|
|
91
|
+
if (res.ok) {
|
|
92
|
+
const data = await res.json();
|
|
93
|
+
const rates = {};
|
|
94
|
+
for (const [code, v] of Object.entries(data?.Valute || {})) {
|
|
95
|
+
const nominal = Number(v.Nominal) || 1;
|
|
96
|
+
const value = Number(v.Value) || 0;
|
|
97
|
+
rates[code] = {
|
|
98
|
+
code,
|
|
99
|
+
numCode: String(v.NumCode || ''),
|
|
100
|
+
name: String(v.Name || code),
|
|
101
|
+
nominal,
|
|
102
|
+
value,
|
|
103
|
+
previous: Number(v.Previous) || undefined,
|
|
104
|
+
unitRate: Number((value / nominal).toFixed(6)),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
date: String(data?.Date || '').slice(0, 10) || new Date().toISOString().slice(0, 10),
|
|
109
|
+
source: 'cbr-xml-daily.ru',
|
|
110
|
+
rates,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
throw new Error('Сервис курсов Банка России временно недоступен');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default {
|
|
118
|
+
icon: 'carbon:currency',
|
|
119
|
+
label: 'Банк России (ЦБ РФ)',
|
|
120
|
+
description: 'Официальные курсы валют ЦБ РФ на любую дату, валютный калькулятор и ключевая ставка Банка России',
|
|
121
|
+
baseUrl: 'https://www.cbr.ru',
|
|
122
|
+
capabilities: ['finance', 'currency', 'cbr'],
|
|
123
|
+
enabled: true,
|
|
124
|
+
|
|
125
|
+
SCHEMA: {
|
|
126
|
+
get_rates: {
|
|
127
|
+
readonly: true,
|
|
128
|
+
description: 'Официальные курсы валют Банка России (ЦБ РФ) в рублях на указанную дату. По умолчанию возвращает основные валюты (USD, EUR, CNY, BYN, KZT, AED, TRY и др.).',
|
|
129
|
+
params: {
|
|
130
|
+
type: 'object',
|
|
131
|
+
properties: {
|
|
132
|
+
date: { type: 'string', description: 'Дата курса в формате YYYY-MM-DD или DD.MM.YYYY (необязательно, по умолчанию — сегодня)' },
|
|
133
|
+
codes: { type: 'string', description: 'Коды валют через запятую, например "USD,EUR,CNY" (или "ALL" для всех валют ЦБ)' },
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
convert_currency: {
|
|
138
|
+
readonly: true,
|
|
139
|
+
description: 'Пересчёт суммы из одной валюты в другую (включая российский рубль RUB) строго по официальному курсу ЦБ РФ на указанную дату.',
|
|
140
|
+
params: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
properties: {
|
|
143
|
+
amount: { type: 'number', description: 'Сумма для конвертации' },
|
|
144
|
+
from: { type: 'string', description: 'Исходная валюта (например USD, EUR, CNY, RUB)' },
|
|
145
|
+
to: { type: 'string', description: 'Целевая валюта (по умолчанию RUB)' },
|
|
146
|
+
date: { type: 'string', description: 'Дата курса YYYY-MM-DD (по умолчанию — сегодня)' },
|
|
147
|
+
},
|
|
148
|
+
required: ['amount', 'from'],
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
get_key_rate: {
|
|
152
|
+
readonly: true,
|
|
153
|
+
description: 'Получить действующую ключевую ставку Банка России (ЦБ РФ) для расчёта пеней (ст. 395 ГК РФ, 1/300 ставки), процентов и финансовых условий.',
|
|
154
|
+
params: {
|
|
155
|
+
type: 'object',
|
|
156
|
+
properties: {},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
async get_rates(params = {}) {
|
|
162
|
+
try {
|
|
163
|
+
const data = await fetchCbrRates(params.date);
|
|
164
|
+
const rawCodes = String(params.codes || '').trim().toUpperCase();
|
|
165
|
+
const wantAll = rawCodes === 'ALL' || rawCodes === '*';
|
|
166
|
+
const codeList = (!rawCodes || wantAll)
|
|
167
|
+
? POPULAR_CODES
|
|
168
|
+
: rawCodes.split(/[\s,;]+/).filter(Boolean);
|
|
169
|
+
|
|
170
|
+
const selected = {};
|
|
171
|
+
if (wantAll) {
|
|
172
|
+
Object.assign(selected, data.rates);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
for (const c of codeList) {
|
|
176
|
+
if (c === 'RUB' || c === 'RUR') {
|
|
177
|
+
selected.RUB = { code: 'RUB', name: 'Российский рубль', nominal: 1, value: 1, unitRate: 1 };
|
|
178
|
+
}
|
|
179
|
+
else if (data.rates[c]) {
|
|
180
|
+
selected[c] = data.rates[c];
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
source: data.source,
|
|
186
|
+
date: data.date,
|
|
187
|
+
base: 'RUB',
|
|
188
|
+
count: Object.keys(selected).length,
|
|
189
|
+
rates: selected,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
return { error: String(e?.message || e) };
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
async convert_currency(params = {}) {
|
|
198
|
+
const amount = Number(params.amount);
|
|
199
|
+
if (!Number.isFinite(amount))
|
|
200
|
+
return { error: 'convert_currency: укажите числовую сумму amount' };
|
|
201
|
+
const from = String(params.from || 'USD').trim().toUpperCase();
|
|
202
|
+
const to = String(params.to || 'RUB').trim().toUpperCase();
|
|
203
|
+
try {
|
|
204
|
+
const data = await fetchCbrRates(params.date);
|
|
205
|
+
const getRubRate = (code) => {
|
|
206
|
+
if (code === 'RUB' || code === 'RUR')
|
|
207
|
+
return 1;
|
|
208
|
+
const item = data.rates[code];
|
|
209
|
+
if (!item)
|
|
210
|
+
throw new Error(`Валюта «${code}» не найдена в котировках ЦБ РФ`);
|
|
211
|
+
return item.unitRate;
|
|
212
|
+
};
|
|
213
|
+
const fromRub = getRubRate(from);
|
|
214
|
+
const toRub = getRubRate(to);
|
|
215
|
+
const amountInRub = amount * fromRub;
|
|
216
|
+
const result = amountInRub / toRub;
|
|
217
|
+
return {
|
|
218
|
+
source: data.source,
|
|
219
|
+
date: data.date,
|
|
220
|
+
amount,
|
|
221
|
+
from,
|
|
222
|
+
to,
|
|
223
|
+
rateFromRub: Number(fromRub.toFixed(6)),
|
|
224
|
+
rateToRub: Number(toRub.toFixed(6)),
|
|
225
|
+
crossRate: Number((fromRub / toRub).toFixed(6)),
|
|
226
|
+
result: Number(result.toFixed(2)),
|
|
227
|
+
amountInRub: Number(amountInRub.toFixed(2)),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
catch (e) {
|
|
231
|
+
return { error: String(e?.message || e) };
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
async get_key_rate() {
|
|
236
|
+
try {
|
|
237
|
+
const res = await fetch(CBR_MAIN_URL, {
|
|
238
|
+
headers: { 'User-Agent': 'Mozilla/5.0 ODANT-WORK/2.0', Accept: 'text/html' },
|
|
239
|
+
signal: AbortSignal.timeout(10000),
|
|
240
|
+
});
|
|
241
|
+
if (res.ok) {
|
|
242
|
+
const html = await res.text();
|
|
243
|
+
const m = /Ключевая ставка[\s\S]{0,400}?(\d{1,2}[,.]\d{1,2})\s*%/i.exec(html);
|
|
244
|
+
if (m) {
|
|
245
|
+
const rate = Number(m[1].replace(',', '.'));
|
|
246
|
+
return {
|
|
247
|
+
source: 'cbr.ru',
|
|
248
|
+
keyRatePercent: rate,
|
|
249
|
+
dailyPenalty1300: Number((rate / 300).toFixed(5)),
|
|
250
|
+
date: new Date().toISOString().slice(0, 10),
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch { /* fallback */ }
|
|
256
|
+
return {
|
|
257
|
+
source: 'cbr.ru (справочно)',
|
|
258
|
+
keyRatePercent: 21.0,
|
|
259
|
+
dailyPenalty1300: Number((21.0 / 300).toFixed(5)),
|
|
260
|
+
note: 'Для онлайн-сверки проверьте доступ сервера к cbr.ru',
|
|
261
|
+
};
|
|
262
|
+
},
|
|
263
|
+
};
|