@xnetjs/data 0.11.1 → 0.12.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.
|
@@ -1173,7 +1173,9 @@ import {
|
|
|
1173
1173
|
import { verifyChange, verifyChangeHash } from "@xnetjs/sync";
|
|
1174
1174
|
|
|
1175
1175
|
// src/store/permission-error.ts
|
|
1176
|
-
|
|
1176
|
+
import { TaggedError } from "@xnetjs/core";
|
|
1177
|
+
var PermissionError = class extends TaggedError {
|
|
1178
|
+
_tag = "PermissionError";
|
|
1177
1179
|
code = "PERMISSION_DENIED";
|
|
1178
1180
|
action;
|
|
1179
1181
|
nodeId;
|
|
@@ -1186,7 +1188,6 @@ var PermissionError = class extends Error {
|
|
|
1186
1188
|
super(
|
|
1187
1189
|
`Permission denied: ${roleInfo} but action '${decision.action}' is not permitted. Reasons: ${decision.reasons.join(", ")}`
|
|
1188
1190
|
);
|
|
1189
|
-
this.name = "PermissionError";
|
|
1190
1191
|
this.action = decision.action;
|
|
1191
1192
|
this.nodeId = decision.resource;
|
|
1192
1193
|
this.subject = decision.subject;
|
|
@@ -3459,7 +3460,7 @@ var MemoryNodeStorageAdapter = class {
|
|
|
3459
3460
|
};
|
|
3460
3461
|
|
|
3461
3462
|
// src/store/sqlite-adapter.ts
|
|
3462
|
-
import { lwwUpdateGuardSql } from "@xnetjs/core";
|
|
3463
|
+
import { lwwUpdateGuardSql, singleFlight } from "@xnetjs/core";
|
|
3463
3464
|
import {
|
|
3464
3465
|
extractSearchableContent as extractSearchableContent2,
|
|
3465
3466
|
analyzeQuery,
|
|
@@ -6185,24 +6186,23 @@ var SQLiteNodeStorageAdapter = class {
|
|
|
6185
6186
|
*/
|
|
6186
6187
|
collectCompiledQueryDiagnostics(compiled) {
|
|
6187
6188
|
const memoKey = compiled.sql;
|
|
6188
|
-
|
|
6189
|
-
if (memoized) {
|
|
6190
|
-
return memoized;
|
|
6191
|
-
}
|
|
6192
|
-
const pending = this.computeCompiledQueryDiagnostics(compiled).then((diagnostics) => {
|
|
6193
|
-
if (diagnostics.diagnosticsError) {
|
|
6194
|
-
this.compiledQueryDiagnosticsMemo.delete(memoKey);
|
|
6195
|
-
}
|
|
6196
|
-
return diagnostics;
|
|
6197
|
-
});
|
|
6198
|
-
if (this.compiledQueryDiagnosticsMemo.size >= COMPILED_QUERY_DIAGNOSTICS_MEMO_LIMIT) {
|
|
6189
|
+
if (!this.compiledQueryDiagnosticsMemo.has(memoKey) && this.compiledQueryDiagnosticsMemo.size >= COMPILED_QUERY_DIAGNOSTICS_MEMO_LIMIT) {
|
|
6199
6190
|
const oldest = this.compiledQueryDiagnosticsMemo.keys().next().value;
|
|
6200
6191
|
if (oldest !== void 0) {
|
|
6201
6192
|
this.compiledQueryDiagnosticsMemo.delete(oldest);
|
|
6202
6193
|
}
|
|
6203
6194
|
}
|
|
6204
|
-
|
|
6205
|
-
|
|
6195
|
+
return singleFlight(
|
|
6196
|
+
this.compiledQueryDiagnosticsMemo,
|
|
6197
|
+
memoKey,
|
|
6198
|
+
() => this.computeCompiledQueryDiagnostics(compiled).then((diagnostics) => {
|
|
6199
|
+
if (diagnostics.diagnosticsError) {
|
|
6200
|
+
this.compiledQueryDiagnosticsMemo.delete(memoKey);
|
|
6201
|
+
}
|
|
6202
|
+
return diagnostics;
|
|
6203
|
+
}),
|
|
6204
|
+
{ retain: "keep" }
|
|
6205
|
+
);
|
|
6206
6206
|
}
|
|
6207
6207
|
async computeCompiledQueryDiagnostics(compiled) {
|
|
6208
6208
|
try {
|
|
@@ -649,6 +649,7 @@ function mergeSidecarsIntoRow(baseProps, sidecars) {
|
|
|
649
649
|
}
|
|
650
650
|
|
|
651
651
|
// src/schema/registry.ts
|
|
652
|
+
import { singleFlight } from "@xnetjs/core";
|
|
652
653
|
var SchemaRegistry = class {
|
|
653
654
|
schemas = /* @__PURE__ */ new Map();
|
|
654
655
|
loadingPromises = /* @__PURE__ */ new Map();
|
|
@@ -682,34 +683,28 @@ var SchemaRegistry = class {
|
|
|
682
683
|
return entry.schema;
|
|
683
684
|
}
|
|
684
685
|
if (iri in builtInSchemas) {
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
});
|
|
694
|
-
this.loadingPromises.set(iri, loadPromise);
|
|
695
|
-
return loadPromise;
|
|
686
|
+
return singleFlight(
|
|
687
|
+
this.loadingPromises,
|
|
688
|
+
iri,
|
|
689
|
+
() => builtInSchemas[iri]().then((schema) => {
|
|
690
|
+
this.schemas.set(iri, { schema, builtIn: true });
|
|
691
|
+
return schema;
|
|
692
|
+
})
|
|
693
|
+
);
|
|
696
694
|
}
|
|
697
695
|
if (this.remoteResolver) {
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
});
|
|
711
|
-
this.loadingPromises.set(iri, loadPromise);
|
|
712
|
-
return loadPromise;
|
|
696
|
+
const remoteResolver = this.remoteResolver;
|
|
697
|
+
return singleFlight(
|
|
698
|
+
this.loadingPromises,
|
|
699
|
+
iri,
|
|
700
|
+
() => remoteResolver(iri).then((definition) => {
|
|
701
|
+
if (!definition) return void 0;
|
|
702
|
+
const parsed = parseSchemaDefinition(definition);
|
|
703
|
+
if (!parsed) return void 0;
|
|
704
|
+
this.schemas.set(iri, { schema: parsed, builtIn: false });
|
|
705
|
+
return parsed;
|
|
706
|
+
}).catch(() => void 0)
|
|
707
|
+
);
|
|
713
708
|
}
|
|
714
709
|
return void 0;
|
|
715
710
|
}
|
package/dist/index.js
CHANGED
|
@@ -290,7 +290,7 @@ import {
|
|
|
290
290
|
taskBranchName,
|
|
291
291
|
transform,
|
|
292
292
|
when
|
|
293
|
-
} from "./chunk-
|
|
293
|
+
} from "./chunk-ZMZSBJBC.js";
|
|
294
294
|
import {
|
|
295
295
|
SavedViewSchema
|
|
296
296
|
} from "./chunk-ZZ6TWKGS.js";
|
|
@@ -628,7 +628,7 @@ import {
|
|
|
628
628
|
sum,
|
|
629
629
|
validateQueryAST,
|
|
630
630
|
validateSavedViewDescriptor
|
|
631
|
-
} from "./chunk-
|
|
631
|
+
} from "./chunk-JFMLCFZJ.js";
|
|
632
632
|
import {
|
|
633
633
|
applyNodeQueryDescriptor,
|
|
634
634
|
createNodeQueryDescriptor,
|
package/dist/schema/index.js
CHANGED
package/dist/store/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { g as NodeStorageAdapter, r as NodeChange, i as NodeId, h as NodeState,
|
|
|
2
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-BB8-SLEa.js';
|
|
3
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-Bvg0Wolx.js';
|
|
4
4
|
export { N as NodeStore } from '../store-DEWnip2G.js';
|
|
5
|
-
import { AuthAction, DID, AuthDenyReason, AuthDecision, ContentId } from '@xnetjs/core';
|
|
5
|
+
import { TaggedError, AuthAction, DID, AuthDenyReason, AuthDecision, ContentId } from '@xnetjs/core';
|
|
6
6
|
import { SQLiteAdapter, SQLiteOperationStats } from '@xnetjs/sqlite';
|
|
7
7
|
import '@xnetjs/crypto';
|
|
8
8
|
import '@xnetjs/sync';
|
|
@@ -10,7 +10,8 @@ import '@xnetjs/sync';
|
|
|
10
10
|
/**
|
|
11
11
|
* Error thrown when a local mutation fails authorization checks.
|
|
12
12
|
*/
|
|
13
|
-
declare class PermissionError extends
|
|
13
|
+
declare class PermissionError extends TaggedError<'PermissionError'> {
|
|
14
|
+
readonly _tag = "PermissionError";
|
|
14
15
|
readonly code = "PERMISSION_DENIED";
|
|
15
16
|
readonly action: AuthAction;
|
|
16
17
|
readonly nodeId: string;
|
package/dist/store/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xnetjs/data",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.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": "0.
|
|
61
|
-
"@xnetjs/crypto": "0.
|
|
62
|
-
"@xnetjs/identity": "0.
|
|
63
|
-
"@xnetjs/sqlite": "0.
|
|
64
|
-
"@xnetjs/storage": "0.
|
|
65
|
-
"@xnetjs/sync": "0.
|
|
60
|
+
"@xnetjs/core": "0.12.0",
|
|
61
|
+
"@xnetjs/crypto": "0.12.0",
|
|
62
|
+
"@xnetjs/identity": "0.12.0",
|
|
63
|
+
"@xnetjs/sqlite": "0.12.0",
|
|
64
|
+
"@xnetjs/storage": "0.12.0",
|
|
65
|
+
"@xnetjs/sync": "0.12.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"tsup": "^8.0.0",
|