@noya-app/noya-api-client-react 0.1.38 → 0.1.40
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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +17 -0
- package/dist/index.d.mts +32 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +146 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +132 -91
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/react/tableHooks.ts +69 -9
package/dist/index.mjs
CHANGED
|
@@ -5255,8 +5255,20 @@ import { isDeepEqual } from "@noya-app/noya-utils";
|
|
|
5255
5255
|
import { Observable as Observable2 } from "@noya-app/observable";
|
|
5256
5256
|
|
|
5257
5257
|
// ../state-manager/src/AssetManager.ts
|
|
5258
|
-
import { Base64, uuid } from "@noya-app/noya-utils";
|
|
5258
|
+
import { Base64, memoize, uuid } from "@noya-app/noya-utils";
|
|
5259
5259
|
import { Observable as Observable3 } from "@noya-app/observable";
|
|
5260
|
+
var _toNoyaAsset = memoize(
|
|
5261
|
+
(asset) => ({
|
|
5262
|
+
id: asset.stableId,
|
|
5263
|
+
url: asset.url,
|
|
5264
|
+
createdAt: asset.createdAt,
|
|
5265
|
+
size: asset.size,
|
|
5266
|
+
contentType: asset.contentType,
|
|
5267
|
+
width: asset.width ?? null,
|
|
5268
|
+
height: asset.height ?? null,
|
|
5269
|
+
userId: asset.userId ?? null
|
|
5270
|
+
})
|
|
5271
|
+
);
|
|
5260
5272
|
|
|
5261
5273
|
// ../noya-schemas/src/nullable.ts
|
|
5262
5274
|
var Nullable = (schema) => Type.Union([Type.Null(), schema]);
|
|
@@ -5321,6 +5333,7 @@ var activityEventSchema = Type.Object({
|
|
|
5321
5333
|
// ../noya-schemas/src/asset.ts
|
|
5322
5334
|
var assetSchema = Type.Object({
|
|
5323
5335
|
id: Type.String(),
|
|
5336
|
+
stableId: Type.String(),
|
|
5324
5337
|
url: Type.String(),
|
|
5325
5338
|
createdAt: Type.String(),
|
|
5326
5339
|
size: Type.Number(),
|
|
@@ -6015,11 +6028,11 @@ function handleValue(target, handledSet, options) {
|
|
|
6015
6028
|
}
|
|
6016
6029
|
});
|
|
6017
6030
|
if (setMap) {
|
|
6018
|
-
const
|
|
6019
|
-
const values = Array.from(
|
|
6020
|
-
|
|
6031
|
+
const set4 = target;
|
|
6032
|
+
const values = Array.from(set4);
|
|
6033
|
+
set4.clear();
|
|
6021
6034
|
values.forEach((value) => {
|
|
6022
|
-
|
|
6035
|
+
set4.add(setMap.has(value) ? setMap.get(value) : value);
|
|
6023
6036
|
});
|
|
6024
6037
|
}
|
|
6025
6038
|
}
|
|
@@ -6852,7 +6865,7 @@ var makeCreator = (arg) => {
|
|
|
6852
6865
|
};
|
|
6853
6866
|
}
|
|
6854
6867
|
const base2 = arg0;
|
|
6855
|
-
const
|
|
6868
|
+
const mutate = arg1;
|
|
6856
6869
|
let options = arg2;
|
|
6857
6870
|
if (typeof arg1 !== "function") {
|
|
6858
6871
|
options = arg1;
|
|
@@ -6896,7 +6909,7 @@ var makeCreator = (arg) => {
|
|
|
6896
6909
|
}
|
|
6897
6910
|
let result;
|
|
6898
6911
|
try {
|
|
6899
|
-
result =
|
|
6912
|
+
result = mutate(draft);
|
|
6900
6913
|
} catch (error) {
|
|
6901
6914
|
revokeProxy(getProxyDraft(draft));
|
|
6902
6915
|
throw error;
|
|
@@ -7004,7 +7017,7 @@ function apply(state, patches, applyOptions) {
|
|
|
7004
7017
|
if (i > -1) {
|
|
7005
7018
|
patches = patches.slice(i + 1);
|
|
7006
7019
|
}
|
|
7007
|
-
const
|
|
7020
|
+
const mutate = (draft) => {
|
|
7008
7021
|
patches.forEach((patch) => {
|
|
7009
7022
|
const { path: _path, from: _fromPath, op } = patch;
|
|
7010
7023
|
const path2 = unescapePath(_path);
|
|
@@ -7124,17 +7137,17 @@ function apply(state, patches, applyOptions) {
|
|
|
7124
7137
|
console.warn('The "mutable" option is not allowed to be used with other options.');
|
|
7125
7138
|
}
|
|
7126
7139
|
}
|
|
7127
|
-
|
|
7140
|
+
mutate(state);
|
|
7128
7141
|
return void 0;
|
|
7129
7142
|
}
|
|
7130
7143
|
if (isDraft(state)) {
|
|
7131
7144
|
if (applyOptions !== void 0) {
|
|
7132
7145
|
throw new Error(`Cannot apply patches with options to a draft.`);
|
|
7133
7146
|
}
|
|
7134
|
-
|
|
7147
|
+
mutate(state);
|
|
7135
7148
|
return state;
|
|
7136
7149
|
}
|
|
7137
|
-
return create(state,
|
|
7150
|
+
return create(state, mutate, Object.assign(Object.assign({}, applyOptions), { enablePatches: false }));
|
|
7138
7151
|
}
|
|
7139
7152
|
var constructorString = Object.prototype.constructor.toString();
|
|
7140
7153
|
|
|
@@ -7247,6 +7260,10 @@ var import_fast_diff = __toESM(require_diff());
|
|
|
7247
7260
|
// ../state-manager/src/EvalManager.ts
|
|
7248
7261
|
import { uuid as uuid2 } from "@noya-app/noya-utils";
|
|
7249
7262
|
|
|
7263
|
+
// ../state-manager/src/FilePropertyManager.ts
|
|
7264
|
+
import { uuid as uuid3 } from "@noya-app/noya-utils";
|
|
7265
|
+
import { Observable as Observable6 } from "@noya-app/observable";
|
|
7266
|
+
|
|
7250
7267
|
// ../state-manager/src/historyEntries.ts
|
|
7251
7268
|
var HistoryEntries;
|
|
7252
7269
|
((HistoryEntries2) => {
|
|
@@ -7334,7 +7351,7 @@ var HistoryEntries;
|
|
|
7334
7351
|
})(HistoryEntries || (HistoryEntries = {}));
|
|
7335
7352
|
|
|
7336
7353
|
// ../state-manager/src/IOManager.ts
|
|
7337
|
-
import { Observable as
|
|
7354
|
+
import { Observable as Observable7 } from "@noya-app/observable";
|
|
7338
7355
|
|
|
7339
7356
|
// ../state-manager/src/jwt.ts
|
|
7340
7357
|
function base64UrlEncode(str) {
|
|
@@ -7436,31 +7453,31 @@ var jwt;
|
|
|
7436
7453
|
})(jwt || (jwt = {}));
|
|
7437
7454
|
|
|
7438
7455
|
// ../state-manager/src/MenuManager.ts
|
|
7439
|
-
import {
|
|
7456
|
+
import { isDeepEqual as isDeepEqual2 } from "@noya-app/noya-utils";
|
|
7457
|
+
import { Observable as Observable8 } from "@noya-app/observable";
|
|
7440
7458
|
|
|
7441
7459
|
// ../state-manager/src/multiplayer.ts
|
|
7442
|
-
import { Cache, hash, uuid as
|
|
7443
|
-
import {
|
|
7444
|
-
Observable as Observable8,
|
|
7445
|
-
get as get2,
|
|
7446
|
-
mutate
|
|
7447
|
-
} from "@noya-app/observable";
|
|
7460
|
+
import { Cache, hash, uuid as uuid4 } from "@noya-app/noya-utils";
|
|
7461
|
+
import { Observable as Observable10, get as get2, set as set2 } from "@noya-app/observable";
|
|
7448
7462
|
|
|
7449
7463
|
// ../state-manager/src/stateManager.ts
|
|
7450
|
-
import {
|
|
7464
|
+
import {
|
|
7465
|
+
Observable as Observable9,
|
|
7466
|
+
get as getPath2
|
|
7467
|
+
} from "@noya-app/observable";
|
|
7451
7468
|
|
|
7452
7469
|
// ../state-manager/src/multiplayer.ts
|
|
7453
7470
|
var createHash = (value, options) => hash(value, { ...options, ignoreUndefinedProperties: true });
|
|
7454
7471
|
|
|
7455
7472
|
// ../state-manager/src/NoyaManager.ts
|
|
7456
|
-
import { uuid as
|
|
7457
|
-
import { Observable as
|
|
7473
|
+
import { uuid as uuid8 } from "@noya-app/noya-utils";
|
|
7474
|
+
import { Observable as Observable17, set as set3 } from "@noya-app/observable";
|
|
7458
7475
|
|
|
7459
7476
|
// ../noya-pipeline/src/graphToTasks.ts
|
|
7460
7477
|
import { get as get3 } from "@noya-app/observable";
|
|
7461
7478
|
|
|
7462
7479
|
// ../noya-pipeline/src/state.ts
|
|
7463
|
-
import { uuid as
|
|
7480
|
+
import { uuid as uuid5 } from "@noya-app/noya-utils";
|
|
7464
7481
|
var rectSchema = Type.Object({
|
|
7465
7482
|
x: Type.Number(),
|
|
7466
7483
|
y: Type.Number(),
|
|
@@ -7559,24 +7576,24 @@ var pipelineSchema = Type.Object(
|
|
|
7559
7576
|
);
|
|
7560
7577
|
|
|
7561
7578
|
// ../state-manager/src/PipelineManager.ts
|
|
7562
|
-
import { Observable as
|
|
7579
|
+
import { Observable as Observable11 } from "@noya-app/observable";
|
|
7563
7580
|
|
|
7564
7581
|
// ../state-manager/src/PublishingManager.ts
|
|
7565
|
-
import { Observable as
|
|
7582
|
+
import { Observable as Observable12 } from "@noya-app/observable";
|
|
7566
7583
|
|
|
7567
7584
|
// ../state-manager/src/ResourceManager.ts
|
|
7568
|
-
import { isDeepEqual as
|
|
7569
|
-
import { Observable as
|
|
7585
|
+
import { isDeepEqual as isDeepEqual3, uuid as uuid6 } from "@noya-app/noya-utils";
|
|
7586
|
+
import { Observable as Observable13 } from "@noya-app/observable";
|
|
7570
7587
|
|
|
7571
7588
|
// ../state-manager/src/rpcManager.ts
|
|
7572
|
-
import { uuid as
|
|
7573
|
-
import { Observable as
|
|
7589
|
+
import { uuid as uuid7 } from "@noya-app/noya-utils";
|
|
7590
|
+
import { Observable as Observable14 } from "@noya-app/observable";
|
|
7574
7591
|
|
|
7575
7592
|
// ../state-manager/src/SecretManager.ts
|
|
7576
|
-
import { Observable as
|
|
7593
|
+
import { Observable as Observable15 } from "@noya-app/observable";
|
|
7577
7594
|
|
|
7578
7595
|
// ../state-manager/src/TaskManager.ts
|
|
7579
|
-
import { Observable as
|
|
7596
|
+
import { Observable as Observable16 } from "@noya-app/observable";
|
|
7580
7597
|
|
|
7581
7598
|
// ../state-manager/src/NoyaManager.ts
|
|
7582
7599
|
var createMutatorParametersSchema = Type.Object({
|
|
@@ -7588,6 +7605,9 @@ var createMutatorParametersSchema = Type.Object({
|
|
|
7588
7605
|
})
|
|
7589
7606
|
});
|
|
7590
7607
|
|
|
7608
|
+
// ../state-manager/src/sync/localRpcHelpers.ts
|
|
7609
|
+
import { Base64 as Base642 } from "@noya-app/noya-utils";
|
|
7610
|
+
|
|
7591
7611
|
// ../noya-keymap/src/hooks.ts
|
|
7592
7612
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
7593
7613
|
|
|
@@ -7703,7 +7723,7 @@ import { useEffect as useEffect16 } from "react";
|
|
|
7703
7723
|
|
|
7704
7724
|
// ../noya-multiplayer-react/src/NoyaStateContext.tsx
|
|
7705
7725
|
import {
|
|
7706
|
-
Observable as
|
|
7726
|
+
Observable as Observable18
|
|
7707
7727
|
} from "@noya-app/observable";
|
|
7708
7728
|
|
|
7709
7729
|
// ../noya-react-utils/src/components/AutoSizer.tsx
|
|
@@ -7886,7 +7906,7 @@ var FileDropTarget = memoGeneric(function FileDropTarget2({ children, onDropFile
|
|
|
7886
7906
|
import { useCallback as useCallback4, useState as useState3 } from "react";
|
|
7887
7907
|
|
|
7888
7908
|
// ../noya-react-utils/src/hooks/useDeepArray.ts
|
|
7889
|
-
import { isDeepEqual as
|
|
7909
|
+
import { isDeepEqual as isDeepEqual4 } from "@noya-app/noya-utils";
|
|
7890
7910
|
import { useMemo as useMemo3, useState as useState4 } from "react";
|
|
7891
7911
|
function useJsonMemo(value) {
|
|
7892
7912
|
const stringified = useMemo3(
|
|
@@ -7901,7 +7921,7 @@ function useJsonMemo(value) {
|
|
|
7901
7921
|
}
|
|
7902
7922
|
|
|
7903
7923
|
// ../noya-react-utils/src/hooks/useDeepState.ts
|
|
7904
|
-
import { isDeepEqual as
|
|
7924
|
+
import { isDeepEqual as isDeepEqual5 } from "@noya-app/noya-utils";
|
|
7905
7925
|
import { useCallback as useCallback5, useMemo as useMemo4, useState as useState5 } from "react";
|
|
7906
7926
|
|
|
7907
7927
|
// ../noya-react-utils/src/hooks/useFetch.ts
|
|
@@ -8010,7 +8030,7 @@ function downloadBlob(...params) {
|
|
|
8010
8030
|
}
|
|
8011
8031
|
|
|
8012
8032
|
// ../noya-multiplayer-react/src/NoyaStateContext.tsx
|
|
8013
|
-
import
|
|
8033
|
+
import React34, {
|
|
8014
8034
|
createContext as createContext3,
|
|
8015
8035
|
useCallback as useCallback14,
|
|
8016
8036
|
useContext as useContext4,
|
|
@@ -8113,7 +8133,7 @@ import React31 from "react";
|
|
|
8113
8133
|
import { createRoot } from "react-dom/client";
|
|
8114
8134
|
|
|
8115
8135
|
// ../noya-multiplayer-react/src/inspector/StateInspector.tsx
|
|
8116
|
-
import { Base64 as
|
|
8136
|
+
import { Base64 as Base643, memoize as memoize2, uuid as uuid9 } from "@noya-app/noya-utils";
|
|
8117
8137
|
import React30, {
|
|
8118
8138
|
useCallback as useCallback12,
|
|
8119
8139
|
useEffect as useEffect13,
|
|
@@ -10452,19 +10472,17 @@ async function importAll(buffer, noyaManager, {
|
|
|
10452
10472
|
}
|
|
10453
10473
|
if (assets.length) {
|
|
10454
10474
|
await Promise.all(
|
|
10455
|
-
noyaManager.assetManager.assets$.get().map((asset) => noyaManager.assetManager.delete(asset.
|
|
10475
|
+
noyaManager.assetManager.assets$.get().map((asset) => noyaManager.assetManager.delete(asset.stableId))
|
|
10456
10476
|
);
|
|
10457
|
-
|
|
10477
|
+
await Promise.all(
|
|
10458
10478
|
assets.map(async (asset) => {
|
|
10459
|
-
|
|
10479
|
+
await noyaManager.assetManager.create({
|
|
10460
10480
|
data: assetMap[asset.id],
|
|
10461
|
-
contentType: asset.contentType
|
|
10481
|
+
contentType: asset.contentType,
|
|
10482
|
+
stableId: asset.stableId
|
|
10462
10483
|
});
|
|
10463
|
-
return [asset.id, newAsset.id];
|
|
10464
10484
|
})
|
|
10465
10485
|
);
|
|
10466
|
-
const replacementMap = Object.fromEntries(idPairs);
|
|
10467
|
-
state = replaceDeep(state, replacementMap);
|
|
10468
10486
|
}
|
|
10469
10487
|
noyaManager.initialState = state;
|
|
10470
10488
|
noyaManager.forceInit();
|
|
@@ -10497,27 +10515,6 @@ function decodeAll(buffer) {
|
|
|
10497
10515
|
}
|
|
10498
10516
|
return { state, schema, assets, assetMap };
|
|
10499
10517
|
}
|
|
10500
|
-
function replaceDeep(obj, replacementMap) {
|
|
10501
|
-
switch (typeof obj) {
|
|
10502
|
-
case "object":
|
|
10503
|
-
if (obj === null) {
|
|
10504
|
-
return obj;
|
|
10505
|
-
}
|
|
10506
|
-
if (Array.isArray(obj)) {
|
|
10507
|
-
return obj.map((item) => replaceDeep(item, replacementMap));
|
|
10508
|
-
}
|
|
10509
|
-
return Object.fromEntries(
|
|
10510
|
-
Object.entries(obj).map(([key, value]) => [
|
|
10511
|
-
key,
|
|
10512
|
-
replaceDeep(value, replacementMap)
|
|
10513
|
-
])
|
|
10514
|
-
);
|
|
10515
|
-
case "string":
|
|
10516
|
-
return replacementMap[obj] ?? obj;
|
|
10517
|
-
default:
|
|
10518
|
-
return obj;
|
|
10519
|
-
}
|
|
10520
|
-
}
|
|
10521
10518
|
|
|
10522
10519
|
// ../noya-multiplayer-react/src/inspector/StateInspectorTitleLabel.tsx
|
|
10523
10520
|
import React27 from "react";
|
|
@@ -10980,7 +10977,14 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
10980
10977
|
"Upload"
|
|
10981
10978
|
))
|
|
10982
10979
|
},
|
|
10983
|
-
/* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React30.createElement(
|
|
10980
|
+
/* @__PURE__ */ React30.createElement(StateInspectorDisclosureRowInner, null, assets.map((asset) => /* @__PURE__ */ React30.createElement(StateInspectorRow, { key: asset.id, colorScheme }, /* @__PURE__ */ React30.createElement(
|
|
10981
|
+
themedObjectInspector,
|
|
10982
|
+
{
|
|
10983
|
+
name: asset.id,
|
|
10984
|
+
data: truncateAsset(asset),
|
|
10985
|
+
theme: theme3
|
|
10986
|
+
}
|
|
10987
|
+
), /* @__PURE__ */ React30.createElement(
|
|
10984
10988
|
StateInspectorButton,
|
|
10985
10989
|
{
|
|
10986
10990
|
theme: theme3,
|
|
@@ -11005,10 +11009,8 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
11005
11009
|
"Are you sure you want to delete all resources?"
|
|
11006
11010
|
);
|
|
11007
11011
|
if (!ok) return;
|
|
11008
|
-
await
|
|
11009
|
-
resources.map(
|
|
11010
|
-
(resource) => resourceManager.deleteResource({ id: resource.id })
|
|
11011
|
-
)
|
|
11012
|
+
await resourceManager.deleteResource(
|
|
11013
|
+
resources.map((resource) => ({ id: resource.id }))
|
|
11012
11014
|
);
|
|
11013
11015
|
}
|
|
11014
11016
|
},
|
|
@@ -11018,7 +11020,7 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
11018
11020
|
{
|
|
11019
11021
|
theme: theme3,
|
|
11020
11022
|
onClick: async () => {
|
|
11021
|
-
const path2 = prompt("Enter directory path") ||
|
|
11023
|
+
const path2 = prompt("Enter directory path") || uuid9();
|
|
11022
11024
|
await resourceManager.createResource({
|
|
11023
11025
|
type: "directory",
|
|
11024
11026
|
path: path2
|
|
@@ -11034,9 +11036,9 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
11034
11036
|
const file = await uploadFile();
|
|
11035
11037
|
resourceManager.createResource({
|
|
11036
11038
|
type: "asset",
|
|
11037
|
-
path: file.name ||
|
|
11039
|
+
path: file.name || uuid9(),
|
|
11038
11040
|
asset: {
|
|
11039
|
-
content:
|
|
11041
|
+
content: Base643.encode(await file.arrayBuffer()),
|
|
11040
11042
|
contentType: file.type,
|
|
11041
11043
|
encoding: "base64"
|
|
11042
11044
|
}
|
|
@@ -11221,6 +11223,12 @@ var StateInspector = memoGeneric(function StateInspector2({
|
|
|
11221
11223
|
)
|
|
11222
11224
|
);
|
|
11223
11225
|
});
|
|
11226
|
+
var truncateAsset = memoize2((asset) => {
|
|
11227
|
+
if (asset.url.startsWith("data:") || asset.url.startsWith("blob:")) {
|
|
11228
|
+
return { ...asset, url: ellipsis(asset.url, 40) };
|
|
11229
|
+
}
|
|
11230
|
+
return asset;
|
|
11231
|
+
});
|
|
11224
11232
|
|
|
11225
11233
|
// ../noya-multiplayer-react/src/hooks.ts
|
|
11226
11234
|
function useManagedHistory(stateManager) {
|
|
@@ -11231,10 +11239,11 @@ function useManagedHistory(stateManager) {
|
|
|
11231
11239
|
);
|
|
11232
11240
|
}
|
|
11233
11241
|
|
|
11242
|
+
// ../noya-multiplayer-react/src/singleton.tsx
|
|
11243
|
+
import React33 from "react";
|
|
11244
|
+
|
|
11234
11245
|
// ../noya-multiplayer-react/src/NoyaStateContext.tsx
|
|
11235
11246
|
var AnyNoyaStateContext = createContext3(void 0);
|
|
11236
|
-
var ConnectedUsersContext = createContext3(void 0);
|
|
11237
|
-
var AnyEphemeralUserDataManagerContext = createContext3(void 0);
|
|
11238
11247
|
var emptyArray = [];
|
|
11239
11248
|
function useActivityEventsForManager(streamFilter, activityEventsManager) {
|
|
11240
11249
|
const [streamId, setStreamId] = useState17(void 0);
|
|
@@ -11253,8 +11262,8 @@ function useActivityEventsForManager(streamFilter, activityEventsManager) {
|
|
|
11253
11262
|
}
|
|
11254
11263
|
|
|
11255
11264
|
// ../noya-multiplayer-react/src/components/UserPointersOverlay.tsx
|
|
11256
|
-
import { Observable as
|
|
11257
|
-
import
|
|
11265
|
+
import { Observable as Observable19 } from "@noya-app/observable";
|
|
11266
|
+
import React35, { useEffect as useEffect17, useMemo as useMemo12, useState as useState18 } from "react";
|
|
11258
11267
|
function shouldShow(hideAfter, updatedAt) {
|
|
11259
11268
|
return !!updatedAt && Date.now() - updatedAt < hideAfter;
|
|
11260
11269
|
}
|
|
@@ -11267,7 +11276,7 @@ var UserPointerInternal = memoGeneric(function UserPointerInternal2({
|
|
|
11267
11276
|
const observable = useMemo12(() => {
|
|
11268
11277
|
const metadata$ = ephemeralUserDataManager.metadata$.observePath([user.id]).throttle(50);
|
|
11269
11278
|
const data$ = ephemeralUserDataManager.data$.observePath([user.id]).throttle(50);
|
|
11270
|
-
return
|
|
11279
|
+
return Observable19.combine([metadata$, data$], ([metadata2, data2]) => {
|
|
11271
11280
|
return { metadata: metadata2, data: data2 };
|
|
11272
11281
|
});
|
|
11273
11282
|
}, [ephemeralUserDataManager, user.id]);
|
|
@@ -11297,9 +11306,9 @@ var UserPointersOverlay = memoGeneric(function UserPointers({
|
|
|
11297
11306
|
}) {
|
|
11298
11307
|
const currentUserId = useObservable2(ephemeralUserDataManager.currentUserId$);
|
|
11299
11308
|
const connectedUsers = useObservable2(connectedUsersManager.connectedUsers$);
|
|
11300
|
-
return /* @__PURE__ */
|
|
11309
|
+
return /* @__PURE__ */ React35.createElement(React35.Fragment, null, connectedUsers.map((user) => {
|
|
11301
11310
|
if (user.id === currentUserId) return null;
|
|
11302
|
-
return /* @__PURE__ */
|
|
11311
|
+
return /* @__PURE__ */ React35.createElement(
|
|
11303
11312
|
UserPointerInternal,
|
|
11304
11313
|
{
|
|
11305
11314
|
key: user.id,
|
|
@@ -11315,7 +11324,7 @@ var UserPointersOverlay = memoGeneric(function UserPointers({
|
|
|
11315
11324
|
import {
|
|
11316
11325
|
RefetchableObservable
|
|
11317
11326
|
} from "@noya-app/observable-store";
|
|
11318
|
-
import { useEffect as useEffect18, useMemo as useMemo13 } from "react";
|
|
11327
|
+
import { useCallback as useCallback15, useEffect as useEffect18, useMemo as useMemo13 } from "react";
|
|
11319
11328
|
function useTable(table, {
|
|
11320
11329
|
where,
|
|
11321
11330
|
select
|
|
@@ -11363,21 +11372,39 @@ function useTable(table, {
|
|
|
11363
11372
|
observable.start?.();
|
|
11364
11373
|
}, [observable]);
|
|
11365
11374
|
const { status, data } = useObservable2(observable);
|
|
11375
|
+
const optimisticUpdate = useCallback15(
|
|
11376
|
+
(entity, config) => {
|
|
11377
|
+
if (!table) return;
|
|
11378
|
+
table.optimisticUpdate(entity, config);
|
|
11379
|
+
},
|
|
11380
|
+
[table]
|
|
11381
|
+
);
|
|
11366
11382
|
return useMemo13(() => {
|
|
11367
11383
|
return {
|
|
11368
11384
|
status,
|
|
11369
11385
|
data,
|
|
11370
|
-
refetch: observable.refetch
|
|
11386
|
+
refetch: observable.refetch,
|
|
11387
|
+
optimisticUpdate
|
|
11371
11388
|
};
|
|
11372
|
-
}, [status, data, observable]);
|
|
11389
|
+
}, [status, data, observable, optimisticUpdate]);
|
|
11373
11390
|
}
|
|
11374
11391
|
function useFileList(select, options = {}) {
|
|
11375
11392
|
const client = useNoyaClientOrFallback();
|
|
11376
|
-
|
|
11393
|
+
const { status, data, refetch, optimisticUpdate } = useTable(
|
|
11394
|
+
client.fileList$,
|
|
11395
|
+
{ select },
|
|
11396
|
+
options
|
|
11397
|
+
);
|
|
11398
|
+
return {
|
|
11399
|
+
status,
|
|
11400
|
+
data,
|
|
11401
|
+
refetch,
|
|
11402
|
+
optimisticUpdate
|
|
11403
|
+
};
|
|
11377
11404
|
}
|
|
11378
11405
|
function useFileListItem(id, select, options = {}) {
|
|
11379
11406
|
const client = useNoyaClientOrFallback();
|
|
11380
|
-
const { status, data, refetch } = useTable(
|
|
11407
|
+
const { status, data, refetch, optimisticUpdate } = useTable(
|
|
11381
11408
|
client.fileList$,
|
|
11382
11409
|
{ where: { id: id ?? null }, select },
|
|
11383
11410
|
options
|
|
@@ -11386,21 +11413,28 @@ function useFileListItem(id, select, options = {}) {
|
|
|
11386
11413
|
return {
|
|
11387
11414
|
data: data.at(0),
|
|
11388
11415
|
status,
|
|
11389
|
-
refetch
|
|
11416
|
+
refetch,
|
|
11417
|
+
optimisticUpdate
|
|
11390
11418
|
};
|
|
11391
|
-
}, [data, status, refetch]);
|
|
11419
|
+
}, [data, status, refetch, optimisticUpdate]);
|
|
11392
11420
|
}
|
|
11393
11421
|
function useResourcesList(fileId, select, options = {}) {
|
|
11394
11422
|
const client = useNoyaClientOrFallback();
|
|
11395
|
-
|
|
11423
|
+
const { status, data, refetch, optimisticUpdate } = useTable(
|
|
11396
11424
|
client.resources$,
|
|
11397
11425
|
{ select, where: { accessibleByFileId: fileId } },
|
|
11398
11426
|
options
|
|
11399
11427
|
);
|
|
11428
|
+
return {
|
|
11429
|
+
status,
|
|
11430
|
+
data,
|
|
11431
|
+
refetch,
|
|
11432
|
+
optimisticUpdate
|
|
11433
|
+
};
|
|
11400
11434
|
}
|
|
11401
11435
|
function useUser(id, select, options = {}) {
|
|
11402
11436
|
const client = useNoyaClientOrFallback();
|
|
11403
|
-
const { status, data, refetch } = useTable(
|
|
11437
|
+
const { status, data, refetch, optimisticUpdate } = useTable(
|
|
11404
11438
|
client.users$,
|
|
11405
11439
|
{ select, where: { id: id ?? null } },
|
|
11406
11440
|
options
|
|
@@ -11409,17 +11443,24 @@ function useUser(id, select, options = {}) {
|
|
|
11409
11443
|
return {
|
|
11410
11444
|
status,
|
|
11411
11445
|
data: data.at(0),
|
|
11412
|
-
refetch
|
|
11446
|
+
refetch,
|
|
11447
|
+
optimisticUpdate
|
|
11413
11448
|
};
|
|
11414
|
-
}, [status, data, refetch]);
|
|
11449
|
+
}, [status, data, refetch, optimisticUpdate]);
|
|
11415
11450
|
}
|
|
11416
11451
|
function useActivityEventsList(fileId, select, options = {}) {
|
|
11417
11452
|
const client = useNoyaClientOrFallback();
|
|
11418
|
-
|
|
11453
|
+
const { status, data, refetch, optimisticUpdate } = useTable(
|
|
11419
11454
|
client.activityEvents$,
|
|
11420
11455
|
{ select, where: { fileId } },
|
|
11421
11456
|
options
|
|
11422
11457
|
);
|
|
11458
|
+
return {
|
|
11459
|
+
status,
|
|
11460
|
+
data,
|
|
11461
|
+
refetch,
|
|
11462
|
+
optimisticUpdate
|
|
11463
|
+
};
|
|
11423
11464
|
}
|
|
11424
11465
|
export {
|
|
11425
11466
|
NoyaAPIProvider,
|