@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,157 @@
|
|
|
1
|
+
function jsonKeysDiffer(a, b) {
|
|
2
|
+
if (a === b)
|
|
3
|
+
return false;
|
|
4
|
+
return JSON.stringify(a) !== JSON.stringify(b);
|
|
5
|
+
}
|
|
6
|
+
/** Maps a JSON Schema property to the appropriate SQL column type. */
|
|
7
|
+
export function propertyToColumnType(prop) {
|
|
8
|
+
if (prop["x-kind"] === "seqId")
|
|
9
|
+
return "integer";
|
|
10
|
+
if (prop.type === "integer")
|
|
11
|
+
return "integer";
|
|
12
|
+
if (prop.type === "number")
|
|
13
|
+
return "real";
|
|
14
|
+
if (prop.type === "boolean")
|
|
15
|
+
return "boolean";
|
|
16
|
+
return "text";
|
|
17
|
+
}
|
|
18
|
+
/** Converts a `CollectionSchema` to the flat list of `ColumnDef`s that the dialect will render as DDL. */
|
|
19
|
+
export function schemaToColumns(schema) {
|
|
20
|
+
const requiredSet = new Set(schema.required ?? []);
|
|
21
|
+
return Object.entries(schema.properties)
|
|
22
|
+
.filter(([, prop]) => !prop["x-view-only"])
|
|
23
|
+
.map(([name, prop]) => {
|
|
24
|
+
const col = {
|
|
25
|
+
name,
|
|
26
|
+
type: propertyToColumnType(prop),
|
|
27
|
+
nullable: !requiredSet.has(name) && !prop["x-system"]
|
|
28
|
+
};
|
|
29
|
+
if (prop.default !== undefined) {
|
|
30
|
+
col.default = prop.default;
|
|
31
|
+
}
|
|
32
|
+
if (name === "id") {
|
|
33
|
+
col.unique = true;
|
|
34
|
+
}
|
|
35
|
+
if (prop["x-system"]) {
|
|
36
|
+
col.xSystem = true;
|
|
37
|
+
}
|
|
38
|
+
if (prop["x-hidden"]) {
|
|
39
|
+
col.xHidden = true;
|
|
40
|
+
}
|
|
41
|
+
if (prop["x-kind"]) {
|
|
42
|
+
col.xKind = prop["x-kind"];
|
|
43
|
+
if (prop["x-kind"] === "seqId") {
|
|
44
|
+
col.primaryKey = true;
|
|
45
|
+
col.autoIncrement = true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return col;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** Extracts index entries from a schema's `x-indexes`, adding a deterministic name to each. */
|
|
52
|
+
export function schemaToIndexEntries(schema) {
|
|
53
|
+
return (schema["x-indexes"] ?? []).map((idx) => ({
|
|
54
|
+
...idx,
|
|
55
|
+
name: `idx_${schema["x-collection-kind"]}_${idx.fields.join("_")}`
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
function diffViewSchemas(name, stored, desired) {
|
|
59
|
+
const query = desired["x-view-query"];
|
|
60
|
+
if (!query)
|
|
61
|
+
return [];
|
|
62
|
+
if (stored === null) {
|
|
63
|
+
return [{ kind: "createView", view: name, query }];
|
|
64
|
+
}
|
|
65
|
+
if (stored["x-view-query"] !== query) {
|
|
66
|
+
return [
|
|
67
|
+
{ kind: "dropView", view: name },
|
|
68
|
+
{ kind: "createView", view: name, query }
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Computes the `MigrationStep`s needed to bring `stored` up to `desired` for a single collection.
|
|
75
|
+
* Pass `null` for `stored` to generate a full `createTable`.
|
|
76
|
+
*/
|
|
77
|
+
export function diffSchemas(name, stored, desired) {
|
|
78
|
+
if (desired["x-collection-kind"] === "view") {
|
|
79
|
+
return diffViewSchemas(name, stored, desired);
|
|
80
|
+
}
|
|
81
|
+
const steps = [];
|
|
82
|
+
if (stored === null) {
|
|
83
|
+
steps.push({ kind: "createTable", table: name, columns: schemaToColumns(desired) });
|
|
84
|
+
for (const idx of schemaToIndexEntries(desired)) {
|
|
85
|
+
steps.push({ kind: "createIndex", table: name, fields: idx.fields, unique: idx.unique });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
const storedCols = schemaToColumns(stored);
|
|
90
|
+
const desiredCols = schemaToColumns(desired);
|
|
91
|
+
const storedMap = new Map(storedCols.map((c) => [c.name, c]));
|
|
92
|
+
const desiredMap = new Map(desiredCols.map((c) => [c.name, c]));
|
|
93
|
+
for (const dc of desiredCols) {
|
|
94
|
+
const sc = storedMap.get(dc.name);
|
|
95
|
+
if (!sc) {
|
|
96
|
+
steps.push({ kind: "addColumn", table: name, column: dc });
|
|
97
|
+
}
|
|
98
|
+
else if (sc.type !== dc.type || sc.nullable !== dc.nullable || jsonKeysDiffer(sc.default, dc.default)) {
|
|
99
|
+
steps.push({ kind: "alterColumn", table: name, column: dc });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const sc of storedCols) {
|
|
103
|
+
if (!desiredMap.has(sc.name) && !sc.xSystem) {
|
|
104
|
+
steps.push({ kind: "dropColumn", table: name, column: sc.name });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const storedIndexes = schemaToIndexEntries(stored);
|
|
108
|
+
const desiredIndexes = schemaToIndexEntries(desired);
|
|
109
|
+
const storedIdxMap = new Map(storedIndexes.map((i) => [i.name, i]));
|
|
110
|
+
const desiredIdxMap = new Map(desiredIndexes.map((i) => [i.name, i]));
|
|
111
|
+
for (const di of desiredIndexes) {
|
|
112
|
+
if (!storedIdxMap.has(di.name)) {
|
|
113
|
+
steps.push({ kind: "createIndex", table: name, fields: di.fields, unique: di.unique });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const si of storedIndexes) {
|
|
117
|
+
if (!desiredIdxMap.has(si.name)) {
|
|
118
|
+
steps.push({ kind: "dropIndex", table: name, indexName: si.name });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return steps;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Builds a full `MigrationPlan` for a set of desired schemas against the currently stored schemas.
|
|
126
|
+
* When `allowDestructive` is true, tables absent from `schemas` are dropped.
|
|
127
|
+
*/
|
|
128
|
+
export function computePlan(schemas, stored, options) {
|
|
129
|
+
const steps = [];
|
|
130
|
+
let destructive = false;
|
|
131
|
+
for (const { name, schema } of schemas) {
|
|
132
|
+
const storedSchema = stored[name] ?? null;
|
|
133
|
+
const diffSteps = diffSchemas(name, storedSchema, schema);
|
|
134
|
+
for (const step of diffSteps) {
|
|
135
|
+
if (step.kind === "dropTable" || step.kind === "dropColumn" || step.kind === "alterColumn") {
|
|
136
|
+
destructive = true;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
steps.push(...diffSteps);
|
|
140
|
+
}
|
|
141
|
+
if (options?.allowDestructive) {
|
|
142
|
+
const desiredNames = new Set(schemas.map((s) => s.name));
|
|
143
|
+
for (const name of Object.keys(stored)) {
|
|
144
|
+
if (!desiredNames.has(name)) {
|
|
145
|
+
if (stored[name]["x-collection-kind"] === "view") {
|
|
146
|
+
steps.push({ kind: "dropView", view: name });
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
steps.push({ kind: "dropTable", table: name });
|
|
150
|
+
destructive = true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return { steps, destructive };
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=schema-diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-diff.js","sourceRoot":"","sources":["../../../src/migrator/schema-diff.ts"],"names":[],"mappings":"AAGA,SAAS,cAAc,CAAC,CAAU,EAAE,CAAU;IAC5C,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAA;IACzB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;AAChD,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,oBAAoB,CAAC,IAAwB;IAC3D,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,OAAO;QAAE,OAA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C;gBAC3F,WAAW,GAAG,IAAI,CAAA;YACpB,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;IAC1B,CAAC;IAED,IAAI,OAAO,EAAE,gBAAgB,EAAE,CAAC;QAC9B,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QACxD,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACvC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC5B,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,mBAAmB,CAAC,KAAK,MAAM,EAAE,CAAC;oBACjD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;gBAC9C,CAAC;qBAAM,CAAC;oBACN,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;oBAC9C,WAAW,GAAG,IAAI,CAAA;gBACpB,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAA;AAC/B,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { LogLevel } from "effect";
|
|
2
|
+
import type { CollectionSchema } from "@gettersethya/mira-client";
|
|
3
|
+
/** SQL column type at the database level. Maps from the JSON Schema `type` field. */
|
|
4
|
+
export type ColumnType = "text" | "integer" | "real" | "boolean";
|
|
5
|
+
/** Internal representation of a single database column, used when generating DDL. */
|
|
6
|
+
export type ColumnDef = {
|
|
7
|
+
name: string;
|
|
8
|
+
type: ColumnType;
|
|
9
|
+
nullable: boolean;
|
|
10
|
+
default?: unknown;
|
|
11
|
+
primaryKey?: boolean;
|
|
12
|
+
autoIncrement?: boolean;
|
|
13
|
+
unique?: boolean;
|
|
14
|
+
xSystem?: boolean;
|
|
15
|
+
xHidden?: boolean;
|
|
16
|
+
xKind?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A single DDL operation produced by the schema differ.
|
|
20
|
+
* Each variant maps 1:1 to a SQL statement via the active `Dialect`.
|
|
21
|
+
*/
|
|
22
|
+
export type MigrationStep = {
|
|
23
|
+
kind: "createTable";
|
|
24
|
+
table: string;
|
|
25
|
+
columns: ColumnDef[];
|
|
26
|
+
} | {
|
|
27
|
+
kind: "dropTable";
|
|
28
|
+
table: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: "renameTable";
|
|
31
|
+
from: string;
|
|
32
|
+
to: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "addColumn";
|
|
35
|
+
table: string;
|
|
36
|
+
column: ColumnDef;
|
|
37
|
+
} | {
|
|
38
|
+
kind: "dropColumn";
|
|
39
|
+
table: string;
|
|
40
|
+
column: string;
|
|
41
|
+
} | {
|
|
42
|
+
kind: "renameColumn";
|
|
43
|
+
table: string;
|
|
44
|
+
from: string;
|
|
45
|
+
to: string;
|
|
46
|
+
} | {
|
|
47
|
+
kind: "alterColumn";
|
|
48
|
+
table: string;
|
|
49
|
+
column: ColumnDef;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "createIndex";
|
|
52
|
+
table: string;
|
|
53
|
+
fields: string[];
|
|
54
|
+
unique: boolean;
|
|
55
|
+
} | {
|
|
56
|
+
kind: "dropIndex";
|
|
57
|
+
table: string;
|
|
58
|
+
indexName: string;
|
|
59
|
+
} | {
|
|
60
|
+
kind: "createSystemTable";
|
|
61
|
+
table: string;
|
|
62
|
+
columns: ColumnDef[];
|
|
63
|
+
} | {
|
|
64
|
+
kind: "createView";
|
|
65
|
+
view: string;
|
|
66
|
+
query: string;
|
|
67
|
+
} | {
|
|
68
|
+
kind: "dropView";
|
|
69
|
+
view: string;
|
|
70
|
+
};
|
|
71
|
+
/** The full set of DDL steps to bring stored schemas up to date with desired schemas. */
|
|
72
|
+
export type MigrationPlan = {
|
|
73
|
+
steps: MigrationStep[];
|
|
74
|
+
/** True if any step would destroy data (drop table, drop column, alter column). */
|
|
75
|
+
destructive: boolean;
|
|
76
|
+
};
|
|
77
|
+
/** A collection name paired with its desired `CollectionSchema`. Input to the migrator. */
|
|
78
|
+
export type NamedSchema = {
|
|
79
|
+
name: string;
|
|
80
|
+
schema: CollectionSchema;
|
|
81
|
+
};
|
|
82
|
+
/** Options controlling migration behavior passed to `Migrator.migrate()` and `Migrator.plan()`. */
|
|
83
|
+
export type MigrateOptions = {
|
|
84
|
+
/** Allow destructive steps (drop table, drop column). Defaults to false. */
|
|
85
|
+
allowDestructive?: boolean;
|
|
86
|
+
/** Numeric log verbosity: 0=none, 1=error, 2=warn, 3=info (default), 4=debug. */
|
|
87
|
+
logLevel?: number;
|
|
88
|
+
};
|
|
89
|
+
/** Maps a numeric log level to an Effect `LogLevel`. Defaults to `Info` for unknown values. */
|
|
90
|
+
export declare function toEffectLogLevel(level?: number): LogLevel.LogLevel;
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/migrator/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAEjE,qFAAqF;AACrF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAA;AAEhE,qFAAqF;AACrF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO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E,GACvD;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,EAAE,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAQ,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,UAAU,CAAC;IAAU,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/C,yFAAyF;AACzF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,mFAAmF;IACnF,WAAW,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,2FAA2F;AAC3F,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,gBAAgB,CAAA;CACzB,CAAA;AAED,mGAAmG;AACnG,MAAM,MAAM,cAAc,GAAG;IAC3B,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,+FAA+F;AAC/F,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,QAAQ,CASlE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LogLevel } from "effect";
|
|
2
|
+
/** Maps a numeric log level to an Effect `LogLevel`. Defaults to `Info` for unknown values. */
|
|
3
|
+
export function toEffectLogLevel(level) {
|
|
4
|
+
switch (level ?? 3) {
|
|
5
|
+
case 0: return LogLevel.None;
|
|
6
|
+
case 1: return LogLevel.Error;
|
|
7
|
+
case 2: return LogLevel.Warning;
|
|
8
|
+
case 3: return LogLevel.Info;
|
|
9
|
+
case 4: return LogLevel.Debug;
|
|
10
|
+
default: return LogLevel.Info;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/migrator/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AA4DjC,+FAA+F;AAC/F,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC;QACnB,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,IAAI,CAAA;QAC5B,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,KAAK,CAAA;QAC7B,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,OAAO,CAAA;QAC/B,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,IAAI,CAAA;QAC5B,KAAK,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,KAAK,CAAA;QAC7B,OAAO,CAAC,CAAC,OAAO,QAAQ,CAAC,IAAI,CAAA;IAC/B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NodeRuntime } from "@effect/platform-node";
|
|
2
|
+
import { Layer } from "effect";
|
|
3
|
+
import type { MiraPlatform } from "../app/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Node.js platform layer preset.
|
|
6
|
+
* Merges all Node-specific service implementations:
|
|
7
|
+
* - NodeFileSystem
|
|
8
|
+
* - NodePath
|
|
9
|
+
* - NodeCryptoLayer (randomBytes, randomUUID via crypto module)
|
|
10
|
+
* - NodeHttpServerFactoryLayer (HTTP server via @effect/platform-node)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* import { NodePlatformLayer } from "@gettersethya/mira"
|
|
14
|
+
*
|
|
15
|
+
* @see NodePlatform — the preset that wraps this layer with runMain and auth
|
|
16
|
+
*/
|
|
17
|
+
export declare const NodePlatformLayer: Layer.Layer<import("../index.js").CryptoService | import("../http/server-factory.js").HttpServerFactory | import("@effect/platform/FileSystem").FileSystem | import("@effect/platform/Path").Path, never, never>;
|
|
18
|
+
/**
|
|
19
|
+
* Node.js platform preset combining the platform layer with auth services.
|
|
20
|
+
* Also re-exports `NodeRuntime` for custom main functions.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* Mira.builder()
|
|
24
|
+
* .platform(NodePlatform)
|
|
25
|
+
* .database(SqliteDatabase({ filename: "data.db" }))
|
|
26
|
+
* .storage(LocalFileStorage({ directory: "./uploads" }))
|
|
27
|
+
* .collections([Posts])
|
|
28
|
+
* .build()
|
|
29
|
+
* .serve()
|
|
30
|
+
*
|
|
31
|
+
* @see NodePlatformLayer — the underlying service layer
|
|
32
|
+
* @see MiraPlatform — the interface NodePlatform implements
|
|
33
|
+
*/
|
|
34
|
+
export declare const NodePlatform: MiraPlatform;
|
|
35
|
+
/**
|
|
36
|
+
* Node runtime from @effect/platform-node.
|
|
37
|
+
* Re-exported for convenience when writing custom entrypoints.
|
|
38
|
+
*/
|
|
39
|
+
export { NodeRuntime };
|
|
40
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/platforms/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAI9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,kNAK7B,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,EAAE,YAG1B,CAAA;AAED;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { NodeFileSystem, NodePath, NodeRuntime } from "@effect/platform-node";
|
|
2
|
+
import { Layer } from "effect";
|
|
3
|
+
import { NodeCryptoLayer } from "../crypto/node.js";
|
|
4
|
+
import { NodeHttpServerFactoryLayer } from "../http/server-factory-node.js";
|
|
5
|
+
import { NodeAuthServiceLayer } from "../http/auth-node.js";
|
|
6
|
+
/**
|
|
7
|
+
* Node.js platform layer preset.
|
|
8
|
+
* Merges all Node-specific service implementations:
|
|
9
|
+
* - NodeFileSystem
|
|
10
|
+
* - NodePath
|
|
11
|
+
* - NodeCryptoLayer (randomBytes, randomUUID via crypto module)
|
|
12
|
+
* - NodeHttpServerFactoryLayer (HTTP server via @effect/platform-node)
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import { NodePlatformLayer } from "@gettersethya/mira"
|
|
16
|
+
*
|
|
17
|
+
* @see NodePlatform — the preset that wraps this layer with runMain and auth
|
|
18
|
+
*/
|
|
19
|
+
export const NodePlatformLayer = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeCryptoLayer, NodeHttpServerFactoryLayer);
|
|
20
|
+
/**
|
|
21
|
+
* Node.js platform preset combining the platform layer with auth services.
|
|
22
|
+
* Also re-exports `NodeRuntime` for custom main functions.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* Mira.builder()
|
|
26
|
+
* .platform(NodePlatform)
|
|
27
|
+
* .database(SqliteDatabase({ filename: "data.db" }))
|
|
28
|
+
* .storage(LocalFileStorage({ directory: "./uploads" }))
|
|
29
|
+
* .collections([Posts])
|
|
30
|
+
* .build()
|
|
31
|
+
* .serve()
|
|
32
|
+
*
|
|
33
|
+
* @see NodePlatformLayer — the underlying service layer
|
|
34
|
+
* @see MiraPlatform — the interface NodePlatform implements
|
|
35
|
+
*/
|
|
36
|
+
export const NodePlatform = {
|
|
37
|
+
layer: Layer.mergeAll(NodePlatformLayer, NodeAuthServiceLayer),
|
|
38
|
+
runMain: (effect) => NodeRuntime.runMain(effect),
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Node runtime from @effect/platform-node.
|
|
42
|
+
* Re-exported for convenience when writing custom entrypoints.
|
|
43
|
+
*/
|
|
44
|
+
export { NodeRuntime };
|
|
45
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/platforms/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAA;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAG1D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAC7C,cAAc,CAAC,KAAK,EACpB,QAAQ,CAAC,KAAK,EACd,eAAe,EACf,0BAA0B,CAC3B,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,YAAY,GAAiB;IACxC,KAAK,EAAE,KAAK,CAAC,QAAQ,CAAC,iBAAiB,EAAE,oBAAoB,CAAC;IAC9D,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;CACjD,CAAA;AAED;;;GAGG;AACH,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../src/repository/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,yDAAyD;AACzD,eAAO,MAAM,UAAU,QAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,CAKpE,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { CryptoService } from "../crypto/index.js";
|
|
3
|
+
/** Generates a 15-character URL-safe alphanumeric ID. */
|
|
4
|
+
export const generateId = () => Effect.gen(function* () {
|
|
5
|
+
const crypto = yield* CryptoService;
|
|
6
|
+
const buf = yield* crypto.randomBytes(12);
|
|
7
|
+
return Buffer.from(buf).toString("base64url").slice(0, 15);
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../src/repository/id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,yDAAyD;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,GAAgD,EAAE,CAC1E,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,aAAa,CAAA;IACnC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IACzC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC5D,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/repository/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC5D,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/repository/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SqlClient, SqlError } from "@effect/sql";
|
|
2
|
+
import { Context, Effect, Layer, Option } from "effect";
|
|
3
|
+
import { CryptoService } from "../crypto/index.js";
|
|
4
|
+
import type { CursorResult, FilterOptions, ListOptions, RepoRecord } from "./types.js";
|
|
5
|
+
declare const Repository_base: Context.TagClass<Repository, "Repository", {
|
|
6
|
+
create(table: string, data: RepoRecord): Effect.Effect<RepoRecord, SqlError.SqlError>;
|
|
7
|
+
update(table: string, id: string, data: RepoRecord): Effect.Effect<Option.Option<RepoRecord>, SqlError.SqlError>;
|
|
8
|
+
view(table: string, id: string): Effect.Effect<Option.Option<RepoRecord>, SqlError.SqlError>;
|
|
9
|
+
viewFilter(table: string, filter: FilterOptions): Effect.Effect<ReadonlyArray<RepoRecord>, SqlError.SqlError>;
|
|
10
|
+
list(table: string, limit: number, options?: ListOptions): Effect.Effect<CursorResult<RepoRecord>, SqlError.SqlError>;
|
|
11
|
+
delete(table: string, id: string): Effect.Effect<Option.Option<void>, SqlError.SqlError>;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Repository tag — schema-agnostic CRUD abstraction above SqlClient.
|
|
15
|
+
*
|
|
16
|
+
* Operates on `RepoRecord` (Record<string, unknown>) — no domain types at this layer.
|
|
17
|
+
* All field validation and type checking happens in `CollectionService` above.
|
|
18
|
+
*
|
|
19
|
+
* Provides:
|
|
20
|
+
* - `create(table, record)` — INSERT with generated id/seqId/timestamps
|
|
21
|
+
* - `update(table, id, patch)` — PATCH with updated timestamp
|
|
22
|
+
* - `view(table, id)` — SELECT by id
|
|
23
|
+
* - `viewFilter(table, filter, options?)` — SELECT by arbitrary filter
|
|
24
|
+
* - `list(table, limit, options?)` — cursor-based paginated SELECT (no COUNT(*))
|
|
25
|
+
* - `delete(table, id)` — DELETE by id
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* import { Repository } from "@gettersethya/mira"
|
|
29
|
+
*
|
|
30
|
+
* Effect.gen(function* () {
|
|
31
|
+
* const repo = yield* Repository
|
|
32
|
+
* const record = yield* repo.create("posts", { title: "Hello" })
|
|
33
|
+
* const page = yield* repo.list("posts", 20, { where: { sql: 't."published" = ?', params: [true] } })
|
|
34
|
+
* })
|
|
35
|
+
*
|
|
36
|
+
* @see RepositoryLive — the default implementation layer
|
|
37
|
+
* @see CollectionService — the layer above that uses Repository
|
|
38
|
+
*/
|
|
39
|
+
export declare class Repository extends Repository_base {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The default `Repository` implementation layer.
|
|
43
|
+
* Provides schema-agnostic CRUD using Effect SQL template literals.
|
|
44
|
+
* Generates IDs via `CryptoService.randomBytes`, manages `seqId` via auto-increment.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* Layer.provideMerge(RepositoryLive)
|
|
48
|
+
*
|
|
49
|
+
* @see Repository — the service tag
|
|
50
|
+
*/
|
|
51
|
+
export declare const RepositoryLive: Layer.Layer<Repository, never, CryptoService | SqlClient.SqlClient>;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../src/repository/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAa,aAAa,EAAE,WAAW,EAAE,UAAU,EAAa,MAAM,YAAY,CAAA;;kBA+B1F,MAAM,QAAQ,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC;kBACvE,MAAM,MAAM,MAAM,QAAQ,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;gBACpG,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;sBAC1E,MAAM,UAAU,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;gBAEpG,MAAM,SACN,MAAM,YACH,WAAW,GACpB,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;kBAC/C,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;;AAtC5F;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,UAAW,SAAQ,eAc7B;CAAG;AA4DN;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,qEAoE1B,CAAA"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { SqlClient } from "@effect/sql";
|
|
2
|
+
import { unsafeFragment } from "@effect/sql/Statement";
|
|
3
|
+
import { Context, Effect, Layer, Option } from "effect";
|
|
4
|
+
import { CryptoService } from "../crypto/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Repository tag — schema-agnostic CRUD abstraction above SqlClient.
|
|
7
|
+
*
|
|
8
|
+
* Operates on `RepoRecord` (Record<string, unknown>) — no domain types at this layer.
|
|
9
|
+
* All field validation and type checking happens in `CollectionService` above.
|
|
10
|
+
*
|
|
11
|
+
* Provides:
|
|
12
|
+
* - `create(table, record)` — INSERT with generated id/seqId/timestamps
|
|
13
|
+
* - `update(table, id, patch)` — PATCH with updated timestamp
|
|
14
|
+
* - `view(table, id)` — SELECT by id
|
|
15
|
+
* - `viewFilter(table, filter, options?)` — SELECT by arbitrary filter
|
|
16
|
+
* - `list(table, limit, options?)` — cursor-based paginated SELECT (no COUNT(*))
|
|
17
|
+
* - `delete(table, id)` — DELETE by id
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* import { Repository } from "@gettersethya/mira"
|
|
21
|
+
*
|
|
22
|
+
* Effect.gen(function* () {
|
|
23
|
+
* const repo = yield* Repository
|
|
24
|
+
* const record = yield* repo.create("posts", { title: "Hello" })
|
|
25
|
+
* const page = yield* repo.list("posts", 20, { where: { sql: 't."published" = ?', params: [true] } })
|
|
26
|
+
* })
|
|
27
|
+
*
|
|
28
|
+
* @see RepositoryLive — the default implementation layer
|
|
29
|
+
* @see CollectionService — the layer above that uses Repository
|
|
30
|
+
*/
|
|
31
|
+
export class Repository extends Context.Tag("Repository")() {
|
|
32
|
+
}
|
|
33
|
+
function orderFrag(sql, sort) {
|
|
34
|
+
if (!sort)
|
|
35
|
+
return sql.literal("");
|
|
36
|
+
const dir = sort.direction === "desc" ? "DESC" : "ASC";
|
|
37
|
+
return sql.literal(` ORDER BY t."${sort.field}" ${dir}`);
|
|
38
|
+
}
|
|
39
|
+
function buildSelect(sql, fields, expand) {
|
|
40
|
+
if (!fields && !expand)
|
|
41
|
+
return sql.literal("SELECT *");
|
|
42
|
+
const cols = [];
|
|
43
|
+
if (fields) {
|
|
44
|
+
cols.push(...fields.map((f) => `t."${f}"`));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
cols.push("t.*");
|
|
48
|
+
}
|
|
49
|
+
if (expand) {
|
|
50
|
+
for (const e of expand) {
|
|
51
|
+
for (const col of e.targetColumns) {
|
|
52
|
+
cols.push(`_e_${e.localField}."${col}" AS "__e_${e.localField}__${col}"`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (cols.length === 0)
|
|
57
|
+
return sql.literal("SELECT *");
|
|
58
|
+
return sql.literal(`SELECT ${cols.join(", ")}`);
|
|
59
|
+
}
|
|
60
|
+
function buildJoins(sql, expand) {
|
|
61
|
+
if (!expand || expand.length === 0)
|
|
62
|
+
return sql.literal("");
|
|
63
|
+
const joins = expand.map((e) => ` LEFT JOIN ${sql(e.targetTable)} _e_${e.localField} ON _e_${e.localField}."id" = t."${e.localField}"`);
|
|
64
|
+
return sql.literal(joins.join(""));
|
|
65
|
+
}
|
|
66
|
+
function reshapeExpand(row, expand) {
|
|
67
|
+
if (!expand || expand.length === 0)
|
|
68
|
+
return row;
|
|
69
|
+
const expandObj = {};
|
|
70
|
+
for (const e of expand) {
|
|
71
|
+
const nested = {};
|
|
72
|
+
let hasValue = false;
|
|
73
|
+
for (const col of e.targetColumns) {
|
|
74
|
+
const flatKey = `__e_${e.localField}__${col}`;
|
|
75
|
+
const val = row[flatKey];
|
|
76
|
+
if (val !== undefined) {
|
|
77
|
+
nested[col] = val;
|
|
78
|
+
hasValue = true;
|
|
79
|
+
}
|
|
80
|
+
delete row[flatKey];
|
|
81
|
+
}
|
|
82
|
+
if (hasValue) {
|
|
83
|
+
expandObj[e.localField] = nested;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (Object.keys(expandObj).length > 0) {
|
|
87
|
+
row.expand = expandObj;
|
|
88
|
+
}
|
|
89
|
+
return row;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The default `Repository` implementation layer.
|
|
93
|
+
* Provides schema-agnostic CRUD using Effect SQL template literals.
|
|
94
|
+
* Generates IDs via `CryptoService.randomBytes`, manages `seqId` via auto-increment.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* Layer.provideMerge(RepositoryLive)
|
|
98
|
+
*
|
|
99
|
+
* @see Repository — the service tag
|
|
100
|
+
*/
|
|
101
|
+
export const RepositoryLive = Layer.effect(Repository, Effect.gen(function* () {
|
|
102
|
+
const sql = yield* SqlClient.SqlClient;
|
|
103
|
+
const crypto = yield* CryptoService;
|
|
104
|
+
return Repository.of({
|
|
105
|
+
create: (table, data) => Effect.gen(function* () {
|
|
106
|
+
const buf = yield* crypto.randomBytes(12);
|
|
107
|
+
const id = Buffer.from(buf).toString("base64url").slice(0, 15);
|
|
108
|
+
const now = new Date().toISOString();
|
|
109
|
+
const record = { ...data, id, created: now, updated: now };
|
|
110
|
+
yield* sql `INSERT INTO ${sql(table)} ${sql.insert(record)}`;
|
|
111
|
+
return record;
|
|
112
|
+
}).pipe(Effect.withSpan("repository.create", { kind: "client", attributes: { table } })),
|
|
113
|
+
view: (table, id) => Effect.gen(function* () {
|
|
114
|
+
const rows = yield* sql `SELECT * FROM ${sql(table)} t WHERE t.id = ${id} LIMIT 1`;
|
|
115
|
+
return rows.length > 0 ? Option.some(rows[0]) : Option.none();
|
|
116
|
+
}).pipe(Effect.withSpan("repository.view", { kind: "client", attributes: { table } })),
|
|
117
|
+
update: (table, id, data) => Effect.gen(function* () {
|
|
118
|
+
const now = new Date().toISOString();
|
|
119
|
+
const patch = { ...data, updated: now };
|
|
120
|
+
yield* sql `UPDATE ${sql(table)} SET ${sql.update(patch, ["id", "created"])} WHERE id = ${id}`;
|
|
121
|
+
const rows = yield* sql `SELECT * FROM ${sql(table)} t WHERE t.id = ${id} LIMIT 1`;
|
|
122
|
+
return rows.length > 0 ? Option.some(rows[0]) : Option.none();
|
|
123
|
+
}).pipe(Effect.withSpan("repository.update", { kind: "client", attributes: { table } })),
|
|
124
|
+
viewFilter: (table, filter) => Effect.gen(function* () {
|
|
125
|
+
const where = unsafeFragment(filter.where.sql, filter.where.params);
|
|
126
|
+
const order = orderFrag(sql, filter.sort);
|
|
127
|
+
const select = buildSelect(sql, filter.fields, filter.expand);
|
|
128
|
+
const joins = buildJoins(sql, filter.expand);
|
|
129
|
+
const rows = yield* sql `${select} FROM ${sql(table)} t${joins} WHERE ${where}${order}`;
|
|
130
|
+
return rows.map((r) => reshapeExpand(r, filter.expand));
|
|
131
|
+
}).pipe(Effect.withSpan("repository.viewFilter", { kind: "client", attributes: { table } })),
|
|
132
|
+
list: (table, limit, options) => Effect.gen(function* () {
|
|
133
|
+
const order = orderFrag(sql, options?.sort);
|
|
134
|
+
const select = buildSelect(sql, options?.fields, options?.expand);
|
|
135
|
+
const joins = buildJoins(sql, options?.expand);
|
|
136
|
+
const items = options?.where
|
|
137
|
+
? yield* sql `${select} FROM ${sql(table)} t${joins} WHERE ${unsafeFragment(options.where.sql, options.where.params)}${order} LIMIT ${limit}`
|
|
138
|
+
: yield* sql `${select} FROM ${sql(table)} t${joins}${order} LIMIT ${limit}`;
|
|
139
|
+
return { items: items.map((r) => reshapeExpand(r, options?.expand)) };
|
|
140
|
+
}).pipe(Effect.withSpan("repository.list", { kind: "client", attributes: { table } })),
|
|
141
|
+
delete: (table, id) => Effect.gen(function* () {
|
|
142
|
+
const check = yield* sql `SELECT 1 FROM ${sql(table)} WHERE id = ${id} LIMIT 1`;
|
|
143
|
+
if (check.length === 0)
|
|
144
|
+
return Option.none();
|
|
145
|
+
yield* sql `DELETE FROM ${sql(table)} WHERE id = ${id}`;
|
|
146
|
+
return Option.some(undefined);
|
|
147
|
+
}).pipe(Effect.withSpan("repository.delete", { kind: "client", attributes: { table } }))
|
|
148
|
+
});
|
|
149
|
+
}));
|
|
150
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/repository/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE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