@venizia/ignis-atlas 0.1.0-1
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/LICENSE.md +104 -0
- package/README.md +144 -0
- package/dist/cjs/cli/modes.d.ts +29 -0
- package/dist/cjs/cli/modes.d.ts.map +1 -0
- package/dist/cjs/cli/modes.js +70 -0
- package/dist/cjs/cli/modes.js.map +1 -0
- package/dist/cjs/cli.d.ts +3 -0
- package/dist/cjs/cli.d.ts.map +1 -0
- package/dist/cjs/cli.js +60 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/common/constants.d.ts +22 -0
- package/dist/cjs/common/constants.d.ts.map +1 -0
- package/dist/cjs/common/constants.js +32 -0
- package/dist/cjs/common/constants.js.map +1 -0
- package/dist/cjs/common/index.d.ts +3 -0
- package/dist/cjs/common/index.d.ts.map +1 -0
- package/dist/cjs/common/index.js +19 -0
- package/dist/cjs/common/index.js.map +1 -0
- package/dist/cjs/common/logger.d.ts +21 -0
- package/dist/cjs/common/logger.d.ts.map +1 -0
- package/dist/cjs/common/logger.js +50 -0
- package/dist/cjs/common/logger.js.map +1 -0
- package/dist/cjs/common/types.d.ts +5 -0
- package/dist/cjs/common/types.d.ts.map +1 -0
- package/dist/cjs/common/types.js +3 -0
- package/dist/cjs/common/types.js.map +1 -0
- package/dist/cjs/corpus/chunker.d.ts +12 -0
- package/dist/cjs/corpus/chunker.d.ts.map +1 -0
- package/dist/cjs/corpus/chunker.js +298 -0
- package/dist/cjs/corpus/chunker.js.map +1 -0
- package/dist/cjs/corpus/common/index.d.ts +2 -0
- package/dist/cjs/corpus/common/index.d.ts.map +1 -0
- package/dist/cjs/corpus/common/index.js +18 -0
- package/dist/cjs/corpus/common/index.js.map +1 -0
- package/dist/cjs/corpus/common/types.d.ts +37 -0
- package/dist/cjs/corpus/common/types.d.ts.map +1 -0
- package/dist/cjs/corpus/common/types.js +3 -0
- package/dist/cjs/corpus/common/types.js.map +1 -0
- package/dist/cjs/corpus/frontmatter.d.ts +13 -0
- package/dist/cjs/corpus/frontmatter.d.ts.map +1 -0
- package/dist/cjs/corpus/frontmatter.js +31 -0
- package/dist/cjs/corpus/frontmatter.js.map +1 -0
- package/dist/cjs/corpus/index.d.ts +6 -0
- package/dist/cjs/corpus/index.d.ts.map +1 -0
- package/dist/cjs/corpus/index.js +22 -0
- package/dist/cjs/corpus/index.js.map +1 -0
- package/dist/cjs/corpus/loader.d.ts +16 -0
- package/dist/cjs/corpus/loader.d.ts.map +1 -0
- package/dist/cjs/corpus/loader.js +72 -0
- package/dist/cjs/corpus/loader.js.map +1 -0
- package/dist/cjs/corpus/roots.d.ts +9 -0
- package/dist/cjs/corpus/roots.d.ts.map +1 -0
- package/dist/cjs/corpus/roots.js +30 -0
- package/dist/cjs/corpus/roots.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/protocol/common/constants.d.ts +9 -0
- package/dist/cjs/protocol/common/constants.d.ts.map +1 -0
- package/dist/cjs/protocol/common/constants.js +13 -0
- package/dist/cjs/protocol/common/constants.js.map +1 -0
- package/dist/cjs/protocol/common/index.d.ts +4 -0
- package/dist/cjs/protocol/common/index.d.ts.map +1 -0
- package/dist/cjs/protocol/common/index.js +20 -0
- package/dist/cjs/protocol/common/index.js.map +1 -0
- package/dist/cjs/protocol/common/rpc-error.d.ts +9 -0
- package/dist/cjs/protocol/common/rpc-error.d.ts.map +1 -0
- package/dist/cjs/protocol/common/rpc-error.js +12 -0
- package/dist/cjs/protocol/common/rpc-error.js.map +1 -0
- package/dist/cjs/protocol/common/types.d.ts +32 -0
- package/dist/cjs/protocol/common/types.d.ts.map +1 -0
- package/dist/cjs/protocol/common/types.js +3 -0
- package/dist/cjs/protocol/common/types.js.map +1 -0
- package/dist/cjs/protocol/index.d.ts +3 -0
- package/dist/cjs/protocol/index.d.ts.map +1 -0
- package/dist/cjs/protocol/index.js +19 -0
- package/dist/cjs/protocol/index.js.map +1 -0
- package/dist/cjs/protocol/transport.d.ts +28 -0
- package/dist/cjs/protocol/transport.d.ts.map +1 -0
- package/dist/cjs/protocol/transport.js +155 -0
- package/dist/cjs/protocol/transport.js.map +1 -0
- package/dist/cjs/search/common/constants.d.ts +23 -0
- package/dist/cjs/search/common/constants.d.ts.map +1 -0
- package/dist/cjs/search/common/constants.js +56 -0
- package/dist/cjs/search/common/constants.js.map +1 -0
- package/dist/cjs/search/common/index.d.ts +3 -0
- package/dist/cjs/search/common/index.d.ts.map +1 -0
- package/dist/cjs/search/common/index.js +19 -0
- package/dist/cjs/search/common/index.js.map +1 -0
- package/dist/cjs/search/common/types.d.ts +18 -0
- package/dist/cjs/search/common/types.d.ts.map +1 -0
- package/dist/cjs/search/common/types.js +3 -0
- package/dist/cjs/search/common/types.js.map +1 -0
- package/dist/cjs/search/index.d.ts +4 -0
- package/dist/cjs/search/index.d.ts.map +1 -0
- package/dist/cjs/search/index.js +20 -0
- package/dist/cjs/search/index.js.map +1 -0
- package/dist/cjs/search/planner.d.ts +13 -0
- package/dist/cjs/search/planner.d.ts.map +1 -0
- package/dist/cjs/search/planner.js +58 -0
- package/dist/cjs/search/planner.js.map +1 -0
- package/dist/cjs/search/store.d.ts +37 -0
- package/dist/cjs/search/store.d.ts.map +1 -0
- package/dist/cjs/search/store.js +141 -0
- package/dist/cjs/search/store.js.map +1 -0
- package/dist/cjs/server/freshness.d.ts +40 -0
- package/dist/cjs/server/freshness.d.ts.map +1 -0
- package/dist/cjs/server/freshness.js +85 -0
- package/dist/cjs/server/freshness.js.map +1 -0
- package/dist/cjs/server.d.ts +12 -0
- package/dist/cjs/server.d.ts.map +1 -0
- package/dist/cjs/server.js +65 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/tools/common/index.d.ts +2 -0
- package/dist/cjs/tools/common/index.d.ts.map +1 -0
- package/dist/cjs/tools/common/index.js +18 -0
- package/dist/cjs/tools/common/index.js.map +1 -0
- package/dist/cjs/tools/common/schemas.d.ts +23 -0
- package/dist/cjs/tools/common/schemas.d.ts.map +1 -0
- package/dist/cjs/tools/common/schemas.js +37 -0
- package/dist/cjs/tools/common/schemas.js.map +1 -0
- package/dist/cjs/tools/get.tool.d.ts +6 -0
- package/dist/cjs/tools/get.tool.d.ts.map +1 -0
- package/dist/cjs/tools/get.tool.js +115 -0
- package/dist/cjs/tools/get.tool.js.map +1 -0
- package/dist/cjs/tools/index.d.ts +4 -0
- package/dist/cjs/tools/index.d.ts.map +1 -0
- package/dist/cjs/tools/index.js +20 -0
- package/dist/cjs/tools/index.js.map +1 -0
- package/dist/cjs/tools/search.tool.d.ts +6 -0
- package/dist/cjs/tools/search.tool.d.ts.map +1 -0
- package/dist/cjs/tools/search.tool.js +58 -0
- package/dist/cjs/tools/search.tool.js.map +1 -0
- package/dist/corpus/changelogs/2025-12-16-initial-architecture.md +145 -0
- package/dist/corpus/changelogs/2025-12-16-model-repo-datasource-refactor.md +300 -0
- package/dist/corpus/changelogs/2025-12-17-refactor.md +90 -0
- package/dist/corpus/changelogs/2025-12-18-performance-optimizations.md +130 -0
- package/dist/corpus/changelogs/2025-12-18-repository-validation-security.md +255 -0
- package/dist/corpus/changelogs/2025-12-26-nested-relations-and-generics.md +86 -0
- package/dist/corpus/changelogs/2025-12-26-transaction-support.md +57 -0
- package/dist/corpus/changelogs/2025-12-29-dynamic-binding-registration.md +104 -0
- package/dist/corpus/changelogs/2025-12-29-snowflake-uid-helper.md +100 -0
- package/dist/corpus/changelogs/2025-12-30-repository-enhancements.md +214 -0
- package/dist/corpus/changelogs/2025-12-31-json-path-filtering-array-operators.md +214 -0
- package/dist/corpus/changelogs/2025-12-31-string-id-custom-generator.md +137 -0
- package/dist/corpus/changelogs/2026-01-02-default-filter-and-repository-mixins.md +421 -0
- package/dist/corpus/changelogs/2026-01-05-range-queries-content-range.md +184 -0
- package/dist/corpus/changelogs/2026-01-06-basic-authentication.md +103 -0
- package/dist/corpus/changelogs/2026-01-07-controller-route-customization.md +190 -0
- package/dist/corpus/changelogs/2026-01-11-logger-optimization-hf-logger.md +254 -0
- package/dist/corpus/changelogs/2026-02-06-socket-io-integration-fix.md +541 -0
- package/dist/corpus/changelogs/2026-02-10-websocket-heartbeat-payload.md +173 -0
- package/dist/corpus/changelogs/2026-02-11-crypto-refactor-ecdh.md +217 -0
- package/dist/corpus/changelogs/2026-02-11-websocket-encrypted-delivery.md +209 -0
- package/dist/corpus/changelogs/2026-02-11-websocket-generic-types.md +134 -0
- package/dist/corpus/changelogs/2026-02-16-authorization-system.md +378 -0
- package/dist/corpus/changelogs/2026-02-26-core-helpers-decoupling.md +145 -0
- package/dist/corpus/changelogs/2026-02-27-jwks-authentication.md +391 -0
- package/dist/corpus/changelogs/2026-03-02-model-authorize-settings.md +155 -0
- package/dist/corpus/changelogs/2026-03-04-jwt-payload-field-codecs.md +219 -0
- package/dist/corpus/changelogs/2026-03-06-filter-offset-skip-fix.md +88 -0
- package/dist/corpus/changelogs/2026-03-10-kafka-helpers-refactor.md +225 -0
- package/dist/corpus/changelogs/2026-03-12-kafka-helpers-enhancement.md +169 -0
- package/dist/corpus/changelogs/2026-03-15-grpc-controller-system.md +281 -0
- package/dist/corpus/changelogs/2026-03-30-row-level-locking.md +134 -0
- package/dist/corpus/changelogs/2026-03-31-typescript-6-and-toolchain.md +100 -0
- package/dist/corpus/changelogs/2026-04-23-error-response-extra-fields.md +131 -0
- package/dist/corpus/changelogs/2026-05-05-refresh-token-endpoint.md +116 -0
- package/dist/corpus/changelogs/2026-05-08-crud-route-toggles-and-typed-responses.md +136 -0
- package/dist/corpus/changelogs/2026-05-20-relation-scope-default-limit.md +133 -0
- package/dist/corpus/changelogs/2026-05-21-mass-mutation-guards.md +102 -0
- package/dist/corpus/changelogs/2026-05-22-casbin-adapter-schema-qualification.md +72 -0
- package/dist/corpus/changelogs/2026-05-25-per-model-default-limit.md +68 -0
- package/dist/corpus/changelogs/2026-05-27-casbin-domain-matching-function.md +90 -0
- package/dist/corpus/changelogs/2026-06-02-authorize-scoped-rbac.md +105 -0
- package/dist/corpus/changelogs/2026-06-14-validation-codes-and-error-hardening.md +124 -0
- package/dist/corpus/changelogs/2026-06-18-auth-user-information-endpoint.md +69 -0
- package/dist/corpus/changelogs/2026-06-25-redis-helpers-refactor.md +199 -0
- package/dist/corpus/changelogs/2026-07-05-unified-repository-connectors.md +206 -0
- package/dist/corpus/changelogs/2026-07-08-typesense-advanced-search.md +72 -0
- package/dist/corpus/changelogs/2026-07-11-connectors-consistency-hardening.md +192 -0
- package/dist/corpus/changelogs/2026-07-11-postgres-driver-seam-supabase.md +146 -0
- package/dist/corpus/changelogs/2026-07-12-core-consolidation-dedup.md +127 -0
- package/dist/corpus/changelogs/2026-07-13-hardening-round.md +99 -0
- package/dist/corpus/changelogs/2026-07-14-driver-class-bundling.md +100 -0
- package/dist/corpus/changelogs/2026-07-16-error-catalog-and-structured-message.md +64 -0
- package/dist/corpus/changelogs/2026-07-16-secrets-vault-integration.md +72 -0
- package/dist/corpus/changelogs/2026-07-17-error-module-redesign.md +202 -0
- package/dist/corpus/changelogs/2026-07-17-logger-correctness-pass.md +46 -0
- package/dist/corpus/changelogs/2026-07-17-secrets-bundler-invisible-peers.md +30 -0
- package/dist/corpus/changelogs/2026-07-18-dependency-refresh.md +55 -0
- package/dist/corpus/changelogs/2026-07-18-logger-overhaul.md +104 -0
- package/dist/corpus/changelogs/2026-07-18-repository-read-retry.md +74 -0
- package/dist/corpus/changelogs/2026-07-20-casbin-custom-grants.md +72 -0
- package/dist/corpus/changelogs/2026-07-20-casbin-single-wave-extraction.md +58 -0
- package/dist/corpus/changelogs/2026-07-20-error-from-error-client.md +66 -0
- package/dist/corpus/changelogs/2026-07-21-casbin-connector-resolution-fix.md +36 -0
- package/dist/corpus/changelogs/2026-07-25-error-logging.md +129 -0
- package/dist/corpus/changelogs/2026-07-25-ignis-filter-package.md +75 -0
- package/dist/corpus/changelogs/2026-07-26-search-and-mail-error-codes.md +58 -0
- package/dist/corpus/changelogs/2026-08-01-relational-connector-lift.md +403 -0
- package/dist/corpus/changelogs/2026-08-02-sqlite-and-pglite-connectors.md +177 -0
- package/dist/corpus/changelogs/2026-08-05-search-dialect-relational-parity.md +90 -0
- package/dist/corpus/changelogs/2026-08-06-aes-pbkdf2-and-key-rotation.md +131 -0
- package/dist/corpus/changelogs/2026-08-07-default-query-by.md +62 -0
- package/dist/corpus/changelogs/2026-08-07-nested-fields-and-order-validation.md +75 -0
- package/dist/corpus/changelogs/2026-08-07-typesense-multi-search-transport.md +97 -0
- package/dist/corpus/changelogs/2026-08-12-json-log-arguments.md +69 -0
- package/dist/corpus/changelogs/2026-08-13-browser-pure-kernel.md +130 -0
- package/dist/corpus/changelogs/2026-08-18-esm-builds-and-one-default-stack.md +104 -0
- package/dist/corpus/changelogs/2026-08-18-opaque-uid-helper.md +43 -0
- package/dist/corpus/changelogs/2026-08-19-browser-bff-multi-tab.md +88 -0
- package/dist/corpus/changelogs/2026-08-19-service-authentication-phase-1.md +157 -0
- package/dist/corpus/changelogs/2026-08-21-service-authentication-strategy.md +127 -0
- package/dist/corpus/changelogs/2026-08-22-logger-color-off-outside-development.md +48 -0
- package/dist/corpus/changelogs/2026-08-24-query-wrapper-schemas.md +77 -0
- package/dist/corpus/changelogs/2026-08-29-casbin-domain-hierarchy.md +66 -0
- package/dist/corpus/changelogs/2026-08-30-authorize-no-enforcer-fails-closed.md +60 -0
- package/dist/corpus/changelogs/2026-08-30-crypto-hashing.md +158 -0
- package/dist/corpus/changelogs/2026-08-30-policy-definition-extra-variants.md +62 -0
- package/dist/corpus/changelogs/2026-08-30-row-scope-filter.md +221 -0
- package/dist/corpus/changelogs/2026-08-30-search-connector-health-and-import-contract.md +46 -0
- package/dist/corpus/changelogs/2026-08-30-tree-and-recursive-sql.md +188 -0
- package/dist/corpus/changelogs/2026-08-30-typed-where-clauses.md +114 -0
- package/dist/corpus/changelogs/2026-08-31-entity-id-brand.md +70 -0
- package/dist/corpus/changelogs/2026-08-31-event-bus-retry.md +143 -0
- package/dist/corpus/changelogs/2026-08-31-policy-domain-split-release-b.md +54 -0
- package/dist/corpus/changelogs/2026-08-31-policy-domain-split.md +175 -0
- package/dist/corpus/changelogs/2026-08-31-scope-filter-boot-checks.md +77 -0
- package/dist/corpus/changelogs/2026-09-02-bundle-safe-helpers.md +71 -0
- package/dist/corpus/changelogs/2026-09-02-decorator-artifact-registration.md +119 -0
- package/dist/corpus/changelogs/2026-09-03-deprecated-boot-api-removed.md +133 -0
- package/dist/corpus/changelogs/2026-09-04-dependency-floors-raised.md +61 -0
- package/dist/corpus/changelogs/2026-09-05-boot-checks.md +57 -0
- package/dist/corpus/changelogs/2026-09-05-core-drops-boot-dependency.md +44 -0
- package/dist/corpus/changelogs/2026-09-05-list-response-contract.md +74 -0
- package/dist/corpus/changelogs/2026-09-06-bun-serve-options.md +51 -0
- package/dist/corpus/changelogs/2026-09-06-ignis-atlas.md +54 -0
- package/dist/corpus/changelogs/2026-09-06-repository-inheritance-and-quiet-cli.md +46 -0
- package/dist/corpus/changelogs/2026-09-06-shared-singletons-across-module-copies.md +43 -0
- package/dist/corpus/changelogs/index.md +135 -0
- package/dist/corpus/changelogs/planned-schema-migrator.md +553 -0
- package/dist/corpus/changelogs/template.md +64 -0
- package/dist/corpus/wiki/best-practices/api-usage-examples.md +617 -0
- package/dist/corpus/wiki/best-practices/architectural-patterns.md +437 -0
- package/dist/corpus/wiki/best-practices/architecture-decisions.md +524 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/advanced-patterns.md +283 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/constants-configuration.md +240 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/control-flow.md +280 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/documentation.md +241 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/function-patterns.md +178 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/index.md +114 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/naming-conventions.md +200 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/route-definitions.md +205 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/tooling.md +168 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/type-safety.md +199 -0
- package/dist/corpus/wiki/best-practices/common-pitfalls.md +447 -0
- package/dist/corpus/wiki/best-practices/contribution-workflow.md +211 -0
- package/dist/corpus/wiki/best-practices/data-modeling.md +548 -0
- package/dist/corpus/wiki/best-practices/deployment-strategies.md +736 -0
- package/dist/corpus/wiki/best-practices/error-handling.md +604 -0
- package/dist/corpus/wiki/best-practices/index.md +206 -0
- package/dist/corpus/wiki/best-practices/performance-optimization.md +437 -0
- package/dist/corpus/wiki/best-practices/security-guidelines.md +523 -0
- package/dist/corpus/wiki/best-practices/testing-strategies.md +639 -0
- package/dist/corpus/wiki/best-practices/troubleshooting-tips.md +227 -0
- package/dist/corpus/wiki/extensions/atlas/index.md +65 -0
- package/dist/corpus/wiki/extensions/components/api-reference.md +268 -0
- package/dist/corpus/wiki/extensions/components/authentication/api.md +643 -0
- package/dist/corpus/wiki/extensions/components/authentication/errors.md +211 -0
- package/dist/corpus/wiki/extensions/components/authentication/index.md +171 -0
- package/dist/corpus/wiki/extensions/components/authentication/usage.md +464 -0
- package/dist/corpus/wiki/extensions/components/authorization/api.md +1509 -0
- package/dist/corpus/wiki/extensions/components/authorization/errors.md +397 -0
- package/dist/corpus/wiki/extensions/components/authorization/getting-started.md +227 -0
- package/dist/corpus/wiki/extensions/components/authorization/index.md +155 -0
- package/dist/corpus/wiki/extensions/components/authorization/usage.md +587 -0
- package/dist/corpus/wiki/extensions/components/health-check.md +227 -0
- package/dist/corpus/wiki/extensions/components/index.md +26 -0
- package/dist/corpus/wiki/extensions/components/mail/api.md +773 -0
- package/dist/corpus/wiki/extensions/components/mail/errors.md +190 -0
- package/dist/corpus/wiki/extensions/components/mail/index.md +182 -0
- package/dist/corpus/wiki/extensions/components/mail/usage.md +370 -0
- package/dist/corpus/wiki/extensions/components/request-tracker.md +152 -0
- package/dist/corpus/wiki/extensions/components/socket-io/api.md +728 -0
- package/dist/corpus/wiki/extensions/components/socket-io/errors.md +119 -0
- package/dist/corpus/wiki/extensions/components/socket-io/index.md +116 -0
- package/dist/corpus/wiki/extensions/components/socket-io/usage.md +429 -0
- package/dist/corpus/wiki/extensions/components/static-asset/api.md +593 -0
- package/dist/corpus/wiki/extensions/components/static-asset/errors.md +159 -0
- package/dist/corpus/wiki/extensions/components/static-asset/index.md +160 -0
- package/dist/corpus/wiki/extensions/components/static-asset/usage.md +253 -0
- package/dist/corpus/wiki/extensions/components/template/api-page.md +125 -0
- package/dist/corpus/wiki/extensions/components/template/errors-page.md +100 -0
- package/dist/corpus/wiki/extensions/components/template/index.md +104 -0
- package/dist/corpus/wiki/extensions/components/template/setup-page.md +134 -0
- package/dist/corpus/wiki/extensions/components/template/single-page.md +132 -0
- package/dist/corpus/wiki/extensions/components/template/usage-page.md +127 -0
- package/dist/corpus/wiki/extensions/components/websocket/api.md +416 -0
- package/dist/corpus/wiki/extensions/components/websocket/errors.md +128 -0
- package/dist/corpus/wiki/extensions/components/websocket/index.md +127 -0
- package/dist/corpus/wiki/extensions/components/websocket/usage.md +257 -0
- package/dist/corpus/wiki/extensions/helpers/cron/index.md +116 -0
- package/dist/corpus/wiki/extensions/helpers/crypto/index.md +136 -0
- package/dist/corpus/wiki/extensions/helpers/crypto/reference.md +544 -0
- package/dist/corpus/wiki/extensions/helpers/env/index.md +119 -0
- package/dist/corpus/wiki/extensions/helpers/error/index.md +373 -0
- package/dist/corpus/wiki/extensions/helpers/index.md +63 -0
- package/dist/corpus/wiki/extensions/helpers/inversion/index.md +142 -0
- package/dist/corpus/wiki/extensions/helpers/inversion/reference.md +531 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/admin.md +210 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/compile-binary.md +125 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/consumer.md +422 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/examples.md +154 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/index.md +84 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/producer.md +408 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/schema-registry.md +194 -0
- package/dist/corpus/wiki/extensions/helpers/logger/hf-logger.md +220 -0
- package/dist/corpus/wiki/extensions/helpers/logger/index.md +156 -0
- package/dist/corpus/wiki/extensions/helpers/logger/pino.md +107 -0
- package/dist/corpus/wiki/extensions/helpers/logger/reference.md +938 -0
- package/dist/corpus/wiki/extensions/helpers/network/api.md +1067 -0
- package/dist/corpus/wiki/extensions/helpers/network/index.md +189 -0
- package/dist/corpus/wiki/extensions/helpers/queue/index.md +165 -0
- package/dist/corpus/wiki/extensions/helpers/queue/reference.md +490 -0
- package/dist/corpus/wiki/extensions/helpers/redis/index.md +159 -0
- package/dist/corpus/wiki/extensions/helpers/redis/reference.md +784 -0
- package/dist/corpus/wiki/extensions/helpers/secrets/index.md +136 -0
- package/dist/corpus/wiki/extensions/helpers/socket-io/api.md +618 -0
- package/dist/corpus/wiki/extensions/helpers/socket-io/index.md +167 -0
- package/dist/corpus/wiki/extensions/helpers/storage/api.md +1021 -0
- package/dist/corpus/wiki/extensions/helpers/storage/index.md +162 -0
- package/dist/corpus/wiki/extensions/helpers/template/index.md +69 -0
- package/dist/corpus/wiki/extensions/helpers/template/single-page.md +126 -0
- package/dist/corpus/wiki/extensions/helpers/types/index.md +143 -0
- package/dist/corpus/wiki/extensions/helpers/types/reference.md +708 -0
- package/dist/corpus/wiki/extensions/helpers/uid/index.md +259 -0
- package/dist/corpus/wiki/extensions/helpers/websocket/api.md +888 -0
- package/dist/corpus/wiki/extensions/helpers/websocket/index.md +139 -0
- package/dist/corpus/wiki/extensions/helpers/worker-thread/index.md +142 -0
- package/dist/corpus/wiki/extensions/helpers/worker-thread/reference.md +434 -0
- package/dist/corpus/wiki/extensions/index.md +46 -0
- package/dist/corpus/wiki/guides/core-concepts/application/bootstrapping.md +274 -0
- package/dist/corpus/wiki/guides/core-concepts/application/index.md +239 -0
- package/dist/corpus/wiki/guides/core-concepts/components-guide.md +513 -0
- package/dist/corpus/wiki/guides/core-concepts/components.md +155 -0
- package/dist/corpus/wiki/guides/core-concepts/dependency-injection.md +336 -0
- package/dist/corpus/wiki/guides/core-concepts/grpc-controllers.md +296 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/datasources.md +195 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/index.md +132 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/models.md +331 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/pglite.md +218 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/postgres-drivers.md +207 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/repositories.md +311 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/search-meilisearch.md +195 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/search-typesense.md +443 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/sqlite.md +296 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/transactions.md +238 -0
- package/dist/corpus/wiki/guides/core-concepts/rest-controllers.md +465 -0
- package/dist/corpus/wiki/guides/core-concepts/secrets-vault.md +177 -0
- package/dist/corpus/wiki/guides/core-concepts/services.md +389 -0
- package/dist/corpus/wiki/guides/get-started/5-minute-quickstart.md +163 -0
- package/dist/corpus/wiki/guides/get-started/philosophy.md +135 -0
- package/dist/corpus/wiki/guides/get-started/setup.md +136 -0
- package/dist/corpus/wiki/guides/index.md +82 -0
- package/dist/corpus/wiki/guides/migrations/boot-api-removal-migration.md +79 -0
- package/dist/corpus/wiki/guides/migrations/redis-helpers-migration.md +178 -0
- package/dist/corpus/wiki/guides/migrations/scoped-rbac-migration.md +300 -0
- package/dist/corpus/wiki/guides/migrations/unified-connectors-migration.md +114 -0
- package/dist/corpus/wiki/guides/reference/glossary.md +250 -0
- package/dist/corpus/wiki/guides/tutorials/building-a-crud-api.md +704 -0
- package/dist/corpus/wiki/guides/tutorials/complete-installation.md +440 -0
- package/dist/corpus/wiki/guides/tutorials/ecommerce-api.md +1442 -0
- package/dist/corpus/wiki/guides/tutorials/realtime-chat.md +1571 -0
- package/dist/corpus/wiki/guides/tutorials/testing.md +264 -0
- package/dist/corpus/wiki/index.md +5 -0
- package/dist/corpus/wiki/public/apple-touch-icon.png +0 -0
- package/dist/corpus/wiki/public/logo.svg +1 -0
- package/dist/corpus/wiki/public/og-image.png +0 -0
- package/dist/corpus/wiki/public/site.webmanifest +11 -0
- package/dist/corpus/wiki/references/base/application.md +482 -0
- package/dist/corpus/wiki/references/base/bootstrapping.md +351 -0
- package/dist/corpus/wiki/references/base/components.md +883 -0
- package/dist/corpus/wiki/references/base/connectors.md +121 -0
- package/dist/corpus/wiki/references/base/controllers.md +1022 -0
- package/dist/corpus/wiki/references/base/datasources-reference.md +598 -0
- package/dist/corpus/wiki/references/base/datasources.md +165 -0
- package/dist/corpus/wiki/references/base/dependency-injection.md +423 -0
- package/dist/corpus/wiki/references/base/filter-system/application-usage.md +215 -0
- package/dist/corpus/wiki/references/base/filter-system/array-operators.md +135 -0
- package/dist/corpus/wiki/references/base/filter-system/comparison-operators.md +110 -0
- package/dist/corpus/wiki/references/base/filter-system/default-filter.md +267 -0
- package/dist/corpus/wiki/references/base/filter-system/fields-order-pagination.md +244 -0
- package/dist/corpus/wiki/references/base/filter-system/index.md +149 -0
- package/dist/corpus/wiki/references/base/filter-system/json-filtering.md +122 -0
- package/dist/corpus/wiki/references/base/filter-system/list-operators.md +56 -0
- package/dist/corpus/wiki/references/base/filter-system/logical-operators.md +148 -0
- package/dist/corpus/wiki/references/base/filter-system/null-operators.md +80 -0
- package/dist/corpus/wiki/references/base/filter-system/pattern-matching.md +105 -0
- package/dist/corpus/wiki/references/base/filter-system/quick-reference.md +172 -0
- package/dist/corpus/wiki/references/base/filter-system/range-operators.md +53 -0
- package/dist/corpus/wiki/references/base/filter-system/tips.md +154 -0
- package/dist/corpus/wiki/references/base/filter-system/use-cases.md +394 -0
- package/dist/corpus/wiki/references/base/grpc-controllers.md +1020 -0
- package/dist/corpus/wiki/references/base/index.md +112 -0
- package/dist/corpus/wiki/references/base/middlewares.md +543 -0
- package/dist/corpus/wiki/references/base/models-reference.md +886 -0
- package/dist/corpus/wiki/references/base/models.md +154 -0
- package/dist/corpus/wiki/references/base/providers.md +728 -0
- package/dist/corpus/wiki/references/base/repositories/advanced.md +627 -0
- package/dist/corpus/wiki/references/base/repositories/index.md +152 -0
- package/dist/corpus/wiki/references/base/repositories/mixins.md +103 -0
- package/dist/corpus/wiki/references/base/repositories/relations.md +379 -0
- package/dist/corpus/wiki/references/base/repositories/soft-deletable.md +307 -0
- package/dist/corpus/wiki/references/base/secrets.md +267 -0
- package/dist/corpus/wiki/references/base/services.md +417 -0
- package/dist/corpus/wiki/references/configuration/environment-variables.md +498 -0
- package/dist/corpus/wiki/references/configuration/index.md +132 -0
- package/dist/corpus/wiki/references/index.md +172 -0
- package/dist/corpus/wiki/references/quick-reference.md +594 -0
- package/dist/corpus/wiki/references/utilities/date.md +50 -0
- package/dist/corpus/wiki/references/utilities/duration.md +85 -0
- package/dist/corpus/wiki/references/utilities/index.md +81 -0
- package/dist/corpus/wiki/references/utilities/jsx-reference.md +298 -0
- package/dist/corpus/wiki/references/utilities/jsx.md +131 -0
- package/dist/corpus/wiki/references/utilities/module.md +110 -0
- package/dist/corpus/wiki/references/utilities/parse.md +55 -0
- package/dist/corpus/wiki/references/utilities/performance.md +54 -0
- package/dist/corpus/wiki/references/utilities/promise.md +54 -0
- package/dist/corpus/wiki/references/utilities/request.md +85 -0
- package/dist/corpus/wiki/references/utilities/retry.md +148 -0
- package/dist/corpus/wiki/references/utilities/schema.md +69 -0
- package/dist/corpus/wiki/references/utilities/statuses-reference.md +360 -0
- package/dist/corpus/wiki/references/utilities/statuses.md +122 -0
- package/package.json +74 -0
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Network - Full Reference
|
|
3
|
+
description: Complete reference for every network helper class - HTTP fetchers, TCP/TLS socket client and server, UDP client - and every option and type
|
|
4
|
+
difficulty: intermediate
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Network - Full Reference
|
|
8
|
+
|
|
9
|
+
Exhaustive reference for `BaseNetworkRequest` and its fetchers, the TCP/TLS client-server hierarchy, `NetworkUdpClient`, and every option type. For a readable introduction and the most common tasks, start with the [Network overview](/extensions/helpers/network/).
|
|
10
|
+
|
|
11
|
+
## Find what you need
|
|
12
|
+
|
|
13
|
+
| You're looking for | Go to |
|
|
14
|
+
|---|---|
|
|
15
|
+
| The HTTP client base class and URL helpers | [BaseNetworkRequest](#basenetworkrequest) |
|
|
16
|
+
| Axios-backed HTTP client | [AxiosFetcher](#axiosfetcher) / [AxiosNetworkRequest](#axiosnetworkrequest) |
|
|
17
|
+
| Native-`fetch`-backed HTTP client | [NodeFetcher](#nodefetcher) / [NodeFetchNetworkRequest](#nodefetchnetworkrequest) |
|
|
18
|
+
| Why the `QUERY` method must reach the wire uppercase | [HTTP.Methods](#http-methods) |
|
|
19
|
+
| Secret redaction in request logs | [Request Logging and Redaction](#request-logging-and-redaction) |
|
|
20
|
+
| Plain TCP or TLS server, client tracking, authentication | [BaseNetworkTcpServer](#basenetworktcpserver) |
|
|
21
|
+
| Plain TCP or TLS client, auto-reconnect behavior | [BaseNetworkTcpClient](#basenetworktcpclient) |
|
|
22
|
+
| UDP client and multicast | [NetworkUdpClient](#networkudpclient) |
|
|
23
|
+
| Every option and type in one place | [Types Reference](#types-reference) |
|
|
24
|
+
|
|
25
|
+
**Files:**
|
|
26
|
+
|
|
27
|
+
- [`packages/helpers/src/modules/network/http-request/base-network-request.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/http-request/base-network-request.helper.ts) - `BaseNetworkRequest`
|
|
28
|
+
- [`packages/helpers/src/modules/network/http-request/fetcher/base-fetcher.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/http-request/fetcher/base-fetcher.ts) - `IFetchable`, `IRequestOptions`, `AbstractNetworkFetchableHelper`
|
|
29
|
+
- [`packages/helpers/src/modules/network/http-request/fetcher/node-fetcher.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/http-request/fetcher/node-fetcher.ts) - `NodeFetcher`, `NodeFetchNetworkRequest`
|
|
30
|
+
- [`packages/helpers/src/modules/network/http-request/fetcher/axios-fetcher.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/http-request/fetcher/axios-fetcher.ts) - `AxiosFetcher`, `AxiosNetworkRequest` (`@venizia/ignis-helpers/axios` sub-path)
|
|
31
|
+
- [`packages/helpers/src/modules/network/http-request/common/types.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/http-request/common/types.ts) - `TFetcherVariant`, `TFetcherResponse`, `TFetcherWorker`
|
|
32
|
+
- [`packages/helpers/src/modules/network/tcp-socket/base-tcp-server.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/tcp-socket/base-tcp-server.helper.ts) - `BaseNetworkTcpServer`, `ITcpSocketClient`, `ITcpSocketServerOptions`
|
|
33
|
+
- [`packages/helpers/src/modules/network/tcp-socket/base-tcp-client.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/tcp-socket/base-tcp-client.helper.ts) - `BaseNetworkTcpClient`, `INetworkTcpClientProps`
|
|
34
|
+
- [`packages/helpers/src/modules/network/tcp-socket/network-tcp-server.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/tcp-socket/network-tcp-server.helper.ts) - `NetworkTcpServer`
|
|
35
|
+
- [`packages/helpers/src/modules/network/tcp-socket/network-tcp-client.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/tcp-socket/network-tcp-client.helper.ts) - `NetworkTcpClient`
|
|
36
|
+
- [`packages/helpers/src/modules/network/tcp-socket/network-tls-tcp-server.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/tcp-socket/network-tls-tcp-server.helper.ts) - `NetworkTlsTcpServer`
|
|
37
|
+
- [`packages/helpers/src/modules/network/tcp-socket/network-tls-tcp-client.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/tcp-socket/network-tls-tcp-client.helper.ts) - `NetworkTlsTcpClient`
|
|
38
|
+
- [`packages/helpers/src/modules/network/udp-socket/network-udp-client.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/udp-socket/network-udp-client.helper.ts) - `NetworkUdpClient`, `INetworkUdpClientProps`
|
|
39
|
+
- [`packages/helpers/src/common/redact.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/redact.ts) - `redactSecrets`, `redactUrlCredentials`
|
|
40
|
+
- [`packages/helpers/src/common/constants/http.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/constants/http.ts) - `HTTP.Methods`, `THttpMethod`
|
|
41
|
+
|
|
42
|
+
## Architecture
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
BaseHelper
|
|
46
|
+
├── BaseNetworkRequest<T extends TFetcherVariant>
|
|
47
|
+
│ ├── AxiosNetworkRequest (T = 'axios')
|
|
48
|
+
│ └── NodeFetchNetworkRequest (T = 'node-fetch')
|
|
49
|
+
│
|
|
50
|
+
├── BaseNetworkTcpServer<ServerOpts, ServerType, ClientType>
|
|
51
|
+
│ ├── NetworkTcpServer (net.createServer, net.Socket)
|
|
52
|
+
│ └── NetworkTlsTcpServer (tls.createServer, tls.TLSSocket)
|
|
53
|
+
│
|
|
54
|
+
├── BaseNetworkTcpClient<ClientOpts, ClientType>
|
|
55
|
+
│ ├── NetworkTcpClient (net.connect, net.Socket)
|
|
56
|
+
│ └── NetworkTlsTcpClient (tls.connect, tls.TLSSocket)
|
|
57
|
+
│
|
|
58
|
+
└── NetworkUdpClient
|
|
59
|
+
|
|
60
|
+
AbstractNetworkFetchableHelper<V, RQ, RS> (implements IFetchable, NOT a BaseHelper)
|
|
61
|
+
├── AxiosFetcher (V = 'axios')
|
|
62
|
+
└── NodeFetcher (V = 'node-fetch')
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Every class that extends `BaseHelper` inherits scoped logging via `this.logger`. `AbstractNetworkFetchableHelper` and its two fetchers do **not** extend `BaseHelper`. They accept an optional `logger` parameter per call instead - see [Request Logging and Redaction](#request-logging-and-redaction).
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## HTTP Request API
|
|
70
|
+
|
|
71
|
+
### BaseNetworkRequest
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
class BaseNetworkRequest<T extends TFetcherVariant> extends BaseHelper
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Base class for HTTP request helpers. Holds a base URL and delegates to an `IFetchable` fetcher.
|
|
78
|
+
|
|
79
|
+
#### Constructor
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
constructor(opts: {
|
|
83
|
+
name: string;
|
|
84
|
+
baseUrl?: string;
|
|
85
|
+
fetcher: IFetchable<T, IRequestOptions, TFetcherResponse<T>>;
|
|
86
|
+
})
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
| Parameter | Type | Description |
|
|
90
|
+
|-----------|------|-------------|
|
|
91
|
+
| `name` | `string` | Helper name, used as both `scope` and `identifier` for logging |
|
|
92
|
+
| `baseUrl` | `string` | Base URL prepended to request paths. Defaults to `''` |
|
|
93
|
+
| `fetcher` | `IFetchable` | The underlying HTTP fetcher implementation |
|
|
94
|
+
|
|
95
|
+
#### Methods
|
|
96
|
+
|
|
97
|
+
##### `getRequestUrl(opts)`
|
|
98
|
+
|
|
99
|
+
Builds a full URL by combining a base URL with path segments. Throws if no base URL is available.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
getRequestUrl(opts: {
|
|
103
|
+
baseUrl?: string;
|
|
104
|
+
paths: Array<string>;
|
|
105
|
+
}): string
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Parameter | Type | Description |
|
|
109
|
+
|-----------|------|-------------|
|
|
110
|
+
| `baseUrl` | `string` | Overrides the instance's base URL. Falls back to `this.baseUrl`. An explicit empty string does **not** fall back - it throws |
|
|
111
|
+
| `paths` | `string[]` | Path segments to append. Each is prefixed with `/` if missing |
|
|
112
|
+
|
|
113
|
+
**Throws:** `ApplicationError` (via `getError`, `statusCode: 500`) with message `'[getRequestUrl] Invalid configuration for third party request base url!'` when both `opts.baseUrl` and `this.baseUrl` resolve to empty.
|
|
114
|
+
|
|
115
|
+
**Example:**
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
client.getRequestUrl({ paths: ['v1', 'users', '123'] });
|
|
119
|
+
// => 'https://api.example.com/v1/users/123'
|
|
120
|
+
|
|
121
|
+
client.getRequestUrl({ baseUrl: 'https://other.api.com', paths: ['health'] });
|
|
122
|
+
// => 'https://other.api.com/health'
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
##### `getRequestPath(opts)`
|
|
126
|
+
|
|
127
|
+
Joins path segments, ensuring each starts with `/`. An empty `paths` array joins to `''`.
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
getRequestPath(opts: { paths: Array<string> }): string
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Example:**
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
client.getRequestPath({ paths: ['v1', 'users'] });
|
|
137
|
+
// => '/v1/users'
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
##### `getNetworkService()`
|
|
141
|
+
|
|
142
|
+
Returns the underlying `IFetchable` fetcher instance.
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
getNetworkService(): IFetchable<T, IRequestOptions, TFetcherResponse<T>>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
##### `getWorker()`
|
|
149
|
+
|
|
150
|
+
Returns the raw HTTP client from the fetcher (`AxiosInstance` for Axios, `typeof fetch` for Node Fetch). Delegates to `fetcher.getWorker()`.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
getWorker(): TFetcherWorker<T>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
### IFetchable Interface
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
interface IFetchable<
|
|
162
|
+
V extends TFetcherVariant,
|
|
163
|
+
RQ extends IRequestOptions,
|
|
164
|
+
RS extends TFetcherResponse<V>,
|
|
165
|
+
> {
|
|
166
|
+
send(opts: RQ, logger?: any): Promise<RS>;
|
|
167
|
+
get(opts: RQ, logger?: any): Promise<RS>;
|
|
168
|
+
post(opts: RQ, logger?: any): Promise<RS>;
|
|
169
|
+
put(opts: RQ, logger?: any): Promise<RS>;
|
|
170
|
+
patch(opts: RQ, logger?: any): Promise<RS>;
|
|
171
|
+
delete(opts: RQ, logger?: any): Promise<RS>;
|
|
172
|
+
query(opts: RQ, logger?: any): Promise<RS>;
|
|
173
|
+
|
|
174
|
+
getWorker(): TFetcherWorker<V>;
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
All HTTP method shortcuts (`get`, `post`, `put`, `patch`, `delete`, `query`) delegate to `send()` with the `method` field set accordingly. `query` sends the HTTP `QUERY` method ([RFC 9110/10008](https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-10.html)). It behaves like `GET` but carries a body - useful for search payloads too large to fit a query string.
|
|
179
|
+
|
|
180
|
+
### IRequestOptions
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
interface IRequestOptions {
|
|
184
|
+
url: string;
|
|
185
|
+
method?: THttpMethod;
|
|
186
|
+
params?: AnyObject;
|
|
187
|
+
timeout?: number;
|
|
188
|
+
[extra: symbol | string]: any;
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### HTTP.Methods
|
|
193
|
+
|
|
194
|
+
The const-class every fetcher dispatches on:
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
HTTP.Methods = {
|
|
198
|
+
GET: 'get', POST: 'post', PUT: 'put', PATCH: 'patch',
|
|
199
|
+
DELETE: 'delete', HEAD: 'head', OPTIONS: 'options', QUERY: 'query',
|
|
200
|
+
} as const;
|
|
201
|
+
|
|
202
|
+
type THttpMethod = ValueOf<typeof HTTP.Methods> | Uppercase<ValueOf<typeof HTTP.Methods>>;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
> [!IMPORTANT]
|
|
206
|
+
> - **Every `HTTP.Methods` token is lowercase.** `@hono/zod-openapi` route definitions accept no other case.
|
|
207
|
+
> - **Both fetchers accept either case on input**, `'post'` or `'POST'`. Each calls `method.toUpperCase()` immediately before dispatching to its transport.
|
|
208
|
+
> - **This is not cosmetic.** Node's undici is the `fetch` implementation on Node - not Bun - and it auto-normalizes only some methods:
|
|
209
|
+
>
|
|
210
|
+
> | Auto-normalized by undici | Sent through verbatim |
|
|
211
|
+
> |---|---|
|
|
212
|
+
> | `DELETE`, `GET`, `HEAD`, `OPTIONS`, `POST`, `PUT` | `PATCH`, `QUERY` |
|
|
213
|
+
>
|
|
214
|
+
> A lowercase `patch` or `query` reaches the server unchanged, and most servers reject it.
|
|
215
|
+
> - **Bun and Axios hide the bug.** Bun's `fetch` and Axios both uppercase every method themselves - Axios via `node:http`. The bug surfaces only once the app runs on Node with undici.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### AbstractNetworkFetchableHelper
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
abstract class AbstractNetworkFetchableHelper<
|
|
223
|
+
V extends TFetcherVariant,
|
|
224
|
+
RQ extends IRequestOptions,
|
|
225
|
+
RS extends TFetcherResponse<V>,
|
|
226
|
+
> implements IFetchable<V, RQ, RS>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Abstract base for fetcher implementations. Provides convenience HTTP method wrappers and protocol detection. Does **not** extend `BaseHelper` - it has no `this.logger`.
|
|
230
|
+
|
|
231
|
+
#### Constructor
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
constructor(opts: { name: string; variant: V })
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
#### Methods
|
|
238
|
+
|
|
239
|
+
##### `abstract send(opts, logger?)`
|
|
240
|
+
|
|
241
|
+
Subclasses must implement the actual request dispatch.
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
abstract send(opts: RQ, logger?: any): Promise<RS>;
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
##### `get(opts, logger?)` / `post(opts, logger?)` / `put(opts, logger?)` / `patch(opts, logger?)` / `delete(opts, logger?)` / `query(opts, logger?)`
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
get(opts: RQ, logger?: any): Promise<RS>
|
|
251
|
+
post(opts: RQ, logger?: any): Promise<RS>
|
|
252
|
+
put(opts: RQ, logger?: any): Promise<RS>
|
|
253
|
+
patch(opts: RQ, logger?: any): Promise<RS>
|
|
254
|
+
delete(opts: RQ, logger?: any): Promise<RS>
|
|
255
|
+
query(opts: RQ, logger?: any): Promise<RS>
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Each calls `send()` with `method` set to the matching `HTTP.Methods` token (`get` → `HTTP.Methods.GET`, ... `query` → `HTTP.Methods.QUERY`). Any other field on `opts` (`body`, `headers`, `params`, ...) passes through untouched.
|
|
259
|
+
|
|
260
|
+
##### `getProtocol(url)`
|
|
261
|
+
|
|
262
|
+
Returns `HTTP.Protocols.HTTP` (`'http'`) if `url` starts with `'http:'`, otherwise `HTTP.Protocols.HTTPS` (`'https'`).
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
getProtocol(url: string): 'http' | 'https'
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
##### `getWorker()`
|
|
269
|
+
|
|
270
|
+
Returns the underlying HTTP client instance (set by the concrete fetcher's constructor).
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
getWorker(): TFetcherWorker<V>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
### AxiosFetcher
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
class AxiosFetcher extends AbstractNetworkFetchableHelper<
|
|
282
|
+
'axios',
|
|
283
|
+
IAxiosRequestOptions,
|
|
284
|
+
AxiosResponse['data']
|
|
285
|
+
>
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Axios-based fetcher implementation. Creates an `axios` instance with the provided default configuration.
|
|
289
|
+
|
|
290
|
+
#### Constructor
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
constructor(opts: {
|
|
294
|
+
name: string;
|
|
295
|
+
defaultConfigs: AxiosRequestConfig;
|
|
296
|
+
logger?: any;
|
|
297
|
+
})
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
`opts.logger`, if provided, logs `'Creating new network request worker instance! Name: %s'` once at construction time. This is unrelated to the per-call `logger` argument on `send()`.
|
|
301
|
+
|
|
302
|
+
#### IAxiosRequestOptions
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
interface IAxiosRequestOptions extends AxiosRequestConfig, IRequestOptions {
|
|
306
|
+
url: string;
|
|
307
|
+
method?: THttpMethod;
|
|
308
|
+
params?: AnyObject;
|
|
309
|
+
body?: AnyObject; // Mapped to Axios `data`
|
|
310
|
+
headers?: AnyObject;
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
> [!NOTE]
|
|
315
|
+
> - **`body` maps to Axios's `data`** field internally.
|
|
316
|
+
> - **Query `params` are serialized** using `node:querystring` via Axios's `paramsSerializer`.
|
|
317
|
+
> - **HTTPS gets an `https.Agent` automatically.** Certificate verification is ON, and connections are kept alive. Pass `rejectUnauthorized: false` - on the fetcher, for the whole instance, or on a single request - only when you genuinely mean to accept an unverified certificate. A caller-supplied `httpsAgent` always wins, so a custom CA, pinning or mTLS agent is honoured as given.
|
|
318
|
+
|
|
319
|
+
#### Methods
|
|
320
|
+
|
|
321
|
+
##### `send(opts, logger?)`
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
override send<T = any>(opts: IAxiosRequestOptions, logger?: any): Promise<AxiosResponse<T>>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Dispatches the request via the internal `axios` instance.
|
|
328
|
+
|
|
329
|
+
- `method` defaults to `HTTP.Methods.GET` and is uppercased before dispatch.
|
|
330
|
+
- HTTPS URLs automatically get an `https.Agent` configured.
|
|
331
|
+
- If `logger` is passed, logs `'URL: %s | Props: %s'` at `info` level with the assembled request config run through `redactSecrets()`.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
### AxiosNetworkRequest
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
class AxiosNetworkRequest extends BaseNetworkRequest<'axios'>
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Pre-configured HTTP client using Axios. Import only from the sub-path - `import { AxiosNetworkRequest } from '@venizia/ignis-helpers/axios'`.
|
|
342
|
+
|
|
343
|
+
#### Constructor
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
constructor(opts: IAxiosNetworkRequestOptions)
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
interface IAxiosNetworkRequestOptions {
|
|
351
|
+
name: string;
|
|
352
|
+
networkOptions: Omit<AxiosRequestConfig, 'baseURL'> & {
|
|
353
|
+
baseUrl?: string;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Default configuration applied:**
|
|
359
|
+
|
|
360
|
+
| Setting | Default |
|
|
361
|
+
|---------|---------|
|
|
362
|
+
| `headers['content-type']` | `'application/json; charset=utf-8'` |
|
|
363
|
+
| `withCredentials` | `true` |
|
|
364
|
+
| `validateStatus` | `(status) => status < 500` |
|
|
365
|
+
| `timeout` | `60000` (1 minute) |
|
|
366
|
+
|
|
367
|
+
User-provided values in `networkOptions` override all defaults. `networkOptions.baseUrl` maps to Axios's `baseURL`.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
### NodeFetcher
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
class NodeFetcher extends AbstractNetworkFetchableHelper<
|
|
375
|
+
'node-fetch',
|
|
376
|
+
INodeFetchRequestOptions,
|
|
377
|
+
Awaited<ReturnType<typeof fetch>>
|
|
378
|
+
>
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Native `fetch`-based fetcher implementation.
|
|
382
|
+
|
|
383
|
+
#### Constructor
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
constructor(opts: {
|
|
387
|
+
name: string;
|
|
388
|
+
defaultConfigs: RequestInit;
|
|
389
|
+
logger?: any;
|
|
390
|
+
})
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
#### INodeFetchRequestOptions
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
interface INodeFetchRequestOptions extends RequestInit, IRequestOptions {
|
|
397
|
+
url: string;
|
|
398
|
+
method?: THttpMethod;
|
|
399
|
+
params?: AnyObject;
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
#### Methods
|
|
404
|
+
|
|
405
|
+
##### `send(opts, logger?)`
|
|
406
|
+
|
|
407
|
+
```typescript
|
|
408
|
+
override async send(opts: INodeFetchRequestOptions, logger?: any): Promise<Response>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Dispatches the request using the native `fetch` API. Behavior:
|
|
412
|
+
|
|
413
|
+
- `method` defaults to `HTTP.Methods.GET` and is uppercased before dispatch.
|
|
414
|
+
- Query `params` are serialized with `node:querystring` and appended to `url`. The separator adapts: `?` when the URL carries no query string yet, `&` when it already does - never a double `?`.
|
|
415
|
+
- If `timeout` is provided, an internal `AbortController` aborts the request after that many milliseconds.
|
|
416
|
+
- The internal timeout signal is **composed**, never substituted, with a caller-supplied `signal`. When both are present, IGNIS builds `AbortSignal.any([signal, timeoutController.signal])`. That way a caller aborting its own signal still cancels the request, even while a timeout is also armed.
|
|
417
|
+
- The timer is cleared as soon as the request settles.
|
|
418
|
+
- If `logger` is passed, logs `'URL: %s | Props: %s | Timeout: %s'` at `info` level with the request config run through `redactSecrets()`.
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
### NodeFetchNetworkRequest
|
|
423
|
+
|
|
424
|
+
```typescript
|
|
425
|
+
class NodeFetchNetworkRequest extends BaseNetworkRequest<'node-fetch'>
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Pre-configured HTTP client using native `fetch`. Exported from the root barrel - no extra dependency.
|
|
429
|
+
|
|
430
|
+
#### Constructor
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
constructor(opts: INodeFetchNetworkRequestOptions)
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
```typescript
|
|
437
|
+
interface INodeFetchNetworkRequestOptions {
|
|
438
|
+
name: string;
|
|
439
|
+
networkOptions: RequestInit & {
|
|
440
|
+
baseUrl?: string;
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
**Default configuration applied:**
|
|
446
|
+
|
|
447
|
+
| Setting | Default |
|
|
448
|
+
|---------|---------|
|
|
449
|
+
| `headers['content-type']` | `'application/json; charset=utf-8'` |
|
|
450
|
+
|
|
451
|
+
If `headers` is a `Headers` instance, it is converted to a plain object via `Object.fromEntries(headers.entries())` before merging with the default.
|
|
452
|
+
|
|
453
|
+
> [!WARNING] `timeout` is per-call, not per-instance
|
|
454
|
+
> `networkOptions` is `RequestInit`, which has no `timeout` field. Passing one there has no effect on request cancellation. `NodeFetcher.send()` only reads `timeout` from the arguments of each individual `send()`/`get()`/... call. Pass it every time you need an abort:
|
|
455
|
+
>
|
|
456
|
+
> ```typescript
|
|
457
|
+
> await this.getNetworkService().send({ url: '/slow-endpoint', method: 'get', timeout: 5000 });
|
|
458
|
+
> ```
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
### Request Logging and Redaction
|
|
463
|
+
|
|
464
|
+
Neither fetcher logs anything by default. `send()` and every shortcut accept an **optional** `logger` as the second argument, guarded internally with `logger?.for(...)`. Pass a logger to get an `info`-level line per request - typically `this.logger`, whether the caller is a `BaseHelper` subclass or extends `BaseNetworkRequest` directly:
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
await this.getNetworkService().post({ url, body }, this.logger);
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Whenever a logger is passed, IGNIS runs the assembled request config through `redactSecrets()` before the log line is written. That covers `url`, `method`, `headers`, `body`/`data`, and any other option. Redaction matches by key name, case-insensitively, at any depth, against `SECRET_KEY_PATTERN`:
|
|
471
|
+
|
|
472
|
+
| Key group | Matched spellings |
|
|
473
|
+
|-----------|--------------------|
|
|
474
|
+
| Options-object (camelCase) | `pass`, `password`, `passphrase`, `secret`, `token`, `apiKey`, `accessKey`, `secretKey`, `privateKey`, `key`, `cert`, `ca`, `pfx`, `credentials`, `authorization`, `auth`, `jwtSecret`, `applicationSecret`, `connectionString` |
|
|
475
|
+
| Options-object (snake_case) | `api_key`, `access_key`, `secret_key`, `private_key` |
|
|
476
|
+
| HTTP header spellings | `cookie`, `set-cookie`, `proxy-authorization`, `www-authenticate`, and any `(x-)?(api\|auth\|access\|secret\|session\|csrf\|xsrf)-(key\|token\|secret\|id)` pattern (e.g. `x-api-key`, `x-auth-token`, `x-csrf-token`) |
|
|
477
|
+
|
|
478
|
+
Source: [`redact.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/common/redact.ts) `SECRET_KEY_PATTERN`.
|
|
479
|
+
|
|
480
|
+
A matched value is replaced with `'[REDACTED]'`. `Buffer`/typed-array values under a non-matching key are summarized as `'[Binary N bytes]'` rather than serialized. There is nothing to configure beyond passing the logger - you never call `redactSecrets()` yourself at the call site.
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
## TCP Socket API
|
|
485
|
+
|
|
486
|
+
### BaseNetworkTcpServer
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
class BaseNetworkTcpServer<
|
|
490
|
+
SocketServerOptions extends ServerOpts = ServerOpts,
|
|
491
|
+
SocketServerType extends SocketServer = SocketServer,
|
|
492
|
+
SocketClientType extends SocketClient = SocketClient,
|
|
493
|
+
> extends BaseHelper
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Abstract TCP server with client tracking, authentication flow, and event delegation.
|
|
497
|
+
|
|
498
|
+
#### Constructor
|
|
499
|
+
|
|
500
|
+
```typescript
|
|
501
|
+
constructor(opts: ITcpSocketServerOptions<SocketServerOptions, SocketServerType, SocketClientType>)
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
**Throws:** `ApplicationError` when `authenticateOptions.required` is `true` and `duration` is missing, `0`, or negative. Message: `'TCP Server | Invalid authenticate duration | Required duration for authenticateOptions'`.
|
|
505
|
+
|
|
506
|
+
The constructor calls `configure()`, which creates the server via `createServerFn` and starts listening.
|
|
507
|
+
|
|
508
|
+
#### Protected Properties
|
|
509
|
+
|
|
510
|
+
| Property | Type | Description |
|
|
511
|
+
|----------|------|-------------|
|
|
512
|
+
| `serverOptions` | `Partial<SocketServerOptions>` | Server creation options |
|
|
513
|
+
| `listenOptions` | `Partial<ListenOptions>` | Listen configuration |
|
|
514
|
+
| `authenticateOptions` | `{ required: boolean; duration?: number }` | Auth settings |
|
|
515
|
+
| `clients` | `Record<string, ITcpSocketClient<SocketClientType>>` | Connected client registry |
|
|
516
|
+
| `server` | `SocketServerType` | The underlying server instance |
|
|
517
|
+
| `extraEvents` | `Record<string, (opts) => ValueOrPromise<void>>` | Additional per-client socket events to register |
|
|
518
|
+
|
|
519
|
+
- **Hooks never crash the process.** `onClientData`, `onClientConnected`, `onClientClose`, `onClientError`, `onServerReady`, `onServerError`, and each `extraEvents` entry all run through an internal `invokeHook()` wrapper.
|
|
520
|
+
- **Why it exists.** A hook throwing synchronously inside a raw `net`/`tls` event listener would otherwise be an uncaught exception. That crashes the process. `invokeHook()` catches the throw and logs it instead.
|
|
521
|
+
|
|
522
|
+
#### Methods
|
|
523
|
+
|
|
524
|
+
##### `configure()`
|
|
525
|
+
|
|
526
|
+
Creates the server using `createServerFn`, registers a server-level `error` listener (routed to `onServerError`, never left to crash the process), and starts listening. Called automatically by the constructor.
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
configure(): void
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
##### `onNewConnection(opts)`
|
|
533
|
+
|
|
534
|
+
Handles a new client connection:
|
|
535
|
+
|
|
536
|
+
- Assigns a unique ID via `getUID()`.
|
|
537
|
+
- Registers `data`/`error`/`close`/`extraEvents` listeners on the socket.
|
|
538
|
+
- Tracks the client in the `clients` registry.
|
|
539
|
+
- Invokes `onClientConnected`.
|
|
540
|
+
- Starts the authentication kick-timer when `authenticateOptions.required` is `true`.
|
|
541
|
+
|
|
542
|
+
```typescript
|
|
543
|
+
onNewConnection(opts: { socket: SocketClientType }): void
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
##### `getClients()` / `getClient(opts)` / `getServer()`
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
getClients(): Record<string, ITcpSocketClient<SocketClientType>>
|
|
550
|
+
getClient(opts: { id: string }): ITcpSocketClient<SocketClientType> | undefined
|
|
551
|
+
getServer(): SocketServerType
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
##### `doAuthenticate(opts)`
|
|
555
|
+
|
|
556
|
+
Transitions a client's authentication state.
|
|
557
|
+
|
|
558
|
+
```typescript
|
|
559
|
+
doAuthenticate(opts: {
|
|
560
|
+
id: string;
|
|
561
|
+
state: 'unauthorized' | 'authenticating' | 'authenticated';
|
|
562
|
+
}): void
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
| New state | Effect |
|
|
566
|
+
|---|---|
|
|
567
|
+
| `'authenticated'` | Sets `storage.authenticatedAt`; clears the pending kick-timer |
|
|
568
|
+
| `'unauthorized'` / `'authenticating'` | Clears `storage.authenticatedAt` |
|
|
569
|
+
|
|
570
|
+
##### `emit(opts)`
|
|
571
|
+
|
|
572
|
+
Writes data to a specific client's socket. Never throws - each failure case logs and returns instead:
|
|
573
|
+
|
|
574
|
+
| Condition | Log level |
|
|
575
|
+
|-----------|-----------|
|
|
576
|
+
| Client not found for `clientId` | `error` |
|
|
577
|
+
| Socket not writable | `error` |
|
|
578
|
+
| Payload empty (`!payload?.length`) | `info` |
|
|
579
|
+
|
|
580
|
+
```typescript
|
|
581
|
+
emit(opts: { clientId: string; payload: Buffer | string }): void
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
##### `shutdown()`
|
|
585
|
+
|
|
586
|
+
Tears the server down completely and resolves even while clients are still attached.
|
|
587
|
+
|
|
588
|
+
```typescript
|
|
589
|
+
async shutdown(): Promise<void>
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
**Order of operations:**
|
|
593
|
+
|
|
594
|
+
1. Clears every client's pending authenticate kick-timer.
|
|
595
|
+
2. Destroys every client socket.
|
|
596
|
+
3. Empties the `clients` registry.
|
|
597
|
+
4. Calls `server.close()` and awaits its callback.
|
|
598
|
+
|
|
599
|
+
- **Why this order.** `server.close()` alone never resolves while a socket is still attached. A caller reaching through `getServer().close()` on a busy server would hang forever.
|
|
600
|
+
- **Idempotent.** A second call is a no-op that resolves cleanly.
|
|
601
|
+
- **Safe on a server that never finished `listen()`.** Logs the resulting `ERR_SERVER_NOT_RUNNING` rather than throwing.
|
|
602
|
+
- **After `shutdown()`**, new connection attempts are refused.
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
### ITcpSocketClient
|
|
607
|
+
|
|
608
|
+
```typescript
|
|
609
|
+
interface ITcpSocketClient<SocketClientType> {
|
|
610
|
+
id: string;
|
|
611
|
+
socket: SocketClientType;
|
|
612
|
+
state: 'unauthorized' | 'authenticating' | 'authenticated';
|
|
613
|
+
subscriptions: Set<string>;
|
|
614
|
+
storage: {
|
|
615
|
+
connectedAt: dayjs.Dayjs;
|
|
616
|
+
authenticatedAt: dayjs.Dayjs | null;
|
|
617
|
+
authenticateTimeout?: ReturnType<typeof setTimeout> | null;
|
|
618
|
+
[additionField: symbol | string]: any;
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
### NetworkTcpServer
|
|
626
|
+
|
|
627
|
+
```typescript
|
|
628
|
+
class NetworkTcpServer extends BaseNetworkTcpServer<ServerOpts, Server, Socket>
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Plain TCP server using `net.createServer`.
|
|
632
|
+
|
|
633
|
+
#### Constructor
|
|
634
|
+
|
|
635
|
+
```typescript
|
|
636
|
+
constructor(opts: Omit<ITcpSocketServerOptions, 'createServerFn'>)
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
The `createServerFn` is pre-set to `net.createServer`. `scope` is hardcoded to `'NetworkTcpServer'`, overriding any `opts.scope`.
|
|
640
|
+
|
|
641
|
+
#### Static Methods
|
|
642
|
+
|
|
643
|
+
##### `newInstance(opts)`
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
static newInstance(
|
|
647
|
+
opts: Omit<ITcpSocketServerOptions, 'createServerFn'>
|
|
648
|
+
): NetworkTcpServer
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
653
|
+
### NetworkTlsTcpServer
|
|
654
|
+
|
|
655
|
+
```typescript
|
|
656
|
+
class NetworkTlsTcpServer extends BaseNetworkTcpServer<TlsOptions, tls.Server, TLSSocket>
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
TLS-encrypted TCP server using `tls.createServer`.
|
|
660
|
+
|
|
661
|
+
#### Constructor
|
|
662
|
+
|
|
663
|
+
```typescript
|
|
664
|
+
constructor(opts: Omit<ITcpSocketServerOptions<TlsOptions, tls.Server, TLSSocket>, 'createServerFn'>)
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
The `createServerFn` is pre-set to `tls.createServer`. `scope` is hardcoded to `'NetworkTlsTcpServer'`. Pass TLS certificates and keys in `serverOptions` (type `TlsOptions` from `node:tls`). Every method, including `shutdown()`, is identical to `NetworkTcpServer`.
|
|
668
|
+
|
|
669
|
+
#### Static Methods
|
|
670
|
+
|
|
671
|
+
##### `newInstance(opts)`
|
|
672
|
+
|
|
673
|
+
```typescript
|
|
674
|
+
static newInstance(
|
|
675
|
+
opts: Omit<ITcpSocketServerOptions<TlsOptions, tls.Server, TLSSocket>, 'createServerFn'>
|
|
676
|
+
): NetworkTlsTcpServer
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
### BaseNetworkTcpClient
|
|
682
|
+
|
|
683
|
+
```typescript
|
|
684
|
+
class BaseNetworkTcpClient<
|
|
685
|
+
SocketClientOptions extends PlainConnectionOptions | TlsConnectionOptions,
|
|
686
|
+
SocketClientType extends PlainSocketClient | TlsSocketClient,
|
|
687
|
+
> extends BaseHelper
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
Abstract TCP client with auto-reconnect, encoding support, and lifecycle hooks.
|
|
691
|
+
|
|
692
|
+
#### Constructor
|
|
693
|
+
|
|
694
|
+
```typescript
|
|
695
|
+
constructor(opts: INetworkTcpClientProps<SocketClientOptions, SocketClientType>)
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
Does **not** call `connect()` automatically. Construction only stores options - call `connect({ resetReconnectCounter })` explicitly.
|
|
699
|
+
|
|
700
|
+
#### Protected Properties
|
|
701
|
+
|
|
702
|
+
| Property | Type | Description |
|
|
703
|
+
|----------|------|-------------|
|
|
704
|
+
| `client` | `SocketClientType \| null` | The underlying socket, or `null`/`undefined` when disconnected |
|
|
705
|
+
| `options` | `SocketClientOptions` | Connection options |
|
|
706
|
+
| `reconnect` | `boolean` | Whether auto-reconnect is enabled (default: `false`) |
|
|
707
|
+
| `retry` | `{ maxReconnect: number; currentReconnect: number }` | Reconnect state. `maxReconnect` defaults to `5` |
|
|
708
|
+
| `encoding` | `BufferEncoding \| undefined` | Socket encoding |
|
|
709
|
+
|
|
710
|
+
##### `getLoggableOptions()`
|
|
711
|
+
|
|
712
|
+
```typescript
|
|
713
|
+
protected getLoggableOptions(): unknown
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
Returns `redactSecrets(this.options)`. A TLS client's `options` **is** its private key material - `key`/`cert`/`passphrase`. Every internal log call uses this method instead of logging `this.options` directly, or the key would be written to every log file and aggregator downstream.
|
|
717
|
+
|
|
718
|
+
#### Methods
|
|
719
|
+
|
|
720
|
+
##### `connect(opts)`
|
|
721
|
+
|
|
722
|
+
Establishes the connection:
|
|
723
|
+
|
|
724
|
+
- No-op with a log line if already connected (`isConnected()`) or if `options` is empty.
|
|
725
|
+
- Otherwise, in order:
|
|
726
|
+
1. Destroys any stale `client` first.
|
|
727
|
+
2. Creates the socket via `createClientFn`.
|
|
728
|
+
3. Registers `data`/`close`/`error` listeners.
|
|
729
|
+
4. Applies `encoding`, if set.
|
|
730
|
+
|
|
731
|
+
```typescript
|
|
732
|
+
connect(opts: { resetReconnectCounter: boolean }): void
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
| Parameter | Type | Description |
|
|
736
|
+
|-----------|------|-------------|
|
|
737
|
+
| `resetReconnectCounter` | `boolean` | If `true`, resets `retry.currentReconnect` to `0` before connecting |
|
|
738
|
+
|
|
739
|
+
##### `disconnect()`
|
|
740
|
+
|
|
741
|
+
Destroys the socket, clears the reconnect timeout, and sets `client` to `null`. No-op with a log line if `client` is not set.
|
|
742
|
+
|
|
743
|
+
```typescript
|
|
744
|
+
disconnect(): void
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
##### `forceReconnect()`
|
|
748
|
+
|
|
749
|
+
Calls `disconnect()` then `connect({ resetReconnectCounter: true })`.
|
|
750
|
+
|
|
751
|
+
```typescript
|
|
752
|
+
forceReconnect(): void
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
##### `isConnected()`
|
|
756
|
+
|
|
757
|
+
Returns a truthy value if `client` exists and its `readyState` is not `'closed'`.
|
|
758
|
+
|
|
759
|
+
```typescript
|
|
760
|
+
isConnected(): SocketClientType | null | undefined
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
##### `emit(opts)`
|
|
764
|
+
|
|
765
|
+
Writes data to the server. Logs and returns without throwing if `client` is not initialized or the payload is empty.
|
|
766
|
+
|
|
767
|
+
```typescript
|
|
768
|
+
emit(opts: { payload: Buffer | string }): void
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
##### `getClient()`
|
|
772
|
+
|
|
773
|
+
```typescript
|
|
774
|
+
getClient(): SocketClientType | null | undefined
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
##### `handleConnected()` / `handleData(_opts)` / `handleClosed()` / `handleError(error)`
|
|
778
|
+
|
|
779
|
+
Default handlers used when the matching `onConnected`/`onData`/`onClosed`/`onError` option is omitted.
|
|
780
|
+
|
|
781
|
+
```typescript
|
|
782
|
+
handleConnected(): void // Logs, resets retry.currentReconnect to 0
|
|
783
|
+
handleData(_opts: { identifier: string; message: string | Buffer }): void // No-op
|
|
784
|
+
handleClosed(): void // Logs the closure
|
|
785
|
+
handleError(error: any): void // Logs; schedules a reconnect if eligible
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
**Reconnect gate on `handleError`:**
|
|
789
|
+
|
|
790
|
+
| Condition | Result |
|
|
791
|
+
|-----------|--------|
|
|
792
|
+
| `reconnect` is `false` | No reconnect - the first guard returns immediately |
|
|
793
|
+
| `retry.currentReconnect >= retry.maxReconnect` | No reconnect - the first guard returns immediately |
|
|
794
|
+
| `maxReconnect === -1` | **No reconnect, ever.** `currentReconnect` starts at `0`, and `0 >= -1` is already true, so the first guard returns before any attempt is made |
|
|
795
|
+
| `reconnect` is `true` and `currentReconnect < maxReconnect` (with `maxReconnect >= 0`) | Reconnect scheduled |
|
|
796
|
+
|
|
797
|
+
> [!IMPORTANT]
|
|
798
|
+
> - **`maxReconnect: -1` does not mean unlimited reconnects - it disables reconnection entirely.** That is the opposite of the "`-1` = unlimited" convention used elsewhere in the framework - the Redis retry helper, for example.
|
|
799
|
+
> - **A second guard further down the method is dead code.** `if (maxReconnect > -1 && currentReconnect >= maxReconnect)` can never be true. By the time control reaches it, the first guard has already ruled out `currentReconnect >= maxReconnect`.
|
|
800
|
+
> - Source: [`base-tcp-client.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/helpers/src/modules/network/tcp-socket/base-tcp-client.helper.ts).
|
|
801
|
+
|
|
802
|
+
The reconnect delay is a **fixed 5000 ms**. There is no backoff growth on the TCP/TLS client, unlike the Redis helper's exponential strategy.
|
|
803
|
+
|
|
804
|
+
---
|
|
805
|
+
|
|
806
|
+
### NetworkTcpClient
|
|
807
|
+
|
|
808
|
+
```typescript
|
|
809
|
+
class NetworkTcpClient extends BaseNetworkTcpClient<TcpSocketConnectOpts, Socket>
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
Plain TCP client using `net.connect`.
|
|
813
|
+
|
|
814
|
+
#### Constructor
|
|
815
|
+
|
|
816
|
+
```typescript
|
|
817
|
+
constructor(
|
|
818
|
+
opts: Omit<INetworkTcpClientProps<TcpSocketConnectOpts, Socket>, 'createClientFn'>
|
|
819
|
+
)
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
The `createClientFn` is pre-set to `net.connect`. `scope` is hardcoded to `'NetworkTcpClient'`.
|
|
823
|
+
|
|
824
|
+
#### Static Methods
|
|
825
|
+
|
|
826
|
+
##### `newInstance(opts)`
|
|
827
|
+
|
|
828
|
+
```typescript
|
|
829
|
+
static newInstance(
|
|
830
|
+
opts: Omit<INetworkTcpClientProps<TcpSocketConnectOpts, Socket>, 'createClientFn'>
|
|
831
|
+
): NetworkTcpClient
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
---
|
|
835
|
+
|
|
836
|
+
### NetworkTlsTcpClient
|
|
837
|
+
|
|
838
|
+
```typescript
|
|
839
|
+
class NetworkTlsTcpClient extends BaseNetworkTcpClient<ConnectionOptions, TLSSocket>
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
TLS-encrypted TCP client using `tls.connect`.
|
|
843
|
+
|
|
844
|
+
#### Constructor
|
|
845
|
+
|
|
846
|
+
```typescript
|
|
847
|
+
constructor(
|
|
848
|
+
opts: Omit<INetworkTcpClientProps<ConnectionOptions, TLSSocket>, 'createClientFn'>
|
|
849
|
+
)
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
The `createClientFn` is pre-set to `tls.connect`. `scope` is hardcoded to `'NetworkTlsTcpClient'`. Pass TLS certificates and keys in `options` (type `ConnectionOptions` from `node:tls`). Every method is identical to `NetworkTcpClient`.
|
|
853
|
+
|
|
854
|
+
#### Static Methods
|
|
855
|
+
|
|
856
|
+
##### `newInstance(opts)`
|
|
857
|
+
|
|
858
|
+
```typescript
|
|
859
|
+
static newInstance(
|
|
860
|
+
opts: Omit<INetworkTcpClientProps<ConnectionOptions, TLSSocket>, 'createClientFn'>
|
|
861
|
+
): NetworkTlsTcpClient
|
|
862
|
+
```
|
|
863
|
+
|
|
864
|
+
---
|
|
865
|
+
|
|
866
|
+
## UDP Socket API
|
|
867
|
+
|
|
868
|
+
### NetworkUdpClient
|
|
869
|
+
|
|
870
|
+
```typescript
|
|
871
|
+
class NetworkUdpClient extends BaseHelper
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
UDP datagram client with multicast support, using `node:dgram` internally (`type: 'udp4'`). No client/server split - one class handles both send and receive. `scope` is always hardcoded to `'NetworkUdpClient'` (no `scope` option exists on `INetworkUdpClientProps`).
|
|
875
|
+
|
|
876
|
+
#### Constructor
|
|
877
|
+
|
|
878
|
+
```typescript
|
|
879
|
+
constructor(opts: INetworkUdpClientProps)
|
|
880
|
+
```
|
|
881
|
+
|
|
882
|
+
Construction only stores options; call `connect()` explicitly to bind the socket.
|
|
883
|
+
|
|
884
|
+
#### Static Methods
|
|
885
|
+
|
|
886
|
+
##### `newInstance(opts)`
|
|
887
|
+
|
|
888
|
+
```typescript
|
|
889
|
+
static newInstance(opts: INetworkUdpClientProps): NetworkUdpClient
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
#### Methods
|
|
893
|
+
|
|
894
|
+
##### `connect()`
|
|
895
|
+
|
|
896
|
+
Creates a `dgram.Socket` and binds it, in order:
|
|
897
|
+
|
|
898
|
+
1. Creates the socket (`type: 'udp4'`, `reuseAddr` from options).
|
|
899
|
+
2. Registers `close`/`error`/`listening`/`message` listeners.
|
|
900
|
+
3. Binds to `port`/`host`.
|
|
901
|
+
|
|
902
|
+
Each listener routes through an internal `invokeHook()` wrapper - the same synchronous-throw guard as the TCP server. `onBind` fires after binding completes; it's the place to join multicast groups via `socket.addMembership(group, iface)`.
|
|
903
|
+
|
|
904
|
+
```typescript
|
|
905
|
+
connect(): void
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
No-op with a log line in two cases: `client` is already set, or `port` fails `Number.isInteger(port) && port >= 0`. Port `0` itself is valid - it means "let the OS assign a free port" - and is accepted.
|
|
909
|
+
|
|
910
|
+
##### `disconnect()`
|
|
911
|
+
|
|
912
|
+
Closes the socket and sets `client` to `null`. No-op with a log line if `client` is not set.
|
|
913
|
+
|
|
914
|
+
```typescript
|
|
915
|
+
disconnect(): void
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
##### `isConnected()`
|
|
919
|
+
|
|
920
|
+
Returns the underlying socket if bound, or `null`/`undefined` otherwise.
|
|
921
|
+
|
|
922
|
+
```typescript
|
|
923
|
+
isConnected(): dgram.Socket | null | undefined
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
##### `getClient()`
|
|
927
|
+
|
|
928
|
+
```typescript
|
|
929
|
+
getClient(): dgram.Socket | null | undefined
|
|
930
|
+
```
|
|
931
|
+
|
|
932
|
+
##### `handleConnected()` / `handleData(opts)` / `handleClosed()` / `handleError(opts)`
|
|
933
|
+
|
|
934
|
+
Default handlers used when the matching `onConnected`/`onData`/`onClosed`/`onError` option is omitted:
|
|
935
|
+
|
|
936
|
+
| Handler | Log level | Logged context |
|
|
937
|
+
|---------|-----------|-----------------|
|
|
938
|
+
| `handleConnected` | `info` | `host`, `port`, `multicastAddress` |
|
|
939
|
+
| `handleClosed` | `info` | `host`, `port`, `multicastAddress` |
|
|
940
|
+
| `handleData` | `info` | `host`, `port` only - no `multicastAddress` |
|
|
941
|
+
| `handleError` | `error` | `host`, `port` only - no `multicastAddress` |
|
|
942
|
+
|
|
943
|
+
```typescript
|
|
944
|
+
handleConnected(): void
|
|
945
|
+
handleData(opts: { identifier: string; message: string | Buffer; remoteInfo: dgram.RemoteInfo }): void
|
|
946
|
+
handleClosed(): void
|
|
947
|
+
handleError(opts: { identifier: string; error: Error }): void
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
---
|
|
951
|
+
|
|
952
|
+
## Types Reference
|
|
953
|
+
|
|
954
|
+
### TFetcherVariant / TFetcherResponse / TFetcherWorker
|
|
955
|
+
|
|
956
|
+
```typescript
|
|
957
|
+
type TFetcherVariant = 'node-fetch' | 'axios';
|
|
958
|
+
|
|
959
|
+
type TFetcherResponse<T extends TFetcherVariant> =
|
|
960
|
+
T extends 'node-fetch' ? Response : AxiosResponse;
|
|
961
|
+
|
|
962
|
+
type TFetcherWorker<T extends TFetcherVariant> =
|
|
963
|
+
T extends 'axios' ? AxiosInstance : typeof fetch;
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
### THttpMethod
|
|
967
|
+
|
|
968
|
+
```typescript
|
|
969
|
+
type THttpMethod = ValueOf<typeof HTTP.Methods> | Uppercase<ValueOf<typeof HTTP.Methods>>;
|
|
970
|
+
// 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options' | 'query'
|
|
971
|
+
// | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'QUERY'
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
### ITcpSocketServerOptions
|
|
975
|
+
|
|
976
|
+
```typescript
|
|
977
|
+
interface ITcpSocketServerOptions<
|
|
978
|
+
SocketServerOptions extends ServerOpts = ServerOpts,
|
|
979
|
+
SocketServerType extends SocketServer = SocketServer,
|
|
980
|
+
SocketClientType extends SocketClient = SocketClient,
|
|
981
|
+
> {
|
|
982
|
+
scope?: string;
|
|
983
|
+
identifier: string;
|
|
984
|
+
|
|
985
|
+
serverOptions: Partial<SocketServerOptions>;
|
|
986
|
+
listenOptions: Partial<ListenOptions>;
|
|
987
|
+
authenticateOptions: { required: boolean; duration?: number };
|
|
988
|
+
|
|
989
|
+
extraEvents?: Record<
|
|
990
|
+
string,
|
|
991
|
+
(opts: { id: string; socket: SocketClientType; args: any }) => ValueOrPromise<void>
|
|
992
|
+
>;
|
|
993
|
+
|
|
994
|
+
createServerFn: (
|
|
995
|
+
options: Partial<SocketServerOptions>,
|
|
996
|
+
connectionListener: (socket: SocketClientType) => void,
|
|
997
|
+
) => SocketServerType;
|
|
998
|
+
|
|
999
|
+
onServerReady?: (opts: { server: SocketServerType }) => void;
|
|
1000
|
+
onClientConnected?: (opts: { id: string; socket: SocketClientType }) => void;
|
|
1001
|
+
onClientData?: (opts: { id: string; socket: SocketClientType; data: Buffer | string }) => void;
|
|
1002
|
+
onClientClose?: (opts: { id: string; socket: SocketClientType }) => void;
|
|
1003
|
+
onClientError?: (opts: { id: string; socket: SocketClientType; error: Error }) => void;
|
|
1004
|
+
onServerError?: (opts: { server: SocketServerType; error: Error }) => void;
|
|
1005
|
+
}
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
`onServerError` fires when the underlying `net`/`tls` server emits `'error'` - for example `EADDRINUSE` from a port already in use. Without this listener, the event is unhandled and takes the whole process down with it.
|
|
1009
|
+
|
|
1010
|
+
### INetworkTcpClientProps
|
|
1011
|
+
|
|
1012
|
+
```typescript
|
|
1013
|
+
interface INetworkTcpClientProps<
|
|
1014
|
+
SocketClientOptions extends PlainConnectionOptions | TlsConnectionOptions,
|
|
1015
|
+
SocketClientType extends PlainSocketClient | TlsSocketClient,
|
|
1016
|
+
> {
|
|
1017
|
+
identifier: string;
|
|
1018
|
+
scope?: string;
|
|
1019
|
+
options: SocketClientOptions;
|
|
1020
|
+
reconnect?: boolean;
|
|
1021
|
+
maxRetry?: number;
|
|
1022
|
+
encoding?: BufferEncoding;
|
|
1023
|
+
createClientFn: (
|
|
1024
|
+
options: SocketClientOptions,
|
|
1025
|
+
connectionListener?: () => void,
|
|
1026
|
+
) => SocketClientType;
|
|
1027
|
+
onConnected?: (opts: { client: SocketClientType }) => ValueOrPromise<void>;
|
|
1028
|
+
onData?: (opts: { identifier: string; message: string | Buffer }) => ValueOrPromise<void>;
|
|
1029
|
+
onClosed?: (opts: { client: SocketClientType }) => void;
|
|
1030
|
+
onError?: (error: any) => void;
|
|
1031
|
+
}
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
### INetworkUdpClientProps
|
|
1035
|
+
|
|
1036
|
+
```typescript
|
|
1037
|
+
interface INetworkUdpClientProps {
|
|
1038
|
+
identifier: string;
|
|
1039
|
+
host?: string;
|
|
1040
|
+
port: number;
|
|
1041
|
+
reuseAddr?: boolean;
|
|
1042
|
+
multicastAddress?: {
|
|
1043
|
+
groups?: Array<string>;
|
|
1044
|
+
interface?: string;
|
|
1045
|
+
};
|
|
1046
|
+
onConnected?: (opts: { identifier: string; host?: string; port: number }) => void;
|
|
1047
|
+
onData?: (opts: {
|
|
1048
|
+
identifier: string;
|
|
1049
|
+
message: string | Buffer;
|
|
1050
|
+
remoteInfo: dgram.RemoteInfo;
|
|
1051
|
+
}) => void;
|
|
1052
|
+
onClosed?: (opts: { identifier: string; host?: string; port: number }) => void;
|
|
1053
|
+
onError?: (opts: { identifier: string; host?: string; port: number; error: Error }) => void;
|
|
1054
|
+
onBind?: (opts: {
|
|
1055
|
+
identifier: string;
|
|
1056
|
+
socket: dgram.Socket;
|
|
1057
|
+
host?: string;
|
|
1058
|
+
port: number;
|
|
1059
|
+
reuseAddr?: boolean;
|
|
1060
|
+
multicastAddress?: { groups?: Array<string>; interface?: string };
|
|
1061
|
+
}) => ValueOrPromise<void>;
|
|
1062
|
+
}
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
## See also
|
|
1066
|
+
|
|
1067
|
+
- [Network overview](/extensions/helpers/network/) - introduction and the most common tasks
|