@audiotool/nexus 0.0.7 → 0.0.9
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/README.md +4 -34
- package/dist/api.js +2 -2
- package/dist/{audiotool-api-BeiEe46q.js → audiotool-api-o8DnCQiu.js} +1 -1
- package/dist/document/backend/document-service/consolidator.d.ts +2 -1
- package/dist/document/backend/document-service/gateway.d.ts +2 -2
- package/dist/document/backend/gateway.d.ts +15 -2
- package/dist/document/document.d.ts +16 -15
- package/dist/document.js +1 -1
- package/dist/{get-schema-location-details-BSMUliFD.js → get-schema-location-details-D2lXBgbu.js} +1 -1
- package/dist/index.js +587 -577
- package/dist/lang-BqPY1uAS.js +22 -0
- package/dist/utils.js +1 -1
- package/package.json +2 -1
- package/dist/lang-KJQpoj7q.js +0 -13
package/dist/index.js
CHANGED
|
@@ -4,17 +4,17 @@ var Qt = (i) => {
|
|
|
4
4
|
};
|
|
5
5
|
var _t = (i, e, t) => e in i ? Zt(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
6
6
|
var r = (i, e, t) => _t(i, typeof e != "symbol" ? e + "" : e, t), Wt = (i, e, t) => e.has(i) || Qt("Cannot " + t);
|
|
7
|
-
var s = (i, e, t) => (Wt(i, e, "read from private field"), t ? t.call(i) : e.get(i)),
|
|
8
|
-
import { aS as entityMessageToTypeKey, aT as mustUnpackEntity, aU as packEntity, aV as getEntityTypeKeyFromProtoName, aW as unpackEntity, aX as Preset, aY as anyEntityToTypeKey, aZ as createRetryingPromiseClient, a_ as createAuthorizedKeepaliveTransport, aR as createAudiotoolAPI, a$ as extractUuid, n as neverThrowingFetch } from "./audiotool-api-
|
|
7
|
+
var s = (i, e, t) => (Wt(i, e, "read from private field"), t ? t.call(i) : e.get(i)), p = (i, e, t) => e.has(i) ? Qt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), h = (i, e, t, n) => (Wt(i, e, "write to private field"), n ? n.call(i, t) : e.set(i, t), t), g = (i, e, t) => (Wt(i, e, "access private method"), t);
|
|
8
|
+
import { aS as entityMessageToTypeKey, aT as mustUnpackEntity, aU as packEntity, aV as getEntityTypeKeyFromProtoName, aW as unpackEntity, aX as Preset, aY as anyEntityToTypeKey, aZ as createRetryingPromiseClient, a_ as createAuthorizedKeepaliveTransport, aR as createAudiotoolAPI, a$ as extractUuid, n as neverThrowingFetch } from "./audiotool-api-o8DnCQiu.js";
|
|
9
9
|
import { Message, proto3, Any, protoInt64, ScalarType, MethodKind } from "@bufbuild/protobuf";
|
|
10
10
|
import { P as Pointer, E as Empty, e as entityMessageTypes } from "./types-Cztu157p.js";
|
|
11
|
-
import { t as throw_, a as assert, s as sleep } from "./lang-
|
|
11
|
+
import { t as throw_, a as assert, b as asyncInterval, s as sleep } from "./lang-BqPY1uAS.js";
|
|
12
12
|
import { h as hashSymbol, H as HashMap, V as ValueNotifier, N as Notifier, A as AsyncLock } from "./observable-notifier-value-pw47I_2-.js";
|
|
13
13
|
import { v5 } from "uuid";
|
|
14
|
-
import { s as schemaLocationToSchemaPath, a as schemaPathToSchemaLocation, g as getSchemaLocationDetails, _ as _getSchemaLocatorDetails } from "./get-schema-location-details-
|
|
14
|
+
import { s as schemaLocationToSchemaPath, a as schemaPathToSchemaLocation, g as getSchemaLocationDetails, _ as _getSchemaLocatorDetails } from "./get-schema-location-details-D2lXBgbu.js";
|
|
15
15
|
import toposort from "toposort";
|
|
16
16
|
import { ConnectError, Code } from "@connectrpc/connect";
|
|
17
|
-
const
|
|
17
|
+
const F = class F extends Message {
|
|
18
18
|
constructor(t) {
|
|
19
19
|
super();
|
|
20
20
|
/**
|
|
@@ -34,19 +34,19 @@ const I = class I extends Message {
|
|
|
34
34
|
proto3.util.initPartial(t, this);
|
|
35
35
|
}
|
|
36
36
|
static fromBinary(t, n) {
|
|
37
|
-
return new
|
|
37
|
+
return new F().fromBinary(t, n);
|
|
38
38
|
}
|
|
39
39
|
static fromJson(t, n) {
|
|
40
|
-
return new
|
|
40
|
+
return new F().fromJson(t, n);
|
|
41
41
|
}
|
|
42
42
|
static fromJsonString(t, n) {
|
|
43
|
-
return new
|
|
43
|
+
return new F().fromJsonString(t, n);
|
|
44
44
|
}
|
|
45
45
|
static equals(t, n) {
|
|
46
|
-
return proto3.util.equals(
|
|
46
|
+
return proto3.util.equals(F, t, n);
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
r(
|
|
49
|
+
r(F, "runtime", proto3), r(F, "typeName", "audiotool.document.v1.AttachMetadataRequest"), r(F, "fields", proto3.util.newFieldList(() => [
|
|
50
50
|
{
|
|
51
51
|
no: 1,
|
|
52
52
|
name: "project_name",
|
|
@@ -62,8 +62,8 @@ r(I, "runtime", proto3), r(I, "typeName", "audiotool.document.v1.AttachMetadataR
|
|
|
62
62
|
/* ScalarType.STRING */
|
|
63
63
|
}
|
|
64
64
|
]));
|
|
65
|
-
let AttachMetadataRequest =
|
|
66
|
-
const
|
|
65
|
+
let AttachMetadataRequest = F;
|
|
66
|
+
const J = class J extends Message {
|
|
67
67
|
constructor(t) {
|
|
68
68
|
super();
|
|
69
69
|
/**
|
|
@@ -88,19 +88,19 @@ const N = class N extends Message {
|
|
|
88
88
|
proto3.util.initPartial(t, this);
|
|
89
89
|
}
|
|
90
90
|
static fromBinary(t, n) {
|
|
91
|
-
return new
|
|
91
|
+
return new J().fromBinary(t, n);
|
|
92
92
|
}
|
|
93
93
|
static fromJson(t, n) {
|
|
94
|
-
return new
|
|
94
|
+
return new J().fromJson(t, n);
|
|
95
95
|
}
|
|
96
96
|
static fromJsonString(t, n) {
|
|
97
|
-
return new
|
|
97
|
+
return new J().fromJsonString(t, n);
|
|
98
98
|
}
|
|
99
99
|
static equals(t, n) {
|
|
100
|
-
return proto3.util.equals(
|
|
100
|
+
return proto3.util.equals(J, t, n);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
r(
|
|
103
|
+
r(J, "runtime", proto3), r(J, "typeName", "audiotool.document.v1.AttachMetadataResponse"), r(J, "fields", proto3.util.newFieldList(() => [
|
|
104
104
|
{
|
|
105
105
|
no: 1,
|
|
106
106
|
name: "source_name",
|
|
@@ -117,8 +117,8 @@ r(N, "runtime", proto3), r(N, "typeName", "audiotool.document.v1.AttachMetadataR
|
|
|
117
117
|
},
|
|
118
118
|
{ no: 3, name: "client_coordinates", kind: "message", T: ClientCoordinates }
|
|
119
119
|
]));
|
|
120
|
-
let AttachMetadataResponse =
|
|
121
|
-
const
|
|
120
|
+
let AttachMetadataResponse = J;
|
|
121
|
+
const C = class C extends Message {
|
|
122
122
|
constructor(t) {
|
|
123
123
|
super();
|
|
124
124
|
/**
|
|
@@ -144,19 +144,19 @@ const F = class F extends Message {
|
|
|
144
144
|
proto3.util.initPartial(t, this);
|
|
145
145
|
}
|
|
146
146
|
static fromBinary(t, n) {
|
|
147
|
-
return new
|
|
147
|
+
return new C().fromBinary(t, n);
|
|
148
148
|
}
|
|
149
149
|
static fromJson(t, n) {
|
|
150
|
-
return new
|
|
150
|
+
return new C().fromJson(t, n);
|
|
151
151
|
}
|
|
152
152
|
static fromJsonString(t, n) {
|
|
153
|
-
return new
|
|
153
|
+
return new C().fromJsonString(t, n);
|
|
154
154
|
}
|
|
155
155
|
static equals(t, n) {
|
|
156
|
-
return proto3.util.equals(
|
|
156
|
+
return proto3.util.equals(C, t, n);
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
|
-
r(
|
|
159
|
+
r(C, "runtime", proto3), r(C, "typeName", "audiotool.document.v1.PutMetadataRequest"), r(C, "fields", proto3.util.newFieldList(() => [
|
|
160
160
|
{
|
|
161
161
|
no: 1,
|
|
162
162
|
name: "project_name",
|
|
@@ -173,27 +173,27 @@ r(F, "runtime", proto3), r(F, "typeName", "audiotool.document.v1.PutMetadataRequ
|
|
|
173
173
|
},
|
|
174
174
|
{ no: 3, name: "client_coordinates", kind: "message", T: ClientCoordinates }
|
|
175
175
|
]));
|
|
176
|
-
let PutMetadataRequest =
|
|
177
|
-
const
|
|
176
|
+
let PutMetadataRequest = C;
|
|
177
|
+
const L = class L extends Message {
|
|
178
178
|
constructor(e) {
|
|
179
179
|
super(), proto3.util.initPartial(e, this);
|
|
180
180
|
}
|
|
181
181
|
static fromBinary(e, t) {
|
|
182
|
-
return new
|
|
182
|
+
return new L().fromBinary(e, t);
|
|
183
183
|
}
|
|
184
184
|
static fromJson(e, t) {
|
|
185
|
-
return new
|
|
185
|
+
return new L().fromJson(e, t);
|
|
186
186
|
}
|
|
187
187
|
static fromJsonString(e, t) {
|
|
188
|
-
return new
|
|
188
|
+
return new L().fromJsonString(e, t);
|
|
189
189
|
}
|
|
190
190
|
static equals(e, t) {
|
|
191
|
-
return proto3.util.equals(
|
|
191
|
+
return proto3.util.equals(L, e, t);
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
-
r(
|
|
195
|
-
let PutMetadataResponse =
|
|
196
|
-
const
|
|
194
|
+
r(L, "runtime", proto3), r(L, "typeName", "audiotool.document.v1.PutMetadataResponse"), r(L, "fields", proto3.util.newFieldList(() => []));
|
|
195
|
+
let PutMetadataResponse = L;
|
|
196
|
+
const U = class U extends Message {
|
|
197
197
|
constructor(t) {
|
|
198
198
|
super();
|
|
199
199
|
/**
|
|
@@ -251,19 +251,19 @@ const C = class C extends Message {
|
|
|
251
251
|
proto3.util.initPartial(t, this);
|
|
252
252
|
}
|
|
253
253
|
static fromBinary(t, n) {
|
|
254
|
-
return new
|
|
254
|
+
return new U().fromBinary(t, n);
|
|
255
255
|
}
|
|
256
256
|
static fromJson(t, n) {
|
|
257
|
-
return new
|
|
257
|
+
return new U().fromJson(t, n);
|
|
258
258
|
}
|
|
259
259
|
static fromJsonString(t, n) {
|
|
260
|
-
return new
|
|
260
|
+
return new U().fromJsonString(t, n);
|
|
261
261
|
}
|
|
262
262
|
static equals(t, n) {
|
|
263
|
-
return proto3.util.equals(
|
|
263
|
+
return proto3.util.equals(U, t, n);
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
|
-
r(
|
|
266
|
+
r(U, "runtime", proto3), r(U, "typeName", "audiotool.document.v1.ClientCoordinates"), r(U, "fields", proto3.util.newFieldList(() => [
|
|
267
267
|
{
|
|
268
268
|
no: 1,
|
|
269
269
|
name: "x",
|
|
@@ -314,8 +314,8 @@ r(C, "runtime", proto3), r(C, "typeName", "audiotool.document.v1.ClientCoordinat
|
|
|
314
314
|
/* ScalarType.DOUBLE */
|
|
315
315
|
}
|
|
316
316
|
]));
|
|
317
|
-
let ClientCoordinates =
|
|
318
|
-
const
|
|
317
|
+
let ClientCoordinates = U;
|
|
318
|
+
const B = class B extends Message {
|
|
319
319
|
constructor(t) {
|
|
320
320
|
super();
|
|
321
321
|
/**
|
|
@@ -333,19 +333,19 @@ const U = class U extends Message {
|
|
|
333
333
|
proto3.util.initPartial(t, this);
|
|
334
334
|
}
|
|
335
335
|
static fromBinary(t, n) {
|
|
336
|
-
return new
|
|
336
|
+
return new B().fromBinary(t, n);
|
|
337
337
|
}
|
|
338
338
|
static fromJson(t, n) {
|
|
339
|
-
return new
|
|
339
|
+
return new B().fromJson(t, n);
|
|
340
340
|
}
|
|
341
341
|
static fromJsonString(t, n) {
|
|
342
|
-
return new
|
|
342
|
+
return new B().fromJsonString(t, n);
|
|
343
343
|
}
|
|
344
344
|
static equals(t, n) {
|
|
345
|
-
return proto3.util.equals(
|
|
345
|
+
return proto3.util.equals(B, t, n);
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
|
-
r(
|
|
348
|
+
r(B, "runtime", proto3), r(B, "typeName", "audiotool.document.v1.GetEntitiesRequest"), r(B, "fields", proto3.util.newFieldList(() => [
|
|
349
349
|
{
|
|
350
350
|
no: 1,
|
|
351
351
|
name: "project_name",
|
|
@@ -361,8 +361,8 @@ r(U, "runtime", proto3), r(U, "typeName", "audiotool.document.v1.GetEntitiesRequ
|
|
|
361
361
|
/* ScalarType.STRING */
|
|
362
362
|
}
|
|
363
363
|
]));
|
|
364
|
-
let GetEntitiesRequest =
|
|
365
|
-
const
|
|
364
|
+
let GetEntitiesRequest = B;
|
|
365
|
+
const A = class A extends Message {
|
|
366
366
|
constructor(t) {
|
|
367
367
|
super();
|
|
368
368
|
/**
|
|
@@ -375,23 +375,23 @@ const L = class L extends Message {
|
|
|
375
375
|
proto3.util.initPartial(t, this);
|
|
376
376
|
}
|
|
377
377
|
static fromBinary(t, n) {
|
|
378
|
-
return new
|
|
378
|
+
return new A().fromBinary(t, n);
|
|
379
379
|
}
|
|
380
380
|
static fromJson(t, n) {
|
|
381
|
-
return new
|
|
381
|
+
return new A().fromJson(t, n);
|
|
382
382
|
}
|
|
383
383
|
static fromJsonString(t, n) {
|
|
384
|
-
return new
|
|
384
|
+
return new A().fromJsonString(t, n);
|
|
385
385
|
}
|
|
386
386
|
static equals(t, n) {
|
|
387
|
-
return proto3.util.equals(
|
|
387
|
+
return proto3.util.equals(A, t, n);
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
|
-
r(
|
|
390
|
+
r(A, "runtime", proto3), r(A, "typeName", "audiotool.document.v1.GetEntitiesResponse"), r(A, "fields", proto3.util.newFieldList(() => [
|
|
391
391
|
{ no: 1, name: "entities", kind: "message", T: Any, repeated: !0 }
|
|
392
392
|
]));
|
|
393
|
-
let GetEntitiesResponse =
|
|
394
|
-
const
|
|
393
|
+
let GetEntitiesResponse = A;
|
|
394
|
+
const D = class D extends Message {
|
|
395
395
|
constructor(t) {
|
|
396
396
|
super();
|
|
397
397
|
/**
|
|
@@ -420,19 +420,19 @@ const B = class B extends Message {
|
|
|
420
420
|
proto3.util.initPartial(t, this);
|
|
421
421
|
}
|
|
422
422
|
static fromBinary(t, n) {
|
|
423
|
-
return new
|
|
423
|
+
return new D().fromBinary(t, n);
|
|
424
424
|
}
|
|
425
425
|
static fromJson(t, n) {
|
|
426
|
-
return new
|
|
426
|
+
return new D().fromJson(t, n);
|
|
427
427
|
}
|
|
428
428
|
static fromJsonString(t, n) {
|
|
429
|
-
return new
|
|
429
|
+
return new D().fromJsonString(t, n);
|
|
430
430
|
}
|
|
431
431
|
static equals(t, n) {
|
|
432
|
-
return proto3.util.equals(
|
|
432
|
+
return proto3.util.equals(D, t, n);
|
|
433
433
|
}
|
|
434
434
|
};
|
|
435
|
-
r(
|
|
435
|
+
r(D, "runtime", proto3), r(D, "typeName", "audiotool.document.v1.AttachRequest"), r(D, "fields", proto3.util.newFieldList(() => [
|
|
436
436
|
{
|
|
437
437
|
no: 1,
|
|
438
438
|
name: "project_name",
|
|
@@ -448,8 +448,8 @@ r(B, "runtime", proto3), r(B, "typeName", "audiotool.document.v1.AttachRequest")
|
|
|
448
448
|
/* ScalarType.UINT32 */
|
|
449
449
|
}
|
|
450
450
|
]));
|
|
451
|
-
let AttachRequest =
|
|
452
|
-
const
|
|
451
|
+
let AttachRequest = D;
|
|
452
|
+
const O = class O extends Message {
|
|
453
453
|
constructor(t) {
|
|
454
454
|
super();
|
|
455
455
|
/**
|
|
@@ -461,24 +461,24 @@ const A = class A extends Message {
|
|
|
461
461
|
proto3.util.initPartial(t, this);
|
|
462
462
|
}
|
|
463
463
|
static fromBinary(t, n) {
|
|
464
|
-
return new
|
|
464
|
+
return new O().fromBinary(t, n);
|
|
465
465
|
}
|
|
466
466
|
static fromJson(t, n) {
|
|
467
|
-
return new
|
|
467
|
+
return new O().fromJson(t, n);
|
|
468
468
|
}
|
|
469
469
|
static fromJsonString(t, n) {
|
|
470
|
-
return new
|
|
470
|
+
return new O().fromJsonString(t, n);
|
|
471
471
|
}
|
|
472
472
|
static equals(t, n) {
|
|
473
|
-
return proto3.util.equals(
|
|
473
|
+
return proto3.util.equals(O, t, n);
|
|
474
474
|
}
|
|
475
475
|
};
|
|
476
|
-
r(
|
|
476
|
+
r(O, "runtime", proto3), r(O, "typeName", "audiotool.document.v1.AttachResponse"), r(O, "fields", proto3.util.newFieldList(() => [
|
|
477
477
|
{ no: 1, name: "transaction", kind: "message", T: Transaction, oneof: "message" },
|
|
478
478
|
{ no: 2, name: "noop", kind: "message", T: Noop, oneof: "message" }
|
|
479
479
|
]));
|
|
480
|
-
let AttachResponse =
|
|
481
|
-
const
|
|
480
|
+
let AttachResponse = O;
|
|
481
|
+
const q = class q extends Message {
|
|
482
482
|
constructor(t) {
|
|
483
483
|
super();
|
|
484
484
|
/**
|
|
@@ -490,19 +490,19 @@ const D = class D extends Message {
|
|
|
490
490
|
proto3.util.initPartial(t, this);
|
|
491
491
|
}
|
|
492
492
|
static fromBinary(t, n) {
|
|
493
|
-
return new
|
|
493
|
+
return new q().fromBinary(t, n);
|
|
494
494
|
}
|
|
495
495
|
static fromJson(t, n) {
|
|
496
|
-
return new
|
|
496
|
+
return new q().fromJson(t, n);
|
|
497
497
|
}
|
|
498
498
|
static fromJsonString(t, n) {
|
|
499
|
-
return new
|
|
499
|
+
return new q().fromJsonString(t, n);
|
|
500
500
|
}
|
|
501
501
|
static equals(t, n) {
|
|
502
|
-
return proto3.util.equals(
|
|
502
|
+
return proto3.util.equals(q, t, n);
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
|
-
r(
|
|
505
|
+
r(q, "runtime", proto3), r(q, "typeName", "audiotool.document.v1.Noop"), r(q, "fields", proto3.util.newFieldList(() => [
|
|
506
506
|
{
|
|
507
507
|
no: 1,
|
|
508
508
|
name: "server_commit_index",
|
|
@@ -511,8 +511,8 @@ r(D, "runtime", proto3), r(D, "typeName", "audiotool.document.v1.Noop"), r(D, "f
|
|
|
511
511
|
/* ScalarType.UINT32 */
|
|
512
512
|
}
|
|
513
513
|
]));
|
|
514
|
-
let Noop =
|
|
515
|
-
const
|
|
514
|
+
let Noop = q;
|
|
515
|
+
const j = class j extends Message {
|
|
516
516
|
constructor(t) {
|
|
517
517
|
super();
|
|
518
518
|
/**
|
|
@@ -525,24 +525,24 @@ const O = class O extends Message {
|
|
|
525
525
|
proto3.util.initPartial(t, this);
|
|
526
526
|
}
|
|
527
527
|
static fromBinary(t, n) {
|
|
528
|
-
return new
|
|
528
|
+
return new j().fromBinary(t, n);
|
|
529
529
|
}
|
|
530
530
|
static fromJson(t, n) {
|
|
531
|
-
return new
|
|
531
|
+
return new j().fromJson(t, n);
|
|
532
532
|
}
|
|
533
533
|
static fromJsonString(t, n) {
|
|
534
|
-
return new
|
|
534
|
+
return new j().fromJsonString(t, n);
|
|
535
535
|
}
|
|
536
536
|
static equals(t, n) {
|
|
537
|
-
return proto3.util.equals(
|
|
537
|
+
return proto3.util.equals(j, t, n);
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
|
-
r(
|
|
540
|
+
r(j, "runtime", proto3), r(j, "typeName", "audiotool.document.v1.ModifyRequest"), r(j, "fields", proto3.util.newFieldList(() => [
|
|
541
541
|
{ no: 1, name: "project_name", kind: "scalar", T: 9, oneof: "message" },
|
|
542
542
|
{ no: 2, name: "transaction", kind: "message", T: Transaction, oneof: "message" }
|
|
543
543
|
]));
|
|
544
|
-
let ModifyRequest =
|
|
545
|
-
const
|
|
544
|
+
let ModifyRequest = j;
|
|
545
|
+
const R = class R extends Message {
|
|
546
546
|
constructor(t) {
|
|
547
547
|
super();
|
|
548
548
|
/**
|
|
@@ -555,19 +555,19 @@ const q = class q extends Message {
|
|
|
555
555
|
proto3.util.initPartial(t, this);
|
|
556
556
|
}
|
|
557
557
|
static fromBinary(t, n) {
|
|
558
|
-
return new
|
|
558
|
+
return new R().fromBinary(t, n);
|
|
559
559
|
}
|
|
560
560
|
static fromJson(t, n) {
|
|
561
|
-
return new
|
|
561
|
+
return new R().fromJson(t, n);
|
|
562
562
|
}
|
|
563
563
|
static fromJsonString(t, n) {
|
|
564
|
-
return new
|
|
564
|
+
return new R().fromJsonString(t, n);
|
|
565
565
|
}
|
|
566
566
|
static equals(t, n) {
|
|
567
|
-
return proto3.util.equals(
|
|
567
|
+
return proto3.util.equals(R, t, n);
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
|
-
r(
|
|
570
|
+
r(R, "runtime", proto3), r(R, "typeName", "audiotool.document.v1.ModifyResponse"), r(R, "fields", proto3.util.newFieldList(() => [
|
|
571
571
|
{
|
|
572
572
|
no: 1,
|
|
573
573
|
name: "error",
|
|
@@ -576,8 +576,8 @@ r(q, "runtime", proto3), r(q, "typeName", "audiotool.document.v1.ModifyResponse"
|
|
|
576
576
|
/* ScalarType.STRING */
|
|
577
577
|
}
|
|
578
578
|
]));
|
|
579
|
-
let ModifyResponse =
|
|
580
|
-
const
|
|
579
|
+
let ModifyResponse = R;
|
|
580
|
+
const $ = class $ extends Message {
|
|
581
581
|
constructor(t) {
|
|
582
582
|
super();
|
|
583
583
|
/**
|
|
@@ -595,19 +595,19 @@ const j = class j extends Message {
|
|
|
595
595
|
proto3.util.initPartial(t, this);
|
|
596
596
|
}
|
|
597
597
|
static fromBinary(t, n) {
|
|
598
|
-
return new
|
|
598
|
+
return new $().fromBinary(t, n);
|
|
599
599
|
}
|
|
600
600
|
static fromJson(t, n) {
|
|
601
|
-
return new
|
|
601
|
+
return new $().fromJson(t, n);
|
|
602
602
|
}
|
|
603
603
|
static fromJsonString(t, n) {
|
|
604
|
-
return new
|
|
604
|
+
return new $().fromJsonString(t, n);
|
|
605
605
|
}
|
|
606
606
|
static equals(t, n) {
|
|
607
|
-
return proto3.util.equals(
|
|
607
|
+
return proto3.util.equals($, t, n);
|
|
608
608
|
}
|
|
609
609
|
};
|
|
610
|
-
r(
|
|
610
|
+
r($, "runtime", proto3), r($, "typeName", "audiotool.document.v1.ApplyTransactionsRequest"), r($, "fields", proto3.util.newFieldList(() => [
|
|
611
611
|
{
|
|
612
612
|
no: 1,
|
|
613
613
|
name: "project_name",
|
|
@@ -617,8 +617,8 @@ r(j, "runtime", proto3), r(j, "typeName", "audiotool.document.v1.ApplyTransactio
|
|
|
617
617
|
},
|
|
618
618
|
{ no: 2, name: "transactions", kind: "message", T: Transaction, repeated: !0 }
|
|
619
619
|
]));
|
|
620
|
-
let ApplyTransactionsRequest =
|
|
621
|
-
const
|
|
620
|
+
let ApplyTransactionsRequest = $;
|
|
621
|
+
const V = class V extends Message {
|
|
622
622
|
constructor(t) {
|
|
623
623
|
super();
|
|
624
624
|
/**
|
|
@@ -630,27 +630,27 @@ const R = class R extends Message {
|
|
|
630
630
|
proto3.util.initPartial(t, this);
|
|
631
631
|
}
|
|
632
632
|
static fromBinary(t, n) {
|
|
633
|
-
return new
|
|
633
|
+
return new V().fromBinary(t, n);
|
|
634
634
|
}
|
|
635
635
|
static fromJson(t, n) {
|
|
636
|
-
return new
|
|
636
|
+
return new V().fromJson(t, n);
|
|
637
637
|
}
|
|
638
638
|
static fromJsonString(t, n) {
|
|
639
|
-
return new
|
|
639
|
+
return new V().fromJsonString(t, n);
|
|
640
640
|
}
|
|
641
641
|
static equals(t, n) {
|
|
642
|
-
return proto3.util.equals(
|
|
642
|
+
return proto3.util.equals(V, t, n);
|
|
643
643
|
}
|
|
644
644
|
};
|
|
645
|
-
r(
|
|
645
|
+
r(V, "runtime", proto3), r(V, "typeName", "audiotool.document.v1.ApplyTransactionsResponse"), r(V, "fields", proto3.util.newFieldList(() => [
|
|
646
646
|
{ no: 1, name: "errors", kind: "map", K: 9, V: {
|
|
647
647
|
kind: "scalar",
|
|
648
648
|
T: 9
|
|
649
649
|
/* ScalarType.STRING */
|
|
650
650
|
} }
|
|
651
651
|
]));
|
|
652
|
-
let ApplyTransactionsResponse =
|
|
653
|
-
const
|
|
652
|
+
let ApplyTransactionsResponse = V;
|
|
653
|
+
const W = class W extends Message {
|
|
654
654
|
constructor(t) {
|
|
655
655
|
super();
|
|
656
656
|
/**
|
|
@@ -676,19 +676,19 @@ const $ = class $ extends Message {
|
|
|
676
676
|
proto3.util.initPartial(t, this);
|
|
677
677
|
}
|
|
678
678
|
static fromBinary(t, n) {
|
|
679
|
-
return new
|
|
679
|
+
return new W().fromBinary(t, n);
|
|
680
680
|
}
|
|
681
681
|
static fromJson(t, n) {
|
|
682
|
-
return new
|
|
682
|
+
return new W().fromJson(t, n);
|
|
683
683
|
}
|
|
684
684
|
static fromJsonString(t, n) {
|
|
685
|
-
return new
|
|
685
|
+
return new W().fromJsonString(t, n);
|
|
686
686
|
}
|
|
687
687
|
static equals(t, n) {
|
|
688
|
-
return proto3.util.equals(
|
|
688
|
+
return proto3.util.equals(W, t, n);
|
|
689
689
|
}
|
|
690
690
|
};
|
|
691
|
-
r(
|
|
691
|
+
r(W, "runtime", proto3), r(W, "typeName", "audiotool.document.v1.Transaction"), r(W, "fields", proto3.util.newFieldList(() => [
|
|
692
692
|
{
|
|
693
693
|
no: 1,
|
|
694
694
|
name: "id",
|
|
@@ -705,8 +705,8 @@ r($, "runtime", proto3), r($, "typeName", "audiotool.document.v1.Transaction"),
|
|
|
705
705
|
},
|
|
706
706
|
{ no: 3, name: "modifications", kind: "message", T: Modification, repeated: !0 }
|
|
707
707
|
]));
|
|
708
|
-
let Transaction =
|
|
709
|
-
const
|
|
708
|
+
let Transaction = W;
|
|
709
|
+
const G = class G extends Message {
|
|
710
710
|
constructor(t) {
|
|
711
711
|
super();
|
|
712
712
|
/**
|
|
@@ -718,25 +718,25 @@ const V = class V extends Message {
|
|
|
718
718
|
proto3.util.initPartial(t, this);
|
|
719
719
|
}
|
|
720
720
|
static fromBinary(t, n) {
|
|
721
|
-
return new
|
|
721
|
+
return new G().fromBinary(t, n);
|
|
722
722
|
}
|
|
723
723
|
static fromJson(t, n) {
|
|
724
|
-
return new
|
|
724
|
+
return new G().fromJson(t, n);
|
|
725
725
|
}
|
|
726
726
|
static fromJsonString(t, n) {
|
|
727
|
-
return new
|
|
727
|
+
return new G().fromJsonString(t, n);
|
|
728
728
|
}
|
|
729
729
|
static equals(t, n) {
|
|
730
|
-
return proto3.util.equals(
|
|
730
|
+
return proto3.util.equals(G, t, n);
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
|
-
r(
|
|
733
|
+
r(G, "runtime", proto3), r(G, "typeName", "audiotool.document.v1.Modification"), r(G, "fields", proto3.util.newFieldList(() => [
|
|
734
734
|
{ no: 2, name: "create", kind: "message", T: Create, oneof: "modification" },
|
|
735
735
|
{ no: 3, name: "delete", kind: "message", T: Delete, oneof: "modification" },
|
|
736
736
|
{ no: 4, name: "update", kind: "message", T: Update, oneof: "modification" }
|
|
737
737
|
]));
|
|
738
|
-
let Modification =
|
|
739
|
-
const
|
|
738
|
+
let Modification = G;
|
|
739
|
+
const z = class z extends Message {
|
|
740
740
|
constructor(t) {
|
|
741
741
|
super();
|
|
742
742
|
/**
|
|
@@ -748,23 +748,23 @@ const W = class W extends Message {
|
|
|
748
748
|
proto3.util.initPartial(t, this);
|
|
749
749
|
}
|
|
750
750
|
static fromBinary(t, n) {
|
|
751
|
-
return new
|
|
751
|
+
return new z().fromBinary(t, n);
|
|
752
752
|
}
|
|
753
753
|
static fromJson(t, n) {
|
|
754
|
-
return new
|
|
754
|
+
return new z().fromJson(t, n);
|
|
755
755
|
}
|
|
756
756
|
static fromJsonString(t, n) {
|
|
757
|
-
return new
|
|
757
|
+
return new z().fromJsonString(t, n);
|
|
758
758
|
}
|
|
759
759
|
static equals(t, n) {
|
|
760
|
-
return proto3.util.equals(
|
|
760
|
+
return proto3.util.equals(z, t, n);
|
|
761
761
|
}
|
|
762
762
|
};
|
|
763
|
-
r(
|
|
763
|
+
r(z, "runtime", proto3), r(z, "typeName", "audiotool.document.v1.Create"), r(z, "fields", proto3.util.newFieldList(() => [
|
|
764
764
|
{ no: 1, name: "entity", kind: "message", T: Any }
|
|
765
765
|
]));
|
|
766
|
-
let Create =
|
|
767
|
-
const
|
|
766
|
+
let Create = z;
|
|
767
|
+
const K = class K extends Message {
|
|
768
768
|
constructor(t) {
|
|
769
769
|
super();
|
|
770
770
|
/**
|
|
@@ -782,19 +782,19 @@ const G = class G extends Message {
|
|
|
782
782
|
proto3.util.initPartial(t, this);
|
|
783
783
|
}
|
|
784
784
|
static fromBinary(t, n) {
|
|
785
|
-
return new
|
|
785
|
+
return new K().fromBinary(t, n);
|
|
786
786
|
}
|
|
787
787
|
static fromJson(t, n) {
|
|
788
|
-
return new
|
|
788
|
+
return new K().fromJson(t, n);
|
|
789
789
|
}
|
|
790
790
|
static fromJsonString(t, n) {
|
|
791
|
-
return new
|
|
791
|
+
return new K().fromJsonString(t, n);
|
|
792
792
|
}
|
|
793
793
|
static equals(t, n) {
|
|
794
|
-
return proto3.util.equals(
|
|
794
|
+
return proto3.util.equals(K, t, n);
|
|
795
795
|
}
|
|
796
796
|
};
|
|
797
|
-
r(
|
|
797
|
+
r(K, "runtime", proto3), r(K, "typeName", "audiotool.document.v1.Update"), r(K, "fields", proto3.util.newFieldList(() => [
|
|
798
798
|
{ no: 1, name: "field", kind: "message", T: Pointer },
|
|
799
799
|
{ no: 2, name: "double", kind: "scalar", T: 1, oneof: "value" },
|
|
800
800
|
{ no: 3, name: "float", kind: "scalar", T: 2, oneof: "value" },
|
|
@@ -813,8 +813,8 @@ r(G, "runtime", proto3), r(G, "typeName", "audiotool.document.v1.Update"), r(G,
|
|
|
813
813
|
{ no: 16, name: "bytes", kind: "scalar", T: 12, oneof: "value" },
|
|
814
814
|
{ no: 17, name: "pointer", kind: "message", T: Pointer, oneof: "value" }
|
|
815
815
|
]));
|
|
816
|
-
let Update =
|
|
817
|
-
const
|
|
816
|
+
let Update = K;
|
|
817
|
+
const H = class H extends Message {
|
|
818
818
|
constructor(t) {
|
|
819
819
|
super();
|
|
820
820
|
/**
|
|
@@ -826,19 +826,19 @@ const z = class z extends Message {
|
|
|
826
826
|
proto3.util.initPartial(t, this);
|
|
827
827
|
}
|
|
828
828
|
static fromBinary(t, n) {
|
|
829
|
-
return new
|
|
829
|
+
return new H().fromBinary(t, n);
|
|
830
830
|
}
|
|
831
831
|
static fromJson(t, n) {
|
|
832
|
-
return new
|
|
832
|
+
return new H().fromJson(t, n);
|
|
833
833
|
}
|
|
834
834
|
static fromJsonString(t, n) {
|
|
835
|
-
return new
|
|
835
|
+
return new H().fromJsonString(t, n);
|
|
836
836
|
}
|
|
837
837
|
static equals(t, n) {
|
|
838
|
-
return proto3.util.equals(
|
|
838
|
+
return proto3.util.equals(H, t, n);
|
|
839
839
|
}
|
|
840
840
|
};
|
|
841
|
-
r(
|
|
841
|
+
r(H, "runtime", proto3), r(H, "typeName", "audiotool.document.v1.Delete"), r(H, "fields", proto3.util.newFieldList(() => [
|
|
842
842
|
{
|
|
843
843
|
no: 1,
|
|
844
844
|
name: "entity_id",
|
|
@@ -847,27 +847,27 @@ r(z, "runtime", proto3), r(z, "typeName", "audiotool.document.v1.Delete"), r(z,
|
|
|
847
847
|
/* ScalarType.STRING */
|
|
848
848
|
}
|
|
849
849
|
]));
|
|
850
|
-
let Delete =
|
|
851
|
-
const
|
|
850
|
+
let Delete = H;
|
|
851
|
+
const Q = class Q extends Message {
|
|
852
852
|
constructor(e) {
|
|
853
853
|
super(), proto3.util.initPartial(e, this);
|
|
854
854
|
}
|
|
855
855
|
static fromBinary(e, t) {
|
|
856
|
-
return new
|
|
856
|
+
return new Q().fromBinary(e, t);
|
|
857
857
|
}
|
|
858
858
|
static fromJson(e, t) {
|
|
859
|
-
return new
|
|
859
|
+
return new Q().fromJson(e, t);
|
|
860
860
|
}
|
|
861
861
|
static fromJsonString(e, t) {
|
|
862
|
-
return new
|
|
862
|
+
return new Q().fromJsonString(e, t);
|
|
863
863
|
}
|
|
864
864
|
static equals(e, t) {
|
|
865
|
-
return proto3.util.equals(
|
|
865
|
+
return proto3.util.equals(Q, e, t);
|
|
866
866
|
}
|
|
867
867
|
};
|
|
868
|
-
r(
|
|
869
|
-
let GetWasmRequest =
|
|
870
|
-
const
|
|
868
|
+
r(Q, "runtime", proto3), r(Q, "typeName", "audiotool.document.v1.GetWasmRequest"), r(Q, "fields", proto3.util.newFieldList(() => []));
|
|
869
|
+
let GetWasmRequest = Q;
|
|
870
|
+
const X = class X extends Message {
|
|
871
871
|
constructor(t) {
|
|
872
872
|
super();
|
|
873
873
|
/**
|
|
@@ -879,19 +879,19 @@ const H = class H extends Message {
|
|
|
879
879
|
proto3.util.initPartial(t, this);
|
|
880
880
|
}
|
|
881
881
|
static fromBinary(t, n) {
|
|
882
|
-
return new
|
|
882
|
+
return new X().fromBinary(t, n);
|
|
883
883
|
}
|
|
884
884
|
static fromJson(t, n) {
|
|
885
|
-
return new
|
|
885
|
+
return new X().fromJson(t, n);
|
|
886
886
|
}
|
|
887
887
|
static fromJsonString(t, n) {
|
|
888
|
-
return new
|
|
888
|
+
return new X().fromJsonString(t, n);
|
|
889
889
|
}
|
|
890
890
|
static equals(t, n) {
|
|
891
|
-
return proto3.util.equals(
|
|
891
|
+
return proto3.util.equals(X, t, n);
|
|
892
892
|
}
|
|
893
893
|
};
|
|
894
|
-
r(
|
|
894
|
+
r(X, "runtime", proto3), r(X, "typeName", "audiotool.document.v1.GetWasmResponse"), r(X, "fields", proto3.util.newFieldList(() => [
|
|
895
895
|
{
|
|
896
896
|
no: 1,
|
|
897
897
|
name: "data",
|
|
@@ -900,27 +900,27 @@ r(H, "runtime", proto3), r(H, "typeName", "audiotool.document.v1.GetWasmResponse
|
|
|
900
900
|
/* ScalarType.BYTES */
|
|
901
901
|
}
|
|
902
902
|
]));
|
|
903
|
-
let GetWasmResponse =
|
|
904
|
-
const
|
|
903
|
+
let GetWasmResponse = X;
|
|
904
|
+
const Y = class Y extends Message {
|
|
905
905
|
constructor(e) {
|
|
906
906
|
super(), proto3.util.initPartial(e, this);
|
|
907
907
|
}
|
|
908
908
|
static fromBinary(e, t) {
|
|
909
|
-
return new
|
|
909
|
+
return new Y().fromBinary(e, t);
|
|
910
910
|
}
|
|
911
911
|
static fromJson(e, t) {
|
|
912
|
-
return new
|
|
912
|
+
return new Y().fromJson(e, t);
|
|
913
913
|
}
|
|
914
914
|
static fromJsonString(e, t) {
|
|
915
|
-
return new
|
|
915
|
+
return new Y().fromJsonString(e, t);
|
|
916
916
|
}
|
|
917
917
|
static equals(e, t) {
|
|
918
|
-
return proto3.util.equals(
|
|
918
|
+
return proto3.util.equals(Y, e, t);
|
|
919
919
|
}
|
|
920
920
|
};
|
|
921
|
-
r(
|
|
922
|
-
let GetWasmExecRequest =
|
|
923
|
-
const
|
|
921
|
+
r(Y, "runtime", proto3), r(Y, "typeName", "audiotool.document.v1.GetWasmExecRequest"), r(Y, "fields", proto3.util.newFieldList(() => []));
|
|
922
|
+
let GetWasmExecRequest = Y;
|
|
923
|
+
const Z = class Z extends Message {
|
|
924
924
|
constructor(t) {
|
|
925
925
|
super();
|
|
926
926
|
/**
|
|
@@ -932,19 +932,19 @@ const X = class X extends Message {
|
|
|
932
932
|
proto3.util.initPartial(t, this);
|
|
933
933
|
}
|
|
934
934
|
static fromBinary(t, n) {
|
|
935
|
-
return new
|
|
935
|
+
return new Z().fromBinary(t, n);
|
|
936
936
|
}
|
|
937
937
|
static fromJson(t, n) {
|
|
938
|
-
return new
|
|
938
|
+
return new Z().fromJson(t, n);
|
|
939
939
|
}
|
|
940
940
|
static fromJsonString(t, n) {
|
|
941
|
-
return new
|
|
941
|
+
return new Z().fromJsonString(t, n);
|
|
942
942
|
}
|
|
943
943
|
static equals(t, n) {
|
|
944
|
-
return proto3.util.equals(
|
|
944
|
+
return proto3.util.equals(Z, t, n);
|
|
945
945
|
}
|
|
946
946
|
};
|
|
947
|
-
r(
|
|
947
|
+
r(Z, "runtime", proto3), r(Z, "typeName", "audiotool.document.v1.GetWasmExecResponse"), r(Z, "fields", proto3.util.newFieldList(() => [
|
|
948
948
|
{
|
|
949
949
|
no: 1,
|
|
950
950
|
name: "data",
|
|
@@ -953,8 +953,8 @@ r(X, "runtime", proto3), r(X, "typeName", "audiotool.document.v1.GetWasmExecResp
|
|
|
953
953
|
/* ScalarType.STRING */
|
|
954
954
|
}
|
|
955
955
|
]));
|
|
956
|
-
let GetWasmExecResponse =
|
|
957
|
-
const
|
|
956
|
+
let GetWasmExecResponse = Z;
|
|
957
|
+
const _ = class _ extends Message {
|
|
958
958
|
constructor(t) {
|
|
959
959
|
super();
|
|
960
960
|
/**
|
|
@@ -979,19 +979,19 @@ const Y = class Y extends Message {
|
|
|
979
979
|
proto3.util.initPartial(t, this);
|
|
980
980
|
}
|
|
981
981
|
static fromBinary(t, n) {
|
|
982
|
-
return new
|
|
982
|
+
return new _().fromBinary(t, n);
|
|
983
983
|
}
|
|
984
984
|
static fromJson(t, n) {
|
|
985
|
-
return new
|
|
985
|
+
return new _().fromJson(t, n);
|
|
986
986
|
}
|
|
987
987
|
static fromJsonString(t, n) {
|
|
988
|
-
return new
|
|
988
|
+
return new _().fromJsonString(t, n);
|
|
989
989
|
}
|
|
990
990
|
static equals(t, n) {
|
|
991
|
-
return proto3.util.equals(
|
|
991
|
+
return proto3.util.equals(_, t, n);
|
|
992
992
|
}
|
|
993
993
|
};
|
|
994
|
-
r(
|
|
994
|
+
r(_, "runtime", proto3), r(_, "typeName", "audiotool.document.v1.PingRequest"), r(_, "fields", proto3.util.newFieldList(() => [
|
|
995
995
|
{
|
|
996
996
|
no: 1,
|
|
997
997
|
name: "project_name",
|
|
@@ -1014,27 +1014,27 @@ r(Y, "runtime", proto3), r(Y, "typeName", "audiotool.document.v1.PingRequest"),
|
|
|
1014
1014
|
/* ScalarType.UINT32 */
|
|
1015
1015
|
}
|
|
1016
1016
|
]));
|
|
1017
|
-
let PingRequest =
|
|
1018
|
-
const
|
|
1017
|
+
let PingRequest = _;
|
|
1018
|
+
const tt = class tt extends Message {
|
|
1019
1019
|
constructor(e) {
|
|
1020
1020
|
super(), proto3.util.initPartial(e, this);
|
|
1021
1021
|
}
|
|
1022
1022
|
static fromBinary(e, t) {
|
|
1023
|
-
return new
|
|
1023
|
+
return new tt().fromBinary(e, t);
|
|
1024
1024
|
}
|
|
1025
1025
|
static fromJson(e, t) {
|
|
1026
|
-
return new
|
|
1026
|
+
return new tt().fromJson(e, t);
|
|
1027
1027
|
}
|
|
1028
1028
|
static fromJsonString(e, t) {
|
|
1029
|
-
return new
|
|
1029
|
+
return new tt().fromJsonString(e, t);
|
|
1030
1030
|
}
|
|
1031
1031
|
static equals(e, t) {
|
|
1032
|
-
return proto3.util.equals(
|
|
1032
|
+
return proto3.util.equals(tt, e, t);
|
|
1033
1033
|
}
|
|
1034
1034
|
};
|
|
1035
|
-
r(
|
|
1036
|
-
let PingResponse =
|
|
1037
|
-
const
|
|
1035
|
+
r(tt, "runtime", proto3), r(tt, "typeName", "audiotool.document.v1.PingResponse"), r(tt, "fields", proto3.util.newFieldList(() => []));
|
|
1036
|
+
let PingResponse = tt;
|
|
1037
|
+
const et = class et extends Message {
|
|
1038
1038
|
constructor(t) {
|
|
1039
1039
|
super();
|
|
1040
1040
|
/**
|
|
@@ -1046,19 +1046,19 @@ const _ = class _ extends Message {
|
|
|
1046
1046
|
proto3.util.initPartial(t, this);
|
|
1047
1047
|
}
|
|
1048
1048
|
static fromBinary(t, n) {
|
|
1049
|
-
return new
|
|
1049
|
+
return new et().fromBinary(t, n);
|
|
1050
1050
|
}
|
|
1051
1051
|
static fromJson(t, n) {
|
|
1052
|
-
return new
|
|
1052
|
+
return new et().fromJson(t, n);
|
|
1053
1053
|
}
|
|
1054
1054
|
static fromJsonString(t, n) {
|
|
1055
|
-
return new
|
|
1055
|
+
return new et().fromJsonString(t, n);
|
|
1056
1056
|
}
|
|
1057
1057
|
static equals(t, n) {
|
|
1058
|
-
return proto3.util.equals(
|
|
1058
|
+
return proto3.util.equals(et, t, n);
|
|
1059
1059
|
}
|
|
1060
1060
|
};
|
|
1061
|
-
r(
|
|
1061
|
+
r(et, "runtime", proto3), r(et, "typeName", "audiotool.document.v1.GetClientStatsRequest"), r(et, "fields", proto3.util.newFieldList(() => [
|
|
1062
1062
|
{
|
|
1063
1063
|
no: 1,
|
|
1064
1064
|
name: "project_name",
|
|
@@ -1067,8 +1067,8 @@ r(_, "runtime", proto3), r(_, "typeName", "audiotool.document.v1.GetClientStatsR
|
|
|
1067
1067
|
/* ScalarType.STRING */
|
|
1068
1068
|
}
|
|
1069
1069
|
]));
|
|
1070
|
-
let GetClientStatsRequest =
|
|
1071
|
-
const
|
|
1070
|
+
let GetClientStatsRequest = et;
|
|
1071
|
+
const nt = class nt extends Message {
|
|
1072
1072
|
constructor(t) {
|
|
1073
1073
|
super();
|
|
1074
1074
|
/**
|
|
@@ -1080,23 +1080,23 @@ const tt = class tt extends Message {
|
|
|
1080
1080
|
proto3.util.initPartial(t, this);
|
|
1081
1081
|
}
|
|
1082
1082
|
static fromBinary(t, n) {
|
|
1083
|
-
return new
|
|
1083
|
+
return new nt().fromBinary(t, n);
|
|
1084
1084
|
}
|
|
1085
1085
|
static fromJson(t, n) {
|
|
1086
|
-
return new
|
|
1086
|
+
return new nt().fromJson(t, n);
|
|
1087
1087
|
}
|
|
1088
1088
|
static fromJsonString(t, n) {
|
|
1089
|
-
return new
|
|
1089
|
+
return new nt().fromJsonString(t, n);
|
|
1090
1090
|
}
|
|
1091
1091
|
static equals(t, n) {
|
|
1092
|
-
return proto3.util.equals(
|
|
1092
|
+
return proto3.util.equals(nt, t, n);
|
|
1093
1093
|
}
|
|
1094
1094
|
};
|
|
1095
|
-
r(
|
|
1095
|
+
r(nt, "runtime", proto3), r(nt, "typeName", "audiotool.document.v1.GetClientStatsResponse"), r(nt, "fields", proto3.util.newFieldList(() => [
|
|
1096
1096
|
{ no: 1, name: "client_info", kind: "message", T: ClientInfo, repeated: !0 }
|
|
1097
1097
|
]));
|
|
1098
|
-
let GetClientStatsResponse =
|
|
1099
|
-
const
|
|
1098
|
+
let GetClientStatsResponse = nt;
|
|
1099
|
+
const it = class it extends Message {
|
|
1100
1100
|
constructor(t) {
|
|
1101
1101
|
super();
|
|
1102
1102
|
/**
|
|
@@ -1127,19 +1127,19 @@ const et = class et extends Message {
|
|
|
1127
1127
|
proto3.util.initPartial(t, this);
|
|
1128
1128
|
}
|
|
1129
1129
|
static fromBinary(t, n) {
|
|
1130
|
-
return new
|
|
1130
|
+
return new it().fromBinary(t, n);
|
|
1131
1131
|
}
|
|
1132
1132
|
static fromJson(t, n) {
|
|
1133
|
-
return new
|
|
1133
|
+
return new it().fromJson(t, n);
|
|
1134
1134
|
}
|
|
1135
1135
|
static fromJsonString(t, n) {
|
|
1136
|
-
return new
|
|
1136
|
+
return new it().fromJsonString(t, n);
|
|
1137
1137
|
}
|
|
1138
1138
|
static equals(t, n) {
|
|
1139
|
-
return proto3.util.equals(
|
|
1139
|
+
return proto3.util.equals(it, t, n);
|
|
1140
1140
|
}
|
|
1141
1141
|
};
|
|
1142
|
-
r(
|
|
1142
|
+
r(it, "runtime", proto3), r(it, "typeName", "audiotool.document.v1.ClientInfo"), r(it, "fields", proto3.util.newFieldList(() => [
|
|
1143
1143
|
{
|
|
1144
1144
|
no: 1,
|
|
1145
1145
|
name: "id",
|
|
@@ -1169,27 +1169,27 @@ r(et, "runtime", proto3), r(et, "typeName", "audiotool.document.v1.ClientInfo"),
|
|
|
1169
1169
|
/* ScalarType.STRING */
|
|
1170
1170
|
}
|
|
1171
1171
|
]));
|
|
1172
|
-
let ClientInfo =
|
|
1173
|
-
const
|
|
1172
|
+
let ClientInfo = it;
|
|
1173
|
+
const ot = class ot extends Message {
|
|
1174
1174
|
constructor(e) {
|
|
1175
1175
|
super(), proto3.util.initPartial(e, this);
|
|
1176
1176
|
}
|
|
1177
1177
|
static fromBinary(e, t) {
|
|
1178
|
-
return new
|
|
1178
|
+
return new ot().fromBinary(e, t);
|
|
1179
1179
|
}
|
|
1180
1180
|
static fromJson(e, t) {
|
|
1181
|
-
return new
|
|
1181
|
+
return new ot().fromJson(e, t);
|
|
1182
1182
|
}
|
|
1183
1183
|
static fromJsonString(e, t) {
|
|
1184
|
-
return new
|
|
1184
|
+
return new ot().fromJsonString(e, t);
|
|
1185
1185
|
}
|
|
1186
1186
|
static equals(e, t) {
|
|
1187
|
-
return proto3.util.equals(
|
|
1187
|
+
return proto3.util.equals(ot, e, t);
|
|
1188
1188
|
}
|
|
1189
1189
|
};
|
|
1190
|
-
r(
|
|
1191
|
-
let GetVersionRequest =
|
|
1192
|
-
const
|
|
1190
|
+
r(ot, "runtime", proto3), r(ot, "typeName", "audiotool.document.v1.GetVersionRequest"), r(ot, "fields", proto3.util.newFieldList(() => []));
|
|
1191
|
+
let GetVersionRequest = ot;
|
|
1192
|
+
const rt = class rt extends Message {
|
|
1193
1193
|
constructor(t) {
|
|
1194
1194
|
super();
|
|
1195
1195
|
/**
|
|
@@ -1201,19 +1201,19 @@ const it = class it extends Message {
|
|
|
1201
1201
|
proto3.util.initPartial(t, this);
|
|
1202
1202
|
}
|
|
1203
1203
|
static fromBinary(t, n) {
|
|
1204
|
-
return new
|
|
1204
|
+
return new rt().fromBinary(t, n);
|
|
1205
1205
|
}
|
|
1206
1206
|
static fromJson(t, n) {
|
|
1207
|
-
return new
|
|
1207
|
+
return new rt().fromJson(t, n);
|
|
1208
1208
|
}
|
|
1209
1209
|
static fromJsonString(t, n) {
|
|
1210
|
-
return new
|
|
1210
|
+
return new rt().fromJsonString(t, n);
|
|
1211
1211
|
}
|
|
1212
1212
|
static equals(t, n) {
|
|
1213
|
-
return proto3.util.equals(
|
|
1213
|
+
return proto3.util.equals(rt, t, n);
|
|
1214
1214
|
}
|
|
1215
1215
|
};
|
|
1216
|
-
r(
|
|
1216
|
+
r(rt, "runtime", proto3), r(rt, "typeName", "audiotool.document.v1.GetVersionResponse"), r(rt, "fields", proto3.util.newFieldList(() => [
|
|
1217
1217
|
{
|
|
1218
1218
|
no: 1,
|
|
1219
1219
|
name: "version",
|
|
@@ -1222,27 +1222,27 @@ r(it, "runtime", proto3), r(it, "typeName", "audiotool.document.v1.GetVersionRes
|
|
|
1222
1222
|
/* ScalarType.STRING */
|
|
1223
1223
|
}
|
|
1224
1224
|
]));
|
|
1225
|
-
let GetVersionResponse =
|
|
1226
|
-
const
|
|
1225
|
+
let GetVersionResponse = rt;
|
|
1226
|
+
const at = class at extends Message {
|
|
1227
1227
|
constructor(e) {
|
|
1228
1228
|
super(), proto3.util.initPartial(e, this);
|
|
1229
1229
|
}
|
|
1230
1230
|
static fromBinary(e, t) {
|
|
1231
|
-
return new
|
|
1231
|
+
return new at().fromBinary(e, t);
|
|
1232
1232
|
}
|
|
1233
1233
|
static fromJson(e, t) {
|
|
1234
|
-
return new
|
|
1234
|
+
return new at().fromJson(e, t);
|
|
1235
1235
|
}
|
|
1236
1236
|
static fromJsonString(e, t) {
|
|
1237
|
-
return new
|
|
1237
|
+
return new at().fromJsonString(e, t);
|
|
1238
1238
|
}
|
|
1239
1239
|
static equals(e, t) {
|
|
1240
|
-
return proto3.util.equals(
|
|
1240
|
+
return proto3.util.equals(at, e, t);
|
|
1241
1241
|
}
|
|
1242
1242
|
};
|
|
1243
|
-
r(
|
|
1244
|
-
let GetTimeRequest =
|
|
1245
|
-
const
|
|
1243
|
+
r(at, "runtime", proto3), r(at, "typeName", "audiotool.document.v1.GetTimeRequest"), r(at, "fields", proto3.util.newFieldList(() => []));
|
|
1244
|
+
let GetTimeRequest = at;
|
|
1245
|
+
const st = class st extends Message {
|
|
1246
1246
|
constructor(t) {
|
|
1247
1247
|
super();
|
|
1248
1248
|
/**
|
|
@@ -1254,19 +1254,19 @@ const rt = class rt extends Message {
|
|
|
1254
1254
|
proto3.util.initPartial(t, this);
|
|
1255
1255
|
}
|
|
1256
1256
|
static fromBinary(t, n) {
|
|
1257
|
-
return new
|
|
1257
|
+
return new st().fromBinary(t, n);
|
|
1258
1258
|
}
|
|
1259
1259
|
static fromJson(t, n) {
|
|
1260
|
-
return new
|
|
1260
|
+
return new st().fromJson(t, n);
|
|
1261
1261
|
}
|
|
1262
1262
|
static fromJsonString(t, n) {
|
|
1263
|
-
return new
|
|
1263
|
+
return new st().fromJsonString(t, n);
|
|
1264
1264
|
}
|
|
1265
1265
|
static equals(t, n) {
|
|
1266
|
-
return proto3.util.equals(
|
|
1266
|
+
return proto3.util.equals(st, t, n);
|
|
1267
1267
|
}
|
|
1268
1268
|
};
|
|
1269
|
-
r(
|
|
1269
|
+
r(st, "runtime", proto3), r(st, "typeName", "audiotool.document.v1.GetTimeResponse"), r(st, "fields", proto3.util.newFieldList(() => [
|
|
1270
1270
|
{
|
|
1271
1271
|
no: 1,
|
|
1272
1272
|
name: "time",
|
|
@@ -1275,7 +1275,7 @@ r(rt, "runtime", proto3), r(rt, "typeName", "audiotool.document.v1.GetTimeRespon
|
|
|
1275
1275
|
/* ScalarType.INT64 */
|
|
1276
1276
|
}
|
|
1277
1277
|
]));
|
|
1278
|
-
let GetTimeResponse =
|
|
1278
|
+
let GetTimeResponse = st;
|
|
1279
1279
|
const wasmUrl = "/document_validator.wasm", wasmJsUrl = "/wasm_exec.js", runningInNode = typeof process < "u";
|
|
1280
1280
|
let wasmDocumentStateBuilderCache;
|
|
1281
1281
|
const getWasmDocumentState = async () => {
|
|
@@ -1304,17 +1304,17 @@ const getWasmDocumentState = async () => {
|
|
|
1304
1304
|
return delete globalThis.createDocumentState, e(() => {
|
|
1305
1305
|
const l = c();
|
|
1306
1306
|
return {
|
|
1307
|
-
applyTransaction(
|
|
1308
|
-
const
|
|
1309
|
-
return
|
|
1310
|
-
modifications:
|
|
1307
|
+
applyTransaction(u) {
|
|
1308
|
+
const m = l.applyTransaction(u.toBinary());
|
|
1309
|
+
return m instanceof Object && "error" in m ? m.error : new Transaction({
|
|
1310
|
+
modifications: m.rollbacks.map((f) => Modification.fromBinary(f))
|
|
1311
1311
|
});
|
|
1312
1312
|
}
|
|
1313
1313
|
};
|
|
1314
1314
|
}), (await i)();
|
|
1315
1315
|
}, executeWrapperJs = async () => {
|
|
1316
1316
|
if (!runningInNode)
|
|
1317
|
-
return import("https://cdn.audiotool.com/website-assets/document-service/
|
|
1317
|
+
return import("https://cdn.audiotool.com/website-assets/document-service/5b85be5b151fe1c949845fe34b15f24ab059c736//wasm_exec.js");
|
|
1318
1318
|
const path = await import("node:path"), url = await import("node:url"), fs = await import("node:fs");
|
|
1319
1319
|
let filePath;
|
|
1320
1320
|
filePath = path.resolve(
|
|
@@ -1333,7 +1333,7 @@ const getWasmDocumentState = async () => {
|
|
|
1333
1333
|
}, loadWasm = async () => {
|
|
1334
1334
|
if (!runningInNode)
|
|
1335
1335
|
return await fetch(
|
|
1336
|
-
"https://cdn.audiotool.com/website-assets/document-service/
|
|
1336
|
+
"https://cdn.audiotool.com/website-assets/document-service/5b85be5b151fe1c949845fe34b15f24ab059c736//document_validator.wasm.gz"
|
|
1337
1337
|
).then(
|
|
1338
1338
|
async (o) => o.ok ? WebAssembly.compileStreaming(o) : throw_("couldn't fetch wasm module")
|
|
1339
1339
|
);
|
|
@@ -1356,12 +1356,12 @@ const getWasmDocumentState = async () => {
|
|
|
1356
1356
|
};
|
|
1357
1357
|
};
|
|
1358
1358
|
var Pt;
|
|
1359
|
-
const
|
|
1359
|
+
const pt = class pt {
|
|
1360
1360
|
constructor(e = void 0, t = void 0, n = []) {
|
|
1361
1361
|
r(this, "entityId");
|
|
1362
1362
|
r(this, "fieldIndex");
|
|
1363
1363
|
r(this, "entityType");
|
|
1364
|
-
|
|
1364
|
+
p(this, Pt);
|
|
1365
1365
|
if (this.entityId = e ?? "", this.fieldIndex = n, this.entityType = t, e !== void 0 && e !== "" && t === void 0)
|
|
1366
1366
|
throw new Error("entity type is required if id is set");
|
|
1367
1367
|
}
|
|
@@ -1377,14 +1377,14 @@ const ft = class ft {
|
|
|
1377
1377
|
}
|
|
1378
1378
|
/** @internal Returns a copy of this object with an appended field number. */
|
|
1379
1379
|
withAppendedFieldNumber(e) {
|
|
1380
|
-
return new
|
|
1380
|
+
return new pt(this.entityId, this.entityType, [
|
|
1381
1381
|
...this.fieldIndex,
|
|
1382
1382
|
e
|
|
1383
1383
|
]);
|
|
1384
1384
|
}
|
|
1385
1385
|
/** @internal */
|
|
1386
1386
|
withFieldIndex(e) {
|
|
1387
|
-
return new
|
|
1387
|
+
return new pt(this.entityId, this.entityType, [...e]);
|
|
1388
1388
|
}
|
|
1389
1389
|
/** @internal */
|
|
1390
1390
|
toPointerMessage() {
|
|
@@ -1405,27 +1405,27 @@ const ft = class ft {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
/** @internal clones the location, updating only the id */
|
|
1407
1407
|
withId(e) {
|
|
1408
|
-
return new
|
|
1408
|
+
return new pt(e, this.entityType, this.fieldIndex.slice());
|
|
1409
1409
|
}
|
|
1410
1410
|
/** @internal */
|
|
1411
1411
|
static fromPointerMessage(e, t) {
|
|
1412
1412
|
if (t.entityId === void 0 || t.entityId === "")
|
|
1413
|
-
return new
|
|
1413
|
+
return new pt();
|
|
1414
1414
|
const n = e(t.entityId);
|
|
1415
1415
|
if (n === void 0)
|
|
1416
1416
|
throw new Error(
|
|
1417
1417
|
`entity type for ${t.entityId} is undefined for a set pointer: ${t.toJsonString()}`
|
|
1418
1418
|
);
|
|
1419
|
-
return new
|
|
1419
|
+
return new pt(t.entityId, n, t.fieldIndex.slice());
|
|
1420
1420
|
}
|
|
1421
1421
|
/** @internal */
|
|
1422
1422
|
static fromSchemaPath(e, t) {
|
|
1423
1423
|
const { entityType: n, fieldIndex: o } = schemaPathToSchemaLocation(t);
|
|
1424
|
-
return new
|
|
1424
|
+
return new pt(e, n, o);
|
|
1425
1425
|
}
|
|
1426
1426
|
};
|
|
1427
1427
|
Pt = new WeakMap();
|
|
1428
|
-
let NexusLocation =
|
|
1428
|
+
let NexusLocation = pt;
|
|
1429
1429
|
const hashNexusLocation = (i, e) => v5(
|
|
1430
1430
|
`${i}/${e.join(",")}`,
|
|
1431
1431
|
"4f4aaf81-65f2-4239-b1df-e34a0729f6b8"
|
|
@@ -1484,7 +1484,7 @@ class PrimitiveField {
|
|
|
1484
1484
|
/** The location of this field within the Nexus document. */
|
|
1485
1485
|
r(this, "location");
|
|
1486
1486
|
/** The value of the field; private with a getter to prevent accidenal overwrites. */
|
|
1487
|
-
|
|
1487
|
+
p(this, kt);
|
|
1488
1488
|
/** Whether the field is mutable. Updating immutable fields results in a transaction error.
|
|
1489
1489
|
*
|
|
1490
1490
|
* If the type fo the field is known at compile time, updating the field using the {@link TransactionBuilder}
|
|
@@ -1564,27 +1564,27 @@ const createNexusFields = (i, e, t, n) => {
|
|
|
1564
1564
|
return t.getType().fields.list().forEach((a) => {
|
|
1565
1565
|
if (a.name === "id" && a.no === 1)
|
|
1566
1566
|
return;
|
|
1567
|
-
const c = n.withAppendedFieldNumber(a.no),
|
|
1567
|
+
const c = n.withAppendedFieldNumber(a.no), d = t[a.localName];
|
|
1568
1568
|
let l;
|
|
1569
1569
|
if (!a.repeated)
|
|
1570
1570
|
l = createField(
|
|
1571
1571
|
i,
|
|
1572
1572
|
e,
|
|
1573
1573
|
c,
|
|
1574
|
-
|
|
1574
|
+
d,
|
|
1575
1575
|
a
|
|
1576
1576
|
);
|
|
1577
1577
|
else {
|
|
1578
|
-
const
|
|
1579
|
-
(
|
|
1578
|
+
const u = d.map(
|
|
1579
|
+
(m, f) => createField(
|
|
1580
1580
|
i,
|
|
1581
1581
|
e,
|
|
1582
|
-
c.withAppendedFieldNumber(
|
|
1583
|
-
|
|
1582
|
+
c.withAppendedFieldNumber(f),
|
|
1583
|
+
m,
|
|
1584
1584
|
a
|
|
1585
1585
|
)
|
|
1586
1586
|
);
|
|
1587
|
-
l = new ArrayField(c,
|
|
1587
|
+
l = new ArrayField(c, u);
|
|
1588
1588
|
}
|
|
1589
1589
|
o[a.localName] = l;
|
|
1590
1590
|
}), o;
|
|
@@ -1726,51 +1726,51 @@ const createNexusFields = (i, e, t, n) => {
|
|
|
1726
1726
|
onUpdate: () => {
|
|
1727
1727
|
},
|
|
1728
1728
|
...(i == null ? void 0 : i.callbacks) ?? {}
|
|
1729
|
-
}, o = /* @__PURE__ */ new Map(), a = (
|
|
1730
|
-
var
|
|
1731
|
-
return ((
|
|
1732
|
-
}, c = (
|
|
1733
|
-
const
|
|
1729
|
+
}, o = /* @__PURE__ */ new Map(), a = (u) => {
|
|
1730
|
+
var m;
|
|
1731
|
+
return ((m = e.get(u)) == null ? void 0 : m.entityType) ?? o.get(u);
|
|
1732
|
+
}, c = (u) => {
|
|
1733
|
+
const m = createEntity(
|
|
1734
1734
|
a,
|
|
1735
1735
|
mustUnpackEntity(
|
|
1736
|
-
|
|
1736
|
+
u.entity ?? throw_("received empty create modification")
|
|
1737
1737
|
)
|
|
1738
1738
|
);
|
|
1739
|
-
e.set(
|
|
1740
|
-
addSourceTarget(t,
|
|
1741
|
-
}), n.onCreate(
|
|
1742
|
-
},
|
|
1743
|
-
const
|
|
1744
|
-
e.delete(
|
|
1745
|
-
removeSourceTarget(t,
|
|
1746
|
-
}), n.onDelete(
|
|
1747
|
-
}, l = (
|
|
1748
|
-
const
|
|
1749
|
-
applyUpdate(
|
|
1750
|
-
onStopPointingTo: (
|
|
1751
|
-
removeSourceTarget(t,
|
|
1739
|
+
e.set(m.id, m), visitPointers$1(m, (f, y) => {
|
|
1740
|
+
addSourceTarget(t, f, y), n.onStartPointingTo(f, y);
|
|
1741
|
+
}), n.onCreate(m);
|
|
1742
|
+
}, d = (u) => {
|
|
1743
|
+
const m = u.entityId, f = e.get(m) ?? throw_("can't find deleted entity");
|
|
1744
|
+
e.delete(m), visitPointers$1(f, (y, v) => {
|
|
1745
|
+
removeSourceTarget(t, y, v), n.onStopPointingTo(y, v);
|
|
1746
|
+
}), n.onDelete(f);
|
|
1747
|
+
}, l = (u) => {
|
|
1748
|
+
const m = u.field ?? throw_("received update without pointer"), f = NexusLocation.fromPointerMessage(a, m), y = e.get(f.entityId) ?? throw_("can't find updated entity"), v = extractPbUpdateValue(u.value, a);
|
|
1749
|
+
applyUpdate(y, f, v, {
|
|
1750
|
+
onStopPointingTo: (w, b) => {
|
|
1751
|
+
removeSourceTarget(t, w, b) || throw_(), n.onStopPointingTo(w, b);
|
|
1752
1752
|
},
|
|
1753
|
-
onStartPointingTo: (
|
|
1754
|
-
addSourceTarget(t,
|
|
1753
|
+
onStartPointingTo: (w, b) => {
|
|
1754
|
+
addSourceTarget(t, w, b), n.onStartPointingTo(w, b);
|
|
1755
1755
|
}
|
|
1756
|
-
}), n.onUpdate(
|
|
1756
|
+
}), n.onUpdate(f, v);
|
|
1757
1757
|
};
|
|
1758
1758
|
return {
|
|
1759
1759
|
entities: e,
|
|
1760
1760
|
references: t,
|
|
1761
|
-
applyModification(
|
|
1762
|
-
const
|
|
1763
|
-
switch (
|
|
1761
|
+
applyModification(u) {
|
|
1762
|
+
const m = u.modification;
|
|
1763
|
+
switch (m.case) {
|
|
1764
1764
|
case "create": {
|
|
1765
|
-
c(
|
|
1765
|
+
c(m.value);
|
|
1766
1766
|
break;
|
|
1767
1767
|
}
|
|
1768
1768
|
case "delete": {
|
|
1769
|
-
|
|
1769
|
+
d(m.value);
|
|
1770
1770
|
break;
|
|
1771
1771
|
}
|
|
1772
1772
|
case "update": {
|
|
1773
|
-
l(
|
|
1773
|
+
l(m.value);
|
|
1774
1774
|
break;
|
|
1775
1775
|
}
|
|
1776
1776
|
}
|
|
@@ -1778,11 +1778,11 @@ const createNexusFields = (i, e, t, n) => {
|
|
|
1778
1778
|
getStats() {
|
|
1779
1779
|
return {
|
|
1780
1780
|
entities: e.size,
|
|
1781
|
-
references: t.values().reduce((
|
|
1781
|
+
references: t.values().reduce((u, m) => u + m.length, 0)
|
|
1782
1782
|
};
|
|
1783
1783
|
},
|
|
1784
|
-
_addEntityTypeForId(
|
|
1785
|
-
o.set(
|
|
1784
|
+
_addEntityTypeForId(u, m) {
|
|
1785
|
+
o.set(u, m);
|
|
1786
1786
|
}
|
|
1787
1787
|
};
|
|
1788
1788
|
}, TerminableBuilder = {
|
|
@@ -1793,17 +1793,17 @@ const createNexusFields = (i, e, t, n) => {
|
|
|
1793
1793
|
}
|
|
1794
1794
|
})
|
|
1795
1795
|
};
|
|
1796
|
-
var
|
|
1796
|
+
var ct, ht, k, lt, dt, At;
|
|
1797
1797
|
const Et = class Et {
|
|
1798
1798
|
constructor(e = nexusDocumentState()) {
|
|
1799
|
-
|
|
1800
|
-
|
|
1799
|
+
p(this, ct, new HashMap());
|
|
1800
|
+
p(this, ht, /* @__PURE__ */ new Map());
|
|
1801
1801
|
/** contains either: entity id, *, or entity type */
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
h(this,
|
|
1802
|
+
p(this, k, /* @__PURE__ */ new Map());
|
|
1803
|
+
p(this, lt, new HashMap());
|
|
1804
|
+
p(this, dt, new HashMap());
|
|
1805
|
+
p(this, At);
|
|
1806
|
+
h(this, At, e), Et.debugWindowInstance ?? (Et.debugWindowInstance = this);
|
|
1807
1807
|
}
|
|
1808
1808
|
/**
|
|
1809
1809
|
* Subscribe to the event that an entity of a specific type is created.
|
|
@@ -1818,18 +1818,18 @@ const Et = class Et {
|
|
|
1818
1818
|
);
|
|
1819
1819
|
c !== void 0 && this.onRemove(a, c);
|
|
1820
1820
|
};
|
|
1821
|
-
return getOrDefault(s(this,
|
|
1821
|
+
return getOrDefault(s(this, ht), e).add(n), TerminableBuilder.terminableFrom(
|
|
1822
1822
|
() => {
|
|
1823
1823
|
var a;
|
|
1824
|
-
return (a = s(this,
|
|
1824
|
+
return (a = s(this, ht).get(e)) == null ? void 0 : a.delete(n);
|
|
1825
1825
|
}
|
|
1826
1826
|
);
|
|
1827
1827
|
}
|
|
1828
1828
|
/** @internal */
|
|
1829
1829
|
_dispatchCreate(e) {
|
|
1830
1830
|
[
|
|
1831
|
-
...s(this,
|
|
1832
|
-
...s(this,
|
|
1831
|
+
...s(this, ht).get("*") ?? [],
|
|
1832
|
+
...s(this, ht).get(e.entityType) ?? []
|
|
1833
1833
|
].forEach((t) => t(e));
|
|
1834
1834
|
}
|
|
1835
1835
|
/**
|
|
@@ -1839,17 +1839,17 @@ const Et = class Et {
|
|
|
1839
1839
|
*/
|
|
1840
1840
|
onUpdate(e, t, n = !0) {
|
|
1841
1841
|
const o = t;
|
|
1842
|
-
return getOrDefault(s(this,
|
|
1842
|
+
return getOrDefault(s(this, ct), e.location).add(o), n && t(e.value), TerminableBuilder.terminableFrom(
|
|
1843
1843
|
() => {
|
|
1844
1844
|
var c;
|
|
1845
|
-
return (c = s(this,
|
|
1845
|
+
return (c = s(this, ct).get(e.location)) == null ? void 0 : c.delete(o);
|
|
1846
1846
|
}
|
|
1847
1847
|
);
|
|
1848
1848
|
}
|
|
1849
1849
|
/** @internal */
|
|
1850
1850
|
_dispatchUpdate(e, t) {
|
|
1851
1851
|
var n;
|
|
1852
|
-
(n = s(this,
|
|
1852
|
+
(n = s(this, ct).get(e)) == null || n.forEach((o) => o(t));
|
|
1853
1853
|
}
|
|
1854
1854
|
/**
|
|
1855
1855
|
* Subscribe to an event where an entity is removed.
|
|
@@ -1866,22 +1866,22 @@ const Et = class Et {
|
|
|
1866
1866
|
onRemove(e, t) {
|
|
1867
1867
|
const n = t;
|
|
1868
1868
|
return getOrDefault(
|
|
1869
|
-
s(this,
|
|
1869
|
+
s(this, k),
|
|
1870
1870
|
typeof e == "string" ? e : e.id
|
|
1871
1871
|
).add(n), TerminableBuilder.terminableFrom(
|
|
1872
1872
|
() => {
|
|
1873
1873
|
var a;
|
|
1874
|
-
return (a = s(this,
|
|
1874
|
+
return (a = s(this, k).get(typeof e == "string" ? e : e.id)) == null ? void 0 : a.delete(n);
|
|
1875
1875
|
}
|
|
1876
1876
|
);
|
|
1877
1877
|
}
|
|
1878
1878
|
/** @internal */
|
|
1879
1879
|
_dispatchRemove(e) {
|
|
1880
1880
|
[
|
|
1881
|
-
...s(this,
|
|
1882
|
-
...s(this,
|
|
1883
|
-
...s(this,
|
|
1884
|
-
].forEach((t) => t(e)), s(this,
|
|
1881
|
+
...s(this, k).get("*") ?? [],
|
|
1882
|
+
...s(this, k).get(e.id) ?? [],
|
|
1883
|
+
...s(this, k).get(e.entityType) ?? []
|
|
1884
|
+
].forEach((t) => t(e)), s(this, k).delete(e.id), [...s(this, lt).keys()].filter((t) => t.entityId === e.id).forEach((t) => s(this, lt).delete(t)), [...s(this, dt).keys()].filter((t) => t.entityId === e.id).forEach((t) => s(this, dt).delete(t)), [...s(this, ct).keys()].filter((t) => t.entityId === e.id).forEach((t) => s(this, ct).delete(t));
|
|
1885
1885
|
}
|
|
1886
1886
|
/** Subscribe to the event that some pointer in the document starts pointing to a given location.
|
|
1887
1887
|
*
|
|
@@ -1903,17 +1903,17 @@ const Et = class Et {
|
|
|
1903
1903
|
*/
|
|
1904
1904
|
onPointingTo(e, t, n = !0) {
|
|
1905
1905
|
var a;
|
|
1906
|
-
return getOrDefault(s(this,
|
|
1906
|
+
return getOrDefault(s(this, lt), e).add(t), n && ((a = s(this, At).references.get(e)) == null || a.forEach((c) => t(c))), TerminableBuilder.terminableFrom(
|
|
1907
1907
|
() => {
|
|
1908
1908
|
var c;
|
|
1909
|
-
return (c = s(this,
|
|
1909
|
+
return (c = s(this, lt).get(e)) == null ? void 0 : c.delete(t);
|
|
1910
1910
|
}
|
|
1911
1911
|
);
|
|
1912
1912
|
}
|
|
1913
1913
|
/** @internal */
|
|
1914
1914
|
_dispatchPointingTo(e, t) {
|
|
1915
1915
|
var n;
|
|
1916
|
-
(n = s(this,
|
|
1916
|
+
(n = s(this, lt).get(e)) == null || n.forEach((o) => o(t));
|
|
1917
1917
|
}
|
|
1918
1918
|
/** Subscribe to the event that some pointer in the document stops pointing to a given location.
|
|
1919
1919
|
*
|
|
@@ -1930,17 +1930,17 @@ const Et = class Et {
|
|
|
1930
1930
|
* @returns A terminable that when terminated will stop dispatching new onStopPointingTo events.
|
|
1931
1931
|
*/
|
|
1932
1932
|
onStopPointingTo(e, t) {
|
|
1933
|
-
return getOrDefault(s(this,
|
|
1933
|
+
return getOrDefault(s(this, dt), e).add(t), TerminableBuilder.terminableFrom(
|
|
1934
1934
|
() => {
|
|
1935
1935
|
var o;
|
|
1936
|
-
return (o = s(this,
|
|
1936
|
+
return (o = s(this, dt).get(e)) == null ? void 0 : o.delete(t);
|
|
1937
1937
|
}
|
|
1938
1938
|
);
|
|
1939
1939
|
}
|
|
1940
1940
|
/** @internal */
|
|
1941
1941
|
_dispatchStopPointingTo(e, t) {
|
|
1942
1942
|
var n;
|
|
1943
|
-
(n = s(this,
|
|
1943
|
+
(n = s(this, dt).get(e)) == null || n.forEach((o) => o(t));
|
|
1944
1944
|
}
|
|
1945
1945
|
/**
|
|
1946
1946
|
* @internal
|
|
@@ -1948,15 +1948,15 @@ const Et = class Et {
|
|
|
1948
1948
|
* on large documents. Don't call too often. */
|
|
1949
1949
|
getStats() {
|
|
1950
1950
|
return {
|
|
1951
|
-
numCreateListeners: sizeOf(s(this,
|
|
1952
|
-
numUpdateListeners: sizeOf(s(this,
|
|
1953
|
-
numRemoveListeners: sizeOf(s(this,
|
|
1954
|
-
numPointingToListeners: sizeOf(s(this,
|
|
1955
|
-
numStopPointingToListeners: sizeOf(s(this,
|
|
1951
|
+
numCreateListeners: sizeOf(s(this, ht)),
|
|
1952
|
+
numUpdateListeners: sizeOf(s(this, ct)),
|
|
1953
|
+
numRemoveListeners: sizeOf(s(this, k)),
|
|
1954
|
+
numPointingToListeners: sizeOf(s(this, lt)),
|
|
1955
|
+
numStopPointingToListeners: sizeOf(s(this, dt))
|
|
1956
1956
|
};
|
|
1957
1957
|
}
|
|
1958
1958
|
};
|
|
1959
|
-
|
|
1959
|
+
ct = new WeakMap(), ht = new WeakMap(), k = new WeakMap(), lt = new WeakMap(), dt = new WeakMap(), At = new WeakMap(), /**
|
|
1960
1960
|
* @internal
|
|
1961
1961
|
* For debugging purposes, the first instance of the nexus event manager ever created. */
|
|
1962
1962
|
r(Et, "debugWindowInstance");
|
|
@@ -1970,7 +1970,7 @@ const sizeOf = (i) => i.values().reduce((e, t) => e + t.size, 0), getOrDefault =
|
|
|
1970
1970
|
validate: () => {
|
|
1971
1971
|
}
|
|
1972
1972
|
});
|
|
1973
|
-
var Mt, Tt, It, Nt,
|
|
1973
|
+
var Mt, Tt, It, Nt, ft, Bt, Xt;
|
|
1974
1974
|
const zt = class zt {
|
|
1975
1975
|
constructor({
|
|
1976
1976
|
getFields: e,
|
|
@@ -1978,34 +1978,34 @@ const zt = class zt {
|
|
|
1978
1978
|
filterFields: n,
|
|
1979
1979
|
documentLock: o
|
|
1980
1980
|
}) {
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1981
|
+
p(this, ft);
|
|
1982
|
+
p(this, Mt);
|
|
1983
|
+
p(this, Tt);
|
|
1984
|
+
p(this, It);
|
|
1985
|
+
p(this, Nt);
|
|
1986
1986
|
h(this, Mt, e), h(this, Tt, t), h(this, It, n), h(this, Nt, o);
|
|
1987
1987
|
}
|
|
1988
1988
|
/** Only keep fields that are marked with target type appearing in `targetTypes`. */
|
|
1989
1989
|
ofTargetTypes(...e) {
|
|
1990
|
-
return
|
|
1990
|
+
return g(this, ft, Bt).call(this, (t) => getSchemaLocationDetails(t.location).targetTypes.some(
|
|
1991
1991
|
(n) => e.includes(n)
|
|
1992
1992
|
));
|
|
1993
1993
|
}
|
|
1994
1994
|
/** Only keep fields that aren't pointed to by any other field in the nexus document. */
|
|
1995
1995
|
notPointedTo() {
|
|
1996
|
-
return
|
|
1996
|
+
return g(this, ft, Bt).call(this, (e) => {
|
|
1997
1997
|
const t = s(this, Tt).call(this).get(e.location);
|
|
1998
1998
|
return t === void 0 || t.length === 0;
|
|
1999
1999
|
});
|
|
2000
2000
|
}
|
|
2001
2001
|
pointedToBy(e) {
|
|
2002
|
-
return
|
|
2002
|
+
return g(this, ft, Bt).call(this, (t) => {
|
|
2003
2003
|
const n = s(this, Tt).call(this).get(t.location);
|
|
2004
2004
|
return n !== void 0 && n.some((o) => o.equals(e));
|
|
2005
2005
|
});
|
|
2006
2006
|
}
|
|
2007
2007
|
primitiveFields() {
|
|
2008
|
-
return
|
|
2008
|
+
return g(this, ft, Bt).call(this, (e) => e instanceof PrimitiveField);
|
|
2009
2009
|
}
|
|
2010
2010
|
/** Returns all primitive fields selected using this query */
|
|
2011
2011
|
get() {
|
|
@@ -2020,14 +2020,14 @@ const zt = class zt {
|
|
|
2020
2020
|
* part of a ComparableMap that maps entity ids to fields for that entity.
|
|
2021
2021
|
*/
|
|
2022
2022
|
getByEntity() {
|
|
2023
|
-
|
|
2023
|
+
g(this, ft, Xt).call(this);
|
|
2024
2024
|
const e = /* @__PURE__ */ new Map();
|
|
2025
2025
|
return this.get().forEach((t) => {
|
|
2026
2026
|
e.has(t.location.entityId) || e.set(t.location.entityId, []), (e.get(t.location.entityId) ?? throw_()).push(t);
|
|
2027
2027
|
}), e;
|
|
2028
2028
|
}
|
|
2029
2029
|
};
|
|
2030
|
-
Mt = new WeakMap(), Tt = new WeakMap(), It = new WeakMap(), Nt = new WeakMap(),
|
|
2030
|
+
Mt = new WeakMap(), Tt = new WeakMap(), It = new WeakMap(), Nt = new WeakMap(), ft = new WeakSet(), Bt = function(e) {
|
|
2031
2031
|
return new zt({
|
|
2032
2032
|
getFields: s(this, Mt),
|
|
2033
2033
|
getRefs: s(this, Tt),
|
|
@@ -2040,12 +2040,12 @@ Mt = new WeakMap(), Tt = new WeakMap(), It = new WeakMap(), Nt = new WeakMap(),
|
|
|
2040
2040
|
throw new Error("Document is not locked");
|
|
2041
2041
|
};
|
|
2042
2042
|
let FieldQuery = zt;
|
|
2043
|
-
var x,
|
|
2043
|
+
var x, ut, vt, T, E, gt;
|
|
2044
2044
|
const Kt = class Kt {
|
|
2045
2045
|
/** Don't construct this class, it is constructed by NexusDocument. */
|
|
2046
2046
|
constructor(e) {
|
|
2047
|
-
|
|
2048
|
-
|
|
2047
|
+
p(this, T);
|
|
2048
|
+
p(this, x);
|
|
2049
2049
|
/** This function filters & transforms entities. When modifying a query,
|
|
2050
2050
|
* (e.g. with `ofTypes`, we basically "append" another function
|
|
2051
2051
|
* to this one that filters and casts the entities.
|
|
@@ -2053,14 +2053,14 @@ const Kt = class Kt {
|
|
|
2053
2053
|
* When calling `run`, we get all entities and filter them using this function
|
|
2054
2054
|
* before returning all existing entities.
|
|
2055
2055
|
*/
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
h(this, x, (e == null ? void 0 : e.documentState) ?? nexusDocumentState()), h(this,
|
|
2056
|
+
p(this, ut);
|
|
2057
|
+
p(this, vt);
|
|
2058
|
+
h(this, x, (e == null ? void 0 : e.documentState) ?? nexusDocumentState()), h(this, ut, (e == null ? void 0 : e.filterEntities) ?? ((t) => t)), h(this, vt, e == null ? void 0 : e.documentLock);
|
|
2059
2059
|
}
|
|
2060
2060
|
/** Returns all entities selected by this query, in undefined order.
|
|
2061
2061
|
*/
|
|
2062
2062
|
get() {
|
|
2063
|
-
return
|
|
2063
|
+
return g(this, T, gt).call(this), [...s(this, ut).call(this, s(this, x).entities).values()];
|
|
2064
2064
|
}
|
|
2065
2065
|
/** Returns the first entity returned by `get()`, if any.
|
|
2066
2066
|
*
|
|
@@ -2069,11 +2069,11 @@ const Kt = class Kt {
|
|
|
2069
2069
|
* if it's known that the query will return at most one entity.
|
|
2070
2070
|
*/
|
|
2071
2071
|
getOne() {
|
|
2072
|
-
return
|
|
2072
|
+
return g(this, T, gt).call(this), this.get()[0];
|
|
2073
2073
|
}
|
|
2074
2074
|
/** Of all selected entities, return the one with id `id`, if it exists. */
|
|
2075
2075
|
getEntity(e) {
|
|
2076
|
-
return
|
|
2076
|
+
return g(this, T, gt).call(this), s(this, ut).call(this, s(this, x).entities).get(e);
|
|
2077
2077
|
}
|
|
2078
2078
|
/**
|
|
2079
2079
|
* Of all selected entities, return the one with id `id`. Throw if it doesn't
|
|
@@ -2087,7 +2087,7 @@ const Kt = class Kt {
|
|
|
2087
2087
|
* of the provided types.
|
|
2088
2088
|
*/
|
|
2089
2089
|
getEntityAs(e, ...t) {
|
|
2090
|
-
|
|
2090
|
+
g(this, T, gt).call(this), assert(t.length > 0, "must provide at least one type");
|
|
2091
2091
|
const n = this.getEntity(e);
|
|
2092
2092
|
if (n !== void 0 && t.includes(n.entityType))
|
|
2093
2093
|
return n;
|
|
@@ -2097,7 +2097,7 @@ const Kt = class Kt {
|
|
|
2097
2097
|
* provided types. Throw if it doesn't exist.
|
|
2098
2098
|
*/
|
|
2099
2099
|
mustGetEntityAs(e, ...t) {
|
|
2100
|
-
|
|
2100
|
+
g(this, T, gt).call(this), assert(t.length > 0, "must provide at least one type");
|
|
2101
2101
|
const n = this.mustGetEntity(e);
|
|
2102
2102
|
return t.includes(n.entityType) ? n : throw_(
|
|
2103
2103
|
`entity with uuid ${e} is not of any of the provided types ${t}`
|
|
@@ -2105,7 +2105,7 @@ const Kt = class Kt {
|
|
|
2105
2105
|
}
|
|
2106
2106
|
/** Only keep entities whose id appears in `ids`. */
|
|
2107
2107
|
withIds(...e) {
|
|
2108
|
-
return
|
|
2108
|
+
return g(this, T, E).call(this, (t) => filterByUuids(t, e));
|
|
2109
2109
|
}
|
|
2110
2110
|
/** Return the `FieldQuery<NexusField>` that starts with all fields of all
|
|
2111
2111
|
* currently selected entities.
|
|
@@ -2113,7 +2113,7 @@ const Kt = class Kt {
|
|
|
2113
2113
|
fields() {
|
|
2114
2114
|
return new FieldQuery({
|
|
2115
2115
|
getFields: () => [
|
|
2116
|
-
...s(this,
|
|
2116
|
+
...s(this, ut).call(this, s(this, x).entities).values()
|
|
2117
2117
|
].flatMap((e) => toFields(e)),
|
|
2118
2118
|
getRefs: () => s(this, x).references,
|
|
2119
2119
|
filterFields: () => !0,
|
|
@@ -2124,7 +2124,7 @@ const Kt = class Kt {
|
|
|
2124
2124
|
* in `targetTypes`. Target types of fields of entities are ignored.
|
|
2125
2125
|
*/
|
|
2126
2126
|
ofTargetTypes(...e) {
|
|
2127
|
-
return
|
|
2127
|
+
return g(this, T, E).call(this, (t) => {
|
|
2128
2128
|
const n = /* @__PURE__ */ new Map();
|
|
2129
2129
|
return t.forEach((o, a) => {
|
|
2130
2130
|
getSchemaLocationDetails(o.location).targetTypes.some(
|
|
@@ -2135,17 +2135,17 @@ const Kt = class Kt {
|
|
|
2135
2135
|
}
|
|
2136
2136
|
/** Check if a specific entity is contained in the current query. */
|
|
2137
2137
|
has(e) {
|
|
2138
|
-
|
|
2138
|
+
g(this, T, gt).call(this);
|
|
2139
2139
|
const t = typeof e == "string" ? e : e.id;
|
|
2140
|
-
return s(this,
|
|
2140
|
+
return s(this, ut).call(this, s(this, x).entities).has(t);
|
|
2141
2141
|
}
|
|
2142
2142
|
/** Only keep entities whose type string appears in `types`. */
|
|
2143
2143
|
ofTypes(...e) {
|
|
2144
|
-
return
|
|
2144
|
+
return g(this, T, E).call(this, (t) => filterByType(t, e));
|
|
2145
2145
|
}
|
|
2146
2146
|
/** Omit entities whose type string appears in `types`. */
|
|
2147
2147
|
notOfTypes(...e) {
|
|
2148
|
-
return
|
|
2148
|
+
return g(this, T, E).call(this, (t) => omitByType(t, e));
|
|
2149
2149
|
}
|
|
2150
2150
|
/** Only keep entities that have some fields that point to:
|
|
2151
2151
|
* * `entityOfType`: some field of entities of a set of types
|
|
@@ -2161,7 +2161,7 @@ const Kt = class Kt {
|
|
|
2161
2161
|
*/
|
|
2162
2162
|
get pointingTo() {
|
|
2163
2163
|
return {
|
|
2164
|
-
entityOfType: (...e) =>
|
|
2164
|
+
entityOfType: (...e) => g(this, T, E).call(this, (t) => filterByUuids(
|
|
2165
2165
|
t,
|
|
2166
2166
|
getUuidsPointingToTypes(
|
|
2167
2167
|
s(this, x).references,
|
|
@@ -2169,11 +2169,11 @@ const Kt = class Kt {
|
|
|
2169
2169
|
...e
|
|
2170
2170
|
)
|
|
2171
2171
|
)),
|
|
2172
|
-
locations: (...e) =>
|
|
2172
|
+
locations: (...e) => g(this, T, E).call(this, (t) => filterByUuids(
|
|
2173
2173
|
t,
|
|
2174
2174
|
getUuidsPointingToLocations(s(this, x).references, e)
|
|
2175
2175
|
)),
|
|
2176
|
-
entities: (...e) =>
|
|
2176
|
+
entities: (...e) => g(this, T, E).call(this, (t) => filterByUuids(
|
|
2177
2177
|
t,
|
|
2178
2178
|
getUuidsPointingToEntities(s(this, x).references, e)
|
|
2179
2179
|
))
|
|
@@ -2193,7 +2193,7 @@ const Kt = class Kt {
|
|
|
2193
2193
|
*/
|
|
2194
2194
|
get pointedToBy() {
|
|
2195
2195
|
return {
|
|
2196
|
-
entityOfType: (...e) =>
|
|
2196
|
+
entityOfType: (...e) => g(this, T, E).call(this, (t) => filterByUuids(
|
|
2197
2197
|
t,
|
|
2198
2198
|
getUuidsPointedToByTypes(
|
|
2199
2199
|
s(this, x).references,
|
|
@@ -2201,25 +2201,25 @@ const Kt = class Kt {
|
|
|
2201
2201
|
...e
|
|
2202
2202
|
)
|
|
2203
2203
|
)),
|
|
2204
|
-
locations: (...e) =>
|
|
2204
|
+
locations: (...e) => g(this, T, E).call(this, (t) => filterByUuids(
|
|
2205
2205
|
t,
|
|
2206
2206
|
getUuidsPointedToByLocations(s(this, x).references, e)
|
|
2207
2207
|
)),
|
|
2208
|
-
entities: (...e) =>
|
|
2208
|
+
entities: (...e) => g(this, T, E).call(this, (t) => filterByUuids(
|
|
2209
2209
|
t,
|
|
2210
2210
|
getUuidsPointedToByEntities(s(this, x).references, e)
|
|
2211
2211
|
))
|
|
2212
2212
|
};
|
|
2213
2213
|
}
|
|
2214
2214
|
};
|
|
2215
|
-
x = new WeakMap(),
|
|
2215
|
+
x = new WeakMap(), ut = new WeakMap(), vt = new WeakMap(), T = new WeakSet(), /** Return a copy of this class, with a new function "appended" to the
|
|
2216
2216
|
* filter pipeline. The filter can change the type of the entity, or
|
|
2217
2217
|
* remove entities from the query.
|
|
2218
2218
|
*/
|
|
2219
2219
|
E = function(e) {
|
|
2220
2220
|
return new Kt({
|
|
2221
2221
|
documentState: s(this, x),
|
|
2222
|
-
filterEntities: (t) => e(s(this,
|
|
2222
|
+
filterEntities: (t) => e(s(this, ut).call(this, t)),
|
|
2223
2223
|
documentLock: s(this, vt)
|
|
2224
2224
|
});
|
|
2225
2225
|
}, gt = function() {
|
|
@@ -2363,8 +2363,8 @@ const filterByType = (i, e) => {
|
|
|
2363
2363
|
), assert(
|
|
2364
2364
|
a.length === c.length,
|
|
2365
2365
|
`tried overriding repeated field ${n.localName} with array of different length`
|
|
2366
|
-
), a.forEach((
|
|
2367
|
-
c[l] = toFieldValue(i, n, c[l],
|
|
2366
|
+
), a.forEach((d, l) => {
|
|
2367
|
+
c[l] = toFieldValue(i, n, c[l], d);
|
|
2368
2368
|
});
|
|
2369
2369
|
});
|
|
2370
2370
|
}, toFieldValue = (i, e, t, n) => {
|
|
@@ -2423,24 +2423,24 @@ const filterByType = (i, e) => {
|
|
|
2423
2423
|
const n = /* @__PURE__ */ new Map();
|
|
2424
2424
|
e.forEach((l) => n.set(l.entity.id, l));
|
|
2425
2425
|
const o = /* @__PURE__ */ new Map(), a = [];
|
|
2426
|
-
[...n.values()].forEach(({ entity: l, overwrites:
|
|
2427
|
-
const
|
|
2428
|
-
|
|
2429
|
-
const
|
|
2430
|
-
const
|
|
2431
|
-
return
|
|
2426
|
+
[...n.values()].forEach(({ entity: l, overwrites: u }) => {
|
|
2427
|
+
const m = entityToConstructorType(l), f = createDefaultEntityMessage(l.entityType);
|
|
2428
|
+
f.id = t.get(l.id) ?? throw_();
|
|
2429
|
+
const y = mapConstructorLocations(m, (v) => {
|
|
2430
|
+
const w = t.get(v.entityId);
|
|
2431
|
+
return w !== void 0 ? (a.push([f.id, w]), new NexusLocation(w, v.entityType, [
|
|
2432
2432
|
...v.fieldIndex
|
|
2433
2433
|
])) : v;
|
|
2434
2434
|
});
|
|
2435
|
-
updateEntityMessageWithConstructor(
|
|
2435
|
+
updateEntityMessageWithConstructor(f, y), u !== void 0 && updateEntityMessageWithConstructor(f, u), o.set(f.id, [l.entityType, f]);
|
|
2436
2436
|
});
|
|
2437
|
-
const c = toposort(a).reverse(),
|
|
2437
|
+
const c = toposort(a).reverse(), d = [...o.keys()].filter(
|
|
2438
2438
|
(l) => !c.includes(l)
|
|
2439
2439
|
);
|
|
2440
2440
|
return {
|
|
2441
|
-
modifications: [...c, ...
|
|
2442
|
-
const [,
|
|
2443
|
-
return buildCreateModification(
|
|
2441
|
+
modifications: [...c, ...d].map((l) => {
|
|
2442
|
+
const [, u] = o.get(l) ?? throw_();
|
|
2443
|
+
return buildCreateModification(u);
|
|
2444
2444
|
}),
|
|
2445
2445
|
uuidMap: t
|
|
2446
2446
|
};
|
|
@@ -2697,8 +2697,8 @@ const filterByType = (i, e) => {
|
|
|
2697
2697
|
throw new CallAfterSendError("cloneLinked");
|
|
2698
2698
|
const { modifications: n, uuidMap: o } = buildModificationsForCloneLinkedEntities(...t);
|
|
2699
2699
|
return n.forEach((a) => i.applyModification(a, !0)), t.map((a) => {
|
|
2700
|
-
const c = a instanceof NexusEntity ? a.id : a.entity.id,
|
|
2701
|
-
return i.query.mustGetEntity(
|
|
2700
|
+
const c = a instanceof NexusEntity ? a.id : a.entity.id, d = o.get(c) ?? throw_();
|
|
2701
|
+
return i.query.mustGetEntity(d);
|
|
2702
2702
|
});
|
|
2703
2703
|
},
|
|
2704
2704
|
update: (t, n) => {
|
|
@@ -2770,10 +2770,10 @@ class CallAfterSendError extends Error {
|
|
|
2770
2770
|
);
|
|
2771
2771
|
}
|
|
2772
2772
|
}
|
|
2773
|
-
var
|
|
2773
|
+
var mt, P, M, yt, xt, Dt, Ft, Ot, Gt;
|
|
2774
2774
|
class NexusDocument {
|
|
2775
2775
|
constructor(e) {
|
|
2776
|
-
|
|
2776
|
+
p(this, Ot);
|
|
2777
2777
|
/** Public field to query the entities in the document.
|
|
2778
2778
|
*
|
|
2779
2779
|
* ## Careful
|
|
@@ -2817,64 +2817,52 @@ class NexusDocument {
|
|
|
2817
2817
|
* If the transaction is incoming `local` is `false`.
|
|
2818
2818
|
*/
|
|
2819
2819
|
r(this, "onModification", new Notifier());
|
|
2820
|
-
/** Public field to query the entities in the document.
|
|
2821
|
-
*
|
|
2822
|
-
* @deprecated Don't use this field, as it can cause race conditions on the nexus document.
|
|
2823
|
-
*
|
|
2824
|
-
* Instead, use
|
|
2825
|
-
* * for building a transaction: {@link TransactionBuilder.entities}
|
|
2826
|
-
* * for other purposes, being aware of caveats: {@link NexusDocument.queryEntitiesWithoutLock}
|
|
2827
|
-
*
|
|
2828
|
-
*/
|
|
2829
|
-
r(this, "entities");
|
|
2830
2820
|
/** Keeps track of all entities currently in the document. */
|
|
2831
|
-
|
|
2821
|
+
p(this, mt);
|
|
2832
2822
|
/**
|
|
2833
2823
|
* Lock that protects transactions. Only one transaction can be created at a time.
|
|
2834
2824
|
*/
|
|
2835
|
-
|
|
2825
|
+
p(this, P, new AsyncLock());
|
|
2836
2826
|
/** The connection to the backend */
|
|
2837
|
-
|
|
2827
|
+
p(this, M);
|
|
2838
2828
|
/** Validates any and all modifications */
|
|
2839
|
-
|
|
2829
|
+
p(this, yt);
|
|
2840
2830
|
/**
|
|
2841
2831
|
* This flag is set to true if {@link takeTransactions} is called. Before that, no transactions
|
|
2842
2832
|
* from the backend are processed, and no transactions are allowed to be created from the frontend.
|
|
2843
2833
|
*
|
|
2844
2834
|
* This is to make sure that all `onCreate` callbacks are attached before any entity is created.
|
|
2845
2835
|
*/
|
|
2846
|
-
|
|
2836
|
+
p(this, xt, !1);
|
|
2847
2837
|
/**
|
|
2848
2838
|
* The number of modifications applied to the document for incoming transactions before control
|
|
2849
2839
|
* is yield to the scheduler.
|
|
2850
2840
|
*/
|
|
2851
|
-
|
|
2841
|
+
p(this, Dt);
|
|
2852
2842
|
/** The delay between two gateway.synchronize() calls to sync with backend. */
|
|
2853
|
-
|
|
2854
|
-
h(this,
|
|
2843
|
+
p(this, Ft);
|
|
2844
|
+
h(this, Ft, (e == null ? void 0 : e.synchronizeEveryMs) ?? 16), h(this, Dt, (e == null ? void 0 : e.incomingModificationsBatchSize) ?? 20), h(this, mt, nexusDocumentState({
|
|
2855
2845
|
callbacks: {
|
|
2856
|
-
onStartPointingTo: (
|
|
2857
|
-
this.events._dispatchPointingTo(
|
|
2846
|
+
onStartPointingTo: (t, n) => {
|
|
2847
|
+
this.events._dispatchPointingTo(n, t);
|
|
2858
2848
|
},
|
|
2859
|
-
onStopPointingTo: (
|
|
2860
|
-
this.events._dispatchStopPointingTo(
|
|
2849
|
+
onStopPointingTo: (t, n) => {
|
|
2850
|
+
this.events._dispatchStopPointingTo(n, t);
|
|
2861
2851
|
},
|
|
2862
|
-
onUpdate: (
|
|
2863
|
-
this.events._dispatchUpdate(
|
|
2852
|
+
onUpdate: (t, n) => {
|
|
2853
|
+
this.events._dispatchUpdate(t, n);
|
|
2864
2854
|
},
|
|
2865
|
-
onCreate: (
|
|
2866
|
-
this.events._dispatchCreate(
|
|
2855
|
+
onCreate: (t) => {
|
|
2856
|
+
this.events._dispatchCreate(t);
|
|
2867
2857
|
},
|
|
2868
|
-
onDelete: (
|
|
2869
|
-
this.events._dispatchRemove(
|
|
2858
|
+
onDelete: (t) => {
|
|
2859
|
+
this.events._dispatchRemove(t);
|
|
2870
2860
|
}
|
|
2871
2861
|
}
|
|
2872
|
-
}))
|
|
2873
|
-
|
|
2874
|
-
documentState: s(this, dt),
|
|
2862
|
+
})), this.queryEntitiesWithoutLock = new EntityQuery({
|
|
2863
|
+
documentState: s(this, mt),
|
|
2875
2864
|
documentLock: void 0
|
|
2876
|
-
});
|
|
2877
|
-
this.entities = t, this.queryEntitiesWithoutLock = t, this.events = new NexusEventManager(s(this, dt));
|
|
2865
|
+
}), this.events = new NexusEventManager(s(this, mt));
|
|
2878
2866
|
}
|
|
2879
2867
|
/**
|
|
2880
2868
|
* This flag is set to true if {@link takeTransactions} is called. Before that, no transactions
|
|
@@ -2898,31 +2886,28 @@ class NexusDocument {
|
|
|
2898
2886
|
* Note that every transaction by default is undoable, unless the flag in {@link TransactionOptions} is set to false.
|
|
2899
2887
|
* @returns: {@link TransactionBuilder}
|
|
2900
2888
|
*/
|
|
2901
|
-
async createTransaction(e) {
|
|
2902
|
-
assert(
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
documentState: s(this, dt),
|
|
2908
|
-
documentLock: s(this, ht)
|
|
2909
|
-
}), a = (e == null ? void 0 : e.actionId) ?? Symbol();
|
|
2889
|
+
async createTransaction(e, t = !0) {
|
|
2890
|
+
assert(s(this, xt), "Transactions not allowed yet"), assert(s(this, M) !== void 0, "Gateway not initialized"), assert(s(this, yt) !== void 0, "Validator not initialized");
|
|
2891
|
+
const n = t ? await s(this, P).acquire() : void 0, o = [], a = new EntityQuery({
|
|
2892
|
+
documentState: s(this, mt),
|
|
2893
|
+
documentLock: s(this, P)
|
|
2894
|
+
}), c = (e == null ? void 0 : e.actionId) ?? Symbol();
|
|
2910
2895
|
return transactionBuilder({
|
|
2911
|
-
applyModification: (
|
|
2912
|
-
const
|
|
2896
|
+
applyModification: (d, l) => {
|
|
2897
|
+
const u = g(this, Ot, Gt).call(this, d, {
|
|
2913
2898
|
local: !0,
|
|
2914
|
-
throwIfInvalid:
|
|
2915
|
-
actionId:
|
|
2899
|
+
throwIfInvalid: l,
|
|
2900
|
+
actionId: c
|
|
2916
2901
|
});
|
|
2917
|
-
if (
|
|
2918
|
-
return
|
|
2919
|
-
|
|
2902
|
+
if (u !== void 0)
|
|
2903
|
+
return u;
|
|
2904
|
+
o.push(d);
|
|
2920
2905
|
},
|
|
2921
2906
|
finish: () => {
|
|
2922
|
-
var
|
|
2923
|
-
return
|
|
2907
|
+
var d;
|
|
2908
|
+
return o.length === 0 ? (n == null || n.release(), []) : ((d = s(this, M)) == null || d.send(new Transaction({ modifications: o })), n == null || n.release(), o);
|
|
2924
2909
|
},
|
|
2925
|
-
query:
|
|
2910
|
+
query: a
|
|
2926
2911
|
});
|
|
2927
2912
|
}
|
|
2928
2913
|
/**
|
|
@@ -2957,42 +2942,64 @@ class NexusDocument {
|
|
|
2957
2942
|
async takeTransactions(e) {
|
|
2958
2943
|
if (s(this, xt))
|
|
2959
2944
|
throw new Error("called `takeTransactions()` twice");
|
|
2960
|
-
h(this, yt, (e == null ? void 0 : e.validator) ?? mockNexusValidator()), h(this,
|
|
2945
|
+
h(this, yt, (e == null ? void 0 : e.validator) ?? mockNexusValidator()), h(this, M, (e == null ? void 0 : e.gateway) ?? mockNexusGateway());
|
|
2961
2946
|
let t;
|
|
2962
|
-
s(this,
|
|
2963
|
-
|
|
2947
|
+
s(this, M).blocked.subscribe(async (l) => {
|
|
2948
|
+
l ? t === void 0 && (t = await s(this, P).acquire()) : (t == null || t.release(), t = void 0);
|
|
2964
2949
|
});
|
|
2965
|
-
const
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2950
|
+
const n = await s(this, P).acquire();
|
|
2951
|
+
h(this, xt, !0);
|
|
2952
|
+
const {
|
|
2953
|
+
promise: o,
|
|
2954
|
+
resolve: a
|
|
2955
|
+
} = Promise.withResolvers(), c = asyncInterval(async () => {
|
|
2956
|
+
const l = (s(this, M) ?? throw_()).synchronize();
|
|
2957
|
+
if (l.length === 0)
|
|
2958
|
+
return;
|
|
2959
|
+
const u = l.flatMap((m) => m.modifications).length;
|
|
2960
|
+
await this.applyIncomingTransactions(l, {
|
|
2961
|
+
_takeTransactionLock: !1
|
|
2962
|
+
}), c.terminate(), a(u > 0);
|
|
2963
|
+
}, s(this, Ft)), d = await o;
|
|
2964
|
+
if ((e == null ? void 0 : e.templateTransaction) !== void 0)
|
|
2965
|
+
if (d)
|
|
2966
|
+
console.error(
|
|
2967
|
+
"Could not apply template transaction to document: Project state from backend is not empty."
|
|
2968
|
+
);
|
|
2969
|
+
else {
|
|
2970
|
+
const l = await e.templateTransaction, u = await this.createTransaction(void 0, !1);
|
|
2971
|
+
l.modifications.forEach((m) => u._addModification(m)), u.send();
|
|
2970
2972
|
}
|
|
2971
|
-
|
|
2973
|
+
n.release(), asyncInterval(async () => {
|
|
2974
|
+
const l = await s(this, P).acquire(), u = (s(this, M) ?? throw_()).synchronize();
|
|
2975
|
+
await this.applyIncomingTransactions(u, { _takeTransactionLock: !1 }), l.release();
|
|
2976
|
+
}, s(this, Ft));
|
|
2972
2977
|
}
|
|
2973
2978
|
/** Apply a transaction that doesn't originate from this document. Yields to the browser
|
|
2974
2979
|
* scheduler every few modifications applied to make sure we don't block the main thread
|
|
2975
2980
|
* for too long for big transactions. Throws if the transaction lock isn't taken.
|
|
2981
|
+
*
|
|
2976
2982
|
*/
|
|
2977
|
-
async applyIncomingTransactions(e) {
|
|
2978
|
-
assert(s(this,
|
|
2979
|
-
const
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2983
|
+
async applyIncomingTransactions(e, t) {
|
|
2984
|
+
assert(s(this, M) !== void 0, "Gateway not initialized"), assert(s(this, yt) !== void 0, "Validator not initialized");
|
|
2985
|
+
const n = (t == null ? void 0 : t._takeTransactionLock) ?? !0 ? await s(this, P).acquire() : assert(
|
|
2986
|
+
s(this, P).locked,
|
|
2987
|
+
"if takeTransactionLock is false, the lock must be held."
|
|
2988
|
+
);
|
|
2989
|
+
for (const o of e)
|
|
2990
|
+
for (const [a, c] of o.modifications.entries())
|
|
2991
|
+
g(this, Ot, Gt).call(this, c, {
|
|
2984
2992
|
local: !1,
|
|
2985
2993
|
throwIfInvalid: !0
|
|
2986
|
-
}),
|
|
2987
|
-
|
|
2988
|
-
t.release();
|
|
2994
|
+
}), a % s(this, Dt) === 0 && await sleep(0);
|
|
2995
|
+
n == null || n.release();
|
|
2989
2996
|
}
|
|
2990
2997
|
/** For debugging purposes */
|
|
2991
2998
|
getStats() {
|
|
2992
|
-
return s(this,
|
|
2999
|
+
return s(this, mt).getStats();
|
|
2993
3000
|
}
|
|
2994
3001
|
}
|
|
2995
|
-
|
|
3002
|
+
mt = new WeakMap(), P = new WeakMap(), M = new WeakMap(), yt = new WeakMap(), xt = new WeakMap(), Dt = new WeakMap(), Ft = new WeakMap(), Ot = new WeakSet(), /**
|
|
2996
3003
|
* Apply a modification to the document after validating it, and dispatch events to
|
|
2997
3004
|
* {@link onModification} listeners. Throws if the modification is invalid, unless `throwIfInvalid` is false;
|
|
2998
3005
|
* in that case, the function returns `string` on error and doesn't change the document state. If application
|
|
@@ -3004,7 +3011,7 @@ Gt = function(e, {
|
|
|
3004
3011
|
actionId: o
|
|
3005
3012
|
}) {
|
|
3006
3013
|
assert(s(this, yt) !== void 0, "Validator not initialized"), assert(
|
|
3007
|
-
s(this,
|
|
3014
|
+
s(this, P).locked,
|
|
3008
3015
|
"tried applying modification without lock"
|
|
3009
3016
|
);
|
|
3010
3017
|
const a = s(this, yt).validate(e);
|
|
@@ -3013,16 +3020,16 @@ Gt = function(e, {
|
|
|
3013
3020
|
throw new Error(`modification failed validation: ${a}`);
|
|
3014
3021
|
return a;
|
|
3015
3022
|
}
|
|
3016
|
-
s(this,
|
|
3023
|
+
s(this, mt).applyModification(e), this.onModification.notify({ modification: e, local: t, actionId: o });
|
|
3017
3024
|
};
|
|
3018
|
-
var
|
|
3025
|
+
var I, S;
|
|
3019
3026
|
class NexusStateConsolidator {
|
|
3020
3027
|
constructor(e) {
|
|
3021
3028
|
/**
|
|
3022
3029
|
* A copy of the document state, to validate that pending transactions can still be applied,
|
|
3023
3030
|
* and drop them if not.
|
|
3024
3031
|
*/
|
|
3025
|
-
|
|
3032
|
+
p(this, I);
|
|
3026
3033
|
/**
|
|
3027
3034
|
* Transactions not yet confirmed or rejected by the remote.
|
|
3028
3035
|
*
|
|
@@ -3030,8 +3037,8 @@ class NexusStateConsolidator {
|
|
|
3030
3037
|
* applied to {@link #state}, while backwards contains their respective reverse, so the state
|
|
3031
3038
|
* before all transactions in {@link #pending} can be restored.
|
|
3032
3039
|
*/
|
|
3033
|
-
|
|
3034
|
-
h(this,
|
|
3040
|
+
p(this, S, []);
|
|
3041
|
+
h(this, I, e);
|
|
3035
3042
|
}
|
|
3036
3043
|
/**
|
|
3037
3044
|
* Consolidate the local and remote transaction history.
|
|
@@ -3042,11 +3049,11 @@ class NexusStateConsolidator {
|
|
|
3042
3049
|
* @returns Transactions needed to sync local & remote, plus transactions created but not yet received
|
|
3043
3050
|
*/
|
|
3044
3051
|
consolidate(e, t, n) {
|
|
3045
|
-
n.forEach((
|
|
3046
|
-
const l = s(this,
|
|
3052
|
+
n.forEach((d) => {
|
|
3053
|
+
const l = s(this, I).applyTransaction(d);
|
|
3047
3054
|
if (!(l instanceof Transaction))
|
|
3048
3055
|
throw new Error(`Error applying reverse transaction: ${l}`);
|
|
3049
|
-
s(this, S).push([
|
|
3056
|
+
s(this, S).push([d, l]);
|
|
3050
3057
|
});
|
|
3051
3058
|
let o = e[0], a = s(this, S)[0];
|
|
3052
3059
|
for (; o !== void 0 && a !== void 0 && o.id === a[0].id; )
|
|
@@ -3054,47 +3061,50 @@ class NexusStateConsolidator {
|
|
|
3054
3061
|
if (e.length === 0) {
|
|
3055
3062
|
if (t.size === 0)
|
|
3056
3063
|
return [];
|
|
3057
|
-
const
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3064
|
+
const d = s(this, S).findIndex(
|
|
3065
|
+
([f]) => t.has(f.id)
|
|
3066
|
+
);
|
|
3067
|
+
if (d === -1)
|
|
3068
|
+
throw new Error(
|
|
3069
|
+
"Invariant violation: expected to find rejected transaction in #pending, but didn't. This is a bug."
|
|
3070
|
+
);
|
|
3071
|
+
const l = s(this, S).splice(d), u = l.map(([, f]) => {
|
|
3072
|
+
if (!(s(this, I).applyTransaction(f) instanceof Transaction))
|
|
3063
3073
|
throw new Error("error applying reversal of transaction");
|
|
3064
|
-
return
|
|
3065
|
-
}).reverse(), m =
|
|
3066
|
-
const
|
|
3067
|
-
if (
|
|
3068
|
-
return [
|
|
3069
|
-
}).filter((
|
|
3070
|
-
return s(this, S).push(...m), [...
|
|
3074
|
+
return f;
|
|
3075
|
+
}).reverse(), m = l.filter(([f]) => !t.has(f.id)).map(([f]) => {
|
|
3076
|
+
const y = s(this, I).applyTransaction(f);
|
|
3077
|
+
if (y instanceof Transaction)
|
|
3078
|
+
return [f, y];
|
|
3079
|
+
}).filter((f) => f !== void 0);
|
|
3080
|
+
return s(this, S).push(...m), [...u, ...m.map(([f]) => f)];
|
|
3071
3081
|
}
|
|
3072
|
-
const c = s(this, S).map((
|
|
3073
|
-
return c.forEach((
|
|
3074
|
-
const l = s(this,
|
|
3082
|
+
const c = s(this, S).map((d) => d[1].clone()).reverse();
|
|
3083
|
+
return c.forEach((d) => {
|
|
3084
|
+
const l = s(this, I).applyTransaction(d);
|
|
3075
3085
|
if (!(l instanceof Transaction))
|
|
3076
3086
|
throw new Error(`Error applying reverse transaction: ${l}`);
|
|
3077
|
-
}), e.forEach((
|
|
3078
|
-
const l = s(this,
|
|
3087
|
+
}), e.forEach((d) => {
|
|
3088
|
+
const l = s(this, I).applyTransaction(d);
|
|
3079
3089
|
if (!(l instanceof Transaction))
|
|
3080
3090
|
throw new Error(`Error applying incoming transaction: ${l}`);
|
|
3081
|
-
}), h(this, S, s(this, S).filter(([
|
|
3082
|
-
const l = t.has(
|
|
3083
|
-
(
|
|
3091
|
+
}), h(this, S, s(this, S).filter(([d]) => {
|
|
3092
|
+
const l = t.has(d.id), u = e.some(
|
|
3093
|
+
(m) => m.id === d.id
|
|
3084
3094
|
);
|
|
3085
|
-
return !l && !
|
|
3086
|
-
}).map(([
|
|
3087
|
-
const l = s(this,
|
|
3088
|
-
return l instanceof Transaction ? [
|
|
3089
|
-
}).filter((
|
|
3095
|
+
return !l && !u;
|
|
3096
|
+
}).map(([d]) => {
|
|
3097
|
+
const l = s(this, I).applyTransaction(d);
|
|
3098
|
+
return l instanceof Transaction ? [d, l] : void 0;
|
|
3099
|
+
}).filter((d) => d !== void 0)), [
|
|
3090
3100
|
...c,
|
|
3091
3101
|
...e,
|
|
3092
|
-
...s(this, S).map(([
|
|
3102
|
+
...s(this, S).map(([d]) => d)
|
|
3093
3103
|
];
|
|
3094
3104
|
}
|
|
3095
3105
|
}
|
|
3096
|
-
|
|
3097
|
-
var qt, jt, Rt, $t,
|
|
3106
|
+
I = new WeakMap(), S = new WeakMap();
|
|
3107
|
+
var qt, jt, Rt, $t, Jt, Vt, bt, Ct, Lt;
|
|
3098
3108
|
const wt = class wt {
|
|
3099
3109
|
constructor({
|
|
3100
3110
|
documentService: e,
|
|
@@ -3104,33 +3114,33 @@ const wt = class wt {
|
|
|
3104
3114
|
logConsolidatedTransactions: a,
|
|
3105
3115
|
logRejectedTransactions: c
|
|
3106
3116
|
}) {
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3117
|
+
p(this, qt);
|
|
3118
|
+
p(this, jt);
|
|
3119
|
+
p(this, Rt, !1);
|
|
3110
3120
|
// = false due to ts complaining
|
|
3111
|
-
|
|
3121
|
+
p(this, $t);
|
|
3112
3122
|
// the connection to the backend, to send & receive transactions
|
|
3113
|
-
|
|
3123
|
+
p(this, Jt);
|
|
3114
3124
|
r(this, "blocked");
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
h(this,
|
|
3125
|
+
p(this, Vt);
|
|
3126
|
+
p(this, bt, []);
|
|
3127
|
+
p(this, Ct, []);
|
|
3128
|
+
p(this, Lt, /* @__PURE__ */ new Set());
|
|
3129
|
+
h(this, Jt, e), h(this, Vt, new NexusStateConsolidator(t)), h(this, $t, a ?? !1), h(this, Rt, o ?? !1), h(this, jt, n ?? !1), h(this, qt, c ?? !1), (async () => {
|
|
3120
3130
|
for (; ; ) {
|
|
3121
3131
|
const l = await e.receiveNextTransaction();
|
|
3122
3132
|
s(this, bt).push(l), wt.stats.numReceivedCtr++, s(this, Rt) && console.debug("CollabGateway: received transaction", l);
|
|
3123
3133
|
}
|
|
3124
3134
|
})();
|
|
3125
|
-
const
|
|
3126
|
-
s(this,
|
|
3127
|
-
|
|
3128
|
-
}), this.blocked =
|
|
3135
|
+
const d = new ValueNotifier(!1);
|
|
3136
|
+
s(this, Jt).connectionOk.subscribe((l) => {
|
|
3137
|
+
d.setValue(!l);
|
|
3138
|
+
}), this.blocked = d;
|
|
3129
3139
|
}
|
|
3130
3140
|
/** Send a transaction to the document service. */
|
|
3131
3141
|
send(e) {
|
|
3132
|
-
e.id = crypto.randomUUID(), s(this,
|
|
3133
|
-
wt.stats.numConfirmedCtr++, t !== void 0 && (s(this,
|
|
3142
|
+
e.id = crypto.randomUUID(), s(this, Ct).push(e.clone()), wt.stats.numQueuedCtr++, s(this, jt) && console.debug("CollabGateway: sending local transaction", e), s(this, Jt).sendNextTransaction(e).then((t) => {
|
|
3143
|
+
wt.stats.numConfirmedCtr++, t !== void 0 && (s(this, Lt).add(e.id), s(this, qt) && console.debug(
|
|
3134
3144
|
"CollabGateway: received rejected transaction",
|
|
3135
3145
|
e,
|
|
3136
3146
|
t
|
|
@@ -3141,13 +3151,13 @@ const wt = class wt {
|
|
|
3141
3151
|
synchronize() {
|
|
3142
3152
|
const e = s(this, bt).length > 0, t = s(this, Vt).consolidate(
|
|
3143
3153
|
s(this, bt),
|
|
3144
|
-
s(this,
|
|
3145
|
-
s(this,
|
|
3154
|
+
s(this, Lt),
|
|
3155
|
+
s(this, Ct)
|
|
3146
3156
|
);
|
|
3147
|
-
return s(this, bt).length = 0, s(this,
|
|
3157
|
+
return s(this, bt).length = 0, s(this, Lt).clear(), s(this, Ct).length = 0, s(this, $t) && e && console.debug("CollabGateway: consolidated transactions", t), t;
|
|
3148
3158
|
}
|
|
3149
3159
|
};
|
|
3150
|
-
qt = new WeakMap(), jt = new WeakMap(), Rt = new WeakMap(), $t = new WeakMap(),
|
|
3160
|
+
qt = new WeakMap(), jt = new WeakMap(), Rt = new WeakMap(), $t = new WeakMap(), Jt = new WeakMap(), Vt = new WeakMap(), bt = new WeakMap(), Ct = new WeakMap(), Lt = new WeakMap(), /**
|
|
3151
3161
|
* Some stats, useful for debugging.
|
|
3152
3162
|
*/
|
|
3153
3163
|
r(wt, "stats", {
|
|
@@ -3167,7 +3177,7 @@ class BufferedSender {
|
|
|
3167
3177
|
/** Contains data to be sent out during the next batched send. The second element resolves the promise
|
|
3168
3178
|
* created in `send` for that data.
|
|
3169
3179
|
*/
|
|
3170
|
-
|
|
3180
|
+
p(this, Ut, []);
|
|
3171
3181
|
(async () => {
|
|
3172
3182
|
for (; ; ) {
|
|
3173
3183
|
const n = s(this, Ut).splice(0, s(this, Ut).length);
|
|
@@ -3204,45 +3214,45 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3204
3214
|
callIsOk: n
|
|
3205
3215
|
}
|
|
3206
3216
|
);
|
|
3207
|
-
const
|
|
3208
|
-
await sleep(Math.max(0, t -
|
|
3217
|
+
const d = Date.now() - c;
|
|
3218
|
+
await sleep(Math.max(0, t - d)), o.setValue(d / 2);
|
|
3209
3219
|
}
|
|
3210
3220
|
})(), o;
|
|
3211
3221
|
}, createReceiveNextTransactionFn = (i, e, t, n, o) => {
|
|
3212
3222
|
let a = 0;
|
|
3213
3223
|
const c = () => i.attach({ projectName: e, commitIndex: a }, { signal: o() })[Symbol.asyncIterator]();
|
|
3214
|
-
let
|
|
3224
|
+
let d = c(), l = !1;
|
|
3215
3225
|
return async () => {
|
|
3216
3226
|
for (; ; )
|
|
3217
3227
|
try {
|
|
3218
|
-
const { value:
|
|
3219
|
-
if (
|
|
3228
|
+
const { value: u, done: m } = await d.next();
|
|
3229
|
+
if (m ?? !1)
|
|
3220
3230
|
throw new Error("document service attach stream closed");
|
|
3221
|
-
switch (t.setValue(!0),
|
|
3231
|
+
switch (t.setValue(!0), u.message.case) {
|
|
3222
3232
|
case "noop": {
|
|
3223
3233
|
if (l)
|
|
3224
3234
|
continue;
|
|
3225
3235
|
return l = !0, new Transaction();
|
|
3226
3236
|
}
|
|
3227
3237
|
case "transaction": {
|
|
3228
|
-
const
|
|
3229
|
-
return a =
|
|
3238
|
+
const f = u.message.value;
|
|
3239
|
+
return a = f.commitIndex, l = !0, f;
|
|
3230
3240
|
}
|
|
3231
3241
|
default:
|
|
3232
3242
|
throw new Error(
|
|
3233
|
-
`received attach response with unknown message case: ${
|
|
3243
|
+
`received attach response with unknown message case: ${u.message.case}`
|
|
3234
3244
|
);
|
|
3235
3245
|
}
|
|
3236
|
-
} catch (
|
|
3237
|
-
if (!(
|
|
3238
|
-
throw
|
|
3239
|
-
switch (
|
|
3246
|
+
} catch (u) {
|
|
3247
|
+
if (!(u instanceof ConnectError))
|
|
3248
|
+
throw u;
|
|
3249
|
+
switch (u.code) {
|
|
3240
3250
|
case Code.Canceled:
|
|
3241
3251
|
// happens if abort controller throws
|
|
3242
3252
|
case Code.Aborted:
|
|
3243
3253
|
case Code.Unavailable:
|
|
3244
3254
|
case Code.Unknown: {
|
|
3245
|
-
t.setValue(!1), console.debug("Connection lost:",
|
|
3255
|
+
t.setValue(!1), console.debug("Connection lost:", u.message, " - retrying..."), await sleep(n + Math.random() * n * 0.1), d = c();
|
|
3246
3256
|
continue;
|
|
3247
3257
|
}
|
|
3248
3258
|
case Code.OutOfRange:
|
|
@@ -3250,7 +3260,7 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3250
3260
|
"local document state too far in the past, must reload tab"
|
|
3251
3261
|
);
|
|
3252
3262
|
default:
|
|
3253
|
-
throw
|
|
3263
|
+
throw u;
|
|
3254
3264
|
}
|
|
3255
3265
|
}
|
|
3256
3266
|
};
|
|
@@ -3262,8 +3272,8 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3262
3272
|
}) => {
|
|
3263
3273
|
let o = new AbortController();
|
|
3264
3274
|
const a = new ValueNotifier(!0);
|
|
3265
|
-
a.subscribe((
|
|
3266
|
-
|
|
3275
|
+
a.subscribe((w) => {
|
|
3276
|
+
w ? o = new AbortController() : o.abort("ping called failed, connection assumed lost");
|
|
3267
3277
|
});
|
|
3268
3278
|
let c;
|
|
3269
3279
|
c = createPingNotifier(
|
|
@@ -3272,39 +3282,39 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3272
3282
|
e,
|
|
3273
3283
|
a
|
|
3274
3284
|
);
|
|
3275
|
-
const
|
|
3285
|
+
const d = new ValueNotifier(!0), l = createReceiveNextTransactionFn(
|
|
3276
3286
|
n,
|
|
3277
3287
|
i,
|
|
3278
|
-
|
|
3288
|
+
d,
|
|
3279
3289
|
t,
|
|
3280
3290
|
() => o.signal
|
|
3281
|
-
),
|
|
3282
|
-
async (
|
|
3291
|
+
), u = new ValueNotifier(!0), m = new BufferedSender(
|
|
3292
|
+
async (w) => {
|
|
3283
3293
|
const b = await n.applyTransactions(
|
|
3284
3294
|
{
|
|
3285
3295
|
projectName: i,
|
|
3286
|
-
transactions:
|
|
3296
|
+
transactions: w
|
|
3287
3297
|
},
|
|
3288
3298
|
{
|
|
3289
|
-
callIsOk:
|
|
3299
|
+
callIsOk: u
|
|
3290
3300
|
}
|
|
3291
3301
|
);
|
|
3292
3302
|
if (b instanceof Error)
|
|
3293
3303
|
throw new Error("error sending transaction", { cause: b });
|
|
3294
|
-
return
|
|
3295
|
-
(
|
|
3304
|
+
return w.map(
|
|
3305
|
+
(N) => b.errors[N.id] ?? void 0
|
|
3296
3306
|
);
|
|
3297
3307
|
}
|
|
3298
|
-
),
|
|
3308
|
+
), f = async (w) => await m.send(w), y = combinedValueNotifiersWithAnd(
|
|
3299
3309
|
a,
|
|
3300
|
-
|
|
3301
|
-
|
|
3310
|
+
d,
|
|
3311
|
+
u
|
|
3302
3312
|
);
|
|
3303
3313
|
return {
|
|
3304
3314
|
ping: c,
|
|
3305
|
-
connectionOk:
|
|
3315
|
+
connectionOk: y,
|
|
3306
3316
|
receiveNextTransaction: l,
|
|
3307
|
-
sendNextTransaction:
|
|
3317
|
+
sendNextTransaction: f
|
|
3308
3318
|
};
|
|
3309
3319
|
}, initCollabGateway = async (i, e) => {
|
|
3310
3320
|
const t = createDocumentServiceWrapper({
|
|
@@ -3486,7 +3496,7 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3486
3496
|
}
|
|
3487
3497
|
}
|
|
3488
3498
|
}, createOnlineDocument = async (i, e, t) => {
|
|
3489
|
-
var
|
|
3499
|
+
var u;
|
|
3490
3500
|
let n = createWasmNexusValidator();
|
|
3491
3501
|
const o = await i.projectService.openSession({
|
|
3492
3502
|
projectName: e
|
|
@@ -3496,7 +3506,7 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3496
3506
|
const a = createRetryingPromiseClient(
|
|
3497
3507
|
DocumentService,
|
|
3498
3508
|
createAuthorizedKeepaliveTransport({
|
|
3499
|
-
baseUrl: ((
|
|
3509
|
+
baseUrl: ((u = o.session) == null ? void 0 : u.documentServiceUrl) ?? throw_("backend returned no document service url"),
|
|
3500
3510
|
useBinaryFormat: !0,
|
|
3501
3511
|
getToken: t
|
|
3502
3512
|
})
|
|
@@ -3505,8 +3515,8 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3505
3515
|
const c = await initCollabGateway(
|
|
3506
3516
|
e ?? throw_(),
|
|
3507
3517
|
a
|
|
3508
|
-
),
|
|
3509
|
-
return c.blocked.subscribe((
|
|
3518
|
+
), d = new NexusDocument(), l = new ValueNotifier(!1);
|
|
3519
|
+
return c.blocked.subscribe((m) => l.setValue(!m)), createSyncedDocument(d, l, await n, c);
|
|
3510
3520
|
}, createOfflineDocument = async (i) => {
|
|
3511
3521
|
const e = i ? await createWasmNexusValidator() : mockNexusValidator(), t = mockNexusGateway(), n = new NexusDocument(), o = new ValueNotifier(!0);
|
|
3512
3522
|
return createSyncedDocument(n, o, e, t);
|
|
@@ -3562,17 +3572,17 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3562
3572
|
codeVerifier: `oidc_${i}_oidc_code_verifier`,
|
|
3563
3573
|
userName: `oidc_${i}_oidc_user_name`,
|
|
3564
3574
|
state: `oidc_${i}_oidc_state`
|
|
3565
|
-
}, o = () => redirectUserToLogin(n, i, t, e), a = new URLSearchParams(window.location.search), c = a.get("error"),
|
|
3575
|
+
}, o = () => redirectUserToLogin(n, i, t, e), a = new URLSearchParams(window.location.search), c = a.get("error"), d = a.get("error_description");
|
|
3566
3576
|
if (c != null)
|
|
3567
3577
|
return cleanupUrl(), cleanUpLocalStorage(n), {
|
|
3568
3578
|
loggedIn: !1,
|
|
3569
|
-
error: toError(c,
|
|
3579
|
+
error: toError(c, d),
|
|
3570
3580
|
login: o
|
|
3571
3581
|
};
|
|
3572
3582
|
const l = a.get("code");
|
|
3573
3583
|
if (l != null) {
|
|
3574
|
-
const
|
|
3575
|
-
if (
|
|
3584
|
+
const f = a.get("state"), y = localStorage.getItem(n.state);
|
|
3585
|
+
if (f == null || y == null || f !== y)
|
|
3576
3586
|
return {
|
|
3577
3587
|
loggedIn: !1,
|
|
3578
3588
|
error: toError(
|
|
@@ -3588,7 +3598,7 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3588
3598
|
error: toError("Code verifier not found. Restart the auth flow."),
|
|
3589
3599
|
login: o
|
|
3590
3600
|
};
|
|
3591
|
-
const
|
|
3601
|
+
const w = await fetch(TOKEN_ENDPOINT, {
|
|
3592
3602
|
method: "POST",
|
|
3593
3603
|
headers: {
|
|
3594
3604
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
@@ -3603,47 +3613,47 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3603
3613
|
})
|
|
3604
3614
|
}), {
|
|
3605
3615
|
access_token: b,
|
|
3606
|
-
refresh_token:
|
|
3616
|
+
refresh_token: N,
|
|
3607
3617
|
expires_in: St,
|
|
3608
3618
|
error: Ht,
|
|
3609
3619
|
error_description: Yt
|
|
3610
|
-
} = await
|
|
3620
|
+
} = await w.json();
|
|
3611
3621
|
if (Ht)
|
|
3612
3622
|
return {
|
|
3613
3623
|
loggedIn: !1,
|
|
3614
3624
|
error: toError(Ht, Yt),
|
|
3615
3625
|
login: o
|
|
3616
3626
|
};
|
|
3617
|
-
localStorage.setItem(n.accessToken, b), localStorage.setItem(n.refreshToken,
|
|
3627
|
+
localStorage.setItem(n.accessToken, b), localStorage.setItem(n.refreshToken, N), localStorage.setItem(
|
|
3618
3628
|
n.expiresAt,
|
|
3619
3629
|
(Date.now() + St * 1e3).toString()
|
|
3620
3630
|
), cleanupUrl(), localStorage.removeItem(n.codeVerifier);
|
|
3621
3631
|
}
|
|
3622
3632
|
localStorage.removeItem(n.state);
|
|
3623
|
-
const
|
|
3624
|
-
let
|
|
3625
|
-
if (typeof
|
|
3626
|
-
const
|
|
3627
|
-
if (
|
|
3628
|
-
|
|
3629
|
-
const v = await
|
|
3630
|
-
return
|
|
3633
|
+
const u = await getOrFetchValidToken(n, i);
|
|
3634
|
+
let m;
|
|
3635
|
+
if (typeof u == "string") {
|
|
3636
|
+
const f = async () => {
|
|
3637
|
+
if (m == null) {
|
|
3638
|
+
m = (async () => await getOrFetchValidToken(n, i) ?? new Error("User not logged in."))();
|
|
3639
|
+
const v = await m;
|
|
3640
|
+
return m = void 0, v;
|
|
3631
3641
|
}
|
|
3632
|
-
return await
|
|
3642
|
+
return await m;
|
|
3633
3643
|
};
|
|
3634
|
-
let
|
|
3644
|
+
let y;
|
|
3635
3645
|
return {
|
|
3636
3646
|
loggedIn: !0,
|
|
3637
|
-
getToken:
|
|
3647
|
+
getToken: f,
|
|
3638
3648
|
getUserName: async () => {
|
|
3639
|
-
if (
|
|
3640
|
-
return await
|
|
3641
|
-
const { promise: v, resolve:
|
|
3642
|
-
|
|
3643
|
-
const b = await
|
|
3649
|
+
if (y !== void 0)
|
|
3650
|
+
return await y;
|
|
3651
|
+
const { promise: v, resolve: w } = Promise.withResolvers();
|
|
3652
|
+
y = v;
|
|
3653
|
+
const b = await f();
|
|
3644
3654
|
if (b instanceof Error)
|
|
3645
|
-
return
|
|
3646
|
-
const
|
|
3655
|
+
return w(b), await y;
|
|
3656
|
+
const N = await neverThrowingFetch(
|
|
3647
3657
|
`${API_ENDPOINT}/audiotool.auth.v1.AuthService/GetWhoami`,
|
|
3648
3658
|
{
|
|
3649
3659
|
method: "POST",
|
|
@@ -3654,12 +3664,12 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3654
3664
|
body: JSON.stringify({})
|
|
3655
3665
|
}
|
|
3656
3666
|
);
|
|
3657
|
-
if (
|
|
3658
|
-
return
|
|
3659
|
-
if (!
|
|
3660
|
-
return
|
|
3661
|
-
const { whoami: St } = await
|
|
3662
|
-
return console.debug("whoami", St),
|
|
3667
|
+
if (N instanceof Error)
|
|
3668
|
+
return w(N), await y;
|
|
3669
|
+
if (!N.ok)
|
|
3670
|
+
return w(new Error(`Failed to get user info: ${N.statusText}`)), await y;
|
|
3671
|
+
const { whoami: St } = await N.json();
|
|
3672
|
+
return console.debug("whoami", St), w((St == null ? void 0 : St.userName) ?? "Unknown User"), await y;
|
|
3663
3673
|
},
|
|
3664
3674
|
logout() {
|
|
3665
3675
|
cleanUpLocalStorage(n), cleanupUrl(), window.location.reload();
|
|
@@ -3668,7 +3678,7 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3668
3678
|
}
|
|
3669
3679
|
return {
|
|
3670
3680
|
loggedIn: !1,
|
|
3671
|
-
error:
|
|
3681
|
+
error: u,
|
|
3672
3682
|
login: o
|
|
3673
3683
|
};
|
|
3674
3684
|
}, cleanUpLocalStorage = (i) => {
|
|
@@ -3685,8 +3695,8 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3685
3695
|
localStorage.setItem(i.codeVerifier, o);
|
|
3686
3696
|
const a = await generateCodeChallenge(o), c = crypto.getRandomValues(new Uint8Array(16)).join("");
|
|
3687
3697
|
localStorage.setItem(i.state, c);
|
|
3688
|
-
const
|
|
3689
|
-
|
|
3698
|
+
const d = new URL(AUTHORIZATION_ENDPOINT);
|
|
3699
|
+
d.search = new URLSearchParams({
|
|
3690
3700
|
response_type: "code",
|
|
3691
3701
|
client_id: e,
|
|
3692
3702
|
scope: t,
|
|
@@ -3694,7 +3704,7 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3694
3704
|
code_challenge: a,
|
|
3695
3705
|
redirect_uri: n,
|
|
3696
3706
|
state: c
|
|
3697
|
-
}).toString(), window.location.href =
|
|
3707
|
+
}).toString(), window.location.href = d.toString();
|
|
3698
3708
|
}, toError = (i, e) => (e = e ? `: ${e}` : "", new Error(`${i}${e}`)), generateCodeVerifier = () => {
|
|
3699
3709
|
const i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
3700
3710
|
return crypto.getRandomValues(new Uint8Array(64)).reduce(
|
|
@@ -3710,8 +3720,8 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3710
3720
|
return;
|
|
3711
3721
|
let n = !0;
|
|
3712
3722
|
{
|
|
3713
|
-
const
|
|
3714
|
-
n =
|
|
3723
|
+
const f = localStorage.getItem(i.expiresAt);
|
|
3724
|
+
n = f == null ? !0 : Date.now() >= parseInt(f) - 6e4;
|
|
3715
3725
|
}
|
|
3716
3726
|
if (!n)
|
|
3717
3727
|
return t;
|
|
@@ -3735,10 +3745,10 @@ const createPingNotifier = (i, e, t, n) => {
|
|
|
3735
3745
|
return new Error(`Error during refresh token request: ${a.name}`, {
|
|
3736
3746
|
cause: a.message
|
|
3737
3747
|
});
|
|
3738
|
-
const { error: c, error_description:
|
|
3739
|
-
return c ? toError(c,
|
|
3748
|
+
const { error: c, error_description: d, access_token: l, refresh_token: u, expires_in: m } = await a.json();
|
|
3749
|
+
return c ? toError(c, d) : (localStorage.setItem(i.accessToken, l), localStorage.setItem(i.refreshToken, u), localStorage.setItem(
|
|
3740
3750
|
i.expiresAt,
|
|
3741
|
-
(Date.now() +
|
|
3751
|
+
(Date.now() + m * 1e3).toString()
|
|
3742
3752
|
), l);
|
|
3743
3753
|
};
|
|
3744
3754
|
export {
|