@amalgm/live 0.2.81-preview.45708334404 → 0.2.81-preview.45793205987
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/apply/plans.d.ts.map +1 -1
- package/dist/apply/plans.js +3 -1
- package/dist/apply/plans.js.map +1 -1
- package/dist/apply/showing.d.ts +2 -1
- package/dist/apply/showing.d.ts.map +1 -1
- package/dist/apply/showing.js +5 -2
- package/dist/apply/showing.js.map +1 -1
- package/dist/clash/bodmas.d.ts +3 -0
- package/dist/clash/bodmas.d.ts.map +1 -1
- package/dist/clash/bodmas.js +14 -6
- package/dist/clash/bodmas.js.map +1 -1
- package/dist/{sharing/command-input.d.ts → commands/input.d.ts} +9 -5
- package/dist/commands/input.d.ts.map +1 -0
- package/dist/{sharing/command-input.js → commands/input.js} +14 -4
- package/dist/commands/input.js.map +1 -0
- package/dist/commands/mcp.d.ts +30 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +12 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/detection/batch.d.ts +4 -0
- package/dist/detection/batch.d.ts.map +1 -1
- package/dist/detection/batch.js +4 -2
- package/dist/detection/batch.js.map +1 -1
- package/dist/detection/record-order.d.ts +9 -0
- package/dist/detection/record-order.d.ts.map +1 -1
- package/dist/detection/record-order.js +31 -4
- package/dist/detection/record-order.js.map +1 -1
- package/dist/detection/record-proposal.d.ts.map +1 -1
- package/dist/detection/record-proposal.js +9 -3
- package/dist/detection/record-proposal.js.map +1 -1
- package/dist/detection/removals.d.ts +2 -0
- package/dist/detection/removals.d.ts.map +1 -1
- package/dist/detection/removals.js +2 -0
- package/dist/detection/removals.js.map +1 -1
- package/dist/drive/drive.d.ts +2 -1
- package/dist/drive/drive.d.ts.map +1 -1
- package/dist/drive/drive.js +2 -1
- package/dist/drive/drive.js.map +1 -1
- package/dist/drive/listing.d.ts.map +1 -1
- package/dist/drive/listing.js +3 -3
- package/dist/drive/listing.js.map +1 -1
- package/dist/drive/where.d.ts +3 -0
- package/dist/drive/where.d.ts.map +1 -1
- package/dist/drive/where.js +8 -3
- package/dist/drive/where.js.map +1 -1
- package/dist/entities/cloud.d.ts.map +1 -1
- package/dist/entities/cloud.js +3 -3
- package/dist/entities/cloud.js.map +1 -1
- package/dist/entities/rules.d.ts +14 -2
- package/dist/entities/rules.d.ts.map +1 -1
- package/dist/entities/rules.js +17 -5
- package/dist/entities/rules.js.map +1 -1
- package/dist/files/accepted-files.d.ts.map +1 -1
- package/dist/files/accepted-files.js +7 -3
- package/dist/files/accepted-files.js.map +1 -1
- package/dist/files/commands.d.ts +4 -1
- package/dist/files/commands.d.ts.map +1 -1
- package/dist/files/commands.js.map +1 -1
- package/dist/files/plans.d.ts +2 -0
- package/dist/files/plans.d.ts.map +1 -1
- package/dist/files/plans.js +5 -4
- package/dist/files/plans.js.map +1 -1
- package/dist/files/usage.d.ts +12 -1
- package/dist/files/usage.d.ts.map +1 -1
- package/dist/files/usage.js +48 -5
- package/dist/files/usage.js.map +1 -1
- package/dist/git/holds.d.ts +105 -0
- package/dist/git/holds.d.ts.map +1 -0
- package/dist/git/holds.js +103 -0
- package/dist/git/holds.js.map +1 -0
- package/dist/git/index.d.ts +4 -1
- package/dist/git/index.d.ts.map +1 -1
- package/dist/git/index.js +4 -1
- package/dist/git/index.js.map +1 -1
- package/dist/git/parts.d.ts +41 -0
- package/dist/git/parts.d.ts.map +1 -0
- package/dist/git/parts.js +119 -0
- package/dist/git/parts.js.map +1 -0
- package/dist/git/places.d.ts +33 -0
- package/dist/git/places.d.ts.map +1 -0
- package/dist/git/places.js +36 -0
- package/dist/git/places.js.map +1 -0
- package/dist/git/restore.d.ts +35 -0
- package/dist/git/restore.d.ts.map +1 -0
- package/dist/git/restore.js +110 -0
- package/dist/git/restore.js.map +1 -0
- package/dist/git/tag.d.ts +57 -24
- package/dist/git/tag.d.ts.map +1 -1
- package/dist/git/tag.js +141 -31
- package/dist/git/tag.js.map +1 -1
- package/dist/git/turns.d.ts +6 -4
- package/dist/git/turns.d.ts.map +1 -1
- package/dist/git/turns.js +6 -4
- package/dist/git/turns.js.map +1 -1
- package/dist/history/history.d.ts +2 -4
- package/dist/history/history.d.ts.map +1 -1
- package/dist/history/history.js +28 -11
- package/dist/history/history.js.map +1 -1
- package/dist/history/identity.d.ts +29 -0
- package/dist/history/identity.d.ts.map +1 -0
- package/dist/history/identity.js +39 -0
- package/dist/history/identity.js.map +1 -0
- package/dist/history/index.d.ts +9 -6
- package/dist/history/index.d.ts.map +1 -1
- package/dist/history/index.js +6 -5
- package/dist/history/index.js.map +1 -1
- package/dist/history/rule.d.ts +22 -31
- package/dist/history/rule.d.ts.map +1 -1
- package/dist/history/rule.js +28 -67
- package/dist/history/rule.js.map +1 -1
- package/dist/history/runs.d.ts +35 -0
- package/dist/history/runs.d.ts.map +1 -0
- package/dist/history/runs.js +29 -0
- package/dist/history/runs.js.map +1 -0
- package/dist/history/types.d.ts +19 -17
- package/dist/history/types.d.ts.map +1 -1
- package/dist/history/types.js +5 -4
- package/dist/history/types.js.map +1 -1
- package/dist/history/version.d.ts +4 -1
- package/dist/history/version.d.ts.map +1 -1
- package/dist/history/version.js +8 -1
- package/dist/history/version.js.map +1 -1
- package/dist/records/rail.d.ts +3 -0
- package/dist/records/rail.d.ts.map +1 -1
- package/dist/records/rail.js +5 -0
- package/dist/records/rail.js.map +1 -1
- package/dist/records/send-line.d.ts +5 -0
- package/dist/records/send-line.d.ts.map +1 -1
- package/dist/records/send-line.js +14 -0
- package/dist/records/send-line.js.map +1 -1
- package/dist/sharing/commands.d.ts +3 -8
- package/dist/sharing/commands.d.ts.map +1 -1
- package/dist/sharing/commands.js +1 -1
- package/dist/sharing/commands.js.map +1 -1
- package/dist/sharing/index.d.ts +3 -2
- package/dist/sharing/index.d.ts.map +1 -1
- package/dist/sharing/index.js.map +1 -1
- package/dist/sharing/mcp.d.ts +3 -20
- package/dist/sharing/mcp.d.ts.map +1 -1
- package/dist/sharing/mcp.js +4 -9
- package/dist/sharing/mcp.js.map +1 -1
- package/dist/versions/admit.d.ts +15 -0
- package/dist/versions/admit.d.ts.map +1 -0
- package/dist/versions/admit.js +33 -0
- package/dist/versions/admit.js.map +1 -0
- package/dist/versions/api.d.ts +11 -0
- package/dist/versions/api.d.ts.map +1 -0
- package/dist/versions/api.js +102 -0
- package/dist/versions/api.js.map +1 -0
- package/dist/versions/cli-text.d.ts +8 -0
- package/dist/versions/cli-text.d.ts.map +1 -0
- package/dist/versions/cli-text.js +68 -0
- package/dist/versions/cli-text.js.map +1 -0
- package/dist/versions/cli.d.ts +20 -0
- package/dist/versions/cli.d.ts.map +1 -0
- package/dist/versions/cli.js +122 -0
- package/dist/versions/cli.js.map +1 -0
- package/dist/versions/commands.d.ts +44 -0
- package/dist/versions/commands.d.ts.map +1 -0
- package/dist/versions/commands.js +87 -0
- package/dist/versions/commands.js.map +1 -0
- package/dist/versions/content.d.ts +10 -0
- package/dist/versions/content.d.ts.map +1 -0
- package/dist/versions/content.js +29 -0
- package/dist/versions/content.js.map +1 -0
- package/dist/versions/dates.d.ts +29 -0
- package/dist/versions/dates.d.ts.map +1 -0
- package/dist/versions/dates.js +119 -0
- package/dist/versions/dates.js.map +1 -0
- package/dist/versions/deliver.d.ts +35 -0
- package/dist/versions/deliver.d.ts.map +1 -0
- package/dist/versions/deliver.js +37 -0
- package/dist/versions/deliver.js.map +1 -0
- package/dist/versions/errors.d.ts +18 -0
- package/dist/versions/errors.d.ts.map +1 -0
- package/dist/versions/errors.js +30 -0
- package/dist/versions/errors.js.map +1 -0
- package/dist/versions/index.d.ts +24 -0
- package/dist/versions/index.d.ts.map +1 -0
- package/dist/versions/index.js +15 -0
- package/dist/versions/index.js.map +1 -0
- package/dist/versions/line.d.ts +21 -0
- package/dist/versions/line.d.ts.map +1 -0
- package/dist/versions/line.js +97 -0
- package/dist/versions/line.js.map +1 -0
- package/dist/versions/list.d.ts +7 -0
- package/dist/versions/list.d.ts.map +1 -0
- package/dist/versions/list.js +12 -0
- package/dist/versions/list.js.map +1 -0
- package/dist/versions/mcp.d.ts +12 -0
- package/dist/versions/mcp.d.ts.map +1 -0
- package/dist/versions/mcp.js +36 -0
- package/dist/versions/mcp.js.map +1 -0
- package/dist/versions/ports.d.ts +81 -0
- package/dist/versions/ports.d.ts.map +1 -0
- package/dist/versions/ports.js +6 -0
- package/dist/versions/ports.js.map +1 -0
- package/dist/versions/read.d.ts +23 -0
- package/dist/versions/read.d.ts.map +1 -0
- package/dist/versions/read.js +60 -0
- package/dist/versions/read.js.map +1 -0
- package/dist/versions/restore.d.ts +11 -0
- package/dist/versions/restore.d.ts.map +1 -0
- package/dist/versions/restore.js +37 -0
- package/dist/versions/restore.js.map +1 -0
- package/dist/versions/services.d.ts +12 -0
- package/dist/versions/services.d.ts.map +1 -0
- package/dist/versions/services.js +14 -0
- package/dist/versions/services.js.map +1 -0
- package/dist/versions/show.d.ts +7 -0
- package/dist/versions/show.d.ts.map +1 -0
- package/dist/versions/show.js +15 -0
- package/dist/versions/show.js.map +1 -0
- package/dist/versions/types.d.ts +84 -0
- package/dist/versions/types.d.ts.map +1 -0
- package/dist/versions/types.js +7 -0
- package/dist/versions/types.js.map +1 -0
- package/dist/versions/versions.d.ts +15 -0
- package/dist/versions/versions.d.ts.map +1 -0
- package/dist/versions/versions.js +15 -0
- package/dist/versions/versions.js.map +1 -0
- package/dist-cjs/apply/plans.js +3 -1
- package/dist-cjs/apply/plans.js.map +1 -1
- package/dist-cjs/apply/showing.js +5 -2
- package/dist-cjs/apply/showing.js.map +1 -1
- package/dist-cjs/clash/bodmas.js +15 -5
- package/dist-cjs/clash/bodmas.js.map +1 -1
- package/dist-cjs/{sharing/command-input.js → commands/input.js} +14 -3
- package/dist-cjs/commands/input.js.map +1 -0
- package/dist-cjs/commands/mcp.js +15 -0
- package/dist-cjs/commands/mcp.js.map +1 -0
- package/dist-cjs/detection/batch.js +3 -1
- package/dist-cjs/detection/batch.js.map +1 -1
- package/dist-cjs/detection/record-order.js +31 -4
- package/dist-cjs/detection/record-order.js.map +1 -1
- package/dist-cjs/detection/record-proposal.js +9 -3
- package/dist-cjs/detection/record-proposal.js.map +1 -1
- package/dist-cjs/detection/removals.js +2 -0
- package/dist-cjs/detection/removals.js.map +1 -1
- package/dist-cjs/drive/drive.js +2 -1
- package/dist-cjs/drive/drive.js.map +1 -1
- package/dist-cjs/drive/listing.js +2 -2
- package/dist-cjs/drive/listing.js.map +1 -1
- package/dist-cjs/drive/where.js +8 -2
- package/dist-cjs/drive/where.js.map +1 -1
- package/dist-cjs/entities/cloud.js +2 -2
- package/dist-cjs/entities/cloud.js.map +1 -1
- package/dist-cjs/entities/rules.js +19 -5
- package/dist-cjs/entities/rules.js.map +1 -1
- package/dist-cjs/files/accepted-files.js +7 -3
- package/dist-cjs/files/accepted-files.js.map +1 -1
- package/dist-cjs/files/commands.js.map +1 -1
- package/dist-cjs/files/plans.js +5 -4
- package/dist-cjs/files/plans.js.map +1 -1
- package/dist-cjs/files/usage.js +48 -5
- package/dist-cjs/files/usage.js.map +1 -1
- package/dist-cjs/git/holds.js +110 -0
- package/dist-cjs/git/holds.js.map +1 -0
- package/dist-cjs/git/index.js +9 -2
- package/dist-cjs/git/index.js.map +1 -1
- package/dist-cjs/git/parts.js +127 -0
- package/dist-cjs/git/parts.js.map +1 -0
- package/dist-cjs/git/places.js +39 -0
- package/dist-cjs/git/places.js.map +1 -0
- package/dist-cjs/git/restore.js +113 -0
- package/dist-cjs/git/restore.js.map +1 -0
- package/dist-cjs/git/tag.js +144 -32
- package/dist-cjs/git/tag.js.map +1 -1
- package/dist-cjs/git/turns.js +6 -4
- package/dist-cjs/git/turns.js.map +1 -1
- package/dist-cjs/history/history.js +27 -10
- package/dist-cjs/history/history.js.map +1 -1
- package/dist-cjs/history/identity.js +43 -0
- package/dist-cjs/history/identity.js.map +1 -0
- package/dist-cjs/history/index.js +9 -9
- package/dist-cjs/history/index.js.map +1 -1
- package/dist-cjs/history/rule.js +28 -69
- package/dist-cjs/history/rule.js.map +1 -1
- package/dist-cjs/history/runs.js +33 -0
- package/dist-cjs/history/runs.js.map +1 -0
- package/dist-cjs/history/types.js +5 -4
- package/dist-cjs/history/types.js.map +1 -1
- package/dist-cjs/history/version.js +8 -1
- package/dist-cjs/history/version.js.map +1 -1
- package/dist-cjs/records/rail.js +5 -0
- package/dist-cjs/records/rail.js.map +1 -1
- package/dist-cjs/records/send-line.js +14 -0
- package/dist-cjs/records/send-line.js.map +1 -1
- package/dist-cjs/sharing/commands.js +15 -15
- package/dist-cjs/sharing/commands.js.map +1 -1
- package/dist-cjs/sharing/index.js.map +1 -1
- package/dist-cjs/sharing/mcp.js +4 -9
- package/dist-cjs/sharing/mcp.js.map +1 -1
- package/dist-cjs/versions/admit.js +36 -0
- package/dist-cjs/versions/admit.js.map +1 -0
- package/dist-cjs/versions/api.js +106 -0
- package/dist-cjs/versions/api.js.map +1 -0
- package/dist-cjs/versions/cli-text.js +72 -0
- package/dist-cjs/versions/cli-text.js.map +1 -0
- package/dist-cjs/versions/cli.js +126 -0
- package/dist-cjs/versions/cli.js.map +1 -0
- package/dist-cjs/versions/commands.js +93 -0
- package/dist-cjs/versions/commands.js.map +1 -0
- package/dist-cjs/versions/content.js +32 -0
- package/dist-cjs/versions/content.js.map +1 -0
- package/dist-cjs/versions/dates.js +125 -0
- package/dist-cjs/versions/dates.js.map +1 -0
- package/dist-cjs/versions/deliver.js +41 -0
- package/dist-cjs/versions/deliver.js.map +1 -0
- package/dist-cjs/versions/errors.js +35 -0
- package/dist-cjs/versions/errors.js.map +1 -0
- package/dist-cjs/versions/index.js +37 -0
- package/dist-cjs/versions/index.js.map +1 -0
- package/dist-cjs/versions/line.js +100 -0
- package/dist-cjs/versions/line.js.map +1 -0
- package/dist-cjs/versions/list.js +15 -0
- package/dist-cjs/versions/list.js.map +1 -0
- package/dist-cjs/versions/mcp.js +39 -0
- package/dist-cjs/versions/mcp.js.map +1 -0
- package/dist-cjs/versions/ports.js +7 -0
- package/dist-cjs/versions/ports.js.map +1 -0
- package/dist-cjs/versions/read.js +66 -0
- package/dist-cjs/versions/read.js.map +1 -0
- package/dist-cjs/versions/restore.js +40 -0
- package/dist-cjs/versions/restore.js.map +1 -0
- package/dist-cjs/versions/services.js +17 -0
- package/dist-cjs/versions/services.js.map +1 -0
- package/dist-cjs/versions/show.js +18 -0
- package/dist-cjs/versions/show.js.map +1 -0
- package/dist-cjs/versions/types.js +8 -0
- package/dist-cjs/versions/types.js.map +1 -0
- package/dist-cjs/versions/versions.js +18 -0
- package/dist-cjs/versions/versions.js.map +1 -0
- package/package.json +16 -4
- package/dist/git/commands.d.ts +0 -3
- package/dist/git/commands.d.ts.map +0 -1
- package/dist/git/commands.js +0 -35
- package/dist/git/commands.js.map +0 -1
- package/dist/sharing/command-input.d.ts.map +0 -1
- package/dist/sharing/command-input.js.map +0 -1
- package/dist-cjs/git/commands.js +0 -39
- package/dist-cjs/git/commands.js.map +0 -1
- package/dist-cjs/sharing/command-input.js.map +0 -1
package/dist/history/history.js
CHANGED
|
@@ -5,21 +5,38 @@
|
|
|
5
5
|
* which schedules the one release that acceptance fixes, and arms one timer
|
|
6
6
|
* at `nextDueAt`. `cleanup` runs when that timer fires. Nothing polls.
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { contentKind } from '../clash/bodmas.js';
|
|
9
|
+
import { TYPES } from '../entities/types.js';
|
|
10
|
+
import { releaseFixedBy } from './rule.js';
|
|
9
11
|
/** Releases or artifacts read in one store call. */
|
|
10
12
|
const BATCH = 256;
|
|
11
|
-
|
|
13
|
+
const UNPLAYED = Symbol('unplayed');
|
|
14
|
+
/**
|
|
15
|
+
* The state `version` replaces on the played line, as the versions listing
|
|
16
|
+
* reads it (`src/versions/line.ts`): the newest earlier record whose bytes
|
|
17
|
+
* the line took, or null when none did. Content of another kind than what
|
|
18
|
+
* stands is not played (`src/clash/bodmas.ts`, rule 3): it neither ends a
|
|
19
|
+
* version nor is one, so it answers UNPLAYED and is passed over when it
|
|
20
|
+
* comes before. Only a retype changes the kind, so the newest one decides
|
|
21
|
+
* it; with none, the kind never changed, so every earlier content was played.
|
|
22
|
+
*/
|
|
23
|
+
async function stateBefore(store, version) {
|
|
24
|
+
if (version.sequence === 1 || version.sets === null || version.deleted)
|
|
25
|
+
return null;
|
|
26
|
+
const { entityId, sequence } = version;
|
|
27
|
+
const setter = await store.setBefore(entityId, sequence, []);
|
|
28
|
+
if (setter === null)
|
|
29
|
+
return store.setBefore(entityId, sequence, [...TYPES]);
|
|
30
|
+
const kind = contentKind(setter.type);
|
|
31
|
+
if (version.sets === 'content' && contentKind(version.type) !== kind)
|
|
32
|
+
return UNPLAYED;
|
|
33
|
+
return store.setBefore(entityId, sequence, [...TYPES].filter((type) => contentKind(type) === kind));
|
|
34
|
+
}
|
|
35
|
+
function createHistory({ store, planOf, now }) {
|
|
12
36
|
return {
|
|
13
|
-
async versions(entityId) {
|
|
14
|
-
return judge(await store.versions(entityId), now()).filter(version => version.state !== 'gone');
|
|
15
|
-
},
|
|
16
37
|
async accepted(version) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
if (earlier === null)
|
|
20
|
-
throw new Error(`version ${sequence} of ${version.entityId} was never accepted`);
|
|
21
|
-
return earlier;
|
|
22
|
-
});
|
|
38
|
+
const before = await stateBefore(store, version);
|
|
39
|
+
const release = before === UNPLAYED ? null : await releaseFixedBy(version, before, () => planOf(version.authorityId));
|
|
23
40
|
if (release !== null)
|
|
24
41
|
await store.schedule(release);
|
|
25
42
|
return release;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/history/history.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/history/history.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OA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AK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;oBAC1C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;wBACnB,OAAO,IAAI,CAAC,CAAC;wBACb,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC;oBACxB,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;QAC1E,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a version of each type is, and how long a replaced one stays.
|
|
3
|
+
*
|
|
4
|
+
* One table, shared by the keeping rule and by the version commands, so what
|
|
5
|
+
* is kept and what is listed never disagree. It reads only what the
|
|
6
|
+
* authority accepted: the sync rails never read it.
|
|
7
|
+
*
|
|
8
|
+
* Two neighbouring states with one identity are one version. An identity
|
|
9
|
+
* starts with the state's type, so a retype always starts a version.
|
|
10
|
+
*/
|
|
11
|
+
import type { CloudEntityRecord } from '../entities/cloud.js';
|
|
12
|
+
import type { EntityType } from '../entities/types.js';
|
|
13
|
+
import type { FilesPlan } from '../files/plans.js';
|
|
14
|
+
import { type TransferArtifact } from '../transfer/artifacts.js';
|
|
15
|
+
/** A repository package's five parts (`gitParts`), by its transport
|
|
16
|
+
* version. The host computes each once and keeps it beside history. */
|
|
17
|
+
export type GitPartsOf = (transportVersion: string) => string;
|
|
18
|
+
export interface VersionDefinition {
|
|
19
|
+
/** What one state with these bytes is. */
|
|
20
|
+
identity(artifact: TransferArtifact, gitParts: GitPartsOf): string;
|
|
21
|
+
/** Days a replaced version stays, on the plan its owner holds. */
|
|
22
|
+
keepDays(plan: FilesPlan): number;
|
|
23
|
+
}
|
|
24
|
+
/** Null: the type has no bytes of its own, so no versions. */
|
|
25
|
+
export declare const VERSION_DEFINITIONS: Readonly<Record<EntityType, VersionDefinition | null>>;
|
|
26
|
+
/** The identity of one state, or null when it is no version: a type with
|
|
27
|
+
* no bytes, bytes not yet captured, or a permanent deletion. */
|
|
28
|
+
export declare function identityOf(row: CloudEntityRecord, gitParts: GitPartsOf): string | null;
|
|
29
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/history/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEpF;uEACuE;AACvE,MAAM,MAAM,UAAU,GAAG,CAAC,gBAAgB,EAAE,MAAM,KAAK,MAAM,CAAC;AAE9D,MAAM,WAAW,iBAAiB;IAChC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,CAAC;IACnE,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAAC;CACnC;AAiBD,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,iBAAiB,GAAG,IAAI,CAAC,CAMrF,CAAC;AAEH;iEACiE;AACjE,wBAAgB,UAAU,CAAC,GAAG,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAItF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a version of each type is, and how long a replaced one stays.
|
|
3
|
+
*
|
|
4
|
+
* One table, shared by the keeping rule and by the version commands, so what
|
|
5
|
+
* is kept and what is listed never disagree. It reads only what the
|
|
6
|
+
* authority accepted: the sync rails never read it.
|
|
7
|
+
*
|
|
8
|
+
* Two neighbouring states with one identity are one version. An identity
|
|
9
|
+
* starts with the state's type, so a retype always starts a version.
|
|
10
|
+
*/
|
|
11
|
+
import { artifactForRecord } from '../transfer/artifacts.js';
|
|
12
|
+
/** Its bytes: a new version only when they change. */
|
|
13
|
+
const byBytes = {
|
|
14
|
+
identity: artifact => `${artifact.kind}:${artifact.contentHash}`,
|
|
15
|
+
keepDays: plan => plan.versionDays,
|
|
16
|
+
};
|
|
17
|
+
/** Git's own state, in five parts; housekeeping makes no version. */
|
|
18
|
+
const byGitParts = {
|
|
19
|
+
identity: (artifact, gitParts) => gitParts(artifact.contentHash),
|
|
20
|
+
keepDays: plan => plan.versionDays,
|
|
21
|
+
};
|
|
22
|
+
/** A secret's value someone replaced must not stay readable. */
|
|
23
|
+
const keepsNothing = { ...byBytes, keepDays: () => 0 };
|
|
24
|
+
/** Null: the type has no bytes of its own, so no versions. */
|
|
25
|
+
export const VERSION_DEFINITIONS = Object.freeze({
|
|
26
|
+
'file.text': byBytes, 'file.binary': byBytes, link: byBytes,
|
|
27
|
+
agent: byBytes, automation: byBytes, app: byBytes, tool: byBytes,
|
|
28
|
+
'repo.git': byGitParts,
|
|
29
|
+
secret: keepsNothing,
|
|
30
|
+
workspace: null, folder: null, reference: null,
|
|
31
|
+
});
|
|
32
|
+
/** The identity of one state, or null when it is no version: a type with
|
|
33
|
+
* no bytes, bytes not yet captured, or a permanent deletion. */
|
|
34
|
+
export function identityOf(row, gitParts) {
|
|
35
|
+
const definition = VERSION_DEFINITIONS[row.type];
|
|
36
|
+
const artifact = definition === null ? null : artifactForRecord(row);
|
|
37
|
+
return artifact === null ? null : `${row.type}:${definition.identity(artifact, gitParts)}`;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js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C,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACrE,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,UAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;AAC9F,CAAC"}
|
package/dist/history/index.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Version history:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* every type, one cleanup run, one timer.
|
|
2
|
+
* Version history: a replaced version stays for its type's days on its
|
|
3
|
+
* owner's plan, then its bytes go unless something still holds them. One
|
|
4
|
+
* rule for every type, one cleanup run, one timer.
|
|
6
5
|
*/
|
|
7
6
|
export { createHistory } from './history.js';
|
|
8
7
|
export type { History } from './history.js';
|
|
9
|
-
export {
|
|
8
|
+
export { VERSION_DEFINITIONS, identityOf } from './identity.js';
|
|
9
|
+
export type { GitPartsOf, VersionDefinition } from './identity.js';
|
|
10
|
+
export { releaseFixedBy } from './rule.js';
|
|
11
|
+
export { foldRuns } from './runs.js';
|
|
12
|
+
export type { LinePoint, VersionRun } from './runs.js';
|
|
10
13
|
export { packageContents, versionOf } from './version.js';
|
|
11
|
-
export type { ArtifactRef, Cleanup, Dropped, HistoryPorts, HistoryStore, HistoryVersion,
|
|
14
|
+
export type { ArtifactRef, Cleanup, Dropped, HistoryPorts, HistoryStore, HistoryVersion, Release, } from './types.js';
|
|
12
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1D,YAAY,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,OAAO,GACR,MAAM,YAAY,CAAC"}
|
package/dist/history/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Version history:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* every type, one cleanup run, one timer.
|
|
2
|
+
* Version history: a replaced version stays for its type's days on its
|
|
3
|
+
* owner's plan, then its bytes go unless something still holds them. One
|
|
4
|
+
* rule for every type, one cleanup run, one timer.
|
|
6
5
|
*/
|
|
7
6
|
export { createHistory } from './history.js';
|
|
8
|
-
export {
|
|
7
|
+
export { VERSION_DEFINITIONS, identityOf } from './identity.js';
|
|
8
|
+
export { releaseFixedBy } from './rule.js';
|
|
9
|
+
export { foldRuns } from './runs.js';
|
|
9
10
|
export { packageContents, versionOf } from './version.js';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/history/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/history/rule.d.ts
CHANGED
|
@@ -1,38 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The keeping rule, one law for every type: a version stays while it is
|
|
3
|
+
* current, and for its type's days (`identity.ts`) on its owner's plan after
|
|
4
|
+
* a state with another identity replaces it. Then its records are released.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* A version is the run of records with one identity, so accepting record `k`
|
|
7
|
+
* fixes a release exactly when `k` sets the bytes or type, the play takes
|
|
8
|
+
* them, and it replaces a version with a state of another identity: records 1 through `k - 1` go together
|
|
9
|
+
* at that time plus the days of the replaced state's type. A rename, a Trash
|
|
10
|
+
* or a repository's housekeeping sets no new identity and fixes nothing.
|
|
11
|
+
* An echo (`src/clash/echo.ts`) states a joined line and sets nothing: it can
|
|
12
|
+
* end a listed version, yet fixes no release, so what is kept always covers
|
|
13
|
+
* what is listed.
|
|
8
14
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Time is the authority's acceptance time, never a device clock. Because a
|
|
14
|
-
* version's end depends only on the versions after it, accepting version `k`
|
|
15
|
-
* fixes exactly one end: that of version `k - 10`, the one it pushes out of
|
|
16
|
-
* the newest ten. Versions go oldest first.
|
|
17
|
-
*/
|
|
18
|
-
import type { HistoryVersion, JudgedVersion, Release } from './types.js';
|
|
19
|
-
/** Rule 1: this many newest versions stay, however old. */
|
|
20
|
-
export declare const KEEP_NEWEST = 10;
|
|
21
|
-
/** Rule 2: a replaced version stays this long after it was replaced. */
|
|
22
|
-
export declare const KEEP_REPLACED_MS: number;
|
|
23
|
-
/** Rule 3: a version no rule keeps waits this long in version Trash. */
|
|
24
|
-
export declare const VERSION_TRASH_MS: number;
|
|
25
|
-
/**
|
|
26
|
-
* The one release accepting `version` fixes, or null when it fixes none yet.
|
|
27
|
-
* `versionAt` reads an earlier version of the same entity; only the one that
|
|
28
|
-
* replaced the version leaving the newest ten is read.
|
|
15
|
+
* A permanent deletion keeps no history: everything before it goes when it
|
|
16
|
+
* is accepted. A secret keeps no replaced value, since its type keeps it for
|
|
17
|
+
* zero days. Time is the authority's acceptance time, never a device clock.
|
|
29
18
|
*/
|
|
30
|
-
|
|
19
|
+
import type { FilesPlan } from '../files/plans.js';
|
|
20
|
+
import type { HistoryVersion, Release } from './types.js';
|
|
31
21
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
22
|
+
* The one release accepting `version` fixes, or null when it fixes none.
|
|
23
|
+
* `before` is the newest earlier record whose bytes the played line took
|
|
24
|
+
* (null when none did): a state with no identity, such as a folder, is no
|
|
25
|
+
* version, so replacing it releases nothing. `plan` answers the one its
|
|
26
|
+
* owner holds now, asked only when a release replaces a version.
|
|
36
27
|
*/
|
|
37
|
-
export declare function
|
|
28
|
+
export declare function releaseFixedBy(version: HistoryVersion, before: HistoryVersion | null, plan: () => Promise<FilesPlan>): Promise<Release | null>;
|
|
38
29
|
//# sourceMappingURL=rule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/history/rule.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../src/history/rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAI1D;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,SAAS,CAAC,GACrF,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAOzB"}
|
package/dist/history/rule.js
CHANGED
|
@@ -1,78 +1,39 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The keeping rule, one law for every type: a version stays while it is
|
|
3
|
+
* current, and for its type's days (`identity.ts`) on its owner's plan after
|
|
4
|
+
* a state with another identity replaces it. Then its records are released.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* A version is the run of records with one identity, so accepting record `k`
|
|
7
|
+
* fixes a release exactly when `k` sets the bytes or type, the play takes
|
|
8
|
+
* them, and it replaces a version with a state of another identity: records 1 through `k - 1` go together
|
|
9
|
+
* at that time plus the days of the replaced state's type. A rename, a Trash
|
|
10
|
+
* or a repository's housekeeping sets no new identity and fixes nothing.
|
|
11
|
+
* An echo (`src/clash/echo.ts`) states a joined line and sets nothing: it can
|
|
12
|
+
* end a listed version, yet fixes no release, so what is kept always covers
|
|
13
|
+
* what is listed.
|
|
8
14
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* Time is the authority's acceptance time, never a device clock. Because a
|
|
14
|
-
* version's end depends only on the versions after it, accepting version `k`
|
|
15
|
-
* fixes exactly one end: that of version `k - 10`, the one it pushes out of
|
|
16
|
-
* the newest ten. Versions go oldest first.
|
|
15
|
+
* A permanent deletion keeps no history: everything before it goes when it
|
|
16
|
+
* is accepted. A secret keeps no replaced value, since its type keeps it for
|
|
17
|
+
* zero days. Time is the authority's acceptance time, never a device clock.
|
|
17
18
|
*/
|
|
19
|
+
import { VERSION_DEFINITIONS } from './identity.js';
|
|
18
20
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
19
|
-
/** Rule 1: this many newest versions stay, however old. */
|
|
20
|
-
export const KEEP_NEWEST = 10;
|
|
21
|
-
/** Rule 2: a replaced version stays this long after it was replaced. */
|
|
22
|
-
export const KEEP_REPLACED_MS = 30 * DAY_MS;
|
|
23
|
-
/** Rule 3: a version no rule keeps waits this long in version Trash. */
|
|
24
|
-
export const VERSION_TRASH_MS = 30 * DAY_MS;
|
|
25
|
-
/**
|
|
26
|
-
* When a version leaves both keeping rules: thirty days after `next`
|
|
27
|
-
* replaced it, or when `tenth` pushed it out of the newest ten, whichever is
|
|
28
|
-
* later. It then waits in version Trash.
|
|
29
|
-
*/
|
|
30
|
-
function keptUntil(next, tenth) {
|
|
31
|
-
return Math.max(next.acceptedAt + KEEP_REPLACED_MS, tenth.acceptedAt);
|
|
32
|
-
}
|
|
33
|
-
/** Accepting this version ends every version before it, at once. */
|
|
34
|
-
const endsHistory = (version) => version.deleted || version.type === 'secret';
|
|
35
21
|
/**
|
|
36
|
-
* The one release accepting `version` fixes, or null when it fixes none
|
|
37
|
-
* `
|
|
38
|
-
*
|
|
22
|
+
* The one release accepting `version` fixes, or null when it fixes none.
|
|
23
|
+
* `before` is the newest earlier record whose bytes the played line took
|
|
24
|
+
* (null when none did): a state with no identity, such as a folder, is no
|
|
25
|
+
* version, so replacing it releases nothing. `plan` answers the one its
|
|
26
|
+
* owner holds now, asked only when a release replaces a version.
|
|
39
27
|
*/
|
|
40
|
-
export async function releaseFixedBy(version,
|
|
28
|
+
export async function releaseFixedBy(version, before, plan) {
|
|
41
29
|
const { entityId, sequence, acceptedAt } = version;
|
|
42
|
-
if (
|
|
43
|
-
return sequence > 1 ? { entityId, through: sequence - 1, dueAt: acceptedAt } : null;
|
|
44
|
-
}
|
|
45
|
-
const leaving = sequence - KEEP_NEWEST;
|
|
46
|
-
if (leaving < 1)
|
|
30
|
+
if (sequence === 1)
|
|
47
31
|
return null;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* newest; a version's end depends only on the versions after it, so released
|
|
55
|
-
* ones before need not be read.
|
|
56
|
-
*/
|
|
57
|
-
export function judge(versions, now) {
|
|
58
|
-
const count = versions.length;
|
|
59
|
-
const last = versions[count - 1];
|
|
60
|
-
const endedAt = last !== undefined && endsHistory(last) ? last.acceptedAt : null;
|
|
61
|
-
return versions.map((version, index) => {
|
|
62
|
-
if (index === count - 1)
|
|
63
|
-
return { ...version, state: 'current', trashedAt: null, goneAt: null };
|
|
64
|
-
if (endedAt !== null) {
|
|
65
|
-
return { ...version, state: 'gone', trashedAt: endedAt, goneAt: endedAt };
|
|
66
|
-
}
|
|
67
|
-
const next = versions[index + 1];
|
|
68
|
-
const tenth = versions[index + KEEP_NEWEST];
|
|
69
|
-
if (tenth === undefined) {
|
|
70
|
-
return { ...version, state: 'kept', trashedAt: null, goneAt: null };
|
|
71
|
-
}
|
|
72
|
-
const trashedAt = keptUntil(next, tenth);
|
|
73
|
-
const goneAt = trashedAt + VERSION_TRASH_MS;
|
|
74
|
-
const state = now < trashedAt ? 'kept' : now < goneAt ? 'trashed' : 'gone';
|
|
75
|
-
return { ...version, state, trashedAt, goneAt };
|
|
76
|
-
});
|
|
32
|
+
if (version.deleted)
|
|
33
|
+
return { entityId, through: sequence - 1, dueAt: acceptedAt };
|
|
34
|
+
if (!version.sets || before === null || before.identity === null || before.identity === version.identity)
|
|
35
|
+
return null;
|
|
36
|
+
const days = VERSION_DEFINITIONS[before.type].keepDays(await plan());
|
|
37
|
+
return { entityId, through: sequence - 1, dueAt: acceptedAt + days * DAY_MS };
|
|
77
38
|
}
|
|
78
39
|
//# sourceMappingURL=rule.js.map
|
package/dist/history/rule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/history/rule.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../src/history/rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAAuB,EAAE,MAA6B,EAAE,IAA8B;IAEtF,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,OAAO,CAAC,OAAO;QAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IACnF,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IACtH,MAAM,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAE,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACtE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run fold: neighbouring states of one entity with one identity are one
|
|
3
|
+
* version. A, B, A is three versions: the fold never looks back.
|
|
4
|
+
*/
|
|
5
|
+
import type { CloudEntityRecord } from '../entities/cloud.js';
|
|
6
|
+
/** One state in an entity's line. */
|
|
7
|
+
export interface LinePoint {
|
|
8
|
+
/** The entity's own channel sequence of the record that produced this
|
|
9
|
+
* state. 0 is the state it was born with: in its first sign-in or a package. */
|
|
10
|
+
readonly sequence: number;
|
|
11
|
+
/** Authority acceptance time. Never a device clock. */
|
|
12
|
+
readonly acceptedAt: number;
|
|
13
|
+
readonly actorId: string;
|
|
14
|
+
readonly originDeviceId: string;
|
|
15
|
+
readonly row: CloudEntityRecord;
|
|
16
|
+
/** The row's identity (`identityOf`); null when it is no version. */
|
|
17
|
+
readonly identity: string | null;
|
|
18
|
+
}
|
|
19
|
+
/** Neighbouring points with one identity: one version. */
|
|
20
|
+
export interface VersionRun {
|
|
21
|
+
readonly identity: string;
|
|
22
|
+
/** Began the version: its number and its time. */
|
|
23
|
+
readonly first: LinePoint;
|
|
24
|
+
/** The version's last name, type and mode. */
|
|
25
|
+
readonly last: LinePoint;
|
|
26
|
+
/** When the next state replaced it; null while it is current. */
|
|
27
|
+
readonly endedAt: number | null;
|
|
28
|
+
}
|
|
29
|
+
/** One pass. A point with the open run's identity extends it; any other
|
|
30
|
+
* ends the open run at its time, and opens a new run unless it has no
|
|
31
|
+
* identity. */
|
|
32
|
+
export declare function foldRuns(points: readonly LinePoint[]): readonly VersionRun[];
|
|
33
|
+
/** The run whose records include this sequence, or null. */
|
|
34
|
+
export declare function runHolding(runs: readonly VersionRun[], sequence: number): VersionRun | null;
|
|
35
|
+
//# sourceMappingURL=runs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/history/runs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,qCAAqC;AACrC,MAAM,WAAW,SAAS;IACxB;qFACiF;IACjF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAChC,qEAAqE;IACrE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,0DAA0D;AAC1D,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;gBAEgB;AAChB,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,UAAU,EAAE,CAe5E;AAED,4DAA4D;AAC5D,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAE3F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run fold: neighbouring states of one entity with one identity are one
|
|
3
|
+
* version. A, B, A is three versions: the fold never looks back.
|
|
4
|
+
*/
|
|
5
|
+
/** One pass. A point with the open run's identity extends it; any other
|
|
6
|
+
* ends the open run at its time, and opens a new run unless it has no
|
|
7
|
+
* identity. */
|
|
8
|
+
export function foldRuns(points) {
|
|
9
|
+
const runs = [];
|
|
10
|
+
for (const point of points) {
|
|
11
|
+
const { identity } = point;
|
|
12
|
+
const open = runs.at(-1);
|
|
13
|
+
if (open?.endedAt === null) {
|
|
14
|
+
if (open.identity === identity) {
|
|
15
|
+
runs[runs.length - 1] = { ...open, last: point };
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
runs[runs.length - 1] = { ...open, endedAt: point.acceptedAt };
|
|
19
|
+
}
|
|
20
|
+
if (identity !== null)
|
|
21
|
+
runs.push({ identity, first: point, last: point, endedAt: null });
|
|
22
|
+
}
|
|
23
|
+
return runs;
|
|
24
|
+
}
|
|
25
|
+
/** The run whose records include this sequence, or null. */
|
|
26
|
+
export function runHolding(runs, sequence) {
|
|
27
|
+
return runs.find((run) => run.first.sequence <= sequence && sequence <= run.last.sequence) ?? null;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=runs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs.js","sourceRoot":"","sources":["../../src/history/runs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA6BH;;gBAEgB;AAChB,MAAM,UAAU,QAAQ,CAAC,MAA4B;IACnD,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QAC3B,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,IAAI,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;YAC3B,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gBACjD,SAAS;YACX,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QACjE,CAAC;QACD,IAAI,QAAQ,KAAK,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,UAAU,CAAC,IAA2B,EAAE,QAAgB;IACtE,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC;AACrG,CAAC"}
|
package/dist/history/types.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version history: how long the cloud keeps each entity's earlier versions.
|
|
3
|
-
* A version is
|
|
4
|
-
*
|
|
5
|
-
* changes Watch, Detect, Record, Send, Receive, Apply or
|
|
6
|
-
* what the authority accepted and lets go of bytes the rule
|
|
3
|
+
* A version is a run of accepted records with one identity (`identity.ts`);
|
|
4
|
+
* its bytes are the artifacts those records name. History never writes
|
|
5
|
+
* records and never changes Watch, Detect, Record, Send, Receive, Apply or
|
|
6
|
+
* Verify. It reads what the authority accepted and lets go of bytes the rule
|
|
7
|
+
* no longer keeps.
|
|
7
8
|
*/
|
|
8
9
|
import type { EntityType } from '../entities/types.js';
|
|
10
|
+
import type { FilesPlan } from '../files/plans.js';
|
|
9
11
|
/** One accepted record, as history sees it. */
|
|
10
12
|
interface HistoryVersion {
|
|
11
13
|
readonly entityId: string;
|
|
@@ -23,20 +25,18 @@ interface HistoryVersion {
|
|
|
23
25
|
readonly type: EntityType;
|
|
24
26
|
/** A permanent deletion. Nothing follows it on its channel. */
|
|
25
27
|
readonly deleted: boolean;
|
|
28
|
+
/** What the record sets: its type with its bytes (it creates or
|
|
29
|
+
* retypes), its bytes alone (content), or neither. Only a record that
|
|
30
|
+
* sets one can start a version. */
|
|
31
|
+
readonly sets: 'type' | 'content' | null;
|
|
32
|
+
/** Its result's identity (`identityOf`); null when it is no version. */
|
|
33
|
+
readonly identity: string | null;
|
|
26
34
|
}
|
|
27
35
|
/** One stored artifact: its content hash within its authority's storage. */
|
|
28
36
|
interface ArtifactRef {
|
|
29
37
|
readonly authorityId: string;
|
|
30
38
|
readonly contentHash: string;
|
|
31
39
|
}
|
|
32
|
-
type VersionState = 'current' | 'kept' | 'trashed' | 'gone';
|
|
33
|
-
/** A version and where the rule stands on it. `trashedAt` and `goneAt` are
|
|
34
|
-
* null until a later version fixes them. */
|
|
35
|
-
interface JudgedVersion extends HistoryVersion {
|
|
36
|
-
readonly state: VersionState;
|
|
37
|
-
readonly trashedAt: number | null;
|
|
38
|
-
readonly goneAt: number | null;
|
|
39
|
-
}
|
|
40
40
|
/** Versions 1 through `through` of one entity go at `dueAt`. */
|
|
41
41
|
interface Release {
|
|
42
42
|
readonly entityId: string;
|
|
@@ -57,10 +57,9 @@ type Dropped = {
|
|
|
57
57
|
* mark on versions, and a queue of artifacts to check.
|
|
58
58
|
*/
|
|
59
59
|
interface HistoryStore {
|
|
60
|
-
/** The
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
version(entityId: string, sequence: number): Promise<HistoryVersion | null>;
|
|
60
|
+
/** The newest accepted record of the entity before `sequence` that sets
|
|
61
|
+
* its type, or sets bytes of one of `types`; null when there is none. */
|
|
62
|
+
setBefore(entityId: string, sequence: number, types: readonly EntityType[]): Promise<HistoryVersion | null>;
|
|
64
63
|
/** Keep this release until it is due. Saving the same release again changes nothing. */
|
|
65
64
|
schedule(release: Release): Promise<void>;
|
|
66
65
|
/** Scheduled releases due by `now`, earliest first, at most `limit`. */
|
|
@@ -93,6 +92,9 @@ interface HistoryStore {
|
|
|
93
92
|
}
|
|
94
93
|
interface HistoryPorts {
|
|
95
94
|
readonly store: HistoryStore;
|
|
95
|
+
/** The plan the person who owns this authority holds now, asked only
|
|
96
|
+
* when an acceptance replaces a version. */
|
|
97
|
+
planOf(authorityId: string): Promise<FilesPlan>;
|
|
96
98
|
/** The authority's clock. */
|
|
97
99
|
now(): number;
|
|
98
100
|
}
|
|
@@ -103,5 +105,5 @@ interface Cleanup {
|
|
|
103
105
|
readonly bytes: number;
|
|
104
106
|
readonly nextDueAt: number | null;
|
|
105
107
|
}
|
|
106
|
-
export type { ArtifactRef, Cleanup, Dropped, HistoryPorts, HistoryStore, HistoryVersion,
|
|
108
|
+
export type { ArtifactRef, Cleanup, Dropped, HistoryPorts, HistoryStore, HistoryVersion, Release, };
|
|
107
109
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/history/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/history/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,+CAA+C;AAC/C,UAAU,cAAc;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,uDAAuD;IACvD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;gEAC4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;iCAC6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;uCAEmC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACzC,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAA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AAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;iDAC6C;IAC7C,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAChD,6BAA6B;IAC7B,GAAG,IAAI,MAAM,CAAC;CACf;AAED,oEAAoE;AACpE,UAAU,OAAO;IACf,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,YAAY,EACV,WAAW,EACX,OAAO,EACP,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,OAAO,GACR,CAAC"}
|
package/dist/history/types.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Version history: how long the cloud keeps each entity's earlier versions.
|
|
3
|
-
* A version is
|
|
4
|
-
*
|
|
5
|
-
* changes Watch, Detect, Record, Send, Receive, Apply or
|
|
6
|
-
* what the authority accepted and lets go of bytes the rule
|
|
3
|
+
* A version is a run of accepted records with one identity (`identity.ts`);
|
|
4
|
+
* its bytes are the artifacts those records name. History never writes
|
|
5
|
+
* records and never changes Watch, Detect, Record, Send, Receive, Apply or
|
|
6
|
+
* Verify. It reads what the authority accepted and lets go of bytes the rule
|
|
7
|
+
* no longer keeps.
|
|
7
8
|
*/
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/history/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/history/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -3,8 +3,11 @@ import type { DetectedChangeProposal } from '../detection/record-proposal.js';
|
|
|
3
3
|
import type { GraphPageRef } from '../entities/graph-pages.js';
|
|
4
4
|
import type { Sha256Hex } from '../entities/types.js';
|
|
5
5
|
import type { AcceptedEntityRecord } from '../records/contracts.js';
|
|
6
|
+
import { type GitPartsOf } from './identity.js';
|
|
6
7
|
import type { HistoryVersion } from './types.js';
|
|
7
|
-
|
|
8
|
+
/** `gitParts` answers a repository package's five parts; it is asked only
|
|
9
|
+
* when the record's result is a repository. */
|
|
10
|
+
export declare function versionOf(record: AcceptedEntityRecord, gitParts: GitPartsOf): HistoryVersion;
|
|
8
11
|
/** Every artifact one package holds: its pages and the bytes of each entity
|
|
9
12
|
* it carries. A member has no version of its own until its first change, so
|
|
10
13
|
* its first bytes are the package's, and the package holds them for as long
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/history/version.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/history/version.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAE5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD;+CAC+C;AAC/C,wBAAgB,SAAS,CAAC,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,UAAU,GAAG,cAAc,CAa5F;AAED;;;;uDAIuD;AACvD,wBAAgB,eAAe,CAC7B,MAAM,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,GAAG,QAAQ,CAAC,EACzD,SAAS,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,UAAU,EAC5C,SAAS,EAAE,SAAS,GACnB,SAAS,MAAM,EAAE,CAQnB"}
|