odant-work 1.0.94 → 1.0.95

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "packageName": "odant-work",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
4
4
  "createdAt": 1795100682741,
5
- "updatedAt": 1796200687373,
5
+ "updatedAt": 1796203903734,
6
6
  "files": {
7
7
  "$server/$folder/$class/$ai/class.js": "eb8a308eca37fa674530a548df981700b363186043fba6c47ae6e335e4cf5c94",
8
8
  "$server/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js": "2aafef4d16bf6f893948d4f2b22e63ad9aed8f73af036a75e2385ffba5772293",
@@ -215,7 +215,7 @@
215
215
  "$server/$folder/handlers/methods/create/progress.md": "d7a61baaf02afda1f0b65883a809ceed4e59fe5ff01b6471806d3f2b08ef27cf",
216
216
  "$server/$folder/handlers/methods/help/$handler/class.js": "ff54bf976cbdc846d7c1b46ff12b111e99a3f4831240a4e420b73c98c0355a5c",
217
217
  "$server/$folder/handlers/methods/info/$handler/class.js": "8752efb28abdcfad4e8ce56cfebcd8bb09ec0735cba7b84156d248bfcb0f9db0",
218
- "$server/$folder/handlers/pages/form/$handler/class.js": "6e4509c80b6f2abfe0ad75a79862ec3dfbbb743ffedd28d25bee41acc8876e95",
218
+ "$server/$folder/handlers/pages/form/$handler/class.js": "118e274110cbe6ffca0ce5806a13c3c7c6ac1061aaee3e26591622b52875ebd3",
219
219
  "$server/$folder/handlers/pages/form/folder/$handler/class.js": "71664da71a7a92806e50c2faf62786b28014073c56706e5cbb93420e20f10716",
220
220
  "$server/$folder/handlers/readme.md": "d810e5ef204cd29a5da09e0a9b30a1c07628243f38e9821803dd8c6f16311080",
221
221
  "$server/$folder/lib/calendar-form/calendar-form.js": "dbfc0f7014659222ad3b3519d8e6c79bd5567102ab287096d59d015d66015148",
@@ -294,7 +294,7 @@
294
294
  "MODULES/Данные/KLADR/Регионы/$catalog/class.js": "8010bcfe5f1eb81703cac27832e1f4eb83d148764b9bdfde5ea4002cb6435f3e",
295
295
  "MODULES/Данные/KLADR/Улицы/$catalog/class.js": "cfbadc196d3db71802e2e3dab492957ce18aaa789870040b3e24d3038a894860",
296
296
  "MODULES/Данные/RuCalendar/$module/class.js": "3a8824da32079be2c614de079bf8a8ad3a8bfa5eb9724782398d9f015c566199",
297
- "MODULES/Данные/Weather/$module/class.js": "e71ed4d5ef76cc6286ce4f79d98227052a9cfd966f4a38d8b50f0b3a85ba4e93",
297
+ "MODULES/Данные/Weather/$module/class.js": "52987470a58116df3e57e30418d2e32d7371b9effef34be83a00435c73fa7d2f",
298
298
  "MODULES/Коннекторы/1C/$module/class.js": "a08d8c2387f6193a670bfe0aefbd5d2e8d233e456c2ad806e5c7b9a7e8e198df",
299
299
  "MODULES/Коннекторы/2GIS/$mcp/class.js": "c2f2e75e1911b3dff04a66c785a5b9fde6ca7b84a31dd33dadc0e2cdfd627f91",
300
300
  "MODULES/Коннекторы/2GIS/$mcp/readme.md": "ee03fb6383d51e4a59539f238c193225b3bf2037ac2203546d4b351b2f9cbd8f",
@@ -302,7 +302,7 @@
302
302
  "MODULES/Коннекторы/Telegram/$module/class.js": "374d9644ed880f32d4e43e4ccdea290a3a3774f8c0096091ca7da502f94f99f2",
303
303
  "MODULES/Коннекторы/YandexDisk/$module/class.js": "4c52309f0b2256f8dcc791b3cf04cb5b020db451dd5791a7ad72654358c39933",
304
304
  "MODULES/Маркетплейсы/Ozon/$mcp/class.js": "f7e0e15e34da7f5bfc3fbcf61b11ffaf957911316efea35e43e68c599aecdbc4",
305
- "MODULES/Маркетплейсы/Wildberries/$mcp/class.js": "1472e6b00cb1cc24f1fdaa1cad1969362616ac439ff1a534f689f66d34bb32de",
305
+ "MODULES/Маркетплейсы/Wildberries/$mcp/class.js": "ad74dd811d115526b53faef5adda9b9e08ad4e3e51206baec7bb8efcb2fc643a",
306
306
  "MODULES/Маркетплейсы/YandexMarket/$mcp/class.js": "0bee74d35393e5640111ef1b30de8575ab2682e32b0fbdfef5341c8d59c5170c",
307
307
  "MODULES/Модели/GigaChat/$provider/$folder/$class/$ai/class.js": "18f26a4811981973cbf5f90584177028c44ce04fe9ecf4b5e546dccdbbd330d8",
308
308
  "MODULES/Модели/GigaChat/$provider/class.js": "20827bd6ba60a9ea93ff7bacee190d6600de4294463831f55a5f5cd8218c08fa",
@@ -843,8 +843,8 @@
843
843
  "oda/tools/tester/index.html": "58be4351a9733d2cff91347f6da63d8c60eb32bd2207d9269b9338eb33836e87",
844
844
  "oda/tools/tester/readme.md": "ce7e48a8f1a53b6016664ea8e4f6422904bfecdf475cdae65be863f9620ed849",
845
845
  "oda/tools/tester/tester.js": "afe9e21081092faf61c515ad934eb8f024a3e89568cc192c157e8afd556663da",
846
- "package-lock.json": "3565dc9eeb7591173fc9aafcc4cd173df1e6b09a391c951eb00fb2b86c4803ee",
847
- "package.json": "70213ae048fafd220141d2e78d8ecb7ff70824d1d9770720f76610dd76b6da38",
846
+ "package-lock.json": "2e720c030616fb5f22cba3a795300a18909dd785a5943aaa03378af9d124316a",
847
+ "package.json": "9ce7e63869dde14053438301793adcd13220fbe2810df2a6e3db2e09e57e6686",
848
848
  "run.mjs": "96274369c2ab29f293f787fbc1e371fc7e661f9577dccb2d1c245a866d193c77",
849
849
  "sources/client.js": "a1fe12500376bae4d354366f483ae62a217dbbbdc6228ed355e28298855ccb77",
850
850
  "sources/client/class.js": "ddd2862e2c78d337360a16a26f7af2ad28f603d58f480f39a0cc82192173050a",
@@ -866,7 +866,7 @@
866
866
  "sources/data/objects.js": "58a7682c51c840536c5fe1297f4d402b899441286305425e6ceba3312ddcb3f3",
867
867
  "sources/data/posting.js": "6595bb9ec632539ae7629504db327d25a491e61c1cdc598bb43d08ea0d45548d",
868
868
  "sources/data/print.js": "e60f4fd7d10d6161a40d4fa08165dfb3c343e5ad00f0bddcec24a86a9cb299fd",
869
- "sources/data/progress.md": "0804ecd7eff3fa1214cd6c1e3f2c4475d733aeaf36e43284c41aa6a1d5fce446",
869
+ "sources/data/progress.md": "088dad92cf3894032823912cb4897da7656b5fbf95f1c9730dbb509e7df0001b",
870
870
  "sources/data/readme.md": "2ab6c0f2e2b30fc00714e3deaa2ad261f370b9b8917b96d5b1b8116933c4948b",
871
871
  "sources/data/reports.js": "0330f404860fe2589a7d46a2f0fe690ca23249bd841a062a26718742d4fd11d6",
872
872
  "sources/data/schema.js": "7b5300961966570d451c97d2cf18667f56116dd1dec5ccea644cb0b83e29401d",
@@ -874,7 +874,7 @@
874
874
  "sources/data/sql-inspector.js": "11d83cf3282e42d7f39954bb7bf6ea1462f845f05a5df7444819e2a7de715095",
875
875
  "sources/data/time.js": "cb34c1137685e83265938bb007859dfc1fca3548588d1663ee01e1affc87a09a",
876
876
  "sources/data/workspace.js": "90a2dd4122d059d2abfe063e7c4153cd1078324f606dfd57e23c538369424e7e",
877
- "sources/host/auth-methods.js": "274e8a9f287af5679b96808af0dd01182de0451a603b5764d3b09831b3ac57b8",
877
+ "sources/host/auth-methods.js": "a7162c89bb8519be6d2db5d292475abadcb990d8ede4a8eec543d6a44566ca15",
878
878
  "sources/host/auto-updater.js": "63feae6db03e6ac330a9008278a61f2e631843a2cc2cb8c86c12f7d16e3e1e73",
879
879
  "sources/host/babel-merge.js": "492059ca639c9673151ce579bb97f70fa202379db0e6e0be95faa63d64a3085b",
880
880
  "sources/host/config.js": "f41058d2ef46afc0ac5e262a0f31064d3288ab3794c4d45c0761498e775f60ae",
@@ -984,7 +984,7 @@
984
984
  "sources/modules/lan/scan.js": "bbc92272776b198c09f987af8c09c635f48341ac3311127ec958751f01570f82",
985
985
  "sources/modules/lan/store.js": "fed7da49bbf508216b51ea3bc2b30e1e1ff5261edc3cbee57690d4e3130ae9e7",
986
986
  "sources/modules/lan/subnet.js": "3d95231b206ba2ddc5fb8cff3002ca2c980a4e856e18cb505c24e7d81d643684",
987
- "sources/modules/license/index.js": "7d19a054c186a1bd27962762f4d939f93e4bdb831e4892905f2a34d9aeec0a5c",
987
+ "sources/modules/license/index.js": "d798a6e529e607bb9839ff2902b5a8c1968601addad6c44f1f7b86f43bcf7206",
988
988
  "sources/modules/mcp-marketplaces/mcp-stdio.js": "db9e757d3f35803dc8d1ba25614040a0c5b1efacd405591d0a5f901c9a51074a",
989
989
  "sources/modules/mcp-marketplaces/ozon.js": "ab543b966a16cd9aa592b03237da0c43646fd7cbb1deef4d8da66f919a634b7f",
990
990
  "sources/modules/mcp-marketplaces/wildberries.js": "a3d94623e93dc8ca75f5a5e42794568762c84392b29f7521b9464161ef577380",
@@ -170,6 +170,17 @@ ODA({
170
170
  height: 22px;
171
171
  margin: 0 2px;
172
172
  }
173
+ .sub-row {
174
+ display: flex;
175
+ flex-direction: column;
176
+ width: 100%;
177
+ flex-shrink: 0;
178
+ }
179
+ :host([layout="tabs"]) .sub-row {
180
+ width: auto;
181
+ flex-direction: row;
182
+ align-items: center;
183
+ }
173
184
  .sub-btn {
174
185
  @apply --horizontal;
175
186
  align-items: center;
@@ -231,6 +242,11 @@ ODA({
231
242
  height: 22px;
232
243
  margin: 0 2px;
233
244
  }
245
+ .sub-row {
246
+ width: auto;
247
+ flex-direction: row;
248
+ align-items: center;
249
+ }
234
250
  .sub-btn {
235
251
  width: auto;
236
252
  white-space: nowrap;
@@ -240,7 +256,7 @@ ODA({
240
256
  }
241
257
  </style>
242
258
  <nav ~if="groupedItems.length" class="sub-nav" aria-label="Разделы">
243
- <div ~for="groupedItems" style="display:contents;">
259
+ <div ~for="groupedItems" class="sub-row">
244
260
  <div ~if="$for.item.isSep" class="sub-sep"></div>
245
261
  <button ~if="!$for.item.isSep" type="button" class="sub-btn"
246
262
  :data-active="$for.item.active ? '1' : ''"
@@ -269,11 +285,24 @@ ODA({
269
285
  _loadSeq: 0,
270
286
  _attachedDone: false,
271
287
  _pendingSubView: '',
272
- $handler: null,
288
+ _pendingMountTabId: '',
289
+ _loadingFor: null,
290
+ _loadingHandler: null,
291
+ _loadingPromise: null,
292
+ _loadedFor: null,
293
+ _loadedHandler: null,
294
+ _attemptedMountIds: null,
295
+ $handler: {
296
+ $def: null,
297
+ set(n) {
298
+ if (n && this.$item)
299
+ this._loadTabs(this.$item);
300
+ }
301
+ },
273
302
  $item: {
274
303
  $def: null,
275
304
  set(n) {
276
- if (n)
305
+ if (n && this.$handler)
277
306
  this._loadTabs(n);
278
307
  }
279
308
  },
@@ -363,11 +392,31 @@ ODA({
363
392
  },
364
393
  attached() {
365
394
  this._attachedDone = true;
366
- if (this.$item && (!this.tabs || !this.tabs.length)) {
395
+ if (this.$item && !this.tabs?.length && !this._loadingPromise) {
367
396
  this._loadTabs(this.$item);
368
397
  }
369
- else if (this.activeId && !this.$?.('#subBody')?.children?.length) {
370
- const tab = (this.tabs || []).find(t => t.id === this.activeId);
398
+ else if (this.activeId) {
399
+ const body = this.$?.('#subBody');
400
+ if (!body) {
401
+ this._pendingMountTabId = this.activeId;
402
+ this.render?.(true);
403
+ }
404
+ else if (!body.children?.length && !this._controls?.[this.activeId] && !this._attemptedMountIds?.has(this.activeId)) {
405
+ const tab = (this.tabs || []).find(t => t.id === this.activeId);
406
+ if (tab)
407
+ this._mountTab(tab, this._pendingSubView || '');
408
+ }
409
+ }
410
+ },
411
+ onRender() {
412
+ const body = this.$?.('#subBody');
413
+ if (!body)
414
+ return;
415
+ const targetId = this._pendingMountTabId
416
+ || (!body.children?.length && this.activeId && !this._controls?.[this.activeId] ? this.activeId : '');
417
+ if (targetId && !this._attemptedMountIds?.has(targetId)) {
418
+ this._pendingMountTabId = '';
419
+ const tab = (this.tabs || []).find(t => t.id === targetId);
371
420
  if (tab)
372
421
  this._mountTab(tab, this._pendingSubView || '');
373
422
  }
@@ -381,7 +430,27 @@ ODA({
381
430
  }
382
431
  return this.$handler?.id ? `/pages/form/${this.$handler.id}` : '/pages/form';
383
432
  },
384
- async _loadTabs(item) {
433
+ _loadTabs(item) {
434
+ const handler = this.$handler || null;
435
+ if (item && this._loadingPromise && this._loadingFor === item && this._loadingHandler === handler)
436
+ return this._loadingPromise;
437
+ if (item && this._loadedFor === item && this._loadedHandler === handler && this.tabs?.length)
438
+ return Promise.resolve();
439
+ this._loadingFor = item || null;
440
+ this._loadingHandler = handler;
441
+ const p = this._doLoadTabs(item).then(() => {
442
+ if (this._loadingFor === item && this._loadingHandler === handler) {
443
+ this._loadedFor = item || null;
444
+ this._loadedHandler = handler;
445
+ }
446
+ }).finally(() => {
447
+ if (this._loadingPromise === p)
448
+ this._loadingPromise = null;
449
+ });
450
+ this._loadingPromise = p;
451
+ return p;
452
+ },
453
+ async _doLoadTabs(item) {
385
454
  const seq = ++this._loadSeq;
386
455
  if (!item) {
387
456
  this.tabs = [];
@@ -408,6 +477,8 @@ ODA({
408
477
  t.$context = item;
409
478
  this.tabs = list;
410
479
  this._controls = {};
480
+ this._attemptedMountIds = new Set();
481
+ this._pendingMountTabId = '';
411
482
  const body = this.$?.('#subBody');
412
483
  if (body)
413
484
  body.innerHTML = '';
@@ -429,6 +500,7 @@ ODA({
429
500
  if (!tab)
430
501
  return;
431
502
  this.activeId = id;
503
+ this.render?.(true);
432
504
  await this._mountTab(tab, nestedSubView);
433
505
  this.$form?.syncFromView?.(this);
434
506
  },
@@ -438,11 +510,16 @@ ODA({
438
510
  const seq = ++this._mountSeq;
439
511
  const body = this.$?.('#subBody');
440
512
  if (!body) {
513
+ this._pendingMountTabId = tab.id;
441
514
  this._pendingSubView = nestedSubView || '';
515
+ this.render?.(true);
442
516
  return;
443
517
  }
518
+ this._pendingMountTabId = '';
444
519
  this._pendingSubView = '';
445
520
  this._controls ||= {};
521
+ this._attemptedMountIds ||= new Set();
522
+ this._attemptedMountIds.add(tab.id);
446
523
  let el = this._controls[tab.id];
447
524
  if (!el) {
448
525
  const mod = await tab.importView();
@@ -457,9 +534,9 @@ ODA({
457
534
  }
458
535
  else if (this.depth < 6 && (tab.layout || tab.DATA?.layout || (Array.isArray(tab.DATA?.items) && tab.DATA.items.length))) {
459
536
  el = ODA.createComponent('work-subview-container', {
537
+ $handler: tab,
460
538
  $item: this.$item,
461
539
  $context: this.$item,
462
- $handler: tab,
463
540
  layout: tab.layout || tab.DATA?.layout || 'sidebar',
464
541
  role: this.role,
465
542
  subViewPath: nestedSubView,
@@ -478,6 +555,9 @@ ODA({
478
555
  ch.hidden = ch !== el;
479
556
  ch.style.display = ch === el ? '' : 'none';
480
557
  }
558
+ if (el[R]?.states)
559
+ el[R].states.sleep = false;
560
+ el.render?.(true);
481
561
  if (nestedSubView && typeof el.applyNav === 'function')
482
562
  await el.applyNav({ subView: nestedSubView });
483
563
  this.$form?.syncFromView?.(this);
@@ -2339,10 +2419,10 @@ ODA({is: 'work-form',
2339
2419
  }
2340
2420
  else if (n.layout || n.DATA?.layout || (Array.isArray(n.DATA?.items) && n.DATA.items.length)) {
2341
2421
  el = ODA.createComponent('work-subview-container', {
2422
+ $handler: n,
2342
2423
  $item: tabItem,
2343
2424
  $context: tabItem,
2344
2425
  slot: 'main',
2345
- $handler: n,
2346
2426
  layout: n.layout || n.DATA?.layout || 'sidebar',
2347
2427
  role: this.activeRole,
2348
2428
  subViewPath: nav?.subView || '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odant-work",
3
- "version": "1.0.94",
3
+ "version": "1.0.95",
4
4
  "description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
5
5
  "type": "module",
6
6
  "main": "sources/work.js",
@@ -6,7 +6,7 @@ import * as CORE from '../server/index.js';
6
6
  import { $server } from '../server/server.js';
7
7
  import { audit } from '../server/access/audit.js';
8
8
  import { inspectInvite, consumeInvite } from '../server/access/invites.js';
9
- import { assertWorkplaceAvailableForLogin } from '../modules/license/index.js';
9
+ import { assertWorkplaceAvailableForLogin, sendLoginCodeViaLicenseHub } from '../modules/license/index.js';
10
10
 
11
11
  const REGISTER_CODE_TTL_MS = 10 * 60 * 1000;
12
12
  const REGISTER_MAX_ATTEMPTS = 5;
@@ -114,7 +114,21 @@ export const authMethods = {
114
114
  if (DEV_MODE) {
115
115
  return "На Вашу почту отправлено письмо с одноразовым кодом, введите его для продолжения регистрации.";
116
116
  }
117
- throw new Error('Почтовый сервер не настроен. Администратор (BOSS) может настроить почтовый ящик в корне WORK → представление «Почта» (⚙️ Почтовые ящики) или в файле #system/mail.json');
117
+ // Подключённый (лицензированный) клиент без собственного SMTP отправляет код через сервер поддержки
118
+ let relayError = '';
119
+ try {
120
+ const relayed = await sendLoginCodeViaLicenseHub({ email, code });
121
+ if (relayed?.ok)
122
+ return "На Вашу почту отправлено письмо с одноразовым кодом, введите его для продолжения регистрации.";
123
+ }
124
+ catch (relayErr) {
125
+ relayError = relayErr?.message || String(relayErr);
126
+ console.warn('[auth] Код входа не отправлен через сервер поддержки:', relayError);
127
+ }
128
+ throw new Error(
129
+ 'Почтовый сервер не настроен. Администратор (BOSS) может настроить почтовый ящик в корне WORK → представление «Почта» (⚙️ Почтовые ящики) или в файле #system/mail.json'
130
+ + (relayError ? `, либо подключить лицензию к серверу поддержки (${relayError})` : '')
131
+ );
118
132
  }
119
133
  const fromUser = activeMailer.fromUser || activeMailer.transport?.options?.auth?.user || 'noreply@localhost';
120
134
  const mailOptions = {
@@ -1122,6 +1122,59 @@ export async function syncWithLicenseHub({ hubUrl, licensePath, systemDir, token
1122
1122
  return getFullLicenseStatus({ license: lic, licensePath, systemDir: sysDir, trustedPublicKey });
1123
1123
  }
1124
1124
 
1125
+ /**
1126
+ * Отправить одноразовый код входа/регистрации на Email через сервер поддержки,
1127
+ * когда на локальном WORK не настроен собственный почтовый сервер (SMTP).
1128
+ *
1129
+ * Работает только для подключённых (активированных) клиентов: запрос подтверждается
1130
+ * парой licenseId + HWID/отпечатком узла или привязанным токеном владельца (owk1...).
1131
+ */
1132
+ export async function sendLoginCodeViaLicenseHub({
1133
+ email,
1134
+ code,
1135
+ hubUrl,
1136
+ systemDir,
1137
+ licensePath,
1138
+ trustedPublicKey = '',
1139
+ fetchImpl = globalThis.fetch,
1140
+ } = {}) {
1141
+ const sysDir = systemDir || (licensePath ? path.dirname(licensePath) : SYSTEM_DIR);
1142
+ const lic = loadLocalLicense(licensePath || LICENSE_FILE, { systemDir: sysDir, trustedPublicKey });
1143
+ if (lic.unlicensed) {
1144
+ throw new Error(
1145
+ 'Локальная система не подключена к серверу поддержки: привяжите лицензию владельца '
1146
+ + 'или настройте почтовый сервер в #system/mail.json'
1147
+ );
1148
+ }
1149
+
1150
+ const binding = loadOwnerTokenBinding(sysDir);
1151
+ const baseUrl = String(hubUrl || binding?.hubUrl || lic.hubUrl || DEFAULT_LICENSE_HUB_URL).replace(/\/+$/, '');
1152
+ const hw = getHardwareIdentity();
1153
+ const res = await fetchImpl(`${baseUrl}/api/license/send-login-code`, {
1154
+ method: 'POST',
1155
+ headers: {
1156
+ 'Content-Type': 'application/json',
1157
+ ...(binding?.token ? { Authorization: `Bearer ${binding.token}` } : {}),
1158
+ },
1159
+ signal: typeof AbortSignal !== 'undefined' && typeof AbortSignal.timeout === 'function'
1160
+ ? AbortSignal.timeout(15000)
1161
+ : undefined,
1162
+ body: JSON.stringify({
1163
+ email,
1164
+ ...(code ? { code } : {}),
1165
+ licenseId: lic.licenseId,
1166
+ hwid: lic.hardware?.hwid || hw.hwid,
1167
+ nodeFingerprint: lic.hardware?.nodeFingerprint || hw.nodeFingerprint,
1168
+ ...(binding?.token ? { token: binding.token } : {}),
1169
+ }),
1170
+ });
1171
+ const data = await res.json().catch(() => ({}));
1172
+ if (!res.ok) {
1173
+ throw new Error(data?.error || `Сервер поддержки (${baseUrl}) отклонил отправку кода (HTTP ${res.status})`);
1174
+ }
1175
+ return data;
1176
+ }
1177
+
1125
1178
  /**
1126
1179
  * Создать заказ (через ЮKassa или по договору/счёту для юрлиц) на сервере work.odant.org.
1127
1180
  */