jazz-tools 0.7.0-alpha.2 → 0.7.0-alpha.4
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,OAAO,MACT,SAAQ,KAAW;IAWnB,IAAI,SAAS;QAGT,OAAQ,IAAI,CAAC,WAA6B,CAAC,SAAS,CAAC;IACzD,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,YAAY,UAAU;YACxC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YAClC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK;
|
1
|
+
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,WAAW,EACX,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,OAAO,MACT,SAAQ,KAAW;IAWnB,IAAI,SAAS;QAGT,OAAQ,IAAI,CAAC,WAA6B,CAAC,SAAS,CAAC;IACzD,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,YAAY,UAAU;YAC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C;gBAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACJ,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACpC,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Effect } from "effect";
|
2
|
-
import { subscriptionsScopes } from
|
2
|
+
import { subscriptionsScopes } from "../internal.js";
|
3
3
|
export class ValueRef {
|
4
4
|
constructor(id, controlledAccount, valueConstructor) {
|
5
5
|
this.id = id;
|
@@ -12,7 +12,9 @@ export class ValueRef {
|
|
12
12
|
// TODO: cache it for object identity!!!
|
13
13
|
const raw = this.controlledAccount._raw.core.node.getLoaded(this.id);
|
14
14
|
if (raw) {
|
15
|
-
const value = new this.valueConstructor(undefined, {
|
15
|
+
const value = new this.valueConstructor(undefined, {
|
16
|
+
fromRaw: raw,
|
17
|
+
});
|
16
18
|
this.cachedValue = value;
|
17
19
|
return value;
|
18
20
|
}
|
@@ -42,8 +44,7 @@ export class ValueRef {
|
|
42
44
|
return "unavailable";
|
43
45
|
}
|
44
46
|
else {
|
45
|
-
return new ValueRef(this.id, this.controlledAccount, this.valueConstructor)
|
46
|
-
.value;
|
47
|
+
return new ValueRef(this.id, this.controlledAccount, this.valueConstructor).value;
|
47
48
|
}
|
48
49
|
}
|
49
50
|
async load(options) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../src/implementation/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
1
|
+
{"version":3,"file":"refs.js","sourceRoot":"","sources":["../../src/implementation/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWhC,OAAO,EAAE,mBAAmB,E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ACnB,GAAG,CAAC,MAAM,EAAE,GAAG;YACX,IAAI,GAAG,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC;gBAC1B,OAAO,QAAQ,CAAC;oBACZ,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,EAAE,CAAC;wBACjC,MAAM,IAAI,QAAQ,CACd,WAAW,CAAC,GAAG,CAAE,EACjB,iBAAiB,EACjB,sBAAsB,CAAC,GAAG,CAAC,CAC9B,CAAC;oBACN,CAAC;gBACL,CAAC,CAAC;YACN,CAAC;YACD,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,OAAO,SAAS,CAAC;YAC9C,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;gBACnB,OAAO,cAAc,EAAE,CAAC,MAAM,CAAC;YACnC,CAAC;YACD,MAAM,EAAE,GAAG,WAAW,CAAC,GAAW,CAAC,CAAC;YACpC,IAAI,CAAC,EAAE;gBAAE,OAAO,SAAS,CAAC;YAC1B,OAAO,IAAI,QAAQ,CACf,EAAiB,EACjB,iBAAiB,EACjB,sBAAsB,CAAC,GAAW,CAAC,CACtC,CAAC;QACN,CAAC;QACD,OAAO;YACH,OAAO,cAAc,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzD,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
package/src/coValues/coList.ts
CHANGED
@@ -22,7 +22,7 @@ import {
|
|
22
22
|
} from "../internal.js";
|
23
23
|
import { Schema } from "@effect/schema";
|
24
24
|
|
25
|
-
export class CoList<Item extends EnsureItemNullable<Item,
|
25
|
+
export class CoList<Item extends EnsureItemNullable<Item, "Co.List"> = any>
|
26
26
|
extends Array<Item>
|
27
27
|
implements CoValue<"CoList", RawCoList>
|
28
28
|
{
|
@@ -50,6 +50,13 @@ export class CoList<Item extends EnsureItemNullable<Item, 'Co.List'> = any>
|
|
50
50
|
[idx: number]: NonNullable<Item> extends CoValue
|
51
51
|
? ValueRef<NonNullable<Item>>
|
52
52
|
: never;
|
53
|
+
} & {
|
54
|
+
length: number;
|
55
|
+
[Symbol.iterator](): IterableIterator<
|
56
|
+
NonNullable<Item> extends CoValue
|
57
|
+
? ValueRef<NonNullable<Item>>
|
58
|
+
: never
|
59
|
+
>;
|
53
60
|
} {
|
54
61
|
return makeRefs<number>(
|
55
62
|
(idx) => this._raw.get(idx) as unknown as ID<CoValue>,
|
@@ -1,7 +1,15 @@
|
|
1
1
|
import { Effect } from "effect";
|
2
2
|
import type { CoID, RawCoValue } from "cojson";
|
3
|
-
import type {
|
4
|
-
|
3
|
+
import type {
|
4
|
+
Account,
|
5
|
+
CoValue,
|
6
|
+
ID,
|
7
|
+
Me,
|
8
|
+
SubclassedConstructor,
|
9
|
+
UnavailableError,
|
10
|
+
indexSignature,
|
11
|
+
} from "../internal.js";
|
12
|
+
import { subscriptionsScopes } from "../internal.js";
|
5
13
|
|
6
14
|
export class ValueRef<V extends CoValue> {
|
7
15
|
private cachedValue: V | undefined;
|
@@ -19,7 +27,9 @@ export class ValueRef<V extends CoValue> {
|
|
19
27
|
this.id as unknown as CoID<RawCoValue>
|
20
28
|
);
|
21
29
|
if (raw) {
|
22
|
-
const value = new this.valueConstructor(undefined, {
|
30
|
+
const value = new this.valueConstructor(undefined, {
|
31
|
+
fromRaw: raw,
|
32
|
+
}) as V;
|
23
33
|
this.cachedValue = value;
|
24
34
|
return value;
|
25
35
|
} else {
|
@@ -43,7 +53,9 @@ export class ValueRef<V extends CoValue> {
|
|
43
53
|
});
|
44
54
|
}
|
45
55
|
|
46
|
-
private async loadHelper(options?: {
|
56
|
+
private async loadHelper(options?: {
|
57
|
+
onProgress: (p: number) => void;
|
58
|
+
}): Promise<V | "unavailable"> {
|
47
59
|
const raw = await this.controlledAccount._raw.core.node.load(
|
48
60
|
this.id as unknown as CoID<RawCoValue>,
|
49
61
|
options?.onProgress
|
@@ -51,12 +63,17 @@ export class ValueRef<V extends CoValue> {
|
|
51
63
|
if (raw === "unavailable") {
|
52
64
|
return "unavailable";
|
53
65
|
} else {
|
54
|
-
return new ValueRef(
|
55
|
-
.
|
66
|
+
return new ValueRef(
|
67
|
+
this.id,
|
68
|
+
this.controlledAccount,
|
69
|
+
this.valueConstructor
|
70
|
+
).value!;
|
56
71
|
}
|
57
72
|
}
|
58
73
|
|
59
|
-
async load(options?: {
|
74
|
+
async load(options?: {
|
75
|
+
onProgress: (p: number) => void;
|
76
|
+
}): Promise<V | undefined> {
|
60
77
|
const result = await this.loadHelper(options);
|
61
78
|
if (result === "unavailable") {
|
62
79
|
return undefined;
|
@@ -82,9 +99,15 @@ export function makeRefs<Keys extends string | number | indexSignature>(
|
|
82
99
|
getIdForKey: (key: Keys) => ID<CoValue> | undefined,
|
83
100
|
getKeysWithIds: () => Keys[],
|
84
101
|
controlledAccount: Account & Me,
|
85
|
-
valueConstructorForKey: (key: Keys) => SubclassedConstructor<CoValue
|
86
|
-
): { [K in Keys]: ValueRef<CoValue> } {
|
87
|
-
|
102
|
+
valueConstructorForKey: (key: Keys) => SubclassedConstructor<CoValue>
|
103
|
+
): { [K in Keys]: ValueRef<CoValue> } & {
|
104
|
+
[Symbol.iterator]: () => IterableIterator<ValueRef<CoValue>>;
|
105
|
+
length: number;
|
106
|
+
} {
|
107
|
+
const refs = {} as { [K in Keys]: ValueRef<CoValue> } & {
|
108
|
+
[Symbol.iterator]: () => IterableIterator<ValueRef<CoValue>>;
|
109
|
+
length: number;
|
110
|
+
};
|
88
111
|
return new Proxy(refs, {
|
89
112
|
get(target, key) {
|
90
113
|
if (key === Symbol.iterator) {
|