jazz-tools 0.7.0-alpha.0 → 0.7.0-alpha.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. package/.eslintrc.cjs +8 -1
  2. package/.turbo/turbo-build.log +79 -9
  3. package/CHANGELOG.md +76 -0
  4. package/dist/coValues/account.js +171 -0
  5. package/dist/coValues/account.js.map +1 -0
  6. package/dist/coValues/coList.js +246 -0
  7. package/dist/coValues/coList.js.map +1 -0
  8. package/dist/coValues/coMap.js +235 -0
  9. package/dist/coValues/coMap.js.map +1 -0
  10. package/dist/coValues/coStream.js +263 -0
  11. package/dist/coValues/coStream.js.map +1 -0
  12. package/dist/coValues/extensions/imageDef.js +14 -11
  13. package/dist/coValues/extensions/imageDef.js.map +1 -1
  14. package/dist/coValues/group.js +71 -0
  15. package/dist/coValues/group.js.map +1 -0
  16. package/dist/coValues/interfaces.js +61 -0
  17. package/dist/coValues/interfaces.js.map +1 -0
  18. package/dist/implementation/errors.js.map +1 -0
  19. package/dist/implementation/inspect.js +2 -0
  20. package/dist/implementation/inspect.js.map +1 -0
  21. package/dist/{refs.js → implementation/refs.js} +16 -15
  22. package/dist/implementation/refs.js.map +1 -0
  23. package/dist/implementation/schema.js +41 -0
  24. package/dist/implementation/schema.js.map +1 -0
  25. package/dist/{subscriptionScope.js → implementation/subscriptionScope.js} +1 -1
  26. package/dist/implementation/subscriptionScope.js.map +1 -0
  27. package/dist/index.js +10 -29
  28. package/dist/index.js.map +1 -1
  29. package/dist/internal.js +13 -0
  30. package/dist/internal.js.map +1 -0
  31. package/dist/tests/coList.test.js +22 -22
  32. package/dist/tests/coList.test.js.map +1 -1
  33. package/dist/tests/coMap.test.js +140 -46
  34. package/dist/tests/coMap.test.js.map +1 -1
  35. package/dist/tests/coStream.test.js +55 -49
  36. package/dist/tests/coStream.test.js.map +1 -1
  37. package/package.json +11 -4
  38. package/src/coValues/account.ts +327 -0
  39. package/src/coValues/coList.ts +391 -0
  40. package/src/coValues/coMap.ts +413 -0
  41. package/src/coValues/coStream.ts +404 -0
  42. package/src/coValues/extensions/imageDef.ts +20 -16
  43. package/src/coValues/group.ts +139 -0
  44. package/src/coValues/interfaces.ts +218 -0
  45. package/src/implementation/inspect.ts +2 -0
  46. package/src/{refs.ts → implementation/refs.ts} +53 -39
  47. package/src/implementation/schema.ts +124 -0
  48. package/src/{subscriptionScope.ts → implementation/subscriptionScope.ts} +11 -13
  49. package/src/index.ts +14 -57
  50. package/src/internal.ts +15 -0
  51. package/src/tests/coList.test.ts +23 -25
  52. package/src/tests/coMap.test.ts +140 -53
  53. package/src/tests/coStream.test.ts +76 -68
  54. package/dist/coValueInterfaces.js +0 -8
  55. package/dist/coValueInterfaces.js.map +0 -1
  56. package/dist/coValues/account/account.js +0 -11
  57. package/dist/coValues/account/account.js.map +0 -1
  58. package/dist/coValues/account/accountOf.js +0 -150
  59. package/dist/coValues/account/accountOf.js.map +0 -1
  60. package/dist/coValues/account/migration.js +0 -4
  61. package/dist/coValues/account/migration.js.map +0 -1
  62. package/dist/coValues/coList/coList.js +0 -2
  63. package/dist/coValues/coList/coList.js.map +0 -1
  64. package/dist/coValues/coList/coListOf.js +0 -235
  65. package/dist/coValues/coList/coListOf.js.map +0 -1
  66. package/dist/coValues/coList/internalDocs.js +0 -2
  67. package/dist/coValues/coList/internalDocs.js.map +0 -1
  68. package/dist/coValues/coMap/coMap.js +0 -2
  69. package/dist/coValues/coMap/coMap.js.map +0 -1
  70. package/dist/coValues/coMap/coMapOf.js +0 -262
  71. package/dist/coValues/coMap/coMapOf.js.map +0 -1
  72. package/dist/coValues/coMap/internalDocs.js +0 -2
  73. package/dist/coValues/coMap/internalDocs.js.map +0 -1
  74. package/dist/coValues/coStream/coStream.js +0 -2
  75. package/dist/coValues/coStream/coStream.js.map +0 -1
  76. package/dist/coValues/coStream/coStreamOf.js +0 -244
  77. package/dist/coValues/coStream/coStreamOf.js.map +0 -1
  78. package/dist/coValues/construction.js +0 -34
  79. package/dist/coValues/construction.js.map +0 -1
  80. package/dist/coValues/group/group.js +0 -2
  81. package/dist/coValues/group/group.js.map +0 -1
  82. package/dist/coValues/group/groupOf.js +0 -109
  83. package/dist/coValues/group/groupOf.js.map +0 -1
  84. package/dist/coValues/resolution.js +0 -66
  85. package/dist/coValues/resolution.js.map +0 -1
  86. package/dist/errors.js.map +0 -1
  87. package/dist/refs.js.map +0 -1
  88. package/dist/schemaHelpers.js +0 -14
  89. package/dist/schemaHelpers.js.map +0 -1
  90. package/dist/subscriptionScope.js.map +0 -1
  91. package/dist/tests/types.test.js +0 -33
  92. package/dist/tests/types.test.js.map +0 -1
  93. package/src/coValueInterfaces.ts +0 -105
  94. package/src/coValues/account/account.ts +0 -106
  95. package/src/coValues/account/accountOf.ts +0 -284
  96. package/src/coValues/account/migration.ts +0 -12
  97. package/src/coValues/coList/coList.ts +0 -57
  98. package/src/coValues/coList/coListOf.ts +0 -377
  99. package/src/coValues/coList/internalDocs.ts +0 -1
  100. package/src/coValues/coMap/coMap.ts +0 -110
  101. package/src/coValues/coMap/coMapOf.ts +0 -451
  102. package/src/coValues/coMap/internalDocs.ts +0 -1
  103. package/src/coValues/coStream/coStream.ts +0 -63
  104. package/src/coValues/coStream/coStreamOf.ts +0 -404
  105. package/src/coValues/construction.ts +0 -110
  106. package/src/coValues/group/group.ts +0 -27
  107. package/src/coValues/group/groupOf.ts +0 -183
  108. package/src/coValues/resolution.ts +0 -111
  109. package/src/schemaHelpers.ts +0 -72
  110. package/src/tests/types.test.ts +0 -37
  111. /package/dist/{errors.js → implementation/errors.js} +0 -0
  112. /package/src/{errors.ts → implementation/errors.ts} +0 -0
