@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,300 @@
|
|
|
1
|
+
# Migrating to the Scoped RBAC Authorization (ignis ≥ scoped-rbac release)
|
|
2
|
+
|
|
3
|
+
> **Audience:** the team/agent maintaining **nx-seller** (and any app that wrote a custom
|
|
4
|
+
> `DrizzleCasbinAdapter` subclass). This is a hand-off spec describing exactly what breaks when you
|
|
5
|
+
> upgrade `@venizia/ignis` to the scoped-RBAC release and the two supported migration paths.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 0. TL;DR
|
|
10
|
+
|
|
11
|
+
The ignis `authorize` module was reworked around a single **edge table** + a **scoped Casbin model**.
|
|
12
|
+
As part of that, several symbols nx-seller depends on were **removed or changed**. Upgrading ignis
|
|
13
|
+
**will not compile** until you act on the breakages in §2.
|
|
14
|
+
|
|
15
|
+
You have two paths:
|
|
16
|
+
|
|
17
|
+
| Path | Effort | When |
|
|
18
|
+
|------|--------|------|
|
|
19
|
+
| **B - Bridge** (re-base your custom adapter on `BaseFilteredAdapter`, keep your flat model) | Low - code only, **no data migration** | Do this first to unblock the upgrade |
|
|
20
|
+
| **A - Adopt scoped** (delete your custom adapter, use `ScopedCasbinAdapter` + scoped model) | High - needs a **data migration** | The intended long-term target |
|
|
21
|
+
|
|
22
|
+
Both are described below with exact before/after.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 1. What changed in ignis
|
|
27
|
+
|
|
28
|
+
| Area | Before | After |
|
|
29
|
+
|------|--------|-------|
|
|
30
|
+
| Adapter base | `DrizzleCasbinAdapter` (concrete, app subclassed it) | **removed.** New: thin `BaseFilteredAdapter<TFilter>` + a ready-made generic `ScopedCasbinAdapter` |
|
|
31
|
+
| Adapter options | `IDrizzleCasbinAdapterOptions` | **removed.** `BaseFilteredAdapter` takes `{ scope, dataSource }`; `ScopedCasbinAdapter` takes `{ dataSource, entities }` |
|
|
32
|
+
| Filter shape | `{ principalType, principalValue }` (flat) | `{ principal: { type, id } }` (`ICasbinPolicyFilter`) |
|
|
33
|
+
| `CasbinRuleVariants` | `P, G, GROUP('group'), POLICY('policy')` + `SCHEME_SET`/`isValid` | trimmed to **casbin prefixes only**: `P, G, G2, G3, G4, G5`. `GROUP`/`POLICY` **removed** |
|
|
34
|
+
| DB `variant` discriminator | lived on `CasbinRuleVariants.GROUP/.POLICY` | now `AuthorizationPolicyVariants.*.action` (`grant`, `assign_role`, `join_domain`, `role_inherits`, `resource_inherits`, `action_inherits`, `domain_inherits`) |
|
|
35
|
+
| Cache drivers | `redis` **and** `in-memory` | **redis only.** `CasbinEnforcerCachedDrivers.IN_MEMORY` removed; `cached` is now `{ use: false } \| (ICasbinEnforcerCachedRedis & { use: true })` |
|
|
36
|
+
| Cache invalidation interface | `IAuthorizationCacheInvalidator` / `TAuthorizationCacheInvalidator` | **removed.** `invalidateUserCache?`/`rebuildUserCache?` are now **optional** members of `IAuthorizationEnforcer` (feature-detected by the registry) |
|
|
37
|
+
| Enforcer model | shared single enforcer | **pool** of per-request enforcers (`BasePoolHelper`); policy loaded per request, fail-closed |
|
|
38
|
+
| Scoped option | n/a | new `isScoped?: boolean` on `ICasbinEnforcerOptions` |
|
|
39
|
+
|
|
40
|
+
> **Note:** the old `CasbinRuleVariants.GROUP = 'group'` and `.POLICY = 'policy'`. Your
|
|
41
|
+
> `PolicyDefinition.variant` column currently stores the strings **`'group'`** and **`'policy'`**.
|
|
42
|
+
> Confirm with: `SELECT DISTINCT variant FROM identity."PolicyDefinition";`
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 2. What breaks in nx-seller (exact references)
|
|
47
|
+
|
|
48
|
+
When you bump ignis, these stop compiling/working:
|
|
49
|
+
|
|
50
|
+
1. **nx-seller's `security/application-casbin-adapter.ts`**
|
|
51
|
+
- `extends DrizzleCasbinAdapter` → class removed.
|
|
52
|
+
- `import { DrizzleCasbinAdapter, IDrizzleCasbinAdapterOptions, ICasbinPolicyFilter } from '@venizia/ignis'` → first two removed; `ICasbinPolicyFilter` still exists but its **shape changed**.
|
|
53
|
+
- `filter.principalValue` / `filter.principalType` → now `filter.principal.id` / `filter.principal.type`.
|
|
54
|
+
- `CasbinRuleVariants.GROUP` / `CasbinRuleVariants.POLICY` → removed.
|
|
55
|
+
- `this.entities.role.principalType` / `this.entities.permission.principalType` → `entities` no longer provided by the base.
|
|
56
|
+
|
|
57
|
+
2. **nx-seller's `repositories/policy-definition.repository.ts`**
|
|
58
|
+
- Many `eq(pd.variant, CasbinRuleVariants.GROUP)` / `.POLICY` → constant removed. This file is the
|
|
59
|
+
biggest single breakage surface outside the adapter.
|
|
60
|
+
|
|
61
|
+
3. **nx-seller's `application/verifier.ts`** (enforcer registration)
|
|
62
|
+
- The Redis-absent fallback uses `CasbinEnforcerCachedDrivers.IN_MEMORY` → removed. You must pick
|
|
63
|
+
Redis or `{ use: false }`.
|
|
64
|
+
|
|
65
|
+
4. Any seed/migration writing `variant = 'group' | 'policy'` keeps working at the DB level (those are
|
|
66
|
+
plain strings), but the **constants** that produced them are gone.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 3. Path B - Bridge (recommended first step, no data migration)
|
|
71
|
+
|
|
72
|
+
Goal: compile against new ignis with **identical runtime behavior** - keep your flat `CASBIN_RBAC_MODEL`,
|
|
73
|
+
your `group`/`policy` variant values, and all bespoke logic (global roles, HQ-owner expansion).
|
|
74
|
+
|
|
75
|
+
### 3.1 Define your own variant constants
|
|
76
|
+
|
|
77
|
+
`CasbinRuleVariants.GROUP/.POLICY` are gone from ignis, but your DB still stores `'group'`/`'policy'`.
|
|
78
|
+
Own these strings locally so you are decoupled from ignis's casbin-prefix enum:
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
// packages/core-server/src/security/policy-variant.ts
|
|
82
|
+
export class PolicyDefinitionVariant {
|
|
83
|
+
/** user→role assignment + user→merchant membership rows. */
|
|
84
|
+
static readonly GROUP = 'group';
|
|
85
|
+
/** permission grant rows (role→perm, user→perm). */
|
|
86
|
+
static readonly POLICY = 'policy';
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Then replace every `CasbinRuleVariants.GROUP` → `PolicyDefinitionVariant.GROUP` and
|
|
91
|
+
`CasbinRuleVariants.POLICY` → `PolicyDefinitionVariant.POLICY` in
|
|
92
|
+
`application-casbin-adapter.ts` **and** `policy-definition.repository.ts`.
|
|
93
|
+
Keep using `CasbinRuleVariants.G` / `.P` for the **emitted casbin lines** (those still exist).
|
|
94
|
+
|
|
95
|
+
### 3.2 Re-base `ApplicationCasbinAdapter` on `BaseFilteredAdapter`
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// BEFORE
|
|
99
|
+
import {
|
|
100
|
+
DrizzleCasbinAdapter,
|
|
101
|
+
type IDrizzleCasbinAdapterOptions,
|
|
102
|
+
type ICasbinPolicyFilter,
|
|
103
|
+
} from '@venizia/ignis';
|
|
104
|
+
|
|
105
|
+
export class ApplicationCasbinAdapter extends DrizzleCasbinAdapter {
|
|
106
|
+
private readonly appDataSource: IDrizzleCasbinAdapterOptions['dataSource'];
|
|
107
|
+
constructor(opts: IDrizzleCasbinAdapterOptions) {
|
|
108
|
+
super(opts);
|
|
109
|
+
this.appDataSource = opts.dataSource;
|
|
110
|
+
}
|
|
111
|
+
// ... used this.entities.role.principalType, filter.principalValue, etc.
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
// AFTER
|
|
117
|
+
import { BaseFilteredAdapter, type ICasbinPolicyFilter } from '@venizia/ignis';
|
|
118
|
+
import type { IDataSource } from '@venizia/ignis';
|
|
119
|
+
|
|
120
|
+
interface IAppCasbinEntities {
|
|
121
|
+
role: { principalType: string };
|
|
122
|
+
permission: { principalType: string };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export class ApplicationCasbinAdapter extends BaseFilteredAdapter {
|
|
126
|
+
private readonly entities: IAppCasbinEntities;
|
|
127
|
+
|
|
128
|
+
constructor(opts: { dataSource: IDataSource; entities: IAppCasbinEntities }) {
|
|
129
|
+
super({ scope: ApplicationCasbinAdapter.name, dataSource: opts.dataSource });
|
|
130
|
+
this.entities = opts.entities;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// `this.connector` is provided by BaseFilteredAdapter (replaces this.appConnector).
|
|
134
|
+
|
|
135
|
+
override async loadFilteredPolicy(model: Model, filter: ICasbinPolicyFilter): Promise<void> {
|
|
136
|
+
const userId = filter.principal.id; // was filter.principalValue
|
|
137
|
+
const principalType = filter.principal.type; // was filter.principalType
|
|
138
|
+
// ... unchanged bespoke logic ...
|
|
139
|
+
// Instead of `Helper.loadPolicyLine(line, model)` per line you may use:
|
|
140
|
+
// await this.loadLines({ model, lines });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Key swaps inside the class:
|
|
146
|
+
- `this.appConnector` → `this.connector` (from `BaseFilteredAdapter`).
|
|
147
|
+
- `filter.principalValue` → `filter.principal.id`; `filter.principalType` → `filter.principal.type`.
|
|
148
|
+
- `this.entities.role.principalType` / `this.entities.permission.principalType` → from your own
|
|
149
|
+
`entities` (pass the same values you pass today; drop the `tableName`/`policyDefinition` parts the
|
|
150
|
+
base used to require - you import the Drizzle tables directly already).
|
|
151
|
+
- `CasbinRuleVariants.GROUP/.POLICY` → `PolicyDefinitionVariant.GROUP/.POLICY` (§3.1).
|
|
152
|
+
|
|
153
|
+
### 3.3 Fix the cache fallback in `verifier.ts`
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
// BEFORE - in-memory fallback (driver removed)
|
|
157
|
+
const cached: ICasbinEnforcerOptions['cached'] = redis
|
|
158
|
+
? { use: true, driver: CasbinEnforcerCachedDrivers.REDIS, options: { ... } }
|
|
159
|
+
: { use: true, driver: CasbinEnforcerCachedDrivers.IN_MEMORY, options: { expiresIn: 5*60*1000 } };
|
|
160
|
+
|
|
161
|
+
// AFTER - Redis or no cache
|
|
162
|
+
const cached: ICasbinEnforcerOptions['cached'] = redis
|
|
163
|
+
? { use: true, driver: CasbinEnforcerCachedDrivers.REDIS, options: { connection: redis, expiresIn: 5*60*1000, keyFn: ({ user }) => `casbin:${user.principalType}:${user.userId}` } }
|
|
164
|
+
: { use: false };
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
> **Decide:** in prod, **always provide Redis** - without it every request rebuilds the policy from the
|
|
168
|
+
> DB (no per-user cache). The pool still protects you from the concurrency race, but you lose the line cache.
|
|
169
|
+
|
|
170
|
+
### 3.4 Adapter construction (`verifier.ts`)
|
|
171
|
+
|
|
172
|
+
Drop the `policyDefinition`/`tableName` entries the old base required; pass only what your re-based
|
|
173
|
+
class declares:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
const adapter = new ApplicationCasbinAdapter({
|
|
177
|
+
dataSource: this.get<PostgresCoreDataSource>({ /* unchanged */ }),
|
|
178
|
+
entities: {
|
|
179
|
+
role: { principalType: Role.AUTHORIZATION_SUBJECT! },
|
|
180
|
+
permission: { principalType: Permission.AUTHORIZATION_SUBJECT! },
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Everything else in the registration (`CASBIN_RBAC_MODEL`, `domainMatching`, `normalizePayloadFn`)
|
|
186
|
+
stays. **Result: behavior identical, compiles on new ignis, zero data migration.**
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 4. Path A - Adopt the scoped model (target state)
|
|
191
|
+
|
|
192
|
+
This deletes `ApplicationCasbinAdapter` entirely and uses the generic `ScopedCasbinAdapter`. The
|
|
193
|
+
bespoke logic moves from **code** into **data (edges)**. Do this once Path B has unblocked you.
|
|
194
|
+
|
|
195
|
+
### 4.1 Register the generic adapter + scoped model
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import {
|
|
199
|
+
ScopedCasbinAdapter,
|
|
200
|
+
CASBIN_RBAC_DOMAIN_SCOPED_MODEL,
|
|
201
|
+
CasbinEnforcerModelDrivers,
|
|
202
|
+
} from '@venizia/ignis';
|
|
203
|
+
|
|
204
|
+
const adapter = new ScopedCasbinAdapter({
|
|
205
|
+
dataSource: this.get<PostgresCoreDataSource>({ /* ... */ }),
|
|
206
|
+
entities: {
|
|
207
|
+
policyDefinition: { tableName: PolicyDefinition.TABLE_NAME, schemaName: 'identity' },
|
|
208
|
+
permission: { tableName: Permission.TABLE_NAME, schemaName: 'identity' },
|
|
209
|
+
principals: { user: 'User', role: 'Role' }, // casbin name prefixes
|
|
210
|
+
domainTypes: ['Merchant', 'Organizer'], // domain types you scope on
|
|
211
|
+
softDelete: { use: true, columnName: 'deleted_at' },
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// In the enforcer options:
|
|
216
|
+
// model: { driver: CasbinEnforcerModelDrivers.TEXT, definition: CASBIN_RBAC_DOMAIN_SCOPED_MODEL }
|
|
217
|
+
// isScoped: true
|
|
218
|
+
// adapter, cached
|
|
219
|
+
// ❌ remove domainMatching (isScoped auto-registers keyMatch on g + objectMatch on g4)
|
|
220
|
+
// ❌ remove normalizePayloadFn (scoped mode uses the default (sub,dom,obj,act) payload;
|
|
221
|
+
// pass the request domain via the provider's domain resolver instead)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 4.2 Data migration - the `variant` column
|
|
225
|
+
|
|
226
|
+
The scoped adapter filters on `AuthorizationPolicyVariants.*.action`, not `group`/`policy`. You must
|
|
227
|
+
re-classify rows:
|
|
228
|
+
|
|
229
|
+
| Current row (`variant`) | Becomes | Rule |
|
|
230
|
+
|-------------------------|---------|------|
|
|
231
|
+
| `group`, subject=User, target=Role | `assign_role` | user→role |
|
|
232
|
+
| `group`, subject=Role, target=Role | `role_inherits` | role→role (if you have role hierarchy) |
|
|
233
|
+
| `group`, subject=User, target=Merchant | `join_domain` | user→domain membership |
|
|
234
|
+
| `policy` (role→perm or user→perm) | `grant` | permission grant |
|
|
235
|
+
|
|
236
|
+
New edge types you may need to **add** (no equivalent today):
|
|
237
|
+
- `domain_inherits` (Merchant ⊂ Organizer / HQ) - **this replaces the bespoke `queryHqOwnerOrgMerchants`
|
|
238
|
+
JOIN**. Materialize one row per Merchant→Organizer (or →HQ-merchant) relationship; the scoped model's
|
|
239
|
+
`g3` then cascades a grant on the parent domain to all child merchants automatically. Maintain these
|
|
240
|
+
rows when merchants/organizers are created or moved.
|
|
241
|
+
- `resource_inherits` (`g4`) / `action_inherits` (`g5`) - only if you want resource/action hierarchies.
|
|
242
|
+
|
|
243
|
+
### 4.3 Re-express bespoke behavior as data
|
|
244
|
+
|
|
245
|
+
| Today (code in `ApplicationCasbinAdapter`) | Scoped equivalent (data) |
|
|
246
|
+
|--------------------------------------------|--------------------------|
|
|
247
|
+
| Global role → wildcard `*` domain (`AppFixedRoles.isGlobalRole`) | Store the `assign_role` row with **NULL domain** → adapter emits `g, User_x, Role_y, *` |
|
|
248
|
+
| NULL-domain role → expand to every member merchant | Grant rows with domain **`ANY_MEMBER`** + `join_domain` (`g2`) membership rows; the matcher resolves "any domain I'm a member of" |
|
|
249
|
+
| HQ-owner expansion (live JOIN) | `domain_inherits` (`g3`) edges (see §4.2) |
|
|
250
|
+
| Domain-agnostic role permissions (`p, Role, *, ...`) | Grant rows with domain `ANY_MEMBER` (default when `domain` is NULL) |
|
|
251
|
+
|
|
252
|
+
### 4.4 Behavioral caveat - resource matching changes
|
|
253
|
+
|
|
254
|
+
Your flat model uses exact `r.obj == p.obj`. The scoped model uses **`objectMatch`** (dotted-prefix +
|
|
255
|
+
wildcard): a grant on `Order` will now **also** match `Order.findById`, and `p.obj = '*'` matches any
|
|
256
|
+
resource. Audit your permission `code`s before switching, or you may unintentionally widen access.
|
|
257
|
+
|
|
258
|
+
### 4.5 Update `policy-definition.repository.ts`
|
|
259
|
+
|
|
260
|
+
This file queries by `variant`. After the data migration, replace `CasbinRuleVariants.GROUP/.POLICY`
|
|
261
|
+
with the relevant `AuthorizationPolicyVariants.*.action` values (e.g. `ASSIGN_ROLE.action`,
|
|
262
|
+
`JOIN_DOMAIN.action`, `GRANT.action`) matching the row kind each query targets.
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 5. Decision guide
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
Need to ship the ignis bump now, behavior unchanged? → Path B (bridge).
|
|
270
|
+
Ready to model org hierarchy as data + run a migration? → Path A (scoped).
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Path B and Path A are not mutually exclusive: do **B** to upgrade safely, then schedule **A** to delete
|
|
274
|
+
the bespoke adapter and gain resource/action/domain hierarchies for free.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 6. Verification checklist (either path)
|
|
279
|
+
|
|
280
|
+
- [ ] `bun run build` (or `tsc -p .`) is clean - no references to `DrizzleCasbinAdapter`,
|
|
281
|
+
`IDrizzleCasbinAdapterOptions`, `CasbinRuleVariants.GROUP/.POLICY`, `CasbinEnforcerCachedDrivers.IN_MEMORY`,
|
|
282
|
+
`IAuthorizationCacheInvalidator`.
|
|
283
|
+
- [ ] `SELECT DISTINCT variant FROM identity."PolicyDefinition"` matches what your adapter filters on
|
|
284
|
+
(`group`/`policy` for Path B; the new `*.action` set for Path A).
|
|
285
|
+
- [ ] A request for a user with a role-inherited / per-merchant / global permission resolves the same
|
|
286
|
+
ALLOW/DENY as before the upgrade (pick 3-4 representative users and diff).
|
|
287
|
+
- [ ] If `cached.use: true`, Redis is reachable; if a permission changes, call
|
|
288
|
+
`enforcer.invalidateUserCache({ user })` (or rely on TTL) - see the ignis authorization docs.
|
|
289
|
+
- [ ] Super-admin / always-allow-roles still short-circuit (these run in the provider before the enforcer).
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## 7. Reference - current nx-seller wiring (before)
|
|
294
|
+
|
|
295
|
+
For context, the current registration (nx-seller's `application/verifier.ts`) uses:
|
|
296
|
+
`ApplicationCasbinAdapter` (subclass of removed `DrizzleCasbinAdapter`), `CASBIN_RBAC_MODEL` (flat
|
|
297
|
+
`g + p`, exact `r.obj == p.obj`), a Redis-or-in-memory `cached`, `domainMatching { roleDefinition: 'g',
|
|
298
|
+
fn: keyMatch }`, and a `normalizePayloadFn` mapping subject/domain via
|
|
299
|
+
`ApplicationCasbinAdapter.toUserVerb/toMerchantVerb`. Path B keeps all of this except the adapter base
|
|
300
|
+
and the in-memory cache; Path A replaces the adapter, model, `domainMatching`, and `normalizePayloadFn`.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Upgrading to Unified Connectors (BANA Guide)
|
|
3
|
+
description: What changed in @venizia/ignis 0.0.11-0 / @venizia/ignis-helpers 0.0.10-0 and the exact steps a consumer application must take
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Upgrading to Unified Connectors
|
|
7
|
+
|
|
8
|
+
**Target audience:** the BANA (nx-seller) team, and any application upgrading from `@venizia/ignis@0.0.10-x` / `@venizia/ignis-helpers@0.0.9-x`.
|
|
9
|
+
|
|
10
|
+
**Verification status:** every step below was validated against a full copy of BANA's `packages/core-server` source compiled against the release tarballs. The migration ends at **zero compile errors**. The search branch was additionally validated end to end against a live 3-node Typesense cluster.
|
|
11
|
+
|
|
12
|
+
## What changed (summary)
|
|
13
|
+
|
|
14
|
+
IGNIS core was restructured around ONE engine-neutral repository family:
|
|
15
|
+
|
|
16
|
+
- `src/base` now holds a single `AbstractRepository` / `AbstractDataSource` / `AbstractEntity` family. Every engine implements it under `src/connectors/{postgres,typesense}`.
|
|
17
|
+
- Postgres remains re-exported from the root barrel - **your imports keep working unchanged**. Every connector is also addressable explicitly: `@venizia/ignis/postgres`, `@venizia/ignis/typesense` (typesense is subpath-only; its client is an optional peer).
|
|
18
|
+
- Canonical class names are the paradigm-family names (`BaseRelationalDataSource`, `BaseRelationalEntity`, `DefaultRelationalRepository`, ...). The engine name appears only at the concrete datasource (`TypesenseDataSource`) and the query dialect (`PostgresQueryOperators`).
|
|
19
|
+
- The historical names (`BaseDataSource`, `BaseEntity`, `BasePostgresDataSource`, `BasePostgresEntity`, `RDBQueryOperators`, `DefaultCRUDRepository`, ...) all keep resolving from the same import paths. Most are alias re-exports of the SAME classes; the five repository names (`PostgresBaseRepository`, `ReadableRepository`, `PersistableRepository`, `DefaultCRUDRepository`, `SoftDeletableRepository`) are Postgres subclasses of the neutral chain, so they are distinct class objects from their neutral parents. `instanceof`, metadata, and bindings are unaffected. No action required.
|
|
20
|
+
- New capabilities model: `dataSource.getCapabilities()` and a standardized NotSupported error (HTTP 501, `normalized.code` `core.not_supported`) for engine gaps (e.g. transactions on search engines).
|
|
21
|
+
- New engine: the **Typesense search branch** (`BaseSearchEntity`, `defineSearchCollection`, typed `TSearchDocument`, `DefaultSearchRepository`). It does not affect existing postgres code.
|
|
22
|
+
|
|
23
|
+
## Required migrations (in order)
|
|
24
|
+
|
|
25
|
+
### 1. Transaction type rename - the only sweeping change
|
|
26
|
+
|
|
27
|
+
`ITransaction` is now the neutral base contract (no `connector` field). The postgres-rich types were renamed:
|
|
28
|
+
|
|
29
|
+
| Old | New |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `ITransaction<Schema>` (with `.connector`) | `IDatabaseTransaction<Schema>` |
|
|
32
|
+
| `ITransactionOptions` (postgres isolation levels) | `IDatabaseTransactionOptions` |
|
|
33
|
+
| `IExtraOptions` used as the repository 4th generic | `IDatabaseExtraOptions` |
|
|
34
|
+
|
|
35
|
+
Measured impact on BANA: 398 files, one mechanical rewrite, proven zero-error:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
grep -rl 'ITransaction\|IExtraOptions' packages/*/src --include='*.ts' \
|
|
39
|
+
| xargs sed -i 's/\bITransaction\b/IDatabaseTransaction/g; s/\bIExtraOptions\b/IDatabaseExtraOptions/g'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Note: `options?.transaction?.connector` inside `DefaultCRUDRepository` (alias of `DefaultRelationalRepository`) subclasses needs NO change. The postgres tiers now default their options generic to `IDatabaseExtraOptions`, so that path stays typed automatically.
|
|
43
|
+
|
|
44
|
+
### 2. `applicationEnvironment.get` - options object
|
|
45
|
+
|
|
46
|
+
The second positional argument became an options object (and gained `transform`):
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
// Before
|
|
50
|
+
const port = applicationEnvironment.get<string>(Keys.PORT, '3000');
|
|
51
|
+
|
|
52
|
+
// After
|
|
53
|
+
const port = applicationEnvironment.get<string>(Keys.PORT, { defaultValue: '3000' });
|
|
54
|
+
|
|
55
|
+
// New capability - transform raw env values in one read:
|
|
56
|
+
const nodes = applicationEnvironment.get<string[], string>(Keys.NODES, {
|
|
57
|
+
defaultValue: [],
|
|
58
|
+
transform: value => toDelimitedArray(value),
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Measured impact on BANA: **5 call sites** use the positional form. They fail at compile time (not silently), so `tsc` will point at each one:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
grep -rnE "applicationEnvironment.get(<[^>]*>)?\([^,)]+, [^{]" packages/*/src --include='*.ts'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
New helpers: `toDelimitedArray(input, separator?)` (split + trim + drop empties) and `toTrimmed(input)` from `@venizia/ignis-helpers`.
|
|
69
|
+
|
|
70
|
+
### 3. Purge stale TypeScript build info
|
|
71
|
+
|
|
72
|
+
The package's `exports` map changed. Stale incremental caches replay phantom diagnostics for unchanged files - a page of bogus "missing property" errors while new files compile clean:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
find . -name '*.tsbuildinfo' -not -path '*/node_modules/*' -delete
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Run this once after the version bump, before trusting the first `tsc` run.
|
|
79
|
+
|
|
80
|
+
### 4. Auth endpoint error contract (only if you assert on it)
|
|
81
|
+
|
|
82
|
+
The three auth endpoints backed by unimplemented service methods (`refreshToken`, `getUserInformation`) now return the standardized NotSupported error: HTTP 501 with `normalized.code` `core.not_supported` and message `[AuthController] <feature> is not supported.`. Previously this was a plain `Method not implemented`. BANA was scanned: no code asserts on the old string - listed for completeness.
|
|
83
|
+
|
|
84
|
+
## Strongly recommended (not compile-blocking)
|
|
85
|
+
|
|
86
|
+
### Declare decorator flags directly in every bun-run app
|
|
87
|
+
|
|
88
|
+
bun 1.3.14 silently DROPS `@inject` constructor-parameter decorators when the app's `tsconfig.json` only inherits `experimentalDecorators` through a package-style `extends` it fails to resolve. Symptom: the app boots normally, every route mounts, and then `this.repository` / injected services are `undefined` at request time. Protect every app that runs via `bun src/...`:
|
|
89
|
+
|
|
90
|
+
```jsonc
|
|
91
|
+
// tsconfig.json - alongside your extends, not instead of it
|
|
92
|
+
{
|
|
93
|
+
"compilerOptions": {
|
|
94
|
+
"experimentalDecorators": true,
|
|
95
|
+
"emitDecoratorMetadata": true
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
All IGNIS examples now declare these explicitly.
|
|
101
|
+
|
|
102
|
+
## Rollout procedure (proven order)
|
|
103
|
+
|
|
104
|
+
1. Bump `@venizia/ignis` -> `0.0.11-0` and `@venizia/ignis-helpers` -> `0.0.10-0` in ONE canary package first - `packages/commerce` is the recommended canary (heaviest transaction + ControllerFactory usage).
|
|
105
|
+
2. Run migrations 1-3 on the canary; `tsc --noEmit` must be clean.
|
|
106
|
+
3. Run the canary's test suite.
|
|
107
|
+
4. Green -> apply migrations repo-wide, bump the remaining packages, full suite.
|
|
108
|
+
|
|
109
|
+
## What you explicitly do NOT need to do
|
|
110
|
+
|
|
111
|
+
- No import-path changes: root-barrel imports of `BaseDataSource`, `BaseEntity`, `DefaultCRUDRepository`, decorators, etc. all keep working (dual-door export model + compatibility aliases).
|
|
112
|
+
- No repository/generic signature changes: `DefaultCRUDRepository<Schema, DataObject, PersistObject, ...>` call sites are unchanged (a 4th options generic was APPENDED with a default).
|
|
113
|
+
- No runtime behavior changes on the postgres path: the whole pre-existing RDB behavior suite runs unchanged inside the release gates. Every behavior delta was verified to have no trigger inside BANA (`@model` tableName divergence: 0 occurrences; message-string assertions: 0).
|
|
114
|
+
- Nothing search-related: BANA imports zero search symbols today.
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# Glossary for Beginners
|
|
2
|
+
|
|
3
|
+
Quick reference for key terms in IGNIS documentation.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Core Framework Terms
|
|
7
|
+
|
|
8
|
+
| Term | Description |
|
|
9
|
+
|------|-------------|
|
|
10
|
+
| **Application** | Main entry point extending `BaseApplication`. Registers all components. |
|
|
11
|
+
| **Controller** | Handles HTTP/gRPC requests, defines API endpoints. REST controllers extend `BaseRestController`, gRPC controllers extend `BaseGrpcController`. Uses `@controller`, `@get`, `@post` decorators |
|
|
12
|
+
| **Service** | Contains business logic between controllers and repositories |
|
|
13
|
+
| **Repository** | Database operations for one entity (`find`, `create`, `updateById`, etc.) |
|
|
14
|
+
| **DataSource** | Database connection configuration (host, port, credentials) |
|
|
15
|
+
| **Model/Entity** | Defines data structure and relationships using Drizzle schema |
|
|
16
|
+
| **Component** | Reusable plugin that bundles related functionality |
|
|
17
|
+
| **DI Container** | Central registry that stores and resolves dependencies. The `Application` class acts as the container. |
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// Application registers everything
|
|
21
|
+
export class Application extends BaseApplication {
|
|
22
|
+
preConfigure() {
|
|
23
|
+
this.dataSource(PostgresDataSource);
|
|
24
|
+
this.repository(TodoRepository);
|
|
25
|
+
this.controller(TodoController);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Controller handles HTTP
|
|
30
|
+
const TodoRoutes = {
|
|
31
|
+
GET_ALL: {
|
|
32
|
+
method: HTTP.Methods.GET,
|
|
33
|
+
path: '/',
|
|
34
|
+
responses: jsonResponse({ schema: z.array(z.object({ id: z.string() })) }),
|
|
35
|
+
},
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
@controller({ path: '/todos' })
|
|
39
|
+
export class TodoController extends BaseRestController {
|
|
40
|
+
constructor(
|
|
41
|
+
@inject({ key: 'repositories.TodoRepository' })
|
|
42
|
+
private repository: TodoRepository,
|
|
43
|
+
) {
|
|
44
|
+
super({ scope: TodoController.name });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@get({ configs: TodoRoutes.GET_ALL })
|
|
48
|
+
async getAll(c: TRouteContext) {
|
|
49
|
+
const todos = await this.repository.find({ filter: {} });
|
|
50
|
+
return c.json(todos, HTTP.ResultCodes.RS_2.Ok);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Repository handles database
|
|
55
|
+
@repository({ model: Todo, dataSource: PostgresDataSource })
|
|
56
|
+
export class TodoRepository extends DefaultCRUDRepository<typeof Todo.schema> {}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Related:** [Application](../core-concepts/application/) | [Controllers](../core-concepts/rest-controllers) | [Services](../core-concepts/services) | [Repositories](../../references/base/repositories/)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## TypeScript & Pattern Terms
|
|
63
|
+
|
|
64
|
+
### Decorators
|
|
65
|
+
Annotations starting with `@` that add behavior to classes/methods.
|
|
66
|
+
|
|
67
|
+
| Decorator | Purpose |
|
|
68
|
+
|-----------|---------|
|
|
69
|
+
| `@controller` | Marks class as controller. Supports `transport` field (`'rest'` default, `'grpc'`) |
|
|
70
|
+
| `@model` | Marks class as model/entity |
|
|
71
|
+
| `@repository` | Marks class as repository |
|
|
72
|
+
| `@datasource` | Marks class as datasource |
|
|
73
|
+
| `@inject` | Requests dependency from container |
|
|
74
|
+
| `@get`, `@post`, `@put`, `@patch`, `@del` | HTTP route handlers |
|
|
75
|
+
|
|
76
|
+
### Dependency Injection (DI)
|
|
77
|
+
Classes receive dependencies from an external container instead of creating them internally. Benefits: testable, flexible, maintainable.
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// ❌ Without DI - creates own dependencies
|
|
81
|
+
class TodoController {
|
|
82
|
+
private repository = new TodoRepository(new PostgresDataSource());
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ✅ With DI - receives from container
|
|
86
|
+
class TodoController {
|
|
87
|
+
constructor(
|
|
88
|
+
@inject({ key: 'repositories.TodoRepository' })
|
|
89
|
+
private repository: TodoRepository
|
|
90
|
+
) {}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Container & Binding
|
|
95
|
+
Container stores all dependencies. Binding registers classes/values under keys.
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// Register in Application
|
|
99
|
+
this.repository(TodoRepository); // Key: 'repositories.TodoRepository'
|
|
100
|
+
this.bind({ key: 'config.apiKey' }).toValue('sk_live_xxx');
|
|
101
|
+
|
|
102
|
+
// Resolve via @inject
|
|
103
|
+
@inject({ key: 'repositories.TodoRepository' }) private repository: TodoRepository;
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Generic Types
|
|
107
|
+
TypeScript feature for reusable components: `<T>` or `<SomeType>`.
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
class DefaultCRUDRepository<TSchema> { find(): TSchema[] { ... } }
|
|
111
|
+
class TodoRepository extends DefaultCRUDRepository<typeof Todo.schema> {}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Related:** [Dependency Injection Guide](../core-concepts/dependency-injection)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
## Database Terms
|
|
118
|
+
|
|
119
|
+
| Term | Description |
|
|
120
|
+
|------|-------------|
|
|
121
|
+
| **ORM** | Tool to work with databases using code instead of raw SQL. IGNIS uses Drizzle ORM. |
|
|
122
|
+
| **Drizzle ORM** | Type-safe ORM library. [Docs](https://orm.drizzle.team/) |
|
|
123
|
+
| **Schema** | Table structure definition using Drizzle syntax |
|
|
124
|
+
| **Migration** | Script that creates/modifies tables. Version control for database structure. |
|
|
125
|
+
| **Connector** | Database driver that executes queries (via `dataSource.connector`) |
|
|
126
|
+
| **Relations** | Connections between tables (hasMany, belongsTo, hasOne) |
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// Schema definition
|
|
130
|
+
export const todoTable = pgTable('Todo', {
|
|
131
|
+
id: text('id').primaryKey(),
|
|
132
|
+
title: text('title').notNull(),
|
|
133
|
+
completed: boolean('completed').default(false),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Relations
|
|
137
|
+
export const userRelations = createRelations({
|
|
138
|
+
source: userTable,
|
|
139
|
+
relations: [{ name: 'posts', type: 'many', schema: postTable, metadata: {} }],
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Query with relations
|
|
143
|
+
await userRepo.find({ filter: { include: [{ relation: 'posts' }] } });
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Migrations
|
|
148
|
+
bun run drizzle-kit generate # Generate from schema changes
|
|
149
|
+
bun run migrate:dev # Apply to database
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
## Query & Filter Terms
|
|
154
|
+
|
|
155
|
+
### Filter Object
|
|
156
|
+
Specifies what data to retrieve: `where`, `limit`, `order`, `include`.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
await repository.find({
|
|
160
|
+
filter: {
|
|
161
|
+
where: { status: 'active', age: { gte: 18 } },
|
|
162
|
+
order: ['createdAt DESC'],
|
|
163
|
+
limit: 10,
|
|
164
|
+
include: [{ relation: 'author' }],
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Operators
|
|
170
|
+
|
|
171
|
+
| Operator | Meaning | Example |
|
|
172
|
+
|----------|---------|---------|
|
|
173
|
+
| `eq` | Equal | `{ status: { eq: 'active' } }` |
|
|
174
|
+
| `neq` | Not equal | `{ status: { neq: 'deleted' } }` |
|
|
175
|
+
| `gt`, `gte` | Greater than (or equal) | `{ age: { gte: 18 } }` |
|
|
176
|
+
| `lt`, `lte` | Less than (or equal) | `{ price: { lt: 100 } }` |
|
|
177
|
+
| `like`, `ilike` | Pattern match | `{ name: { like: '%john%' } }` |
|
|
178
|
+
| `in`, `nin` | In list / not in list | `{ id: { in: [1, 2, 3] } }` |
|
|
179
|
+
| `between` | Range | `{ age: { between: [18, 65] } }` |
|
|
180
|
+
|
|
181
|
+
**Related:** [Filter System](../../references/base/filter-system/) | [Repositories](../../references/base/repositories/)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
## HTTP & API Terms
|
|
185
|
+
|
|
186
|
+
### REST API Methods
|
|
187
|
+
|
|
188
|
+
| Method | URL | Action |
|
|
189
|
+
|--------|-----|--------|
|
|
190
|
+
| GET | `/todos` | List all |
|
|
191
|
+
| GET | `/todos/{id}` | Get one |
|
|
192
|
+
| POST | `/todos` | Create |
|
|
193
|
+
| PATCH | `/todos/{id}` | Update |
|
|
194
|
+
| DELETE | `/todos/{id}` | Delete |
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
const TodoRoutes = {
|
|
198
|
+
GET_ALL: { method: HTTP.Methods.GET, path: '/', responses: jsonResponse({ schema: z.array(z.any()) }) },
|
|
199
|
+
GET_BY_ID: { method: HTTP.Methods.GET, path: '/{id}', request: { params: z.object({ id: z.string() }) }, responses: jsonResponse({ schema: z.any() }) },
|
|
200
|
+
CREATE: { method: HTTP.Methods.POST, path: '/', request: { body: jsonContent({ schema: z.any() }) }, responses: jsonResponse({ schema: z.any() }) },
|
|
201
|
+
} as const;
|
|
202
|
+
|
|
203
|
+
@controller({ path: '/todos' })
|
|
204
|
+
class TodoController extends BaseRestController {
|
|
205
|
+
@get({ configs: TodoRoutes.GET_ALL })
|
|
206
|
+
async getAll(c: TRouteContext) { ... }
|
|
207
|
+
|
|
208
|
+
@get({ configs: TodoRoutes.GET_BY_ID })
|
|
209
|
+
async getById(c: TRouteContext) {
|
|
210
|
+
const { id } = c.req.valid<{ id: string }>('param');
|
|
211
|
+
...
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
@post({ configs: TodoRoutes.CREATE })
|
|
215
|
+
async create(c: TRouteContext) {
|
|
216
|
+
const data = c.req.valid('json');
|
|
217
|
+
...
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
| Term | Description |
|
|
223
|
+
|------|-------------|
|
|
224
|
+
| **Endpoint** | URL path that API responds to (e.g., `GET /todos`) |
|
|
225
|
+
| **Route Parameter** | Variable in URL wrapped in braces (e.g., `{id}` in OpenAPI route configs) |
|
|
226
|
+
| **Request Body** | JSON data sent with POST/PATCH requests |
|
|
227
|
+
| **OpenAPI/Swagger** | Auto-generated API docs at `/doc/explorer` (default path via ApiReferenceComponent) |
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## Environment & Configuration
|
|
231
|
+
|
|
232
|
+
Environment variables store configuration outside code (in `.env` files). IGNIS uses `APP_ENV_` prefix to avoid system conflicts.
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# .env file
|
|
236
|
+
APP_ENV_POSTGRES_HOST=localhost
|
|
237
|
+
APP_ENV_POSTGRES_PASSWORD=secret123
|
|
238
|
+
APP_ENV_SERVER_PORT=3000
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
const host = process.env.APP_ENV_POSTGRES_HOST;
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Related:** [Environment Variables Reference](../../references/configuration/environment-variables)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
## See Also
|
|
249
|
+
|
|
250
|
+
[5-Minute Quickstart](../get-started/5-minute-quickstart) | [Building a CRUD API](../tutorials/building-a-crud-api) | [Repositories](../../references/base/repositories/)
|