@noya-app/noya-api-client-react 0.1.51 → 0.1.53

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/dist/index.mjs CHANGED
@@ -33,11 +33,11 @@ var require_access = __commonJS({
33
33
  "../../node_modules/tree-visit/lib/access.js"(exports) {
34
34
  "use strict";
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.get = get4;
36
+ exports.get = get5;
37
37
  exports.ancestors = ancestors;
38
38
  exports.access = access;
39
39
  exports.accessPath = accessPath;
40
- function get4(node, indexPath, options) {
40
+ function get5(node, indexPath, options) {
41
41
  if (options.includeTraversalContext) {
42
42
  const accessed = _getPath(node, indexPath, options);
43
43
  return accessed[accessed.length - 1];
@@ -5615,7 +5615,8 @@ var baseSchemaProperties = {
5615
5615
  })
5616
5616
  ),
5617
5617
  accessibleByFileVersionId: Nullable(Type.String()),
5618
- url: Type.Optional(Type.String())
5618
+ url: Type.Optional(Type.String()),
5619
+ transformUrl: Type.Optional(Type.String())
5619
5620
  };
5620
5621
  var uploadableAssetSchema = Type.Object({
5621
5622
  content: Type.String(),
@@ -6064,11 +6065,11 @@ function handleValue(target, handledSet, options) {
6064
6065
  }
6065
6066
  });
6066
6067
  if (setMap) {
6067
- const set4 = target;
6068
- const values = Array.from(set4);
6069
- set4.clear();
6068
+ const set3 = target;
6069
+ const values = Array.from(set3);
6070
+ set3.clear();
6070
6071
  values.forEach((value) => {
6071
- set4.add(setMap.has(value) ? setMap.get(value) : value);
6072
+ set3.add(setMap.has(value) ? setMap.get(value) : value);
6072
6073
  });
6073
6074
  }
6074
6075
  }
@@ -7293,19 +7294,14 @@ function applyExtendedPatch(obj, patches) {
7293
7294
  // ../state-manager/src/diff.ts
7294
7295
  var import_fast_diff = __toESM(require_diff());
7295
7296
 
7296
- // ../state-manager/src/EvalManager.ts
7297
- import { uuid as uuid2 } from "@noya-app/noya-utils";
7298
-
7299
- // ../state-manager/src/FilePropertyManager.ts
7300
- import { uuid as uuid3 } from "@noya-app/noya-utils";
7301
- import { Observable as Observable5 } from "@noya-app/observable";
7297
+ // ../state-manager/src/documentAITools.ts
7298
+ import { get as get2 } from "@noya-app/observable";
7302
7299
 
7303
- // ../state-manager/src/multiplayer.ts
7304
- import { Cache, hash, isDeepEqual as isDeepEqual3, uuid as uuid5 } from "@noya-app/noya-utils";
7305
- import { Observable as Observable8, get as get2, set as set2 } from "@noya-app/observable";
7306
-
7307
- // ../state-manager/src/LogManager.ts
7308
- import { Observable as Observable6 } from "@noya-app/observable";
7300
+ // ../state-manager/src/stateManager.ts
7301
+ import {
7302
+ Observable as Observable5,
7303
+ get as getPath2
7304
+ } from "@noya-app/observable";
7309
7305
 
7310
7306
  // ../state-manager/src/historyEntries.ts
7311
7307
  var HistoryEntries;
@@ -7393,6 +7389,73 @@ var HistoryEntries;
7393
7389
  HistoryEntries2.pathsEqual = pathsEqual;
7394
7390
  })(HistoryEntries || (HistoryEntries = {}));
7395
7391
 
7392
+ // ../state-manager/src/documentAITools.ts
7393
+ var pathSchema = Type.Array(Type.Union([Type.String(), Type.Number()]), {
7394
+ description: "An exact path into the JSON document, expressed as string and number segments."
7395
+ });
7396
+ var documentOperationSchema = Type.Union([
7397
+ Type.Object({
7398
+ op: Type.Literal("set"),
7399
+ path: pathSchema,
7400
+ value: Type.Any()
7401
+ }),
7402
+ Type.Object({
7403
+ op: Type.Literal("add"),
7404
+ path: pathSchema,
7405
+ value: Type.Any()
7406
+ }),
7407
+ Type.Object({
7408
+ op: Type.Literal("remove"),
7409
+ path: pathSchema
7410
+ }),
7411
+ Type.Object({
7412
+ op: Type.Literal("move"),
7413
+ from: pathSchema,
7414
+ path: pathSchema
7415
+ })
7416
+ ]);
7417
+ var readDocumentParametersSchema = Type.Object({
7418
+ path: Type.Optional(pathSchema)
7419
+ });
7420
+ var applyDocumentOperationsParametersSchema = Type.Object({
7421
+ operations: Type.Array(documentOperationSchema, { minItems: 1 }),
7422
+ expectedHash: Type.Optional(
7423
+ Type.String({
7424
+ description: "The document hash returned by an earlier tool result. The edit is rejected if the document changed."
7425
+ })
7426
+ ),
7427
+ summary: Type.String({
7428
+ description: "A concise description of the requested document changes."
7429
+ })
7430
+ });
7431
+ var runDocumentScriptParametersSchema = Type.Object({
7432
+ sourceCode: Type.String({
7433
+ description: 'JavaScript defining a named function "updateState(state)" which mutates state in place.'
7434
+ }),
7435
+ expectedHash: Type.Optional(
7436
+ Type.String({
7437
+ description: "The document hash returned by an earlier tool result. The edit is rejected if the document changed."
7438
+ })
7439
+ ),
7440
+ summary: Type.String({
7441
+ description: "A concise description of the requested document changes."
7442
+ })
7443
+ });
7444
+
7445
+ // ../state-manager/src/EvalManager.ts
7446
+ import { uuid as uuid2 } from "@noya-app/noya-utils";
7447
+
7448
+ // ../state-manager/src/FilePropertyManager.ts
7449
+ import { uuid as uuid3 } from "@noya-app/noya-utils";
7450
+ import { Observable as Observable6 } from "@noya-app/observable";
7451
+
7452
+ // ../state-manager/src/multiplayer.ts
7453
+ import { Cache, hash, isDeepEqual as isDeepEqual3, uuid as uuid5 } from "@noya-app/noya-utils";
7454
+ import { Observable as Observable8, get as get3, set as set2 } from "@noya-app/observable";
7455
+
7456
+ // ../state-manager/src/LogManager.ts
7457
+ import { Observable as Observable7 } from "@noya-app/observable";
7458
+
7396
7459
  // ../../node_modules/@marcbachmann/cel-js/lib/errors.js
7397
7460
  var ParseError = class extends Error {
7398
7461
  #wasConstructedWithAst = false;
@@ -9541,10 +9604,10 @@ function registerOverloads(registry) {
9541
9604
  return true;
9542
9605
  }
9543
9606
  const arr = a instanceof Set ? b : a;
9544
- const set4 = a instanceof Set ? a : b;
9607
+ const set3 = a instanceof Set ? a : b;
9545
9608
  if (!Array.isArray(arr)) return false;
9546
- if (arr.length !== set4?.size) return false;
9547
- for (let i = 0; i < arr.length; i++) if (!set4.has(arr[i])) return false;
9609
+ if (arr.length !== set3?.size) return false;
9610
+ for (let i = 0; i < arr.length; i++) if (!set3.has(arr[i])) return false;
9548
9611
  return true;
9549
9612
  });