@@ -0,0 +1,235 @@
1
+ var _a;
2
+ import { Schema as EffectSchema } from "@effect/schema";
3
+ import { Account, CoValueBase, Ref, SchemaInit, inspect, makeRefs, subscriptionsScopes, ItemsSym, InitValues, isRefEncoded, } from "../internal.js";
4
+ export class CoMap extends CoValueBase {
5
+ get _schema() {
6
+ return this.constructor
7
+ ._schema;
8
+ }
9
+ get _refs() {
10
+ return makeRefs((key) => this._raw.get(key), () => Object.keys(this._schema).filter((key) => {
11
+ const schema = this._schema[key];
12
+ schema !== "json" && isRefEncoded(schema);
13
+ }), this._loadedAs, (key) => this._schema[key]);
14
+ }
15
+ get _edits() {
16
+ return new Proxy(this, {
17
+ get(target, key) {
18
+ const rawEdit = target._raw.lastEditAt(key);
19
+ if (!rawEdit)
20
+ return undefined;
21
+ const descriptor = target._schema[key];
22
+ return {
23
+ value: descriptor === "json"
24
+ ? rawEdit.value
25
+ : "encoded" in descriptor
26
+ ? EffectSchema.decodeSync(descriptor.encoded)(rawEdit.value)
27
+ : new Ref(rawEdit.value, target._loadedAs, descriptor).accessFrom(target),
28
+ ref: descriptor !== "json" && isRefEncoded(descriptor)
29
+ ? new Ref(rawEdit.value, target._loadedAs, descriptor)
30
+ : undefined,
31
+ by: rawEdit.by &&
32
+ new Ref(rawEdit.by, target._loadedAs, Account).accessFrom(target),
33
+ madeAt: rawEdit.at,
34
+ };
35
+ },
36
+ });
37
+ }
38
+ get _loadedAs() {
39
+ return Account.fromNode(this._raw.core.node);
40
+ }
41
+ constructor(init, options) {
42
+ super();
43
+ if (init && "owner" in options) {
44
+ this[InitValues] = {
45
+ init,
46
+ owner: options.owner,
47
+ };
48
+ }
49
+ else if ("fromRaw" in options) {
50
+ Object.defineProperties(this, {
51
+ id: {
52
+ value: options.fromRaw.id,
53
+ enumerable: false,
54
+ },
55
+ _raw: { value: options.fromRaw, enumerable: false },
56
+ });
57
+ }
58
+ else {
59
+ throw new Error("Invalid CoMap constructor arguments");
60
+ }
61
+ return new Proxy(this, CoMapProxyHandler);
62
+ }
63
+ toJSON() {
64
+ const jsonedFields = this._raw.keys().map((key) => {
65
+ const tKey = key;
66
+ const descriptor = this._schema[tKey];
67
+ if (descriptor == "json" || "encode" in descriptor) {
68
+ return [key, this._raw.get(key)];
69
+ }
70
+ else if (isRefEncoded(descriptor)) {
71
+ const jsonedRef = this[tKey]?.toJSON();
72
+ return [key, jsonedRef];
73
+ }
74
+ else {
75
+ return [key, undefined];
76
+ }
77
+ });
78
+ return {
79
+ id: this.id,
80
+ _type: this._type,
81
+ ...Object.fromEntries(jsonedFields),
82
+ };
83
+ }
84
+ [inspect]() {
85
+ return this.toJSON();
86
+ }
87
+ rawFromInit(init, owner) {
88
+ const rawOwner = owner._raw;
89
+ const rawInit = {};
90
+ if (init)
91
+ for (const key of Object.keys(init)) {
92
+ const initValue = init[key];
93
+ const descriptor = (this._schema[key] || this._schema[ItemsSym]);
94
+ if (descriptor === "json") {
95
+ rawInit[key] = initValue;
96
+ }
97
+ else if (isRefEncoded(descriptor)) {
98
+ if (initValue) {
99
+ rawInit[key] = initValue.id;
100
+ }
101
+ }
102
+ else if ("encoded" in descriptor) {
103
+ rawInit[key] = EffectSchema.encodeSync(descriptor.encoded)(initValue);
104
+ }
105
+ }
106
+ return rawOwner.createMap(rawInit);
107
+ }
108
+ }
109
+ _a = CoMap;
110
+ (() => {
111
+ _a.prototype._type = "CoMap";
112
+ })();
113
+ function tryInit(map) {
114
+ if (map[InitValues] &&
115
+ (map._schema[ItemsSym] ||
116
+ Object.keys(map[InitValues].init).every((key) => map._schema[key]))) {
117
+ const raw = map.rawFromInit(map[InitValues].init, map[InitValues].owner);
118
+ Object.defineProperties(map, {
119
+ id: {
120
+ value: raw.id,
121
+ enumerable: false,
122
+ },
123
+ _raw: { value: raw, enumerable: false },
124
+ });
125
+ delete map[InitValues];
126
+ }
127
+ }
128
+ // TODO: cache handlers per descriptor for performance?
129
+ const CoMapProxyHandler = {
130
+ get(target, key, receiver) {
131
+ if (key === "_schema") {
132
+ return Reflect.get(target, key);
133
+ }
134
+ else if (key in target) {
135
+ return Reflect.get(target, key, receiver);
136
+ }
137
+ else {
138
+ const descriptor = (target._schema[key] || target._schema[ItemsSym]);
139
+ if (descriptor && typeof key === "string") {
140
+ const raw = target._raw.get(key);
141
+ if (descriptor === "json") {
142
+ return raw;
143
+ }
144
+ else if ("encoded" in descriptor) {
145
+ return raw === undefined
146
+ ? undefined
147
+ : EffectSchema.decodeSync(descriptor.encoded)(raw);
148
+ }
149
+ else if (isRefEncoded(descriptor)) {
150
+ return raw === undefined
151
+ ? undefined
152
+ : new Ref(raw, target._loadedAs, descriptor).accessFrom(receiver);
153
+ }
154
+ }
155
+ else {
156
+ return undefined;
157
+ }
158
+ }
159
+ },
160
+ set(target, key, value, receiver) {
161
+ var _b;
162
+ if ((typeof key === "string" || ItemsSym) &&
163
+ typeof value === "object" &&
164
+ SchemaInit in value) {
165
+ (_b = target.constructor)._schema || (_b._schema = {});
166
+ target.constructor._schema[key] =
167
+ value[SchemaInit];
168
+ tryInit(target);
169
+ return true;
170
+ }
171
+ const descriptor = (target._schema[key] ||
172
+ target._schema[ItemsSym]);
173
+ if (descriptor && typeof key === "string") {
174
+ if (descriptor === "json") {
175
+ target._raw.set(key, value);
176
+ }
177
+ else if ("encoded" in descriptor) {
178
+ target._raw.set(key, EffectSchema.encodeSync(descriptor.encoded)(value));
179
+ }
180
+ else if (isRefEncoded(descriptor)) {
181
+ target._raw.set(key, value.id);
182
+ subscriptionsScopes.get(target)?.onRefAccessedOrSet(value.id);
183
+ }
184
+ return true;
185
+ }
186
+ else {
187
+ return Reflect.set(target, key, value, receiver);
188
+ }
189
+ },
190
+ defineProperty(target, key, attributes) {
191
+ var _b;
192
+ if ("value" in attributes &&
193
+ typeof attributes.value === "object" &&
194
+ SchemaInit in attributes.value) {
195
+ (_b = target.constructor)._schema || (_b._schema = {});
196
+ target.constructor._schema[key] =
197
+ attributes.value[SchemaInit];
198
+ tryInit(target);
199
+ return true;
200
+ }
201
+ else {
202
+ return Reflect.defineProperty(target, key, attributes);
203
+ }
204
+ },
205
+ ownKeys(target) {
206
+ const keys = Reflect.ownKeys(target).filter((k) => k !== ItemsSym);
207
+ for (const key of Reflect.ownKeys(target._schema)) {
208
+ if (key !== ItemsSym && !keys.includes(key)) {
209
+ keys.push(key);
210
+ }
211
+ }
212
+ for (const key of target._raw.keys()) {
213
+ if (!keys.includes(key)) {
214
+ keys.push(key);
215
+ }
216
+ }
217
+ return keys;
218
+ },
219
+ getOwnPropertyDescriptor(target, key) {
220
+ if (key in target) {
221
+ return Reflect.getOwnPropertyDescriptor(target, key);
222
+ }
223
+ else {
224
+ const descriptor = (target._schema[key] || target._schema[ItemsSym]);
225
+ if (descriptor || key in target._raw.ops) {
226
+ return {
227
+ enumerable: true,
228
+ configurable: true,
229
+ writable: true,
230
+ };
231
+ }
232
+ }
233
+ },
234
+ };
235
+ //# sourceMappingURL=coMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../src/coValues/coMap.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAWxD,OAAO,EACH,OAAO,EACP,WAAW,EACX,GAAG,EACH,UAAU,EACV,OAAO,EACP,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,YAAY,GACf,MAAM,gBAAgB,CAAC;AAwDxB,MAAM,OAAO,KACT,SAAQ,WAAW;IAWnB,IAAI,OAAO;QACP,OAAQ,IAAI,CAAC,WAA4B;aACpC,OAA4B,CAAC;IACtC,CAAC;IAED,IAAI,KAAK;QAOL,OAAO,QAAQ,CACX,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAa,CAA2B,EAC/D,GAAG,EAAE,CACD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;YACrC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CACvB,GAAgC,CACzB,CAAC;YACZ,MAAM,KAAK,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC,CAAsB,EAC3B,IAAI,CAAC,SAAS,EACd,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAwB,CAC7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CAAC,GAAG,EAAE,CAAC;gBACvC,OAAO;oBACH,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,IAAI;oBAClB,QAAQ,EAAE,IAAI;iBACjB,CAAC;YACN,CAAC;QACL,CAAC;IACL,CAAC;CACJ,CAAC"}
@@ -0,0 +1,263 @@
1
+ var _a;
2
+ import { cojsonInternals } from "cojson";
3
+ import { ItemsSym, Account, CoValueBase, Ref, inspect, co, InitValues, SchemaInit, isRefEncoded, } from "../internal.js";
4
+ import { Schema as EffectSchema } from "@effect/schema";
5
+ export class CoStream extends CoValueBase {
6
+ static Of(item) {
7
+ var _b, _c;
8
+ return _c = class CoStreamOf extends _a {
9
+ constructor() {
10
+ super(...arguments);
11
+ this[_b] = item;
12
+ }
13
+ },
14
+ _b = co.items,
15
+ _c;
16
+ }
17
+ get _schema() {
18
+ return this.constructor._schema;
19
+ }
20
+ get byMe() {
21
+ return this[this._loadedAs.id];
22
+ }
23
+ get inCurrentSession() {
24
+ return this.perSession[this._loadedAs.sessionID];
25
+ }
26
+ constructor(init, options) {
27
+ super();
28
+ if ("fromRaw" in options) {
29
+ Object.defineProperties(this, {
30
+ id: {
31
+ value: options.fromRaw.id,
32
+ enumerable: false,
33
+ },
34
+ _raw: { value: options.fromRaw, enumerable: false },
35
+ });
36
+ }
37
+ else {
38
+ this[InitValues] = {
39
+ init,
40
+ owner: options.owner,
41
+ };
42
+ }
43
+ return new Proxy(this, CoStreamProxyHandler);
44
+ }
45
+ push(...items) {
46
+ for (const item of items) {
47
+ this.pushItem(item);
48
+ }
49
+ }
50
+ pushItem(item) {
51
+ const itemDescriptor = this._schema[ItemsSym];
52
+ if (itemDescriptor === "json") {
53
+ this._raw.push(item);
54
+ }
55
+ else if ("encoded" in itemDescriptor) {
56
+ this._raw.push(EffectSchema.encodeSync(itemDescriptor.encoded)(item));
57
+ }
58
+ else if (isRefEncoded(itemDescriptor)) {
59
+ this._raw.push(item.id);
60
+ }
61
+ }
62
+ toJSON() {
63
+ const itemDescriptor = this._schema[ItemsSym];
64
+ const mapper = itemDescriptor === "json"
65
+ ? (v) => v
66
+ : "encoded" in itemDescriptor
67
+ ? EffectSchema.encodeSync(itemDescriptor.encoded)
68
+ : (v) => v && v.id;
69
+ return {
70
+ id: this.id,
71
+ _type: this._type,
72
+ ...Object.fromEntries(Object.entries(this).map(([account, entry]) => [
73
+ account,
74
+ mapper(entry.value),
75
+ ])),
76
+ in: Object.fromEntries(Object.entries(this.perSession).map(([session, entry]) => [
77
+ session,
78
+ mapper(entry.value),
79
+ ])),
80
+ };
81
+ }
82
+ [inspect]() {
83
+ return this.toJSON();
84
+ }
85
+ static schema(def) {
86
+ this._schema || (this._schema = {});
87
+ Object.assign(this._schema, def);
88
+ }
89
+ }
90
+ _a = CoStream;
91
+ (() => {
92
+ _a.prototype._type = "CoStream";
93
+ })();
94
+ function entryFromRawEntry(accessFrom, rawEntry, loadedAs, accountID, itemField) {
95
+ return {
96
+ get value() {
97
+ if (itemField === "json") {
98
+ return rawEntry.value;
99
+ }
100
+ else if ("encoded" in itemField) {
101
+ return EffectSchema.decodeSync(itemField.encoded)(rawEntry.value);
102
+ }
103
+ else if (isRefEncoded(itemField)) {
104
+ return this.ref?.accessFrom(accessFrom);
105
+ }
106
+ },
107
+ get ref() {
108
+ if (itemField !== "json" && isRefEncoded(itemField)) {
109
+ const rawId = rawEntry.value;
110
+ return new Ref(rawId, loadedAs, itemField);
111
+ }
112
+ },
113
+ get by() {
114
+ return (accountID &&
115
+ new Ref(accountID, loadedAs, Account)?.accessFrom(accessFrom));
116
+ },
117
+ madeAt: rawEntry.at,
118
+ tx: rawEntry.tx,
119
+ };
120
+ }
121
+ function init(stream) {
122
+ const init = stream[InitValues];
123
+ if (!init)
124
+ return;
125
+ const raw = init.owner._raw.createStream();
126
+ Object.defineProperties(stream, {
127
+ id: {
128
+ value: raw.id,
129
+ enumerable: false,
130
+ },
131
+ _raw: { value: raw, enumerable: false },
132
+ });
133
+ if (init.init) {
134
+ stream.push(...init.init);
135
+ }
136
+ delete stream[InitValues];
137
+ }
138
+ export const CoStreamProxyHandler = {
139
+ get(target, key, receiver) {
140
+ if (typeof key === "string" && key.startsWith("co_")) {
141
+ const rawEntry = target._raw.lastItemBy(key);
142
+ if (!rawEntry)
143
+ return;
144
+ return entryFromRawEntry(receiver, rawEntry, target._loadedAs, key, target._schema[ItemsSym]);
145
+ }
146
+ else if (key === "perSession") {
147
+ return new Proxy(receiver, CoStreamPerSessionProxyHandler);
148
+ }
149
+ else {
150
+ return Reflect.get(target, key, receiver);
151
+ }
152
+ },
153
+ set(target, key, value, receiver) {
154
+ var _b;
155
+ if (key === ItemsSym &&
156
+ typeof value === "object" &&
157
+ SchemaInit in value) {
158
+ (_b = target.constructor)._schema || (_b._schema = {});
159
+ target.constructor._schema[ItemsSym] =
160
+ value[SchemaInit];
161
+ init(target);
162
+ return true;
163
+ }
164
+ else {
165
+ return Reflect.set(target, key, value, receiver);
166
+ }
167
+ },
168
+ defineProperty(target, key, descriptor) {
169
+ var _b;
170
+ if (descriptor.value &&
171
+ key === ItemsSym &&
172
+ typeof descriptor.value === "object" &&
173
+ SchemaInit in descriptor.value) {
174
+ (_b = target.constructor)._schema || (_b._schema = {});
175
+ target.constructor._schema[ItemsSym] =
176
+ descriptor.value[SchemaInit];
177
+ init(target);
178
+ return true;
179
+ }
180
+ else {
181
+ return Reflect.defineProperty(target, key, descriptor);
182
+ }
183
+ },
184
+ ownKeys(target) {
185
+ const keys = Reflect.ownKeys(target);
186
+ for (const accountID of target._raw.accounts()) {
187
+ keys.push(accountID);
188
+ }
189
+ return keys;
190
+ },
191
+ getOwnPropertyDescriptor(target, key) {
192
+ if (typeof key === "string" && key.startsWith("co_")) {
193
+ return {
194
+ configurable: true,
195
+ enumerable: true,
196
+ writable: false,
197
+ };
198
+ }
199
+ else {
200
+ return Reflect.getOwnPropertyDescriptor(target, key);
201
+ }
202
+ },
203
+ };
204
+ const CoStreamPerSessionProxyHandler = {
205
+ get(target, key, receiver) {
206
+ if (typeof key === "string" && key.includes("session")) {
207
+ const sessionID = key;
208
+ const rawEntry = target._raw.lastItemIn(sessionID);
209
+ if (!rawEntry)
210
+ return;
211
+ const by = cojsonInternals.accountOrAgentIDfromSessionID(sessionID);
212
+ return entryFromRawEntry(target, rawEntry, target._loadedAs, cojsonInternals.isAccountID(by)
213
+ ? by
214
+ : undefined, target._schema[ItemsSym]);
215
+ }
216
+ else {
217
+ return Reflect.get(target, key, receiver);
218
+ }
219
+ },
220
+ };
221
+ export class BinaryCoStream extends CoValueBase {
222
+ constructor(_init, options) {
223
+ super();
224
+ let raw;
225
+ if ("fromRaw" in options) {
226
+ raw = options.fromRaw;
227
+ }
228
+ else {
229
+ const rawOwner = options.owner._raw;
230
+ raw = rawOwner.createBinaryStream();
231
+ }
232
+ Object.defineProperties(this, {
233
+ id: {
234
+ value: raw.id,
235
+ enumerable: false,
236
+ },
237
+ _raw: { value: raw, enumerable: false },
238
+ });
239
+ }
240
+ getChunks(options) {
241
+ return this._raw.getBinaryChunks(options?.allowUnfinished);
242
+ }
243
+ start(options) {
244
+ this._raw.startBinaryStream(options);
245
+ }
246
+ push(data) {
247
+ this._raw.pushBinaryStreamChunk(data);
248
+ }
249
+ end() {
250
+ this._raw.endBinaryStream();
251
+ }
252
+ toJSON() {
253
+ return {
254
+ id: this.id,
255
+ _type: this._type,
256
+ ...this.getChunks(),
257
+ };
258
+ }
259
+ [inspect]() {
260
+ return this.toJSON();
261
+ }
262
+ }
263
+ //# sourceMappingURL=coStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coStream.js","sourceRoot":"","sources":["../../src/coValues/coStream.ts"],"names":[],"mappings":";AAUA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAWzC,OAAO,EACH,QAAQ,EACR,OAAO,EACP,WAAW,EACX,GAAG,EACH,OAAO,EACP,EAAE,EACF,UAAU,EACV,UAAU,EACV,YAAY,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EA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,CAAC,CAAC;IAC1C,CAAC;IAED,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAED,MAAM;QACF,OAAO;YACH,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,IAAI,CAAC,SAAS,EAAE;SACtB,CAAC;IACN,CAAC;IAED,CAAC,OAAO,CAAC;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;CACJ"}
@@ -1,14 +1,12 @@
1
- import * as S from "@effect/schema/Schema";
2
- import { CoMapOf } from "../coMap/coMapOf.js";
3
- import { BinaryCoStreamImpl } from "../coStream/coStreamOf.js";
4
- import { subscriptionsScopes } from "../../subscriptionScope.js";
5
- export class ImageDefinition extends CoMapOf({
6
- originalSize: S.tuple(S.number, S.number),
7
- placeholderDataURL: S.optional(S.string),
8
- }, {
9
- key: S.templateLiteral(S.string, S.literal("x"), S.string),
10
- value: BinaryCoStreamImpl,
11
- }).as() {
1
+ var _a;
2
+ import { BinaryCoStream, CoMap, co, subscriptionsScopes, } from "../../internal.js";
3
+ export class ImageDefinition extends CoMap {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.originalSize = co.json();
7
+ this.placeholderDataURL = co.string;
8
+ this[_a] = co.ref(BinaryCoStream);
9
+ }
12
10
  get highestResAvailable() {
13
11
  if (!subscriptionsScopes.get(this)) {
14
12
  console.warn("highestResAvailable() only makes sense when used within a subscription.");
@@ -31,6 +29,11 @@ export class ImageDefinition extends CoMapOf({
31
29
  });
32
30
  }
33
31
  }
32
+ return (highestAvailableResolution && {
33
+ res: highestAvailableResolution,
34
+ stream: this[highestAvailableResolution],
35
+ });
34
36
  }
