@dxos/echo-pipeline 0.1.31-next.ea8f0bc → 0.1.31
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/lib/browser/{chunk-L44NG4N6.mjs → chunk-QMDRF3NL.mjs} +72 -37
- package/dist/lib/browser/{chunk-L44NG4N6.mjs.map → chunk-QMDRF3NL.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +23 -14
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +68 -33
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +49 -43
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/types/src/dbhost/data-service-host.d.ts.map +1 -1
- package/dist/types/src/dbhost/database-backend.d.ts +2 -2
- package/dist/types/src/dbhost/database-backend.d.ts.map +1 -1
- package/dist/types/src/space/genesis.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts +4 -3
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/util.d.ts.map +1 -1
- package/package.json +29 -29
- package/src/dbhost/data-service-host.ts +19 -25
- package/src/dbhost/database-backend.ts +1 -1
- package/src/pipeline/pipeline.test.ts +12 -4
- package/src/space/data-pipeline-controller.ts +1 -1
- package/src/space/genesis.ts +47 -7
- package/src/space/space-protocol.browser.test.ts +8 -6
- package/src/space/space-protocol.test.ts +8 -6
- package/src/testing/database-test-rig.ts +1 -1
- package/src/testing/test-agent-builder.ts +13 -7
- package/src/testing/util.ts +11 -7
- package/src/tests/database-unit.test.ts +25 -0
- package/src/tests/database.test.ts +5 -5
|
@@ -1099,15 +1099,53 @@ SpaceManager = __decorate5([
|
|
|
1099
1099
|
], SpaceManager);
|
|
1100
1100
|
|
|
1101
1101
|
// packages/core/echo/echo-pipeline/src/space/genesis.ts
|
|
1102
|
-
import {
|
|
1102
|
+
import { createCredential } from "@dxos/credentials";
|
|
1103
1103
|
import { failUndefined as failUndefined2 } from "@dxos/debug";
|
|
1104
|
-
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1104
|
+
import { AdmittedFeed as AdmittedFeed3, SpaceMember } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
1105
1105
|
var spaceGenesis = async (keyring, signingContext, space) => {
|
|
1106
|
-
var _a, _b;
|
|
1107
|
-
const generator = new CredentialGenerator(keyring, signingContext.identityKey, signingContext.deviceKey);
|
|
1106
|
+
var _a, _b, _c;
|
|
1108
1107
|
const credentials = [
|
|
1109
|
-
|
|
1110
|
-
|
|
1108
|
+
await createCredential({
|
|
1109
|
+
signer: keyring,
|
|
1110
|
+
issuer: space.key,
|
|
1111
|
+
subject: space.key,
|
|
1112
|
+
assertion: {
|
|
1113
|
+
"@type": "dxos.halo.credentials.SpaceGenesis",
|
|
1114
|
+
spaceKey: space.key
|
|
1115
|
+
}
|
|
1116
|
+
}),
|
|
1117
|
+
await createCredential({
|
|
1118
|
+
signer: keyring,
|
|
1119
|
+
issuer: space.key,
|
|
1120
|
+
subject: signingContext.identityKey,
|
|
1121
|
+
assertion: {
|
|
1122
|
+
"@type": "dxos.halo.credentials.SpaceMember",
|
|
1123
|
+
spaceKey: space.key,
|
|
1124
|
+
role: SpaceMember.Role.ADMIN,
|
|
1125
|
+
profile: signingContext.profile,
|
|
1126
|
+
genesisFeedKey: (_a = space.controlFeedKey) != null ? _a : failUndefined2()
|
|
1127
|
+
}
|
|
1128
|
+
}),
|
|
1129
|
+
await signingContext.credentialSigner.createCredential({
|
|
1130
|
+
subject: (_b = space.controlFeedKey) != null ? _b : failUndefined2(),
|
|
1131
|
+
assertion: {
|
|
1132
|
+
"@type": "dxos.halo.credentials.AdmittedFeed",
|
|
1133
|
+
spaceKey: space.key,
|
|
1134
|
+
identityKey: signingContext.identityKey,
|
|
1135
|
+
deviceKey: signingContext.deviceKey,
|
|
1136
|
+
designation: AdmittedFeed3.Designation.CONTROL
|
|
1137
|
+
}
|
|
1138
|
+
}),
|
|
1139
|
+
await signingContext.credentialSigner.createCredential({
|
|
1140
|
+
subject: (_c = space.dataFeedKey) != null ? _c : failUndefined2(),
|
|
1141
|
+
assertion: {
|
|
1142
|
+
"@type": "dxos.halo.credentials.AdmittedFeed",
|
|
1143
|
+
spaceKey: space.key,
|
|
1144
|
+
identityKey: signingContext.identityKey,
|
|
1145
|
+
deviceKey: signingContext.deviceKey,
|
|
1146
|
+
designation: AdmittedFeed3.Designation.DATA
|
|
1147
|
+
}
|
|
1148
|
+
})
|
|
1111
1149
|
];
|
|
1112
1150
|
for (const credential of credentials) {
|
|
1113
1151
|
await space.controlPipeline.writer.write({
|
|
@@ -1122,7 +1160,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
|
|
|
1122
1160
|
// packages/core/echo/echo-pipeline/src/dbhost/data-service-host.ts
|
|
1123
1161
|
import assert7 from "@dxos/node-std/assert";
|
|
1124
1162
|
import { Stream } from "@dxos/codec-protobuf";
|
|
1125
|
-
import { tagMutationsInBatch } from "@dxos/echo-db";
|
|
1163
|
+
import { tagMutationsInBatch, setMetadataOnObject } from "@dxos/echo-db";
|
|
1126
1164
|
import { log as log10 } from "@dxos/log";
|
|
1127
1165
|
import { ComplexMap as ComplexMap3 } from "@dxos/util";
|
|
1128
1166
|
var DataServiceHost = class {
|
|
@@ -1143,56 +1181,53 @@ var DataServiceHost = class {
|
|
|
1143
1181
|
objects
|
|
1144
1182
|
}
|
|
1145
1183
|
});
|
|
1146
|
-
this._itemDemuxer.mutation.on(ctx, (
|
|
1184
|
+
this._itemDemuxer.mutation.on(ctx, (message) => {
|
|
1147
1185
|
var _a;
|
|
1186
|
+
const { batch, meta } = message;
|
|
1148
1187
|
log10("Object update", {
|
|
1149
|
-
|
|
1188
|
+
batch,
|
|
1189
|
+
meta
|
|
1150
1190
|
}, {
|
|
1151
1191
|
file: "data-service-host.ts",
|
|
1152
|
-
line:
|
|
1192
|
+
line: 50,
|
|
1153
1193
|
scope: this,
|
|
1154
1194
|
callSite: (f, a) => f(...a)
|
|
1155
1195
|
});
|
|
1156
1196
|
const clientTag = this._clientTagMap.get([
|
|
1157
|
-
|
|
1158
|
-
|
|
1197
|
+
message.meta.feedKey,
|
|
1198
|
+
message.meta.seq
|
|
1159
1199
|
]);
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
...mutation.data,
|
|
1164
|
-
mutations: (_a = mutation.data.mutations) == null ? void 0 : _a.map((m, mutationIdx) => ({
|
|
1165
|
-
...m,
|
|
1166
|
-
meta: mutation.meta
|
|
1167
|
-
})),
|
|
1168
|
-
meta: mutation.meta
|
|
1169
|
-
}
|
|
1170
|
-
]
|
|
1171
|
-
};
|
|
1200
|
+
(_a = batch.objects) == null ? void 0 : _a.forEach((object) => {
|
|
1201
|
+
setMetadataOnObject(object, meta);
|
|
1202
|
+
});
|
|
1172
1203
|
if (clientTag) {
|
|
1173
1204
|
tagMutationsInBatch(batch, clientTag);
|
|
1174
1205
|
}
|
|
1175
1206
|
next({
|
|
1176
1207
|
clientTag,
|
|
1177
|
-
feedKey:
|
|
1178
|
-
seq:
|
|
1208
|
+
feedKey: message.meta.feedKey,
|
|
1209
|
+
seq: message.meta.seq,
|
|
1179
1210
|
batch
|
|
1180
1211
|
});
|
|
1181
1212
|
});
|
|
1182
1213
|
});
|
|
1183
1214
|
}
|
|
1184
1215
|
async write(request) {
|
|
1185
|
-
var _a
|
|
1216
|
+
var _a;
|
|
1186
1217
|
assert7(this._writeStream, "Cannot write mutations in readonly mode");
|
|
1187
|
-
assert7(((_a = request.batch.objects) == null ? void 0 : _a.length) === 1, "Only single object mutations are supported");
|
|
1188
1218
|
const receipt = await this._writeStream.write({
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1219
|
+
batch: {
|
|
1220
|
+
objects: (_a = request.batch.objects) == null ? void 0 : _a.map((object) => {
|
|
1221
|
+
var _a2;
|
|
1222
|
+
return {
|
|
1223
|
+
...object,
|
|
1224
|
+
mutations: (_a2 = object.mutations) == null ? void 0 : _a2.map((m) => ({
|
|
1225
|
+
...m,
|
|
1226
|
+
meta: void 0
|
|
1227
|
+
})),
|
|
1228
|
+
meta: void 0
|
|
1229
|
+
};
|
|
1230
|
+
})
|
|
1196
1231
|
}
|
|
1197
1232
|
});
|
|
1198
1233
|
if (request.clientTag) {
|
|
@@ -1551,7 +1586,7 @@ var DataPipelineControllerImpl = class DataPipelineControllerImpl2 {
|
|
|
1551
1586
|
continue;
|
|
1552
1587
|
}
|
|
1553
1588
|
await this.databaseBackend.echoProcessor({
|
|
1554
|
-
|
|
1589
|
+
batch: data.payload.data.batch,
|
|
1555
1590
|
meta: {
|
|
1556
1591
|
feedKey,
|
|
1557
1592
|
seq,
|
|
@@ -1614,4 +1649,4 @@ export {
|
|
|
1614
1649
|
NoopDataPipelineController,
|
|
1615
1650
|
DataPipelineControllerImpl
|
|
1616
1651
|
};
|
|
1617
|
-
//# sourceMappingURL=chunk-
|
|
1652
|
+
//# sourceMappingURL=chunk-QMDRF3NL.mjs.map
|