jazz-tools 0.20.0 → 0.20.2
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/.turbo/turbo-build.log +56 -56
- package/CHANGELOG.md +21 -0
- package/dist/{chunk-3CAPPS2F.js → chunk-Q5RNSSUM.js} +269 -95
- package/dist/chunk-Q5RNSSUM.js.map +1 -0
- package/dist/chunk-ZQWSQH6L.js +20 -0
- package/dist/index.js +2 -2
- package/dist/inspector/{chunk-MCTB5ZJC.js → chunk-6JPVMI3V.js} +302 -182
- package/dist/inspector/chunk-6JPVMI3V.js.map +1 -0
- package/dist/inspector/{custom-element-5YWVZBWA.js → custom-element-PWRX4VCA.js} +1337 -206
- package/dist/inspector/custom-element-PWRX4VCA.js.map +1 -0
- package/dist/inspector/in-app.d.ts +1 -0
- package/dist/inspector/in-app.d.ts.map +1 -1
- package/dist/inspector/index.d.ts +1 -0
- package/dist/inspector/index.d.ts.map +1 -1
- package/dist/inspector/index.js +1044 -17
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/pages/home.d.ts +4 -1
- package/dist/inspector/pages/home.d.ts.map +1 -1
- package/dist/inspector/pages/performance/PerformancePage.d.ts +7 -0
- package/dist/inspector/pages/performance/PerformancePage.d.ts.map +1 -0
- package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts +8 -0
- package/dist/inspector/pages/performance/SubscriptionDetailPanel.d.ts.map +1 -0
- package/dist/inspector/pages/performance/SubscriptionRow.d.ts +11 -0
- package/dist/inspector/pages/performance/SubscriptionRow.d.ts.map +1 -0
- package/dist/inspector/pages/performance/Timeline.d.ts +12 -0
- package/dist/inspector/pages/performance/Timeline.d.ts.map +1 -0
- package/dist/inspector/pages/performance/helpers.d.ts +5 -0
- package/dist/inspector/pages/performance/helpers.d.ts.map +1 -0
- package/dist/inspector/pages/performance/index.d.ts +3 -0
- package/dist/inspector/pages/performance/index.d.ts.map +1 -0
- package/dist/inspector/pages/performance/types.d.ts +13 -0
- package/dist/inspector/pages/performance/types.d.ts.map +1 -0
- package/dist/inspector/pages/performance/usePerformanceEntries.d.ts +3 -0
- package/dist/inspector/pages/performance/usePerformanceEntries.d.ts.map +1 -0
- package/dist/inspector/register-custom-element.js +3 -1
- package/dist/inspector/register-custom-element.js.map +1 -1
- package/dist/inspector/standalone.js +1 -1
- package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/PerformancePage.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/SubscriptionDetailPanel.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/SubscriptionRow.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/Timeline.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/Timeline.test.d.ts.map +1 -0
- package/dist/inspector/tests/pages/performance/helpers.test.d.ts +2 -0
- package/dist/inspector/tests/pages/performance/helpers.test.d.ts.map +1 -0
- package/dist/inspector/viewer/delete-local-data.d.ts.map +1 -1
- package/dist/inspector/viewer/header.d.ts +4 -2
- package/dist/inspector/viewer/header.d.ts.map +1 -1
- package/dist/inspector/viewer/page-stack.d.ts +3 -1
- package/dist/inspector/viewer/page-stack.d.ts.map +1 -1
- package/dist/react-core/hooks.d.ts +2 -2
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +50 -18
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-core/subscription-provider.d.ts.map +1 -1
- package/dist/react-native-core/media/image.d.ts +1 -1
- package/dist/svelte/jazz.class.svelte.d.ts.map +1 -1
- package/dist/svelte/jazz.class.svelte.js +27 -22
- package/dist/testing.js +2 -2
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/exports.d.ts +1 -1
- package/dist/tools/exports.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +2 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +2 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +2 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.d.ts +3 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +3 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +2 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +6 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/ssr.js +1 -1
- package/dist/tools/subscribe/SubscriptionCache.d.ts +2 -2
- package/dist/tools/subscribe/SubscriptionCache.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts +19 -12
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/tools/subscribe/errorReporting.d.ts +6 -0
- package/dist/tools/subscribe/errorReporting.d.ts.map +1 -1
- package/dist/tools/subscribe/index.d.ts +4 -4
- package/dist/tools/subscribe/index.d.ts.map +1 -1
- package/dist/tools/subscribe/types.d.ts +48 -3
- package/dist/tools/subscribe/types.d.ts.map +1 -1
- package/dist/tools/subscribe/utils.d.ts +1 -1
- package/dist/tools/subscribe/utils.d.ts.map +1 -1
- package/dist/tools/tests/SubscriptionScope.performance.test.d.ts +2 -0
- package/dist/tools/tests/SubscriptionScope.performance.test.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/inspector/in-app.tsx +41 -3
- package/src/inspector/index.tsx +5 -1
- package/src/inspector/pages/home.tsx +26 -3
- package/src/inspector/pages/performance/PerformancePage.tsx +215 -0
- package/src/inspector/pages/performance/SubscriptionDetailPanel.tsx +182 -0
- package/src/inspector/pages/performance/SubscriptionRow.tsx +242 -0
- package/src/inspector/pages/performance/Timeline.tsx +513 -0
- package/src/inspector/pages/performance/helpers.ts +70 -0
- package/src/inspector/pages/performance/index.ts +2 -0
- package/src/inspector/pages/performance/types.ts +12 -0
- package/src/inspector/pages/performance/usePerformanceEntries.ts +53 -0
- package/src/inspector/register-custom-element.ts +3 -0
- package/src/inspector/tests/pages/performance/PerformancePage.test.tsx +83 -0
- package/src/inspector/tests/pages/performance/SubscriptionDetailPanel.test.tsx +68 -0
- package/src/inspector/tests/pages/performance/SubscriptionRow.test.tsx +93 -0
- package/src/inspector/tests/pages/performance/Timeline.test.tsx +57 -0
- package/src/inspector/tests/pages/performance/helpers.test.ts +91 -0
- package/src/inspector/viewer/delete-local-data.tsx +24 -5
- package/src/inspector/viewer/header.tsx +96 -17
- package/src/inspector/viewer/page-stack.tsx +22 -18
- package/src/react-core/hooks.ts +34 -4
- package/src/react-core/subscription-provider.tsx +17 -8
- package/src/svelte/jazz.class.svelte.ts +51 -33
- package/src/tools/coValues/coList.ts +73 -37
- package/src/tools/coValues/interfaces.ts +3 -0
- package/src/tools/exports.ts +1 -0
- package/src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts +13 -0
- package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +0 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +5 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +5 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +5 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.ts +6 -2
- package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +6 -2
- package/src/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +5 -2
- package/src/tools/implementation/zodSchema/schemaTypes/RichTextSchema.ts +9 -2
- package/src/tools/subscribe/SubscriptionCache.ts +6 -4
- package/src/tools/subscribe/SubscriptionScope.ts +141 -23
- package/src/tools/subscribe/errorReporting.ts +1 -1
- package/src/tools/subscribe/index.ts +1 -1
- package/src/tools/subscribe/types.ts +62 -9
- package/src/tools/subscribe/utils.ts +2 -2
- package/src/tools/tests/SubscriptionScope.performance.test.ts +149 -0
- package/src/tools/tests/coList.test.ts +262 -0
- package/src/tools/tests/schema.withPermissions.test.ts +27 -4
- package/dist/chunk-3CAPPS2F.js.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -10
- package/dist/inspector/chunk-MCTB5ZJC.js.map +0 -1
- package/dist/inspector/custom-element-5YWVZBWA.js.map +0 -1
- /package/dist/{chunk-PZ5AY32C.js.map → chunk-ZQWSQH6L.js.map} +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
__export
|
|
3
|
-
|
|
2
|
+
__export,
|
|
3
|
+
__privateAdd,
|
|
4
|
+
__privateGet,
|
|
5
|
+
__privateSet
|
|
6
|
+
} from "./chunk-ZQWSQH6L.js";
|
|
4
7
|
|
|
5
8
|
// src/tools/implementation/zodSchema/zodReExport.ts
|
|
6
9
|
var zodReExport_exports = {};
|
|
@@ -1279,7 +1282,7 @@ var CoListJazzApi = class extends CoValueJazzApi {
|
|
|
1279
1282
|
void 0,
|
|
1280
1283
|
"private"
|
|
1281
1284
|
);
|
|
1282
|
-
return this.raw.
|
|
1285
|
+
return this.raw.length();
|
|
1283
1286
|
}
|
|
1284
1287
|
/**
|
|
1285
1288
|
* Inserts new elements at the start of an array, and returns the new length of the array.
|
|
@@ -1295,7 +1298,7 @@ var CoListJazzApi = class extends CoValueJazzApi {
|
|
|
1295
1298
|
)) {
|
|
1296
1299
|
this.raw.prepend(item);
|
|
1297
1300
|
}
|
|
1298
|
-
return this.raw.
|
|
1301
|
+
return this.raw.length();
|
|
1299
1302
|
}
|
|
1300
1303
|
/**
|
|
1301
1304
|
* Removes the last element from an array and returns it.
|
|
@@ -1527,40 +1530,60 @@ function toRawItems(items, itemDescriptor, owner) {
|
|
|
1527
1530
|
}
|
|
1528
1531
|
return rawItems;
|
|
1529
1532
|
}
|
|
1533
|
+
function getCoListItemValue(target, key) {
|
|
1534
|
+
const rawValue = target.$jazz.raw.get(Number(key));
|
|
1535
|
+
if (rawValue === void 0) {
|
|
1536
|
+
return void 0;
|
|
1537
|
+
}
|
|
1538
|
+
const itemDescriptor = target.$jazz.schema[ItemsSym];
|
|
1539
|
+
if (itemDescriptor === "json") {
|
|
1540
|
+
return rawValue;
|
|
1541
|
+
} else if ("encoded" in itemDescriptor) {
|
|
1542
|
+
return itemDescriptor.encoded.decode(rawValue);
|
|
1543
|
+
} else if (isRefEncoded(itemDescriptor)) {
|
|
1544
|
+
if (rawValue === null) {
|
|
1545
|
+
return void 0;
|
|
1546
|
+
}
|
|
1547
|
+
return accessChildByKey(target, rawValue, key);
|
|
1548
|
+
}
|
|
1549
|
+
return void 0;
|
|
1550
|
+
}
|
|
1530
1551
|
var CoListProxyHandler = {
|
|
1531
1552
|
get(target, key, receiver) {
|
|
1532
|
-
if (typeof key === "
|
|
1533
|
-
const itemDescriptor = target.$jazz.schema[ItemsSym];
|
|
1534
|
-
const rawValue = target.$jazz.raw.get(Number(key));
|
|
1535
|
-
if (itemDescriptor === "json") {
|
|
1536
|
-
return rawValue;
|
|
1537
|
-
} else if ("encoded" in itemDescriptor) {
|
|
1538
|
-
return rawValue === void 0 ? void 0 : itemDescriptor.encoded.decode(rawValue);
|
|
1539
|
-
} else if (isRefEncoded(itemDescriptor)) {
|
|
1540
|
-
return rawValue === void 0 || rawValue === null ? void 0 : accessChildByKey(target, rawValue, key);
|
|
1541
|
-
}
|
|
1542
|
-
} else if (key === "length") {
|
|
1543
|
-
return target.$jazz.raw.entries().length;
|
|
1544
|
-
} else {
|
|
1553
|
+
if (typeof key === "symbol") {
|
|
1545
1554
|
return Reflect.get(target, key, receiver);
|
|
1546
1555
|
}
|
|
1556
|
+
if (!isNaN(+key)) {
|
|
1557
|
+
return getCoListItemValue(target, key);
|
|
1558
|
+
} else if (key === "length") {
|
|
1559
|
+
return target.$jazz.raw.length();
|
|
1560
|
+
}
|
|
1561
|
+
return Reflect.get(target, key, receiver);
|
|
1547
1562
|
},
|
|
1548
1563
|
set(target, key, value, receiver) {
|
|
1564
|
+
if (typeof key === "symbol") {
|
|
1565
|
+
return Reflect.set(target, key, value, receiver);
|
|
1566
|
+
}
|
|
1549
1567
|
if (key === ItemsSym && typeof value === "object" && SchemaInit in value) {
|
|
1550
|
-
target.constructor
|
|
1551
|
-
|
|
1568
|
+
const constructor = target.constructor;
|
|
1569
|
+
if (!constructor._schema) {
|
|
1570
|
+
constructor._schema = {};
|
|
1571
|
+
}
|
|
1572
|
+
constructor._schema[ItemsSym] = value[SchemaInit];
|
|
1552
1573
|
return true;
|
|
1553
1574
|
}
|
|
1554
|
-
if (
|
|
1575
|
+
if (!isNaN(+key)) {
|
|
1555
1576
|
throw Error("Cannot update a CoList directly. Use `$jazz.set` instead.");
|
|
1556
|
-
} else {
|
|
1557
|
-
return Reflect.set(target, key, value, receiver);
|
|
1558
1577
|
}
|
|
1578
|
+
return Reflect.set(target, key, value, receiver);
|
|
1559
1579
|
},
|
|
1560
1580
|
defineProperty(target, key, descriptor) {
|
|
1561
1581
|
if (descriptor.value && key === ItemsSym && typeof descriptor.value === "object" && SchemaInit in descriptor.value) {
|
|
1562
|
-
target.constructor
|
|
1563
|
-
|
|
1582
|
+
const constructor = target.constructor;
|
|
1583
|
+
if (!constructor._schema) {
|
|
1584
|
+
constructor._schema = {};
|
|
1585
|
+
}
|
|
1586
|
+
constructor._schema[ItemsSym] = descriptor.value[SchemaInit];
|
|
1564
1587
|
return true;
|
|
1565
1588
|
} else {
|
|
1566
1589
|
return Reflect.defineProperty(target, key, descriptor);
|
|
@@ -1568,18 +1591,23 @@ var CoListProxyHandler = {
|
|
|
1568
1591
|
},
|
|
1569
1592
|
has(target, key) {
|
|
1570
1593
|
if (typeof key === "string" && !isNaN(+key)) {
|
|
1571
|
-
return Number(key) < target.$jazz.raw.
|
|
1594
|
+
return Number(key) < target.$jazz.raw.length();
|
|
1572
1595
|
} else {
|
|
1573
1596
|
return Reflect.has(target, key);
|
|
1574
1597
|
}
|
|
1575
1598
|
},
|
|
1576
1599
|
ownKeys(target) {
|
|
1577
1600
|
const keys = Reflect.ownKeys(target);
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1601
|
+
const length = target.$jazz.raw.length();
|
|
1602
|
+
for (let i = 0; i < length; i++) {
|
|
1603
|
+
keys.push(String(i));
|
|
1604
|
+
}
|
|
1580
1605
|
return keys;
|
|
1581
1606
|
},
|
|
1582
1607
|
getOwnPropertyDescriptor(target, key) {
|
|
1608
|
+
if (typeof key === "symbol") {
|
|
1609
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
|
1610
|
+
}
|
|
1583
1611
|
if (key === TypeSym) {
|
|
1584
1612
|
return {
|
|
1585
1613
|
enumerable: false,
|
|
@@ -1587,24 +1615,26 @@ var CoListProxyHandler = {
|
|
|
1587
1615
|
writable: false,
|
|
1588
1616
|
value: target[TypeSym]
|
|
1589
1617
|
};
|
|
1590
|
-
} else if (key
|
|
1591
|
-
return Reflect.getOwnPropertyDescriptor(target, key);
|
|
1592
|
-
} else if (typeof key === "string" && !isNaN(+key)) {
|
|
1618
|
+
} else if (!isNaN(+key)) {
|
|
1593
1619
|
const index = Number(key);
|
|
1594
|
-
if (index >= 0 && index < target.$jazz.raw.
|
|
1620
|
+
if (index >= 0 && index < target.$jazz.raw.length()) {
|
|
1595
1621
|
return {
|
|
1596
1622
|
enumerable: true,
|
|
1597
1623
|
configurable: true,
|
|
1598
|
-
writable:
|
|
1624
|
+
writable: false,
|
|
1625
|
+
value: getCoListItemValue(target, key)
|
|
1599
1626
|
};
|
|
1600
1627
|
}
|
|
1601
1628
|
} else if (key === "length") {
|
|
1602
1629
|
return {
|
|
1603
1630
|
enumerable: false,
|
|
1604
1631
|
configurable: false,
|
|
1605
|
-
writable:
|
|
1632
|
+
writable: true,
|
|
1633
|
+
// Must be writable, otherwise JS complains
|
|
1634
|
+
value: target.$jazz.raw.length()
|
|
1606
1635
|
};
|
|
1607
1636
|
}
|
|
1637
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
|
1608
1638
|
}
|
|
1609
1639
|
};
|
|
1610
1640
|
|
|
@@ -2383,17 +2413,17 @@ var _Account = class _Account extends CoValueBase {
|
|
|
2383
2413
|
* @deprecated Use `co.account(...).createAs` instead.
|
|
2384
2414
|
*/
|
|
2385
2415
|
static async createAs(worker, options) {
|
|
2386
|
-
const
|
|
2416
|
+
const crypto2 = worker.$jazz.localNode.crypto;
|
|
2387
2417
|
const connectedPeers = cojsonInternals2.connectedPeers(
|
|
2388
2418
|
"creatingAccount",
|
|
2389
|
-
|
|
2419
|
+
crypto2.uniquenessForHeader(),
|
|
2390
2420
|
// Use a unique id for the client peer, so we don't have clashes in the worker node
|
|
2391
2421
|
{ peer1role: "server", peer2role: "client" }
|
|
2392
2422
|
);
|
|
2393
2423
|
worker.$jazz.localNode.syncManager.addPeer(connectedPeers[1]);
|
|
2394
2424
|
const account = await this.create({
|
|
2395
2425
|
creationProps: options.creationProps,
|
|
2396
|
-
crypto,
|
|
2426
|
+
crypto: crypto2,
|
|
2397
2427
|
peers: [connectedPeers[0]]
|
|
2398
2428
|
});
|
|
2399
2429
|
const credentials = {
|
|
@@ -4302,7 +4332,7 @@ function isEqualRefsToResolve(a, b) {
|
|
|
4302
4332
|
}
|
|
4303
4333
|
|
|
4304
4334
|
// src/tools/subscribe/SubscriptionScope.ts
|
|
4305
|
-
var
|
|
4335
|
+
var _SubscriptionScope = class _SubscriptionScope {
|
|
4306
4336
|
constructor(node, resolve, id, schema, skipRetry = false, bestEffortResolution = false, unstable_branch, callerStack) {
|
|
4307
4337
|
this.node = node;
|
|
4308
4338
|
this.id = id;
|
|
@@ -4366,6 +4396,93 @@ var SubscriptionScope = class _SubscriptionScope {
|
|
|
4366
4396
|
this.unstable_branch
|
|
4367
4397
|
);
|
|
4368
4398
|
}
|
|
4399
|
+
static setProfilingEnabled(enabled) {
|
|
4400
|
+
this.isProfilingEnabled = enabled;
|
|
4401
|
+
}
|
|
4402
|
+
static enableProfiling() {
|
|
4403
|
+
this.isProfilingEnabled = true;
|
|
4404
|
+
}
|
|
4405
|
+
trackLoadingPerformance(source) {
|
|
4406
|
+
if (!_SubscriptionScope.isProfilingEnabled) {
|
|
4407
|
+
return;
|
|
4408
|
+
}
|
|
4409
|
+
if (this.performanceUuid) {
|
|
4410
|
+
return;
|
|
4411
|
+
}
|
|
4412
|
+
const currentState = this.getCurrentRawValue();
|
|
4413
|
+
this.performanceUuid = crypto.randomUUID();
|
|
4414
|
+
this.performanceSource = source;
|
|
4415
|
+
const detail = {
|
|
4416
|
+
type: "jazz-subscription",
|
|
4417
|
+
uuid: this.performanceUuid,
|
|
4418
|
+
id: this.id,
|
|
4419
|
+
source,
|
|
4420
|
+
resolve: this.resolve,
|
|
4421
|
+
status: "pending",
|
|
4422
|
+
startTime: performance.now(),
|
|
4423
|
+
callerStack: this.callerStack?.stack
|
|
4424
|
+
};
|
|
4425
|
+
performance.mark(`jazz.subscription.start:${this.performanceUuid}`, {
|
|
4426
|
+
detail
|
|
4427
|
+
});
|
|
4428
|
+
if (currentState !== CoValueLoadingState.LOADING) {
|
|
4429
|
+
this.emitLoadingComplete(currentState);
|
|
4430
|
+
return;
|
|
4431
|
+
}
|
|
4432
|
+
const unsubscribe = this.subscribe(() => {
|
|
4433
|
+
const rawValue = this.getCurrentRawValue();
|
|
4434
|
+
if (rawValue === CoValueLoadingState.LOADING) {
|
|
4435
|
+
return;
|
|
4436
|
+
}
|
|
4437
|
+
this.emitLoadingComplete(rawValue);
|
|
4438
|
+
unsubscribe();
|
|
4439
|
+
});
|
|
4440
|
+
}
|
|
4441
|
+
emitLoadingComplete(rawValue) {
|
|
4442
|
+
if (!this.performanceUuid) return;
|
|
4443
|
+
const isError = typeof rawValue === "string";
|
|
4444
|
+
const endTime = performance.now();
|
|
4445
|
+
let errorType;
|
|
4446
|
+
if (isError) {
|
|
4447
|
+
if (rawValue === CoValueLoadingState.UNAVAILABLE || rawValue === CoValueLoadingState.UNAUTHORIZED || rawValue === CoValueLoadingState.DELETED) {
|
|
4448
|
+
errorType = rawValue;
|
|
4449
|
+
}
|
|
4450
|
+
}
|
|
4451
|
+
const detail = {
|
|
4452
|
+
type: "jazz-subscription",
|
|
4453
|
+
uuid: this.performanceUuid,
|
|
4454
|
+
id: this.id,
|
|
4455
|
+
source: this.performanceSource ?? "unknown",
|
|
4456
|
+
resolve: this.resolve,
|
|
4457
|
+
status: isError ? "error" : "loaded",
|
|
4458
|
+
startTime: 0,
|
|
4459
|
+
// Will be calculated from measure
|
|
4460
|
+
endTime,
|
|
4461
|
+
errorType,
|
|
4462
|
+
devtools: {
|
|
4463
|
+
track: "Jazz \u{1F3B6}",
|
|
4464
|
+
properties: [
|
|
4465
|
+
["id", this.id],
|
|
4466
|
+
["source", this.performanceSource ?? "unknown"]
|
|
4467
|
+
],
|
|
4468
|
+
tooltipText: this.getCreationStackLines(false)
|
|
4469
|
+
}
|
|
4470
|
+
};
|
|
4471
|
+
performance.mark(`jazz.subscription.end:${this.performanceUuid}`, {
|
|
4472
|
+
detail
|
|
4473
|
+
});
|
|
4474
|
+
try {
|
|
4475
|
+
performance.measure(
|
|
4476
|
+
`${detail.source}(${this.id}, ${JSON.stringify(this.resolve)})`,
|
|
4477
|
+
{
|
|
4478
|
+
start: `jazz.subscription.start:${this.performanceUuid}`,
|
|
4479
|
+
end: `jazz.subscription.end:${this.performanceUuid}`,
|
|
4480
|
+
detail
|
|
4481
|
+
}
|
|
4482
|
+
);
|
|
4483
|
+
} catch {
|
|
4484
|
+
}
|
|
4485
|
+
}
|
|
4369
4486
|
updateValue(value) {
|
|
4370
4487
|
this.value = value;
|
|
4371
4488
|
this.dirty = true;
|
|
@@ -4597,7 +4714,7 @@ var SubscriptionScope = class _SubscriptionScope {
|
|
|
4597
4714
|
}
|
|
4598
4715
|
return CoValueLoadingState.LOADING;
|
|
4599
4716
|
}
|
|
4600
|
-
getCreationStackLines() {
|
|
4717
|
+
getCreationStackLines(fullFrame = true) {
|
|
4601
4718
|
const stack = this.callerStack?.stack;
|
|
4602
4719
|
if (!stack) {
|
|
4603
4720
|
return "";
|
|
@@ -4610,6 +4727,9 @@ var SubscriptionScope = class _SubscriptionScope {
|
|
|
4610
4727
|
if (creationAppFrame) {
|
|
4611
4728
|
result += "Subscription created ", result += creationAppFrame.trim();
|
|
4612
4729
|
}
|
|
4730
|
+
if (!fullFrame) {
|
|
4731
|
+
return result;
|
|
4732
|
+
}
|
|
4613
4733
|
result += "\nFull subscription creation stack:";
|
|
4614
4734
|
for (const line of creationStackLines.slice(0, 8)) {
|
|
4615
4735
|
result += "\n " + line.trim();
|
|
@@ -4964,6 +5084,8 @@ var SubscriptionScope = class _SubscriptionScope {
|
|
|
4964
5084
|
this.childNodes.forEach((child) => child.destroy());
|
|
4965
5085
|
}
|
|
4966
5086
|
};
|
|
5087
|
+
_SubscriptionScope.isProfilingEnabled = isDev;
|
|
5088
|
+
var SubscriptionScope = _SubscriptionScope;
|
|
4967
5089
|
function hasAccessToCoValue(rawCoValue) {
|
|
4968
5090
|
const ruleset = rawCoValue.core.verified.header.ruleset;
|
|
4969
5091
|
return ruleset.type !== "ownedByGroup" || myRoleForRawValue(rawCoValue) !== void 0;
|
|
@@ -5030,9 +5152,9 @@ import {
|
|
|
5030
5152
|
LocalNode as LocalNode5
|
|
5031
5153
|
} from "cojson";
|
|
5032
5154
|
var MockSessionProvider = class {
|
|
5033
|
-
async acquireSession(accountID,
|
|
5155
|
+
async acquireSession(accountID, crypto2) {
|
|
5034
5156
|
return {
|
|
5035
|
-
sessionID:
|
|
5157
|
+
sessionID: crypto2.newRandomSessionID(
|
|
5036
5158
|
accountID
|
|
5037
5159
|
),
|
|
5038
5160
|
sessionDone: () => {
|
|
@@ -5050,7 +5172,7 @@ async function createJazzContextFromExistingCredentials({
|
|
|
5050
5172
|
credentials,
|
|
5051
5173
|
peers,
|
|
5052
5174
|
syncWhen,
|
|
5053
|
-
crypto,
|
|
5175
|
+
crypto: crypto2,
|
|
5054
5176
|
storage,
|
|
5055
5177
|
AccountSchema: PropsAccountSchema,
|
|
5056
5178
|
sessionProvider,
|
|
@@ -5059,7 +5181,7 @@ async function createJazzContextFromExistingCredentials({
|
|
|
5059
5181
|
}) {
|
|
5060
5182
|
const { sessionID, sessionDone } = await sessionProvider.acquireSession(
|
|
5061
5183
|
credentials.accountID,
|
|
5062
|
-
|
|
5184
|
+
crypto2
|
|
5063
5185
|
);
|
|
5064
5186
|
const CurrentAccountSchema = PropsAccountSchema ?? RegisteredSchemas["Account"];
|
|
5065
5187
|
const AccountClass = coValueClassFromCoValueClassOrSchema(CurrentAccountSchema);
|
|
@@ -5069,7 +5191,7 @@ async function createJazzContextFromExistingCredentials({
|
|
|
5069
5191
|
sessionID,
|
|
5070
5192
|
peers,
|
|
5071
5193
|
syncWhen,
|
|
5072
|
-
crypto,
|
|
5194
|
+
crypto: crypto2,
|
|
5073
5195
|
storage,
|
|
5074
5196
|
migration: async (rawAccount, _node, creationProps) => {
|
|
5075
5197
|
const account2 = AccountClass.fromRaw(rawAccount);
|
|
@@ -5102,7 +5224,7 @@ async function createJazzContextForNewAccount({
|
|
|
5102
5224
|
initialAgentSecret,
|
|
5103
5225
|
peers,
|
|
5104
5226
|
syncWhen,
|
|
5105
|
-
crypto,
|
|
5227
|
+
crypto: crypto2,
|
|
5106
5228
|
AccountSchema: PropsAccountSchema,
|
|
5107
5229
|
onLogOut,
|
|
5108
5230
|
storage,
|
|
@@ -5114,7 +5236,7 @@ async function createJazzContextForNewAccount({
|
|
|
5114
5236
|
creationProps,
|
|
5115
5237
|
peers,
|
|
5116
5238
|
syncWhen,
|
|
5117
|
-
crypto,
|
|
5239
|
+
crypto: crypto2,
|
|
5118
5240
|
initialAgentSecret,
|
|
5119
5241
|
storage,
|
|
5120
5242
|
migration: async (rawAccount, _node, creationProps2) => {
|
|
@@ -5143,7 +5265,7 @@ async function createJazzContextForNewAccount({
|
|
|
5143
5265
|
};
|
|
5144
5266
|
}
|
|
5145
5267
|
async function createJazzContext(options) {
|
|
5146
|
-
const
|
|
5268
|
+
const crypto2 = options.crypto;
|
|
5147
5269
|
let context;
|
|
5148
5270
|
const authSecretStorage = options.authSecretStorage;
|
|
5149
5271
|
await authSecretStorage.migrate();
|
|
@@ -5159,7 +5281,7 @@ async function createJazzContext(options) {
|
|
|
5159
5281
|
},
|
|
5160
5282
|
peers: options.peers,
|
|
5161
5283
|
syncWhen: options.syncWhen,
|
|
5162
|
-
crypto,
|
|
5284
|
+
crypto: crypto2,
|
|
5163
5285
|
AccountSchema: options.AccountSchema,
|
|
5164
5286
|
sessionProvider: options.sessionProvider,
|
|
5165
5287
|
onLogOut: async () => {
|
|
@@ -5170,7 +5292,7 @@ async function createJazzContext(options) {
|
|
|
5170
5292
|
});
|
|
5171
5293
|
} else {
|
|
5172
5294
|
const secretSeed = options.crypto.newRandomSecretSeed();
|
|
5173
|
-
const initialAgentSecret = options.newAccountProps?.secret ??
|
|
5295
|
+
const initialAgentSecret = options.newAccountProps?.secret ?? crypto2.agentSecretFromSecretSeed(secretSeed);
|
|
5174
5296
|
const creationProps = options.newAccountProps?.creationProps ?? {
|
|
5175
5297
|
name: options.defaultProfileName ?? "Anonymous user"
|
|
5176
5298
|
};
|
|
@@ -5179,7 +5301,7 @@ async function createJazzContext(options) {
|
|
|
5179
5301
|
initialAgentSecret,
|
|
5180
5302
|
peers: options.peers,
|
|
5181
5303
|
syncWhen: options.syncWhen,
|
|
5182
|
-
crypto,
|
|
5304
|
+
crypto: crypto2,
|
|
5183
5305
|
AccountSchema: options.AccountSchema,
|
|
5184
5306
|
sessionProvider: options.sessionProvider,
|
|
5185
5307
|
onLogOut: async () => {
|
|
@@ -5204,14 +5326,14 @@ async function createJazzContext(options) {
|
|
|
5204
5326
|
function createAnonymousJazzContext({
|
|
5205
5327
|
peers,
|
|
5206
5328
|
syncWhen,
|
|
5207
|
-
crypto,
|
|
5329
|
+
crypto: crypto2,
|
|
5208
5330
|
storage
|
|
5209
5331
|
}) {
|
|
5210
|
-
const agentSecret =
|
|
5332
|
+
const agentSecret = crypto2.newRandomAgentSecret();
|
|
5211
5333
|
const node = new LocalNode5(
|
|
5212
5334
|
agentSecret,
|
|
5213
|
-
|
|
5214
|
-
|
|
5335
|
+
crypto2.newRandomSessionID(crypto2.getAgentID(agentSecret)),
|
|
5336
|
+
crypto2,
|
|
5215
5337
|
syncWhen
|
|
5216
5338
|
);
|
|
5217
5339
|
for (const peer of peers) {
|
|
@@ -5412,13 +5534,21 @@ function createCoreCoRichTextSchema() {
|
|
|
5412
5534
|
resolveQuery: true
|
|
5413
5535
|
};
|
|
5414
5536
|
}
|
|
5415
|
-
var
|
|
5537
|
+
var _permissions;
|
|
5538
|
+
var _RichTextSchema = class _RichTextSchema {
|
|
5416
5539
|
constructor(coValueClass) {
|
|
5417
5540
|
this.coValueClass = coValueClass;
|
|
5418
5541
|
this.collaborative = true;
|
|
5419
5542
|
this.builtin = "CoRichText";
|
|
5420
5543
|
this.resolveQuery = true;
|
|
5421
|
-
this
|
|
5544
|
+
__privateAdd(this, _permissions, null);
|
|
5545
|
+
}
|
|
5546
|
+
/**
|
|
5547
|
+
* Permissions to be used when creating or composing CoValues
|
|
5548
|
+
* @internal
|
|
5549
|
+
*/
|
|
5550
|
+
get permissions() {
|
|
5551
|
+
return __privateGet(this, _permissions) ?? DEFAULT_SCHEMA_PERMISSIONS;
|
|
5422
5552
|
}
|
|
5423
5553
|
create(text, options) {
|
|
5424
5554
|
const optionsWithPermissions = withSchemaPermissions(
|
|
@@ -5447,10 +5577,12 @@ var RichTextSchema = class _RichTextSchema {
|
|
|
5447
5577
|
*/
|
|
5448
5578
|
withPermissions(permissions) {
|
|
5449
5579
|
const copy = new _RichTextSchema(this.coValueClass);
|
|
5450
|
-
copy
|
|
5580
|
+
__privateSet(copy, _permissions, permissions);
|
|
5451
5581
|
return copy;
|
|
5452
5582
|
}
|
|
5453
5583
|
};
|
|
5584
|
+
_permissions = new WeakMap();
|
|
5585
|
+
var RichTextSchema = _RichTextSchema;
|
|
5454
5586
|
|
|
5455
5587
|
// src/tools/implementation/zodSchema/schemaTypes/GroupSchema.ts
|
|
5456
5588
|
function createCoreGroupSchema() {
|
|
@@ -5624,6 +5756,7 @@ __export(coExport_exports, {
|
|
|
5624
5756
|
});
|
|
5625
5757
|
|
|
5626
5758
|
// src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts
|
|
5759
|
+
var _permissions2;
|
|
5627
5760
|
var CoMapSchema = class {
|
|
5628
5761
|
constructor(coreSchema, coValueClass) {
|
|
5629
5762
|
this.coValueClass = coValueClass;
|
|
@@ -5635,15 +5768,18 @@ var CoMapSchema = class {
|
|
|
5635
5768
|
* @default true
|
|
5636
5769
|
*/
|
|
5637
5770
|
this.resolveQuery = true;
|
|
5638
|
-
|
|
5639
|
-
* Permissions to be used when creating or composing CoValues
|
|
5640
|
-
* @internal
|
|
5641
|
-
*/
|
|
5642
|
-
this.permissions = DEFAULT_SCHEMA_PERMISSIONS;
|
|
5771
|
+
__privateAdd(this, _permissions2, null);
|
|
5643
5772
|
this.shape = coreSchema.shape;
|
|
5644
5773
|
this.catchAll = coreSchema.catchAll;
|
|
5645
5774
|
this.getDefinition = coreSchema.getDefinition;
|
|
5646
5775
|
}
|
|
5776
|
+
/**
|
|
5777
|
+
* Permissions to be used when creating or composing CoValues
|
|
5778
|
+
* @internal
|
|
5779
|
+
*/
|
|
5780
|
+
get permissions() {
|
|
5781
|
+
return __privateGet(this, _permissions2) ?? DEFAULT_SCHEMA_PERMISSIONS;
|
|
5782
|
+
}
|
|
5647
5783
|
create(init, options) {
|
|
5648
5784
|
const optionsWithPermissions = withSchemaPermissions(
|
|
5649
5785
|
options,
|
|
@@ -5797,10 +5933,11 @@ var CoMapSchema = class {
|
|
|
5797
5933
|
const copy = hydrateCoreCoValueSchema(coreSchema);
|
|
5798
5934
|
copy.coValueClass.prototype.migrate = this.coValueClass.prototype.migrate;
|
|
5799
5935
|
copy.resolveQuery = resolveQuery ?? this.resolveQuery;
|
|
5800
|
-
copy
|
|
5936
|
+
__privateSet(copy, _permissions2, permissions ?? __privateGet(this, _permissions2));
|
|
5801
5937
|
return copy;
|
|
5802
5938
|
}
|
|
5803
5939
|
};
|
|
5940
|
+
_permissions2 = new WeakMap();
|
|
5804
5941
|
function createCoreCoMapSchema(shape, catchAll) {
|
|
5805
5942
|
return {
|
|
5806
5943
|
collaborative: true,
|
|
@@ -5834,6 +5971,7 @@ function createCoreCoMapSchema(shape, catchAll) {
|
|
|
5834
5971
|
}
|
|
5835
5972
|
|
|
5836
5973
|
// src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts
|
|
5974
|
+
var _permissions3;
|
|
5837
5975
|
var CoListSchema = class {
|
|
5838
5976
|
constructor(element, coValueClass) {
|
|
5839
5977
|
this.element = element;
|
|
@@ -5846,11 +5984,14 @@ var CoListSchema = class {
|
|
|
5846
5984
|
* @default true
|
|
5847
5985
|
*/
|
|
5848
5986
|
this.resolveQuery = true;
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5987
|
+
__privateAdd(this, _permissions3, null);
|
|
5988
|
+
}
|
|
5989
|
+
/**
|
|
5990
|
+
* Permissions to be used when creating or composing CoValues
|
|
5991
|
+
* @internal
|
|
5992
|
+
*/
|
|
5993
|
+
get permissions() {
|
|
5994
|
+
return __privateGet(this, _permissions3) ?? DEFAULT_SCHEMA_PERMISSIONS;
|
|
5854
5995
|
}
|
|
5855
5996
|
create(items, options) {
|
|
5856
5997
|
const optionsWithPermissions = withSchemaPermissions(
|
|
@@ -5936,10 +6077,11 @@ var CoListSchema = class {
|
|
|
5936
6077
|
const coreSchema = createCoreCoListSchema(this.element);
|
|
5937
6078
|
const copy = hydrateCoreCoValueSchema(coreSchema);
|
|
5938
6079
|
copy.resolveQuery = resolveQuery ?? this.resolveQuery;
|
|
5939
|
-
copy
|
|
6080
|
+
__privateSet(copy, _permissions3, permissions ?? __privateGet(this, _permissions3));
|
|
5940
6081
|
return copy;
|
|
5941
6082
|
}
|
|
5942
6083
|
};
|
|
6084
|
+
_permissions3 = new WeakMap();
|
|
5943
6085
|
function createCoreCoListSchema(element) {
|
|
5944
6086
|
return {
|
|
5945
6087
|
collaborative: true,
|
|
@@ -5950,6 +6092,7 @@ function createCoreCoListSchema(element) {
|
|
|
5950
6092
|
}
|
|
5951
6093
|
|
|
5952
6094
|
// src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts
|
|
6095
|
+
var _permissions4;
|
|
5953
6096
|
var CoFeedSchema = class {
|
|
5954
6097
|
constructor(element, coValueClass) {
|
|
5955
6098
|
this.element = element;
|
|
@@ -5962,11 +6105,14 @@ var CoFeedSchema = class {
|
|
|
5962
6105
|
* @default true
|
|
5963
6106
|
*/
|
|
5964
6107
|
this.resolveQuery = true;
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
6108
|
+
__privateAdd(this, _permissions4, null);
|
|
6109
|
+
}
|
|
6110
|
+
/**
|
|
6111
|
+
* Permissions to be used when creating or composing CoValues
|
|
6112
|
+
* @internal
|
|
6113
|
+
*/
|
|
6114
|
+
get permissions() {
|
|
6115
|
+
return __privateGet(this, _permissions4) ?? DEFAULT_SCHEMA_PERMISSIONS;
|
|
5970
6116
|
}
|
|
5971
6117
|
create(init, options) {
|
|
5972
6118
|
const optionsWithPermissions = withSchemaPermissions(
|
|
@@ -6034,10 +6180,11 @@ var CoFeedSchema = class {
|
|
|
6034
6180
|
const coreSchema = createCoreCoFeedSchema(this.element);
|
|
6035
6181
|
const copy = hydrateCoreCoValueSchema(coreSchema);
|
|
6036
6182
|
copy.resolveQuery = resolveQuery ?? this.resolveQuery;
|
|
6037
|
-
copy
|
|
6183
|
+
__privateSet(copy, _permissions4, permissions ?? __privateGet(this, _permissions4));
|
|
6038
6184
|
return copy;
|
|
6039
6185
|
}
|
|
6040
6186
|
};
|
|
6187
|
+
_permissions4 = new WeakMap();
|
|
6041
6188
|
function createCoreCoFeedSchema(element) {
|
|
6042
6189
|
return {
|
|
6043
6190
|
collaborative: true,
|
|
@@ -6055,17 +6202,21 @@ function createCoreCoPlainTextSchema() {
|
|
|
6055
6202
|
resolveQuery: true
|
|
6056
6203
|
};
|
|
6057
6204
|
}
|
|
6058
|
-
var
|
|
6205
|
+
var _permissions5;
|
|
6206
|
+
var _PlainTextSchema = class _PlainTextSchema {
|
|
6059
6207
|
constructor(coValueClass) {
|
|
6060
6208
|
this.coValueClass = coValueClass;
|
|
6061
6209
|
this.collaborative = true;
|
|
6062
6210
|
this.builtin = "CoPlainText";
|
|
6063
6211
|
this.resolveQuery = true;
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6212
|
+
__privateAdd(this, _permissions5, null);
|
|
6213
|
+
}
|
|
6214
|
+
/**
|
|
6215
|
+
* Permissions to be used when creating or composing CoValues
|
|
6216
|
+
* @internal
|
|
6217
|
+
*/
|
|
6218
|
+
get permissions() {
|
|
6219
|
+
return __privateGet(this, _permissions5) ?? DEFAULT_SCHEMA_PERMISSIONS;
|
|
6069
6220
|
}
|
|
6070
6221
|
create(text, options) {
|
|
6071
6222
|
const optionsWithPermissions = withSchemaPermissions(
|
|
@@ -6097,10 +6248,12 @@ var PlainTextSchema = class _PlainTextSchema {
|
|
|
6097
6248
|
*/
|
|
6098
6249
|
withPermissions(permissions) {
|
|
6099
6250
|
const copy = new _PlainTextSchema(this.coValueClass);
|
|
6100
|
-
copy
|
|
6251
|
+
__privateSet(copy, _permissions5, permissions);
|
|
6101
6252
|
return copy;
|
|
6102
6253
|
}
|
|
6103
6254
|
};
|
|
6255
|
+
_permissions5 = new WeakMap();
|
|
6256
|
+
var PlainTextSchema = _PlainTextSchema;
|
|
6104
6257
|
|
|
6105
6258
|
// src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts
|
|
6106
6259
|
function createCoreFileStreamSchema() {
|
|
@@ -6110,16 +6263,21 @@ function createCoreFileStreamSchema() {
|
|
|
6110
6263
|
resolveQuery: true
|
|
6111
6264
|
};
|
|
6112
6265
|
}
|
|
6113
|
-
var
|
|
6266
|
+
var _permissions6;
|
|
6267
|
+
var _FileStreamSchema = class _FileStreamSchema {
|
|
6114
6268
|
constructor(coValueClass) {
|
|
6115
6269
|
this.coValueClass = coValueClass;
|
|
6116
6270
|
this.collaborative = true;
|
|
6117
6271
|
this.builtin = "FileStream";
|
|
6118
6272
|
this.resolveQuery = true;
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6273
|
+
__privateAdd(this, _permissions6, null);
|
|
6274
|
+
}
|
|
6275
|
+
/**
|
|
6276
|
+
* Permissions to be used when creating or composing CoValues
|
|
6277
|
+
* @internal
|
|
6278
|
+
*/
|
|
6279
|
+
get permissions() {
|
|
6280
|
+
return __privateGet(this, _permissions6) ?? DEFAULT_SCHEMA_PERMISSIONS;
|
|
6123
6281
|
}
|
|
6124
6282
|
create(options) {
|
|
6125
6283
|
const optionsWithPermissions = withSchemaPermissions(
|
|
@@ -6170,10 +6328,12 @@ var FileStreamSchema = class _FileStreamSchema {
|
|
|
6170
6328
|
*/
|
|
6171
6329
|
withPermissions(permissions) {
|
|
6172
6330
|
const copy = new _FileStreamSchema(this.coValueClass);
|
|
6173
|
-
copy
|
|
6331
|
+
__privateSet(copy, _permissions6, permissions);
|
|
6174
6332
|
return copy;
|
|
6175
6333
|
}
|
|
6176
6334
|
};
|
|
6335
|
+
_permissions6 = new WeakMap();
|
|
6336
|
+
var FileStreamSchema = _FileStreamSchema;
|
|
6177
6337
|
|
|
6178
6338
|
// src/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.ts
|
|
6179
6339
|
function createCoreCoVectorSchema(dimensions) {
|
|
@@ -6184,17 +6344,22 @@ function createCoreCoVectorSchema(dimensions) {
|
|
|
6184
6344
|
resolveQuery: true
|
|
6185
6345
|
};
|
|
6186
6346
|
}
|
|
6187
|
-
var
|
|
6347
|
+
var _permissions7;
|
|
6348
|
+
var _CoVectorSchema = class _CoVectorSchema {
|
|
6188
6349
|
constructor(dimensions, coValueClass) {
|
|
6189
6350
|
this.dimensions = dimensions;
|
|
6190
6351
|
this.coValueClass = coValueClass;
|
|
6191
6352
|
this.collaborative = true;
|
|
6192
6353
|
this.builtin = "CoVector";
|
|
6193
6354
|
this.resolveQuery = true;
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6355
|
+
__privateAdd(this, _permissions7, null);
|
|
6356
|
+
}
|
|
6357
|
+
/**
|
|
6358
|
+
* Permissions to be used when creating or composing CoValues
|
|
6359
|
+
* @internal
|
|
6360
|
+
*/
|
|
6361
|
+
get permissions() {
|
|
6362
|
+
return __privateGet(this, _permissions7) ?? DEFAULT_SCHEMA_PERMISSIONS;
|
|
6198
6363
|
}
|
|
6199
6364
|
create(vector, options) {
|
|
6200
6365
|
const optionsWithPermissions = withSchemaPermissions(
|
|
@@ -6223,10 +6388,12 @@ var CoVectorSchema = class _CoVectorSchema {
|
|
|
6223
6388
|
*/
|
|
6224
6389
|
withPermissions(permissions) {
|
|
6225
6390
|
const copy = new _CoVectorSchema(this.dimensions, this.coValueClass);
|
|
6226
|
-
copy
|
|
6391
|
+
__privateSet(copy, _permissions7, permissions);
|
|
6227
6392
|
return copy;
|
|
6228
6393
|
}
|
|
6229
6394
|
};
|
|
6395
|
+
_permissions7 = new WeakMap();
|
|
6396
|
+
var CoVectorSchema = _CoVectorSchema;
|
|
6230
6397
|
|
|
6231
6398
|
// src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts
|
|
6232
6399
|
var AccountSchema = class _AccountSchema {
|
|
@@ -6699,6 +6866,13 @@ function discriminatedUnionFieldPermissions(schema) {
|
|
|
6699
6866
|
}
|
|
6700
6867
|
|
|
6701
6868
|
// src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts
|
|
6869
|
+
var isDev2 = function() {
|
|
6870
|
+
try {
|
|
6871
|
+
return process.env.NODE_ENV === "development";
|
|
6872
|
+
} catch {
|
|
6873
|
+
return false;
|
|
6874
|
+
}
|
|
6875
|
+
}();
|
|
6702
6876
|
function isAnyCoValueSchema2(schema) {
|
|
6703
6877
|
return typeof schema === "object" && schema !== null && "collaborative" in schema && schema.collaborative === true;
|
|
6704
6878
|
}
|
|
@@ -7096,7 +7270,6 @@ var SubscriptionCache = class {
|
|
|
7096
7270
|
};
|
|
7097
7271
|
const subscriptionScope = new SubscriptionScope(
|
|
7098
7272
|
node,
|
|
7099
|
-
// @ts-expect-error the SubscriptionScope is too generic for TS to infer its instances are CoValues
|
|
7100
7273
|
resolve,
|
|
7101
7274
|
id,
|
|
7102
7275
|
refEncoded,
|
|
@@ -7608,6 +7781,7 @@ function subscribeToCoValue(cls, id, options, listener) {
|
|
|
7608
7781
|
false,
|
|
7609
7782
|
options.unstable_branch
|
|
7610
7783
|
);
|
|
7784
|
+
rootNode.trackLoadingPerformance("subscribe");
|
|
7611
7785
|
const handleUpdate = () => {
|
|
7612
7786
|
if (unsubscribed) return;
|
|
7613
7787
|
const value = rootNode.getCurrentValue();
|
|
@@ -8010,4 +8184,4 @@ export {
|
|
|
8010
8184
|
JazzContextManager
|
|
8011
8185
|
};
|
|
8012
8186
|
/* istanbul ignore file -- @preserve */
|
|
8013
|
-
//# sourceMappingURL=chunk-
|
|
8187
|
+
//# sourceMappingURL=chunk-Q5RNSSUM.js.map
|