9550
9613
  binaryOverload2("map", `==`, "map", (a, b, ast, ev) => {
@@ -10410,24 +10473,25 @@ var READ_DENIED = Symbol("readDenied");
10410
10473
  // ../state-manager/src/serverScripts.ts
10411
10474
  import { uuid as createUuid, isDeepEqual as isDeepEqual2 } from "@noya-app/noya-utils";
10412
10475
 
10413
- // ../state-manager/src/stateManager.ts
10414
- import {
10415
- Observable as Observable7,
10416
- get as getPath2
10417
- } from "@noya-app/observable";
10418
-
10419
10476
  // ../state-manager/src/multiplayer.ts
10420
10477
  var createHash = (value, options) => hash(value, { ...options, ignoreUndefinedProperties: true });
10421
10478
 
10422
10479
  // ../state-manager/src/GitManager.ts
10423
10480
  import { Observable as Observable9 } from "@noya-app/observable";
10424
10481
 
10425
- // ../state-manager/src/ImagePickerManager.ts
10482
+ // ../state-manager/src/ResourceManager.ts
10483
+ import { isDeepEqual as isDeepEqual4, uuid as uuid6 } from "@noya-app/noya-utils";
10426
10484
  import { Observable as Observable10 } from "@noya-app/observable";
10427
- import { uuid as uuid6 } from "@noya-app/noya-utils";
10428
10485
 
10429
- // ../state-manager/src/IOManager.ts
10486
+ // ../state-manager/src/HostStorageManager.ts
10487
+ import { uuid as uuid7 } from "@noya-app/noya-utils";
10488
+
10489
+ // ../state-manager/src/ImagePickerManager.ts
10430
10490
  import { Observable as Observable11 } from "@noya-app/observable";
10491
+ import { uuid as uuid8 } from "@noya-app/noya-utils";
10492
+
10493
+ // ../state-manager/src/IOManager.ts
10494
+ import { Observable as Observable12 } from "@noya-app/observable";
10431
10495
 
10432
10496
  // ../state-manager/src/jwt.ts
10433
10497
  function base64UrlEncode(str) {
@@ -10529,18 +10593,18 @@ var jwt;
10529
10593
  })(jwt || (jwt = {}));
10530
10594
 
10531
10595
  // ../state-manager/src/MenuManager.ts
10532
- import { isDeepEqual as isDeepEqual4 } from "@noya-app/noya-utils";
10533
- import { Observable as Observable12 } from "@noya-app/observable";
10596
+ import { isDeepEqual as isDeepEqual5 } from "@noya-app/noya-utils";
10597
+ import { Observable as Observable13 } from "@noya-app/observable";
10534
10598
 
10535
10599
  // ../state-manager/src/NoyaManager.ts
10536
- import { uuid as uuid14 } from "@noya-app/noya-utils";
10537
- import { Observable as Observable23, set as set3 } from "@noya-app/observable";
10600
+ import { uuid as uuid15 } from "@noya-app/noya-utils";
10601
+ import { Observable as Observable23 } from "@noya-app/observable";
10538
10602
 
10539
10603
  // ../noya-pipeline/src/graphToTasks.ts
10540
- import { get as get3 } from "@noya-app/observable";
10604
+ import { get as get4 } from "@noya-app/observable";
10541
10605
 
10542
10606
  // ../noya-pipeline/src/state.ts
10543
- import { uuid as uuid7 } from "@noya-app/noya-utils";
10607
+ import { uuid as uuid9 } from "@noya-app/noya-utils";
10544
10608
  var rectSchema = Type.Object({
10545
10609
  x: Type.Number(),
10546
10610
  y: Type.Number(),
@@ -10639,20 +10703,16 @@ var pipelineSchema = Type.Object(
10639
10703
  );
10640
10704
 
10641
10705
  // ../state-manager/src/PipelineManager.ts
10642
- import { Observable as Observable13 } from "@noya-app/observable";
10643
-
10644
- // ../state-manager/src/PublishingManager.ts
10645
10706
  import { Observable as Observable14 } from "@noya-app/observable";
10646
10707
 
10647
- // ../state-manager/src/ResourceManager.ts
10648
- import { isDeepEqual as isDeepEqual5, uuid as uuid8 } from "@noya-app/noya-utils";
10708
+ // ../state-manager/src/PublishingManager.ts
10649
10709
  import { Observable as Observable15 } from "@noya-app/observable";
10650
10710
 
10651
10711
  // ../state-manager/src/SandboxManager.ts
10652
10712
  import { Observable as Observable16 } from "@noya-app/observable";
10653
10713
 
10654
10714
  // ../state-manager/src/rpcManager.ts
10655
- import { uuid as uuid9 } from "@noya-app/noya-utils";
10715
+ import { uuid as uuid10 } from "@noya-app/noya-utils";
10656
10716
  import { Observable as Observable17 } from "@noya-app/observable";
10657
10717
 
10658
10718
  // ../state-manager/src/SecretManager.ts
@@ -10669,7 +10729,7 @@ import { Observable as Observable20 } from "@noya-app/observable";
10669
10729
  import { Observable as Observable22 } from "@noya-app/observable";
10670
10730
 
10671
10731
  // ../state-manager/src/sync/clientId.ts
10672
- import { uuid as uuid10 } from "@noya-app/noya-utils";
10732
+ import { uuid as uuid11 } from "@noya-app/noya-utils";
10673
10733
  import { Observable as Observable21 } from "@noya-app/observable";
10674
10734
 
10675
10735
  // ../state-manager/src/sync/defaultNames.ts
@@ -10766,7 +10826,7 @@ if (typeof window !== "undefined") {
10766
10826
  if (storedClientId) {
10767
10827
  clientId$.set(storedClientId);
10768
10828
  } else {
10769
- const newClientId = uuid10();
10829
+ const newClientId = uuid11();
10770
10830
  safeSetItem(CLIENT_ID_STORAGE_KEY, newClientId);
10771
10831
  clientId$.set(newClientId);
10772
10832
  }
@@ -10789,13 +10849,13 @@ if (typeof window !== "undefined") {
10789
10849
  }
10790
10850
 
10791
10851
  // ../state-manager/src/sync/syncUtils.ts
10792
- import { uuid as uuid11 } from "@noya-app/noya-utils";
10852
+ import { uuid as uuid12 } from "@noya-app/noya-utils";
10793
10853
 
10794
10854
  // ../state-manager/src/sync/localRpcHelpers.ts
10795
- import { Base64 as Base644, uuid as uuid12 } from "@noya-app/noya-utils";
10855
+ import { Base64 as Base644, uuid as uuid13 } from "@noya-app/noya-utils";
10796
10856
 
10797
10857
  // ../state-manager/src/sync/localStorageSync.ts
10798
- import { uuid as uuid13 } from "@noya-app/noya-utils";
10858
+ import { uuid as uuid14 } from "@noya-app/noya-utils";
10799
10859
 
10800
10860
  // ../noya-keymap/src/hooks.ts
10801
10861
  import { useEffect as useEffect2, useRef as useRef2 } from "react";
@@ -10907,16 +10967,6 @@ var MenuItemTree = (0, import_tree_visit3.defineTree)((node) => {
10907
10967
  return node.type === "submenu" ? node.items : [];
10908
10968
  });
10909
10969
 
10910
- // ../state-manager/src/NoyaManager.ts
10911
- var createMutatorParametersSchema = Type.Object({
10912
- sourceCode: Type.String({
10913
- description: "The source code of the mutator function."
10914
- }),
10915
- message: Type.String({
10916
- description: `A message that summarizes the changes made to the document state.`
10917
- })
10918
- });
10919
-
10920
10970
  // ../noya-multiplayer-react/src/ai.ts
10921
10971
  import { useEffect as useEffect18 } from "react";
10922
10972
 
@@ -11332,7 +11382,7 @@ import React35 from "react";
11332
11382
  import { createRoot } from "react-dom/client";
11333
11383
 
11334
11384
  // ../noya-multiplayer-react/src/inspector/StateInspector.tsx
11335
- import { Base64 as Base645, memoize, uuid as uuid15 } from "@noya-app/noya-utils";
11385
+ import { Base64 as Base645, memoize, uuid as uuid16 } from "@noya-app/noya-utils";
11336
11386
  import React34, {
11337
11387
  useCallback as useCallback12,
11338
11388
  useEffect as useEffect14,
@@ -12530,7 +12580,7 @@ var import_is_dom = __toESM2(require_is_dom());
12530
12580
  // ../noya-multiplayer-react/src/useObservable.ts
12531
12581
  import { useMemo as useMemo8, useSyncExternalStore } from "react";
12532
12582
  function useObservable2(observable, pathOrSelector, options) {
12533
- const { get: get4, listen } = useMemo8(() => {
12583
+ const { get: get5, listen } = useMemo8(() => {
12534
12584
  if (!observable) {
12535
12585
  return {
12536
12586
  get: () => void 0,
@@ -12548,10 +12598,10 @@ function useObservable2(observable, pathOrSelector, options) {
12548
12598
  };
12549
12599
  }
12550
12600
  const listen2 = pathOrSelector ? (callback) => observable.subscribe(pathOrSelector, callback) : observable.subscribe;
12551
- const get5 = pathOrSelector ? () => observable.get(pathOrSelector) : observable.get;
12552
- return { get: get5, listen: listen2 };
12601
+ const get6 = pathOrSelector ? () => observable.get(pathOrSelector) : observable.get;
12602
+ return { get: get6, listen: listen2 };
12553
12603
  }, [observable, pathOrSelector, options?.isEqual]);
12554
- return useSyncExternalStore(listen, get4, get4);
12604
+ return useSyncExternalStore(listen, get5, get5);
12555
12605
  }
12556
12606
 
12557
12607
  // ../noya-multiplayer-react/src/inspector/ColoredDot.tsx
@@ -14862,7 +14912,7 @@ var StateInspector = memoGeneric(function StateInspector2({
14862
14912
  {
14863
14913
  theme: theme3,
14864
14914
  onClick: async () => {
14865
- const path2 = prompt("Enter directory path") || uuid15();
14915
+ const path2 = prompt("Enter directory path") || uuid16();
14866
14916
  await resourceManager.createResource({
14867
14917
  type: "directory",
14868
14918
  path: path2
@@ -14878,7 +14928,7 @@ var StateInspector = memoGeneric(function StateInspector2({
14878
14928
  const file = await uploadFile();
14879
14929
  resourceManager.createResource({
14880
14930
  type: "asset",
14881
- path: file.name || uuid15(),
14931
+ path: file.name || uuid16(),
14882
14932
  asset: {
14883
14933
  content: Base645.encode(await file.arrayBuffer()),
14884
14934
  contentType: file.type,