hikoutei 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +13 -21
- package/README.ko.md +14 -22
- package/README.md +25 -29
- package/dist/adapter/persistence/contracts/sql.d.ts +16 -2
- package/dist/adapter/persistence/contracts/sql.d.ts.map +1 -1
- package/dist/adapter/persistence/contracts/sql.js +11 -1
- package/dist/adapter/persistence/contracts/sql.js.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmScalarPersistenceProvider.d.ts +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmScalarPersistenceProvider.d.ts.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmScalarPersistenceProvider.js +40 -14
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmScalarPersistenceProvider.js.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmTypedSheetsEntityManager.d.ts +2 -0
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmTypedSheetsEntityManager.d.ts.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmTypedSheetsEntityManager.js +23 -8
- package/dist/adapter/persistence/providers/mikro-orm/api/MikroOrmTypedSheetsEntityManager.js.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmMappedTypedSheets.d.ts +13 -4
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmMappedTypedSheets.d.ts.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmMappedTypedSheets.js +12 -2
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmMappedTypedSheets.js.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarEntityRuntime.d.ts +21 -0
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarEntityRuntime.d.ts.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarEntityRuntime.js +59 -0
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarEntityRuntime.js.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarRuntime.d.ts +14 -13
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarRuntime.d.ts.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarRuntime.js +43 -64
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmScalarRuntime.js.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmTypedSheetsEngine.d.ts.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmTypedSheetsEngine.js +4 -2
- package/dist/adapter/persistence/providers/mikro-orm/engine/MikroOrmTypedSheetsEngine.js.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmMappedObservation.d.ts.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmMappedObservation.js +1 -2
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmMappedObservation.js.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPolling.d.ts +61 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPolling.d.ts.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPolling.js +186 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPolling.js.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingInspection.d.ts +56 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingInspection.d.ts.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingInspection.js +275 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingInspection.js.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingPersistence.d.ts +11 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingPersistence.d.ts.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingPersistence.js +345 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingPersistence.js.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingSql.d.ts +65 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingSql.d.ts.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingSql.js +51 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingSql.js.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingState.d.ts +36 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingState.d.ts.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingState.js +126 -0
- package/dist/adapter/persistence/providers/mikro-orm/observation/MikroOrmUserInputPollingState.js.map +1 -0
- package/dist/adapter/persistence/providers/mikro-orm/storage/MikroOrmSqliteAdapter.d.ts +11 -2
- package/dist/adapter/persistence/providers/mikro-orm/storage/MikroOrmSqliteAdapter.d.ts.map +1 -1
- package/dist/adapter/persistence/providers/mikro-orm/storage/MikroOrmSqliteAdapter.js +39 -0
- package/dist/adapter/persistence/providers/mikro-orm/storage/MikroOrmSqliteAdapter.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperation.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperation.js +46 -35
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperation.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.js +22 -4
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/effect/effectOperationScript.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.d.ts +2 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.js +47 -54
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/observation/observationOperation.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/read/tableReadOperation.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/read/tableReadOperation.js +6 -30
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/read/tableReadOperation.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/write/fastAppendOperation.d.ts +1 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/write/fastAppendOperation.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/write/fastAppendOperation.js +79 -22
- package/dist/adapter/sheets/providers/apps-script-gateway/operations/write/fastAppendOperation.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/codeGsProtocol.d.ts +2 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/codeGsProtocol.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/codeGsProtocol.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.d.ts +5 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.js +19 -4
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/syncProtocol.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/timing.js +5 -6
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/timing.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/validation.d.ts +2 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/validation.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/validation.js +2 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/protocol/validation.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/transport/operationClient.d.ts +2 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/transport/operationClient.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/transport/operationClient.js +15 -19
- package/dist/adapter/sheets/providers/apps-script-gateway/transport/operationClient.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/transport/operationSyncGateway.d.ts.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/transport/operationSyncGateway.js +44 -30
- package/dist/adapter/sheets/providers/apps-script-gateway/transport/operationSyncGateway.js.map +1 -1
- package/dist/adapter/sheets/providers/apps-script-gateway/validation.d.ts +3 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/validation.d.ts.map +1 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/validation.js +10 -0
- package/dist/adapter/sheets/providers/apps-script-gateway/validation.js.map +1 -0
- package/dist/api/Hikoutei.d.ts +17 -50
- package/dist/api/Hikoutei.d.ts.map +1 -1
- package/dist/api/Hikoutei.js +46 -105
- package/dist/api/Hikoutei.js.map +1 -1
- package/dist/api/entity.d.ts +9 -10
- package/dist/api/entity.d.ts.map +1 -1
- package/dist/api/entity.js +20 -26
- package/dist/api/entity.js.map +1 -1
- package/dist/api/errors.d.ts +0 -6
- package/dist/api/errors.d.ts.map +1 -1
- package/dist/api/errors.js +0 -6
- package/dist/api/errors.js.map +1 -1
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/internalEntityManager.d.ts.map +1 -1
- package/dist/api/internalEntityManager.js +33 -19
- package/dist/api/internalEntityManager.js.map +1 -1
- package/dist/application/orm/mapping/contracts.d.ts +16 -6
- package/dist/application/orm/mapping/contracts.d.ts.map +1 -1
- package/dist/application/orm/mapping/definition.d.ts.map +1 -1
- package/dist/application/orm/mapping/definition.js +47 -8
- package/dist/application/orm/mapping/definition.js.map +1 -1
- package/dist/application/orm/mapping/identity.js +1 -1
- package/dist/application/orm/mapping/identity.js.map +1 -1
- package/dist/application/orm/mapping/projection.d.ts.map +1 -1
- package/dist/application/orm/mapping/projection.js +10 -2
- package/dist/application/orm/mapping/projection.js.map +1 -1
- package/dist/application/orm/mapping/values.d.ts.map +1 -1
- package/dist/application/orm/mapping/values.js +5 -35
- package/dist/application/orm/mapping/values.js.map +1 -1
- package/dist/application/orm/persistence/flush/flushCoordinator.d.ts +3 -1
- package/dist/application/orm/persistence/flush/flushCoordinator.d.ts.map +1 -1
- package/dist/application/orm/persistence/flush/flushCoordinator.js +4 -3
- package/dist/application/orm/persistence/flush/flushCoordinator.js.map +1 -1
- package/dist/application/orm/persistence/lifecycle/entityLifecycle.js +2 -1
- package/dist/application/orm/persistence/lifecycle/entityLifecycle.js.map +1 -1
- package/dist/application/orm/persistence/projection/projectionEffects.d.ts +3 -1
- package/dist/application/orm/persistence/projection/projectionEffects.d.ts.map +1 -1
- package/dist/application/orm/persistence/projection/projectionEffects.js +14 -16
- package/dist/application/orm/persistence/projection/projectionEffects.js.map +1 -1
- package/dist/application/orm/persistence/scalar/unitOfWork.d.ts +6 -6
- package/dist/application/orm/persistence/scalar/unitOfWork.d.ts.map +1 -1
- package/dist/application/orm/persistence/scalar/unitOfWork.js +28 -28
- package/dist/application/orm/persistence/scalar/unitOfWork.js.map +1 -1
- package/dist/application/orm/persistence/support/businessKeys.d.ts.map +1 -1
- package/dist/application/orm/persistence/support/businessKeys.js +6 -24
- package/dist/application/orm/persistence/support/businessKeys.js.map +1 -1
- package/dist/application/orm/persistence/support/canonicalState.d.ts.map +1 -1
- package/dist/application/orm/persistence/support/canonicalState.js +9 -25
- package/dist/application/orm/persistence/support/canonicalState.js.map +1 -1
- package/dist/application/orm/persistence/support/contracts.d.ts +0 -57
- package/dist/application/orm/persistence/support/contracts.d.ts.map +1 -1
- package/dist/application/orm/persistence/support/contracts.js +0 -68
- package/dist/application/orm/persistence/support/contracts.js.map +1 -1
- package/dist/application/orm/persistence/support/helpers.d.ts +1 -11
- package/dist/application/orm/persistence/support/helpers.d.ts.map +1 -1
- package/dist/application/orm/persistence/support/helpers.js +1 -21
- package/dist/application/orm/persistence/support/helpers.js.map +1 -1
- package/dist/application/sync/gateway/constants.d.ts +2 -1
- package/dist/application/sync/gateway/constants.d.ts.map +1 -1
- package/dist/application/sync/gateway/constants.js +4 -3
- package/dist/application/sync/gateway/constants.js.map +1 -1
- package/dist/application/sync/gateway/syncGateway.d.ts.map +1 -1
- package/dist/application/sync/gateway/syncGateway.js +9 -28
- package/dist/application/sync/gateway/syncGateway.js.map +1 -1
- package/dist/application/sync/gateway/validation.d.ts +5 -0
- package/dist/application/sync/gateway/validation.d.ts.map +1 -1
- package/dist/application/sync/gateway/validation.js +22 -3
- package/dist/application/sync/gateway/validation.js.map +1 -1
- package/dist/application/sync/inbound/polling/SimpleSheetPolling.d.ts.map +1 -1
- package/dist/application/sync/inbound/polling/SimpleSheetPolling.js +3 -23
- package/dist/application/sync/inbound/polling/SimpleSheetPolling.js.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.d.ts +2 -0
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.d.ts.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.js +24 -6
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.js.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorker.d.ts.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorker.js +35 -34
- package/dist/application/sync/outbound/effects/SyncEffectWorker.js.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.d.ts +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.d.ts.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.js +8 -37
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.js.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.d.ts.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.js +2 -2
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.js.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.d.ts +0 -5
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.d.ts.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.js +3 -10
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.js.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.d.ts.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.js +13 -21
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.js.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.d.ts +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.d.ts.map +1 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.js +15 -3
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.js.map +1 -1
- package/dist/application/sync/outbound/projection/ProjectionEffectFactory.d.ts.map +1 -1
- package/dist/application/sync/outbound/projection/ProjectionEffectFactory.js +1 -10
- package/dist/application/sync/outbound/projection/ProjectionEffectFactory.js.map +1 -1
- package/dist/application/sync/outbound/reconciliation/ReconciliationScanner.d.ts.map +1 -1
- package/dist/application/sync/outbound/reconciliation/ReconciliationScanner.js +5 -9
- package/dist/application/sync/outbound/reconciliation/ReconciliationScanner.js.map +1 -1
- package/dist/application/sync/service/SyncPollingSupervisor.d.ts +45 -0
- package/dist/application/sync/service/SyncPollingSupervisor.d.ts.map +1 -0
- package/dist/application/sync/service/SyncPollingSupervisor.js +142 -0
- package/dist/application/sync/service/SyncPollingSupervisor.js.map +1 -0
- package/dist/application/sync/service/SyncServiceBootstrap.d.ts +63 -0
- package/dist/application/sync/service/SyncServiceBootstrap.d.ts.map +1 -0
- package/dist/application/sync/service/SyncServiceBootstrap.js +223 -0
- package/dist/application/sync/service/SyncServiceBootstrap.js.map +1 -0
- package/dist/application/sync/service/contracts.d.ts +25 -0
- package/dist/application/sync/service/contracts.d.ts.map +1 -0
- package/dist/application/sync/service/contracts.js +3 -0
- package/dist/application/sync/service/contracts.js.map +1 -0
- package/dist/application/sync/service/errors.d.ts +15 -0
- package/dist/application/sync/service/errors.d.ts.map +1 -0
- package/dist/application/sync/service/errors.js +16 -0
- package/dist/application/sync/service/errors.js.map +1 -0
- package/dist/domain/errors/types.d.ts +1 -1
- package/dist/domain/errors/types.d.ts.map +1 -1
- package/dist/domain/errors/types.js +2 -2
- package/dist/domain/errors/types.js.map +1 -1
- package/dist/domain/evaluate/constants.d.ts +1 -1
- package/dist/domain/evaluate/constants.d.ts.map +1 -1
- package/dist/domain/evaluate/constants.js.map +1 -1
- package/dist/domain/evaluate/preconditions.d.ts.map +1 -1
- package/dist/domain/evaluate/preconditions.js +25 -32
- package/dist/domain/evaluate/preconditions.js.map +1 -1
- package/dist/domain/evaluate/quarantine.js +4 -1
- package/dist/domain/evaluate/quarantine.js.map +1 -1
- package/dist/domain/model/constants.d.ts +48 -0
- package/dist/domain/model/constants.d.ts.map +1 -1
- package/dist/domain/model/constants.js +38 -0
- package/dist/domain/model/constants.js.map +1 -1
- package/dist/domain/model/index.d.ts +2 -2
- package/dist/domain/model/index.d.ts.map +1 -1
- package/dist/domain/model/index.js +1 -1
- package/dist/domain/model/index.js.map +1 -1
- package/dist/domain/model/types.d.ts +13 -10
- package/dist/domain/model/types.d.ts.map +1 -1
- package/dist/infrastructure/storage/constants.d.ts +1 -1
- package/dist/infrastructure/storage/constants.d.ts.map +1 -1
- package/dist/infrastructure/storage/constants.js.map +1 -1
- package/dist/infrastructure/storage/errors.d.ts +2 -2
- package/dist/infrastructure/storage/errors.d.ts.map +1 -1
- package/dist/infrastructure/storage/errors.js +3 -5
- package/dist/infrastructure/storage/errors.js.map +1 -1
- package/dist/infrastructure/storage/index.d.ts +9 -5
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/infrastructure/storage/index.js +3 -1
- package/dist/infrastructure/storage/index.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/migrateSchema.js +9 -4
- package/dist/infrastructure/storage/sqlite/migrateSchema.js.map +1 -1
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.d.ts +9 -0
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.js +35 -36
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.js.map +1 -1
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceSql.d.ts +8 -1
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceSql.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceSql.js +14 -0
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceSql.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationAudit.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationAudit.js +4 -1
- package/dist/infrastructure/storage/state/observation/observationAudit.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationCanonical.d.ts +11 -1
- package/dist/infrastructure/storage/state/observation/observationCanonical.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationCanonical.js +108 -0
- package/dist/infrastructure/storage/state/observation/observationCanonical.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.d.ts +36 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.js +55 -0
- package/dist/infrastructure/storage/state/observation/observationQuarantine.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationTypes.d.ts +22 -0
- package/dist/infrastructure/storage/state/observation/observationTypes.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationTypes.js +5 -0
- package/dist/infrastructure/storage/state/observation/observationTypes.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationValidation.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationValidation.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationValidation.js +26 -0
- package/dist/infrastructure/storage/state/observation/observationValidation.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationWriter.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationWriter.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationWriter.js +5 -1
- package/dist/infrastructure/storage/state/observation/observationWriter.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.js +3 -2
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.d.ts +1 -5
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.js +3 -43
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.d.ts +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.js +2 -4
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.js.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.d.ts +2 -2
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.js +20 -10
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.js.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.d.ts +33 -18
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.js.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.d.ts +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.js +2 -4
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.js.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.d.ts +6 -2
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.js +157 -14
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.js.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/reconciliationSql.d.ts +1 -1
- package/dist/infrastructure/storage/sync/outbound/reconciliationSql.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/outbound/reconciliationSql.js +14 -1
- package/dist/infrastructure/storage/sync/outbound/reconciliationSql.js.map +1 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.d.ts +2 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.js +4 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.js.map +1 -1
- package/dist/infrastructure/storage/sync/shared/writerLease.d.ts +4 -0
- package/dist/infrastructure/storage/sync/shared/writerLease.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/shared/writerLease.js +9 -0
- package/dist/infrastructure/storage/sync/shared/writerLease.js.map +1 -1
- package/dist/shared/constants.d.ts +4 -4
- package/dist/shared/constants.d.ts.map +1 -1
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/encoding/index.d.ts +1 -0
- package/dist/shared/encoding/index.d.ts.map +1 -1
- package/dist/shared/encoding/index.js +1 -0
- package/dist/shared/encoding/index.js.map +1 -1
- package/dist/shared/encoding/normalizedCell.d.ts +4 -0
- package/dist/shared/encoding/normalizedCell.d.ts.map +1 -0
- package/dist/shared/encoding/normalizedCell.js +29 -0
- package/dist/shared/encoding/normalizedCell.js.map +1 -0
- package/dist/shared/encoding/stableEncode.d.ts +2 -1
- package/dist/shared/encoding/stableEncode.d.ts.map +1 -1
- package/dist/shared/encoding/stableEncode.js +6 -12
- package/dist/shared/encoding/stableEncode.js.map +1 -1
- package/dist/shared/identity/index.d.ts +3 -0
- package/dist/shared/identity/index.d.ts.map +1 -0
- package/dist/shared/identity/index.js +2 -0
- package/dist/shared/identity/index.js.map +1 -0
- package/dist/shared/identity/types.d.ts +41 -0
- package/dist/shared/identity/types.d.ts.map +1 -0
- package/dist/shared/identity/types.js +34 -0
- package/dist/shared/identity/types.js.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/state/constructors.d.ts +10 -0
- package/dist/shared/state/constructors.d.ts.map +1 -0
- package/dist/shared/state/constructors.js +18 -0
- package/dist/shared/state/constructors.js.map +1 -0
- package/dist/shared/state/index.d.ts +1 -0
- package/dist/shared/state/index.d.ts.map +1 -1
- package/dist/shared/state/index.js +1 -0
- package/dist/shared/state/index.js.map +1 -1
- package/dist/shared/validation.d.ts +2 -0
- package/dist/shared/validation.d.ts.map +1 -1
- package/dist/shared/validation.js +9 -0
- package/dist/shared/validation.js.map +1 -1
- package/docs/architecture.md +108 -103
- package/docs/ci.md +184 -61
- package/docs/mikro-orm-adapter-spike.md +55 -214
- package/docs/quick-start.md +58 -96
- package/docs/write-and-synchronization-flow.md +70 -39
- package/package.json +1 -1
package/docs/ci.md
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
# CI scenarios
|
|
2
2
|
|
|
3
|
-
Hikoutei's CI
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
Hikoutei's CI runs two installed-consumer scenarios against the packed
|
|
4
|
+
package. Each is built as an installed consumer: after `npm pack` it imports
|
|
5
|
+
from the packed tarball rather than from `src/**` or the source-only test
|
|
6
|
+
fake, and neither is allowed to import those.
|
|
7
|
+
|
|
8
|
+
1. **Internal sync/gateway E2E** (`scripts/ci/run-api-scenario.mjs`) drives the
|
|
9
|
+
internal typed-sheets sync pipeline — projection registration, gateway
|
|
10
|
+
provisioning, the bounded effect worker, polling, and the MikroORM-backed
|
|
11
|
+
storage/CAS/hash machinery — and loads implementation modules directly from
|
|
12
|
+
the packed `dist/` tree.
|
|
13
|
+
2. **Installed root API smoke** (`scripts/ci/run-root-api-scenario.mjs`)
|
|
14
|
+
imports ONLY the installed package root entrypoint `hikoutei` (no internal
|
|
15
|
+
package subpaths and no source imports) and exercises the public
|
|
16
|
+
entity-lifecycle contract an application is meant to use.
|
|
17
|
+
|
|
18
|
+
The public contract is the high-level `hikoutei` root API: a SQLite-backed
|
|
19
|
+
entity lifecycle. Sheet configuration, registration, and synchronization remain
|
|
20
|
+
internal service concerns. The
|
|
8
21
|
`hikoutei/orm` and `hikoutei/mikro-orm` package subpaths are intentionally not
|
|
9
|
-
published
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
intentionally remains focused on the internal sync/gateway pipeline and should
|
|
15
|
-
not be read as public API CRUD coverage.
|
|
22
|
+
published; the root smoke performs those dynamic imports only as negative
|
|
23
|
+
boundary assertions (they must be rejected with `ERR_PACKAGE_PATH_NOT_EXPORTED`)
|
|
24
|
+
while the lifecycle itself imports only the root `hikoutei` entrypoint. This
|
|
25
|
+
guards the boundary directly in an installed consumer in addition to the
|
|
26
|
+
source-level tests.
|
|
16
27
|
|
|
17
28
|
## Internal sync/gateway E2E
|
|
18
29
|
|
|
@@ -29,13 +40,63 @@ the same lifecycle:
|
|
|
29
40
|
5. edit a User_Input value and verify that polling reports the changed row;
|
|
30
41
|
6. restore the value, delete the entity, and verify the final projection state.
|
|
31
42
|
|
|
43
|
+
## Installed root API smoke
|
|
44
|
+
|
|
45
|
+
The root smoke imports only the installed `hikoutei` root entrypoint and drives
|
|
46
|
+
the stable public lifecycle end to end against an in-memory SQLite authority
|
|
47
|
+
(`dbName: ":memory:"`):
|
|
48
|
+
|
|
49
|
+
1. define a scalar entity with `defineTypedSheetsEntity()`;
|
|
50
|
+
2. open the runtime with `createTypedSheets()` and only `dbName` plus entity tokens;
|
|
51
|
+
3. obtain a request-local manager with `em.fork()`;
|
|
52
|
+
4. `create()` / `persist()` / `flush()` one entity and `findOne()`-verify it;
|
|
53
|
+
5. mutate the loaded entity, `flush()`, and re-read it through a fresh fork to
|
|
54
|
+
confirm the mutation committed locally;
|
|
55
|
+
6. `remove()` / `flush()` and verify the entity is gone through a fresh fork;
|
|
56
|
+
7. close the runtime.
|
|
57
|
+
|
|
58
|
+
It uses assertions and writes a JSON report plus a clear pass summary. It never
|
|
59
|
+
contacts Google Sheets, never needs credentials, and never provisions remote
|
|
60
|
+
tabs, so it runs as a packed consumer only in the normal CI, develop, and stable
|
|
61
|
+
verify jobs and has no live counterpart. It is local-only — an in-memory SQLite
|
|
62
|
+
authority with no backend concept — not a fake-backend scenario like the
|
|
63
|
+
internal sync/gateway E2E. Its entity lifecycle imports only the
|
|
64
|
+
root `hikoutei` package; the `hikoutei/orm` and `hikoutei/mikro-orm` dynamic
|
|
65
|
+
imports it performs are negative boundary assertions that must be rejected,
|
|
66
|
+
not part of the lifecycle.
|
|
67
|
+
|
|
32
68
|
## Backends and triggers
|
|
33
69
|
|
|
34
|
-
The
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
70
|
+
The normal CI, develop, and stable verification jobs run **both** installed-consumer
|
|
71
|
+
scenarios — the internal sync/gateway E2E and the installed root API smoke. The
|
|
72
|
+
internal E2E uses the **fake** backend (no Google Sheets contact, no
|
|
73
|
+
credentials); the root API smoke is local-only, an in-memory SQLite authority
|
|
74
|
+
(`:memory:`) with no backend concept. The workflows are:
|
|
75
|
+
|
|
76
|
+
- `.github/workflows/ci.yml` runs on pull requests and pushes to `main` and
|
|
77
|
+
`develop`.
|
|
78
|
+
- `.github/workflows/develop-version.yml` creates the next patch version and
|
|
79
|
+
`develop-vX.Y.Z` tag after a `develop` push.
|
|
80
|
+
- `.github/workflows/develop-publish.yml` verifies and publishes that tag with
|
|
81
|
+
the `develop` dist-tag.
|
|
82
|
+
- `.github/workflows/main-version.yml` creates the next minor version and
|
|
83
|
+
`vX.Y.Z` tag after a `main` push.
|
|
84
|
+
- `.github/workflows/stable-publish.yml` verifies and publishes that tag with
|
|
85
|
+
the `latest` dist-tag.
|
|
86
|
+
|
|
87
|
+
Only the internal sync/gateway E2E has a live variant, in the separate
|
|
88
|
+
`.github/workflows/live-integration.yml` workflow. It is opt-in via
|
|
89
|
+
`workflow_dispatch` — a maintainer with write access dispatches it explicitly;
|
|
90
|
+
it never runs automatically on pull requests or pushes — and exercises
|
|
91
|
+
that single scenario against real Google Sheets with `--backend=live`. The installed root API smoke has no live
|
|
92
|
+
counterpart: it is a local-only lifecycle smoke against an in-memory SQLite
|
|
93
|
+
authority, so it never runs there.
|
|
94
|
+
|
|
95
|
+
Because live is opt-in via `workflow_dispatch`, it is triggered manually by a
|
|
96
|
+
maintainer with write access rather than automatically on pull requests, so
|
|
97
|
+
there is no forked-PR secret-exposure path. The three gateway secrets are
|
|
98
|
+
scoped to the live execution and cleanup steps only, not the whole job, so
|
|
99
|
+
checkout/setup/install/build never see them. The live run uses a dedicated test
|
|
39
100
|
spreadsheet and the following GitHub Actions secrets:
|
|
40
101
|
|
|
41
102
|
- `TYPED_SHEETS_GATEWAY_URL`
|
|
@@ -51,62 +112,124 @@ not leave the fixture behind. The Apps Script receipt tab is also removed by
|
|
|
51
112
|
the cleanup operation. Do not point the live secrets at a production
|
|
52
113
|
spreadsheet; cleanup is intentionally scoped to the dedicated CI spreadsheet.
|
|
53
114
|
|
|
54
|
-
##
|
|
115
|
+
## Develop publication
|
|
55
116
|
|
|
56
|
-
A push to `develop` runs `.github/workflows/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
117
|
+
A push to `develop` runs `.github/workflows/develop-version.yml`. It verifies
|
|
118
|
+
the merged package, increments only the patch component, updates
|
|
119
|
+
`package.json` and `package-lock.json`, commits the release version, and creates
|
|
120
|
+
an annotated tag such as `develop-v0.3.1`. The generated commit is guarded from
|
|
121
|
+
being processed as another release.
|
|
60
122
|
|
|
61
|
-
The
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
123
|
+
The tag triggers `.github/workflows/develop-publish.yml`. It repeats the
|
|
124
|
+
unit/type/build/package checks, the installed-package internal sync/gateway
|
|
125
|
+
E2E, and the installed root API smoke before publishing the numeric package
|
|
126
|
+
version with the npm `develop` dist-tag. The version has no `-beta` suffix, but
|
|
127
|
+
normal `npm install hikoutei` still resolves `latest` rather than this channel.
|
|
128
|
+
Install the develop channel explicitly:
|
|
65
129
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`0.3.0-beta.b30560831639.1`, and starting the next development cycle at
|
|
70
|
-
`0.3.1` produces `0.3.1-beta...`. The stable `package.json` version is
|
|
71
|
-
therefore unchanged by CI. A full workflow rerun receives a new version;
|
|
72
|
-
rerunning only the publish job intentionally reuses its verified artifact.
|
|
73
|
-
An already published beta version is not deleted; after a corrected run, the
|
|
74
|
-
`beta` dist-tag points to the new package on the current version line.
|
|
130
|
+
```sh
|
|
131
|
+
npm install hikoutei@develop
|
|
132
|
+
```
|
|
75
133
|
|
|
76
|
-
|
|
134
|
+
The version calculation is isolated in `scripts/ci/release-version.mjs` and is
|
|
135
|
+
covered by `test/release-version.test.ts`. For example:
|
|
77
136
|
|
|
78
|
-
```
|
|
79
|
-
|
|
137
|
+
```text
|
|
138
|
+
0.3.0 + patch → 0.3.1
|
|
139
|
+
0.3.1 + patch → 0.3.2
|
|
80
140
|
```
|
|
81
141
|
|
|
142
|
+
The workflow requires a repository `RELEASE_TOKEN` secret with contents write
|
|
143
|
+
permission. A token other than the default `GITHUB_TOKEN` is used because a
|
|
144
|
+
push made by `GITHUB_TOKEN` does not trigger another workflow; the release tag
|
|
145
|
+
must trigger `develop-publish.yml`. The publish job separately requires
|
|
146
|
+
`NPM_TOKEN` plus npm provenance. The branch SHA is checked immediately before
|
|
147
|
+
pushing, and the commit plus tag use one atomic Git push, so a concurrent
|
|
148
|
+
develop merge fails without leaving a stale release tag. The version commit and
|
|
149
|
+
npm publication are not atomic; a failed publish can be retried from the
|
|
150
|
+
existing `develop-vX.Y.Z` tag after verifying that the version has not already
|
|
151
|
+
been published.
|
|
152
|
+
|
|
82
153
|
## Stable publication
|
|
83
154
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
not bump versions automatically.
|
|
155
|
+
A push to `main` runs `.github/workflows/main-version.yml`. It verifies the
|
|
156
|
+
merged package, increments the minor component, updates the package manifests,
|
|
157
|
+
commits the release version, and creates an annotated tag such as `v0.4.0`:
|
|
88
158
|
|
|
89
|
-
|
|
159
|
+
```text
|
|
160
|
+
0.3.1 + minor → 0.4.0
|
|
161
|
+
```
|
|
90
162
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
163
|
+
The tag triggers `.github/workflows/stable-publish.yml`. That workflow only
|
|
164
|
+
validates the numeric tag and matching package manifest versions, reruns the
|
|
165
|
+
full checks and installed-consumer scenarios, and publishes to npm with the
|
|
166
|
+
`latest` dist-tag. A `develop-v0.3.1` tag cannot trigger this numeric `vX.Y.Z`
|
|
167
|
+
workflow.
|
|
168
|
+
|
|
169
|
+
The main version workflow uses the same `RELEASE_TOKEN` requirement so its
|
|
170
|
+
`vX.Y.Z` tag triggers `stable-publish.yml`. The stable publish job also
|
|
171
|
+
requires the repository `NPM_TOKEN` secret and npm provenance before publishing
|
|
172
|
+
`latest`. After a stable main release, merge
|
|
173
|
+
`main` back into `develop` so the next patch release starts from the new stable
|
|
174
|
+
baseline. Stable package versions are
|
|
175
|
+
immutable on npm, so reusing a published version fails instead of replacing
|
|
176
|
+
it. Normal users install the stable channel with:
|
|
101
177
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
178
|
+
```sh
|
|
179
|
+
npm install hikoutei
|
|
180
|
+
```
|
|
105
181
|
|
|
106
182
|
## Artifacts
|
|
107
183
|
|
|
108
|
-
The
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
184
|
+
The CI, develop, and stable jobs each emit a JSON report for **both**
|
|
185
|
+
scenarios (internal sync/gateway E2E and installed root API smoke). The live
|
|
186
|
+
job emits a JSON report only for the internal sync/gateway E2E, the single
|
|
187
|
+
scenario it runs. Both runner scripts (`run-api-scenario.mjs` and
|
|
188
|
+
`run-root-api-scenario.mjs`) default their `--summary` option to
|
|
189
|
+
`GITHUB_STEP_SUMMARY`, so in GitHub Actions every CI/develop/stable invocation
|
|
190
|
+
writes a step summary even though none passes `--summary` explicitly. The live
|
|
191
|
+
internal E2E run is the only invocation that passes `--summary` explicitly
|
|
192
|
+
(`--summary="$GITHUB_STEP_SUMMARY"`), which resolves to the same default but
|
|
193
|
+
documents the intent. The develop and stable verify jobs upload their two
|
|
194
|
+
installed-consumer scenario reports as a dedicated reports artifact
|
|
195
|
+
(`if: always()`), separate from the package artifact (`if: success()`) that the
|
|
196
|
+
publish job consumes. Setup time and steady-state time are reported separately
|
|
197
|
+
for the internal E2E so spreadsheet creation and header provisioning do not
|
|
198
|
+
distort the internal sync/gateway measurements.
|
|
199
|
+
|
|
200
|
+
The develop and stable package artifacts are each a single directory that
|
|
201
|
+
holds the npm tarball and its `sha256` checksum together under
|
|
202
|
+
`$RUNNER_TEMP/hikoutei-{develop,stable}-package`. Their GitHub artifact names
|
|
203
|
+
are `hikoutei-develop-package` and `hikoutei-stable-package`; the installed
|
|
204
|
+
consumer report artifacts are `hikoutei-develop-fake-installed-consumer` and
|
|
205
|
+
`hikoutei-stable-fake-installed-consumer`. The normal CI report artifact is
|
|
206
|
+
`hikoutei-fake-installed-consumer`. The publish job downloads the corresponding
|
|
207
|
+
package directory, asserts it contains exactly one `hikoutei-*.tgz` and the
|
|
208
|
+
checksum file, verifies the checksum line names that exact tarball (not merely
|
|
209
|
+
any file present in the directory), and only then runs `sha256sum --check`
|
|
210
|
+
before publishing. Name/version validation, npm provenance, the
|
|
211
|
+
`develop`/`latest` dist-tags, and the stale branch SHA checks are enforced by
|
|
212
|
+
the corresponding workflows.
|
|
213
|
+
|
|
214
|
+
## Action versions
|
|
215
|
+
|
|
216
|
+
Every workflow pins `actions/checkout`, `actions/setup-node`,
|
|
217
|
+
`actions/upload-artifact`, and `actions/download-artifact` to the current
|
|
218
|
+
Node 24-compatible major (`v5`) so the JavaScript actions run on the runner's
|
|
219
|
+
Node 24 runtime:
|
|
220
|
+
|
|
221
|
+
| Action | Major | Runtime |
|
|
222
|
+
| --- | --- | --- |
|
|
223
|
+
| `actions/checkout` | `v5` | Node 24 |
|
|
224
|
+
| `actions/setup-node` | `v5` | Node 24 |
|
|
225
|
+
| `actions/upload-artifact` | `v5` | Node 24 |
|
|
226
|
+
| `actions/download-artifact` | `v5` | Node 24 |
|
|
227
|
+
|
|
228
|
+
All four are on the same major, so there is no exception to record. The pin
|
|
229
|
+
preserves behavior: artifacts are downloaded by name (not by artifact ID);
|
|
230
|
+
`upload-artifact` still zips by default; `setup-node` `cache: npm` is set
|
|
231
|
+
explicitly (the package has no `packageManager` field, so the auto-cache
|
|
232
|
+
shortcut never applies); and the publish steps set `NODE_AUTH_TOKEN` in their
|
|
233
|
+
own `env`, so npm provenance and the `id-token: write` permission are
|
|
234
|
+
unchanged. This major is the action's own runtime version; the build and
|
|
235
|
+
test job still uses `node-version: 22`.
|
|
@@ -1,248 +1,89 @@
|
|
|
1
1
|
# MikroORM SQLite Adapter and Entity Facade Spike
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
MikroORM the typed-sheets public API:
|
|
3
|
+
This spike records the current provider boundary. MikroORM is the replaceable
|
|
4
|
+
SQLite execution engine behind Hikoutei's root EntityManager; it is not part of
|
|
5
|
+
the application-facing contract.
|
|
7
6
|
|
|
8
7
|
```text
|
|
9
|
-
application
|
|
10
|
-
|
|
11
|
-
└─
|
|
8
|
+
application code
|
|
9
|
+
└─ hikoutei root EntityManager
|
|
10
|
+
└─ provider-neutral scalar persistence contract
|
|
11
|
+
└─ MikroORM + SQLite
|
|
12
|
+
└─ [internal sync service]
|
|
13
|
+
└─ canonical state and Sheet effect outbox
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
dedicated SQLite database and cannot accidentally write through the
|
|
16
|
-
application's MySQL entity manager. `TypedSheetsOrm` and
|
|
17
|
-
`TypedSheetsEntityManager` are ours; MikroORM is only the first replaceable
|
|
18
|
-
SQLite execution engine behind them.
|
|
19
|
-
|
|
20
|
-
## Public entity lifecycle
|
|
16
|
+
## Root entity lifecycle
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
without returning a raw MikroORM manager:
|
|
18
|
+
Applications use only the root package:
|
|
24
19
|
|
|
25
20
|
```ts
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
entity: Order,
|
|
36
|
-
logicalSheetId: "orders",
|
|
37
|
-
primaryKey: "id",
|
|
38
|
-
businessKey: "orderNumber",
|
|
39
|
-
schemaVersion: 1,
|
|
40
|
-
fields: [
|
|
41
|
-
{
|
|
42
|
-
property: "orderNumber",
|
|
43
|
-
cellKind: "string",
|
|
44
|
-
ownership: "user",
|
|
45
|
-
required: true,
|
|
46
|
-
unique: true,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
property: "status",
|
|
50
|
-
cellKind: "string",
|
|
51
|
-
ownership: "user",
|
|
52
|
-
required: true,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
property: "approvedAt",
|
|
56
|
-
cellKind: "date",
|
|
57
|
-
ownership: "system",
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
projections: [
|
|
61
|
-
{
|
|
62
|
-
physicalSheetId: "orders-input",
|
|
63
|
-
spreadsheetId: process.env.GOOGLE_SHEET_ID!,
|
|
64
|
-
tabName: "User_Input",
|
|
65
|
-
registeredRange: "A:B",
|
|
66
|
-
projection: "user_input",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
physicalSheetId: "orders-system",
|
|
70
|
-
spreadsheetId: process.env.GOOGLE_SHEET_ID!,
|
|
71
|
-
tabName: "System_State",
|
|
72
|
-
registeredRange: "A:D",
|
|
73
|
-
projection: "system_state",
|
|
74
|
-
},
|
|
75
|
-
],
|
|
21
|
+
import { createTypedSheets, defineTypedSheetsEntity } from "hikoutei";
|
|
22
|
+
|
|
23
|
+
const Order = defineTypedSheetsEntity({
|
|
24
|
+
name: "Order",
|
|
25
|
+
tableName: "orders",
|
|
26
|
+
properties: {
|
|
27
|
+
id: { type: "string", primary: true },
|
|
28
|
+
status: { type: "string" },
|
|
29
|
+
},
|
|
76
30
|
});
|
|
77
31
|
|
|
78
|
-
const
|
|
32
|
+
const hikoutei = await createTypedSheets({
|
|
79
33
|
dbName: "./typed-sheets.sqlite",
|
|
80
34
|
entities: [Order],
|
|
81
|
-
mappings: [orderMapping],
|
|
82
|
-
writer: { writerId: "orders-service" },
|
|
83
|
-
onRegisteredProjections: (definitions) =>
|
|
84
|
-
provisionRegisteredSyncSheets(appsScriptGateway, definitions),
|
|
85
35
|
});
|
|
86
36
|
|
|
87
|
-
const em =
|
|
88
|
-
|
|
37
|
+
const em = hikoutei.em.fork();
|
|
89
38
|
const order = em.create(Order, { id: "o-1", status: "pending" });
|
|
90
39
|
em.persist(order);
|
|
91
40
|
await em.flush();
|
|
92
|
-
|
|
93
|
-
const loaded = await em.findOne(Order, { id: "o-1" });
|
|
94
|
-
if (loaded !== null) {
|
|
95
|
-
loaded.status = "paid";
|
|
96
|
-
await em.flush();
|
|
97
|
-
}
|
|
98
41
|
```
|
|
99
42
|
|
|
100
|
-
The
|
|
101
|
-
`
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
the entire MikroORM query language.
|
|
105
|
-
|
|
106
|
-
`flush()` collects create, update, and delete changes, then the built-in mapping
|
|
107
|
-
planner writes the entity row, canonical state, row binding, business-key
|
|
108
|
-
index, and ordered Sheets outbox effects in one SQLite transaction. It does
|
|
109
|
-
not synchronously call Google Sheets. If planning throws, all of those local
|
|
110
|
-
writes roll back together.
|
|
111
|
-
|
|
112
|
-
The mapping requires exactly one `System_State` route and may additionally
|
|
113
|
-
declare one `User_Input` route. `System_State` receives the complete canonical
|
|
114
|
-
view plus a system tombstone marker. A direct create or a direct change to a
|
|
115
|
-
user-owned field also emits a candidate-preserving `User_Input` reconcile
|
|
116
|
-
effect; it does not overwrite an unresolved Sheet candidate. A direct remove
|
|
117
|
-
also creates a guarded `user_input_delete` effect when a `User_Input` route
|
|
118
|
-
exists. Its payload contains the complete expected input row, so the gateway
|
|
119
|
-
deletes only an anchored row whose visible revision and full row hash still
|
|
120
|
-
match. The worker blocks that effect rather than deleting when an unresolved
|
|
121
|
-
candidate owns any user-owned field.
|
|
122
|
-
|
|
123
|
-
The production-shaped sync gateway source at
|
|
124
|
-
`apps-script/gateway/Code.gs` is the thin operation data plane. Deploy the
|
|
125
|
-
current source before connecting a service; older deployments may not
|
|
126
|
-
understand the current signed operation protocol.
|
|
127
|
-
|
|
128
|
-
The low-level `flushCoordinator` seam remains available for an adapter author
|
|
129
|
-
or an advanced custom planner, but ordinary entity configuration no longer
|
|
130
|
-
needs it.
|
|
131
|
-
|
|
132
|
-
`onRegisteredProjections` is optional. When supplied, it receives the exact
|
|
133
|
-
registry routes and generated headers after the local SQLite registration has
|
|
134
|
-
succeeded; the example uses it to provision the reviewed Apps Script
|
|
135
|
-
allowlist. Omitting it keeps remote spreadsheet provisioning separate from
|
|
136
|
-
process startup.
|
|
137
|
-
|
|
138
|
-
## Package boundary
|
|
139
|
-
|
|
140
|
-
The typed-sheets entity lifecycle contracts are available from
|
|
141
|
-
`typed-sheets/orm`. The MikroORM-specific initializer and SQLite adapter are
|
|
142
|
-
available only from `typed-sheets/mikro-orm`. The root `typed-sheets` import
|
|
143
|
-
does not load MikroORM.
|
|
144
|
-
|
|
145
|
-
MikroORM is an optional peer dependency. This keeps the core/storage contract
|
|
146
|
-
replaceable by another persistence integration later.
|
|
43
|
+
The facade exposes `fork`, `create`, `find`, `findOne`, `persist`, `remove`,
|
|
44
|
+
`flush`, and `transactional`. Reads use SQLite only. The root runtime creates
|
|
45
|
+
entity tables and does not require Sheet routes, gateway credentials, or sync
|
|
46
|
+
provisioning.
|
|
147
47
|
|
|
148
|
-
|
|
149
|
-
import {
|
|
150
|
-
initializeMikroOrmSqliteAdapter,
|
|
151
|
-
migrateMikroOrmSqliteStorageSchema,
|
|
152
|
-
} from "typed-sheets/mikro-orm";
|
|
48
|
+
## Internal mapped service
|
|
153
49
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// Explicit on purpose: startup does not mutate a production schema unless the
|
|
160
|
-
// application opts in.
|
|
161
|
-
await migrateMikroOrmSqliteStorageSchema(storage);
|
|
162
|
-
```
|
|
50
|
+
The sync service uses the same adapter contracts but adds private mapping
|
|
51
|
+
configuration for routes and field ownership. Its bootstrap performs local
|
|
52
|
+
schema migration and projection registration, provisions the Apps Script
|
|
53
|
+
allowlist, and starts the effect/polling supervisors. Those modules are under
|
|
54
|
+
`src/application/sync/service/` and are not exported from `src/index.ts`.
|
|
163
55
|
|
|
164
|
-
`
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
contract while both schemas share the same SQLite connection.
|
|
56
|
+
In internal service mode, `flush()` plans and commits the entity row, canonical
|
|
57
|
+
state, row binding, business-key index, and ordered Sheet outbox effects in one
|
|
58
|
+
SQLite transaction. It still returns before the remote write completes.
|
|
168
59
|
|
|
169
|
-
|
|
60
|
+
The service uses the existing guarded operation model:
|
|
170
61
|
|
|
171
|
-
`
|
|
172
|
-
|
|
62
|
+
- `System_State` receives canonical materialization and tombstones.
|
|
63
|
+
- `User_Input` is updated only through guarded projection effects.
|
|
64
|
+
- response loss is recovered through durable receipts and postcondition reads.
|
|
65
|
+
- user edits are polled, evaluated with ownership and field-level CAS, and
|
|
66
|
+
accepted changes are applied to SQLite without a duplicate User_Input loop.
|
|
67
|
+
- stale, conflicting, and invalid input remains in SQLite evidence tables.
|
|
173
68
|
|
|
174
|
-
|
|
175
|
-
|
|
69
|
+
The production-shaped gateway source is
|
|
70
|
+
`apps-script/gateway/Code.gs`. Its signed transport and operation types are
|
|
71
|
+
internal adapter details; application code does not construct them.
|
|
176
72
|
|
|
177
|
-
|
|
178
|
-
const order = entityManager.create(Order, { id: "o-1", status: "pending" });
|
|
179
|
-
entityManager.persist(order);
|
|
180
|
-
await entityManager.flush();
|
|
73
|
+
## Provider boundary
|
|
181
74
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
```
|
|
75
|
+
`ScalarEntityPersistenceProvider` is the engine-neutral contract used by the
|
|
76
|
+
public EntityManager. The current `MikroOrmScalarPersistenceProvider` maps it
|
|
77
|
+
to one MikroORM SQLite connection. The mapped sync runtime exposes the same
|
|
78
|
+
connection to storage SQL, entity writes, and outbox planning so a transaction
|
|
79
|
+
cannot commit an entity mutation without its local sync work.
|
|
188
80
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
- typed-sheets canonical state
|
|
193
|
-
- pending Google Sheets effect
|
|
194
|
-
- writer lease and fencing (stale writer rejection)
|
|
195
|
-
- registered Sheet projection/allowlist
|
|
196
|
-
|
|
197
|
-
## Current boundary
|
|
198
|
-
|
|
199
|
-
The durable SQLite paths now have adapter-backed counterparts:
|
|
200
|
-
|
|
201
|
-
- writer lease, registry, canonical commit, and effect-outbox operations;
|
|
202
|
-
- `persistObservedRowWithSql()` / `persistObservedRowWithAdapter()` for
|
|
203
|
-
observation receipt, event ledger, canonical state, conflict, quarantine,
|
|
204
|
-
and effects;
|
|
205
|
-
- `persistResolutionCommandWithSql()` /
|
|
206
|
-
`persistResolutionCommandWithAdapter()` for trusted conflict commands;
|
|
207
|
-
- `runSyncEffectWorkerWithAdapter()` from `typed-sheets/mikro-orm` for Sheets
|
|
208
|
-
effect claiming, application, and recovery.
|
|
209
|
-
|
|
210
|
-
The legacy synchronous `node:sqlite` APIs remain available for existing
|
|
211
|
-
runtimes. The `WithSql` variants require a caller-owned transaction, while the
|
|
212
|
-
`WithAdapter` variants open one through the adapter. This distinction makes it
|
|
213
|
-
explicit at the call site whether a user-entity mutation must share the same
|
|
214
|
-
commit boundary.
|
|
215
|
-
|
|
216
|
-
The public mapping layer now derives canonical commits and projection effects
|
|
217
|
-
from entity lifecycle changes. It also supplies
|
|
218
|
-
`persistMappedObservedRowWithMikroOrm()` for the reverse half of the durable
|
|
219
|
-
boundary: an already-normalized, already-evaluated accepted observation is
|
|
220
|
-
stored and applied to the mapped MikroORM entity in one SQLite transaction.
|
|
221
|
-
It uses native MikroORM writes internally so it does not trigger a second
|
|
222
|
-
outbound `flush()` loop.
|
|
223
|
-
|
|
224
|
-
The raw Sheet snapshot → normalized observation → pure evaluator bridge is
|
|
225
|
-
still explicit. In particular, physical row-anchor discovery and projection
|
|
226
|
-
row-location persistence must be supplied by the existing gateway/ingestion
|
|
227
|
-
flow before an observation reaches `persistMappedObservedRowWithMikroOrm()`.
|
|
228
|
-
This prevents the mapping layer from guessing row identity from a row number or
|
|
229
|
-
business key.
|
|
230
|
-
|
|
231
|
-
`em.remove()` creates a canonical tombstone, a `System_State` tombstone
|
|
232
|
-
projection, and a guarded physical `User_Input` deletion when that route is
|
|
233
|
-
configured. A gateway response loss is resolved only through the deletion
|
|
234
|
-
effect's own receipt; an absent row by itself is never treated as proof that a
|
|
235
|
-
manual or unrelated deletion was ours. If the gateway or local conflict ledger
|
|
236
|
-
detects an active candidate, the input row is retained and the deletion effect
|
|
237
|
-
is marked `blocked_candidate` for explicit conflict handling.
|
|
238
|
-
|
|
239
|
-
The mapping/planner depends only on the adapter-neutral storage and entity
|
|
240
|
-
engine contracts. A future SQLite execution engine can replace MikroORM
|
|
241
|
-
without changing the `typedSheetsOrm.em.fork()` workflow or mapping
|
|
242
|
-
declarations.
|
|
81
|
+
A future provider can implement the scalar persistence contract without
|
|
82
|
+
changing entity lifecycle calls. A future worker process can reuse the internal
|
|
83
|
+
sync engine without changing the root API.
|
|
243
84
|
|
|
244
85
|
## Runtime requirement
|
|
245
86
|
|
|
246
87
|
The current adapter uses MikroORM 7's Node SQLite dialect, which requires Node
|
|
247
88
|
22.17 or later. Node's built-in SQLite API is still marked experimental; that
|
|
248
|
-
warning is expected in
|
|
89
|
+
warning is expected in focused adapter tests.
|