jazz-tools 0.17.4 → 0.17.6
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 +44 -44
- package/CHANGELOG.md +21 -0
- package/dist/{chunk-NPXI4XAS.js → chunk-SJHXI5AB.js} +103 -14
- package/dist/chunk-SJHXI5AB.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/media/{chunk-JBLT443O.js → chunk-E5J3WLQW.js} +2 -2
- package/dist/media/{chunk-JBLT443O.js.map → chunk-E5J3WLQW.js.map} +1 -1
- package/dist/media/index.browser.js +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/index.native.js +1 -1
- package/dist/media/utils.d.ts.map +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/testing.js +9 -1
- package/dist/testing.js.map +1 -1
- package/dist/tools/coValues/coList.d.ts +43 -1
- package/dist/tools/coValues/coList.d.ts.map +1 -1
- package/dist/tools/implementation/schema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +15 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +11 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
- package/dist/tools/testing.d.ts +9 -0
- package/dist/tools/testing.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/media/utils.test.ts +3 -2
- package/src/media/utils.ts +5 -1
- package/src/tools/coValues/coList.ts +124 -4
- package/src/tools/implementation/schema.ts +3 -1
- package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +44 -1
- package/src/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +25 -0
- package/src/tools/testing.ts +18 -0
- package/src/tools/tests/coList.test.ts +167 -0
- package/src/tools/tests/coMap.record.test.ts +104 -0
- package/src/tools/tests/coMap.test.ts +19 -1
- package/dist/chunk-NPXI4XAS.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.17.
|
2
|
+
> jazz-tools@0.17.6 build /home/runner/_work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup && pnpm types && pnpm build:svelte
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
|
@@ -100,84 +100,84 @@
|
|
100
100
|
[34mESM[39m Build start
|
101
101
|
[34mCLI[39m Cleaning output folder
|
102
102
|
[34mESM[39m Build start
|
103
|
-
[32mESM[39m [1mdist/worker/index.js [22m[32m2.31 KB[39m
|
104
|
-
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.77 KB[39m
|
105
|
-
[32mESM[39m ⚡️ Build success in 17ms
|
106
103
|
[32mESM[39m [1mdist/react/ssr.js [22m[32m688.00 B[39m
|
107
104
|
[32mESM[39m [1mdist/react/ssr.js.map [22m[32m1.12 KB[39m
|
108
|
-
[32mESM[39m ⚡️ Build success in
|
105
|
+
[32mESM[39m ⚡️ Build success in 17ms
|
109
106
|
[32mESM[39m [1mdist/tiptap/index.js [22m[32m564.00 B[39m
|
110
107
|
[32mESM[39m [1mdist/tiptap/index.js.map [22m[32m1.21 KB[39m
|
111
|
-
[32mESM[39m ⚡️ Build success in
|
112
|
-
[32mESM[39m [1mdist/
|
113
|
-
[32mESM[39m [1mdist/
|
114
|
-
[32mESM[39m
|
115
|
-
[32mESM[39m [1mdist/media/index.native.js [22m[32m3.53 KB[39m
|
116
|
-
[32mESM[39m [1mdist/media/index.js.map [22m[32m71.00 B[39m
|
117
|
-
[32mESM[39m [1mdist/media/index.browser.js.map [22m[32m6.02 KB[39m
|
118
|
-
[32mESM[39m [1mdist/media/chunk-JBLT443O.js.map [22m[32m15.68 KB[39m
|
119
|
-
[32mESM[39m [1mdist/media/index.native.js.map [22m[32m6.52 KB[39m
|
120
|
-
[32mESM[39m ⚡️ Build success in 22ms
|
121
|
-
[32mESM[39m [1mdist/browser/index.js [22m[32m13.43 KB[39m
|
122
|
-
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.65 KB[39m
|
123
|
-
[32mESM[39m ⚡️ Build success in 27ms
|
124
|
-
[32mESM[39m [1mdist/expo/index.js [22m[32m4.65 KB[39m
|
125
|
-
[32mESM[39m [1mdist/expo/crypto.js [22m[32m153.00 B[39m
|
126
|
-
[32mESM[39m [1mdist/expo/testing.js [22m[32m112.00 B[39m
|
127
|
-
[32mESM[39m [1mdist/expo/index.js.map [22m[32m10.17 KB[39m
|
128
|
-
[32mESM[39m [1mdist/expo/crypto.js.map [22m[32m189.00 B[39m
|
129
|
-
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
130
|
-
[32mESM[39m ⚡️ Build success in 27ms
|
108
|
+
[32mESM[39m ⚡️ Build success in 15ms
|
109
|
+
[32mESM[39m [1mdist/worker/index.js [22m[32m2.31 KB[39m
|
110
|
+
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.77 KB[39m
|
111
|
+
[32mESM[39m ⚡️ Build success in 16ms
|
131
112
|
[32mESM[39m [1mdist/react-core/index.js [22m[32m8.41 KB[39m
|
132
113
|
[32mESM[39m [1mdist/react-core/testing.js [22m[32m1.17 KB[39m
|
133
114
|
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js [22m[32m279.00 B[39m
|
134
|
-
[32mESM[39m [1mdist/react-core/index.js.map [22m[32m20.68 KB[39m
|
135
115
|
[32mESM[39m [1mdist/react-core/testing.js.map [22m[32m1.82 KB[39m
|
116
|
+
[32mESM[39m [1mdist/react-core/index.js.map [22m[32m20.68 KB[39m
|
136
117
|
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js.map [22m[32m533.00 B[39m
|
137
|
-
[32mESM[39m ⚡️ Build success in
|
118
|
+
[32mESM[39m ⚡️ Build success in 18ms
|
138
119
|
[32mESM[39m [1mdist/react-native/index.js [22m[32m2.53 KB[39m
|
139
120
|
[32mESM[39m [1mdist/react-native/testing.js [22m[32m120.00 B[39m
|
140
121
|
[32mESM[39m [1mdist/react-native/crypto.js [22m[32m161.00 B[39m
|
141
122
|
[32mESM[39m [1mdist/react-native/index.js.map [22m[32m5.68 KB[39m
|
142
123
|
[32mESM[39m [1mdist/react-native/testing.js.map [22m[32m176.00 B[39m
|
143
124
|
[32mESM[39m [1mdist/react-native/crypto.js.map [22m[32m197.00 B[39m
|
144
|
-
[32mESM[39m ⚡️ Build success in
|
145
|
-
[32mESM[39m [1mdist/
|
146
|
-
[32mESM[39m [1mdist/
|
147
|
-
[32mESM[39m [1mdist/
|
148
|
-
[32mESM[39m [1mdist/
|
149
|
-
[32mESM[39m
|
125
|
+
[32mESM[39m ⚡️ Build success in 20ms
|
126
|
+
[32mESM[39m [1mdist/expo/index.js [22m[32m4.65 KB[39m
|
127
|
+
[32mESM[39m [1mdist/expo/crypto.js [22m[32m153.00 B[39m
|
128
|
+
[32mESM[39m [1mdist/expo/testing.js [22m[32m112.00 B[39m
|
129
|
+
[32mESM[39m [1mdist/expo/index.js.map [22m[32m10.17 KB[39m
|
130
|
+
[32mESM[39m [1mdist/expo/crypto.js.map [22m[32m189.00 B[39m
|
131
|
+
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
132
|
+
[32mESM[39m ⚡️ Build success in 25ms
|
133
|
+
[32mESM[39m [1mdist/media/index.js [22m[32m236.00 B[39m
|
134
|
+
[32mESM[39m [1mdist/media/index.browser.js [22m[32m3.21 KB[39m
|
135
|
+
[32mESM[39m [1mdist/media/index.native.js [22m[32m3.53 KB[39m
|
136
|
+
[32mESM[39m [1mdist/media/chunk-E5J3WLQW.js [22m[32m6.34 KB[39m
|
137
|
+
[32mESM[39m [1mdist/media/index.js.map [22m[32m71.00 B[39m
|
138
|
+
[32mESM[39m [1mdist/media/index.browser.js.map [22m[32m6.02 KB[39m
|
139
|
+
[32mESM[39m [1mdist/media/index.native.js.map [22m[32m6.52 KB[39m
|
140
|
+
[32mESM[39m [1mdist/media/chunk-E5J3WLQW.js.map [22m[32m15.95 KB[39m
|
141
|
+
[32mESM[39m ⚡️ Build success in 32ms
|
142
|
+
[32mESM[39m [1mdist/browser/index.js [22m[32m13.43 KB[39m
|
143
|
+
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.65 KB[39m
|
144
|
+
[32mESM[39m ⚡️ Build success in 34ms
|
150
145
|
[32mESM[39m [1mdist/react-native-core/index.js [22m[32m17.90 KB[39m
|
151
146
|
[32mESM[39m [1mdist/react-native-core/testing.js [22m[32m119.00 B[39m
|
152
147
|
[32mESM[39m [1mdist/react-native-core/crypto.js [22m[32m2.10 KB[39m
|
153
148
|
[32mESM[39m [1mdist/react-native-core/index.js.map [22m[32m36.65 KB[39m
|
154
149
|
[32mESM[39m [1mdist/react-native-core/testing.js.map [22m[32m175.00 B[39m
|
155
150
|
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
156
|
-
[32mESM[39m ⚡️ Build success in
|
151
|
+
[32mESM[39m ⚡️ Build success in 49ms
|
152
|
+
[32mESM[39m [1mdist/react/index.js [22m[32m24.55 KB[39m
|
153
|
+
[32mESM[39m [1mdist/react/testing.js [22m[32m122.00 B[39m
|
154
|
+
[32mESM[39m [1mdist/react/testing.js.map [22m[32m165.00 B[39m
|
155
|
+
[32mESM[39m [1mdist/react/index.js.map [22m[32m52.68 KB[39m
|
156
|
+
[32mESM[39m ⚡️ Build success in 53ms
|
157
157
|
[32mESM[39m [1mdist/prosemirror/index.js [22m[32m76.90 KB[39m
|
158
158
|
[32mESM[39m [1mdist/prosemirror/index.js.map [22m[32m305.53 KB[39m
|
159
|
-
[32mESM[39m ⚡️ Build success in
|
159
|
+
[32mESM[39m ⚡️ Build success in 54ms
|
160
160
|
[32mESM[39m [1mdist/inspector/index.js [22m[32m60.40 KB[39m
|
161
161
|
[32mESM[39m [1mdist/inspector/index.js.map [22m[32m107.91 KB[39m
|
162
|
-
[32mESM[39m ⚡️ Build success in
|
162
|
+
[32mESM[39m ⚡️ Build success in 65ms
|
163
|
+
[32mESM[39m [1mdist/testing.js [22m[32m6.97 KB[39m
|
163
164
|
[32mESM[39m [1mdist/index.js [22m[32m25.96 KB[39m
|
164
|
-
[32mESM[39m [1mdist/
|
165
|
-
[32mESM[39m [1mdist/
|
166
|
-
[32mESM[39m [1mdist/testing.js.map [22m[32m13.07 KB[39m
|
165
|
+
[32mESM[39m [1mdist/chunk-SJHXI5AB.js [22m[32m153.63 KB[39m
|
166
|
+
[32mESM[39m [1mdist/testing.js.map [22m[32m13.65 KB[39m
|
167
167
|
[32mESM[39m [1mdist/index.js.map [22m[32m52.62 KB[39m
|
168
|
-
[32mESM[39m [1mdist/chunk-
|
169
|
-
[32mESM[39m ⚡️ Build success in
|
168
|
+
[32mESM[39m [1mdist/chunk-SJHXI5AB.js.map [22m[32m368.28 KB[39m
|
169
|
+
[32mESM[39m ⚡️ Build success in 84ms
|
170
170
|
[32mESM[39m [1mdist/inspector/register-custom-element.js [22m[32m218.00 B[39m
|
171
171
|
[32mESM[39m [1mdist/inspector/register-custom-element.js.map [22m[32m314.00 B[39m
|
172
172
|
[32mESM[39m [1mdist/inspector/custom-element-I7L56H6B.js [22m[32m1.53 MB[39m
|
173
173
|
[32mESM[39m [1mdist/inspector/custom-element-I7L56H6B.js.map [22m[32m2.35 MB[39m
|
174
|
-
[32mESM[39m ⚡️ Build success in
|
174
|
+
[32mESM[39m ⚡️ Build success in 119ms
|
175
175
|
|
176
|
-
> jazz-tools@0.17.
|
176
|
+
> jazz-tools@0.17.6 types /home/runner/_work/jazz/jazz/packages/jazz-tools
|
177
177
|
> tsc --outDir dist
|
178
178
|
|
179
179
|
|
180
|
-
> jazz-tools@0.17.
|
180
|
+
> jazz-tools@0.17.6 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
|
181
181
|
> rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
|
182
182
|
|
183
183
|
src/svelte -> dist/svelte
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.17.6
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 82de51c: allow creating CoValues from JSON without an active account
|
8
|
+
- 694b168: get resized image's id without triggering shallow load in `loadImageBySize`
|
9
|
+
- cojson@0.17.6
|
10
|
+
- cojson-storage-indexeddb@0.17.6
|
11
|
+
- cojson-transport-ws@0.17.6
|
12
|
+
|
13
|
+
## 0.17.5
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- 5963658: Implement/expose loadUnique and upsertUnique on co.list and co.record
|
18
|
+
- Updated dependencies [71c1411]
|
19
|
+
- Updated dependencies [2d11d44]
|
20
|
+
- cojson@0.17.5
|
21
|
+
- cojson-storage-indexeddb@0.17.5
|
22
|
+
- cojson-transport-ws@0.17.5
|
23
|
+
|
3
24
|
## 0.17.4
|
4
25
|
|
5
26
|
### Patch Changes
|
@@ -718,7 +718,7 @@ var CoMapProxyHandler = {
|
|
718
718
|
RegisteredSchemas["CoMap"] = CoMap;
|
719
719
|
|
720
720
|
// src/tools/coValues/coList.ts
|
721
|
-
import { ControlledAccount as ControlledAccount2, RawAccount as RawAccount2 } from "cojson";
|
721
|
+
import { ControlledAccount as ControlledAccount2, RawAccount as RawAccount2, cojsonInternals as cojsonInternals2 } from "cojson";
|
722
722
|
import { calcPatch } from "fast-myers-diff";
|
723
723
|
var _CoList = class _CoList extends Array {
|
724
724
|
/**
|
@@ -847,10 +847,13 @@ var _CoList = class _CoList extends Array {
|
|
847
847
|
* @category Creation
|
848
848
|
**/
|
849
849
|
static create(items, options) {
|
850
|
-
const { owner } = parseCoValueCreateOptions(options);
|
850
|
+
const { owner, uniqueness } = parseCoValueCreateOptions(options);
|
851
851
|
const instance = new this({ init: items, owner });
|
852
852
|
const raw = owner._raw.createList(
|
853
|
-
toRawItems(items, instance._schema[ItemsSym], owner)
|
853
|
+
toRawItems(items, instance._schema[ItemsSym], owner),
|
854
|
+
null,
|
855
|
+
"private",
|
856
|
+
uniqueness
|
854
857
|
);
|
855
858
|
Object.defineProperties(instance, {
|
856
859
|
id: {
|
@@ -1027,6 +1030,80 @@ var _CoList = class _CoList extends Array {
|
|
1027
1030
|
castAs(cl) {
|
1028
1031
|
return cl.fromRaw(this._raw);
|
1029
1032
|
}
|
1033
|
+
/** @deprecated Use `CoList.upsertUnique` and `CoList.loadUnique` instead. */
|
1034
|
+
static findUnique(unique, ownerID, as) {
|
1035
|
+
return _CoList._findUnique(unique, ownerID, as);
|
1036
|
+
}
|
1037
|
+
/** @internal */
|
1038
|
+
static _findUnique(unique, ownerID, as) {
|
1039
|
+
as ||= activeAccountContext.get();
|
1040
|
+
const header = {
|
1041
|
+
type: "colist",
|
1042
|
+
ruleset: {
|
1043
|
+
type: "ownedByGroup",
|
1044
|
+
group: ownerID
|
1045
|
+
},
|
1046
|
+
meta: null,
|
1047
|
+
uniqueness: unique
|
1048
|
+
};
|
1049
|
+
const crypto = as._type === "Anonymous" ? as.node.crypto : as._raw.core.node.crypto;
|
1050
|
+
return cojsonInternals2.idforHeader(header, crypto);
|
1051
|
+
}
|
1052
|
+
/**
|
1053
|
+
* Given some data, updates an existing CoList or initialises a new one if none exists.
|
1054
|
+
*
|
1055
|
+
* Note: This method respects resolve options, and thus can return `null` if the references cannot be resolved.
|
1056
|
+
*
|
1057
|
+
* @example
|
1058
|
+
* ```ts
|
1059
|
+
* const activeItems = await ItemList.upsertUnique(
|
1060
|
+
* {
|
1061
|
+
* value: [item1, item2, item3],
|
1062
|
+
* unique: sourceData.identifier,
|
1063
|
+
* owner: workspace,
|
1064
|
+
* }
|
1065
|
+
* );
|
1066
|
+
* ```
|
1067
|
+
*
|
1068
|
+
* @param options The options for creating or loading the CoList. This includes the intended state of the CoList, its unique identifier, its owner, and the references to resolve.
|
1069
|
+
* @returns Either an existing & modified CoList, or a new initialised CoList if none exists.
|
1070
|
+
* @category Subscription & Loading
|
1071
|
+
*/
|
1072
|
+
static async upsertUnique(options) {
|
1073
|
+
let listId = _CoList._findUnique(options.unique, options.owner.id);
|
1074
|
+
let list = await loadCoValueWithoutMe(this, listId, {
|
1075
|
+
...options,
|
1076
|
+
loadAs: options.owner._loadedAs,
|
1077
|
+
skipRetry: true
|
1078
|
+
});
|
1079
|
+
if (!list) {
|
1080
|
+
list = this.create(options.value, {
|
1081
|
+
owner: options.owner,
|
1082
|
+
unique: options.unique
|
1083
|
+
});
|
1084
|
+
} else {
|
1085
|
+
list.applyDiff(options.value);
|
1086
|
+
}
|
1087
|
+
return await loadCoValueWithoutMe(this, listId, {
|
1088
|
+
...options,
|
1089
|
+
loadAs: options.owner._loadedAs,
|
1090
|
+
skipRetry: true
|
1091
|
+
});
|
1092
|
+
}
|
1093
|
+
/**
|
1094
|
+
* Loads a CoList by its unique identifier and owner's ID.
|
1095
|
+
* @param unique The unique identifier of the CoList to load.
|
1096
|
+
* @param ownerID The ID of the owner of the CoList.
|
1097
|
+
* @param options Additional options for loading the CoList.
|
1098
|
+
* @returns The loaded CoList, or null if unavailable.
|
1099
|
+
*/
|
1100
|
+
static loadUnique(unique, ownerID, options) {
|
1101
|
+
return loadCoValueWithoutMe(
|
1102
|
+
this,
|
1103
|
+
_CoList._findUnique(unique, ownerID, options?.loadAs),
|
1104
|
+
{ ...options, skipRetry: true }
|
1105
|
+
);
|
1106
|
+
}
|
1030
1107
|
/**
|
1031
1108
|
* Wait for the `CoList` to be uploaded to the other peers.
|
1032
1109
|
*
|
@@ -1136,7 +1213,7 @@ var CoListProxyHandler = {
|
|
1136
1213
|
};
|
1137
1214
|
|
1138
1215
|
// src/tools/coValues/coFeed.ts
|
1139
|
-
import { cojsonInternals as
|
1216
|
+
import { cojsonInternals as cojsonInternals3 } from "cojson";
|
1140
1217
|
var _CoFeed = class _CoFeed extends CoValueBase {
|
1141
1218
|
/**
|
1142
1219
|
* Declare a `CoFeed` by subclassing `CoFeed.Of(...)` and passing the item schema using a `co` primitive or a `coField.ref`.
|
@@ -1469,12 +1546,12 @@ var CoStreamPerSessionProxyHandler = (innerTarget, accessFrom) => ({
|
|
1469
1546
|
const sessionID = key;
|
1470
1547
|
const rawEntry = innerTarget._raw.lastItemIn(sessionID);
|
1471
1548
|
if (!rawEntry) return;
|
1472
|
-
const by =
|
1549
|
+
const by = cojsonInternals3.accountOrAgentIDfromSessionID(sessionID);
|
1473
1550
|
const entry = entryFromRawEntry(
|
1474
1551
|
accessFrom,
|
1475
1552
|
rawEntry,
|
1476
1553
|
innerTarget._loadedAs,
|
1477
|
-
|
1554
|
+
cojsonInternals3.isAccountID(by) ? by : void 0,
|
1478
1555
|
innerTarget._schema[ItemsSym]
|
1479
1556
|
);
|
1480
1557
|
Object.defineProperty(entry, "all", {
|
@@ -1488,7 +1565,7 @@ var CoStreamPerSessionProxyHandler = (innerTarget, accessFrom) => ({
|
|
1488
1565
|
accessFrom,
|
1489
1566
|
rawEntry2.value,
|
1490
1567
|
innerTarget._loadedAs,
|
1491
|
-
|
1568
|
+
cojsonInternals3.isAccountID(by) ? by : void 0,
|
1492
1569
|
innerTarget._schema[ItemsSym]
|
1493
1570
|
);
|
1494
1571
|
}
|
@@ -1658,7 +1735,7 @@ var FileStream = class extends CoValueBase {
|
|
1658
1735
|
totalSizeBytes: arrayBuffer.byteLength,
|
1659
1736
|
fileName
|
1660
1737
|
});
|
1661
|
-
const chunkSize =
|
1738
|
+
const chunkSize = cojsonInternals3.TRANSACTION_CONFIG.MAX_RECOMMENDED_TX_SIZE;
|
1662
1739
|
let lastProgressUpdate = Date.now();
|
1663
1740
|
for (let idx = 0; idx < data.length; idx += chunkSize) {
|
1664
1741
|
stream.push(data.slice(idx, idx + chunkSize));
|
@@ -1742,7 +1819,7 @@ var FileStream = class extends CoValueBase {
|
|
1742
1819
|
import {
|
1743
1820
|
ControlledAccount as ControlledAccount3,
|
1744
1821
|
LocalNode,
|
1745
|
-
cojsonInternals as
|
1822
|
+
cojsonInternals as cojsonInternals4
|
1746
1823
|
} from "cojson";
|
1747
1824
|
var _Account = class _Account extends CoValueBase {
|
1748
1825
|
get _schema() {
|
@@ -1888,7 +1965,7 @@ var _Account = class _Account extends CoValueBase {
|
|
1888
1965
|
return activeAccountContext.get();
|
1889
1966
|
}
|
1890
1967
|
static async createAs(as, options) {
|
1891
|
-
const connectedPeers =
|
1968
|
+
const connectedPeers = cojsonInternals4.connectedPeers(
|
1892
1969
|
"creatingAccount",
|
1893
1970
|
"createdAccount",
|
1894
1971
|
{ peer1role: "server", peer2role: "client" }
|
@@ -3014,7 +3091,9 @@ function instantiateRefEncodedWithInit(schema, init, parentOwner) {
|
|
3014
3091
|
`Cannot automatically create CoValue from value: ${JSON.stringify(init)}. Use the CoValue schema's create() method instead.`
|
3015
3092
|
);
|
3016
3093
|
}
|
3017
|
-
const
|
3094
|
+
const node = parentOwner._raw.core.node;
|
3095
|
+
const rawGroup = node.createGroup();
|
3096
|
+
const owner = new Group({ fromRaw: rawGroup });
|
3018
3097
|
owner.addMember(parentOwner.castAs(Group));
|
3019
3098
|
return schema.ref.create(init, owner);
|
3020
3099
|
}
|
@@ -4130,6 +4209,16 @@ var CoListSchema = class {
|
|
4130
4209
|
getCoValueClass() {
|
4131
4210
|
return this.coValueClass;
|
4132
4211
|
}
|
4212
|
+
/** @deprecated Use `CoList.upsertUnique` and `CoList.loadUnique` instead. */
|
4213
|
+
findUnique(unique, ownerID, as) {
|
4214
|
+
return this.coValueClass.findUnique(unique, ownerID, as);
|
4215
|
+
}
|
4216
|
+
upsertUnique(options) {
|
4217
|
+
return this.coValueClass.upsertUnique(options);
|
4218
|
+
}
|
4219
|
+
loadUnique(unique, ownerID, options) {
|
4220
|
+
return this.coValueClass.loadUnique(unique, ownerID, options);
|
4221
|
+
}
|
4133
4222
|
optional() {
|
4134
4223
|
return coOptionalDefiner(this);
|
4135
4224
|
}
|
@@ -4558,7 +4647,7 @@ var ImageDefinitionBase = coMapDefiner({
|
|
4558
4647
|
var ImageDefinition = ImageDefinitionBase;
|
4559
4648
|
|
4560
4649
|
// src/tools/implementation/ContextManager.ts
|
4561
|
-
import { cojsonInternals as
|
4650
|
+
import { cojsonInternals as cojsonInternals5 } from "cojson";
|
4562
4651
|
import { PureJSCrypto } from "cojson/dist/crypto/PureJSCrypto";
|
4563
4652
|
|
4564
4653
|
// src/tools/auth/KvStoreContext.ts
|
@@ -4887,7 +4976,7 @@ var JazzContextManager = class {
|
|
4887
4976
|
}
|
4888
4977
|
const currentContext = this.context;
|
4889
4978
|
if (prevContext && currentContext && "me" in prevContext && "me" in currentContext) {
|
4890
|
-
const [prevAccountAsPeer, currentAccountAsPeer] =
|
4979
|
+
const [prevAccountAsPeer, currentAccountAsPeer] = cojsonInternals5.connectedPeers(
|
4891
4980
|
prevContext.me.id,
|
4892
4981
|
currentContext.me.id,
|
4893
4982
|
{
|
@@ -5283,4 +5372,4 @@ export {
|
|
5283
5372
|
JazzContextManager
|
5284
5373
|
};
|
5285
5374
|
/* istanbul ignore file -- @preserve */
|
5286
|
-
//# sourceMappingURL=chunk-
|
5375
|
+
//# sourceMappingURL=chunk-SJHXI5AB.js.map
|