@venizia/ignis-kernel 0.4.8-0 → 0.4.8-2
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/README.md +5 -4
- package/dist/esm/base/applications/abstract.d.ts +1 -0
- package/dist/esm/base/applications/abstract.js +1 -0
- package/dist/esm/base/applications/abstract.js.map +1 -1
- package/dist/esm/base/applications/boot-sequence.d.ts +2 -0
- package/dist/esm/base/applications/boot-sequence.js.map +1 -1
- package/dist/esm/base/applications/common/constants.d.ts +2 -0
- package/dist/esm/base/applications/common/constants.js +1 -0
- package/dist/esm/base/applications/common/constants.js.map +1 -1
- package/dist/esm/base/applications/common/types/application.d.ts +30 -8
- package/dist/esm/base/applications/common/types/application.js.map +1 -1
- package/dist/esm/base/applications/common/types/middlewares.d.ts +16 -1
- package/dist/esm/base/applications/common/types/middlewares.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/codecs.d.ts +1 -0
- package/dist/esm/base/auth/authenticate/common/codecs.js +1 -0
- package/dist/esm/base/auth/authenticate/common/codecs.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/constants/authentication.d.ts +6 -0
- package/dist/esm/base/auth/authenticate/common/constants/authentication.js +4 -0
- package/dist/esm/base/auth/authenticate/common/constants/authentication.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/constants/jose.d.ts +8 -0
- package/dist/esm/base/auth/authenticate/common/constants/jose.js +4 -0
- package/dist/esm/base/auth/authenticate/common/constants/jose.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/keys.d.ts +1 -0
- package/dist/esm/base/auth/authenticate/common/keys.js +1 -0
- package/dist/esm/base/auth/authenticate/common/keys.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/basic.d.ts +1 -0
- package/dist/esm/base/auth/authenticate/common/types/basic.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/jwt.d.ts +42 -0
- package/dist/esm/base/auth/authenticate/common/types/jwt.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/rest.d.ts +2 -0
- package/dist/esm/base/auth/authenticate/common/types/rest.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/service.d.ts +10 -1
- package/dist/esm/base/auth/authenticate/common/types/service.js.map +1 -1
- package/dist/esm/base/auth/authenticate/common/types/strategy.d.ts +5 -0
- package/dist/esm/base/auth/authenticate/common/types/strategy.js.map +1 -1
- package/dist/esm/base/auth/authenticate/middlewares/authenticate.middleware.d.ts +1 -0
- package/dist/esm/base/auth/authenticate/middlewares/authenticate.middleware.js +1 -0
- package/dist/esm/base/auth/authenticate/middlewares/authenticate.middleware.js.map +1 -1
- package/dist/esm/base/auth/authenticate/providers/authentication.provider.d.ts +5 -0
- package/dist/esm/base/auth/authenticate/providers/authentication.provider.js +5 -0
- package/dist/esm/base/auth/authenticate/providers/authentication.provider.js.map +1 -1
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.d.ts +1 -0
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js +1 -0
- package/dist/esm/base/auth/authenticate/strategies/strategy-registry.js.map +1 -1
- package/dist/esm/base/auth/authorize/builders/grant.builder.d.ts +1 -0
- package/dist/esm/base/auth/authorize/builders/grant.builder.js +1 -0
- package/dist/esm/base/auth/authorize/builders/grant.builder.js.map +1 -1
- package/dist/esm/base/auth/authorize/builders/policy.builder.d.ts +1 -0
- package/dist/esm/base/auth/authorize/builders/policy.builder.js +1 -0
- package/dist/esm/base/auth/authorize/builders/policy.builder.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/authorization.d.ts +8 -0
- package/dist/esm/base/auth/authorize/common/constants/authorization.js +5 -0
- package/dist/esm/base/auth/authorize/common/constants/authorization.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/binding-keys.d.ts +1 -0
- package/dist/esm/base/auth/authorize/common/constants/binding-keys.js +1 -0
- package/dist/esm/base/auth/authorize/common/constants/binding-keys.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/constants/enforcer.d.ts +9 -0
- package/dist/esm/base/auth/authorize/common/constants/enforcer.js +4 -0
- package/dist/esm/base/auth/authorize/common/constants/enforcer.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/types/enforcer.d.ts +21 -3
- package/dist/esm/base/auth/authorize/common/types/enforcer.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/types/grant.d.ts +1 -0
- package/dist/esm/base/auth/authorize/common/types/grant.js.map +1 -1
- package/dist/esm/base/auth/authorize/common/types/request.d.ts +3 -0
- package/dist/esm/base/auth/authorize/common/types/request.js.map +1 -1
- package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.d.ts +1 -0
- package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js +1 -0
- package/dist/esm/base/auth/authorize/enforcers/enforcer-registry.js.map +1 -1
- package/dist/esm/base/auth/authorize/middlewares/authorize.middleware.d.ts +1 -0
- package/dist/esm/base/auth/authorize/middlewares/authorize.middleware.js +1 -0
- package/dist/esm/base/auth/authorize/middlewares/authorize.middleware.js.map +1 -1
- package/dist/esm/base/auth/authorize/models/authorization-role.model.d.ts +6 -0
- package/dist/esm/base/auth/authorize/models/authorization-role.model.js +1 -0
- package/dist/esm/base/auth/authorize/models/authorization-role.model.js.map +1 -1
- package/dist/esm/base/auth/authorize/providers/authorization.provider.d.ts +1 -0
- package/dist/esm/base/auth/authorize/providers/authorization.provider.js +1 -0
- package/dist/esm/base/auth/authorize/providers/authorization.provider.js.map +1 -1
- package/dist/esm/base/auth/base/abstract-auth-registry.d.ts +2 -0
- package/dist/esm/base/auth/base/abstract-auth-registry.js +1 -0
- package/dist/esm/base/auth/base/abstract-auth-registry.js.map +1 -1
- package/dist/esm/base/auth/models/requests/change-password.schema.d.ts +2 -0
- package/dist/esm/base/auth/models/requests/change-password.schema.js +1 -0
- package/dist/esm/base/auth/models/requests/change-password.schema.js.map +1 -1
- package/dist/esm/base/auth/models/requests/sign-in.schema.d.ts +2 -0
- package/dist/esm/base/auth/models/requests/sign-in.schema.js +1 -0
- package/dist/esm/base/auth/models/requests/sign-in.schema.js.map +1 -1
- package/dist/esm/base/auth/models/requests/sign-up.schema.d.ts +2 -0
- package/dist/esm/base/auth/models/requests/sign-up.schema.js +1 -0
- package/dist/esm/base/auth/models/requests/sign-up.schema.js.map +1 -1
- package/dist/esm/base/components/base.d.ts +1 -0
- package/dist/esm/base/components/base.js +1 -0
- package/dist/esm/base/components/base.js.map +1 -1
- package/dist/esm/base/components/controller/rest/common/types.d.ts +2 -0
- package/dist/esm/base/components/controller/rest/common/types.js +1 -0
- package/dist/esm/base/components/controller/rest/common/types.js.map +1 -1
- package/dist/esm/base/configurations/base.d.ts +1 -0
- package/dist/esm/base/configurations/base.js +1 -0
- package/dist/esm/base/configurations/base.js.map +1 -1
- package/dist/esm/base/configurations/common/types.d.ts +1 -0
- package/dist/esm/base/configurations/common/types.js.map +1 -1
- package/dist/esm/base/controllers/common/constants.d.ts +4 -0
- package/dist/esm/base/controllers/common/constants.js +2 -0
- package/dist/esm/base/controllers/common/constants.js.map +1 -1
- package/dist/esm/base/controllers/common/schema-builders.d.ts +3 -0
- package/dist/esm/base/controllers/common/schema-builders.js +1 -0
- package/dist/esm/base/controllers/common/schema-builders.js.map +1 -1
- package/dist/esm/base/controllers/common/schemas.d.ts +2 -0
- package/dist/esm/base/controllers/common/schemas.js +2 -0
- package/dist/esm/base/controllers/common/schemas.js.map +1 -1
- package/dist/esm/base/controllers/common/types/context.d.ts +2 -0
- package/dist/esm/base/controllers/common/types/context.js.map +1 -1
- package/dist/esm/base/controllers/common/types/controller.d.ts +5 -1
- package/dist/esm/base/controllers/common/types/controller.js.map +1 -1
- package/dist/esm/base/controllers/common/types/route.d.ts +7 -1
- package/dist/esm/base/controllers/common/types/route.js.map +1 -1
- package/dist/esm/base/datasources/common/types.d.ts +5 -0
- package/dist/esm/base/datasources/common/types.js +1 -0
- package/dist/esm/base/datasources/common/types.js.map +1 -1
- package/dist/esm/base/events/common/constants.d.ts +4 -0
- package/dist/esm/base/events/common/constants.js +3 -0
- package/dist/esm/base/events/common/constants.js.map +1 -1
- package/dist/esm/base/events/common/types.d.ts +10 -2
- package/dist/esm/base/events/common/types.js.map +1 -1
- package/dist/esm/base/metadata/injectable.d.ts +46 -0
- package/dist/esm/base/metadata/injectable.js +46 -0
- package/dist/esm/base/metadata/injectable.js.map +1 -1
- package/dist/esm/base/metadata/persistents.d.ts +47 -2
- package/dist/esm/base/metadata/persistents.js +47 -2
- package/dist/esm/base/metadata/persistents.js.map +1 -1
- package/dist/esm/base/metadata/routes/controller.d.ts +17 -0
- package/dist/esm/base/metadata/routes/controller.js +17 -0
- package/dist/esm/base/metadata/routes/controller.js.map +1 -1
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.d.ts +1 -0
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js +1 -0
- package/dist/esm/base/middlewares/emoji-favicon/emoji-favicon.middleware.js.map +1 -1
- package/dist/esm/base/middlewares/not-found/not-found.middleware.d.ts +1 -0
- package/dist/esm/base/middlewares/not-found/not-found.middleware.js +1 -0
- package/dist/esm/base/middlewares/not-found/not-found.middleware.js.map +1 -1
- package/dist/esm/base/mixins/common/types.d.ts +14 -1
- package/dist/esm/base/mixins/common/types.js.map +1 -1
- package/dist/esm/base/models/common/constants.d.ts +2 -0
- package/dist/esm/base/models/common/constants.js +1 -0
- package/dist/esm/base/models/common/constants.js.map +1 -1
- package/dist/esm/base/models/common/schemas.d.ts +1 -0
- package/dist/esm/base/models/common/schemas.js.map +1 -1
- package/dist/esm/base/models/common/types/id.d.ts +4 -0
- package/dist/esm/base/models/common/types/id.js.map +1 -1
- package/dist/esm/base/providers/base.d.ts +1 -0
- package/dist/esm/base/providers/base.js +1 -0
- package/dist/esm/base/providers/base.js.map +1 -1
- package/dist/esm/base/repositories/common/constants.d.ts +2 -2
- package/dist/esm/base/repositories/common/constants.js +2 -2
- package/dist/esm/base/repositories/common/constants.js.map +1 -1
- package/dist/esm/base/repositories/common/scope-through.d.ts +18 -1
- package/dist/esm/base/repositories/common/scope-through.js +18 -1
- package/dist/esm/base/repositories/common/scope-through.js.map +1 -1
- package/dist/esm/base/repositories/common/types/options.d.ts +10 -4
- package/dist/esm/base/repositories/common/types/options.js.map +1 -1
- package/dist/esm/base/repositories/query-schemas/index.d.ts +18 -3
- package/dist/esm/base/repositories/query-schemas/index.js +17 -1
- package/dist/esm/base/repositories/query-schemas/index.js.map +1 -1
- package/dist/esm/base/request-context/registry.d.ts +1 -0
- package/dist/esm/base/request-context/registry.js +1 -0
- package/dist/esm/base/request-context/registry.js.map +1 -1
- package/dist/esm/base/services/base.d.ts +1 -0
- package/dist/esm/base/services/base.js +1 -0
- package/dist/esm/base/services/base.js.map +1 -1
- package/dist/esm/base/services/common/types.d.ts +1 -0
- package/dist/esm/base/services/common/types.js.map +1 -1
- package/dist/esm/common/bindings.d.ts +1 -0
- package/dist/esm/common/bindings.js.map +1 -1
- package/dist/esm/common/error-codes.d.ts +2 -0
- package/dist/esm/common/error-codes.js.map +1 -1
- package/dist/esm/helpers/inversion/common/keys.d.ts +1 -0
- package/dist/esm/helpers/inversion/common/keys.js +1 -0
- package/dist/esm/helpers/inversion/common/keys.js.map +1 -1
- package/dist/esm/helpers/inversion/common/relation-builder.d.ts +1 -0
- package/dist/esm/helpers/inversion/common/relation-builder.js +1 -0
- package/dist/esm/helpers/inversion/common/relation-builder.js.map +1 -1
- package/dist/esm/helpers/inversion/common/types/artifact.d.ts +9 -2
- package/dist/esm/helpers/inversion/common/types/artifact.js.map +1 -1
- package/dist/esm/helpers/inversion/common/types/controller.d.ts +4 -0
- package/dist/esm/helpers/inversion/common/types/controller.js.map +1 -1
- package/dist/esm/helpers/inversion/common/types/model.d.ts +80 -8
- package/dist/esm/helpers/inversion/common/types/model.js.map +1 -1
- package/dist/esm/helpers/inversion/common/types/persistence.d.ts +9 -1
- package/dist/esm/helpers/inversion/common/types/persistence.js.map +1 -1
- package/dist/esm/helpers/inversion/container.d.ts +1 -0
- package/dist/esm/helpers/inversion/container.js +1 -0
- package/dist/esm/helpers/inversion/container.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,3 +1,20 @@
|
|
|
1
1
|
import type { TControllerMetadata } from '../../../helpers/inversion/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Class decorator that registers the class as a controller artifact and stores its `path`, tags and transport (REST by default, or gRPC with a `service`).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { BaseRestController, controller } from '@venizia/ignis';
|
|
8
|
+
*
|
|
9
|
+
* export @controller({ path: '/orders', tags: ['Order'] })
|
|
10
|
+
* class OrderController extends BaseRestController {
|
|
11
|
+
* constructor() {
|
|
12
|
+
* super({ scope: OrderController.name, path: '/orders' });
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* override binding(): void {}
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
2
19
|
export declare const controller: (metadata: TControllerMetadata) => ClassDecorator;
|
|
3
20
|
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { ArtifactTypes, MetadataRegistry } from '../../../helpers/inversion/index.js';
|
|
2
2
|
import { injectable, InjectableUtility } from '../injectable.js';
|
|
3
|
+
/**
|
|
4
|
+
* Class decorator that registers the class as a controller artifact and stores its `path`, tags and transport (REST by default, or gRPC with a `service`).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { BaseRestController, controller } from '@venizia/ignis';
|
|
9
|
+
*
|
|
10
|
+
* export @controller({ path: '/orders', tags: ['Order'] })
|
|
11
|
+
* class OrderController extends BaseRestController {
|
|
12
|
+
* constructor() {
|
|
13
|
+
* super({ scope: OrderController.name, path: '/orders' });
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* override binding(): void {}
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
3
20
|
export const controller = (metadata) => {
|
|
4
21
|
return (target) => {
|
|
5
22
|
injectable({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../src/base/metadata/routes/controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAA6B,EAAkB,EAAE;IAC1E,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,UAAU,CAAC;YACT,IAAI,EAAE,aAAa,CAAC,UAAU;YAC9B,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,EAAE,QAAQ,EAAE,CAAC;SAC3D,CAAC,CAAC,MAAM,CAAC,CAAC;QACX,gBAAgB,CAAC,WAAW,EAAE,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { TControllerMetadata } from '@/helpers/inversion';\nimport { ArtifactTypes, MetadataRegistry } from '@/helpers/inversion';\nimport { injectable, InjectableUtility } from '../injectable';\n\nexport const controller = (metadata: TControllerMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.CONTROLLER,\n ...InjectableUtility.pickRegistrationOptions({ metadata }),\n })(target);\n MetadataRegistry.getInstance().setControllerMetadata({ target, metadata });\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../src/base/metadata/routes/controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAA6B,EAAkB,EAAE;IAC1E,OAAO,CAAC,MAAM,EAAE,EAAE;QAChB,UAAU,CAAC;YACT,IAAI,EAAE,aAAa,CAAC,UAAU;YAC9B,GAAG,iBAAiB,CAAC,uBAAuB,CAAC,EAAE,QAAQ,EAAE,CAAC;SAC3D,CAAC,CAAC,MAAM,CAAC,CAAC;QACX,gBAAgB,CAAC,WAAW,EAAE,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7E,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { TControllerMetadata } from '@/helpers/inversion';\nimport { ArtifactTypes, MetadataRegistry } from '@/helpers/inversion';\nimport { injectable, InjectableUtility } from '../injectable';\n\n/**\n * Class decorator that registers the class as a controller artifact and stores its `path`, tags and transport (REST by default, or gRPC with a `service`).\n *\n * @example\n * ```typescript\n * import { BaseRestController, controller } from '@venizia/ignis';\n *\n * export @controller({ path: '/orders', tags: ['Order'] })\n * class OrderController extends BaseRestController {\n * constructor() {\n * super({ scope: OrderController.name, path: '/orders' });\n * }\n *\n * override binding(): void {}\n * }\n * ```\n */\nexport const controller = (metadata: TControllerMetadata): ClassDecorator => {\n return (target) => {\n injectable({\n type: ArtifactTypes.CONTROLLER,\n ...InjectableUtility.pickRegistrationOptions({ metadata }),\n })(target);\n MetadataRegistry.getInstance().setControllerMetadata({ target, metadata });\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emoji-favicon.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/emoji-favicon/emoji-favicon.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,OAAO,sBAAsB;IACjC,yDAAyD;IACzD,MAAM,CAAC,MAAM,CAAC,IAAsB;QAClC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAEtB,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAClD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACxC,OAAO,IAAI,EAAE,CAAC;YAChB,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;YAEzD,OAAO,OAAO,CAAC,IAAI,CACjB,0GAA0G,IAAI,eAAe,CAC9H,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["import type { MiddlewareHandler } from 'hono';\nimport { createMiddleware } from 'hono/factory';\n\nexport class EmojiFaviconMiddleware {\n /** Serves an emoji as an SVG favicon on /favicon.ico. */\n static create(opts: { icon: string }): MiddlewareHandler {\n const { icon } = opts;\n\n const mw = createMiddleware(async (context, next) => {\n if (context.req.path !== '/favicon.ico') {\n return next();\n }\n\n context.res.headers.set('content-type', 'image/svg+xml');\n\n return context.body(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\"><text y=\".9em\" x=\"-0.1em\" font-size=\"90\">${icon}</text></svg>`,\n );\n });\n\n return mw;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"emoji-favicon.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/emoji-favicon/emoji-favicon.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,0FAA0F;AAC1F,MAAM,OAAO,sBAAsB;IACjC,yDAAyD;IACzD,MAAM,CAAC,MAAM,CAAC,IAAsB;QAClC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAEtB,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;YAClD,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACxC,OAAO,IAAI,EAAE,CAAC;YAChB,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;YAEzD,OAAO,OAAO,CAAC,IAAI,CACjB,0GAA0G,IAAI,eAAe,CAC9H,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,CAAC;IACZ,CAAC;CACF","sourcesContent":["import type { MiddlewareHandler } from 'hono';\nimport { createMiddleware } from 'hono/factory';\n\n/** Factory for a middleware that answers `/favicon.ico` with an emoji rendered as SVG. */\nexport class EmojiFaviconMiddleware {\n /** Serves an emoji as an SVG favicon on /favicon.ico. */\n static create(opts: { icon: string }): MiddlewareHandler {\n const { icon } = opts;\n\n const mw = createMiddleware(async (context, next) => {\n if (context.req.path !== '/favicon.ico') {\n return next();\n }\n\n context.res.headers.set('content-type', 'image/svg+xml');\n\n return context.body(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\"><text y=\".9em\" x=\"-0.1em\" font-size=\"90\">${icon}</text></svg>`,\n );\n });\n\n return mw;\n }\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ILogger } from '@venizia/ignis-helpers/core';
|
|
2
2
|
import type { NotFoundHandler } from 'hono/types';
|
|
3
|
+
/** Builds the application not-found handler: logs the miss at warn level on `logger` (console when omitted) and returns a 404 JSON body carrying the request id, path and url. */
|
|
3
4
|
export declare const notFoundHandler: (opts: {
|
|
4
5
|
logger?: ILogger;
|
|
5
6
|
}) => NotFoundHandler;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HTTP } from '@venizia/ignis-helpers/common';
|
|
2
2
|
import { REQUEST_ID_KEY } from '../common/index.js';
|
|
3
|
+
/** Builds the application not-found handler: logs the miss at warn level on `logger` (console when omitted) and returns a 404 JSON body carrying the request id, path and url. */
|
|
3
4
|
export const notFoundHandler = (opts) => {
|
|
4
5
|
const { logger = console } = opts;
|
|
5
6
|
const mw = async (context) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC5D,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,EAAE,GAAoB,KAAK,EAAE,OAAO,EAAE,EAAE;QAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAE9C,6FAA6F;QAC7F,+FAA+F;QAC/F,6FAA6F;QAC7F,MAAM,CAAC,IAAI,CACT,yCAAyC,EACzC,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,IAAI,EAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAChB,CAAC;QAEF,OAAO,OAAO,CAAC,IAAI,CACjB;YACE,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;YAC1C,SAAS;YACT,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;SACrB,EACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAC/B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","sourcesContent":["import type { ILogger } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport type { NotFoundHandler } from 'hono/types';\nimport { REQUEST_ID_KEY } from '../common';\n\nexport const notFoundHandler = (opts: { logger?: ILogger }) => {\n const { logger = console } = opts;\n\n const mw: NotFoundHandler = async (context) => {\n const requestId = context.get(REQUEST_ID_KEY);\n\n // WARN, not ERROR: an unrouted path is the callers mistake, and this middleware is installed\n // unconditionally - so scanner traffic filled the dedicated error log and tripped error-volume\n // alerting. The same reasoning is already applied to an expired token elsewhere in the tree.\n logger.warn(\n '[%s] URL NOT FOUND | path: %s | url: %s',\n requestId,\n context.req.path,\n context.req.url,\n );\n\n return context.json(\n {\n message: 'URL NOT FOUND',\n statusCode: HTTP.ResultCodes.RS_4.NotFound,\n requestId,\n path: context.req.path,\n url: context.req.url,\n },\n HTTP.ResultCodes.RS_4.NotFound,\n );\n };\n\n return mw;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"not-found.middleware.js","sourceRoot":"","sources":["../../../../../src/base/middlewares/not-found/not-found.middleware.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C,kLAAkL;AAClL,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAA0B,EAAE,EAAE;IAC5D,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,GAAG,IAAI,CAAC;IAElC,MAAM,EAAE,GAAoB,KAAK,EAAE,OAAO,EAAE,EAAE;QAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;QAE9C,6FAA6F;QAC7F,+FAA+F;QAC/F,6FAA6F;QAC7F,MAAM,CAAC,IAAI,CACT,yCAAyC,EACzC,SAAS,EACT,OAAO,CAAC,GAAG,CAAC,IAAI,EAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAChB,CAAC;QAEF,OAAO,OAAO,CAAC,IAAI,CACjB;YACE,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;YAC1C,SAAS;YACT,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI;YACtB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;SACrB,EACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAC/B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","sourcesContent":["import type { ILogger } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport type { NotFoundHandler } from 'hono/types';\nimport { REQUEST_ID_KEY } from '../common';\n\n/** Builds the application not-found handler: logs the miss at warn level on `logger` (console when omitted) and returns a 404 JSON body carrying the request id, path and url. */\nexport const notFoundHandler = (opts: { logger?: ILogger }) => {\n const { logger = console } = opts;\n\n const mw: NotFoundHandler = async (context) => {\n const requestId = context.get(REQUEST_ID_KEY);\n\n // WARN, not ERROR: an unrouted path is the callers mistake, and this middleware is installed\n // unconditionally - so scanner traffic filled the dedicated error log and tripped error-volume\n // alerting. The same reasoning is already applied to an expired token elsewhere in the tree.\n logger.warn(\n '[%s] URL NOT FOUND | path: %s | url: %s',\n requestId,\n context.req.path,\n context.req.url,\n );\n\n return context.json(\n {\n message: 'URL NOT FOUND',\n statusCode: HTTP.ResultCodes.RS_4.NotFound,\n requestId,\n path: context.req.path,\n url: context.req.url,\n },\n HTTP.ResultCodes.RS_4.NotFound,\n );\n };\n\n return mw;\n};\n"]}
|
|
@@ -12,39 +12,52 @@ export type TMixinOpts<Options extends object = {}> = {
|
|
|
12
12
|
namespace: string;
|
|
13
13
|
key: string;
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Matches `bind()`'s overwrite behavior; false makes a same-key re-registration throw. Unset, it
|
|
17
|
+
* follows `bootChecks.binding.allowOverride`.
|
|
18
|
+
*
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
16
21
|
allowOverride?: boolean;
|
|
17
22
|
/** Options passed directly to `instance.configure(options)` during initialization. */
|
|
18
23
|
options?: Options;
|
|
19
24
|
};
|
|
25
|
+
/** Mixin contract for registering configuration classes on the application. */
|
|
20
26
|
export interface IConfigurationMixin {
|
|
21
27
|
configuration<Base extends BaseConfiguration<Options>, Options extends object = {}>(target: TClass<Base>, opts?: TMixinOpts<Options>): Binding<Base>;
|
|
22
28
|
registerConfigurations(): ValueOrPromise<void>;
|
|
23
29
|
}
|
|
30
|
+
/** Mixin contract for registering components on the application. */
|
|
24
31
|
export interface IComponentMixin {
|
|
25
32
|
component<Base extends BaseComponent<Options>, Options extends object = {}>(target: TClass<Base>, opts?: TMixinOpts<Options>): Binding<Base>;
|
|
26
33
|
registerComponents(): ValueOrPromise<void>;
|
|
27
34
|
}
|
|
35
|
+
/** Mixin contract for the application lifecycle hooks of a server and its reported version. */
|
|
28
36
|
export interface IServerConfigMixin {
|
|
29
37
|
staticConfigure(): ValueOrPromise<void>;
|
|
30
38
|
preConfigure(): ValueOrPromise<void>;
|
|
31
39
|
postConfigure(): ValueOrPromise<void>;
|
|
32
40
|
getApplicationVersion(): ValueOrPromise<string>;
|
|
33
41
|
}
|
|
42
|
+
/** Mixin contract for registering controllers on the application. */
|
|
34
43
|
export interface IControllerMixin {
|
|
35
44
|
controller<Base>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base>;
|
|
36
45
|
registerControllers(): ValueOrPromise<void>;
|
|
37
46
|
}
|
|
47
|
+
/** Mixin contract for registering datasources and repositories on the application. */
|
|
38
48
|
export interface IRepositoryMixin {
|
|
39
49
|
dataSource<Base extends IDataSource<Options>, Options extends object = {}>(target: TClass<Base>, opts?: TMixinOpts<Options>): Binding<Base>;
|
|
40
50
|
repository<Base extends IRepository>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base>;
|
|
41
51
|
}
|
|
52
|
+
/** Mixin contract for registering services on the application. */
|
|
42
53
|
export interface IServiceMixin {
|
|
43
54
|
service<Base extends IService>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base>;
|
|
44
55
|
}
|
|
56
|
+
/** Mixin contract for registering every discovered artifact from an artifact index in one call. */
|
|
45
57
|
export interface IArtifactRegistrationMixin {
|
|
46
58
|
registerArtifacts(index: TArtifactIndexInput): Promise<void>;
|
|
47
59
|
}
|
|
60
|
+
/** Mixin contract for serving a static folder; `restPath` is the URL path it is served under. */
|
|
48
61
|
export interface IStaticServeMixin {
|
|
49
62
|
static(opts: {
|
|
50
63
|
restPath?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/base/mixins/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Binding } from '@/helpers/inversion';\nimport type { TClass, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { IApplication, TArtifactIndexInput } from '../../applications';\nimport type { BaseComponent } from '../../components';\nimport type { BaseConfiguration } from '../../configurations';\nimport type { IDataSource } from '../../datasources';\nimport type { IRepository } from '../../repositories';\nimport type { IService } from '../../services';\n\n/** Options of the registration itself, never of the artifact - what the artifact needs goes on its class. */\nexport type TMixinOpts<Options extends object = {}> = {\n binding?: { namespace: string; key: string };\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/base/mixins/common/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Binding } from '@/helpers/inversion';\nimport type { TClass, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { IApplication, TArtifactIndexInput } from '../../applications';\nimport type { BaseComponent } from '../../components';\nimport type { BaseConfiguration } from '../../configurations';\nimport type { IDataSource } from '../../datasources';\nimport type { IRepository } from '../../repositories';\nimport type { IService } from '../../services';\n\n/** Options of the registration itself, never of the artifact - what the artifact needs goes on its class. */\nexport type TMixinOpts<Options extends object = {}> = {\n binding?: { namespace: string; key: string };\n /**\n * Matches `bind()`'s overwrite behavior; false makes a same-key re-registration throw. Unset, it\n * follows `bootChecks.binding.allowOverride`.\n *\n * @default true\n */\n allowOverride?: boolean;\n /** Options passed directly to `instance.configure(options)` during initialization. */\n options?: Options;\n};\n\n/** Mixin contract for registering configuration classes on the application. */\nexport interface IConfigurationMixin {\n configuration<Base extends BaseConfiguration<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base>;\n registerConfigurations(): ValueOrPromise<void>;\n}\n\n/** Mixin contract for registering components on the application. */\nexport interface IComponentMixin {\n component<Base extends BaseComponent<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base>;\n registerComponents(): ValueOrPromise<void>;\n}\n\n/** Mixin contract for the application lifecycle hooks of a server and its reported version. */\nexport interface IServerConfigMixin {\n staticConfigure(): ValueOrPromise<void>;\n preConfigure(): ValueOrPromise<void>;\n postConfigure(): ValueOrPromise<void>;\n getApplicationVersion(): ValueOrPromise<string>;\n}\n\n/** Mixin contract for registering controllers on the application. */\nexport interface IControllerMixin {\n controller<Base>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base>;\n registerControllers(): ValueOrPromise<void>;\n}\n\n/** Mixin contract for registering datasources and repositories on the application. */\nexport interface IRepositoryMixin {\n dataSource<Base extends IDataSource<Options>, Options extends object = {}>(\n target: TClass<Base>,\n opts?: TMixinOpts<Options>,\n ): Binding<Base>;\n repository<Base extends IRepository>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base>;\n}\n/** Mixin contract for registering services on the application. */\nexport interface IServiceMixin {\n service<Base extends IService>(target: TClass<Base>, opts?: TMixinOpts): Binding<Base>;\n}\n\n/** Mixin contract for registering every discovered artifact from an artifact index in one call. */\nexport interface IArtifactRegistrationMixin {\n registerArtifacts(index: TArtifactIndexInput): Promise<void>;\n}\n\n/** Mixin contract for serving a static folder; `restPath` is the URL path it is served under. */\nexport interface IStaticServeMixin {\n static(opts: { restPath?: string; folderPath: string }): IApplication;\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TConstValue } from '@venizia/ignis-helpers/common';
|
|
2
|
+
/** The schema variants an entity can produce (`getSchema({ type })`): select, create, update and execute. */
|
|
2
3
|
export declare class SchemaTypes {
|
|
3
4
|
static readonly SELECT = "select";
|
|
4
5
|
static readonly UPDATE = "update";
|
|
@@ -7,6 +8,7 @@ export declare class SchemaTypes {
|
|
|
7
8
|
static readonly SCHEME_SET: Set<string>;
|
|
8
9
|
static isValid(input: string): input is TSchemaType;
|
|
9
10
|
}
|
|
11
|
+
/** Valid `SchemaTypes` values. */
|
|
10
12
|
export type TSchemaType = TConstValue<typeof SchemaTypes>;
|
|
11
13
|
/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */
|
|
12
14
|
export declare class ModelTypes {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,WAAW;aACN,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/models/common/constants.ts"],"names":[],"mappings":"AAEA,6GAA6G;AAC7G,MAAM,OAAO,WAAW;aACN,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAClB,YAAO,GAAG,SAAS,CAAC;aAEpB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAE5F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,iGAAiG;AACjG,MAAM,OAAO,UAAU;aACL,WAAM,GAAG,QAAQ,CAAC;aAClB,eAAU,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEpD,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAMH,2FAA2F;AAC3F,MAAM,OAAO,aAAa;aACR,WAAM,GAAG,QAAQ,CAAC;aAClB,WAAM,GAAG,QAAQ,CAAC;aAElB,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzE,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\n\n/** The schema variants an entity can produce (`getSchema({ type })`): select, create, update and execute. */\nexport class SchemaTypes {\n static readonly SELECT = 'select';\n static readonly UPDATE = 'update';\n static readonly CREATE = 'create';\n static readonly EXECUTE = 'execute';\n\n static readonly SCHEME_SET = new Set([this.SELECT, this.UPDATE, this.CREATE, this.EXECUTE]);\n\n static isValid(input: string): input is TSchemaType {\n return this.SCHEME_SET.has(input);\n }\n}\n\n/** Valid `SchemaTypes` values. */\nexport type TSchemaType = TConstValue<typeof SchemaTypes>;\n\n/** What `@model` declares. Only ENTITY (a table-backed model) exists; `type` may be left out. */\nexport class ModelTypes {\n static readonly ENTITY = 'entity';\n static readonly SCHEME_SET = new Set([this.ENTITY]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid model type values. */\nexport type TModelType = TConstValue<typeof ModelTypes>;\n\n/** The path-param id shape an entity family resolves to (`AbstractEntity.getIdType()`). */\nexport class IdSchemaTypes {\n static readonly NUMBER = 'number';\n static readonly STRING = 'string';\n\n static readonly SCHEME_SET = new Set<string>([this.NUMBER, this.STRING]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid id schema type values. */\nexport type TIdSchemaType = TConstValue<typeof IdSchemaTypes>;\n"]}
|
|
@@ -16,6 +16,7 @@ export declare const ErrorSchema: z.ZodObject<{
|
|
|
16
16
|
requestId: z.ZodOptional<z.ZodString>;
|
|
17
17
|
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
18
18
|
}, z.core.$strip>;
|
|
19
|
+
/** The error response body type inferred from `ErrorSchema`. */
|
|
19
20
|
export type TErrorResponse = z.infer<typeof ErrorSchema>;
|
|
20
21
|
/** OpenAPI schema builders for the parts of a route that every controller repeats. */
|
|
21
22
|
export declare class OpenApiSchemas {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../../src/base/models/common/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAGvD;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,CAAC;SACV,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QA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a,GAAG,gBAAgB,CAAC,WAAW,CAAC;YACjD,WAAW,EAAE,gBAAgB;YAC7B,MAAM,EAAE,WAAW;SACpB,CAAC,CAAC;QAEH,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,YAAY,CAGjB,IAAoD;QACpD,MAAM,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC;YAChD,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,kBAAkB;YACnD,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC;QAEH,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO;YAClC,CAAC,CAAC,EAAE,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE;YAC5C,CAAC,CAAC,YAAY,CAAC;QAEjB,OAAO;YACL,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,eAAe;YAC3C,GAAG,gBAAgB,CAAC,cAAc,EAAE;SACrC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { z } from '@hono/zod-openapi';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport type { TIdSchemaType } from './constants';\n\n/**\n * The error RESPONSE for OpenAPI docs - here, beside the REST layer that already needs `@hono/zod-openapi`.\n * Named, so every route's `4XX` and `5XX` reference one `ErrorResponse` component.\n */\nexport const ErrorSchema = z\n .object({\n statusCode: z.number().optional(),\n message: z.string(),\n normalized: z\n .object({\n text: z.string(),\n code: z.string(),\n args: z.record(z.string(), z.any()),\n })\n .optional(),\n extra: z.record(z.string(), z.any()).optional(),\n requestId: z.string().optional(),\n details: z.record(z.string(), z.any()).optional(),\n })\n .openapi('ErrorResponse', {\n description: 'Error Schema',\n example: {\n statusCode: HTTP.ResultCodes.RS_4.Conflict,\n message: 'A category named %{name} already exists.',\n normalized: {\n text: 'A category named %{name} already exists.',\n code: 'server.commerce.category.create.duplicate_name',\n args: { name: 'Ticket' },\n },\n extra: { categoryId: 42 },\n requestId: 'abc-123-def',\n details: { url: 'http://localhost:3000/categories', path: '/categories' },\n },\n });\n\n/** The error response body type inferred from `ErrorSchema`. */\nexport type TErrorResponse = z.infer<typeof ErrorSchema>;\n\n/** OpenAPI schema builders for the parts of a route that every controller repeats. */\nexport class OpenApiSchemas {\n static idParams(opts?: { idType: TIdSchemaType }) {\n const { idType = 'number' } = opts ?? {};\n\n switch (idType) {\n case 'number': {\n return z.object({\n id: z.number().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: [1, 2, 3],\n }),\n });\n }\n case 'string': {\n return z.object({\n id: z.string().openapi({\n param: {\n name: 'id',\n in: 'path',\n description: 'The unique id of the resource',\n },\n examples: ['4651e634-a530-4484-9b09-9616a28f35e3', 'some_unique_id'],\n }),\n });\n }\n default: {\n throw getError({\n message: `[OpenApiSchemas.idParams] Invalid input idType | valid: [string | number] | idType: ${idType}`,\n });\n }\n }\n }\n\n static requiredString(opts?: { min?: number; max?: number; fixed?: number }) {\n const { min, max, fixed } = opts ?? {};\n let rs = z.string().nonempty();\n\n if (min) {\n rs = rs.min(min);\n }\n\n if (max) {\n rs = rs.max(max);\n }\n\n if (fixed) {\n rs = rs.length(fixed);\n }\n\n return rs;\n }\n}\n\n/** OpenAPI Header Object format */\ntype THeaderObject = {\n description?: string;\n schema: { type: string; examples?: Array<string> };\n};\n\n/** Map of header names to Header Objects */\ntype TResponseHeaders = Record<string, THeaderObject>;\n\ntype TJsonResponseOpts<T extends z.ZodType, H extends TResponseHeaders | undefined> = {\n schema: T;\n description?: string;\n required?: boolean;\n headers?: H;\n};\n\n/** OpenAPI response builders: the JSON and HTML bodies of a route, and the error bodies every route shares. */\nexport class OpenApiResponses {\n /** Creates HTML content configuration for OpenAPI documentation. */\n static htmlContent(opts: { description: string; required?: boolean }) {\n const { description } = opts;\n\n return {\n description,\n content: {\n 'text/html': {\n schema: z.string().openapi({\n description: 'HTML content',\n example: '<!DOCTYPE html><html><head><title>Page</title></head><body>...</body></html>',\n }),\n },\n },\n required: opts?.required ?? false,\n };\n }\n\n /** Creates HTML response configuration for OpenAPI documentation. */\n static htmlResponse(opts: { description: string; required?: boolean }) {\n return {\n [HTTP.ResultCodes.RS_2.Ok]: OpenApiResponses.htmlContent({\n description: opts.description,\n required: opts.required,\n }),\n ...OpenApiResponses.errorResponses(),\n };\n }\n\n static jsonContent<T extends z.ZodType>(opts: {\n schema: T;\n description: string;\n required?: boolean;\n }) {\n return {\n description: opts.description,\n content: { 'application/json': { schema: opts.schema } },\n required: opts.required,\n };\n }\n\n /** The JSON error body of a route, under `4XX` and `5XX` - the range keys OpenAPI accepts. */\n static errorResponses() {\n const errorResponse = OpenApiResponses.jsonContent({\n description: 'Error Response',\n schema: ErrorSchema,\n });\n\n return { '4XX': errorResponse, '5XX': errorResponse };\n }\n\n static jsonResponse<\n ContentSchema extends z.ZodType,\n HeaderSchema extends TResponseHeaders | undefined = undefined,\n >(opts: TJsonResponseOpts<ContentSchema, HeaderSchema>) {\n const baseResponse = OpenApiResponses.jsonContent({\n required: opts.required,\n description: opts.description ?? 'Success Response',\n schema: opts.schema,\n });\n\n const successResponse = opts.headers\n ? { ...baseResponse, headers: opts.headers }\n : baseResponse;\n\n return {\n [HTTP.ResultCodes.RS_2.Ok]: successResponse,\n ...OpenApiResponses.errorResponses(),\n };\n }\n}\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/** Numeric entity id. */
|
|
1
2
|
export type NumberIdType = number;
|
|
3
|
+
/** String entity id. */
|
|
2
4
|
export type StringIdType = string;
|
|
5
|
+
/** Bigint entity id. */
|
|
3
6
|
export type BigIntIdType = bigint;
|
|
7
|
+
/** Any id type an entity can use: number, string or bigint. */
|
|
4
8
|
export type IdType = NumberIdType | StringIdType | BigIntIdType;
|
|
5
9
|
declare const entityIdBrand: unique symbol;
|
|
6
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../../../src/base/models/common/types/id.ts"],"names":[],"mappings":"","sourcesContent":["/** Numeric entity id. */\nexport type NumberIdType = number;\n/** String entity id. */\nexport type StringIdType = string;\n/** Bigint entity id. */\nexport type BigIntIdType = bigint;\n/** Any id type an entity can use: number, string or bigint. */\nexport type IdType = NumberIdType | StringIdType | BigIntIdType;\n\ndeclare const entityIdBrand: unique symbol;\n\n/**\n * A string id a plain `string` cannot be assigned to, so passing a name, code or email where an id\n * belongs is a compile error. Opt a column in with `.$type<TEntityId>()`.\n *\n * IT VALIDATES NOTHING. `toEntityId` is a cast with a non-empty check; the value is making the\n * laundering VISIBLE at each boundary, not proving the string is a real id.\n *\n * The cost is not optional: Drizzle derives `$inferInsert` and `$inferSelect` from the same field,\n * so a branded column rejects every literal - `create({ data: { merchantId: 'M1' } })`, seeds,\n * fixtures, path params - until each converts. A union with `string` would restore those but makes\n * a plain `string` assignable again, which erases the whole guarantee. Measured, not assumed.\n */\nexport type TEntityId = string & { readonly [entityIdBrand]: never };\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Container } from '../../helpers/inversion/index.js';
|
|
2
2
|
import { BaseHelper } from '@venizia/ignis-helpers/core';
|
|
3
3
|
import type { IProvider } from '@venizia/ignis-inversion';
|
|
4
|
+
/** Base class for a provider: `value(container)` computes the value the provider supplies, using the container to resolve its dependencies. */
|
|
4
5
|
export declare abstract class BaseProvider<T> extends BaseHelper implements IProvider<T> {
|
|
5
6
|
abstract value(container: Container): T;
|
|
6
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseHelper } from '@venizia/ignis-helpers/core';
|
|
2
|
+
/** Base class for a provider: `value(container)` computes the value the provider supplies, using the container to resolve its dependencies. */
|
|
2
3
|
export class BaseProvider extends BaseHelper {
|
|
3
4
|
}
|
|
4
5
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/base/providers/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,MAAM,OAAgB,YAAgB,SAAQ,UAAU;CAEvD","sourcesContent":["import type { Container } from '@/helpers/inversion';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport type { IProvider } from '@venizia/ignis-inversion';\n\nexport abstract class BaseProvider<T> extends BaseHelper implements IProvider<T> {\n abstract value(container: Container): T;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/base/providers/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,+IAA+I;AAC/I,MAAM,OAAgB,YAAgB,SAAQ,UAAU;CAEvD","sourcesContent":["import type { Container } from '@/helpers/inversion';\nimport { BaseHelper } from '@venizia/ignis-helpers/core';\nimport type { IProvider } from '@venizia/ignis-inversion';\n\n/** Base class for a provider: `value(container)` computes the value the provider supplies, using the container to resolve its dependencies. */\nexport abstract class BaseProvider<T> extends BaseHelper implements IProvider<T> {\n abstract value(container: Container): T;\n}\n"]}
|
|
@@ -23,7 +23,7 @@ export declare class RepositoryOperationScopes {
|
|
|
23
23
|
}
|
|
24
24
|
/** Valid repository operation scope values. */
|
|
25
25
|
export type TRepositoryOperationScope = TConstValue<typeof RepositoryOperationScopes>;
|
|
26
|
-
/** What `@repository` binds: MODEL, a model this application declares
|
|
26
|
+
/** What `@repository` binds: MODEL, a model this application declares; REMOTE, data behind another service's API, with no model. */
|
|
27
27
|
export declare class RepositoryTypes {
|
|
28
28
|
static readonly MODEL = "model";
|
|
29
29
|
static readonly REMOTE = "remote";
|
|
@@ -49,7 +49,7 @@ export type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingB
|
|
|
49
49
|
* passes either way.
|
|
50
50
|
*/
|
|
51
51
|
export declare class ScopeWriteGuards {
|
|
52
|
-
/**
|
|
52
|
+
/** A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */
|
|
53
53
|
static readonly REJECT = "reject";
|
|
54
54
|
/** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */
|
|
55
55
|
static readonly ASSIGN = "assign";
|
|
@@ -23,7 +23,7 @@ export class RepositoryOperationScopes {
|
|
|
23
23
|
return this.SCHEME_SET.has(orgType);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
/** What `@repository` binds: MODEL, a model this application declares
|
|
26
|
+
/** What `@repository` binds: MODEL, a model this application declares; REMOTE, data behind another service's API, with no model. */
|
|
27
27
|
export class RepositoryTypes {
|
|
28
28
|
static { this.MODEL = 'model'; }
|
|
29
29
|
static { this.REMOTE = 'remote'; }
|
|
@@ -49,7 +49,7 @@ export class ScopeFilterMissingBehaviors {
|
|
|
49
49
|
* passes either way.
|
|
50
50
|
*/
|
|
51
51
|
export class ScopeWriteGuards {
|
|
52
|
-
/**
|
|
52
|
+
/** A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */
|
|
53
53
|
static { this.REJECT = 'reject'; }
|
|
54
54
|
/** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */
|
|
55
55
|
static { this.ASSIGN = 'assign'; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AA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,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAElC,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,CAAC;IACrF,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\n\n/** Default pagination limit for repository queries. */\nexport const DEFAULT_LIMIT = 10;\n\n/**\n * Largest `limit` a caller may ask for when a model declares no `query.limit.max`.\n *\n * POLICY, not capacity - it sits far below what an engine can physically serve. It exists because\n * removing an accidental guardrail without replacing it would leave the framework less safe than\n * before: a search engine refused a page over 250 hits, so `limit: 5000` failed fast and cheap.\n * Once that page is served, something has to decide when a page is unreasonable.\n *\n * 1000 sits above any list screen and well below the physical ceiling, so reaching it means the\n * caller is doing something unusual - and a model raises it by saying so explicitly.\n */\nexport const DEFAULT_MAX_LIMIT = 1000;\n\n/** Defines the operation scope for repository instances (READ_ONLY, WRITE_ONLY, READ_WRITE). */\nexport class RepositoryOperationScopes {\n static readonly READ_ONLY = 'READ_ONLY';\n static readonly WRITE_ONLY = 'WRITE_ONLY';\n static readonly READ_WRITE = 'READ_WRITE';\n static readonly SCHEME_SET = new Set([this.READ_ONLY, this.WRITE_ONLY, this.READ_WRITE]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid repository operation scope values. */\nexport type TRepositoryOperationScope = TConstValue<typeof RepositoryOperationScopes>;\n\n/** What `@repository` binds: MODEL, a model this application declares (the default); REMOTE, data behind another service's API, with no model. */\nexport class RepositoryTypes {\n static readonly MODEL = 'model';\n static readonly REMOTE = 'remote';\n static readonly SCHEME_SET = new Set([this.MODEL, this.REMOTE]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid repository type values. */\nexport type TRepositoryType = TConstValue<typeof RepositoryTypes>;\n\n/** What a row-scope filter (`@model` settings.access) does when `resolve()` returns null/undefined. */\nexport class ScopeFilterMissingBehaviors {\n /** An unresolved scope matches ZERO rows - the safe reading of \"caller's scope is unknown\". */\n static readonly DENY = 'deny';\n /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */\n static readonly ALLOW = 'allow';\n static readonly SCHEME_SET = new Set([this.DENY, this.ALLOW]);\n\n static isValid(behavior: string): boolean {\n return this.SCHEME_SET.has(behavior);\n }\n}\n\n/** Valid scope-filter missing-behavior values. */\nexport type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingBehaviors>;\n\n/**\n * What a scoped write does with a row whose scope column disagrees with the resolved scope\n * (`@model` settings.access.write.mode). A scope that returns `ScopeFilters.UNRESTRICTED`\n * passes either way.\n */\nexport class ScopeWriteGuards {\n /** Default. A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */\n static readonly REJECT = 'reject';\n /** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */\n static readonly ASSIGN = 'assign';\n static readonly SCHEME_SET = new Set([this.REJECT, this.ASSIGN]);\n\n static isValid(guard: string): boolean {\n return this.SCHEME_SET.has(guard);\n }\n}\n\n/** Valid scope write-guard values. */\nexport type TScopeWriteGuard = TConstValue<typeof ScopeWriteGuards>;\n\n/**\n * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted\n * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static\n * settings, so using it for a per-user bypass (an internal operator) would also unscope every\n * ordinary user whose `resolve()` happens to return nothing.\n */\nexport class ScopeFilters {\n /**\n * Return from `resolve()` to apply NO scope for this request - a caller the application has\n * decided sees everything. Deliberately a symbol: forgetting to return must land in deny, and no\n * JSON body, query string, or header can ever produce this value. `Symbol.for` so two installed\n * copies of this package agree on identity, same as `DATA_SOURCE_BRAND`.\n */\n static readonly UNRESTRICTED = Symbol.for('@venizia/ignis-kernel:scope-filter-unrestricted');\n}\n\n/** Machine-readable codes for repository-level failures, in the dotted namespace core already uses (`core.not_supported`, `core.search_engine.*`) - a client maps the code, never the message. */\nexport class RepositoryErrorCodes {\n /** A verb the repository's `operationScope` does not permit (e.g. `create()` on a READ_ONLY one). */\n static readonly OPERATION_NOT_ALLOWED = MessageCode.build({\n parts: ['core', 'repository', 'operation_not_allowed'],\n });\n\n /** A write whose scope column disagrees with the resolved scope, or whose scope cannot be verified (`access` write guard). */\n static readonly SCOPE_WRITE_DENIED = MessageCode.build({\n parts: ['core', 'repository', 'scope_write_denied'],\n });\n}\n\n/** Valid repository error code values. */\nexport type TRepositoryErrorCode = TConstValue<typeof RepositoryErrorCodes>;\n\n/** Entity relation types (one-to-one/many-to-one, one-to-many). */\nexport class RelationTypes {\n static readonly ONE = 'one';\n static readonly MANY = 'many';\n static readonly SCHEME_SET = new Set([this.ONE, this.MANY]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid relation type values. */\nexport type TRelationType = TConstValue<typeof RelationTypes>;\n\n/** PostgreSQL row-level lock strengths for SELECT ... FOR <strength>. */\nexport class LockStrengths {\n static readonly UPDATE = 'update';\n static readonly NO_KEY_UPDATE = 'no key update';\n static readonly SHARE = 'share';\n static readonly KEY_SHARE = 'key share';\n static readonly SCHEME_SET = new Set([\n this.UPDATE,\n this.NO_KEY_UPDATE,\n this.SHARE,\n this.KEY_SHARE,\n ]);\n\n static isValid(strength: string): boolean {\n return this.SCHEME_SET.has(strength);\n }\n}\n\n/** Valid lock strength values. */\nexport type TLockStrength = TConstValue<typeof LockStrengths>;\n\n/**\n * What a repository call does to rows, as the row scope (`@model` settings.access) sees it.\n * `access.resolve` receives one CONCRETE operation (READ, CREATE, UPDATE or DELETE), never a group,\n * so one function can answer a wide scope for a read and a narrow one for a write. WRITE and ALL\n * are groups of concrete operations, for application code that asks \"is this a write?\".\n */\nexport class ScopeOperations {\n // concrete: what a repository call is\n static readonly READ = 'read';\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n\n // groups: sets of concrete operations\n /** CREATE, UPDATE and DELETE. */\n static readonly WRITE = 'write';\n /** Every concrete operation. */\n static readonly ALL = 'all';\n\n /** All six values: the four concrete operations and the two groups. */\n static readonly SCHEME_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.WRITE,\n this.ALL,\n ]);\n\n /** The concrete operations: what `access.resolve` can receive. */\n static readonly OPERATION_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n ]);\n\n /** Which concrete operations each group holds. */\n static readonly GROUP_MAP: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [this.WRITE, new Set<string>([this.CREATE, this.UPDATE, this.DELETE])],\n [this.ALL, this.OPERATION_SET],\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n\n /**\n * Whether `operation` belongs to `group`. A concrete operation includes itself and nothing else;\n * WRITE includes CREATE, UPDATE and DELETE; ALL includes all four.\n */\n static includes(opts: { group: TScopeOperationGroup; operation: TScopeOperation }): boolean {\n const { group, operation } = opts;\n\n return group === operation || (this.GROUP_MAP.get(group)?.has(operation) ?? false);\n }\n}\n\n/** The four concrete operations: what `access.resolve` receives. Never WRITE or ALL. */\nexport type TScopeOperation =\n | typeof ScopeOperations.READ\n | typeof ScopeOperations.CREATE\n | typeof ScopeOperations.UPDATE\n | typeof ScopeOperations.DELETE;\n\n/** All six values: a concrete operation or a group. What `ScopeOperations.includes` takes as its group. */\nexport type TScopeOperationGroup = TConstValue<typeof ScopeOperations>;\n"]}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAEhC;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C,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAiE;QAC/E,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;QAElC,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,CAAC;IACrF,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\n\n/** Default pagination limit for repository queries. */\nexport const DEFAULT_LIMIT = 10;\n\n/**\n * Largest `limit` a caller may ask for when a model declares no `query.limit.max`.\n *\n * POLICY, not capacity - it sits far below what an engine can physically serve. It exists because\n * removing an accidental guardrail without replacing it would leave the framework less safe than\n * before: a search engine refused a page over 250 hits, so `limit: 5000` failed fast and cheap.\n * Once that page is served, something has to decide when a page is unreasonable.\n *\n * 1000 sits above any list screen and well below the physical ceiling, so reaching it means the\n * caller is doing something unusual - and a model raises it by saying so explicitly.\n */\nexport const DEFAULT_MAX_LIMIT = 1000;\n\n/** Defines the operation scope for repository instances (READ_ONLY, WRITE_ONLY, READ_WRITE). */\nexport class RepositoryOperationScopes {\n static readonly READ_ONLY = 'READ_ONLY';\n static readonly WRITE_ONLY = 'WRITE_ONLY';\n static readonly READ_WRITE = 'READ_WRITE';\n static readonly SCHEME_SET = new Set([this.READ_ONLY, this.WRITE_ONLY, this.READ_WRITE]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid repository operation scope values. */\nexport type TRepositoryOperationScope = TConstValue<typeof RepositoryOperationScopes>;\n\n/** What `@repository` binds: MODEL, a model this application declares; REMOTE, data behind another service's API, with no model. */\nexport class RepositoryTypes {\n static readonly MODEL = 'model';\n static readonly REMOTE = 'remote';\n static readonly SCHEME_SET = new Set([this.MODEL, this.REMOTE]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid repository type values. */\nexport type TRepositoryType = TConstValue<typeof RepositoryTypes>;\n\n/** What a row-scope filter (`@model` settings.access) does when `resolve()` returns null/undefined. */\nexport class ScopeFilterMissingBehaviors {\n /** An unresolved scope matches ZERO rows - the safe reading of \"caller's scope is unknown\". */\n static readonly DENY = 'deny';\n /** Explicit opt-out: no scope is applied. For migrations and background jobs, never inferred from a request. */\n static readonly ALLOW = 'allow';\n static readonly SCHEME_SET = new Set([this.DENY, this.ALLOW]);\n\n static isValid(behavior: string): boolean {\n return this.SCHEME_SET.has(behavior);\n }\n}\n\n/** Valid scope-filter missing-behavior values. */\nexport type TScopeFilterMissingBehavior = TConstValue<typeof ScopeFilterMissingBehaviors>;\n\n/**\n * What a scoped write does with a row whose scope column disagrees with the resolved scope\n * (`@model` settings.access.write.mode). A scope that returns `ScopeFilters.UNRESTRICTED`\n * passes either way.\n */\nexport class ScopeWriteGuards {\n /** A row whose scope column disagrees, or is absent on create, is refused and nothing is written. */\n static readonly REJECT = 'reject';\n /** An ABSENT scope column is filled from an equality scope; a value that disagrees is still refused. */\n static readonly ASSIGN = 'assign';\n static readonly SCHEME_SET = new Set([this.REJECT, this.ASSIGN]);\n\n static isValid(guard: string): boolean {\n return this.SCHEME_SET.has(guard);\n }\n}\n\n/** Valid scope write-guard values. */\nexport type TScopeWriteGuard = TConstValue<typeof ScopeWriteGuards>;\n\n/**\n * The third `resolve()` state, beside a `where` and `deny`-by-default null/undefined: unrestricted\n * for THIS call. `onMissing: 'allow'` cannot express it - `onMissing` lives on the model's static\n * settings, so using it for a per-user bypass (an internal operator) would also unscope every\n * ordinary user whose `resolve()` happens to return nothing.\n */\nexport class ScopeFilters {\n /**\n * Return from `resolve()` to apply NO scope for this request - a caller the application has\n * decided sees everything. Deliberately a symbol: forgetting to return must land in deny, and no\n * JSON body, query string, or header can ever produce this value. `Symbol.for` so two installed\n * copies of this package agree on identity, same as `DATA_SOURCE_BRAND`.\n */\n static readonly UNRESTRICTED = Symbol.for('@venizia/ignis-kernel:scope-filter-unrestricted');\n}\n\n/** Machine-readable codes for repository-level failures, in the dotted namespace core already uses (`core.not_supported`, `core.search_engine.*`) - a client maps the code, never the message. */\nexport class RepositoryErrorCodes {\n /** A verb the repository's `operationScope` does not permit (e.g. `create()` on a READ_ONLY one). */\n static readonly OPERATION_NOT_ALLOWED = MessageCode.build({\n parts: ['core', 'repository', 'operation_not_allowed'],\n });\n\n /** A write whose scope column disagrees with the resolved scope, or whose scope cannot be verified (`access` write guard). */\n static readonly SCOPE_WRITE_DENIED = MessageCode.build({\n parts: ['core', 'repository', 'scope_write_denied'],\n });\n}\n\n/** Valid repository error code values. */\nexport type TRepositoryErrorCode = TConstValue<typeof RepositoryErrorCodes>;\n\n/** Entity relation types (one-to-one/many-to-one, one-to-many). */\nexport class RelationTypes {\n static readonly ONE = 'one';\n static readonly MANY = 'many';\n static readonly SCHEME_SET = new Set([this.ONE, this.MANY]);\n\n static isValid(orgType: string): boolean {\n return this.SCHEME_SET.has(orgType);\n }\n}\n\n/** Valid relation type values. */\nexport type TRelationType = TConstValue<typeof RelationTypes>;\n\n/** PostgreSQL row-level lock strengths for SELECT ... FOR <strength>. */\nexport class LockStrengths {\n static readonly UPDATE = 'update';\n static readonly NO_KEY_UPDATE = 'no key update';\n static readonly SHARE = 'share';\n static readonly KEY_SHARE = 'key share';\n static readonly SCHEME_SET = new Set([\n this.UPDATE,\n this.NO_KEY_UPDATE,\n this.SHARE,\n this.KEY_SHARE,\n ]);\n\n static isValid(strength: string): boolean {\n return this.SCHEME_SET.has(strength);\n }\n}\n\n/** Valid lock strength values. */\nexport type TLockStrength = TConstValue<typeof LockStrengths>;\n\n/**\n * What a repository call does to rows, as the row scope (`@model` settings.access) sees it.\n * `access.resolve` receives one CONCRETE operation (READ, CREATE, UPDATE or DELETE), never a group,\n * so one function can answer a wide scope for a read and a narrow one for a write. WRITE and ALL\n * are groups of concrete operations, for application code that asks \"is this a write?\".\n */\nexport class ScopeOperations {\n // concrete: what a repository call is\n static readonly READ = 'read';\n static readonly CREATE = 'create';\n static readonly UPDATE = 'update';\n static readonly DELETE = 'delete';\n\n // groups: sets of concrete operations\n /** CREATE, UPDATE and DELETE. */\n static readonly WRITE = 'write';\n /** Every concrete operation. */\n static readonly ALL = 'all';\n\n /** All six values: the four concrete operations and the two groups. */\n static readonly SCHEME_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n this.WRITE,\n this.ALL,\n ]);\n\n /** The concrete operations: what `access.resolve` can receive. */\n static readonly OPERATION_SET = new Set<string>([\n this.READ,\n this.CREATE,\n this.UPDATE,\n this.DELETE,\n ]);\n\n /** Which concrete operations each group holds. */\n static readonly GROUP_MAP: ReadonlyMap<string, ReadonlySet<string>> = new Map([\n [this.WRITE, new Set<string>([this.CREATE, this.UPDATE, this.DELETE])],\n [this.ALL, this.OPERATION_SET],\n ]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n\n /**\n * Whether `operation` belongs to `group`. A concrete operation includes itself and nothing else;\n * WRITE includes CREATE, UPDATE and DELETE; ALL includes all four.\n */\n static includes(opts: { group: TScopeOperationGroup; operation: TScopeOperation }): boolean {\n const { group, operation } = opts;\n\n return group === operation || (this.GROUP_MAP.get(group)?.has(operation) ?? false);\n }\n}\n\n/** The four concrete operations: what `access.resolve` receives. Never WRITE or ALL. */\nexport type TScopeOperation =\n | typeof ScopeOperations.READ\n | typeof ScopeOperations.CREATE\n | typeof ScopeOperations.UPDATE\n | typeof ScopeOperations.DELETE;\n\n/** All six values: a concrete operation or a group. What `ScopeOperations.includes` takes as its group. */\nexport type TScopeOperationGroup = TConstValue<typeof ScopeOperations>;\n"]}
|
|
@@ -21,7 +21,24 @@ export declare class ScopeThrough<RelationName extends string = string> {
|
|
|
21
21
|
readonly relation: RelationName;
|
|
22
22
|
protected readonly kind = "scope-through";
|
|
23
23
|
private constructor();
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* `entity` is read for its type only: a misspelled relation, a to-many one or a name held in a plain `string` does not compile.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { ScopeThrough } from '@venizia/ignis';
|
|
30
|
+
* import { ModelFactory, one } from '@venizia/ignis-connectors/postgres';
|
|
31
|
+
* import { integer, pgTable, serial } from 'drizzle-orm/pg-core';
|
|
32
|
+
*
|
|
33
|
+
* const productTable = pgTable('Product', { id: serial('id').primaryKey() });
|
|
34
|
+
* const variantTable = pgTable('Variant', {
|
|
35
|
+
* id: serial('id').primaryKey(),
|
|
36
|
+
* productId: integer('product_id').references(() => productTable.id),
|
|
37
|
+
* });
|
|
38
|
+
* const Variant = ModelFactory.defineEntity({ table: variantTable, relations: () => ({ product: one(productTable) }) });
|
|
39
|
+
* const through = ScopeThrough.of({ entity: Variant, relation: 'product' });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
25
42
|
static of<Entity extends IEntityWithRelations, Name extends TOneRelationNameOf<Entity>>(opts: {
|
|
26
43
|
entity: Entity;
|
|
27
44
|
relation: Name;
|
|
@@ -8,7 +8,24 @@ export class ScopeThrough {
|
|
|
8
8
|
this.relation = relation;
|
|
9
9
|
this.kind = 'scope-through';
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* `entity` is read for its type only: a misspelled relation, a to-many one or a name held in a plain `string` does not compile.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { ScopeThrough } from '@venizia/ignis';
|
|
17
|
+
* import { ModelFactory, one } from '@venizia/ignis-connectors/postgres';
|
|
18
|
+
* import { integer, pgTable, serial } from 'drizzle-orm/pg-core';
|
|
19
|
+
*
|
|
20
|
+
* const productTable = pgTable('Product', { id: serial('id').primaryKey() });
|
|
21
|
+
* const variantTable = pgTable('Variant', {
|
|
22
|
+
* id: serial('id').primaryKey(),
|
|
23
|
+
* productId: integer('product_id').references(() => productTable.id),
|
|
24
|
+
* });
|
|
25
|
+
* const Variant = ModelFactory.defineEntity({ table: variantTable, relations: () => ({ product: one(productTable) }) });
|
|
26
|
+
* const through = ScopeThrough.of({ entity: Variant, relation: 'product' });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
12
29
|
static of(opts) {
|
|
13
30
|
return new ScopeThrough(opts.relation);
|
|
14
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope-through.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/scope-through.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAGvB,YAA6B,QAAsB;QAAtB,aAAQ,GAAR,QAAQ,CAAc;QAFhC,SAAI,GAAG,eAAe,CAAC;IAEY,CAAC;IAEvD
|
|
1
|
+
{"version":3,"file":"scope-through.js","sourceRoot":"","sources":["../../../../../src/base/repositories/common/scope-through.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAGvB,YAA6B,QAAsB;QAAtB,aAAQ,GAAR,QAAQ,CAAc;QAFhC,SAAI,GAAG,eAAe,CAAC;IAEY,CAAC;IAEvD;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,EAAE,CAA+E,IAGvF;QACC,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;CACF","sourcesContent":["import { type RelationTypes } from './constants';\n\n/** An entity class that declares its relations by name, as `ModelFactory.defineEntity` builds one. */\ninterface IEntityWithRelations {\n relationDefinitions: Record<string, { type: string }> | undefined;\n}\n\ntype TDefinitionsOf<Entity extends IEntityWithRelations> = NonNullable<\n Entity['relationDefinitions']\n>;\n\n/** The names of the entity's `one` relations: the only ones a child can be scoped through. None, when it declares no relations. */\nexport type TOneRelationNameOf<Entity extends IEntityWithRelations> = [\n TDefinitionsOf<Entity>,\n] extends [never]\n ? never\n : {\n [\n Name in keyof TDefinitionsOf<Entity> & string\n ]: TDefinitionsOf<Entity>[Name]['type'] extends typeof RelationTypes.ONE ? Name : never;\n }[keyof TDefinitionsOf<Entity> & string];\n\n/**\n * The value of `settings.access.through`: scope this model through the parent a `one` relation points at. `of` is the\n * only way to make one: the constructor is private and the class has a member no plain object has, so a hand-written\n * `{ relation: 'x' }` does not compile and the name is always checked against the entity.\n */\nexport class ScopeThrough<RelationName extends string = string> {\n protected readonly kind = 'scope-through';\n\n private constructor(readonly relation: RelationName) {}\n\n /**\n * `entity` is read for its type only: a misspelled relation, a to-many one or a name held in a plain `string` does not compile.\n *\n * @example\n * ```typescript\n * import { ScopeThrough } from '@venizia/ignis';\n * import { ModelFactory, one } from '@venizia/ignis-connectors/postgres';\n * import { integer, pgTable, serial } from 'drizzle-orm/pg-core';\n *\n * const productTable = pgTable('Product', { id: serial('id').primaryKey() });\n * const variantTable = pgTable('Variant', {\n * id: serial('id').primaryKey(),\n * productId: integer('product_id').references(() => productTable.id),\n * });\n * const Variant = ModelFactory.defineEntity({ table: variantTable, relations: () => ({ product: one(productTable) }) });\n * const through = ScopeThrough.of({ entity: Variant, relation: 'product' });\n * ```\n */\n static of<Entity extends IEntityWithRelations, Name extends TOneRelationNameOf<Entity>>(opts: {\n entity: Entity;\n relation: Name;\n }): ScopeThrough<Name> {\n return new ScopeThrough(opts.relation);\n }\n}\n"]}
|
|
@@ -55,18 +55,24 @@ export interface IExtraOptions extends IWithTransaction {
|
|
|
55
55
|
* `until(result)` returns false; on exhaustion the last result is returned as-is.
|
|
56
56
|
*/
|
|
57
57
|
export interface IReadRetryOptions<TResult> {
|
|
58
|
-
/**
|
|
58
|
+
/** @default 3 */
|
|
59
59
|
maxAttempts?: number;
|
|
60
|
-
/** Total budget across attempts AND sleeps.
|
|
60
|
+
/** Total budget in ms across attempts AND sleeps. Unlimited when omitted. */
|
|
61
61
|
maxTotalMs?: number;
|
|
62
62
|
/**
|
|
63
63
|
* Aborts between attempts and during backoff sleeps - pass the request signal so a cancelled
|
|
64
64
|
* request stops retrying.
|
|
65
65
|
*/
|
|
66
66
|
signal?: AbortSignal;
|
|
67
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Backoff between attempts, tuned for replica lag.
|
|
69
|
+
*
|
|
70
|
+
* @default { strategy: RetryBackoffStrategies.EXPONENTIAL, initialDelayMs: 50, maxDelayMs: 500, jitter: RetryJitterModes.EQUAL }
|
|
71
|
+
*/
|
|
68
72
|
backoff?: IRetryBackoffOptions;
|
|
69
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Retry while false. With none given, `findOne` and `findById` retry on a null row and `find` on an empty list.
|
|
75
|
+
*/
|
|
70
76
|
until?: (result: TResult) => boolean;
|
|
71
77
|
}
|
|
72
78
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../src/base/repositories/common/types/options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ITransaction } from '@/base/datasources';\nimport type { IRetryBackoffOptions, TLogLevel } from '@venizia/ignis-helpers/core';\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport type { SQL } from 'drizzle-orm';\nimport type { TLockStrength } from '../constants';\nimport type { TDataWithRange } from './results';\n\n/** Update data supporting both regular fields and JSON path updates via dot notation. */\nexport type TUpdateData<T = any> = Partial<T> & {\n [jsonPath: string]: any;\n};\n\n/** Options for Drizzle ORM query building, used internally by FilterBuilder. */\nexport type TDrizzleQueryOptions = Partial<{\n limit: number;\n offset: number;\n orderBy: SQL[];\n where: SQL;\n with: Record<string, true | TDrizzleQueryOptions>;\n columns: Record<string, boolean>;\n}>;\n\n/** Configuration for repository operation logging. */\nexport type TRepositoryLogOptions = {\n use: boolean;\n level?: TLogLevel;\n};\n\n/** Configuration for row-level lock wait behavior. Mutually exclusive: use noWait OR skipLocked. */\nexport type TLockConfig =\n | { noWait: true; skipLocked?: undefined }\n | { noWait?: undefined; skipLocked: true }\n | { noWait?: undefined; skipLocked?: undefined };\n\n/** Row-level locking options for read operations. */\nexport type TLockOptions = {\n strength: TLockStrength;\n config?: TLockConfig;\n};\n\n/** Neutral transaction association - postgres narrows to its own `IDatabaseTransaction` (via `isDatabaseTransaction`) where it needs `.connector`. */\nexport interface IWithTransaction {\n transaction?: ITransaction;\n}\n\n/** Extended options for repository operations with transaction, logging, and default filter bypass. */\nexport interface IExtraOptions extends IWithTransaction {\n log?: TRepositoryLogOptions;\n\n /** If true, bypass the default filter configured in model settings (e.g., soft delete). */\n shouldSkipDefaultFilter?: boolean;\n\n /** Row-level locking. Requires transaction. Incompatible with include/fields (Query API). */\n lock?: TLockOptions;\n}\n\n/**\n * Read-after-write retry for read verbs behind a replicated pool. The read re-executes while\n * `until(result)` returns false; on exhaustion the last result is returned as-is.\n */\nexport interface IReadRetryOptions<TResult> {\n /**
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../src/base/repositories/common/types/options.ts"],"names":[],"mappings":"","sourcesContent":["import type { ITransaction } from '@/base/datasources';\nimport type { IRetryBackoffOptions, TLogLevel } from '@venizia/ignis-helpers/core';\nimport type { TNullable } from '@venizia/ignis-helpers/common';\nimport type { SQL } from 'drizzle-orm';\nimport type { TLockStrength } from '../constants';\nimport type { TDataWithRange } from './results';\n\n/** Update data supporting both regular fields and JSON path updates via dot notation. */\nexport type TUpdateData<T = any> = Partial<T> & {\n [jsonPath: string]: any;\n};\n\n/** Options for Drizzle ORM query building, used internally by FilterBuilder. */\nexport type TDrizzleQueryOptions = Partial<{\n limit: number;\n offset: number;\n orderBy: SQL[];\n where: SQL;\n with: Record<string, true | TDrizzleQueryOptions>;\n columns: Record<string, boolean>;\n}>;\n\n/** Configuration for repository operation logging. */\nexport type TRepositoryLogOptions = {\n use: boolean;\n level?: TLogLevel;\n};\n\n/** Configuration for row-level lock wait behavior. Mutually exclusive: use noWait OR skipLocked. */\nexport type TLockConfig =\n | { noWait: true; skipLocked?: undefined }\n | { noWait?: undefined; skipLocked: true }\n | { noWait?: undefined; skipLocked?: undefined };\n\n/** Row-level locking options for read operations. */\nexport type TLockOptions = {\n strength: TLockStrength;\n config?: TLockConfig;\n};\n\n/** Neutral transaction association - postgres narrows to its own `IDatabaseTransaction` (via `isDatabaseTransaction`) where it needs `.connector`. */\nexport interface IWithTransaction {\n transaction?: ITransaction;\n}\n\n/** Extended options for repository operations with transaction, logging, and default filter bypass. */\nexport interface IExtraOptions extends IWithTransaction {\n log?: TRepositoryLogOptions;\n\n /** If true, bypass the default filter configured in model settings (e.g., soft delete). */\n shouldSkipDefaultFilter?: boolean;\n\n /** Row-level locking. Requires transaction. Incompatible with include/fields (Query API). */\n lock?: TLockOptions;\n}\n\n/**\n * Read-after-write retry for read verbs behind a replicated pool. The read re-executes while\n * `until(result)` returns false; on exhaustion the last result is returned as-is.\n */\nexport interface IReadRetryOptions<TResult> {\n /** @default 3 */\n maxAttempts?: number;\n\n /** Total budget in ms across attempts AND sleeps. Unlimited when omitted. */\n maxTotalMs?: number;\n\n /**\n * Aborts between attempts and during backoff sleeps - pass the request signal so a cancelled\n * request stops retrying.\n */\n signal?: AbortSignal;\n\n /**\n * Backoff between attempts, tuned for replica lag.\n *\n * @default { strategy: RetryBackoffStrategies.EXPONENTIAL, initialDelayMs: 50, maxDelayMs: 500, jitter: RetryJitterModes.EQUAL }\n */\n backoff?: IRetryBackoffOptions;\n\n /**\n * Retry while false. With none given, `findOne` and `findById` retry on a null row and `find` on an empty list.\n */\n until?: (result: TResult) => boolean;\n}\n\n/**\n * Intersected into READ verb signatures only - a write verb's options type has no `retry`, so an\n * inline `{ retry }` fails to compile and a pre-built object carrying it is inert.\n */\nexport interface IWithReadRetry<TResult> {\n retry?: IReadRetryOptions<TResult>;\n}\n\n/** Options for `find` returning a plain array - the retry predicate sees `Array<R>`. */\nexport type TFindOptions<TOptions extends IExtraOptions, R> = TOptions & {\n shouldQueryRange?: false;\n} & IWithReadRetry<Array<R>>;\n\n/** Options for `find` with the range envelope - the retry predicate sees `{ data, range }`. */\nexport type TFindRangeOptions<TOptions extends IExtraOptions, R> = TOptions & {\n shouldQueryRange: true;\n} & IWithReadRetry<TDataWithRange<R>>;\n\n/** Options for `findOne`/`findById` - the retry predicate sees `TNullable<R>`. */\nexport type TFindOneOptions<TOptions extends IExtraOptions, R> = TOptions &\n IWithReadRetry<TNullable<R>>;\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/** Load order is the point: `@hono/zod-openapi` peers on `zod`, so importing it patches `.openapi()` onto the shared `ZodType` prototype. `QuerySchemaFactory.build` runs at module scope below, and ESM evaluates imports first, so the method exists by the time the decorator is called. Without this import the schemas silently build undecorated whenever this module happens to load before anything else pulls in the OpenAPI layer. */
|
|
2
2
|
import { z } from '@hono/zod-openapi';
|
|
3
|
-
|
|
3
|
+
/** Selected fields: an array of names to include, or a name-to-boolean map. */
|
|
4
|
+
export declare const FieldsSchema: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodBoolean>, z.ZodArray<z.ZodString>]>>;
|
|
5
|
+
/** The whole `filter` query: an object of where, fields, include, order, limit, offset and skip, or a JSON string of one. */
|
|
6
|
+
export declare const FilterSchema: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
4
7
|
where: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>]>>;
|
|
5
8
|
fields: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodBoolean>, z.ZodArray<z.ZodString>]>>;
|
|
6
9
|
include: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -22,10 +25,22 @@ export declare const FieldsSchema: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodSt
|
|
|
22
25
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
23
26
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
24
27
|
skip: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
}, z.core.$strip>>]
|
|
28
|
+
}, z.core.$strip>>]>>;
|
|
29
|
+
/** Relations to include: an array of `{ relation, scope? }` where `scope` is a nested filter. */
|
|
30
|
+
export declare const InclusionSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
26
31
|
relation: z.ZodString;
|
|
27
32
|
scope: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
28
|
-
}, z.core.$strip
|
|
33
|
+
}, z.core.$strip>>>;
|
|
34
|
+
/** Maximum number of rows; a non-negative integer. */
|
|
35
|
+
export declare const LimitSchema: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
/** Number of rows to offset; a non-negative integer. */
|
|
37
|
+
export declare const OffsetSchema: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
/** Sort order: an array of strings such as `'createdAt ASC'`. */
|
|
39
|
+
export declare const OrderBySchema: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
40
|
+
/** Number of rows to skip; a non-negative integer. */
|
|
41
|
+
export declare const SkipSchema: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
/** Query conditions, with nested AND/OR. */
|
|
43
|
+
export declare const WhereSchema: z.ZodUnion<readonly [z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>, z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>]>;
|
|
29
44
|
/**
|
|
30
45
|
* The query shape of a route that accepts a `filter`. The framework's own `find`, `findById` and
|
|
31
46
|
* `findOne` use it, and a hand-written route gets the same contract by naming it.
|