35
37
  }
38
+ _a = co.items;
36
39
  //# sourceMappingURL=imageDef.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"imageDef.js","sourceRoot":"","sources":["../../../src/coValues/extensions/imageDef.ts"],"names":[],"mappings":"AAAA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C,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,OAAO,MAAM,GAAG,MAAM,CAAC;QAC3B,CAAC,CAAC,CAAC;QAEH,IAAI,0BAA6D,CAAC;QAElE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC;gBACpD,0BAA0B,GAAG,UAAU,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACJ,OAAO,CACH,0BAA0B,IAAI;oBAC1B,GAAG,EAAE,0BAA0B;oBAC/B,MAAM,EAAE,IAAI,CAAC,0BAA0B,CAAE;iBAC5C,CACJ,CAAC;YACN,CAAC;QACL,CAAC;QACD,OAAO,CACH,0BAA0B,IAAI;YAC1B,GAAG,EAAE,0BAA0B;YAC/B,MAAM,EAAE,IAAI,CAAC,0BAA0B,CAAE;SAC5C,CACJ,CAAC;IACN,CAAC;CACJ;KA3CI,EAAE,CAAC,KAAK"}
@@ -0,0 +1,71 @@
1
+ var _a;
2
+ import { Account, CoMap, CoValueBase, Ref, co, isControlledAccount, AccountAndGroupProxyHandler, } from "../internal.js";
3
+ export class Profile extends CoMap {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.name = co.string;
7
+ }
8
+ }
9
+ export class Group extends CoValueBase {
10
+ get _schema() {
11
+ return this.constructor._schema;
12
+ }
13
+ get _refs() {
14
+ const profileID = this._raw.get("profile");
15
+ const rootID = this._raw.get("root");
16
+ return {
17
+ profile: profileID &&
18
+ new Ref(profileID, this._loadedAs, this._schema.profile),
19
+ root: rootID &&
20
+ new Ref(rootID, this._loadedAs, this._schema.root),
21
+ };
22
+ }
23
+ constructor(init, options) {
24
+ super();
25
+ let raw;
26
+ if (options && "fromRaw" in options) {
27
+ raw = options.fromRaw;
28
+ }
29
+ else {
30
+ const initOwner = options?.owner || init?.owner;
31
+ if (!initOwner)
32
+ throw new Error("No owner provided");
33
+ if (initOwner instanceof Account &&
34
+ isControlledAccount(initOwner)) {
35
+ const rawOwner = initOwner._raw;
36
+ raw = rawOwner.createGroup();
37
+ }
38
+ else {
39
+ throw new Error("Can only construct group as a controlled account");
40
+ }
41
+ }
42
+ Object.defineProperties(this, {
43
+ id: {
44
+ value: raw.id,
45
+ enumerable: false,
46
+ },
47
+ _raw: { value: raw, enumerable: false },
48
+ });
49
+ return new Proxy(this, AccountAndGroupProxyHandler);
50
+ }
51
+ myRole() {
52
+ return this._raw.myRole();
53
+ }
54
+ addMember(member, role) {
55
+ this._raw.addMember(member === "everyone" ? member : member._raw, role);
56
+ }
57
+ }
58
+ _a = Group;
59
+ (() => {
60
+ _a.prototype._type = "Group";
61
+ })();
62
+ (() => {
63
+ _a._schema = {
64
+ profile: { json: true },
65
+ root: { json: true },
66
+ };
67
+ Object.defineProperty(_a.prototype, "_schema", {
68
+ get: () => _a._schema,
69
+ });
70
+ })();
71
+ //# sourceMappingURL=group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"group.js","sourceRoot":"","sources":["../../src/coValues/group.ts"],"names":[],"mappings":";AAEA,OAAO,EACH,OAAO,EACP,KAAK,EACL,WAAW,EACX,GAAG,EACH,EAAE,EACF,mBAAmB,EACnB,2BAA2B,GAC9B,MAAM,gBAAgB,CAAC;AAExB,MAAM,OAAO,OAAQ,SAAQ,KAA2B;IAAxD;;QACI,SAAI,GAAG,EAAE,CAAC,MAAM,CAAC;IACrB,CAAC;CAAA;AAED,MAAM,OAAO,KAMT,SAAQ,WAAW;IAWnB,IAAI,OAAO;QAQP,OAAQ,IAAI,CAAC,WAA4B,CAAC,OAAO,CAAC;IACtD,CAAC;IAiBD,IAAI,KAAK;QAIL,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS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