rlz-engine 1.0.55 → 1.0.57

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 CHANGED
@@ -32,7 +32,7 @@ Each backend feature lives in a cohesive directory and exposes an uppercase `<FE
32
32
  | Module | Facets | Purpose |
33
33
  | --------------- | ----------------------------------------- | ------------------------------------------------------------------- |
34
34
  | `AUTH_MODULE` | `makeRpc(storage, options?)`, `makeCli()` | Signup/signin/session/logout RPC endpoints and admin secret command |
35
- | `HTTP_MODULE` | `makeCli(params, init)` | `http start` server command |
35
+ | `HTTP_MODULE` | `makeCli(params, options?)` | `http start` server command |
36
36
  | `LOGGER_MODULE` | `makeCli()`, `makeAdmRpc()` | Audit-log reader command and protected audit query endpoint |
37
37
  | `RPC_MODULE` | `makeDevCli(options)` | Generate user and administrative RPC clients during development |
38
38
 
@@ -50,8 +50,12 @@ import { HTTP_MODULE } from 'rlz-engine/back/http/module.js'
50
50
  import { LOGGER_MODULE } from 'rlz-engine/back/logger/module.js'
51
51
  import { RPC_MODULE } from 'rlz-engine/back/rpc/module.js'
52
52
 
53
+ const applicationPlugin = async (server) => {
54
+ await server.register(applicationRoutes)
55
+ }
56
+
53
57
  const applicationModules = composeModules({
54
- cli: [AUTH_MODULE.makeCli(), HTTP_MODULE.makeCli(serverParams, initializeRoutes), LOGGER_MODULE.makeCli()],
58
+ cli: [AUTH_MODULE.makeCli(), HTTP_MODULE.makeCli(serverParams, { plugins: [applicationPlugin] }), LOGGER_MODULE.makeCli()],
55
59
  rpc: userRpcPlugins,
56
60
  admRpc: [LOGGER_MODULE.makeAdmRpc()]
57
61
  })
@@ -59,12 +63,6 @@ const applicationModules = composeModules({
59
63
  const cli = applicationModules.registerCli(new CliEngine('app.js'))
60
64
  await cli.run()
61
65
 
62
- async function initializeRoutes(server) {
63
- await applicationModules.registerRpc(server)
64
- await applicationModules.registerAdmRpc(server)
65
- // Register application-owned routes and plugins here.
66
- }
67
-
68
66
  const devModules = composeModules({
69
67
  devCli: [
70
68
  RPC_MODULE.makeDevCli({
@@ -81,7 +79,7 @@ await devCli.run()
81
79
 
82
80
  `composeModules()` accepts any combination of `cli`, `devCli`, `rpc`, and `admRpc` arrays; omit facets the application does not use. For RPC builders that need Fastify plugin options, provide `rpcOptions` or `admRpcOptions`, keyed by each builder's `name` (for example, `{ audit: { workingDirectory: appDirectory } }`). The returned object has `registerCli()`, `registerDevCli()`, `registerRpc()`, and `registerAdmRpc()` methods. RPC registration methods are asynchronous and register plugins in array order. Duplicate module or plugin names within the same category throw during composition. Operational and development commands remain separate so client generation does not need to be included in production command setup. Each engine generates nested help from module and command descriptions. For example, `app.js --help`, `app.js http --help`, and `app.js http start --help` show progressively narrower command help.
83
81
 
84
- `AUTH_MODULE.makeRpc(storage, options?)` requires an initialized `AuthStorage` and returns the authentication RPC builder. `AUTH_MODULE.makeCli(workingDirectory?)` accepts a directory or a callback returning one; it defaults to the current working directory. `HTTP_MODULE.makeCli(params, init)` accepts `RunServerParams` without `init`, or a callback that returns those settings, and the route initialization callback. `LOGGER_MODULE.makeCli(workingDirectory?)` accepts the directory containing `logs.sqlite` and defaults to the current working directory. `RPC_MODULE.makeDevCli(options)` requires at least one user or administrative RPC builder and an output path for each configured builder kind.
82
+ `AUTH_MODULE.makeRpc(storage, options?)` requires an initialized `AuthStorage` and returns the authentication RPC builder. `AUTH_MODULE.makeCli(workingDirectory?)` accepts a directory or a callback returning one; it defaults to the current working directory. `HTTP_MODULE.makeCli(params, options?)` accepts `RunServerParams` without `plugins`, or a callback that returns those settings. `options.plugins` lists Fastify plugins registered on each server; no server initialization callback is needed. `options.before` runs after settings resolve and before server startup; `options.after` runs after the server is listening and receives its shutdown function. If `before` fails, the server is not started. If `after` fails, the module shuts down the server before rethrowing. These hooks let applications attach lifecycle work without replacing the built-in HTTP command. `LOGGER_MODULE.makeCli(workingDirectory?)` accepts the directory containing `logs.sqlite` and defaults to the current working directory. `RPC_MODULE.makeDevCli(options)` requires at least one user or administrative RPC builder and an output path for each configured builder kind.
85
83
 
86
84
  ## HTTP server
87
85
 
@@ -95,13 +93,11 @@ await runServer({
95
93
  domain: 'example.com',
96
94
  certDir: './certs',
97
95
  staticDir: './dist',
98
- init: async (server) => {
99
- // Register application routes and plugins here.
100
- }
96
+ plugins: [applicationPlugin]
101
97
  })
102
98
  ```
103
99
 
104
- `domain`, `certDir`, `staticDir`, and `init` are required. Optional settings include `debug`, `unsecurePort`, `securePort`, `auditRetentionMs`, `auditMaxRecords`, `auditSqlite`, and `acmeProvider`. Development serves HTTP with CORS and static files. Production runs an HTTP-01 challenge and redirect server alongside a TLS server with HTTP/2 and HTTP/1 support, and renews certificates periodically. CORS is available only in development and does not allow credentials; production serves static files and RPC from the same HTTPS origin. The returned shutdown function closes the servers and logging storage. The `http start` CLI command keeps the process active until a termination signal.
100
+ `domain`, `certDir`, and `staticDir` are required. Optional settings include `debug`, `unsecurePort`, `securePort`, `auditRetentionMs`, `auditMaxRecords`, `auditSqlite`, `acmeProvider`, and `plugins`. Development serves HTTP with CORS and static files. Production runs an HTTP-01 challenge and redirect server alongside a TLS server with HTTP/2 and HTTP/1 support, and renews certificates periodically. CORS is available only in development and does not allow credentials; production serves static files and RPC from the same HTTPS origin. The returned shutdown function closes the servers and logging storage. The `http start` CLI command keeps the process active until a termination signal.
105
101
 
106
102
  By default, non-debug production writes audit logs to `logs.sqlite`. Development and debug mode use colored console output. Set `auditSqlite: true` (or pass `--audit-sqlite` to `http start`) to write SQLite records alongside console output. Retention defaults to 30 days and the maximum record count defaults to 100,000.
107
103
 
@@ -137,11 +133,12 @@ export const adminRpc = admRpc('operations').add({
137
133
  })
138
134
  ```
139
135
 
140
- Register the generated Fastify plugins from the application initialization callback:
136
+ Pass the generated Fastify plugins to `HTTP_MODULE`; the engine registers them on both development and production servers:
141
137
 
142
138
  ```ts
143
- await server.register(userRpc.makeFastifyPlugin())
144
- await server.register(adminRpc.makeFastifyPlugin())
139
+ HTTP_MODULE.makeCli(serverParams, {
140
+ plugins: [userRpc.makeFastifyPlugin(), adminRpc.makeFastifyPlugin()]
141
+ })
145
142
  ```
146
143
 
147
144
  User endpoints are served at `/rpc/<plugin>_<endpoint>_v<version>`. Authenticated user routes use cookie sessions and require both a session authenticator and a CSRF verifier.
@@ -0,0 +1,2 @@
1
+ import { Ajv } from 'ajv';
2
+ export declare function configureAjvFormats(ajv: Ajv): Ajv;
@@ -0,0 +1,14 @@
1
+ import formatsPlugin from 'ajv-formats';
2
+ export function configureAjvFormats(ajv) {
3
+ if (ajv.getKeyword('formatMaximum') === undefined) {
4
+ formatsPlugin.default(ajv);
5
+ }
6
+ else {
7
+ formatsPlugin.default(ajv, { keywords: false });
8
+ }
9
+ if (ajv.formats?.uuid === undefined) {
10
+ ajv.addFormat('uuid', /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i);
11
+ }
12
+ return ajv;
13
+ }
14
+ //# sourceMappingURL=ajv-formats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ajv-formats.js","sourceRoot":"","sources":["../../../src/back/http/ajv-formats.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,aAAa,CAAA;AAEvC,MAAM,UAAU,mBAAmB,CAAC,GAAQ;IACxC,IAAI,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,KAAK,SAAS,EAAE,CAAC;QAChD,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC9B,CAAC;SAAM,CAAC;QACJ,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAA;IACnD,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,4EAA4E,CAAC,CAAA;IACvG,CAAC;IAED,OAAO,GAAG,CAAA;AACd,CAAC"}
@@ -1,7 +1,17 @@
1
- import { InitServerFuncType, RunServerParams } from './server.js';
1
+ import type { FastifyPluginAsync, FastifyPluginCallback } from 'fastify';
2
+ import { RunServerParams } from './server.js';
2
3
  import { CliModule } from '../cli/cli-engine.js';
3
- /** Fastify lifecycle feature; applications provide deployment settings and route setup. */
4
+ export type HttpServerShutdown = () => Promise<void>;
5
+ export interface HttpModuleOptions {
6
+ /** Fastify plugins registered on each server before application routes. */
7
+ plugins?: readonly (FastifyPluginAsync | FastifyPluginCallback)[];
8
+ /** Runs after resolving server settings and before creating the server. */
9
+ before?: () => void | Promise<void>;
10
+ /** Runs after the server is listening. */
11
+ after?: (shutdown: HttpServerShutdown) => void | Promise<void>;
12
+ }
13
+ /** Fastify lifecycle feature; applications provide deployment settings and plugins. */
4
14
  export declare const HTTP_MODULE: {
5
15
  /** Create the `http start` command using application-owned server configuration. */
6
- makeCli(params: Omit<RunServerParams, 'init'> | (() => Omit<RunServerParams, 'init'>), init: InitServerFuncType): CliModule;
16
+ makeCli(params: Omit<RunServerParams, 'plugins'> | (() => Omit<RunServerParams, 'plugins'>), options?: HttpModuleOptions): CliModule;
7
17
  };
@@ -1,15 +1,15 @@
1
1
  import { flag } from 'cmd-ts';
2
2
  import { runServer } from './server.js';
3
- /** Fastify lifecycle feature; applications provide deployment settings and route setup. */
3
+ /** Fastify lifecycle feature; applications provide deployment settings and plugins. */
4
4
  export const HTTP_MODULE = {
5
5
  /** Create the `http start` command using application-owned server configuration. */
6
- makeCli(params, init) {
6
+ makeCli(params, options = {}) {
7
7
  return {
8
8
  name: 'http',
9
9
  description: 'Start the application HTTP server.',
10
10
  commands: {
11
11
  start: {
12
- description: 'Start the Fastify server using the deployment settings and route initialization supplied by the application. The process remains active until it receives a termination signal.',
12
+ description: 'Start the Fastify server using the deployment settings and plugins supplied by the application. The process remains active until it receives a termination signal.',
13
13
  args: {
14
14
  debug: flag({ long: 'debug', description: 'Enable debug logging.' }),
15
15
  auditSqlite: flag({
@@ -19,12 +19,20 @@ export const HTTP_MODULE = {
19
19
  },
20
20
  handler: async ({ debug, auditSqlite }) => {
21
21
  const serverParams = typeof params === 'function' ? params() : params;
22
- await runServer({
22
+ await options.before?.();
23
+ const shutdown = await runServer({
23
24
  ...serverParams,
24
25
  debug: debug || serverParams.debug,
25
26
  auditSqlite: auditSqlite || serverParams.auditSqlite,
26
- init
27
+ plugins: options.plugins
27
28
  });
29
+ try {
30
+ await options.after?.(shutdown);
31
+ }
32
+ catch (error) {
33
+ await shutdown();
34
+ throw error;
35
+ }
28
36
  }
29
37
  }
30
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../src/back/http/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAuC,SAAS,EAAE,MAAM,aAAa,CAAA;AAG5E,2FAA2F;AAC3F,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,oFAAoF;IACpF,OAAO,CAAC,MAA6E,EAAE,IAAwB;QAC3G,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,oCAAoC;YACjD,QAAQ,EAAE;gBACN,KAAK,EAAE;oBACH,WAAW,EACP,iLAAiL;oBACrL,IAAI,EAAE;wBACF,KAAK,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;wBACpE,WAAW,EAAE,IAAI,CAAC;4BACd,IAAI,EAAE,cAAc;4BACpB,WAAW,EAAE,kEAAkE;yBAClF,CAAC;qBACL;oBACD,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE;wBACtC,MAAM,YAAY,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAA;wBACrE,MAAM,SAAS,CAAC;4BACZ,GAAG,YAAY;4BACf,KAAK,EAAE,KA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,CAAC,CAAA;wBACF,IAAI,CAAC;4BACD,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,CAAA;wBACnC,CAAC;wBAAC,OAAO,KAAK,EAAE,CAAC;4BACb,MAAM,QAAQ,EAAE,CAAA;4BAChB,MAAM,KAAK,CAAA;wBACf,CAAC;oBACL,CAAC;iBACJ;aACJ;SACJ,CAAA;IACL,CAAC;CACJ,CAAA"}
@@ -1,6 +1,5 @@
1
- import { FastifyBaseLogger, FastifyInstance, RawReplyDefaultExpression, RawRequestDefaultExpression, RawServerBase } from 'fastify';
1
+ import { FastifyPluginAsync, FastifyPluginCallback } from 'fastify';
2
2
  import { type AcmeProvider } from 'fastify-acme';
3
- export type InitServerFuncType = <S extends RawServerBase>(server: FastifyInstance<S, RawRequestDefaultExpression<S>, RawReplyDefaultExpression<S>, FastifyBaseLogger>) => Promise<void>;
4
3
  export interface RunServerParams {
5
4
  production: boolean;
6
5
  debug?: boolean;
@@ -17,6 +16,7 @@ export interface RunServerParams {
17
16
  /** Certificate authority used for ACME issuance and renewal. Defaults to Let's Encrypt. */
18
17
  acmeProvider?: AcmeProvider;
19
18
  staticDir: string;
20
- init: InitServerFuncType;
19
+ /** Application routes and integrations, installed on each server instance. */
20
+ plugins?: readonly (FastifyPluginAsync | FastifyPluginCallback)[];
21
21
  }
22
- export declare function runServer({ production, debug, domain, certDir, auditRetentionMs, auditMaxRecords, auditSqlite, acmeProvider, staticDir, securePort, unsecurePort, init }: RunServerParams): Promise<() => Promise<void>>;
22
+ export declare function runServer({ production, debug, domain, certDir, auditRetentionMs, auditMaxRecords, auditSqlite, acmeProvider, staticDir, securePort, unsecurePort, plugins }: RunServerParams): Promise<() => Promise<void>>;
@@ -4,26 +4,18 @@ import fastifyCors from '@fastify/cors';
4
4
  import { fastifyResponseValidation } from '@fastify/response-validation';
5
5
  import fastifySensible, { httpErrors } from '@fastify/sensible';
6
6
  import fastifyStatic from '@fastify/static';
7
- import formatsPlugin from 'ajv-formats';
8
7
  import fastify from 'fastify';
9
8
  import { fastifyAcmeSecurePlugin, fastifyAcmeUnsecurePlugin, getCertAndKey } from 'fastify-acme';
10
9
  import { createReadStream } from 'fs';
11
10
  import { installIntoGlobal } from 'iterator-helpers-polyfill';
12
11
  import path from 'path';
12
+ import { configureAjvFormats } from './ajv-formats.js';
13
13
  import { initAuditLogger } from '../logger/audit-logger.js';
14
14
  import { getSystemLogger } from '../logger/system-logger.js';
15
15
  const DEFAULT_AUDIT_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
16
16
  const DEFAULT_AUDIT_MAX_RECORDS = 100_000;
17
- const ajvFormatsPlugin = (ajv) => {
18
- if (ajv.getKeyword('formatMaximum') === undefined)
19
- formatsPlugin.default(ajv);
20
- if (ajv.formats?.uuid === undefined) {
21
- ajv.addFormat('uuid', /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i);
22
- }
23
- return ajv;
24
- };
25
17
  installIntoGlobal();
26
- export async function runServer({ production, debug = false, domain, certDir, auditRetentionMs = DEFAULT_AUDIT_RETENTION_MS, auditMaxRecords = DEFAULT_AUDIT_MAX_RECORDS, auditSqlite = false, acmeProvider, staticDir, securePort, unsecurePort, init }) {
18
+ export async function runServer({ production, debug = false, domain, certDir, auditRetentionMs = DEFAULT_AUDIT_RETENTION_MS, auditMaxRecords = DEFAULT_AUDIT_MAX_RECORDS, auditSqlite = false, acmeProvider, staticDir, securePort, unsecurePort, plugins = [] }) {
27
19
  const sqliteConfig = { path: path.resolve('logs.sqlite'), retentionMs: auditRetentionMs, maxRecords: auditMaxRecords };
28
20
  const auditLoggerConfig = production && !debug
29
21
  ? { mode: 'sqlite', ...sqliteConfig }
@@ -37,7 +29,7 @@ export async function runServer({ production, debug = false, domain, certDir, au
37
29
  const httpServer = fastify({
38
30
  loggerInstance: getSystemLogger('http', { debug }),
39
31
  ajv: {
40
- plugins: [ajvFormatsPlugin],
32
+ plugins: [configureAjvFormats],
41
33
  customOptions: { useDefaults: false, coerceTypes: false, allErrors: true, verbose: true }
42
34
  }
43
35
  });
@@ -49,9 +41,9 @@ export async function runServer({ production, debug = false, domain, certDir, au
49
41
  await httpServer.register(fastifyCompress);
50
42
  await httpServer.register(fastifySensible);
51
43
  await httpServer.register(fastifyResponseValidation, {
52
- ajv: { plugins: [ajvFormatsPlugin], useDefaults: false, coerceTypes: false, allErrors: true, verbose: true }
44
+ ajv: { plugins: [configureAjvFormats], useDefaults: false, coerceTypes: false, allErrors: true, verbose: true }
53
45
  });
54
- await init(httpServer);
46
+ await registerPlugins(httpServer, plugins);
55
47
  addStaticEndpoints(httpServer, staticDir);
56
48
  await httpServer.listen({ port: unsecurePort ?? 8080 });
57
49
  return async () => {
@@ -77,7 +69,7 @@ export async function runServer({ production, debug = false, domain, certDir, au
77
69
  },
78
70
  loggerInstance: getSystemLogger('https', { debug }),
79
71
  ajv: {
80
- plugins: [ajvFormatsPlugin],
72
+ plugins: [configureAjvFormats],
81
73
  customOptions: { useDefaults: false, coerceTypes: false, allErrors: true, verbose: true }
82
74
  }
83
75
  });
@@ -90,9 +82,9 @@ export async function runServer({ production, debug = false, domain, certDir, au
90
82
  await httpsServer.register(fastifyCompress);
91
83
  await httpsServer.register(fastifySensible);
92
84
  await httpsServer.register(fastifyResponseValidation, {
93
- ajv: { plugins: [ajvFormatsPlugin], useDefaults: false, coerceTypes: false, allErrors: true, verbose: true }
85
+ ajv: { plugins: [configureAjvFormats], useDefaults: false, coerceTypes: false, allErrors: true, verbose: true }
94
86
  });
95
- await init(httpsServer);
87
+ await registerPlugins(httpsServer, plugins);
96
88
  httpsServer.all('/rpc/*', async () => {
97
89
  return httpErrors.notFound();
98
90
  });
@@ -113,6 +105,11 @@ export async function runServer({ production, debug = false, domain, certDir, au
113
105
  throw error;
114
106
  }
115
107
  }
108
+ async function registerPlugins(server, plugins) {
109
+ for (const plugin of plugins) {
110
+ await server.register(plugin);
111
+ }
112
+ }
116
113
  function addStaticEndpoints(server, staticPath) {
117
114
  const absStaticPath = path.resolve(staticPath);
118
115
  const absIndexPath = path.join(absStaticPath, 'index.html');
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/back/http/server.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,WAAW,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAA;AACxE,OAAO,eAAe,EAAE,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAE3C,OAAO,aAAa,MAAM,aAAa,CAAA;AACvC,OAAO,OAAsH,MAAM,SAAS,CAAA;AAC5I,OAAO,EAAqB,uBAAuB,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACnH,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,EAA0B,eAAe,EAAE,MAAM,2BAA2B,CAAA;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAE5D,MAAM,0BAA0B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAC3D,MAAM,yBAAyB,GAAG,OAAO,CAAA;AAEzC,MAAM,gBAAgB,GAAG,CAAC,GAAQ,EAAE,EAAE;IAClC,IAAI,GAAG,CAAC,UAAU,CAAC,eAAe,CAAC,KAAK,SAAS;QAAE,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC7E,IAAI,GAAG,CAAC,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,CAAC;QAClC,GAAG,CAAC,SAAS,CAA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E,EAAE,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;YAChE,CAAC;oBAAS,CAAC;gBACP,gBAAgB,EAAE,CAAA;YACtB,CAAC;QACL,CAAC,CAAA;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,gBAAgB,EAAE,CAAA;QAClB,MAAM,KAAK,CAAA;IACf,CAAC;AACL,CAAC;AAED,KAAK,UAAU,eAAe,CAC1B,MAA2G,EAC3G,OAAgE;IAEhE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB,CACvB,MAA2G,EAC3G,UAAkB;IAElB,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAA;IAE3D,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE;QAClB,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;QAClD,CAAC,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YACtC,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAA;QACrE,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rlz-engine",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "Deps and tools for my style of development",
5
5
  "engines": {
6
6
  "node": ">=22.13.0"