@xnetjs/data 1.0.0 → 2.1.0

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.
@@ -66,19 +66,7 @@ import {
66
66
  taskBranchName,
67
67
  transform,
68
68
  when
69
- } from "../chunk-5B47M2IG.js";
70
- import {
71
- SavedViewSchema
72
- } from "../chunk-XQDXQ7WG.js";
73
- import {
74
- WorkspaceSchema
75
- } from "../chunk-3PV6QTKF.js";
76
- import {
77
- UserWidgetSchema
78
- } from "../chunk-W3QOEPUN.js";
79
- import {
80
- DashboardSchema
81
- } from "../chunk-NSMSOIEW.js";
69
+ } from "../chunk-LZX7O72B.js";
82
70
  import {
83
71
  AbuseReportSchema,
84
72
  AppealSchema,
@@ -122,25 +110,32 @@ import {
122
110
  MemoryItemSchema
123
111
  } from "../chunk-ZKMWJNDQ.js";
124
112
  import {
125
- CHANNEL_KINDS,
126
- ChannelSchema
127
- } from "../chunk-UUQVNDBG.js";
128
- import {
129
- ChatMessageSchema
130
- } from "../chunk-5UJMY3AH.js";
131
- import {
132
- FEED_SCHEMA_IRI,
133
- FeedSchema
134
- } from "../chunk-JLUFPUIL.js";
135
- import {
136
- FEED_ITEM_SCHEMA_IRI,
137
- FeedItemSchema
138
- } from "../chunk-DPJ4T2LQ.js";
139
- import {
140
- EXTERNAL_ITEM_SCHEMA_IRI,
141
- EXTERNAL_ITEM_SOURCES,
142
- ExternalItemSchema
143
- } from "../chunk-D4EVJN2P.js";
113
+ AGENT_ACTION_SCHEMA_IRI,
114
+ AGENT_ACTION_STATUSES,
115
+ AGENT_APPROVAL_DECISIONS,
116
+ AGENT_APPROVAL_SCHEMA_IRI,
117
+ AGENT_APPROVAL_SURFACES,
118
+ AGENT_CHANNELS,
119
+ AGENT_NOTIFICATION_KINDS,
120
+ AGENT_NOTIFICATION_SCHEMA_IRI,
121
+ AGENT_NOTIFICATION_STATUSES,
122
+ AGENT_PASSPORT_SCHEMA_IRI,
123
+ AGENT_REVERSIBILITIES,
124
+ AGENT_RISKS,
125
+ AGENT_RUNTIMES,
126
+ AGENT_SESSION_SCHEMA_IRI,
127
+ AgentActionSchema,
128
+ AgentApprovalSchema,
129
+ AgentNotificationSchema,
130
+ AgentPassportSchema,
131
+ AgentSessionSchema,
132
+ agentActionId,
133
+ agentApprovalId,
134
+ agentNotificationId,
135
+ agentPassportId,
136
+ agentSessionId,
137
+ redactInstruction
138
+ } from "../chunk-JWGS7JMA.js";
144
139
  import {
145
140
  DEFAULT_CHANNEL_TIER,
146
141
  InboxStateSchema,
@@ -167,6 +162,49 @@ import {
167
162
  revocationRecordId,
168
163
  revokedSubjects
169
164
  } from "../chunk-4KJ4NAMC.js";
165
+ import {
166
+ SavedViewSchema
167
+ } from "../chunk-XQDXQ7WG.js";
168
+ import {
169
+ WorkspaceSchema
170
+ } from "../chunk-3PV6QTKF.js";
171
+ import {
172
+ UserWidgetSchema
173
+ } from "../chunk-W3QOEPUN.js";
174
+ import {
175
+ DashboardSchema
176
+ } from "../chunk-NSMSOIEW.js";
177
+ import {
178
+ ReactionSchema
179
+ } from "../chunk-YSD4NSCE.js";
180
+ import {
181
+ DebugReportSchema
182
+ } from "../chunk-Z5I2T75Z.js";
183
+ import {
184
+ ProfileSchema,
185
+ didFromProfileNodeId,
186
+ profileNodeId
187
+ } from "../chunk-EYRZ6ZUB.js";
188
+ import {
189
+ CHANNEL_KINDS,
190
+ ChannelSchema
191
+ } from "../chunk-UUQVNDBG.js";
192
+ import {
193
+ ChatMessageSchema
194
+ } from "../chunk-5UJMY3AH.js";
195
+ import {
196
+ FEED_SCHEMA_IRI,
197
+ FeedSchema
198
+ } from "../chunk-JLUFPUIL.js";
199
+ import {
200
+ FEED_ITEM_SCHEMA_IRI,
201
+ FeedItemSchema
202
+ } from "../chunk-DPJ4T2LQ.js";
203
+ import {
204
+ EXTERNAL_ITEM_SCHEMA_IRI,
205
+ EXTERNAL_ITEM_SOURCES,
206
+ ExternalItemSchema
207
+ } from "../chunk-D4EVJN2P.js";
170
208
  import {
171
209
  MediaAssetSchema
172
210
  } from "../chunk-7PCMTV6J.js";
@@ -192,13 +230,13 @@ import {
192
230
  CommentSchema
193
231
  } from "../chunk-I7JMGCV6.js";
194
232
  import {
195
- ReactionSchema
196
- } from "../chunk-YSD4NSCE.js";
233
+ CHECKPOINT_SCHEMA_IRI,
234
+ CheckpointSchema
235
+ } from "../chunk-6ZUJID52.js";
197
236
  import {
198
- ProfileSchema,
199
- didFromProfileNodeId,
200
- profileNodeId
201
- } from "../chunk-EYRZ6ZUB.js";
237
+ DRAFT_SCHEMA_IRI,
238
+ DraftSchema
239
+ } from "../chunk-MEAIGK3W.js";
202
240
  import {
203
241
  ACTIVITY_KINDS,
204
242
  ACTIVITY_SCHEMA_IRI,
@@ -319,24 +357,6 @@ import {
319
357
  import {
320
358
  DatabaseSchema
321
359
  } from "../chunk-ZKJXGQCR.js";
322
- import {
323
- PresenceSummarySchema,
324
- SYSTEM_NAMESPACE_KINDS,
325
- SYSTEM_SCHEMA_BASE_IRIS,
326
- SYSTEM_SCHEMA_IRIS,
327
- SchemaCompatibilitySchema,
328
- SchemaDefinitionSchema,
329
- SyncPolicySchema,
330
- buildSystemNamespace,
331
- buildSystemNodeId,
332
- computeSchemaDefinitionContentHash,
333
- createSchemaDefinitionSigningPayload,
334
- isSystemNamespaceResource,
335
- isSystemSchemaIri,
336
- parseSystemNamespaceResource,
337
- resolveSchemaAuthority,
338
- validateSchemaDefinitionNode
339
- } from "../chunk-XJBDESCX.js";
340
360
  import {
341
361
  EXT_PREFIX,
342
362
  extKey,
@@ -364,6 +384,24 @@ import {
364
384
  DatabaseViewSchema
365
385
  } from "../chunk-TRPXLCND.js";
366
386
  import "../chunk-JA56EQJO.js";
387
+ import {
388
+ PresenceSummarySchema,
389
+ SYSTEM_NAMESPACE_KINDS,
390
+ SYSTEM_SCHEMA_BASE_IRIS,
391
+ SYSTEM_SCHEMA_IRIS,
392
+ SchemaCompatibilitySchema,
393
+ SchemaDefinitionSchema,
394
+ SyncPolicySchema,
395
+ buildSystemNamespace,
396
+ buildSystemNodeId,
397
+ computeSchemaDefinitionContentHash,
398
+ createSchemaDefinitionSigningPayload,
399
+ isSystemNamespaceResource,
400
+ isSystemSchemaIri,
401
+ parseSystemNamespaceResource,
402
+ resolveSchemaAuthority,
403
+ validateSchemaDefinitionNode
404
+ } from "../chunk-XJBDESCX.js";
367
405
  import {
368
406
  SPACE_MEMBERSHIP_SCHEMA_IRI,
369
407
  SpaceMembershipSchema,
@@ -409,21 +447,42 @@ export {
409
447
  ACHIEVEMENT_SCHEMA_IRI,
410
448
  ACTIVITY_KINDS,
411
449
  ACTIVITY_SCHEMA_IRI,
450
+ AGENT_ACTION_SCHEMA_IRI,
451
+ AGENT_ACTION_STATUSES,
452
+ AGENT_APPROVAL_DECISIONS,
453
+ AGENT_APPROVAL_SCHEMA_IRI,
454
+ AGENT_APPROVAL_SURFACES,
455
+ AGENT_CHANNELS,
456
+ AGENT_NOTIFICATION_KINDS,
457
+ AGENT_NOTIFICATION_SCHEMA_IRI,
458
+ AGENT_NOTIFICATION_STATUSES,
459
+ AGENT_PASSPORT_SCHEMA_IRI,
460
+ AGENT_REVERSIBILITIES,
461
+ AGENT_RISKS,
462
+ AGENT_RUNTIMES,
463
+ AGENT_SESSION_SCHEMA_IRI,
412
464
  AbuseReportSchema,
413
465
  AccountRecordSchema,
414
466
  AccountSchema,
415
467
  AchievementSchema,
416
468
  ActivitySchema,
469
+ AgentActionSchema,
470
+ AgentApprovalSchema,
471
+ AgentNotificationSchema,
472
+ AgentPassportSchema,
473
+ AgentSessionSchema,
417
474
  AppealSchema,
418
475
  BUDGET_SCHEMA_IRI,
419
476
  BudgetSchema,
420
477
  CHANNEL_KINDS,
478
+ CHECKPOINT_SCHEMA_IRI,
421
479
  CONTACT_LIFECYCLE,
422
480
  CONTACT_SCHEMA_IRI,
423
481
  CRM_NAMESPACE,
424
482
  CanvasSchema,
425
483
  ChannelSchema,
426
484
  ChatMessageSchema,
485
+ CheckpointSchema,
427
486
  CommentSchema,
428
487
  CommunityNoteSchema,
429
488
  ContactSchema,
@@ -435,6 +494,7 @@ export {
435
494
  DEFAULT_CHANNEL_TIER,
436
495
  DEFAULT_SCHEMA_VERSION,
437
496
  DEVICE_RECORD_SCHEMA_IRI,
497
+ DRAFT_SCHEMA_IRI,
438
498
  DashboardSchema,
439
499
  DatabaseFieldSchema,
440
500
  DatabaseRowSchema,
@@ -443,7 +503,9 @@ export {
443
503
  DatabaseViewSchema,
444
504
  DealContactRoleSchema,
445
505
  DealSchema,
506
+ DebugReportSchema,
446
507
  DeviceRecordSchema,
508
+ DraftSchema,
447
509
  EXTENSION_FIELD_SCHEMA_IRI,
448
510
  EXTERNAL_ITEM_SCHEMA_IRI,
449
511
  EXTERNAL_ITEM_SOURCES,
@@ -573,6 +635,11 @@ export {
573
635
  accountState,
574
636
  addDefault,
575
637
  admitDeviceRecord,
638
+ agentActionId,
639
+ agentApprovalId,
640
+ agentNotificationId,
641
+ agentPassportId,
642
+ agentSessionId,
576
643
  bucketPresenceCount,
577
644
  buildEffectiveSchema,
578
645
  buildFolderTree,
@@ -669,6 +736,7 @@ export {
669
736
  profileNodeId,
670
737
  promoteOverlay,
671
738
  recoveryRecordId,
739
+ redactInstruction,
672
740
  relation,
673
741
  remove,
674
742
  rename,
@@ -1,7 +1,7 @@
1
- import { g as NodeStorageAdapter, r as NodeChange, i as NodeId, h as NodeState, aa as NodeBatchPreflightResult, a3 as ImportNodesOptions, a5 as ApplyNodeBatchInput, a6 as ApplyNodeBatchResult, L as ListNodesOptions, ae as CountNodesOptions, a2 as SetNodeOptions, j as NodeQueryDescriptor, k as NodeQueryResult, S as SchemaIRI, a4 as RebuildNodeIndexesOptions, bi as NodeReadAuthorizer, bj as AuthorizationStateVersion } from '../types-B5rrBwRI.js';
2
- export { av as ConflictResult, ay as ContentKeyCache, C as CreateNodeOptions, ab as DeterministicNodeBatchWriteInput, m as DeterministicNodeImportDraft, G as GetWithMigrationOptions, n as ImportDeterministicNodesOptions, o as ImportDeterministicNodesResult, s as MergeConflict, M as MigratedNodeState, az as MigrationInfo, aw as NodeBatchChangeEvent, u as NodeBatchChangeListener, a7 as NodeBatchIndexMode, a8 as NodeBatchNotificationMode, a9 as NodeBatchSyncMode, p as NodeBatchWriteInput, ac as NodeBatchWritePolicy, q as NodeBatchWriteResult, ad as NodeBatchWriteTimings, v as NodeChangeEvent, t as NodeChangeListener, ax as NodeContentCipher, a0 as NodePayload, ar as NodeQueryCursor, aq as NodeQueryCursorOrderEntry, ao as NodeQueryMaterializedViewOptions, as as NodeQueryOptions, N as NodeQueryPageCountMode, ap as NodeQueryPageOptions, au as NodeQueryParityCheckMetadata, at as NodeQueryPlanMetadata, am as NodeQuerySearchField, an as NodeQuerySearchFilter, al as NodeQuerySpatialFilter, af as NodeQuerySpatialPoint, ah as NodeQuerySpatialPointFields, ak as NodeQuerySpatialRadius, ag as NodeQuerySpatialRect, ai as NodeQuerySpatialRectFields, aj as NodeQuerySpatialWindow, f as NodeStoreOptions, bk as OperationNodeBatchWriteInput, $ as PropertyKey, bl as PropertyLookup, a1 as PropertyTimestamp, aR as SchemaLookup, c as SortDirection, d as SystemOrderField, aO as TEMP_ID_PREFIX, aS as TempIdResolution, T as TransactionOperation, l as TransactionResult, U as UpdateNodeOptions, aI as applyNodeQueryDescriptor, aA as createNodeQueryDescriptor, bm as createPropertyLookup, aQ as createSchemaLookup, aC as decodeNodeQueryCursor, aB as encodeNodeQueryCursor, aG as filterNodeQueryResults, aJ as getNodeQuerySearchTokens, aN as isTempId, aF as matchesNodeQueryDescriptor, aK as nodeQueryDescriptorNeedsBoundedReload, aD as nodeQueryDescriptorToOptions, aP as resolveTempIds, aE as serializeNodeQueryDescriptor, aH as sortNodeQueryResults, aM as withoutNodeQueryMaterializedView, aL as withoutNodeQueryPagination } from '../types-B5rrBwRI.js';
3
- export { G as QUERY_AST_VERSION, r as QueryAST, n as QueryASTAggregate, A as QueryASTAggregateExecution, m as QueryASTAggregateFunction, y as QueryASTAggregateGroup, x as QueryASTAggregatePlan, z as QueryASTAggregateResult, d as QueryASTComparisonPredicate, e as QueryASTCompoundPredicate, a as QueryASTField, l as QueryASTIncludes, p as QueryASTNodeQuery, s as QueryASTNodeQueryOptions, f as QueryASTNotPredicate, c as QueryASTOperator, h as QueryASTOrderBy, i as QueryASTPage, B as QueryASTPlannerGate, g as QueryASTPredicate, q as QueryASTQuerySet, o as QueryASTQuerySetAggregate, j as QueryASTRelationDirection, k as QueryASTRelationInclude, t as QueryASTRelationIncludeOptions, w as QueryASTRelationIndexRequirement, b as QueryASTSchemaInput, u as QueryASTValidationError, v as QueryASTValidationResult, Q as QueryASTVersion, S as SavedViewDescriptor, F as SavedViewFeedDensity, E as SavedViewFeedLayout, C as SavedViewPresentationHint, D as SavedViewPresentationHintMode, V as and, a3 as avg, N as between, P as contains, a0 as count, a1 as countDistinct, a9 as dashboardQuerySet, Z as defineNodeQueryAST, a8 as defineQuerySetAST, ab as defineSavedViewDescriptor, H as eq, aj as evaluateQueryASTPlannerGate, af as executeQueryASTLoadedAggregates, ag as filterQueryASTLoadedRows, _ as follow, $ as from, ah as getQueryASTRelationIndexRequirements, a6 as groupBy, J as gt, K as gte, a7 as having, O as includesAny, U as isNotNull, T as isNull, L as lt, M as lte, ai as matchesQueryASTLoadedRow, a5 as max, a4 as min, I as neq, X as not, W as or, ae as planQueryASTAggregates, Y as queryOperators, aa as querySetCount, R as startsWith, a2 as sum, ac as validateQueryAST, ad as validateSavedViewDescriptor } from '../query-ast-ESRn8U2H.js';
4
- export { N as NodeStore } from '../store-B0fb6WdJ.js';
1
+ import { g as NodeStorageAdapter, s as NodeChange, i as NodeId, h as NodeState, ad as NodeBatchPreflightResult, a6 as ImportNodesOptions, a8 as ApplyNodeBatchInput, a9 as ApplyNodeBatchResult, L as ListNodesOptions, ah as CountNodesOptions, a4 as PinRegistry, a5 as SetNodeOptions, k as NodeQueryDescriptor, l as NodeQueryResult, S as SchemaIRI, a7 as RebuildNodeIndexesOptions, bd as NodeReadAuthorizer, be as AuthorizationStateVersion } from '../types-C64g-IXg.js';
2
+ export { j as CheckedOutDraftOverlay, ay as ConflictResult, aB as ContentKeyCache, C as CreateNodeOptions, ae as DeterministicNodeBatchWriteInput, n as DeterministicNodeImportDraft, G as GetWithMigrationOptions, o as ImportDeterministicNodesOptions, p as ImportDeterministicNodesResult, t as MergeConflict, M as MigratedNodeState, aC as MigrationInfo, az as NodeBatchChangeEvent, v as NodeBatchChangeListener, aa as NodeBatchIndexMode, ab as NodeBatchNotificationMode, ac as NodeBatchSyncMode, q as NodeBatchWriteInput, af as NodeBatchWritePolicy, r as NodeBatchWriteResult, ag as NodeBatchWriteTimings, w as NodeChangeEvent, u as NodeChangeListener, aA as NodeContentCipher, a1 as NodePayload, au as NodeQueryCursor, at as NodeQueryCursorOrderEntry, ar as NodeQueryMaterializedViewOptions, av as NodeQueryOptions, N as NodeQueryPageCountMode, as as NodeQueryPageOptions, ax as NodeQueryParityCheckMetadata, aw as NodeQueryPlanMetadata, ap as NodeQuerySearchField, aq as NodeQuerySearchFilter, ao as NodeQuerySpatialFilter, ai as NodeQuerySpatialPoint, ak as NodeQuerySpatialPointFields, an as NodeQuerySpatialRadius, aj as NodeQuerySpatialRect, al as NodeQuerySpatialRectFields, am as NodeQuerySpatialWindow, f as NodeStoreOptions, bf as OperationNodeBatchWriteInput, a3 as PinEntry, a0 as PropertyKey, bg as PropertyLookup, a2 as PropertyTimestamp, aU as SchemaLookup, c as SortDirection, d as SystemOrderField, aR as TEMP_ID_PREFIX, aV as TempIdResolution, T as TransactionOperation, m as TransactionResult, U as UpdateNodeOptions, aL as applyNodeQueryDescriptor, aD as createNodeQueryDescriptor, bh as createPropertyLookup, aT as createSchemaLookup, aF as decodeNodeQueryCursor, aE as encodeNodeQueryCursor, aJ as filterNodeQueryResults, aM as getNodeQuerySearchTokens, aQ as isTempId, aI as matchesNodeQueryDescriptor, aN as nodeQueryDescriptorNeedsBoundedReload, aG as nodeQueryDescriptorToOptions, aS as resolveTempIds, aH as serializeNodeQueryDescriptor, aK as sortNodeQueryResults, aP as withoutNodeQueryMaterializedView, aO as withoutNodeQueryPagination } from '../types-C64g-IXg.js';
3
+ export { G as QUERY_AST_VERSION, r as QueryAST, n as QueryASTAggregate, A as QueryASTAggregateExecution, m as QueryASTAggregateFunction, y as QueryASTAggregateGroup, x as QueryASTAggregatePlan, z as QueryASTAggregateResult, d as QueryASTComparisonPredicate, e as QueryASTCompoundPredicate, a as QueryASTField, l as QueryASTIncludes, p as QueryASTNodeQuery, s as QueryASTNodeQueryOptions, f as QueryASTNotPredicate, c as QueryASTOperator, h as QueryASTOrderBy, i as QueryASTPage, B as QueryASTPlannerGate, g as QueryASTPredicate, q as QueryASTQuerySet, o as QueryASTQuerySetAggregate, j as QueryASTRelationDirection, k as QueryASTRelationInclude, t as QueryASTRelationIncludeOptions, w as QueryASTRelationIndexRequirement, b as QueryASTSchemaInput, u as QueryASTValidationError, v as QueryASTValidationResult, Q as QueryASTVersion, S as SavedViewDescriptor, F as SavedViewFeedDensity, E as SavedViewFeedLayout, C as SavedViewPresentationHint, D as SavedViewPresentationHintMode, V as and, a3 as avg, N as between, P as contains, a0 as count, a1 as countDistinct, a9 as dashboardQuerySet, Z as defineNodeQueryAST, a8 as defineQuerySetAST, ab as defineSavedViewDescriptor, H as eq, aj as evaluateQueryASTPlannerGate, af as executeQueryASTLoadedAggregates, ag as filterQueryASTLoadedRows, _ as follow, $ as from, ah as getQueryASTRelationIndexRequirements, a6 as groupBy, J as gt, K as gte, a7 as having, O as includesAny, U as isNotNull, T as isNull, L as lt, M as lte, ai as matchesQueryASTLoadedRow, a5 as max, a4 as min, I as neq, X as not, W as or, ae as planQueryASTAggregates, Y as queryOperators, aa as querySetCount, R as startsWith, a2 as sum, ac as validateQueryAST, ad as validateSavedViewDescriptor } from '../query-ast-NV5StnHo.js';
4
+ export { N as NodeStore } from '../store-BIDKtpjW.js';
5
5
  import { TaggedError, AuthAction, DID, AuthDenyReason, AuthDecision, ContentId } from '@xnetjs/core';
6
6
  import { SQLiteAdapter, SQLiteOperationStats } from '@xnetjs/sqlite';
7
7
  import '@xnetjs/crypto';
@@ -85,6 +85,9 @@ declare class MemoryNodeStorageAdapter implements NodeStorageAdapter {
85
85
  byteSize: number;
86
86
  }[]>;
87
87
  deleteYjsSnapshots(nodeId: NodeId): Promise<void>;
88
+ /** key -> ownerId -> entry */
89
+ private pinStore;
90
+ readonly pins: PinRegistry;
88
91
  /**
89
92
  * Clear all data (for testing).
90
93
  */
@@ -315,6 +318,7 @@ declare class SQLiteNodeStorageAdapter implements NodeStorageAdapter {
315
318
  getDocumentContent(nodeId: NodeId): Promise<Uint8Array | null>;
316
319
  setDocumentContent(nodeId: NodeId, content: Uint8Array): Promise<void>;
317
320
  private setDocumentContentInternal;
321
+ readonly pins: PinRegistry;
318
322
  /**
319
323
  * Save a Yjs snapshot for time travel.
320
324
  */
@@ -511,4 +515,4 @@ declare class SQLiteNodeStorageAdapter implements NodeStorageAdapter {
511
515
  */
512
516
  declare function createNodeStorageAdapter(db: SQLiteAdapter, options?: SQLiteNodeStorageAdapterOptions): SQLiteNodeStorageAdapter;
513
517
 
514
- export { ApplyNodeBatchInput, ApplyNodeBatchResult, CountNodesOptions, ImportNodesOptions, ListNodesOptions, MemoryNodeStorageAdapter, NodeBatchPreflightResult, NodeChange, NodeId, NodeQueryDescriptor, NodeQueryResult, NodeState, NodeStorageAdapter, PermissionError, RebuildNodeIndexesOptions, type SQLiteAdaptiveIndexingOptions, SQLiteNodeStorageAdapter, type SQLiteNodeStorageAdapterOptions, type SQLiteQueryVerificationOptions, SetNodeOptions, createNodeStorageAdapter };
518
+ export { ApplyNodeBatchInput, ApplyNodeBatchResult, CountNodesOptions, ImportNodesOptions, ListNodesOptions, MemoryNodeStorageAdapter, NodeBatchPreflightResult, NodeChange, NodeId, NodeQueryDescriptor, NodeQueryResult, NodeState, NodeStorageAdapter, PermissionError, PinRegistry, RebuildNodeIndexesOptions, type SQLiteAdaptiveIndexingOptions, SQLiteNodeStorageAdapter, type SQLiteNodeStorageAdapterOptions, type SQLiteQueryVerificationOptions, SetNodeOptions, createNodeStorageAdapter };
@@ -49,8 +49,7 @@ import {
49
49
  sum,
50
50
  validateQueryAST,
51
51
  validateSavedViewDescriptor
52
- } from "../chunk-CARPMPXV.js";
53
- import "../chunk-XJBDESCX.js";
52
+ } from "../chunk-4S73XDWH.js";
54
53
  import {
55
54
  applyNodeQueryDescriptor,
56
55
  createNodeQueryDescriptor,
@@ -66,6 +65,7 @@ import {
66
65
  withoutNodeQueryMaterializedView,
67
66
  withoutNodeQueryPagination
68
67
  } from "../chunk-S5RP5RKY.js";
68
+ import "../chunk-XJBDESCX.js";
69
69
  import "../chunk-RRXJNZX5.js";
70
70
  import "../chunk-D4LUUZYD.js";
71
71
  export {
@@ -1,4 +1,4 @@
1
- import { e as StoreAuthAPI, f as NodeStoreOptions, g as NodeStorageAdapter, C as CreateNodeOptions, h as NodeState, i as NodeId, G as GetWithMigrationOptions, M as MigratedNodeState, U as UpdateNodeOptions, L as ListNodesOptions, j as NodeQueryDescriptor, k as NodeQueryResult, T as TransactionOperation, l as TransactionResult, m as DeterministicNodeImportDraft, n as ImportDeterministicNodesOptions, o as ImportDeterministicNodesResult, p as NodeBatchWriteInput, q as NodeBatchWriteResult, S as SchemaIRI, r as NodeChange, s as MergeConflict, t as NodeChangeListener, u as NodeBatchChangeListener } from './types-B5rrBwRI.js';
1
+ import { e as StoreAuthAPI, f as NodeStoreOptions, g as NodeStorageAdapter, C as CreateNodeOptions, h as NodeState, i as NodeId, j as CheckedOutDraftOverlay, G as GetWithMigrationOptions, M as MigratedNodeState, U as UpdateNodeOptions, L as ListNodesOptions, k as NodeQueryDescriptor, l as NodeQueryResult, T as TransactionOperation, m as TransactionResult, n as DeterministicNodeImportDraft, o as ImportDeterministicNodesOptions, p as ImportDeterministicNodesResult, q as NodeBatchWriteInput, r as NodeBatchWriteResult, S as SchemaIRI, s as NodeChange, t as MergeConflict, u as NodeChangeListener, v as NodeBatchChangeListener } from './types-C64g-IXg.js';
2
2
 
3
3
  /**
4
4
  * NodeStore - Event-sourced storage for Nodes
@@ -26,6 +26,13 @@ declare class NodeStore {
26
26
  private listeners;
27
27
  private nodeListeners;
28
28
  private batchListeners;
29
+ private checkedOutDraft;
30
+ private cloneToOriginal;
31
+ private draftMemberSet;
32
+ private draftDynamicMembers;
33
+ /** null = conservative "all schemas" (memberSchemaIds omitted). */
34
+ private draftMemberSchemaSet;
35
+ private draftOverlayListeners;
29
36
  private schemaLookup?;
30
37
  private propertyLookup?;
31
38
  private lensRegistry?;
@@ -62,6 +69,54 @@ declare class NodeStore {
62
69
  * Get a Node by ID.
63
70
  */
64
71
  get(id: NodeId): Promise<NodeState | null>;
72
+ /**
73
+ * Read a node WITHOUT the draft overlay (exploration 0329) — merge review
74
+ * and diff surfaces use this to see main's true state while checked out.
75
+ */
76
+ getRaw(id: NodeId): Promise<NodeState | null>;
77
+ /**
78
+ * Check a draft out (or pass null to return to main). While checked out,
79
+ * member reads swap to clone content under original ids, member writes
80
+ * redirect to clones (lazily forking via `onMissingMember`), and clone
81
+ * change events mirror to original-id subscribers.
82
+ */
83
+ setCheckedOutDraft(overlay: CheckedOutDraftOverlay | null): void;
84
+ /** Report a locally-created node to the checkout's draft-born hook (0329 P4). */
85
+ private notifyDraftNodeCreated;
86
+ private notifyDraftOverlayListeners;
87
+ getCheckedOutDraft(): CheckedOutDraftOverlay | null;
88
+ /**
89
+ * Device-local draft privacy (exploration 0329): ids marked here (draft
90
+ * bookkeeping nodes, clones, draft-born nodes) are excluded from outbound
91
+ * sync publication by the personal node-sync room's `shouldPublish`
92
+ * predicate. In-memory only — the draft module rehydrates it from open
93
+ * Draft nodes at boot, BEFORE sync starts.
94
+ */
95
+ private draftPrivateNodeIds;
96
+ markDraftPrivate(ids: readonly NodeId[]): void;
97
+ unmarkDraftPrivate(ids: readonly NodeId[]): void;
98
+ isDraftPrivate(id: NodeId): boolean;
99
+ /** Notified on every checkout change (including clone-map refreshes). */
100
+ subscribeToDraftOverlay(listener: () => void): () => void;
101
+ /**
102
+ * Swap checked-out members' content to their clones (original ids kept, so
103
+ * MV id lists and grid ordering are untouched). No-op without a checkout.
104
+ */
105
+ private overlayStates;
106
+ /**
107
+ * Draft-aware query path (0329 P5): candidates from storage WITHOUT
108
+ * pagination, unioned with checked-out members the predicate may have
109
+ * missed (their clone values can change membership), content-swapped,
110
+ * clone rows hidden, then the full descriptor re-applied in JS so
111
+ * filter/sort/pagination reflect draft values.
112
+ */
113
+ private draftAwareQuery;
114
+ /**
115
+ * Resolve where a write to `id` lands under the checkout: an existing
116
+ * clone, a lazily-forked one (`onMissingMember`), or — for non-members,
117
+ * clone ids, and declined forks — the id itself.
118
+ */
119
+ private resolveDraftWriteTarget;
65
120
  /**
66
121
  * Return the subset of IDs that already exist in materialized storage.
67
122
  *
@@ -231,7 +231,7 @@ interface NodeQueryDescriptor {
231
231
  authFingerprint?: string;
232
232
  }
233
233
  interface NodeQueryPlanMetadata {
234
- strategy: 'storage-query' | 'list-fallback' | 'auth-pushdown-candidates';
234
+ strategy: 'storage-query' | 'list-fallback' | 'auth-pushdown-candidates' | 'draft-overlay';
235
235
  candidateNodeCount: number;
236
236
  hydratedNodeCount: number;
237
237
  returnedNodeCount: number;
@@ -959,6 +959,74 @@ interface NodeStorageAdapter {
959
959
  setAppState?(key: string, value: string): Promise<void>;
960
960
  getDocumentContent(nodeId: NodeId): Promise<Uint8Array | null>;
961
961
  setDocumentContent(nodeId: NodeId, content: Uint8Array): Promise<void>;
962
+ /**
963
+ * Pin registry (exploration 0329): keys pinned here are exempt from history
964
+ * pruning and Yjs snapshot eviction. A key is either a change hash or a
965
+ * `yjs:<nodeId>@<timestamp>` snapshot ref; owners (checkpoints, drafts)
966
+ * release all their pins in one call when they are deleted. Blobs are NOT
967
+ * pinned — referenced blobs past retention are an explicit blob horizon.
968
+ * Optional: without it, pruning behaves as before (nothing is protected).
969
+ */
970
+ pins?: PinRegistry;
971
+ }
972
+ /**
973
+ * Checked-out draft overlay (exploration 0329): while set on a NodeStore,
974
+ * reads of an original member id return its clone's content (under the
975
+ * original id — MV id lists and grid ordering never see clone ids), writes
976
+ * to members redirect to their clones, and the first write to a not-yet-
977
+ * forked member triggers `onMissingMember` (lazy copy-on-write, wired to
978
+ * `forkNodeIntoDraft`). Only ids in `members` are overlay-managed — all
979
+ * other reads/writes pass through untouched, so bookkeeping writes (the
980
+ * draft node itself, profiles, unrelated content) never fork.
981
+ */
982
+ interface CheckedOutDraftOverlay {
983
+ /** The Draft node that owns this checkout. */
984
+ draftId: NodeId;
985
+ /**
986
+ * The draft's declared scope: ids eligible for overlay + lazy COW.
987
+ * `'dynamic'` (agent-PR sessions, 0329 P4) makes EVERY written id a
988
+ * candidate — `onMissingMember` decides per id (never-fork schemas and
989
+ * bookkeeping decline by returning null).
990
+ */
991
+ members: readonly NodeId[] | 'dynamic';
992
+ /** originalId -> cloneId for members already forked. */
993
+ clones: Record<NodeId, NodeId>;
994
+ /**
995
+ * Schema IRIs the members span. Queries against OTHER schemas keep their
996
+ * indexed fast path (nothing to overlay); queries against these take the
997
+ * draft-aware path (clone values drive filter/sort — a JS re-apply over
998
+ * unpaginated candidates, the accepted transient-session cost). Omitted =
999
+ * conservative: every query takes the draft-aware path.
1000
+ */
1001
+ memberSchemaIds?: readonly string[];
1002
+ /**
1003
+ * Lazy copy-on-write: fork `originalId` into the draft and return the
1004
+ * clone id (or null to decline — the write then targets the original).
1005
+ */
1006
+ onMissingMember?: (originalId: NodeId) => Promise<NodeId | null>;
1007
+ /**
1008
+ * Fired when a NEW node is created while this draft is checked out
1009
+ * (draft-born; promoted to a fresh main node on merge). Agent-PR sessions
1010
+ * wire this to `markCreatedInDraft`.
1011
+ */
1012
+ onNodeCreated?: (nodeId: NodeId, schemaId: string) => void;
1013
+ }
1014
+ /** One pinned key: a change hash or a `yjs:`-prefixed snapshot ref. */
1015
+ interface PinEntry {
1016
+ key: string;
1017
+ ownerId: string;
1018
+ reason: string;
1019
+ }
1020
+ /** Pin registry capability on a storage adapter (exploration 0329). */
1021
+ interface PinRegistry {
1022
+ /** Add pins (idempotent per (key, ownerId)). */
1023
+ addPins(pins: readonly PinEntry[]): Promise<void>;
1024
+ /** Release every pin held by an owner (checkpoint/draft deletion). */
1025
+ removePinsByOwner(ownerId: string): Promise<void>;
1026
+ /** Of the given keys, return the subset pinned by any owner. */
1027
+ getPinnedKeysAmong(keys: readonly string[]): Promise<Set<string>>;
1028
+ /** Total number of pins (diagnostics). */
1029
+ countPins(): Promise<number>;
962
1030
  }
963
1031
  interface SetNodeOptions {
964
1032
  /**
@@ -1605,4 +1673,4 @@ type InferNode<P extends Record<string, PropertyBuilder>> = {
1605
1673
  createdBy: DID;
1606
1674
  } & InferProperties<P>;
1607
1675
 
1608
- export { type PropertyKey as $, createNodeId as A, type PropertyType as B, type CreateNodeOptions$1 as C, type DefinedSchema as D, type PropertyDefinition as E, type ValidationError as F, type GetWithMigrationOptions as G, type CreateNodeOptions as H, type InferCreateProps as I, type InferPropertyType as J, type InferProperties as K, type ListNodesOptions as L, type MigratedNodeState as M, type NodeQueryPageCountMode as N, type OfflineAuthPolicy as O, type PropertyBuilder as P, type InferNode as Q, type SchemaLens as R, type SchemaIRI as S, type TransactionOperation as T, type UpdateNodeOptions as U, type ValidationResult as V, type LensOperation as W, type MigrationResult as X, MigrationError as Y, LensRegistry as Z, lensRegistry as _, type Schema as a, type StoreAuthKeyManager as a$, type NodePayload as a0, type PropertyTimestamp as a1, type SetNodeOptions as a2, type ImportNodesOptions as a3, type RebuildNodeIndexesOptions as a4, type ApplyNodeBatchInput as a5, type ApplyNodeBatchResult as a6, type NodeBatchIndexMode as a7, type NodeBatchNotificationMode as a8, type NodeBatchSyncMode as a9, createNodeQueryDescriptor as aA, encodeNodeQueryCursor as aB, decodeNodeQueryCursor as aC, nodeQueryDescriptorToOptions as aD, serializeNodeQueryDescriptor as aE, matchesNodeQueryDescriptor as aF, filterNodeQueryResults as aG, sortNodeQueryResults as aH, applyNodeQueryDescriptor as aI, getNodeQuerySearchTokens as aJ, nodeQueryDescriptorNeedsBoundedReload as aK, withoutNodeQueryPagination as aL, withoutNodeQueryMaterializedView as aM, isTempId as aN, TEMP_ID_PREFIX as aO, resolveTempIds as aP, createSchemaLookup as aQ, type SchemaLookup as aR, type TempIdResolution as aS, StoreAuth as aT, GrantRateLimiter as aU, GRANT_SCHEMA_IRI as aV, isGrantActive as aW, DEFAULT_OFFLINE_POLICY as aX, mergeOfflinePolicy as aY, type StoreAuthOptions as aZ, type StoreAuthStore as a_, type NodeBatchPreflightResult as aa, type DeterministicNodeBatchWriteInput as ab, type NodeBatchWritePolicy as ac, type NodeBatchWriteTimings as ad, type CountNodesOptions as ae, type NodeQuerySpatialPoint as af, type NodeQuerySpatialRect as ag, type NodeQuerySpatialPointFields as ah, type NodeQuerySpatialRectFields as ai, type NodeQuerySpatialWindow as aj, type NodeQuerySpatialRadius as ak, type NodeQuerySpatialFilter as al, type NodeQuerySearchField as am, type NodeQuerySearchFilter as an, type NodeQueryMaterializedViewOptions as ao, type NodeQueryPageOptions as ap, type NodeQueryCursorOrderEntry as aq, type NodeQueryCursor as ar, type NodeQueryOptions as as, type NodeQueryPlanMetadata as at, type NodeQueryParityCheckMetadata as au, type ConflictResult as av, type NodeBatchChangeEvent as aw, type NodeContentCipher as ax, type ContentKeyCache as ay, type MigrationInfo as az, type ParsedSchemaIRI as b, type GrantInput as b0, type Grant as b1, StoreAuthError as b2, type StoreAuthErrorCode as b3, type GrantNode as b4, type GrantIndexStore as b5, type GrantIndexOptions as b6, type RevocationConsistency as b7, type RevocationConfig as b8, type GrantRateLimiterOptions as b9, type DocumentType as ba, DEFAULT_SCHEMA_VERSION as bb, parseSchemaIRI as bc, buildSchemaIRI as bd, normalizeSchemaIRI as be, getBaseSchemaIRI as bf, isSameSchema as bg, getSchemaVersion as bh, type NodeReadAuthorizer as bi, type AuthorizationStateVersion as bj, type OperationNodeBatchWriteInput as bk, type PropertyLookup as bl, createPropertyLookup as bm, type SortDirection as c, type SystemOrderField as d, type StoreAuthAPI as e, type NodeStoreOptions as f, type NodeStorageAdapter as g, type NodeState as h, type NodeId as i, type NodeQueryDescriptor as j, type NodeQueryResult as k, type TransactionResult as l, type DeterministicNodeImportDraft as m, type ImportDeterministicNodesOptions as n, type ImportDeterministicNodesResult as o, type NodeBatchWriteInput as p, type NodeBatchWriteResult as q, type NodeChange as r, type MergeConflict as s, type NodeChangeListener as t, type NodeBatchChangeListener as u, type NodeChangeEvent as v, GrantIndex as w, type Node as x, type DID as y, isNode as z };
1676
+ export { lensRegistry as $, isNode as A, createNodeId as B, type CreateNodeOptions$1 as C, type DefinedSchema as D, type PropertyType as E, type PropertyDefinition as F, type GetWithMigrationOptions as G, type ValidationError as H, type InferCreateProps as I, type CreateNodeOptions as J, type InferPropertyType as K, type ListNodesOptions as L, type MigratedNodeState as M, type NodeQueryPageCountMode as N, type OfflineAuthPolicy as O, type PropertyBuilder as P, type InferProperties as Q, type InferNode as R, type SchemaIRI as S, type TransactionOperation as T, type UpdateNodeOptions as U, type ValidationResult as V, type SchemaLens as W, type LensOperation as X, type MigrationResult as Y, MigrationError as Z, LensRegistry as _, type Schema as a, mergeOfflinePolicy as a$, type PropertyKey as a0, type NodePayload as a1, type PropertyTimestamp as a2, type PinEntry as a3, type PinRegistry as a4, type SetNodeOptions as a5, type ImportNodesOptions as a6, type RebuildNodeIndexesOptions as a7, type ApplyNodeBatchInput as a8, type ApplyNodeBatchResult as a9, type NodeContentCipher as aA, type ContentKeyCache as aB, type MigrationInfo as aC, createNodeQueryDescriptor as aD, encodeNodeQueryCursor as aE, decodeNodeQueryCursor as aF, nodeQueryDescriptorToOptions as aG, serializeNodeQueryDescriptor as aH, matchesNodeQueryDescriptor as aI, filterNodeQueryResults as aJ, sortNodeQueryResults as aK, applyNodeQueryDescriptor as aL, getNodeQuerySearchTokens as aM, nodeQueryDescriptorNeedsBoundedReload as aN, withoutNodeQueryPagination as aO, withoutNodeQueryMaterializedView as aP, isTempId as aQ, TEMP_ID_PREFIX as aR, resolveTempIds as aS, createSchemaLookup as aT, type SchemaLookup as aU, type TempIdResolution as aV, StoreAuth as aW, GrantRateLimiter as aX, GRANT_SCHEMA_IRI as aY, isGrantActive as aZ, DEFAULT_OFFLINE_POLICY as a_, type NodeBatchIndexMode as aa, type NodeBatchNotificationMode as ab, type NodeBatchSyncMode as ac, type NodeBatchPreflightResult as ad, type DeterministicNodeBatchWriteInput as ae, type NodeBatchWritePolicy as af, type NodeBatchWriteTimings as ag, type CountNodesOptions as ah, type NodeQuerySpatialPoint as ai, type NodeQuerySpatialRect as aj, type NodeQuerySpatialPointFields as ak, type NodeQuerySpatialRectFields as al, type NodeQuerySpatialWindow as am, type NodeQuerySpatialRadius as an, type NodeQuerySpatialFilter as ao, type NodeQuerySearchField as ap, type NodeQuerySearchFilter as aq, type NodeQueryMaterializedViewOptions as ar, type NodeQueryPageOptions as as, type NodeQueryCursorOrderEntry as at, type NodeQueryCursor as au, type NodeQueryOptions as av, type NodeQueryPlanMetadata as aw, type NodeQueryParityCheckMetadata as ax, type ConflictResult as ay, type NodeBatchChangeEvent as az, type ParsedSchemaIRI as b, type StoreAuthOptions as b0, type StoreAuthStore as b1, type StoreAuthKeyManager as b2, type GrantInput as b3, type Grant as b4, StoreAuthError as b5, type StoreAuthErrorCode as b6, type GrantNode as b7, type GrantIndexStore as b8, type GrantIndexOptions as b9, type RevocationConsistency as ba, type RevocationConfig as bb, type GrantRateLimiterOptions as bc, type NodeReadAuthorizer as bd, type AuthorizationStateVersion as be, type OperationNodeBatchWriteInput as bf, type PropertyLookup as bg, createPropertyLookup as bh, type DocumentType as bi, DEFAULT_SCHEMA_VERSION as bj, parseSchemaIRI as bk, buildSchemaIRI as bl, normalizeSchemaIRI as bm, getBaseSchemaIRI as bn, isSameSchema as bo, getSchemaVersion as bp, type SortDirection as c, type SystemOrderField as d, type StoreAuthAPI as e, type NodeStoreOptions as f, type NodeStorageAdapter as g, type NodeState as h, type NodeId as i, type CheckedOutDraftOverlay as j, type NodeQueryDescriptor as k, type NodeQueryResult as l, type TransactionResult as m, type DeterministicNodeImportDraft as n, type ImportDeterministicNodesOptions as o, type ImportDeterministicNodesResult as p, type NodeBatchWriteInput as q, type NodeBatchWriteResult as r, type NodeChange as s, type MergeConflict as t, type NodeChangeListener as u, type NodeBatchChangeListener as v, type NodeChangeEvent as w, GrantIndex as x, type Node as y, type DID as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnetjs/data",
3
- "version": "1.0.0",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,12 +57,12 @@
57
57
  "nanoid": "^5.1.6",
58
58
  "y-protocols": "^1.0.6",
59
59
  "yjs": "^13.6.24",
60
- "@xnetjs/core": "1.0.0",
61
- "@xnetjs/crypto": "1.0.0",
62
- "@xnetjs/identity": "1.0.0",
63
- "@xnetjs/sqlite": "1.0.0",
64
- "@xnetjs/storage": "1.0.0",
65
- "@xnetjs/sync": "1.0.0"
60
+ "@xnetjs/core": "2.1.0",
61
+ "@xnetjs/crypto": "2.1.0",
62
+ "@xnetjs/identity": "2.1.0",
63
+ "@xnetjs/sqlite": "2.1.0",
64
+ "@xnetjs/storage": "2.1.0",
65
+ "@xnetjs/sync": "2.1.0"
66
66
  },
67
67
  "devDependencies": {
68
68
  "tsup": "^8.0.0",