hikoutei 0.4.2 → 0.4.3
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/dist/application/sync/outbound/SheetsEffectDispatcher.d.ts +64 -0
- package/dist/application/sync/outbound/SheetsEffectDispatcher.d.ts.map +1 -0
- package/dist/application/sync/outbound/SheetsEffectDispatcher.js +440 -0
- package/dist/application/sync/outbound/SheetsEffectDispatcher.js.map +1 -0
- package/dist/application/sync/service/SyncServiceBootstrap.d.ts +3 -4
- package/dist/application/sync/service/SyncServiceBootstrap.d.ts.map +1 -1
- package/dist/application/sync/service/SyncServiceBootstrap.js +7 -4
- package/dist/application/sync/service/SyncServiceBootstrap.js.map +1 -1
- package/dist/application/sync/telemetry/syncTiming.d.ts +20 -33
- package/dist/application/sync/telemetry/syncTiming.d.ts.map +1 -1
- package/dist/application/sync/telemetry/syncTiming.js +14 -12
- package/dist/application/sync/telemetry/syncTiming.js.map +1 -1
- package/dist/infrastructure/storage/errors.d.ts +10 -5
- package/dist/infrastructure/storage/errors.d.ts.map +1 -1
- package/dist/infrastructure/storage/errors.js +10 -7
- package/dist/infrastructure/storage/errors.js.map +1 -1
- package/dist/infrastructure/storage/index.d.ts +6 -4
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/infrastructure/storage/index.js +3 -2
- package/dist/infrastructure/storage/index.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.d.ts +12 -11
- package/dist/infrastructure/storage/sqlite/schema.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.js +17 -109
- package/dist/infrastructure/storage/sqlite/schema.js.map +1 -1
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.d.ts +2 -2
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.js +2 -2
- package/dist/infrastructure/storage/state/canonical/canonicalCommit.js.map +1 -1
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.d.ts +1 -2
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.js +1 -2
- package/dist/infrastructure/storage/state/mapped/mappedPersistenceContext.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationCanonical.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationCanonical.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.js +1 -1
- package/dist/infrastructure/storage/state/observation/observationQuarantine.js.map +1 -1
- package/dist/infrastructure/storage/state/observation/observationTypes.d.ts +1 -1
- package/dist/infrastructure/storage/state/observation/observationTypes.d.ts.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/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 +1 -2
- package/dist/infrastructure/storage/state/observation/observationWriter.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.d.ts +1 -2
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.js +1 -2
- package/dist/infrastructure/storage/state/resolution/resolutionWriter.js.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterContracts.d.ts +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterContracts.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.d.ts +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/state/resolution/resolutionWriterHelpers.js +1 -1
- 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 -2
- package/dist/infrastructure/storage/state/resolution/resolutionWriterSql.js.map +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.d.ts +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.d.ts.map +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.js +1 -1
- package/dist/infrastructure/storage/sync/shared/spreadsheetAuthority.js.map +1 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.d.ts +1 -1
- package/dist/infrastructure/storage/sync/shared/syncRegistry.js +1 -1
- package/package.json +13 -7
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.d.ts +0 -66
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.js +0 -123
- package/dist/application/sync/outbound/effects/AdaptiveEffectBatchController.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.d.ts +0 -111
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.js +0 -369
- package/dist/application/sync/outbound/effects/SyncEffectSupervisor.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorker.d.ts +0 -127
- package/dist/application/sync/outbound/effects/SyncEffectWorker.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorker.js +0 -552
- package/dist/application/sync/outbound/effects/SyncEffectWorker.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.d.ts +0 -85
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.js +0 -74
- package/dist/application/sync/outbound/effects/SyncEffectWorkerConstants.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.d.ts +0 -31
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.js +0 -222
- package/dist/application/sync/outbound/effects/SyncEffectWorkerDispatch.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.d.ts +0 -14
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.js +0 -25
- package/dist/application/sync/outbound/effects/SyncEffectWorkerHelpers.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.d.ts +0 -61
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.js +0 -296
- package/dist/application/sync/outbound/effects/SyncEffectWorkerRouting.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.d.ts +0 -17
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.js +0 -80
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTiming.js.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.d.ts +0 -13
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.d.ts.map +0 -1
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.js +0 -248
- package/dist/application/sync/outbound/effects/SyncEffectWorkerTransitions.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.d.ts +0 -141
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.js +0 -318
- package/dist/infrastructure/storage/sync/outbound/effectOutbox.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.d.ts +0 -143
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.js +0 -16
- package/dist/infrastructure/storage/sync/outbound/effectOutboxContracts.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.d.ts +0 -33
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.js +0 -259
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSql.js.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.d.ts +0 -27
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.js +0 -316
- package/dist/infrastructure/storage/sync/outbound/effectOutboxSupport.js.map +0 -1
- package/dist/infrastructure/storage/sync/shared/writerLease.d.ts +0 -76
- package/dist/infrastructure/storage/sync/shared/writerLease.d.ts.map +0 -1
- package/dist/infrastructure/storage/sync/shared/writerLease.js +0 -189
- package/dist/infrastructure/storage/sync/shared/writerLease.js.map +0 -1
- package/docs/advanced-sheets-gateway-concurrency-problem.md +0 -434
- package/docs/architecture.md +0 -224
- package/docs/ci.md +0 -293
- package/docs/code-guidelines.md +0 -248
- package/docs/development.md +0 -74
- package/docs/gateway-removal-inventory.md +0 -147
- package/docs/git-workflow.md +0 -224
- package/docs/google-sheets-sync-scaling-strategy.md +0 -459
- package/docs/mikro-orm-adapter-spike.md +0 -89
- package/docs/quick-start.md +0 -137
- package/docs/sql-layer-plan.md +0 -59
- package/docs/sync-bulk-write-benchmark.md +0 -2117
- package/docs/sync-observability.md +0 -100
- package/docs/task-queue-write-model.md +0 -640
- package/docs/typed-sheets-mvp-scope-2026-06-29.md +0 -490
- package/docs/typed-sheets-plan.md +0 -417
- package/docs/write-and-synchronization-flow.md +0 -179
package/docs/quick-start.md
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
# Hikoutei Quick Start
|
|
2
|
-
|
|
3
|
-
Hikoutei is a typed repository and safe write layer for Google Sheets-backed MVPs.
|
|
4
|
-
SQLite is the application authority; Google Sheets is an asynchronous internal
|
|
5
|
-
projection and human input surface.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
npm install hikoutei @mikro-orm/core @mikro-orm/sql
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The root API does not expose MikroORM, SQL, or sync-worker types.
|
|
14
|
-
The current built-in SQLite provider uses the optional MikroORM peer
|
|
15
|
-
dependencies internally.
|
|
16
|
-
|
|
17
|
-
## Define an entity
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { createTypedSheets, defineTypedSheetsEntity } from "hikoutei";
|
|
21
|
-
|
|
22
|
-
const User = defineTypedSheetsEntity({
|
|
23
|
-
name: "User",
|
|
24
|
-
tableName: "users",
|
|
25
|
-
properties: {
|
|
26
|
-
id: { type: "string", primary: true },
|
|
27
|
-
name: { type: "string" },
|
|
28
|
-
active: { type: "boolean" },
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const hikoutei = await createTypedSheets({
|
|
33
|
-
dbName: "./hikoutei.sqlite",
|
|
34
|
-
entities: [User],
|
|
35
|
-
});
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
`createTypedSheets()` validates entity descriptors, opens the local SQLite
|
|
39
|
-
authority, and creates the declared entity tables. It does not contact Google
|
|
40
|
-
Sheets and accepts no Sheet route or provider option.
|
|
41
|
-
|
|
42
|
-
## Entity lifecycle
|
|
43
|
-
|
|
44
|
-
Use a request-local manager. Reads come from SQLite, never from a remote Sheet.
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
const em = hikoutei.em.fork();
|
|
48
|
-
|
|
49
|
-
const user = em.create(User, {
|
|
50
|
-
id: "u1",
|
|
51
|
-
name: "Ada",
|
|
52
|
-
active: true,
|
|
53
|
-
});
|
|
54
|
-
em.persist(user);
|
|
55
|
-
await em.flush();
|
|
56
|
-
|
|
57
|
-
const loaded = await em.findOne(User, { id: "u1" });
|
|
58
|
-
if (loaded !== null) {
|
|
59
|
-
loaded.name = "Ada Lovelace";
|
|
60
|
-
await em.flush();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
await em.transactional(async (transactionalEm) => {
|
|
64
|
-
const target = await transactionalEm.findOne(User, { id: "u1" });
|
|
65
|
-
if (target !== null) transactionalEm.remove(target);
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The stable lifecycle methods are `fork()`, `create()`, `find()`, `findOne()`,
|
|
70
|
-
`persist()`, `remove()`, `flush()`, and `transactional()`. Relations and
|
|
71
|
-
provider-specific query operators are not part of the scalar release.
|
|
72
|
-
|
|
73
|
-
## Internal Sheet synchronization
|
|
74
|
-
|
|
75
|
-
Applications do not call Sheet APIs or choose a write operation for each
|
|
76
|
-
entity change. A service-side internal sync bootstrap owns:
|
|
77
|
-
|
|
78
|
-
- projection routes and user-owned field configuration
|
|
79
|
-
- provider credentials (service account) and spreadsheet ID
|
|
80
|
-
- local projection registration and remote provisioning
|
|
81
|
-
- the outbound effect supervisor and durable outbox delivery
|
|
82
|
-
- User_Input polling, evaluation, conflict handling, and reconciliation
|
|
83
|
-
|
|
84
|
-
When that internal service mode is active, `flush()` commits the entity table,
|
|
85
|
-
canonical sync state, and durable Sheet effect outbox in one SQLite transaction.
|
|
86
|
-
The call still does not wait for the remote Sheet write.
|
|
87
|
-
|
|
88
|
-
The internal service provisions and validates the registered tabs before it
|
|
89
|
-
starts delivery. Schema drift or provider setup failure stops service startup
|
|
90
|
-
rather than silently changing a remote Sheet. These service modules are under
|
|
91
|
-
`src/application/sync/service/` and are intentionally not re-exported from the
|
|
92
|
-
package root.
|
|
93
|
-
|
|
94
|
-
### Full direct provider (service account, recommended)
|
|
95
|
-
|
|
96
|
-
The bootstrap can run the entire sync path with ONE Google Sheets API
|
|
97
|
-
provider by setting the internal `googleSheetsApi` option. The provider
|
|
98
|
-
authenticates with Application Default Credentials — set
|
|
99
|
-
`GOOGLE_APPLICATION_CREDENTIALS` to a service-account key that is shared on
|
|
100
|
-
the spreadsheet — and implements provisioning (creating missing tabs and
|
|
101
|
-
headers in one atomic batch), fast append, guarded update/delete, receipt,
|
|
102
|
-
replay, response-loss recovery, values-only table reads, row anchors, and
|
|
103
|
-
User_Input observation. No Apps Script deployment is needed.
|
|
104
|
-
|
|
105
|
-
The provider disables SDK auto-retry, spaces every request start at 1,100 ms
|
|
106
|
-
per class (reads and writes separately), and telemetries only operation
|
|
107
|
-
names, counts, durations, and stable codes. One SQLite runtime stays the
|
|
108
|
-
single authoritative writer per spreadsheet.
|
|
109
|
-
|
|
110
|
-
## Removed: Apps Script gateway
|
|
111
|
-
|
|
112
|
-
The signed Apps Script gateway and the `appsScript`/`googleApiWorker` options
|
|
113
|
-
were removed in this cleanup. The service-account `googleSheetsApi` provider
|
|
114
|
-
above is the only sync path; existing deployments should switch to it. The
|
|
115
|
-
provider reads and writes the same tabs, receipt sheet, and anchor metadata,
|
|
116
|
-
so existing spreadsheets keep working without re-provisioning.
|
|
117
|
-
|
|
118
|
-
Sheet consistency does not rely on cross-request Sheet transactions; it comes
|
|
119
|
-
from the hidden effect-receipt tab, effect-id/payload-hash dedupe, the SQLite
|
|
120
|
-
durable outbox, fencing, and postcondition recovery.
|
|
121
|
-
|
|
122
|
-
Live Google integration is opt-in and requires a service account, credentials,
|
|
123
|
-
a spreadsheet, and external quota. The normal test suite uses fake providers
|
|
124
|
-
and SQLite fixtures without credentials.
|
|
125
|
-
|
|
126
|
-
## Read/write guarantees
|
|
127
|
-
|
|
128
|
-
- SQLite is the source of truth for application reads.
|
|
129
|
-
- `flush()` returns after the local SQLite transaction commits.
|
|
130
|
-
- Sheet delivery is asynchronous and at-least-once.
|
|
131
|
-
- Stale or conflicting User_Input edits are recorded in SQLite rather than
|
|
132
|
-
silently overwriting canonical data.
|
|
133
|
-
- Provider response loss is recoverable work, not proof of a failed remote write.
|
|
134
|
-
- Sheet consistency comes from the hidden effect-receipt tab,
|
|
135
|
-
effect-id/payload-hash dedupe, the SQLite durable outbox, fencing, and
|
|
136
|
-
postcondition recovery, not cross-request Sheet transactions.
|
|
137
|
-
- Projection route/header drift fails explicitly.
|
package/docs/sql-layer-plan.md
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# SQL Layer Plan
|
|
2
|
-
|
|
3
|
-
## Positioning
|
|
4
|
-
|
|
5
|
-
The SQL layer should sit above the existing repository/core layer.
|
|
6
|
-
|
|
7
|
-
It should not turn Google Sheets into a general database. The goal is a small, predictable SQL subset for MVPs, internal tools, and low-traffic admin workflows.
|
|
8
|
-
|
|
9
|
-
## Initial SQL Subset
|
|
10
|
-
|
|
11
|
-
Candidate first subset:
|
|
12
|
-
|
|
13
|
-
```sql
|
|
14
|
-
SELECT * FROM Users;
|
|
15
|
-
SELECT * FROM Users WHERE id = ?;
|
|
16
|
-
INSERT INTO Users (id, email, active, _version) VALUES (?, ?, ?, ?);
|
|
17
|
-
UPDATE Users SET active = ? WHERE id = ?;
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Required Constraints
|
|
21
|
-
|
|
22
|
-
- One sheet tab maps to one table.
|
|
23
|
-
- Table schema still comes from typed column definitions.
|
|
24
|
-
- Header drift still fails.
|
|
25
|
-
- `_version` optimistic locking remains the write-safety mechanism.
|
|
26
|
-
- SQL parsing should call repository operations instead of bypassing them.
|
|
27
|
-
|
|
28
|
-
## Out of Scope for the First SQL Version
|
|
29
|
-
|
|
30
|
-
- Joins.
|
|
31
|
-
- Transactions.
|
|
32
|
-
- Multi-row atomic writes.
|
|
33
|
-
- Aggregations.
|
|
34
|
-
- Nested queries.
|
|
35
|
-
- Arbitrary expressions.
|
|
36
|
-
- Cross-spreadsheet queries.
|
|
37
|
-
|
|
38
|
-
## Implementation Direction
|
|
39
|
-
|
|
40
|
-
The SQL layer should be a separate package or module above core:
|
|
41
|
-
|
|
42
|
-
```txt
|
|
43
|
-
sql query
|
|
44
|
-
-> parser
|
|
45
|
-
-> typed table registry
|
|
46
|
-
-> repository operation
|
|
47
|
-
-> adapter
|
|
48
|
-
-> Google Sheets API
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
This keeps schema drift detection, parsing, duplicate key checks, and optimistic locking in one place.
|
|
52
|
-
|
|
53
|
-
## 한국어
|
|
54
|
-
|
|
55
|
-
SQL layer는 현재 repository/core layer 위에 올라가는 구조가 맞습니다.
|
|
56
|
-
|
|
57
|
-
목표는 Google Sheets를 범용 DB로 만드는 것이 아니라, MVP/internal tool/low-traffic admin을 위한 작고 예측 가능한 SQL subset을 제공하는 것입니다.
|
|
58
|
-
|
|
59
|
-
초기 SQL은 `SELECT`, key 기반 `WHERE`, `INSERT`, 단순 `UPDATE` 정도로 제한하는 것이 좋습니다. Join, transaction, multi-row atomic write는 후순위입니다.
|