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.
Files changed (111) hide show
  1. package/.eslintrc.cjs +8 -1
  2. package/CHANGELOG.md +8 -0
  3. package/dist/coValues/account.js +138 -0
  4. package/dist/coValues/account.js.map +1 -0
  5. package/dist/coValues/coList.js +196 -0
  6. package/dist/coValues/coList.js.map +1 -0
  7. package/dist/coValues/coMap.js +249 -0
  8. package/dist/coValues/coMap.js.map +1 -0
  9. package/dist/coValues/coStream.js +189 -0
  10. package/dist/coValues/coStream.js.map +1 -0
  11. package/dist/coValues/extensions/imageDef.js +17 -12
  12. package/dist/coValues/extensions/imageDef.js.map +1 -1
  13. package/dist/coValues/group.js +96 -0
  14. package/dist/coValues/group.js.map +1 -0
  15. package/dist/coValues/interfaces.js +58 -0
  16. package/dist/coValues/interfaces.js.map +1 -0
  17. package/dist/implementation/errors.js.map +1 -0
  18. package/dist/implementation/inspect.js +2 -0
  19. package/dist/implementation/inspect.js.map +1 -0
  20. package/dist/{refs.js → implementation/refs.js} +11 -13
  21. package/dist/implementation/refs.js.map +1 -0
  22. package/dist/implementation/schema.js +6 -0
  23. package/dist/implementation/schema.js.map +1 -0
  24. package/dist/{subscriptionScope.js → implementation/subscriptionScope.js} +1 -1
  25. package/dist/implementation/subscriptionScope.js.map +1 -0
  26. package/dist/index.js +23 -27
  27. package/dist/index.js.map +1 -1
  28. package/dist/internal.js +13 -0
  29. package/dist/internal.js.map +1 -0
  30. package/dist/tests/coList.test.js +26 -22
  31. package/dist/tests/coList.test.js.map +1 -1
  32. package/dist/tests/coMap.test.js +91 -43
  33. package/dist/tests/coMap.test.js.map +1 -1
  34. package/dist/tests/coStream.test.js +35 -24
  35. package/dist/tests/coStream.test.js.map +1 -1
  36. package/package.json +11 -4
  37. package/src/coValues/account.ts +297 -0
  38. package/src/coValues/coList.ts +320 -0
  39. package/src/coValues/coMap.ts +447 -0
  40. package/src/coValues/coStream.ts +325 -0
  41. package/src/coValues/extensions/imageDef.ts +24 -16
  42. package/src/coValues/group.ts +187 -0
  43. package/src/coValues/interfaces.ts +216 -0
  44. package/src/implementation/inspect.ts +2 -0
  45. package/src/{refs.ts → implementation/refs.ts} +21 -32
  46. package/src/implementation/schema.ts +69 -0
  47. package/src/{subscriptionScope.ts → implementation/subscriptionScope.ts} +11 -13
  48. package/src/index.ts +22 -50
  49. package/src/internal.ts +15 -0
  50. package/src/tests/coList.test.ts +27 -25
  51. package/src/tests/coMap.test.ts +125 -50
  52. package/src/tests/coStream.test.ts +51 -38
  53. package/dist/coValueInterfaces.js +0 -8
  54. package/dist/coValueInterfaces.js.map +0 -1
  55. package/dist/coValues/account/account.js +0 -11
  56. package/dist/coValues/account/account.js.map +0 -1
  57. package/dist/coValues/account/accountOf.js +0 -150
  58. package/dist/coValues/account/accountOf.js.map +0 -1
  59. package/dist/coValues/account/migration.js +0 -4
  60. package/dist/coValues/account/migration.js.map +0 -1
  61. package/dist/coValues/coList/coList.js +0 -2
  62. package/dist/coValues/coList/coList.js.map +0 -1
  63. package/dist/coValues/coList/coListOf.js +0 -235
  64. package/dist/coValues/coList/coListOf.js.map +0 -1
  65. package/dist/coValues/coList/internalDocs.js +0 -2
  66. package/dist/coValues/coList/internalDocs.js.map +0 -1
  67. package/dist/coValues/coMap/coMap.js +0 -2
  68. package/dist/coValues/coMap/coMap.js.map +0 -1
  69. package/dist/coValues/coMap/coMapOf.js +0 -262
  70. package/dist/coValues/coMap/coMapOf.js.map +0 -1
  71. package/dist/coValues/coMap/internalDocs.js +0 -2
  72. package/dist/coValues/coMap/internalDocs.js.map +0 -1
  73. package/dist/coValues/coStream/coStream.js +0 -2
  74. package/dist/coValues/coStream/coStream.js.map +0 -1
  75. package/dist/coValues/coStream/coStreamOf.js +0 -244
  76. package/dist/coValues/coStream/coStreamOf.js.map +0 -1
  77. package/dist/coValues/construction.js +0 -34
  78. package/dist/coValues/construction.js.map +0 -1
  79. package/dist/coValues/group/group.js +0 -2
  80. package/dist/coValues/group/group.js.map +0 -1
  81. package/dist/coValues/group/groupOf.js +0 -109
  82. package/dist/coValues/group/groupOf.js.map +0 -1
  83. package/dist/coValues/resolution.js +0 -66
  84. package/dist/coValues/resolution.js.map +0 -1
  85. package/dist/errors.js.map +0 -1
  86. package/dist/refs.js.map +0 -1
  87. package/dist/schemaHelpers.js +0 -14
  88. package/dist/schemaHelpers.js.map +0 -1
  89. package/dist/subscriptionScope.js.map +0 -1
  90. package/dist/tests/types.test.js +0 -33
  91. package/dist/tests/types.test.js.map +0 -1
  92. package/src/coValueInterfaces.ts +0 -105
  93. package/src/coValues/account/account.ts +0 -106
  94. package/src/coValues/account/accountOf.ts +0 -284
  95. package/src/coValues/account/migration.ts +0 -12
  96. package/src/coValues/coList/coList.ts +0 -57
  97. package/src/coValues/coList/coListOf.ts +0 -377
  98. package/src/coValues/coList/internalDocs.ts +0 -1
  99. package/src/coValues/coMap/coMap.ts +0 -110
  100. package/src/coValues/coMap/coMapOf.ts +0 -451
  101. package/src/coValues/coMap/internalDocs.ts +0 -1
  102. package/src/coValues/coStream/coStream.ts +0 -63
  103. package/src/coValues/coStream/coStreamOf.ts +0 -404
  104. package/src/coValues/construction.ts +0 -110
  105. package/src/coValues/group/group.ts +0 -27
  106. package/src/coValues/group/groupOf.ts +0 -183
  107. package/src/coValues/resolution.ts +0 -111
  108. package/src/schemaHelpers.ts +0 -72
  109. package/src/tests/types.test.ts +0 -37
  110. /package/dist/{errors.js → implementation/errors.js} +0 -0
  111. /package/src/{errors.ts → implementation/errors.ts} +0 -0
