Skip to content

Add static method createFromUrl for B24Hook#8

Closed
arsentos wants to merge 1 commit into
bitrix24:mainfrom
arsentos:feature-create-B24Hook-from-url
Closed

Add static method createFromUrl for B24Hook#8
arsentos wants to merge 1 commit into
bitrix24:mainfrom
arsentos:feature-create-B24Hook-from-url

Conversation

@arsentos
Copy link
Copy Markdown

There is enhancement issue #6 about creating B24Hook from complete URL. I implemented it and added docs, criticism welcome!

@IgorShevchik
Copy link
Copy Markdown
Collaborator

Corrected the code a bit.
Changes uploaded (ver 0.4.4)

IgorShevchik pushed a commit that referenced this pull request May 27, 2026
…docs)

Five parallel role-reviews (docs, programmer, QA, security, CTO) found 16
fixable items. Three larger findings (unit-test infra, isolate recipe deps,
v3 whitelist CI monitor) are moved out to issues #64 / #65 / #66. The rest
land here.

🔴 Runtime bugs
- Recipe 6: replace contiguous-prefix `sawFailure` continue with `break`.
  Original logic still sent Telegram messages for deals after a mid-batch
  failure; cursor stayed at last-success-before-failure, so the next tick
  re-sent the already-delivered post-failure deals as duplicates. With
  `break`, the failed deal AND everything after wait for the next tick.
- Recipe 5: `batch.make` named-object form needs `returnAjaxResult: true`
  to expose named keys safely. Previous `getData() as { Storages, Children }`
  was a runtime lie — actual shape is the union `T | T[] | BatchPayloadResult<T>`.
  Now reads through AjaxResult per key as the canonical SDK spec shows.
- Recipe 8: `JSON.parse(content!)` had no null/parse guard. GPT can return
  null content (content-filter, rate-limit trim) or invalid JSON despite
  `response_format: 'json_object'`. Now throws with useful raw-snippet.

🔴 Security
- Recipe 7: `B24_APPLICATION_TOKEN` is now REQUIRED (throw on startup if
  missing). Previously the recipe accepted any POST when the env var was
  absent. Compare uses `timingSafeEqual` to defeat timing-recovery attacks.
- Recipe 12: same `timingSafeEqual` for the application_token check on
  /uninstall. Also `fs.writeFile(..., { mode: 0o600 })` so other local
  users can't read persisted tokens. INFO-level log no longer includes
  `domain` / `userId` (`logger.info('[${event}] member=${id}')` only).
  /portal/:memberId/profile demo route now has an explicit
  SECURITY-WARNING comment about missing auth.
- Recipe 7 log redaction: log only the keys of `payload.data.FIELDS`
  (not the values) to prevent future sensitive field leakage.

🔴 Docs facts
- b24jssdk-recipes/SKILL.md: «Nine» → «Twelve», description updated to
  mention recipes 10–12 (error handling, event registration, OAuth install).
- b24jssdk-recipes/SKILL.md: caveat about recipe-7-event-registration
  now correctly points to recipe 11 (it exists) instead of «not covered
  by these scripts».
- MAINTENANCE.md: recipe-section count and list updated 9→12.

🟡 Polish
- SUGGESTED-EXAMPLES.md: drop confusing «#1 / #6 / #8» gap numbers in
  the Done section (recipes have their own numbers 10/11/12).
- docs/.../99.examples/0.index.md: drop `offClientSideWarning?.()`
  optional chaining in the shared boot snippet — consistent with skills
  and recipes (the method is present on all entry points).
- Recipe 4: split `created` counter into `createdInB24` / `createdInErp`
  for actionable metrics.
- Recipe 3: `setInterval` now has an overlap guard so slow ticks don't
  race on `dealStages`.
- Recipe 6: add cold-start comment explaining that `lastSeenDealId = 0`
  floods all NEW-stage deals on first tick.
- tsconfig.recipes: explain `ignoreDeprecations: "6.0"` inline.

🟢 Traceability
- Recipes 7 and 9: add `UNVERIFIED_ON_LIVE_PORTAL` markers to the
  header docblocks with pointers to REPORT.md.

CI: `lint`, `typecheck` (incl. `skills:typecheck`), `docs:lint-pages` —
all green.

Co-authored-by: 5 role-review agents (docs, programmer, QA, security, CTO)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants