@gettersethya/mira 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/dist/src/app/app.d.ts +100 -0
- package/dist/src/app/app.d.ts.map +1 -0
- package/dist/src/app/app.js +176 -0
- package/dist/src/app/app.js.map +1 -0
- package/dist/src/app/builder.d.ts +106 -0
- package/dist/src/app/builder.d.ts.map +1 -0
- package/dist/src/app/builder.js +122 -0
- package/dist/src/app/builder.js.map +1 -0
- package/dist/src/app/index.d.ts +33 -0
- package/dist/src/app/index.d.ts.map +1 -0
- package/dist/src/app/index.js +30 -0
- package/dist/src/app/index.js.map +1 -0
- package/dist/src/app/plugin.d.ts +60 -0
- package/dist/src/app/plugin.d.ts.map +1 -0
- package/dist/src/app/plugin.js +20 -0
- package/dist/src/app/plugin.js.map +1 -0
- package/dist/src/app/types.d.ts +55 -0
- package/dist/src/app/types.d.ts.map +1 -0
- package/dist/src/app/types.js +2 -0
- package/dist/src/app/types.js.map +1 -0
- package/dist/src/cache/cached-collection.d.ts +30 -0
- package/dist/src/cache/cached-collection.d.ts.map +1 -0
- package/dist/src/cache/cached-collection.js +107 -0
- package/dist/src/cache/cached-collection.js.map +1 -0
- package/dist/src/cache/collection-cache.d.ts +17 -0
- package/dist/src/cache/collection-cache.d.ts.map +1 -0
- package/dist/src/cache/collection-cache.js +37 -0
- package/dist/src/cache/collection-cache.js.map +1 -0
- package/dist/src/cache/index.d.ts +4 -0
- package/dist/src/cache/index.d.ts.map +1 -0
- package/dist/src/cache/index.js +3 -0
- package/dist/src/cache/index.js.map +1 -0
- package/dist/src/cache/types.d.ts +12 -0
- package/dist/src/cache/types.d.ts.map +1 -0
- package/dist/src/cache/types.js +2 -0
- package/dist/src/cache/types.js.map +1 -0
- package/dist/src/collection-service/collection-service.d.ts +62 -0
- package/dist/src/collection-service/collection-service.d.ts.map +1 -0
- package/dist/src/collection-service/collection-service.js +289 -0
- package/dist/src/collection-service/collection-service.js.map +1 -0
- package/dist/src/collection-service/context.d.ts +19 -0
- package/dist/src/collection-service/context.d.ts.map +1 -0
- package/dist/src/collection-service/context.js +2 -0
- package/dist/src/collection-service/context.js.map +1 -0
- package/dist/src/collection-service/decode.d.ts +6 -0
- package/dist/src/collection-service/decode.d.ts.map +1 -0
- package/dist/src/collection-service/decode.js +26 -0
- package/dist/src/collection-service/decode.js.map +1 -0
- package/dist/src/collection-service/errors.d.ts +67 -0
- package/dist/src/collection-service/errors.d.ts.map +1 -0
- package/dist/src/collection-service/errors.js +43 -0
- package/dist/src/collection-service/errors.js.map +1 -0
- package/dist/src/collection-service/index.d.ts +5 -0
- package/dist/src/collection-service/index.d.ts.map +1 -0
- package/dist/src/collection-service/index.js +3 -0
- package/dist/src/collection-service/index.js.map +1 -0
- package/dist/src/collection-service/input-schema.d.ts +10 -0
- package/dist/src/collection-service/input-schema.d.ts.map +1 -0
- package/dist/src/collection-service/input-schema.js +123 -0
- package/dist/src/collection-service/input-schema.js.map +1 -0
- package/dist/src/collection-service/where.d.ts +35 -0
- package/dist/src/collection-service/where.d.ts.map +1 -0
- package/dist/src/collection-service/where.js +91 -0
- package/dist/src/collection-service/where.js.map +1 -0
- package/dist/src/config/config.d.ts +44 -0
- package/dist/src/config/config.d.ts.map +1 -0
- package/dist/src/config/config.js +89 -0
- package/dist/src/config/config.js.map +1 -0
- package/dist/src/config/index.d.ts +3 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/index.js +2 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/types.d.ts +29 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config/types.js +2 -0
- package/dist/src/config/types.js.map +1 -0
- package/dist/src/crypto/crypto.d.ts +11 -0
- package/dist/src/crypto/crypto.d.ts.map +1 -0
- package/dist/src/crypto/crypto.js +4 -0
- package/dist/src/crypto/crypto.js.map +1 -0
- package/dist/src/crypto/index.d.ts +3 -0
- package/dist/src/crypto/index.d.ts.map +1 -0
- package/dist/src/crypto/index.js +3 -0
- package/dist/src/crypto/index.js.map +1 -0
- package/dist/src/crypto/node.d.ts +4 -0
- package/dist/src/crypto/node.d.ts.map +1 -0
- package/dist/src/crypto/node.js +9 -0
- package/dist/src/crypto/node.js.map +1 -0
- package/dist/src/databases/index.d.ts +2 -0
- package/dist/src/databases/index.d.ts.map +1 -0
- package/dist/src/databases/index.js +2 -0
- package/dist/src/databases/index.js.map +1 -0
- package/dist/src/databases/sqlite.d.ts +24 -0
- package/dist/src/databases/sqlite.d.ts.map +1 -0
- package/dist/src/databases/sqlite.js +27 -0
- package/dist/src/databases/sqlite.js.map +1 -0
- package/dist/src/hooks/hook-collection.d.ts +5 -0
- package/dist/src/hooks/hook-collection.d.ts.map +1 -0
- package/dist/src/hooks/hook-collection.js +77 -0
- package/dist/src/hooks/hook-collection.js.map +1 -0
- package/dist/src/hooks/hook-service.d.ts +33 -0
- package/dist/src/hooks/hook-service.d.ts.map +1 -0
- package/dist/src/hooks/hook-service.js +118 -0
- package/dist/src/hooks/hook-service.js.map +1 -0
- package/dist/src/hooks/index.d.ts +4 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/index.js +3 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/types.d.ts +52 -0
- package/dist/src/hooks/types.d.ts.map +1 -0
- package/dist/src/hooks/types.js +2 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/http/auth-node.d.ts +4 -0
- package/dist/src/http/auth-node.d.ts.map +1 -0
- package/dist/src/http/auth-node.js +34 -0
- package/dist/src/http/auth-node.js.map +1 -0
- package/dist/src/http/auth.d.ts +40 -0
- package/dist/src/http/auth.d.ts.map +1 -0
- package/dist/src/http/auth.js +76 -0
- package/dist/src/http/auth.js.map +1 -0
- package/dist/src/http/errors.d.ts +31 -0
- package/dist/src/http/errors.d.ts.map +1 -0
- package/dist/src/http/errors.js +36 -0
- package/dist/src/http/errors.js.map +1 -0
- package/dist/src/http/file-serve.d.ts +10 -0
- package/dist/src/http/file-serve.d.ts.map +1 -0
- package/dist/src/http/file-serve.js +159 -0
- package/dist/src/http/file-serve.js.map +1 -0
- package/dist/src/http/file-token.d.ts +7 -0
- package/dist/src/http/file-token.d.ts.map +1 -0
- package/dist/src/http/file-token.js +57 -0
- package/dist/src/http/file-token.js.map +1 -0
- package/dist/src/http/files.d.ts +11 -0
- package/dist/src/http/files.d.ts.map +1 -0
- package/dist/src/http/files.js +85 -0
- package/dist/src/http/files.js.map +1 -0
- package/dist/src/http/index.d.ts +11 -0
- package/dist/src/http/index.d.ts.map +1 -0
- package/dist/src/http/index.js +9 -0
- package/dist/src/http/index.js.map +1 -0
- package/dist/src/http/ip-middleware.d.ts +4 -0
- package/dist/src/http/ip-middleware.d.ts.map +1 -0
- package/dist/src/http/ip-middleware.js +24 -0
- package/dist/src/http/ip-middleware.js.map +1 -0
- package/dist/src/http/params.d.ts +15 -0
- package/dist/src/http/params.d.ts.map +1 -0
- package/dist/src/http/params.js +48 -0
- package/dist/src/http/params.js.map +1 -0
- package/dist/src/http/router.d.ts +11 -0
- package/dist/src/http/router.d.ts.map +1 -0
- package/dist/src/http/router.js +300 -0
- package/dist/src/http/router.js.map +1 -0
- package/dist/src/http/schema.d.ts +5 -0
- package/dist/src/http/schema.d.ts.map +1 -0
- package/dist/src/http/schema.js +17 -0
- package/dist/src/http/schema.js.map +1 -0
- package/dist/src/http/server-factory-node.d.ts +4 -0
- package/dist/src/http/server-factory-node.d.ts.map +1 -0
- package/dist/src/http/server-factory-node.js +8 -0
- package/dist/src/http/server-factory-node.js.map +1 -0
- package/dist/src/http/server-factory.d.ts +11 -0
- package/dist/src/http/server-factory.d.ts.map +1 -0
- package/dist/src/http/server-factory.js +4 -0
- package/dist/src/http/server-factory.js.map +1 -0
- package/dist/src/http/telemetry-routes.d.ts +5 -0
- package/dist/src/http/telemetry-routes.d.ts.map +1 -0
- package/dist/src/http/telemetry-routes.js +156 -0
- package/dist/src/http/telemetry-routes.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +22 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/migrator/dialect-sqlite.d.ts +9 -0
- package/dist/src/migrator/dialect-sqlite.d.ts.map +1 -0
- package/dist/src/migrator/dialect-sqlite.js +102 -0
- package/dist/src/migrator/dialect-sqlite.js.map +1 -0
- package/dist/src/migrator/dialect.d.ts +24 -0
- package/dist/src/migrator/dialect.d.ts.map +1 -0
- package/dist/src/migrator/dialect.js +5 -0
- package/dist/src/migrator/dialect.js.map +1 -0
- package/dist/src/migrator/index.d.ts +8 -0
- package/dist/src/migrator/index.d.ts.map +1 -0
- package/dist/src/migrator/index.js +6 -0
- package/dist/src/migrator/index.js.map +1 -0
- package/dist/src/migrator/migrator.d.ts +36 -0
- package/dist/src/migrator/migrator.d.ts.map +1 -0
- package/dist/src/migrator/migrator.js +200 -0
- package/dist/src/migrator/migrator.js.map +1 -0
- package/dist/src/migrator/schema-diff.d.ts +25 -0
- package/dist/src/migrator/schema-diff.d.ts.map +1 -0
- package/dist/src/migrator/schema-diff.js +157 -0
- package/dist/src/migrator/schema-diff.js.map +1 -0
- package/dist/src/migrator/types.d.ts +91 -0
- package/dist/src/migrator/types.d.ts.map +1 -0
- package/dist/src/migrator/types.js +13 -0
- package/dist/src/migrator/types.js.map +1 -0
- package/dist/src/platforms/node.d.ts +40 -0
- package/dist/src/platforms/node.d.ts.map +1 -0
- package/dist/src/platforms/node.js +45 -0
- package/dist/src/platforms/node.js.map +1 -0
- package/dist/src/repository/id.d.ts +5 -0
- package/dist/src/repository/id.d.ts.map +1 -0
- package/dist/src/repository/id.js +9 -0
- package/dist/src/repository/id.js.map +1 -0
- package/dist/src/repository/index.d.ts +3 -0
- package/dist/src/repository/index.d.ts.map +1 -0
- package/dist/src/repository/index.js +2 -0
- package/dist/src/repository/index.js.map +1 -0
- package/dist/src/repository/repository.d.ts +53 -0
- package/dist/src/repository/repository.d.ts.map +1 -0
- package/dist/src/repository/repository.js +150 -0
- package/dist/src/repository/repository.js.map +1 -0
- package/dist/src/repository/types.d.ts +42 -0
- package/dist/src/repository/types.d.ts.map +1 -0
- package/dist/src/repository/types.js +2 -0
- package/dist/src/repository/types.js.map +1 -0
- package/dist/src/rule/compiler.d.ts +52 -0
- package/dist/src/rule/compiler.d.ts.map +1 -0
- package/dist/src/rule/compiler.js +115 -0
- package/dist/src/rule/compiler.js.map +1 -0
- package/dist/src/rule/enforcer.d.ts +47 -0
- package/dist/src/rule/enforcer.d.ts.map +1 -0
- package/dist/src/rule/enforcer.js +60 -0
- package/dist/src/rule/enforcer.js.map +1 -0
- package/dist/src/rule/index.d.ts +3 -0
- package/dist/src/rule/index.d.ts.map +1 -0
- package/dist/src/rule/index.js +3 -0
- package/dist/src/rule/index.js.map +1 -0
- package/dist/src/storage/index.d.ts +3 -0
- package/dist/src/storage/index.d.ts.map +1 -0
- package/dist/src/storage/index.js +3 -0
- package/dist/src/storage/index.js.map +1 -0
- package/dist/src/storage/local-preset.d.ts +21 -0
- package/dist/src/storage/local-preset.d.ts.map +1 -0
- package/dist/src/storage/local-preset.js +21 -0
- package/dist/src/storage/local-preset.js.map +1 -0
- package/dist/src/storage/storage.d.ts +83 -0
- package/dist/src/storage/storage.d.ts.map +1 -0
- package/dist/src/storage/storage.js +120 -0
- package/dist/src/storage/storage.js.map +1 -0
- package/dist/src/telemetry/collections.d.ts +4 -0
- package/dist/src/telemetry/collections.d.ts.map +1 -0
- package/dist/src/telemetry/collections.js +19 -0
- package/dist/src/telemetry/collections.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +9 -0
- package/dist/src/telemetry/index.d.ts.map +1 -0
- package/dist/src/telemetry/index.js +9 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/logger.d.ts +4 -0
- package/dist/src/telemetry/logger.d.ts.map +1 -0
- package/dist/src/telemetry/logger.js +27 -0
- package/dist/src/telemetry/logger.js.map +1 -0
- package/dist/src/telemetry/sqlite-logger.d.ts +24 -0
- package/dist/src/telemetry/sqlite-logger.d.ts.map +1 -0
- package/dist/src/telemetry/sqlite-logger.js +152 -0
- package/dist/src/telemetry/sqlite-logger.js.map +1 -0
- package/dist/src/telemetry/telemetry-sql-client.d.ts +11 -0
- package/dist/src/telemetry/telemetry-sql-client.d.ts.map +1 -0
- package/dist/src/telemetry/telemetry-sql-client.js +8 -0
- package/dist/src/telemetry/telemetry-sql-client.js.map +1 -0
- package/dist/src/telemetry/tracer.d.ts +16 -0
- package/dist/src/telemetry/tracer.d.ts.map +1 -0
- package/dist/src/telemetry/tracer.js +106 -0
- package/dist/src/telemetry/tracer.js.map +1 -0
- package/dist/src/thumbnail/index.d.ts +4 -0
- package/dist/src/thumbnail/index.d.ts.map +1 -0
- package/dist/src/thumbnail/index.js +3 -0
- package/dist/src/thumbnail/index.js.map +1 -0
- package/dist/src/thumbnail/photon.d.ts +9 -0
- package/dist/src/thumbnail/photon.d.ts.map +1 -0
- package/dist/src/thumbnail/photon.js +73 -0
- package/dist/src/thumbnail/photon.js.map +1 -0
- package/dist/src/thumbnail/types.d.ts +23 -0
- package/dist/src/thumbnail/types.d.ts.map +1 -0
- package/dist/src/thumbnail/types.js +22 -0
- package/dist/src/thumbnail/types.js.map +1 -0
- package/dist/tests/app/app.test.d.ts +2 -0
- package/dist/tests/app/app.test.d.ts.map +1 -0
- package/dist/tests/app/app.test.js +125 -0
- package/dist/tests/app/app.test.js.map +1 -0
- package/dist/tests/app/builder.test.d.ts +2 -0
- package/dist/tests/app/builder.test.d.ts.map +1 -0
- package/dist/tests/app/builder.test.js +70 -0
- package/dist/tests/app/builder.test.js.map +1 -0
- package/dist/tests/cache/cached-collection.test.d.ts +2 -0
- package/dist/tests/cache/cached-collection.test.d.ts.map +1 -0
- package/dist/tests/cache/cached-collection.test.js +244 -0
- package/dist/tests/cache/cached-collection.test.js.map +1 -0
- package/dist/tests/cache/collection-cache.test.d.ts +2 -0
- package/dist/tests/cache/collection-cache.test.d.ts.map +1 -0
- package/dist/tests/cache/collection-cache.test.js +73 -0
- package/dist/tests/cache/collection-cache.test.js.map +1 -0
- package/dist/tests/collection-service/collection-service.test.d.ts +2 -0
- package/dist/tests/collection-service/collection-service.test.d.ts.map +1 -0
- package/dist/tests/collection-service/collection-service.test.js +938 -0
- package/dist/tests/collection-service/collection-service.test.js.map +1 -0
- package/dist/tests/collection-service/input-schema.test.d.ts +2 -0
- package/dist/tests/collection-service/input-schema.test.d.ts.map +1 -0
- package/dist/tests/collection-service/input-schema.test.js +327 -0
- package/dist/tests/collection-service/input-schema.test.js.map +1 -0
- package/dist/tests/config/config.test.d.ts +2 -0
- package/dist/tests/config/config.test.d.ts.map +1 -0
- package/dist/tests/config/config.test.js +84 -0
- package/dist/tests/config/config.test.js.map +1 -0
- package/dist/tests/crypto/crypto.test.d.ts +2 -0
- package/dist/tests/crypto/crypto.test.d.ts.map +1 -0
- package/dist/tests/crypto/crypto.test.js +56 -0
- package/dist/tests/crypto/crypto.test.js.map +1 -0
- package/dist/tests/hooks/hook-collection.test.d.ts +2 -0
- package/dist/tests/hooks/hook-collection.test.d.ts.map +1 -0
- package/dist/tests/hooks/hook-collection.test.js +103 -0
- package/dist/tests/hooks/hook-collection.test.js.map +1 -0
- package/dist/tests/hooks/hook-service.test.d.ts +2 -0
- package/dist/tests/hooks/hook-service.test.d.ts.map +1 -0
- package/dist/tests/hooks/hook-service.test.js +216 -0
- package/dist/tests/hooks/hook-service.test.js.map +1 -0
- package/dist/tests/http/file-serve.test.d.ts +2 -0
- package/dist/tests/http/file-serve.test.d.ts.map +1 -0
- package/dist/tests/http/file-serve.test.js +210 -0
- package/dist/tests/http/file-serve.test.js.map +1 -0
- package/dist/tests/http/file-token.test.d.ts +2 -0
- package/dist/tests/http/file-token.test.d.ts.map +1 -0
- package/dist/tests/http/file-token.test.js +165 -0
- package/dist/tests/http/file-token.test.js.map +1 -0
- package/dist/tests/http/ip-middleware.test.d.ts +2 -0
- package/dist/tests/http/ip-middleware.test.d.ts.map +1 -0
- package/dist/tests/http/ip-middleware.test.js +58 -0
- package/dist/tests/http/ip-middleware.test.js.map +1 -0
- package/dist/tests/http/router.test.d.ts +2 -0
- package/dist/tests/http/router.test.d.ts.map +1 -0
- package/dist/tests/http/router.test.js +312 -0
- package/dist/tests/http/router.test.js.map +1 -0
- package/dist/tests/migrator/dialect-sqlite.test.d.ts +2 -0
- package/dist/tests/migrator/dialect-sqlite.test.d.ts.map +1 -0
- package/dist/tests/migrator/dialect-sqlite.test.js +90 -0
- package/dist/tests/migrator/dialect-sqlite.test.js.map +1 -0
- package/dist/tests/migrator/integration.test.d.ts +2 -0
- package/dist/tests/migrator/integration.test.d.ts.map +1 -0
- package/dist/tests/migrator/integration.test.js +180 -0
- package/dist/tests/migrator/integration.test.js.map +1 -0
- package/dist/tests/migrator/migrator.test.d.ts +2 -0
- package/dist/tests/migrator/migrator.test.d.ts.map +1 -0
- package/dist/tests/migrator/migrator.test.js +225 -0
- package/dist/tests/migrator/migrator.test.js.map +1 -0
- package/dist/tests/migrator/schema-diff.test.d.ts +2 -0
- package/dist/tests/migrator/schema-diff.test.d.ts.map +1 -0
- package/dist/tests/migrator/schema-diff.test.js +323 -0
- package/dist/tests/migrator/schema-diff.test.js.map +1 -0
- package/dist/tests/repository/repository.test.d.ts +2 -0
- package/dist/tests/repository/repository.test.d.ts.map +1 -0
- package/dist/tests/repository/repository.test.js +255 -0
- package/dist/tests/repository/repository.test.js.map +1 -0
- package/dist/tests/rule/compiler.test.d.ts +2 -0
- package/dist/tests/rule/compiler.test.d.ts.map +1 -0
- package/dist/tests/rule/compiler.test.js +226 -0
- package/dist/tests/rule/compiler.test.js.map +1 -0
- package/dist/tests/rule/enforcer.test.d.ts +2 -0
- package/dist/tests/rule/enforcer.test.d.ts.map +1 -0
- package/dist/tests/rule/enforcer.test.js +190 -0
- package/dist/tests/rule/enforcer.test.js.map +1 -0
- package/dist/tests/storage/storage.test.d.ts +2 -0
- package/dist/tests/storage/storage.test.d.ts.map +1 -0
- package/dist/tests/storage/storage.test.js +76 -0
- package/dist/tests/storage/storage.test.js.map +1 -0
- package/dist/tests/telemetry/collections.test.d.ts +2 -0
- package/dist/tests/telemetry/collections.test.d.ts.map +1 -0
- package/dist/tests/telemetry/collections.test.js +67 -0
- package/dist/tests/telemetry/collections.test.js.map +1 -0
- package/dist/tests/telemetry/instrumentation.test.d.ts +2 -0
- package/dist/tests/telemetry/instrumentation.test.d.ts.map +1 -0
- package/dist/tests/telemetry/instrumentation.test.js +226 -0
- package/dist/tests/telemetry/instrumentation.test.js.map +1 -0
- package/dist/tests/telemetry/logger.test.d.ts +2 -0
- package/dist/tests/telemetry/logger.test.d.ts.map +1 -0
- package/dist/tests/telemetry/logger.test.js +56 -0
- package/dist/tests/telemetry/logger.test.js.map +1 -0
- package/dist/tests/telemetry/sqlite-logger.test.d.ts +2 -0
- package/dist/tests/telemetry/sqlite-logger.test.d.ts.map +1 -0
- package/dist/tests/telemetry/sqlite-logger.test.js +218 -0
- package/dist/tests/telemetry/sqlite-logger.test.js.map +1 -0
- package/dist/tests/telemetry/telemetry-routes.test.d.ts +2 -0
- package/dist/tests/telemetry/telemetry-routes.test.d.ts.map +1 -0
- package/dist/tests/telemetry/telemetry-routes.test.js +133 -0
- package/dist/tests/telemetry/telemetry-routes.test.js.map +1 -0
- package/dist/tests/telemetry/tracer.test.d.ts +2 -0
- package/dist/tests/telemetry/tracer.test.d.ts.map +1 -0
- package/dist/tests/telemetry/tracer.test.js +63 -0
- package/dist/tests/telemetry/tracer.test.js.map +1 -0
- package/dist/tests/thumbnail/photon.test.d.ts +2 -0
- package/dist/tests/thumbnail/photon.test.d.ts.map +1 -0
- package/dist/tests/thumbnail/photon.test.js +478 -0
- package/dist/tests/thumbnail/photon.test.js.map +1 -0
- package/dist/tests/thumbnail/thumbnail.test.d.ts +2 -0
- package/dist/tests/thumbnail/thumbnail.test.d.ts.map +1 -0
- package/dist/tests/thumbnail/thumbnail.test.js +35 -0
- package/dist/tests/thumbnail/thumbnail.test.js.map +1 -0
- package/package.json +46 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for the Mira server library.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { Mira, NodePlatform, SqliteDatabase, LocalFileStorage } from "@gettersethya/mira"
|
|
7
|
+
*
|
|
8
|
+
* const app = Mira.builder()
|
|
9
|
+
* .platform(NodePlatform)
|
|
10
|
+
* .database(SqliteDatabase({ filename: "data.db" }))
|
|
11
|
+
* .storage(LocalFileStorage({ directory: "./uploads" }))
|
|
12
|
+
* .collections([Posts, Users])
|
|
13
|
+
* .build()
|
|
14
|
+
* .serve()
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Server-only: all client exports are re-exported from @gettersethya/mira too
|
|
19
|
+
* import { BaseCollection, Field } from "@gettersethya/mira"
|
|
20
|
+
*
|
|
21
|
+
* @see MiraBuilder — the phantom-type fluent builder
|
|
22
|
+
* @see MiraApp — the assembled server
|
|
23
|
+
*/
|
|
24
|
+
import { MiraBuilder } from "./builder.js";
|
|
25
|
+
export declare const Mira: {
|
|
26
|
+
builder: () => MiraBuilder<never>;
|
|
27
|
+
};
|
|
28
|
+
export type { MiraPlatform, MiraDatabase, MiraStorage, PlatformServices } from "./types.js";
|
|
29
|
+
export type { MiraApp } from "./app.js";
|
|
30
|
+
export { MiraBuilder } from "./builder.js";
|
|
31
|
+
export type { RecordHook, RecordSuccessHook, ListHook, ListSuccessHook } from "./plugin.js";
|
|
32
|
+
export { MiraPlugin, onCollection, onCollectionSuccess } from "./plugin.js";
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,eAAO,MAAM,IAAI;;CAEhB,CAAA;AAED,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC3F,YAAY,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC3F,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entry point for the Mira server library.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { Mira, NodePlatform, SqliteDatabase, LocalFileStorage } from "@gettersethya/mira"
|
|
7
|
+
*
|
|
8
|
+
* const app = Mira.builder()
|
|
9
|
+
* .platform(NodePlatform)
|
|
10
|
+
* .database(SqliteDatabase({ filename: "data.db" }))
|
|
11
|
+
* .storage(LocalFileStorage({ directory: "./uploads" }))
|
|
12
|
+
* .collections([Posts, Users])
|
|
13
|
+
* .build()
|
|
14
|
+
* .serve()
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Server-only: all client exports are re-exported from @gettersethya/mira too
|
|
19
|
+
* import { BaseCollection, Field } from "@gettersethya/mira"
|
|
20
|
+
*
|
|
21
|
+
* @see MiraBuilder — the phantom-type fluent builder
|
|
22
|
+
* @see MiraApp — the assembled server
|
|
23
|
+
*/
|
|
24
|
+
import { MiraBuilder } from "./builder.js";
|
|
25
|
+
export const Mira = {
|
|
26
|
+
builder: () => new MiraBuilder(),
|
|
27
|
+
};
|
|
28
|
+
export { MiraBuilder } from "./builder.js";
|
|
29
|
+
export { MiraPlugin, onCollection, onCollectionSuccess } from "./plugin.js";
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,WAAW,EAAE;CACjC,CAAA;AAID,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Effect, Layer } from "effect";
|
|
2
|
+
import type { HttpRouter, FileSystem, Path } from "@effect/platform";
|
|
3
|
+
import type { SqlClient } from "@effect/sql";
|
|
4
|
+
import type { AnyCollectionDef } from "@gettersethya/mira-client";
|
|
5
|
+
import type { Repository } from "../repository/index.js";
|
|
6
|
+
import type { AppConfig } from "../config/index.js";
|
|
7
|
+
import type { AuthService } from "../http/auth.js";
|
|
8
|
+
import type { CollectionService } from "../collection-service/collection-service.js";
|
|
9
|
+
import type { PlatformServices } from "./types.js";
|
|
10
|
+
import type { RecordHookContext, RecordResultContext, ListHookContext, ListResultContext, ViewHookContext, ViewResultContext, HookErrorContext } from "../hooks/types.js";
|
|
11
|
+
export interface RecordHook<T> {
|
|
12
|
+
readonly collections?: ReadonlyArray<string>;
|
|
13
|
+
readonly handler: (ctx: T) => Effect.Effect<T, never, never>;
|
|
14
|
+
}
|
|
15
|
+
export interface RecordSuccessHook<T> {
|
|
16
|
+
readonly collections?: ReadonlyArray<string>;
|
|
17
|
+
readonly handler: (ctx: T) => Effect.Effect<void, never, never>;
|
|
18
|
+
}
|
|
19
|
+
export interface ListHook<T> {
|
|
20
|
+
readonly collections?: ReadonlyArray<string>;
|
|
21
|
+
readonly handler: (ctx: T) => Effect.Effect<T, never, never>;
|
|
22
|
+
}
|
|
23
|
+
export interface ListSuccessHook<T> {
|
|
24
|
+
readonly collections?: ReadonlyArray<string>;
|
|
25
|
+
readonly handler: (ctx: T) => Effect.Effect<void, never, never>;
|
|
26
|
+
}
|
|
27
|
+
export declare const onCollection: <T>(collections: ReadonlyArray<string>, handler: (ctx: T) => Effect.Effect<T, never, never>) => RecordHook<T>;
|
|
28
|
+
export declare const onCollectionSuccess: <T>(collections: ReadonlyArray<string>, handler: (ctx: T) => Effect.Effect<void, never, never>) => RecordSuccessHook<T>;
|
|
29
|
+
export interface MiraPlugin {
|
|
30
|
+
readonly onBootstrap?: () => Effect.Effect<void, never, AppConfig | CollectionService>;
|
|
31
|
+
readonly onServe?: () => Effect.Effect<void, never, never>;
|
|
32
|
+
readonly onTerminate?: () => Effect.Effect<void, never, never>;
|
|
33
|
+
readonly onRecordCreate?: RecordHook<RecordHookContext>;
|
|
34
|
+
readonly onRecordCreateExecute?: RecordHook<RecordHookContext>;
|
|
35
|
+
readonly onRecordCreateSuccess?: RecordSuccessHook<RecordResultContext>;
|
|
36
|
+
readonly onRecordCreateError?: RecordSuccessHook<HookErrorContext>;
|
|
37
|
+
readonly onRecordUpdate?: RecordHook<RecordHookContext>;
|
|
38
|
+
readonly onRecordUpdateExecute?: RecordHook<RecordHookContext>;
|
|
39
|
+
readonly onRecordUpdateSuccess?: RecordSuccessHook<RecordResultContext>;
|
|
40
|
+
readonly onRecordUpdateError?: RecordSuccessHook<HookErrorContext>;
|
|
41
|
+
readonly onRecordDelete?: RecordHook<RecordHookContext>;
|
|
42
|
+
readonly onRecordDeleteExecute?: RecordHook<RecordHookContext>;
|
|
43
|
+
readonly onRecordDeleteSuccess?: RecordSuccessHook<RecordResultContext>;
|
|
44
|
+
readonly onRecordDeleteError?: RecordSuccessHook<HookErrorContext>;
|
|
45
|
+
readonly onRecordList?: ListHook<ListHookContext>;
|
|
46
|
+
readonly onRecordListSuccess?: ListSuccessHook<ListResultContext>;
|
|
47
|
+
readonly onRecordListError?: ListSuccessHook<HookErrorContext>;
|
|
48
|
+
readonly onRecordView?: ListHook<ViewHookContext>;
|
|
49
|
+
readonly onRecordViewSuccess?: ListSuccessHook<ViewResultContext>;
|
|
50
|
+
readonly onRecordViewError?: ListSuccessHook<HookErrorContext>;
|
|
51
|
+
readonly layer?: Layer.Layer<never, never, PlatformServices | AppConfig | Repository | CollectionService>;
|
|
52
|
+
readonly routes?: HttpRouter.HttpRouter<never, FileSystem.FileSystem | Path.Path | Repository | AppConfig | AuthService | SqlClient.SqlClient | CollectionService>;
|
|
53
|
+
readonly collections?: ReadonlyArray<AnyCollectionDef>;
|
|
54
|
+
}
|
|
55
|
+
export declare const MiraPlugin: {
|
|
56
|
+
define: (opts: MiraPlugin) => MiraPlugin;
|
|
57
|
+
fromLayer: (layer: Layer.Layer<never, never, never>) => MiraPlugin;
|
|
58
|
+
isMiraPlugin: (ext: unknown) => ext is MiraPlugin;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/app/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,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GAAG,iBAAiB,CACnH,CAAA;IACD,QAAQ,CAAC,WAAW,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CACvD;AAMD,eAAO,MAAM,UAAU;mBACN,UAAU,KAAG,UAAU;uBAKnB,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAG,UAAU;wBAK5C,OAAO,KAAG,GAAG,IAAI,UAAU;CAKhD,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const onCollection = (collections, handler) => ({ collections, handler });
|
|
2
|
+
export const onCollectionSuccess = (collections, handler) => ({ collections, handler });
|
|
3
|
+
export const MiraPlugin = {
|
|
4
|
+
define: (opts) => {
|
|
5
|
+
const instance = { _tag: "MiraPlugin", ...opts };
|
|
6
|
+
return instance;
|
|
7
|
+
},
|
|
8
|
+
fromLayer: (layer) => {
|
|
9
|
+
const instance = { _tag: "MiraPlugin", layer };
|
|
10
|
+
return instance;
|
|
11
|
+
},
|
|
12
|
+
isMiraPlugin: (ext) => {
|
|
13
|
+
if (typeof ext !== "object" || ext === null)
|
|
14
|
+
return false;
|
|
15
|
+
if (!("_tag" in ext))
|
|
16
|
+
return false;
|
|
17
|
+
return ext._tag === "MiraPlugin";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/app/plugin.ts"],"names":[],"mappings":"AAuCA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,WAAkC,EAClC,OAAmD,EACpC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAA;AAE9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,WAAkC,EAClC,OAAsD,EAChC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAA;AA0CrD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM,EAAE,CAAC,IAAgB,EAAc,EAAE;QACvC,MAAM,QAAQ,GAAuB,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,CAAA;QACpE,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,SAAS,EAAE,CAAC,KAAuC,EAAc,EAAE;QACjE,MAAM,QAAQ,GAAuB,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAA;QAClE,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,YAAY,EAAE,CAAC,GAAY,EAAqB,EAAE;QAChD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,KAAK,CAAA;QACzD,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC;YAAE,OAAO,KAAK,CAAA;QAClC,OAAO,GAAG,CAAC,IAAI,KAAK,YAAY,CAAA;IAClC,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { FileSystem, Path } from "@effect/platform";
|
|
2
|
+
import type { Effect, Layer } from "effect";
|
|
3
|
+
import type { SqlClient } from "@effect/sql";
|
|
4
|
+
import type { AuthService } from "../http/auth.js";
|
|
5
|
+
import type { HttpServerFactory } from "../http/server-factory.js";
|
|
6
|
+
import type { CryptoService } from "../crypto/crypto.js";
|
|
7
|
+
import type { Dialect } from "../migrator/dialect.js";
|
|
8
|
+
import type { FileStorage } from "../storage/storage.js";
|
|
9
|
+
/**
|
|
10
|
+
* Services that a platform preset must provide.
|
|
11
|
+
* Union type including CryptoService, FileSystem, Path, HttpServerFactory, and AuthService.
|
|
12
|
+
*
|
|
13
|
+
* @see MiraPlatform — requires a Layer providing these services
|
|
14
|
+
*/
|
|
15
|
+
export type PlatformServices = CryptoService | FileSystem.FileSystem | Path.Path | HttpServerFactory | AuthService;
|
|
16
|
+
/**
|
|
17
|
+
* Services that a database preset must provide.
|
|
18
|
+
* Union type including SqlClient and Dialect.
|
|
19
|
+
*
|
|
20
|
+
* @see MiraDatabase — requires a Layer providing these services
|
|
21
|
+
*/
|
|
22
|
+
export type DatabaseServices = SqlClient.SqlClient | Dialect;
|
|
23
|
+
/**
|
|
24
|
+
* Interface for a platform preset (e.g., Node, Bun).
|
|
25
|
+
* Must provide a Layer with all PlatformServices and a `runMain` function
|
|
26
|
+
* that runs an Effect to completion.
|
|
27
|
+
*
|
|
28
|
+
* @see NodePlatform — Node.js implementation
|
|
29
|
+
* @see MiraBuilder.platform — where MiraPlatform is used
|
|
30
|
+
*/
|
|
31
|
+
export interface MiraPlatform {
|
|
32
|
+
layer: Layer.Layer<PlatformServices>;
|
|
33
|
+
runMain: (effect: Effect.Effect<never, never, never>) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Interface for a database preset (e.g., SQLite).
|
|
37
|
+
* Must provide a Layer with all DatabaseServices.
|
|
38
|
+
*
|
|
39
|
+
* @see SqliteDatabase — SQLite implementation
|
|
40
|
+
* @see MiraBuilder.database — where MiraDatabase is used
|
|
41
|
+
*/
|
|
42
|
+
export interface MiraDatabase {
|
|
43
|
+
layer: Layer.Layer<DatabaseServices>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Interface for a storage preset (e.g., local disk, S3).
|
|
47
|
+
* Must provide a Layer with FileStorage, requiring FileSystem and Path.
|
|
48
|
+
*
|
|
49
|
+
* @see LocalFileStorage — local disk implementation
|
|
50
|
+
* @see MiraBuilder.storage — where MiraStorage is used
|
|
51
|
+
*/
|
|
52
|
+
export interface MiraStorage {
|
|
53
|
+
layer: Layer.Layer<FileStorage, never, FileSystem.FileSystem | Path.Path>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/app/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAA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"","sources":["../../../src/app/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SqlClient } from "@effect/sql";
|
|
2
|
+
import { Layer } from "effect";
|
|
3
|
+
import type { AnyCollectionDef } from "@gettersethya/mira-client";
|
|
4
|
+
import { Repository } from "../repository/repository.js";
|
|
5
|
+
import { CollectionService } from "../collection-service/collection-service.js";
|
|
6
|
+
import { FileStorage } from "../storage/storage.js";
|
|
7
|
+
import type { CollectionCacheConfigValues } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create a cached `CollectionService` layer that wraps the standard collection service.
|
|
10
|
+
*
|
|
11
|
+
* The cache is transparent — it implements the same `CollectionService` tag.
|
|
12
|
+
* List results and individual records are cached with a configurable TTL.
|
|
13
|
+
* Cache is invalidated (nuked) on any write operation (create/update/delete).
|
|
14
|
+
*
|
|
15
|
+
* This is the default service layer used by MiraApp — the standard
|
|
16
|
+
* `makeCollectionServiceLayer` is wrapped by this function internally.
|
|
17
|
+
*
|
|
18
|
+
* @param allCollections - Array of collection definitions
|
|
19
|
+
* @param config - Optional cache configuration (record TTL, list TTL, max entries)
|
|
20
|
+
* @returns A Layer providing CollectionService with caching
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* makeCachedCollectionServiceLayer([Posts, Users])
|
|
24
|
+
* makeCachedCollectionServiceLayer([Posts], { recordTtlMs: 60_000 })
|
|
25
|
+
*
|
|
26
|
+
* @see CollectionService — the service tag
|
|
27
|
+
* @see makeCollectionServiceLayer — the underlying uncached service
|
|
28
|
+
*/
|
|
29
|
+
export declare function makeCachedCollectionServiceLayer(allCollections: ReadonlyArray<AnyCollectionDef>, config?: CollectionCacheConfigValues): Layer.Layer<CollectionService, never, Repository | SqlClient.SqlClient | FileStorage>;
|
|
30
|
+
//# sourceMappingURL=cached-collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-collection.d.ts","sourceRoot":"","sources":["../../../src/cache/cached-collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAU,KAAK,EAAkB,MAAM,QAAQ,CAAA;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEvD,OAAO,EAAE,iBAAiB,EAA8B,MAAM,4CAA4C,CAAA;AAC1G,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AA2D7D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gCAAgC,CAC9C,cAAc,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC/C,MAAM,GAAE,2BAA2C,GAClD,KAAK,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC,SAAS,GAAG,WAAW,CAAC,CAsFvF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Effect, Layer, Option } from "effect";
|
|
2
|
+
import { CollectionService, makeCollectionServiceLayer } from "../collection-service/collection-service.js";
|
|
3
|
+
import { CollectionCache, makeCollectionCacheLayer } from "./collection-cache.js";
|
|
4
|
+
function serializeFilterNode(node) {
|
|
5
|
+
switch (node.op) {
|
|
6
|
+
case "eq":
|
|
7
|
+
case "neq":
|
|
8
|
+
case "gt":
|
|
9
|
+
case "gte":
|
|
10
|
+
case "lt":
|
|
11
|
+
case "lte":
|
|
12
|
+
return `${node.op}(${node.field},${String(node.value)})`;
|
|
13
|
+
case "in":
|
|
14
|
+
return `in(${node.field},[${node.values.map(String).join(",")}])`;
|
|
15
|
+
case "like":
|
|
16
|
+
return `like(${node.field},${node.value})`;
|
|
17
|
+
case "null":
|
|
18
|
+
case "not_null":
|
|
19
|
+
return `${node.op}(${node.field})`;
|
|
20
|
+
case "and":
|
|
21
|
+
case "or":
|
|
22
|
+
return `${node.op}(${serializeFilterNode(node.left)},${serializeFilterNode(node.right)})`;
|
|
23
|
+
case "not":
|
|
24
|
+
return `not(${serializeFilterNode(node.node)})`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function stableViewKey(col, id, select, expand) {
|
|
28
|
+
const selectPart = select != null ? [...select].sort().join(",") : "";
|
|
29
|
+
const expandPart = expand != null ? [...expand].sort().join(",") : "";
|
|
30
|
+
return `${col}:${id}:${selectPart}|${expandPart}`;
|
|
31
|
+
}
|
|
32
|
+
function stableListKey(cursor, perPage, filter, sort, select, expand) {
|
|
33
|
+
const filterPart = filter !== undefined ? serializeFilterNode(filter) : "";
|
|
34
|
+
const sortPart = sort !== undefined ? `${sort.field}:${sort.direction}` : "";
|
|
35
|
+
const selectPart = select != null ? [...select].sort().join(",") : "";
|
|
36
|
+
const expandPart = expand != null ? [...expand].sort().join(",") : "";
|
|
37
|
+
return `${cursor ?? ""}|${perPage}|${filterPart}|${sortPart}|${selectPart}|${expandPart}`;
|
|
38
|
+
}
|
|
39
|
+
const defaultConfig = {
|
|
40
|
+
recordTtlMs: 30_000,
|
|
41
|
+
listTtlMs: 10_000,
|
|
42
|
+
maxRecords: 50_000,
|
|
43
|
+
maxLists: 5_000,
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Create a cached `CollectionService` layer that wraps the standard collection service.
|
|
47
|
+
*
|
|
48
|
+
* The cache is transparent — it implements the same `CollectionService` tag.
|
|
49
|
+
* List results and individual records are cached with a configurable TTL.
|
|
50
|
+
* Cache is invalidated (nuked) on any write operation (create/update/delete).
|
|
51
|
+
*
|
|
52
|
+
* This is the default service layer used by MiraApp — the standard
|
|
53
|
+
* `makeCollectionServiceLayer` is wrapped by this function internally.
|
|
54
|
+
*
|
|
55
|
+
* @param allCollections - Array of collection definitions
|
|
56
|
+
* @param config - Optional cache configuration (record TTL, list TTL, max entries)
|
|
57
|
+
* @returns A Layer providing CollectionService with caching
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* makeCachedCollectionServiceLayer([Posts, Users])
|
|
61
|
+
* makeCachedCollectionServiceLayer([Posts], { recordTtlMs: 60_000 })
|
|
62
|
+
*
|
|
63
|
+
* @see CollectionService — the service tag
|
|
64
|
+
* @see makeCollectionServiceLayer — the underlying uncached service
|
|
65
|
+
*/
|
|
66
|
+
export function makeCachedCollectionServiceLayer(allCollections, config = defaultConfig) {
|
|
67
|
+
return Layer.effect(CollectionService, Effect.gen(function* () {
|
|
68
|
+
const svc = yield* CollectionService;
|
|
69
|
+
const cache = yield* CollectionCache;
|
|
70
|
+
return CollectionService.of({
|
|
71
|
+
list: (collection, cursor, perPage, ctx, filter, sort, select, expand) => {
|
|
72
|
+
const key = `${collection.name}:${stableListKey(cursor, perPage, filter, sort, select, expand)}`;
|
|
73
|
+
return Effect.gen(function* () {
|
|
74
|
+
const cached = yield* cache.getList(key);
|
|
75
|
+
yield* Effect.currentSpan.pipe(Effect.tap((span) => Effect.sync(() => span.attribute("cache.hit", Option.isSome(cached)))), Effect.ignore);
|
|
76
|
+
if (Option.isSome(cached))
|
|
77
|
+
return cached.value;
|
|
78
|
+
const page = yield* svc.list(collection, cursor, perPage, ctx, filter, sort, select, expand);
|
|
79
|
+
yield* cache.putList(key, page);
|
|
80
|
+
return page;
|
|
81
|
+
}).pipe(Effect.withSpan("cache.list", {
|
|
82
|
+
kind: "internal",
|
|
83
|
+
attributes: { collection: collection.name },
|
|
84
|
+
}));
|
|
85
|
+
},
|
|
86
|
+
view: (collection, id, ctx, select, expand) => {
|
|
87
|
+
const key = stableViewKey(collection.name, id, select, expand);
|
|
88
|
+
return Effect.gen(function* () {
|
|
89
|
+
const cached = yield* cache.getRecord(key);
|
|
90
|
+
yield* Effect.currentSpan.pipe(Effect.tap((span) => Effect.sync(() => span.attribute("cache.hit", Option.isSome(cached)))), Effect.ignore);
|
|
91
|
+
if (Option.isSome(cached))
|
|
92
|
+
return cached.value;
|
|
93
|
+
const record = yield* svc.view(collection, id, ctx, select, expand);
|
|
94
|
+
yield* cache.putRecord(key, record);
|
|
95
|
+
return record;
|
|
96
|
+
}).pipe(Effect.withSpan("cache.view", {
|
|
97
|
+
kind: "internal",
|
|
98
|
+
attributes: { collection: collection.name },
|
|
99
|
+
}));
|
|
100
|
+
},
|
|
101
|
+
create: (collection, data, ctx) => svc.create(collection, data, ctx).pipe(Effect.tap(() => cache.nukeListsFor(collection.name)), Effect.withSpan("cache.create", { kind: "internal", attributes: { collection: collection.name } })),
|
|
102
|
+
update: (collection, id, data, ctx) => svc.update(collection, id, data, ctx).pipe(Effect.tap(() => Effect.all([cache.invalidateRecord(collection.name, id), cache.nukeListsFor(collection.name)], { concurrency: "unbounded" })), Effect.withSpan("cache.update", { kind: "internal", attributes: { collection: collection.name } })),
|
|
103
|
+
delete: (collection, id, ctx) => svc.delete(collection, id, ctx).pipe(Effect.tap(() => Effect.all([cache.invalidateRecord(collection.name, id), cache.nukeListsFor(collection.name)], { concurrency: "unbounded" })), Effect.withSpan("cache.delete", { kind: "internal", attributes: { collection: collection.name } })),
|
|
104
|
+
});
|
|
105
|
+
})).pipe(Layer.provide(Layer.merge(makeCollectionServiceLayer(allCollections), makeCollectionCacheLayer(config))));
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=cached-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-collection.js","sourceRoot":"","sources":["../../../src/cache/cached-collection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAA;AAKtD,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA;AAE1G,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAGjF,SAAS,mBAAmB,CAAC,IAAgB;IAC3C,QAAQ,IAAI,CAAC,EAAE,EAAE,CAAC;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AC,GAAG,EAAE,CACd,MAAM,CAAC,GAAG,CACR,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,EAClF,EAAE,WAAW,EAAE,WAAW,EAAE,CAC7B,CACF,EACD,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CACnG;SACJ,CAAC,CAAA;IACJ,CAAC,CAAC,CACH,CAAC,IAAI,CACJ,KAAK,CAAC,OAAO,CACX,KAAK,CAAC,KAAK,CAAC,0BAA0B,CAAC,cAAc,CAAC,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC,CAC1F,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Context, Effect, Layer, Option } from "effect";
|
|
2
|
+
import type { CursorPage } from "../collection-service/context.js";
|
|
3
|
+
import type { RepoRecord } from "../repository/types.js";
|
|
4
|
+
import type { CollectionCacheConfigValues } from "./types.js";
|
|
5
|
+
declare const CollectionCache_base: Context.TagClass<CollectionCache, "CollectionCache", {
|
|
6
|
+
getRecord(key: string): Effect.Effect<Option.Option<RepoRecord>>;
|
|
7
|
+
putRecord(key: string, v: RepoRecord): Effect.Effect<void>;
|
|
8
|
+
invalidateRecord(col: string, id: string): Effect.Effect<void>;
|
|
9
|
+
getList(key: string): Effect.Effect<Option.Option<CursorPage>>;
|
|
10
|
+
putList(key: string, v: CursorPage): Effect.Effect<void>;
|
|
11
|
+
nukeListsFor(col: string): Effect.Effect<void>;
|
|
12
|
+
}>;
|
|
13
|
+
export declare class CollectionCache extends CollectionCache_base {
|
|
14
|
+
}
|
|
15
|
+
export declare function makeCollectionCacheLayer(config: CollectionCacheConfigValues): Layer.Layer<CollectionCache>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=collection-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-cache.d.ts","sourceRoot":"","sources":["../../../src/cache/collection-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAW,KAAK,EAAE,MAAM,EAAO,MAAM,QAAQ,CAAA;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAc,2BAA2B,EAAE,MAAM,YAAY,CAAA;;mBAKtD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;mBACjD,MAAM,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;0BACpC,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;iBACjD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;iBACjD,MAAM,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;sBACtC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;;AARlD,qBAAa,eAAgB,SAAQ,oBAUlC;CAAG;AAoCN,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,2BAA2B,GAClC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CA4B9B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Context, Effect, HashMap, Layer, Option, Ref } from "effect";
|
|
2
|
+
export class CollectionCache extends Context.Tag("CollectionCache")() {
|
|
3
|
+
}
|
|
4
|
+
const get = (ref, key) => Ref.get(ref).pipe(Effect.map(HashMap.get(key)), Effect.map(Option.filter((e) => e.expiresAt > Date.now())), Effect.map(Option.map((e) => e.value)));
|
|
5
|
+
const put = (ref, key, value, ttlMs, maxSize) => {
|
|
6
|
+
const now = Date.now();
|
|
7
|
+
const entry = { value, insertedAt: now, expiresAt: now + ttlMs };
|
|
8
|
+
return Ref.update(ref, (map) => {
|
|
9
|
+
const inserted = HashMap.set(map, key, entry);
|
|
10
|
+
if (HashMap.size(inserted) <= maxSize)
|
|
11
|
+
return inserted;
|
|
12
|
+
let oldestKey;
|
|
13
|
+
let oldestTime = Infinity;
|
|
14
|
+
for (const [k, v] of inserted) {
|
|
15
|
+
if (v.insertedAt < oldestTime) {
|
|
16
|
+
oldestTime = v.insertedAt;
|
|
17
|
+
oldestKey = k;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return oldestKey !== undefined ? HashMap.remove(inserted, oldestKey) : inserted;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export function makeCollectionCacheLayer(config) {
|
|
24
|
+
return Layer.effect(CollectionCache, Effect.gen(function* () {
|
|
25
|
+
const recordRef = yield* Ref.make(HashMap.empty());
|
|
26
|
+
const listRef = yield* Ref.make(HashMap.empty());
|
|
27
|
+
return CollectionCache.of({
|
|
28
|
+
getRecord: (key) => get(recordRef, key),
|
|
29
|
+
putRecord: (key, v) => put(recordRef, key, v, config.recordTtlMs, config.maxRecords),
|
|
30
|
+
invalidateRecord: (col, id) => Ref.update(recordRef, (map) => HashMap.filter(map, (_, key) => !key.startsWith(`${col}:${id}:`))),
|
|
31
|
+
getList: (key) => get(listRef, key),
|
|
32
|
+
putList: (key, v) => put(listRef, key, v, config.listTtlMs, config.maxLists),
|
|
33
|
+
nukeListsFor: (col) => Ref.update(listRef, (map) => HashMap.filter(map, (_, key) => !key.startsWith(`${col}:`))),
|
|
34
|
+
});
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=collection-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-cache.js","sourceRoot":"","sources":["../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EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAClE;YAEH,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC;YAEnC,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC;YAE5E,YAAY,EAAE,CAAC,GAAG,EAAE,EAAE,CACpB,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAC5D;SACJ,CAAC,CAAA;IACJ,CAAC,CAAC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CollectionCache, makeCollectionCacheLayer } from "./collection-cache.js";
|
|
2
|
+
export { makeCachedCollectionServiceLayer } from "./cached-collection.js";
|
|
3
|
+
export type { CacheEntry, CollectionCacheConfigValues } from "./types.js";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAA;AACzE,YAAY,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface CacheEntry<A> {
|
|
2
|
+
value: A;
|
|
3
|
+
insertedAt: number;
|
|
4
|
+
expiresAt: number;
|
|
5
|
+
}
|
|
6
|
+
export interface CollectionCacheConfigValues {
|
|
7
|
+
recordTtlMs: number;
|
|
8
|
+
listTtlMs: number;
|
|
9
|
+
maxRecords: number;
|
|
10
|
+
maxLists: number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cache/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAA;IACR,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cache/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { SqlClient } from "@effect/sql";
|
|
2
|
+
import { Context, Effect, Layer } from "effect";
|
|
3
|
+
import type { AnyCollectionDef } from "@gettersethya/mira-client";
|
|
4
|
+
import type { FilterNode } from "@gettersethya/mira-client";
|
|
5
|
+
import { Repository } from "../repository/repository.js";
|
|
6
|
+
import type { RepoRecord, SortOrder } from "../repository/types.js";
|
|
7
|
+
import { FileStorage } from "../storage/storage.js";
|
|
8
|
+
import type { CursorPage, RequestCtx } from "./context.js";
|
|
9
|
+
import type { CollectionError } from "./errors.js";
|
|
10
|
+
declare const CollectionService_base: Context.TagClass<CollectionService, "CollectionService", {
|
|
11
|
+
list(collection: AnyCollectionDef, cursor: number | null, perPage: number, ctx: RequestCtx, filter?: FilterNode, sort?: SortOrder, select?: ReadonlyArray<string> | null, expand?: ReadonlyArray<string> | null): Effect.Effect<CursorPage, CollectionError>;
|
|
12
|
+
view(collection: AnyCollectionDef, id: string, ctx: RequestCtx, select?: ReadonlyArray<string> | null, expand?: ReadonlyArray<string> | null): Effect.Effect<RepoRecord, CollectionError>;
|
|
13
|
+
create(collection: AnyCollectionDef, data: RepoRecord, ctx: RequestCtx): Effect.Effect<RepoRecord, CollectionError>;
|
|
14
|
+
update(collection: AnyCollectionDef, id: string, data: RepoRecord, ctx: RequestCtx): Effect.Effect<RepoRecord, CollectionError>;
|
|
15
|
+
delete(collection: AnyCollectionDef, id: string, ctx: RequestCtx): Effect.Effect<void, CollectionError>;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Collection Service tag — the core business-logic layer sitting between
|
|
19
|
+
* the HTTP router and the repository.
|
|
20
|
+
*
|
|
21
|
+
* Each method performs:
|
|
22
|
+
* - Schema validation (field types, required fields, constraints via Effect Schema)
|
|
23
|
+
* - Access rule enforcement (compiles and applies x-rules)
|
|
24
|
+
* - System field management (seqId, created, updated timestamps)
|
|
25
|
+
* - Hidden/read-only field stripping for responses
|
|
26
|
+
* - Cursor-based pagination for list operations
|
|
27
|
+
* - File cleanup on update/delete (best-effort)
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* import { CollectionService } from "@gettersethya/mira"
|
|
31
|
+
*
|
|
32
|
+
* Effect.gen(function* () {
|
|
33
|
+
* const svc = yield* CollectionService
|
|
34
|
+
* const page = yield* svc.list(postsDef, null, 20, ctx, undefined, { field: "seqId", direction: "asc" })
|
|
35
|
+
* })
|
|
36
|
+
*
|
|
37
|
+
* @see makeCollectionServiceLayer — factory function
|
|
38
|
+
* @see Repository — the underlying data access layer
|
|
39
|
+
*/
|
|
40
|
+
export declare class CollectionService extends CollectionService_base {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Create a `CollectionService` layer for a given set of collection definitions.
|
|
44
|
+
* Each collection gets its own validated service instance with per-collection
|
|
45
|
+
* rules, field schemas, and system field handling.
|
|
46
|
+
*
|
|
47
|
+
* The layer depends on `Repository`, `SqlClient`, and `FileStorage`.
|
|
48
|
+
*
|
|
49
|
+
* @param allCollections - Array of collection definitions
|
|
50
|
+
* @returns A Layer providing CollectionService
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* Layer.provideMerge(makeCollectionServiceLayer([Posts, Users]))
|
|
54
|
+
*
|
|
55
|
+
* @see CollectionService — the service tag
|
|
56
|
+
* @see makeCachedCollectionServiceLayer — wrapping layer that adds caching
|
|
57
|
+
*/
|
|
58
|
+
export declare function makeCollectionServiceLayer(allCollections: ReadonlyArray<AnyCollectionDef>): Layer.Layer<CollectionService, never, Repository | SqlClient.SqlClient | FileStorage>;
|
|
59
|
+
/** @deprecated Use makeCollectionServiceLayer(allCollections) */
|
|
60
|
+
export declare const CollectionServiceLive: Layer.Layer<CollectionService, never, SqlClient.SqlClient | FileStorage | Repository>;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=collection-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-service.d.ts","sourceRoot":"","sources":["../../../src/collection-service/collection-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAkB,MAAM,QAAQ,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,2BAA2B,CAAA;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2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