@@ -1,244 +0,0 @@
1
- var _a;
2
- import { RawAccount, cojsonInternals, } from "cojson";
3
- import { inspect, } from "../../coValueInterfaces.js";
4
- import { SharedCoValueConstructor } from "../construction.js";
5
- import { AST, Schema } from "@effect/schema";
6
- import { constructorOfSchemaSym, propertyIsCoValueSchema, } from "../resolution.js";
7
- import { pipeArguments } from "effect/Pipeable";
8
- import { ValueRef } from "../../refs.js";
9
- import { Account, controlledAccountFromNode } from "../account/accountOf.js";
10
- import { Group } from "../group/groupOf.js";
11
- export function CoStreamOf(itemSchema) {
12
- const decodeItem = Schema.decodeSync(itemSchema);
13
- const encodeItem = Schema.encodeSync(itemSchema);
14
- const itemIsCoValue = propertyIsCoValueSchema(itemSchema);
15
- class CoStreamOfItem extends SharedCoValueConstructor {
16
- static get ast() {
17
- return AST.setAnnotation(Schema.instanceOf(this).ast, constructorOfSchemaSym, this);
18
- }
19
- static pipe() {
20
- // eslint-disable-next-line prefer-rest-params
21
- return pipeArguments(this, arguments);
22
- }
23
- constructor(init, options) {
24
- super();
25
- let raw;
26
- if ("fromRaw" in options) {
27
- raw = options.fromRaw;
28
- }
29
- else {
30
- const rawOwner = options.owner._raw;
31
- raw = rawOwner.createStream();
32
- }
33
- this.by = {};
34
- this.in = {};
35
- Object.defineProperties(this, {
36
- id: { value: raw.id, enumerable: false },
37
- _type: { value: "CoStream", enumerable: false },
38
- _owner: {
39
- get: () => raw.group instanceof RawAccount
40
- ? Account.fromRaw(raw.group)
41
- : Group.fromRaw(raw.group),
42
- enumerable: false,
43
- },
44
- _raw: { value: raw, enumerable: false },
45
- _loadedAs: {
46
- get: () => controlledAccountFromNode(raw.core.node),
47
- enumerable: false,
48
- },
49
- _schema: { value: this.constructor, enumerable: false },
50
- });
51
- if (init !== undefined) {
52
- for (const item of init) {
53
- this.pushItem(item);
54
- }
55
- }
56
- this.updateEntries();
57
- }
58
- updateEntries() {
59
- // eslint-disable-next-line @typescript-eslint/no-this-alias
60
- const self = this;
61
- const raw = this._raw;
62
- const loadedAs = this._loadedAs;
63
- for (const accountID of this._raw.accounts()) {
64
- Object.defineProperty(this.by, accountID, {
65
- get() {
66
- const rawEntry = raw.lastItemBy(accountID);
67
- if (!rawEntry)
68
- return;
69
- return entryFromRawEntry(self, rawEntry, loadedAs, accountID);
70
- },
71
- configurable: true,
72
- });
73
- }
74
- Object.defineProperty(this.by, "me", {
75
- get() {
76
- return self.by[loadedAs.id];
77
- },
78
- enumerable: false,
79
- configurable: true,
80
- });
81
- for (const sessionID of raw.sessions()) {
82
- Object.defineProperty(this.in, sessionID, {
83
- get() {
84
- const rawEntry = raw.lastItemIn(sessionID);
85
- if (!rawEntry)
86
- return;
87
- const by = cojsonInternals.accountOrAgentIDfromSessionID(sessionID);
88
- return entryFromRawEntry(self, rawEntry, loadedAs, cojsonInternals.isAccountID(by)
89
- ? by
90
- : undefined);
91
- },
92
- configurable: true,
93
- });
94
- }
95
- Object.defineProperty(this.in, "currentSession", {
96
- get() {
97
- return self.in[loadedAs.sessionID];
98
- },
99
- enumerable: false,
100
- configurable: true,
101
- });
102
- }
103
- static fromRaw(raw) {
104
- return new CoStreamOfItem(undefined, { fromRaw: raw });
105
- }
106
- push(...items) {
107
- for (const item of items) {
108
- this.pushItem(item);
109
- }
110
- this.updateEntries();
111
- }
112
- pushItem(item) {
113
- if (itemIsCoValue) {
114
- this._raw.push(item.id);
115
- }
116
- else {
117
- this._raw.push(encodeItem(item));
118
- }
119
- }
120
- toJSON() {
121
- return {
122
- by: Object.fromEntries(Object.entries(this.by).map(([key, value]) => [
123
- key,
124
- value &&
125
- typeof value === "object" &&
126
- "toJSON" in value &&
127
- typeof value.toJSON === "function"
128
- ? value.toJSON()
129
- : value,
130
- ])),
131
- in: Object.fromEntries(Object.entries(this.in).map(([key, value]) => [
132
- key,
133
- value &&
134
- typeof value === "object" &&
135
- "toJSON" in value &&
136
- typeof value.toJSON === "function"
137
- ? value.toJSON()
138
- : value,
139
- ])),
140
- co: {
141
- id: this.id,
142
- type: "CoStream",
143
- },
144
- };
145
- }
146
- [(Schema.TypeId, inspect)]() {
147
- return this.toJSON();
148
- }
149
- static as() {
150
- return CoStreamOfItem;
151
- }
152
- }
153
- CoStreamOfItem.type = "CoStream";
154
- return CoStreamOfItem;
155
- function entryFromRawEntry(accessFrom, rawEntry, loadedAs, accountID) {
156
- return {
157
- get value() {
158
- if (itemIsCoValue) {
159
- return this.ref?.accessFrom(accessFrom);
160
- }
161
- else {
162
- return decodeItem(rawEntry.value);
163
- }
164
- },
165
- get ref() {
166
- if (itemIsCoValue) {
167
- const rawId = rawEntry.value;
168
- return new ValueRef(rawId, loadedAs, itemSchema);
169
- }
170
- },
171
- get by() {
172
- return (accountID &&
173
- new ValueRef(accountID, loadedAs, Account)?.accessFrom(accessFrom));
174
- },
175
- madeAt: rawEntry.at,
176
- tx: rawEntry.tx,
177
- };
178
- }
179
- }
180
- class BinaryCoStreamImplClass extends SharedCoValueConstructor {
181
- static pipe() {
182
- // eslint-disable-next-line prefer-rest-params
183
- return pipeArguments(this, arguments);
184
- }
185
- constructor(init, options) {
186
- super();
187
- let raw;
188
- if ("fromRaw" in options) {
189
- raw = options.fromRaw;
190
- }
191
- else {
192
- const rawOwner = options.owner._raw;
193
- raw = rawOwner.createBinaryStream();
194
- }
195
- Object.defineProperties(this, {
196
- id: { value: raw.id, enumerable: false },
197
- _type: { value: "BinaryCoStream", enumerable: false },
198
- _owner: {
199
- get: () => raw.group instanceof RawAccount
200
- ? Account.fromRaw(raw.group)
201
- : Group.fromRaw(raw.group),
202
- enumerable: false,
203
- },
204
- _raw: { value: raw, enumerable: false },
205
- _loadedAs: {
206
- get: () => controlledAccountFromNode(raw.core.node),
207
- enumerable: false,
208
- },
209
- _schema: { value: this.constructor, enumerable: false },
210
- });
211
- }
212
- static fromRaw(raw) {
213
- return new _a(undefined, { fromRaw: raw });
214
- }
215
- getChunks(options) {
216
- return this._raw.getBinaryChunks(options?.allowUnfinished);
217
- }
218
- start(options) {
219
- this._raw.startBinaryStream(options);
220
- }
221
- push(data) {
222
- this._raw.pushBinaryStreamChunk(data);
223
- }
224
- end() {
225
- this._raw.endBinaryStream();
226
- }
227
- toJSON() {
228
- return {
229
- ...this.getChunks(),
230
- co: {
231
- id: this.id,
232
- type: "BinaryCoStream",
233
- },
234
- };
235
- }
236
- [(Schema.TypeId, inspect)]() {
237
- return this.toJSON();
238
- }
239
- }
240
- _a = BinaryCoStreamImplClass;
241
- BinaryCoStreamImplClass.ast = AST.setAnnotation(Schema.instanceOf(_a).ast, constructorOfSchemaSym, _a);
242
- BinaryCoStreamImplClass.type = "BinaryCoStream";
243
- export const BinaryCoStreamImpl = BinaryCoStreamImplClass;
244
- //# sourceMappingURL=coStreamOf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coStreamOf.js","sourceRoot":"","sources":["../../../src/coValues/coStream/coStreamOf.ts"],"names":[],"mappings":";AAAA,OAAO,EAMH,UAAU,EAIV,eAAe,GAClB,MAAM,QAAQ,CAAC;AAChB,OAAO,EAIH,OAAO,GACV,MAAM,4BAA4B,CAAC;AASpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACH,sBAAsB,EACtB,uBAAuB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,UAAU,UAAU,CAExB,UAAgB;IACd,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACjD,MAAM,aAAa,GAAG,uBAAuB,CAAC,UAAU,CAAC,CAAC;IAE1D,MAAM,cAAe,SAAQ,wBAAwB;QACjD,MAAM,KAAK,GAAG;YACV,OAAO,GAAG,CAAC,aAAa,CACpB,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAC3B,sBAAsB,EACtB,IAAI,CACP,CAAC;QACN,CAAC;QAMD,MAAM,CAAC,IAAI;YACP,8CAA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AAE,gBAAgB;aACzB;SACJ,CAAC;IACN,CAAC;IAED,EA7FQ,MAAM,CAAC,MAAM,EA6FpB,OAAO,EAAC;QACL,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACzB,CAAC;;;AApGM,2BAAG,GAAG,GAAG,CAAC,aAAa,CAC1B,MAAM,CAAC,UAAU,CAAC,EAAI,CAAC,CAAC,GAAG,EAC3B,sBAAsB,EACtB,EAAI,CACP,AAJS,CAIR;AAUK,4BAAI,GAAG,gBAAyB,AAA5B,CAA6B;AAyF5C,MAAM,CAAC,MAAM,kBAAkB,GAC3B,uBAA+C,CAAC"}
@@ -1,34 +0,0 @@
1
- import { Effect, Sink, Stream } from "effect";
2
- import { ControlledAccountCtx } from "./account/account.js";
3
- import { ValueRef } from "../refs.js";
4
- import { SubscriptionScope } from "../subscriptionScope.js";
5
- export class SharedCoValueConstructor {
6
- static loadEf(id) {
7
- return Effect.gen(this, function* (_) {
8
- const controlledAccount = yield* _(ControlledAccountCtx);
9
- return yield* _(new ValueRef(id, controlledAccount, this).loadEf());
10
- });
11
- }
12
- static load(id, options) {
13
- return new ValueRef(id, options.as, this).load(options?.onProgress && { onProgress: options.onProgress });
14
- }
15
- static subscribe(id, options, onUpdate) {
16
- void Effect.runPromise(Effect.provideService(this.subscribeEf(id).pipe(Stream.run(Sink.forEach((update) => Effect.sync(() => onUpdate(update))))), ControlledAccountCtx, options.as));
17
- return function unsubscribe() { };
18
- }
19
- static subscribeEf(id) {
20
- return Stream.fromEffect(this.loadEf(id)).pipe(Stream.flatMap((value) => Stream.asyncScoped((emit) => Effect.gen(this, function* (_) {
21
- const subscription = new SubscriptionScope(value, this, (update) => {
22
- void emit.single(update);
23
- });
24
- yield* _(Effect.addFinalizer(() => Effect.sync(() => subscription.unsubscribeAll())));
25
- }))));
26
- }
27
- subscribe(listener) {
28
- return this._schema.subscribe(this.id, { as: this._loadedAs }, listener);
29
- }
30
- subscribeEf() {
31
- return Stream.provideService(this._schema.subscribeEf(this.id), ControlledAccountCtx, this._loadedAs);
32
- }
33
- }
34
- //# sourceMappingURL=construction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"construction.js","sourceRoot":"","sources":["../../src/coValues/construction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQ9C,OAAO,EAAqB,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,OAAgB,wBAAwB;IAK1C,MAAM,CAAC,MAAM,CAET,EAAS;QAET,OAAO,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;YAChC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC;YACzD,OAAO,KAAK,CAAC,CAAC,CAAC,CACX,IAAI,QAAQ,CAAC,EAAW,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,CAC9D,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,IAAI,CAEP,EAAS,EACT,OAGC;QAED,OAAO,IAAI,QAAQ,CAAC,EAAW,EAAE,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CACnD,OAAO,EAAE,UAAU,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAC5D,CAAC;IACN,CAAC;IAED,MAAM,CAAC,SAAS,CAEZ,EAAS,EACT,OAAkC,EAClC,QAA4B;QAE5B,KAAK,MAAM,CAAC,UAAU,CAClB,MAAM,CAAC,cAAc,CACjB,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CACrB,MAAM,CAAC,GAAG,CACN,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAA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C2C,CAAC;IAClE,CAAC;CACJ"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=group.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/coValues/group/group.ts"],"names":[],"mappings":""}
@@ -1,109 +0,0 @@
1
- import { inspect, isCoValueSchema, } from "../../coValueInterfaces.js";
2
- import * as S from "@effect/schema/Schema";
3
- import { isControlledAccount, } from "../account/account.js";
4
- import { AST, Schema } from "@effect/schema";
5
- import { constructorOfSchemaSym } from "../resolution.js";
6
- import { pipeArguments } from "effect/Pipeable";
7
- import { ValueRef } from "../../refs.js";
8
- import { controlledAccountFromNode } from "../account/accountOf.js";
9
- import { SharedCoValueConstructor } from "../construction.js";
10
- export function GroupOf(fields) {
11
- class GroupOfProfileAndRoot extends SharedCoValueConstructor {
12
- static get ast() {
13
- return AST.setAnnotation(Schema.instanceOf(this).ast, constructorOfSchemaSym, this);
14
- }
15
- static pipe() {
16
- // eslint-disable-next-line prefer-rest-params
17
- return pipeArguments(this, arguments);
18
- }
19
- constructor(init, options) {
20
- super();
21
- let raw;
22
- if (options && "fromRaw" in options) {
23
- raw = options.fromRaw;
24
- }
25
- else {
26
- const initOwner = options?.owner || init?.owner;
27
- if (!initOwner)
28
- throw new Error("No owner provided");
29
- if (isControlledAccount(initOwner)) {
30
- const rawOwner = initOwner._raw;
31
- raw = rawOwner.createGroup();
32
- }
33
- else {
34
- throw new Error("Can only construct group as a controlled account");
35
- }
36
- }
37
- const refs = {
38
- get profile() {
39
- if (isCoValueSchema(fields.profile)) {
40
- const profileID = raw.get("profile");
41
- return (profileID &&
42
- new ValueRef(profileID, controlledAccountFromNode(raw.core.node), fields.profile));
43
- }
44
- },
45
- get root() {
46
- if (isCoValueSchema(fields.root)) {
47
- const rootID = raw.get("root");
48
- return (rootID &&
49
- new ValueRef(rootID, controlledAccountFromNode(raw.core.node), fields.root));
50
- }
51
- },
52
- };
53
- Object.defineProperties(this, {
54
- id: { value: raw.id, enumerable: false },
55
- _type: { value: "Group", enumerable: false },
56
- _owner: { value: this, enumerable: false },
57
- _refs: { value: refs, enumerable: false },
58
- _raw: { value: raw, enumerable: false },
59
- _loadedAs: {
60
- get: () => controlledAccountFromNode(raw.core.node),
61
- enumerable: false,
62
- },
63
- _schema: { value: GroupOfProfileAndRoot, enumerable: false },
64
- });
65
- }
66
- static fromRaw(raw) {
67
- return new GroupOfProfileAndRoot(undefined, {
68
- fromRaw: raw,
69
- });
70
- }
71
- get profile() {
72
- return this._refs.profile.accessFrom(this);
73
- }
74
- get root() {
75
- return this._refs.root.accessFrom(this);
76
- }
77
- addMember(member, role) {
78
- this._raw.addMember(typeof member === "string" ? member : member._raw, role);
79
- return this;
80
- }
81
- myRole() {
82
- return this._raw.myRole();
83
- }
84
- toJSON() {
85
- return {
86
- co: {
87
- id: this.id,
88
- type: this._type,
89
- },
90
- profile: this.profile?.toJSON(),
91
- root: this.root?.toJSON(),
92
- };
93
- }
94
- [(Schema.TypeId, inspect)]() {
95
- return this.toJSON();
96
- }
97
- static as() {
98
- return this;
99
- }
100
- }
101
- GroupOfProfileAndRoot.type = "Group";
102
- return GroupOfProfileAndRoot;
103
- }
104
- export class Group extends GroupOf({
105
- profile: S.null,
106
- root: S.null,
107
- }).as() {
108
- }
109
- //# sourceMappingURL=groupOf.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"groupOf.js","sourceRoot":"","sources":["../../../src/coValues/group/groupOf.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,OAAO,EACP,eAAe,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AAE3C,OAAO,EAGH,mBAAmB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAA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AAI,EAAE,CAAC,CAAC,IAAI;CACf,CAAC,CAAC,EAAE,EAAS;CAAG"}
@@ -1,66 +0,0 @@
1
- // TODO: can we get rid of this because effect schema already has an annotation for the constructor?
2
- export const constructorOfSchemaSym = Symbol.for("@jazz/constructorOfSymbol");
3
- export function propertyIsCoValueSchema(prop) {
4
- if ("propertySignatureAST" in prop) {
5
- return astIsCoValueSchema(prop.propertySignatureAST.from);
6
- }
7
- else {
8
- return astIsCoValueSchema(prop.ast);
9
- }
10
- }
11
- function astIsCoValueSchema(ast) {
12
- if ((ast._tag === "Declaration") &&
13
- ast.annotations[constructorOfSchemaSym]) {
14
- return true;
15
- }
16
- else if (ast._tag === "Union") {
17
- return ast.types.every((member) => member._tag === "UndefinedKeyword" || astIsCoValueSchema(member));
18
- }
19
- else if (ast._tag === "BooleanKeyword" ||
20
- ast._tag === "NumberKeyword" ||
21
- ast._tag === "StringKeyword" ||
22
- ast._tag === "Literal" ||
23
- ast._tag === "Tuple") {
24
- return false;
25
- }
26
- else if (ast._tag === "Refinement") {
27
- return astIsCoValueSchema(ast.from);
28
- }
29
- else if (ast._tag === "Transform") {
30
- return astIsCoValueSchema(ast.from);
31
- }
32
- else {
33
- throw new Error(`astIsCoValueSchema can't yet handle ${ast._tag}: ${JSON.stringify(ast)}`);
34
- }
35
- }
36
- export function getCoValueConstructorInProperty(prop, rawValue) {
37
- if ("propertySignatureAST" in prop) {
38
- return getCoValueConstructorInAST(prop.propertySignatureAST.from, rawValue);
39
- }
40
- else {
41
- return getCoValueConstructorInAST(prop.ast, rawValue);
42
- }
43
- }
44
- // TODO (optimization): make this meta, so this creates a tailor-made function that will take a RawCoValue at call time
45
- function getCoValueConstructorInAST(ast, rawValue) {
46
- if ((ast._tag === "Declaration") &&
47
- ast.annotations[constructorOfSchemaSym]) {
48
- return ast.annotations[constructorOfSchemaSym];
49
- }
50
- else if (ast._tag === "Union" && ast.types.length === 2) {
51
- const [a, b] = ast.types;
52
- if (a._tag === "UndefinedKeyword") {
53
- return getCoValueConstructorInAST(b, rawValue);
54
- }
55
- else if (b._tag === "UndefinedKeyword") {
56
- return getCoValueConstructorInAST(a, rawValue);
57
- }
58
- else {
59
- throw new Error(`getCoValueConstructorInAST can't yet handle Union of: ${JSON.stringify(ast.types)}`);
60
- }
61
- }
62
- else {
63
- throw new Error(`getCoValueConstructorInAST can't yet handle ${ast._tag}: ${JSON.stringify(ast)}`);
64
- }
65
- }
66
- //# sourceMappingURL=resolution.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolution.js","sourceRoot":"","sources":["../../src/coValues/resolution.ts"],"names":[],"mappings":"AAIA,oGAAoG;AACpG,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAG9E,MAAM,UAAU,uBAAuB,CACnC,IAEiE;IAEjE,IAAI,sBAAsB,IAAI,IAAI,EAAE,CAAC;QACjC,OAAO,kBAAkB,CACpB,IAAI,CAAC,oBAA0C,CAAC,IAAI,CACxD,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,kBAAkB,CAAE,IAA+B,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAY;IACpC,IACI,CAAC,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC;QAC5B,GAAG,CAAC,WAAW,CAAC,sBAAsB,CAAC,EACzC,CAAC;QACC,OAAO,IAAI,CAAC;IAChB,CAAC;SAAM,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,CAClB,CAAC,MAAM,EAAE,EAAE,CACP,MAAM,CAAC,IAAI,KAAK,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,CAAC,CACvE,CAAC;IACN,CAAC;SAAM,IACH,GAAG,CAAC,IAAI,KAAK,gBAAgB;QAC7B,GAAG,CAAC,IAAI,KAAK,eAAe;QAC5B,GAAG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G,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YAChC,OAAO,0BAA0B,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC;aAAM,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACvC,OAAO,0BAA0B,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACJ,MAAM,IAAI,KAAK,CACX,yDAAyD,IAAI,CAAC,SAAS,CACnE,GAAG,CAAC,KAAK,CACZ,EAAE,CACN,CAAC;QACN,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CACX,+CACI,GAAG,CAAC,IACR,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAC7B,CAAC;IACN,CAAC;AACL,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":""}
package/dist/refs.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"refs.js","sourceRoot":"","sources":["../src/refs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,OAAO,QAAQ;IAGjB,YACa,EAAS,EACT,iBAAoC,EACpC,OAAqB;QAFrB,OAAE,GAAF,EAAE,CAAO;QACT,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,YAAO,GAAP,OAAO,CAAc;IAC/B,CAAC;IAEJ,IAAI,KAAK;QACL,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAC,WAAW,CAAC;QAC9C,wCAAwC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAA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Aa,CAAC,GAAG,CAAC,CACrB,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,GAAc,CAAC,CAAC;YACvC,IAAI,CAAC,EAAE;gBAAE,OAAO,SAAS,CAAC;YAC1B,OAAO,IAAI,QAAQ,CACf,EAAuB,EACvB,iBAAiB,EACjB,aAAa,CAAC,GAAc,CAAC,CAChC,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"}
@@ -1,14 +0,0 @@
1
- import * as S from "@effect/schema/Schema";
2
- export function CoSchema(raw) {
3
- return raw;
4
- }
5
- export function propSigToSchema(propSig) {
6
- if ("ast" in propSig) {
7
- return propSig;
8
- }
9
- else {
10
- const ast = propSig.propertySignatureAST;
11
- return S.make(ast.from);
12
- }
13
- }
14
- //# sourceMappingURL=schemaHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaHelpers.js","sourceRoot":"","sources":["../src/schemaHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,uBAAuB,CAAC;AA4C3C,MAAM,UAAU,QAAQ,CACpB,GAAQ;IAER,OAAO,GAAU,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,eAAe,CAG3B,OAAU;IAMV,IAAI,KAAK,IAAI,OAAO,EAAE,CAAC;QACnB,OAAO,OAAc,CAAC;IAC1B,CAAC;SAAM,CAAC;QACJ,MAAM,GAAG,GACL,OAGH,CAAC,oBAAoB,CAAC;QACvB,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,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE;wBAC1C,sFAAsF;wBACtF,IAAI,CAAC,SAAS;4BAAE,OAAO;wBACvB,IAAI,CAAC,cAAc,EAAE,CAAC;oBAC1B,CAAC,CAAC,CAAC;oBAEH,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC9B,CAAC;YACL,CAAC,CAAC,CAAC;QACX,CAAC;IACL,CAAC;IAED,cAAc;QACV,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC3B,KAAK,CAAC,QAAQ,EAAE,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACJ,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAClC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACJ"}
@@ -1,33 +0,0 @@
1
- import { Account, Co, ImageDefinition, S, jazzReady } from "..";
2
- import { describe, test, beforeEach, expectTypeOf } from "vitest";
3
- import { webcrypto } from "node:crypto";
4
- if (!("crypto" in globalThis)) {
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- globalThis.crypto = webcrypto;
7
- }
8
- beforeEach(async () => {
9
- await jazzReady;
10
- });
11
- class TestMap extends Co.map({
12
- name: S.string,
13
- image: Co.media.imageDef,
14
- maybeImage: S.optional(Co.media.imageDef),
15
- }).as() {
16
- }
17
- describe("CoMap type tests", () => {
18
- test("Optional field refs work", async () => {
19
- const me = await Account.create({
20
- name: "Hermes Puggington",
21
- });
22
- const map = new TestMap({
23
- name: "Hermes",
24
- image: new ImageDefinition({
25
- originalSize: [100, 100],
26
- placeholderDataURL: "data:image/png;base64,",
27
- }, { owner: me }),
28
- }, { owner: me });
29
- expectTypeOf(map._refs.image).toMatchTypeOf();
30
- expectTypeOf(map._refs.maybeImage).toMatchTypeOf();
31
- });
32
- });
33
- //# sourceMappingURL=types.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.test.js","sourceRoot":"","sources":["../../src/tests/types.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,IAAI,CAAC,CAAC,QAAQ,IAAI,UAAU,CAAC,EAAE,CAAC;IAC5B,8DAA8D;IAC7D,UAAkB,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3C,CAAC;AAED,UAAU,CAAC,KAAK,IAAI,EAAE;IAClB,MAAM,SAAS,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,MAAM,OAAQ,SAAQ,EAAE,CAAC,GAAG,CAAC;IACzB,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ;IACxB,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;CAC5C,CAAC,CAAC,EAAE,EAAW;CAAG;AAEnB,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;QACxC,MAAM,EAAE,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC;YAC5B,IAAI,EAAE,mBAAmB;SAC5B,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC;YACpB,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,IAAI,eAAe,CAAC;gBACvB,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;gBACxB,kBAAkB,EAAE,wBAAwB;aAC/C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