jazz-tools 0.7.0-alpha.0 → 0.7.0-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +8 -1
- package/CHANGELOG.md +8 -0
- package/dist/coValues/account.js +138 -0
- package/dist/coValues/account.js.map +1 -0
- package/dist/coValues/coList.js +196 -0
- package/dist/coValues/coList.js.map +1 -0
- package/dist/coValues/coMap.js +249 -0
- package/dist/coValues/coMap.js.map +1 -0
- package/dist/coValues/coStream.js +189 -0
- package/dist/coValues/coStream.js.map +1 -0
- package/dist/coValues/extensions/imageDef.js +17 -12
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +96 -0
- package/dist/coValues/group.js.map +1 -0
- package/dist/coValues/interfaces.js +58 -0
- package/dist/coValues/interfaces.js.map +1 -0
- package/dist/implementation/errors.js.map +1 -0
- package/dist/implementation/inspect.js +2 -0
- package/dist/implementation/inspect.js.map +1 -0
- package/dist/{refs.js → implementation/refs.js} +11 -13
- package/dist/implementation/refs.js.map +1 -0
- package/dist/implementation/schema.js +6 -0
- package/dist/implementation/schema.js.map +1 -0
- package/dist/{subscriptionScope.js → implementation/subscriptionScope.js} +1 -1
- package/dist/implementation/subscriptionScope.js.map +1 -0
- package/dist/index.js +23 -27
- package/dist/index.js.map +1 -1
- package/dist/internal.js +13 -0
- package/dist/internal.js.map +1 -0
- package/dist/tests/coList.test.js +26 -22
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +91 -43
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +35 -24
- package/dist/tests/coStream.test.js.map +1 -1
- package/package.json +11 -4
- package/src/coValues/account.ts +297 -0
- package/src/coValues/coList.ts +320 -0
- package/src/coValues/coMap.ts +447 -0
- package/src/coValues/coStream.ts +325 -0
- package/src/coValues/extensions/imageDef.ts +24 -16
- package/src/coValues/group.ts +187 -0
- package/src/coValues/interfaces.ts +216 -0
- package/src/implementation/inspect.ts +2 -0
- package/src/{refs.ts → implementation/refs.ts} +21 -32
- package/src/implementation/schema.ts +69 -0
- package/src/{subscriptionScope.ts → implementation/subscriptionScope.ts} +11 -13
- package/src/index.ts +22 -50
- package/src/internal.ts +15 -0
- package/src/tests/coList.test.ts +27 -25
- package/src/tests/coMap.test.ts +125 -50
- package/src/tests/coStream.test.ts +51 -38
- package/dist/coValueInterfaces.js +0 -8
- package/dist/coValueInterfaces.js.map +0 -1
- package/dist/coValues/account/account.js +0 -11
- package/dist/coValues/account/account.js.map +0 -1
- package/dist/coValues/account/accountOf.js +0 -150
- package/dist/coValues/account/accountOf.js.map +0 -1
- package/dist/coValues/account/migration.js +0 -4
- package/dist/coValues/account/migration.js.map +0 -1
- package/dist/coValues/coList/coList.js +0 -2
- package/dist/coValues/coList/coList.js.map +0 -1
- package/dist/coValues/coList/coListOf.js +0 -235
- package/dist/coValues/coList/coListOf.js.map +0 -1
- package/dist/coValues/coList/internalDocs.js +0 -2
- package/dist/coValues/coList/internalDocs.js.map +0 -1
- package/dist/coValues/coMap/coMap.js +0 -2
- package/dist/coValues/coMap/coMap.js.map +0 -1
- package/dist/coValues/coMap/coMapOf.js +0 -262
- package/dist/coValues/coMap/coMapOf.js.map +0 -1
- package/dist/coValues/coMap/internalDocs.js +0 -2
- package/dist/coValues/coMap/internalDocs.js.map +0 -1
- package/dist/coValues/coStream/coStream.js +0 -2
- package/dist/coValues/coStream/coStream.js.map +0 -1
- package/dist/coValues/coStream/coStreamOf.js +0 -244
- package/dist/coValues/coStream/coStreamOf.js.map +0 -1
- package/dist/coValues/construction.js +0 -34
- package/dist/coValues/construction.js.map +0 -1
- package/dist/coValues/group/group.js +0 -2
- package/dist/coValues/group/group.js.map +0 -1
- package/dist/coValues/group/groupOf.js +0 -109
- package/dist/coValues/group/groupOf.js.map +0 -1
- package/dist/coValues/resolution.js +0 -66
- package/dist/coValues/resolution.js.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/refs.js.map +0 -1
- package/dist/schemaHelpers.js +0 -14
- package/dist/schemaHelpers.js.map +0 -1
- package/dist/subscriptionScope.js.map +0 -1
- package/dist/tests/types.test.js +0 -33
- package/dist/tests/types.test.js.map +0 -1
- package/src/coValueInterfaces.ts +0 -105
- package/src/coValues/account/account.ts +0 -106
- package/src/coValues/account/accountOf.ts +0 -284
- package/src/coValues/account/migration.ts +0 -12
- package/src/coValues/coList/coList.ts +0 -57
- package/src/coValues/coList/coListOf.ts +0 -377
- package/src/coValues/coList/internalDocs.ts +0 -1
- package/src/coValues/coMap/coMap.ts +0 -110
- package/src/coValues/coMap/coMapOf.ts +0 -451
- package/src/coValues/coMap/internalDocs.ts +0 -1
- package/src/coValues/coStream/coStream.ts +0 -63
- package/src/coValues/coStream/coStreamOf.ts +0 -404
- package/src/coValues/construction.ts +0 -110
- package/src/coValues/group/group.ts +0 -27
- package/src/coValues/group/groupOf.ts +0 -183
- package/src/coValues/resolution.ts +0 -111
- package/src/schemaHelpers.ts +0 -72
- package/src/tests/types.test.ts +0 -37
- /package/dist/{errors.js → implementation/errors.js} +0 -0
- /package/src/{errors.ts → implementation/errors.ts} +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../../src/coValues/account/migration.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,sBAAsB,CAClC,aAAgB,EAChB,SAA8B;IAE9B,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../../src/coValues/coList/coList.ts"],"names":[],"mappings":""}
|
@@ -1,235 +0,0 @@
|
|
1
|
-
import { RawAccount, cojsonInternals, } from "cojson";
|
2
|
-
import { inspect } from "../../coValueInterfaces.js";
|
3
|
-
import { AST, Schema } from "@effect/schema";
|
4
|
-
import { constructorOfSchemaSym, propertyIsCoValueSchema, } from "../resolution.js";
|
5
|
-
import { ValueRef, makeRefs } from "../../refs.js";
|
6
|
-
import { Account, controlledAccountFromNode } from "../account/accountOf.js";
|
7
|
-
import { subscriptionsScopes } from "../../subscriptionScope.js";
|
8
|
-
import { SharedCoValueConstructor } from "../construction.js";
|
9
|
-
import { pipeArguments } from "effect/Pipeable";
|
10
|
-
import { Group } from "../group/groupOf.js";
|
11
|
-
export function CoListOf(itemSchema) {
|
12
|
-
const decodeItem = Schema.decodeSync(itemSchema);
|
13
|
-
const encodeItem = Schema.encodeSync(itemSchema);
|
14
|
-
class CoListOfItem extends Array {
|
15
|
-
static get ast() {
|
16
|
-
return AST.setAnnotation(Schema.instanceOf(this).ast, constructorOfSchemaSym, this);
|
17
|
-
}
|
18
|
-
static pipe() {
|
19
|
-
// eslint-disable-next-line prefer-rest-params
|
20
|
-
return pipeArguments(this, arguments);
|
21
|
-
}
|
22
|
-
constructor(init, options) {
|
23
|
-
if (typeof init === "number") {
|
24
|
-
// this might be called from an intrinsic, like map, trying to create an empty array
|
25
|
-
// passing `0` as the only parameter
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
27
|
-
return new Array(init);
|
28
|
-
}
|
29
|
-
super();
|
30
|
-
const itemsAreCoValues = propertyIsCoValueSchema(itemSchema);
|
31
|
-
if (!options) {
|
32
|
-
throw new Error("Must provide options");
|
33
|
-
}
|
34
|
-
let raw;
|
35
|
-
if ("fromRaw" in options) {
|
36
|
-
raw = options.fromRaw;
|
37
|
-
}
|
38
|
-
else {
|
39
|
-
const rawOwner = options.owner._raw;
|
40
|
-
const rawInit = itemsAreCoValues
|
41
|
-
? init?.map((item) => item.id)
|
42
|
-
: init?.map((item) => encodeItem(item));
|
43
|
-
raw = rawOwner.createList(rawInit);
|
44
|
-
}
|
45
|
-
const refs = itemsAreCoValues
|
46
|
-
? makeRefs((idx) => raw.get(idx), () => Array.from({ length: raw.entries().length }, (_, idx) => idx), controlledAccountFromNode(raw.core.node), (_idx) => itemSchema)
|
47
|
-
: [];
|
48
|
-
const getEdits = () => new Proxy(this, {
|
49
|
-
get: (target, key, receiver) => {
|
50
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
51
|
-
const rawEdit = raw.editAt(Number(key));
|
52
|
-
if (!rawEdit)
|
53
|
-
return undefined;
|
54
|
-
return {
|
55
|
-
get value() {
|
56
|
-
if (itemsAreCoValues) {
|
57
|
-
return this.ref?.accessFrom(receiver);
|
58
|
-
}
|
59
|
-
else {
|
60
|
-
return (rawEdit?.value &&
|
61
|
-
decodeItem(rawEdit?.value));
|
62
|
-
}
|
63
|
-
},
|
64
|
-
get ref() {
|
65
|
-
if (itemsAreCoValues) {
|
66
|
-
return (rawEdit?.value &&
|
67
|
-
new ValueRef(rawEdit?.value, receiver._loadedAs, itemSchema));
|
68
|
-
}
|
69
|
-
},
|
70
|
-
get by() {
|
71
|
-
if (cojsonInternals.isAccountID(rawEdit.by)) {
|
72
|
-
return new ValueRef(rawEdit.by, receiver._loadedAs, Account).accessFrom(receiver);
|
73
|
-
}
|
74
|
-
},
|
75
|
-
madeAt: rawEdit.at,
|
76
|
-
tx: rawEdit.tx,
|
77
|
-
};
|
78
|
-
}
|
79
|
-
else if (key === "length") {
|
80
|
-
return raw.entries().length;
|
81
|
-
}
|
82
|
-
return Reflect.get(target, key, receiver);
|
83
|
-
},
|
84
|
-
});
|
85
|
-
Object.defineProperties(this, {
|
86
|
-
id: { value: raw.id, enumerable: false },
|
87
|
-
_type: { value: "CoList", enumerable: false },
|
88
|
-
_owner: {
|
89
|
-
get: () => raw.group instanceof RawAccount
|
90
|
-
? Account.fromRaw(raw.group)
|
91
|
-
: Group.fromRaw(raw.group),
|
92
|
-
enumerable: false,
|
93
|
-
},
|
94
|
-
_refs: { value: refs, enumerable: false },
|
95
|
-
_edits: { get: getEdits, enumerable: false },
|
96
|
-
_raw: { value: raw, enumerable: false },
|
97
|
-
_loadedAs: {
|
98
|
-
get: () => controlledAccountFromNode(raw.core.node),
|
99
|
-
enumerable: false,
|
100
|
-
},
|
101
|
-
_schema: { value: this.constructor, enumerable: false },
|
102
|
-
});
|
103
|
-
return new Proxy(this, {
|
104
|
-
get(target, key, receiver) {
|
105
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
106
|
-
if (itemsAreCoValues) {
|
107
|
-
return target._refs[Number(key)]?.accessFrom(receiver);
|
108
|
-
}
|
109
|
-
else {
|
110
|
-
return decodeItem(raw.get(Number(key)));
|
111
|
-
}
|
112
|
-
}
|
113
|
-
else if (key === "length") {
|
114
|
-
return raw.entries().length;
|
115
|
-
}
|
116
|
-
const prop = Reflect.get(target, key, receiver);
|
117
|
-
if (typeof prop === "function") {
|
118
|
-
return prop.bind(receiver);
|
119
|
-
}
|
120
|
-
return prop;
|
121
|
-
},
|
122
|
-
set(target, key, value, receiver) {
|
123
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
124
|
-
if (itemsAreCoValues) {
|
125
|
-
raw.replace(Number(key), value.id);
|
126
|
-
subscriptionsScopes
|
127
|
-
.get(receiver)
|
128
|
-
?.onRefAccessedOrSet(value.id);
|
129
|
-
return true;
|
130
|
-
}
|
131
|
-
else {
|
132
|
-
raw.replace(Number(key), encodeItem(value));
|
133
|
-
return true;
|
134
|
-
}
|
135
|
-
}
|
136
|
-
else {
|
137
|
-
return Reflect.set(target, key, value);
|
138
|
-
}
|
139
|
-
},
|
140
|
-
has(target, key) {
|
141
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
142
|
-
return Number(key) < raw.entries().length;
|
143
|
-
}
|
144
|
-
else {
|
145
|
-
return Reflect.has(target, key);
|
146
|
-
}
|
147
|
-
},
|
148
|
-
});
|
149
|
-
}
|
150
|
-
static fromRaw(raw) {
|
151
|
-
return new CoListOfItem(undefined, { fromRaw: raw });
|
152
|
-
}
|
153
|
-
push(...items) {
|
154
|
-
let rawItems;
|
155
|
-
if (propertyIsCoValueSchema(itemSchema)) {
|
156
|
-
rawItems = items.map((item) => item.id);
|
157
|
-
}
|
158
|
-
else {
|
159
|
-
rawItems = items.map((item) => encodeItem(item));
|
160
|
-
}
|
161
|
-
for (const item of rawItems) {
|
162
|
-
this._raw.append(item);
|
163
|
-
}
|
164
|
-
return this._raw.entries().length;
|
165
|
-
}
|
166
|
-
unshift(...items) {
|
167
|
-
let rawItems;
|
168
|
-
if (propertyIsCoValueSchema(itemSchema)) {
|
169
|
-
rawItems = items.map((item) => item.id);
|
170
|
-
}
|
171
|
-
else {
|
172
|
-
rawItems = items.map((item) => encodeItem(item));
|
173
|
-
}
|
174
|
-
for (const item of rawItems) {
|
175
|
-
this._raw.prepend(item);
|
176
|
-
}
|
177
|
-
return this._raw.entries().length;
|
178
|
-
}
|
179
|
-
pop() {
|
180
|
-
const last = this[this.length - 1];
|
181
|
-
this._raw.delete(this.length - 1);
|
182
|
-
return last;
|
183
|
-
}
|
184
|
-
shift() {
|
185
|
-
const first = this[0];
|
186
|
-
this._raw.delete(0);
|
187
|
-
return first;
|
188
|
-
}
|
189
|
-
splice(start, deleteCount, ...items) {
|
190
|
-
const deleted = this.slice(start, start + deleteCount);
|
191
|
-
for (let idxToDelete = start + deleteCount; idxToDelete > start; idxToDelete--) {
|
192
|
-
this._raw.delete(idxToDelete);
|
193
|
-
}
|
194
|
-
let rawItems;
|
195
|
-
if (propertyIsCoValueSchema(itemSchema)) {
|
196
|
-
rawItems = items.map((item) => item.id);
|
197
|
-
}
|
198
|
-
else {
|
199
|
-
rawItems = items.map((item) => encodeItem(item));
|
200
|
-
}
|
201
|
-
let appendAfter = start;
|
202
|
-
for (const item of rawItems) {
|
203
|
-
this._raw.append(item, appendAfter);
|
204
|
-
appendAfter++;
|
205
|
-
}
|
206
|
-
return deleted;
|
207
|
-
}
|
208
|
-
toJSON() {
|
209
|
-
return this.map((item) => typeof item === "object" &&
|
210
|
-
"toJSON" in item &&
|
211
|
-
typeof item.toJSON === "function"
|
212
|
-
? item.toJSON()
|
213
|
-
: item);
|
214
|
-
}
|
215
|
-
[(Schema.TypeId, inspect)]() {
|
216
|
-
return this.toJSON();
|
217
|
-
}
|
218
|
-
static as() {
|
219
|
-
return CoListOfItem;
|
220
|
-
}
|
221
|
-
subscribe(listener) {
|
222
|
-
return SharedCoValueConstructor.prototype.subscribe.call(this, listener);
|
223
|
-
}
|
224
|
-
subscribeEf() {
|
225
|
-
return SharedCoValueConstructor.prototype.subscribeEf.call(this);
|
226
|
-
}
|
227
|
-
}
|
228
|
-
CoListOfItem.type = "CoList";
|
229
|
-
CoListOfItem.load = SharedCoValueConstructor.load;
|
230
|
-
CoListOfItem.loadEf = SharedCoValueConstructor.loadEf;
|
231
|
-
CoListOfItem.subscribe = SharedCoValueConstructor.subscribe;
|
232
|
-
CoListOfItem.subscribeEf = SharedCoValueConstructor.subscribeEf;
|
233
|
-
return CoListOfItem;
|
234
|
-
}
|
235
|
-
//# sourceMappingURL=coListOf.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"coListOf.js","sourceRoot":"","sources":["../../../src/coValues/coList/coListOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,UAAU,EAEV,eAAe,GAClB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAqB,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAGxE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EACH,sBAAsB,EACtB,uBAAuB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,MAAM,UAAU,QAAQ,CAEtB,UAAgB;IACd,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC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AC,IAAI,CAAC,MAAM,EAAE;gBACf,CAAC,CAAC,IAAI,CACb,CAAC;QACN,CAAC;QAED,EA9SQ,MAAM,CAAC,MAAM,EA8SpB,OAAO,EAAC;YACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,CAAC,EAAE;YACL,OAAO,YAAuD,CAAC;QACnE,CAAC;QAED,SAAS,CAAC,QAAgC;YACtC,OAAO,wBAAwB,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CACpD,IAAI,EACJ,QAES,CACZ,CAAC;QACN,CAAC;QAED,WAAW;YACP,OAAO,wBAAwB,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CACtD,IAAI,CACoD,CAAC;QACjE,CAAC;;IA1TM,iBAAI,GAAG,QAAiB,CAAC;IAsRzB,iBAAI,GAAG,wBAAwB,CAAC,IAAI,CAAC;IACrC,mBAAM,GAAG,wBAAwB,CAAC,MAAM,CAAC;IACzC,sBAAS,GAAG,wBAAwB,CAAC,SAAS,CAAC;IAC/C,wBAAW,GAAG,wBAAwB,CAAC,WAAW,CAAC;IAoC9D,OAAO,YAEN,CAAC;AACN,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"internalDocs.js","sourceRoot":"","sources":["../../../src/coValues/coList/internalDocs.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../../src/coValues/coMap/coMap.ts"],"names":[],"mappings":""}
|
@@ -1,262 +0,0 @@
|
|
1
|
-
import { isCoValueSchema, isCoValue, inspect, } from "../../coValueInterfaces.js";
|
2
|
-
import { ValueRef, makeRefs } from "../../refs.js";
|
3
|
-
import { RawAccount, cojsonInternals } from "cojson";
|
4
|
-
import { Account, controlledAccountFromNode } from "../account/accountOf.js";
|
5
|
-
import { subscriptionsScopes } from "../../subscriptionScope.js";
|
6
|
-
import { AST, Schema } from "@effect/schema";
|
7
|
-
import { constructorOfSchemaSym, propertyIsCoValueSchema, } from "../resolution.js";
|
8
|
-
import { SharedCoValueConstructor } from "../construction.js";
|
9
|
-
import { propSigToSchema, } from "../../schemaHelpers.js";
|
10
|
-
import { pipeArguments } from "effect/Pipeable";
|
11
|
-
import { Group } from "../group/groupOf.js";
|
12
|
-
export function CoMapOf(fields, indexSignature) {
|
13
|
-
class CoMapOfFields extends SharedCoValueConstructor {
|
14
|
-
static get ast() {
|
15
|
-
return AST.setAnnotation(Schema.instanceOf(this).ast, constructorOfSchemaSym, this);
|
16
|
-
}
|
17
|
-
static pipe() {
|
18
|
-
// eslint-disable-next-line prefer-rest-params
|
19
|
-
return pipeArguments(this, arguments);
|
20
|
-
}
|
21
|
-
constructor(init, options) {
|
22
|
-
super();
|
23
|
-
let raw;
|
24
|
-
if ("fromRaw" in options) {
|
25
|
-
raw = options.fromRaw;
|
26
|
-
}
|
27
|
-
else {
|
28
|
-
const rawOwner = options.owner._raw;
|
29
|
-
const rawInit = {};
|
30
|
-
if (init)
|
31
|
-
for (const key of Object.keys(init)) {
|
32
|
-
const initValue = init[key];
|
33
|
-
const field = fields[key] ||
|
34
|
-
(indexSignature &&
|
35
|
-
Schema.is(indexSignature.key)(key) &&
|
36
|
-
indexSignature.value);
|
37
|
-
if (!field) {
|
38
|
-
throw new Error(`Key ${String(key)} not in schema`);
|
39
|
-
}
|
40
|
-
if (propertyIsCoValueSchema(field)) {
|
41
|
-
// TOOD: check for alignment of actual value with schema
|
42
|
-
if (isCoValue(initValue)) {
|
43
|
-
rawInit[key] = initValue.id;
|
44
|
-
}
|
45
|
-
else {
|
46
|
-
throw new Error(`Expected covalue in ${String(key)} but got ${initValue}`);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
const fieldSchema = ("propertySignatureAST" in field
|
51
|
-
? Schema.make(field.propertySignatureAST.from)
|
52
|
-
: field);
|
53
|
-
rawInit[key] =
|
54
|
-
Schema.encodeSync(fieldSchema)(initValue);
|
55
|
-
}
|
56
|
-
}
|
57
|
-
raw = rawOwner.createMap(rawInit);
|
58
|
-
}
|
59
|
-
for (const key of Object.keys(fields)) {
|
60
|
-
if (typeof key !== "string")
|
61
|
-
continue;
|
62
|
-
const fieldSchema = fields[key];
|
63
|
-
if (propertyIsCoValueSchema(fieldSchema)) {
|
64
|
-
Object.defineProperty(this, key, {
|
65
|
-
get() {
|
66
|
-
return this.getCoValueAtKey(key);
|
67
|
-
},
|
68
|
-
set(value) {
|
69
|
-
this.setCoValueAtKey(key, value);
|
70
|
-
},
|
71
|
-
enumerable: true,
|
72
|
-
});
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
Object.defineProperty(this, key, {
|
76
|
-
get() {
|
77
|
-
return this.getPrimitiveAtKey(key, fieldSchema);
|
78
|
-
},
|
79
|
-
set(value) {
|
80
|
-
this.setPrimitiveAtKey(key, value, fieldSchema);
|
81
|
-
},
|
82
|
-
enumerable: true,
|
83
|
-
});
|
84
|
-
}
|
85
|
-
}
|
86
|
-
const fieldsThatAreRefs = Object.entries(fields)
|
87
|
-
.filter(([_, value]) => isCoValueSchema(value))
|
88
|
-
.map(([key]) => key);
|
89
|
-
const refs = makeRefs((key) => {
|
90
|
-
return raw.get(key);
|
91
|
-
}, () => {
|
92
|
-
if (indexSignature) {
|
93
|
-
return raw
|
94
|
-
.keys()
|
95
|
-
.filter((key) => fieldsThatAreRefs.includes(key) ||
|
96
|
-
Schema.is(indexSignature.key)(key));
|
97
|
-
}
|
98
|
-
else {
|
99
|
-
return fieldsThatAreRefs;
|
100
|
-
}
|
101
|
-
}, controlledAccountFromNode(raw.core.node), (key) => fields[key] ||
|
102
|
-
(indexSignature
|
103
|
-
? indexSignature.value
|
104
|
-
: (() => {
|
105
|
-
throw new Error("Expected " + String(key) + " to be valid");
|
106
|
-
})()));
|
107
|
-
const getEdits = () => new Proxy(this, {
|
108
|
-
get(target, key, receiver) {
|
109
|
-
const schemaAtKey = fields[key] ||
|
110
|
-
(indexSignature &&
|
111
|
-
Schema.is(indexSignature?.key)(key)
|
112
|
-
? indexSignature?.value
|
113
|
-
: undefined);
|
114
|
-
if (!schemaAtKey)
|
115
|
-
return Reflect.get(target, key, receiver);
|
116
|
-
const rawEdit = raw.lastEditAt(key);
|
117
|
-
if (!rawEdit)
|
118
|
-
return undefined;
|
119
|
-
return {
|
120
|
-
get value() {
|
121
|
-
if (isCoValueSchema(schemaAtKey)) {
|
122
|
-
return this.ref?.accessFrom(target);
|
123
|
-
}
|
124
|
-
else {
|
125
|
-
return (rawEdit?.value &&
|
126
|
-
Schema.decodeSync(propSigToSchema(schemaAtKey))(rawEdit?.value));
|
127
|
-
}
|
128
|
-
},
|
129
|
-
get ref() {
|
130
|
-
if (isCoValueSchema(schemaAtKey)) {
|
131
|
-
return (rawEdit?.value &&
|
132
|
-
new ValueRef(rawEdit?.value, target._loadedAs, schemaAtKey));
|
133
|
-
}
|
134
|
-
},
|
135
|
-
get by() {
|
136
|
-
if (cojsonInternals.isAccountID(rawEdit.by)) {
|
137
|
-
return new ValueRef(rawEdit.by, target._loadedAs, Account).accessFrom(target);
|
138
|
-
}
|
139
|
-
},
|
140
|
-
madeAt: rawEdit.at,
|
141
|
-
tx: rawEdit.tx,
|
142
|
-
};
|
143
|
-
},
|
144
|
-
});
|
145
|
-
Object.defineProperties(this, {
|
146
|
-
id: {
|
147
|
-
value: raw.id,
|
148
|
-
enumerable: false,
|
149
|
-
},
|
150
|
-
_type: { value: "CoMap", enumerable: false },
|
151
|
-
_owner: {
|
152
|
-
get: () => raw.group instanceof RawAccount
|
153
|
-
? Account.fromRaw(raw.group)
|
154
|
-
: Group.fromRaw(raw.group),
|
155
|
-
enumerable: false,
|
156
|
-
},
|
157
|
-
_refs: { value: refs, enumerable: false },
|
158
|
-
_edits: { get: getEdits, enumerable: false },
|
159
|
-
_raw: { value: raw, enumerable: false },
|
160
|
-
_loadedAs: {
|
161
|
-
get: () => controlledAccountFromNode(raw.core.node),
|
162
|
-
enumerable: false,
|
163
|
-
},
|
164
|
-
_schema: {
|
165
|
-
value: this.constructor,
|
166
|
-
enumerable: false,
|
167
|
-
},
|
168
|
-
});
|
169
|
-
if (indexSignature) {
|
170
|
-
return new Proxy(this, {
|
171
|
-
get(target, key) {
|
172
|
-
if (key in target) {
|
173
|
-
return Reflect.get(target, key);
|
174
|
-
}
|
175
|
-
else {
|
176
|
-
if (Schema.is(indexSignature.key)(key)) {
|
177
|
-
if (propertyIsCoValueSchema(indexSignature.value)) {
|
178
|
-
return target.getCoValueAtKey(key);
|
179
|
-
}
|
180
|
-
else {
|
181
|
-
return target.getPrimitiveAtKey(key, indexSignature.value);
|
182
|
-
}
|
183
|
-
}
|
184
|
-
else {
|
185
|
-
throw new Error("No such key " + String(key) + " in CoMap");
|
186
|
-
}
|
187
|
-
}
|
188
|
-
},
|
189
|
-
set(target, key, value) {
|
190
|
-
if (key in target) {
|
191
|
-
return Reflect.set(target, key, value);
|
192
|
-
}
|
193
|
-
else if (Schema.is(indexSignature.key)(key)) {
|
194
|
-
if (propertyIsCoValueSchema(indexSignature.value)) {
|
195
|
-
target.setCoValueAtKey(key, value);
|
196
|
-
}
|
197
|
-
else {
|
198
|
-
target.setPrimitiveAtKey(key, value, indexSignature.value);
|
199
|
-
}
|
200
|
-
return true;
|
201
|
-
}
|
202
|
-
else {
|
203
|
-
throw new Error("No such key " + String(key) + " in CoMap");
|
204
|
-
}
|
205
|
-
},
|
206
|
-
ownKeys(target) {
|
207
|
-
const keys = Reflect.ownKeys(target);
|
208
|
-
for (const key of target._raw.keys()) {
|
209
|
-
if (!keys.includes(key)) {
|
210
|
-
if (Schema.is(indexSignature.key)(key)) {
|
211
|
-
keys.push(key);
|
212
|
-
}
|
213
|
-
}
|
214
|
-
}
|
215
|
-
return keys;
|
216
|
-
},
|
217
|
-
getOwnPropertyDescriptor(target, key) {
|
218
|
-
if (key in target) {
|
219
|
-
return Reflect.getOwnPropertyDescriptor(target, key);
|
220
|
-
}
|
221
|
-
else if (Schema.is(indexSignature.key)(key)) {
|
222
|
-
return {
|
223
|
-
enumerable: true,
|
224
|
-
configurable: true,
|
225
|
-
};
|
226
|
-
}
|
227
|
-
},
|
228
|
-
});
|
229
|
-
}
|
230
|
-
}
|
231
|
-
static fromRaw(raw) {
|
232
|
-
return new CoMapOfFields(undefined, { fromRaw: raw });
|
233
|
-
}
|
234
|
-
getCoValueAtKey(key) {
|
235
|
-
return this._refs[key]?.accessFrom(this);
|
236
|
-
}
|
237
|
-
setCoValueAtKey(key, value) {
|
238
|
-
this._raw.set(key, value.id);
|
239
|
-
subscriptionsScopes.get(this)?.onRefAccessedOrSet(value.id);
|
240
|
-
}
|
241
|
-
getPrimitiveAtKey(key, schemaAtKey) {
|
242
|
-
return Schema.decodeSync(propSigToSchema(schemaAtKey))(this._raw.get(key));
|
243
|
-
}
|
244
|
-
setPrimitiveAtKey(key, value, schemaAtKey) {
|
245
|
-
this._raw.set(key, Schema.encodeSync(propSigToSchema(schemaAtKey))(value));
|
246
|
-
}
|
247
|
-
toJSON() {
|
248
|
-
return Object.fromEntries(Object.entries(this).flatMap(([key, value]) => typeof value === "object" && "toJSON" in value
|
249
|
-
? [[key, value?.toJSON()]]
|
250
|
-
: [[key, value]]));
|
251
|
-
}
|
252
|
-
[(Schema.TypeId, inspect)]() {
|
253
|
-
return this.toJSON();
|
254
|
-
}
|
255
|
-
static as() {
|
256
|
-
return CoMapOfFields;
|
257
|
-
}
|
258
|
-
}
|
259
|
-
CoMapOfFields.type = "CoMap";
|
260
|
-
return CoMapOfFields;
|
261
|
-
}
|
262
|
-
//# sourceMappingURL=coMapOf.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"coMapOf.js","sourceRoot":"","sources":["../../../src/coValues/coMap/coMapOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,eAAe,EACf,SAAS,EAET,OAAO,GAEV,MAAM,4BAA4B,CAAC;AAUpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC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OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAC1C,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK;gBAC1C,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC1B,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CACvB,CACJ,CAAC;QACN,CAAC;QAED,EA9XQ,MAAM,CAAC,MAAM,EA8XpB,OAAO,EAAC;YACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,CAAC,EAAE;YACL,OAAO,aAIN,CAAC;QACN,CAAC;;IA/XM,kBAAI,GAAG,OAAgB,CAAC;IAkYnC,OAAO,aAEN,CAAC;AACN,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"internalDocs.js","sourceRoot":"","sources":["../../../src/coValues/coMap/internalDocs.ts"],"names":[],"mappings":""}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"coStream.js","sourceRoot":"","sources":["../../../src/coValues/coStream/coStream.ts"],"names":[],"mappings":""}
|