@dxos/client-services 0.1.51-main.0e88376 → 0.1.51-main.10d68b7

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.
@@ -20,11 +20,15 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
20
20
  }
21
21
  });
22
22
  next({
23
- feeds: Array.from(feedMap.values()).map((feed) => ({
24
- feedKey: feed.key,
25
- length: feed.properties.length,
26
- bytes: feed.core.byteLength
27
- }))
23
+ feeds: Array.from(feedMap.values()).map((feed) => {
24
+ var _a, _b;
25
+ return {
26
+ feedKey: feed.key,
27
+ length: feed.properties.length,
28
+ bytes: feed.core.byteLength,
29
+ downloaded: (_b = (_a = feed.core.bitfield) == null ? void 0 : _a.data.toBuffer()) != null ? _b : new Uint8Array()
30
+ };
31
+ })
28
32
  });
29
33
  };
30
34
  subscriptions.add(feedStore.feedOpened.on(update));
@@ -3106,6 +3110,7 @@ var SpacesServiceImpl = class {
3106
3110
  for (const space of dataSpaceManager.spaces.values()) {
3107
3111
  subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
3108
3112
  subscriptions.add(space.presence.updated.on(ctx, onUpdate));
3113
+ subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
3109
3114
  space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
3110
3115
  if (space.dataPipeline.pipelineState) {
3111
3116
  subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
@@ -3176,21 +3181,23 @@ var SpacesServiceImpl = class {
3176
3181
  await space.createEpoch();
3177
3182
  }
3178
3183
  _transformSpace(space) {
3179
- var _a, _b, _c, _d, _e, _f;
3184
+ var _a, _b, _c, _d, _e, _f, _g;
3180
3185
  return {
3181
3186
  spaceKey: space.key,
3182
3187
  state: space.state,
3183
3188
  error: space.error ? encodeError(space.error) : void 0,
3184
3189
  pipeline: {
3185
3190
  currentEpoch: space.dataPipeline.currentEpoch,
3191
+ appliedEpoch: space.dataPipeline.appliedEpoch,
3186
3192
  controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
3187
3193
  currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
3188
3194
  targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
3189
3195
  totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
3190
3196
  dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
3191
- currentDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.timeframe,
3192
- targetDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.targetTimeframe,
3193
- totalDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.endTimeframe
3197
+ startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
3198
+ currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
3199
+ targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
3200
+ totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
3194
3201
  },
3195
3202
  members: Array.from(space.inner.spaceState.members.values()).map((member) => {
3196
3203
  var _a2, _b2, _c2;
@@ -3204,7 +3211,7 @@ var SpacesServiceImpl = class {
3204
3211
  presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? SpaceMember2.PresenceState.ONLINE : SpaceMember2.PresenceState.OFFLINE
3205
3212
  };
3206
3213
  }),
3207
- creator: (_f = space.inner.spaceState.creator) == null ? void 0 : _f.key,
3214
+ creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
3208
3215
  cache: space.cache,
3209
3216
  metrics: space.metrics
3210
3217
  };
@@ -3566,7 +3573,8 @@ var DevicesServiceImpl = class {
3566
3573
  // packages/sdk/client-services/src/packlets/logging/logging-service.ts
3567
3574
  import { Event as Event7 } from "@dxos/async";
3568
3575
  import { Stream as Stream11 } from "@dxos/codec-protobuf";
3569
- import { log as log14, shouldLog, getContextFromEntry } from "@dxos/log";
3576
+ import { getContextFromEntry, log as log14 } from "@dxos/log";
3577
+ import { QueryLogsRequest } from "@dxos/protocols/proto/dxos/client/services";
3570
3578
  import { jsonify } from "@dxos/util";
3571
3579
  var LoggingServiceImpl = class {
3572
3580
  constructor() {
@@ -3583,31 +3591,60 @@ var LoggingServiceImpl = class {
3583
3591
  log14.runtimeConfig.processors.splice(index, 1);
3584
3592
  }
3585
3593
  queryLogs(request) {
3586
- var _a;
3587
- const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
3588
3594
  return new Stream11(({ ctx, next }) => {
3589
3595
  const handler = (entry2) => {
3590
- var _a2, _b, _c;
3591
- if (((_a2 = entry2.meta) == null ? void 0 : _a2.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3596
+ var _a, _b, _c, _d, _e;
3597
+ if (LOG_PROCESSING > 0) {
3592
3598
  return;
3593
3599
  }
3594
- if (shouldLog(entry2, filters)) {
3595
- const record = {
3596
- ...entry2,
3597
- context: jsonify(getContextFromEntry(entry2))
3598
- };
3599
- (_b = record.meta) == null ? true : delete _b.bugcheck;
3600
- (_c = record.meta) == null ? true : delete _c.scope;
3600
+ if (((_a = entry2.meta) == null ? void 0 : _a.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
3601
+ return;
3602
+ }
3603
+ if (!shouldLog(entry2, request)) {
3604
+ return;
3605
+ }
3606
+ const record = {
3607
+ ...entry2,
3608
+ context: jsonify(getContextFromEntry(entry2)),
3609
+ timestamp: new Date(),
3610
+ meta: {
3611
+ // TODO(dmaretskyi): Fix proto.
3612
+ file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
3613
+ line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
3614
+ }
3615
+ };
3616
+ try {
3617
+ LOG_PROCESSING++;
3601
3618
  next(record);
3619
+ } finally {
3620
+ LOG_PROCESSING--;
3602
3621
  }
3603
3622
  };
3604
- ctx.onDispose(() => {
3605
- this._logs.off(handler);
3606
- });
3607
- this._logs.on(handler);
3623
+ this._logs.on(ctx, handler);
3624
+ });
3625
+ }
3626
+ };
3627
+ var matchFilter = (filter, level, path, options) => {
3628
+ switch (options) {
3629
+ case QueryLogsRequest.MatchingOptions.INCLUSIVE:
3630
+ return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
3631
+ case QueryLogsRequest.MatchingOptions.EXPLICIT:
3632
+ return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
3633
+ }
3634
+ };
3635
+ var shouldLog = (entry2, request) => {
3636
+ var _a;
3637
+ const options = (_a = request.options) != null ? _a : QueryLogsRequest.MatchingOptions.INCLUSIVE;
3638
+ if (request.filters === void 0) {
3639
+ return options === QueryLogsRequest.MatchingOptions.INCLUSIVE;
3640
+ } else {
3641
+ return request.filters.some((filter) => {
3642
+ var _a2, _b;
3643
+ return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
3608
3644
  });
3609
3645
  }
3610
3646
  };
3647
+ var LOG_PROCESSING = 0;
3611
3648
 
3612
3649
  // packages/sdk/client-services/src/packlets/network/network-service.ts
3613
3650
  import { Stream as Stream12 } from "@dxos/codec-protobuf";
@@ -3964,4 +4001,4 @@ export {
3964
4001
  ClientServicesHost,
3965
4002
  LocalClientServices
3966
4003
  };
3967
- //# sourceMappingURL=chunk-YPN5TDAA.mjs.map
4004
+ //# sourceMappingURL=chunk-U74HTJWV.mjs.map