This is the monorepo for the Miroir Framework
Clone git repository
$ git clone https://github.com/miroir-framework/miroir.git
go to the created directory, and download dependencies:
$ npm install
build the client and server (shell):
npm run devBuild -w miroir-core && npm run build -w miroir-localcache-redux -w miroir-server-msw-stub -w miroir-store-filesystem -w miroir-store-indexedDb -w miroir-store-postgres
TBW
there must be an "admin" user/schema, that is used as a life line, to create / administer other user/schemas.
Use of the server is not mandatory to develop on the client, as MSW can be used to simulate the server.
build server in backround (useful when developing the server):
npm run build-tsup -w miroir-server
launch server:
npm run dev -w miroir-server
launch client:
npm run startDev -w miroir-standalone-app
$ VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-core -- domainSelector
results in:
PASS tests/2_domain/domainSelector.unit.test.ts
domainSelector
√ error on non-existing Entity: EntityNotFound (151 ms)
√ error on non-existing Entity: EntityNotFound (17 ms)
√ error on non-existing object uuid: InstanceNotFound (14 ms)
√ select 1 object from Domain State (22 ms)
√ select 1 object from Domain State using context reference (19 ms)
√ select 1 object from Domain State using direct query parameter reference (19 ms)
√ select 1 object from the uuid found in an attribute of another object from Domain State (21 ms)
√ select Authors (10 ms)
√ select Books of Publisher of given Book from Domain State (30 ms)
√ select custom-built result: Books of Publisher of given Book from Domain State (27 ms)
√ select custom-built result with queryCombiner: instances of all Entites from Domain State, indexed by Entity Uuid (10 ms)
Test Suites: 1 skipped, 1 passed, 1 of 2 total
Tests: 1 skipped, 11 passed, 12 total
Snapshots: 0 total
Time: 6.032 s, estimated 8 s
Ran all test suites with tests matching "domainSelector".
To test the DomainSelector, first compile miroir-core:
npm run preTestNodeNext -w miroir-core
then run the test:
npm run testNode -w miroir-core -- domainSelector
to run all the miroir-core unit tests:
npm run testNode -w miroir-core
The LocalStoreController can be tested:
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-emulatedServer-indexedDb VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- PersistenceStoreController
Should result in something resembling:
✓ 4_storage/PersistenceStoreController.integ.test.tsx (12 tests) 1522ms
Test Files 1 passed (1)
Tests 12 passed (12)
Start at 15:48:36
Duration 10.38s (transform 943ms, setup 114ms, collect 3.30s, tests 1.52s, environment 480ms, prepare 260ms)
The extractor runners ExtractorTemplatePersistenceStoreRunner (for indexedDb, Postgres/sql, filesystem peristent storage) can be tested:
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-emulatedServer-indexedDb VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- ExtractorTemplatePersistenceStoreRunner
Using jest / vitest environment only
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-emulatedServer-filesystem VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- DomainController
Using real server
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-realServer-filesystem VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- DomainController
Using jest / vitest environment only (nodejs), DB will exist as files on the local filesystem
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-emulatedServer-indexedDb VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- DomainController
Using a real server running on nodejs, DB will exist as files on the local filesystem
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-realServer-indexedDb VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- DomainController
Using jest / vitest environment only (nodejs), the "miroir" and "library" schemas are created, then dropped at the end of the test
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-emulatedServer-sql VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- DomainController
Using a real server running on nodejs, the "miroir" and "library" schemas are NOT created or dropped, they have to exist for the test to pass issue #24.
VITE_MIROIR_TEST_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/miroirConfig.test-emulatedServer-sql VITE_MIROIR_LOG_CONFIG_FILENAME=./packages/miroir-standalone-app/tests/specificLoggersConfig_DomainController_debug npm run test -w miroir-standalone-app -- DomainController
TBW
TBW