@arke-institute/sdk 2.3.0 → 2.3.2

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Source: Arke v1 API
8
8
  * Version: 1.0.0
9
- * Generated: 2026-01-01T18:48:14.305Z
9
+ * Generated: 2026-01-04T16:48:55.356Z
10
10
  */
11
11
  type paths = {
12
12
  "/auth/register": {
@@ -1790,6 +1790,322 @@ type paths = {
1790
1790
  };
1791
1791
  };
1792
1792
  post?: never;
1793
+ /**
1794
+ * Delete entity
1795
+ * @description Soft-deletes an entity by creating a tombstone version. The entity can be restored later via POST /entities/:id/restore. Note: entity:delete on a collection requires collection:delete permission.
1796
+ */
1797
+ delete: {
1798
+ parameters: {
1799
+ query?: never;
1800
+ header?: never;
1801
+ path: {
1802
+ /** @description Entity ID (ULID) */
1803
+ id: string;
1804
+ };
1805
+ cookie?: never;
1806
+ };
1807
+ requestBody?: {
1808
+ content: {
1809
+ "application/json": components["schemas"]["DeleteEntityRequest"];
1810
+ };
1811
+ };
1812
+ responses: {
1813
+ /** @description Entity deleted */
1814
+ 200: {
1815
+ headers: {
1816
+ [name: string]: unknown;
1817
+ };
1818
+ content: {
1819
+ "application/json": components["schemas"]["EntityDeletedResponse"];
1820
+ };
1821
+ };
1822
+ /** @description Bad Request - Invalid input */
1823
+ 400: {
1824
+ headers: {
1825
+ [name: string]: unknown;
1826
+ };
1827
+ content: {
1828
+ /**
1829
+ * @example {
1830
+ * "error": "Validation failed",
1831
+ * "details": {
1832
+ * "issues": [
1833
+ * {
1834
+ * "path": [
1835
+ * "properties",
1836
+ * "label"
1837
+ * ],
1838
+ * "message": "Required"
1839
+ * }
1840
+ * ]
1841
+ * }
1842
+ * }
1843
+ */
1844
+ "application/json": components["schemas"]["ValidationErrorResponse"];
1845
+ };
1846
+ };
1847
+ /** @description Unauthorized - Missing or invalid authentication */
1848
+ 401: {
1849
+ headers: {
1850
+ [name: string]: unknown;
1851
+ };
1852
+ content: {
1853
+ /**
1854
+ * @example {
1855
+ * "error": "Unauthorized: Missing or invalid authentication token"
1856
+ * }
1857
+ */
1858
+ "application/json": components["schemas"]["ErrorResponse"];
1859
+ };
1860
+ };
1861
+ /** @description Forbidden - Insufficient permissions */
1862
+ 403: {
1863
+ headers: {
1864
+ [name: string]: unknown;
1865
+ };
1866
+ content: {
1867
+ /**
1868
+ * @example {
1869
+ * "error": "Forbidden: You do not have permission to perform this action"
1870
+ * }
1871
+ */
1872
+ "application/json": components["schemas"]["ErrorResponse"];
1873
+ };
1874
+ };
1875
+ /** @description Not Found - Resource does not exist */
1876
+ 404: {
1877
+ headers: {
1878
+ [name: string]: unknown;
1879
+ };
1880
+ content: {
1881
+ /**
1882
+ * @example {
1883
+ * "error": "Entity not found"
1884
+ * }
1885
+ */
1886
+ "application/json": components["schemas"]["ErrorResponse"];
1887
+ };
1888
+ };
1889
+ /** @description Conflict - CAS validation failed (entity was modified) */
1890
+ 409: {
1891
+ headers: {
1892
+ [name: string]: unknown;
1893
+ };
1894
+ content: {
1895
+ /**
1896
+ * @example {
1897
+ * "error": "Conflict: entity was modified",
1898
+ * "details": {
1899
+ * "expected": "bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy",
1900
+ * "actual": "bafyreinewabc123456789defghijklmnopqrstuvwxyz"
1901
+ * }
1902
+ * }
1903
+ */
1904
+ "application/json": components["schemas"]["CASErrorResponse"];
1905
+ };
1906
+ };
1907
+ };
1908
+ };
1909
+ options?: never;
1910
+ head?: never;
1911
+ patch?: never;
1912
+ trace?: never;
1913
+ };
1914
+ "/entities/{id}/restore": {
1915
+ parameters: {
1916
+ query?: never;
1917
+ header?: never;
1918
+ path?: never;
1919
+ cookie?: never;
1920
+ };
1921
+ get?: never;
1922
+ put?: never;
1923
+ /**
1924
+ * Restore deleted entity
1925
+ * @description Restores a deleted entity by finding the last non-deleted version and creating a new version from it. Note: entity:restore on a collection requires collection:restore permission.
1926
+ */
1927
+ post: {
1928
+ parameters: {
1929
+ query?: never;
1930
+ header?: never;
1931
+ path: {
1932
+ /** @description Entity ID (ULID) */
1933
+ id: string;
1934
+ };
1935
+ cookie?: never;
1936
+ };
1937
+ requestBody?: {
1938
+ content: {
1939
+ "application/json": components["schemas"]["RestoreEntityRequest"];
1940
+ };
1941
+ };
1942
+ responses: {
1943
+ /** @description Entity restored */
1944
+ 200: {
1945
+ headers: {
1946
+ [name: string]: unknown;
1947
+ };
1948
+ content: {
1949
+ "application/json": components["schemas"]["EntityRestoredResponse"];
1950
+ };
1951
+ };
1952
+ /** @description Bad Request - Invalid input */
1953
+ 400: {
1954
+ headers: {
1955
+ [name: string]: unknown;
1956
+ };
1957
+ content: {
1958
+ /**
1959
+ * @example {
1960
+ * "error": "Validation failed",
1961
+ * "details": {
1962
+ * "issues": [
1963
+ * {
1964
+ * "path": [
1965
+ * "properties",
1966
+ * "label"
1967
+ * ],
1968
+ * "message": "Required"
1969
+ * }
1970
+ * ]
1971
+ * }
1972
+ * }
1973
+ */
1974
+ "application/json": components["schemas"]["ValidationErrorResponse"];
1975
+ };
1976
+ };
1977
+ /** @description Unauthorized - Missing or invalid authentication */
1978
+ 401: {
1979
+ headers: {
1980
+ [name: string]: unknown;
1981
+ };
1982
+ content: {
1983
+ /**
1984
+ * @example {
1985
+ * "error": "Unauthorized: Missing or invalid authentication token"
1986
+ * }
1987
+ */
1988
+ "application/json": components["schemas"]["ErrorResponse"];
1989
+ };
1990
+ };
1991
+ /** @description Forbidden - Insufficient permissions */
1992
+ 403: {
1993
+ headers: {
1994
+ [name: string]: unknown;
1995
+ };
1996
+ content: {
1997
+ /**
1998
+ * @example {
1999
+ * "error": "Forbidden: You do not have permission to perform this action"
2000
+ * }
2001
+ */
2002
+ "application/json": components["schemas"]["ErrorResponse"];
2003
+ };
2004
+ };
2005
+ /** @description Not Found - Resource does not exist */
2006
+ 404: {
2007
+ headers: {
2008
+ [name: string]: unknown;
2009
+ };
2010
+ content: {
2011
+ /**
2012
+ * @example {
2013
+ * "error": "Entity not found"
2014
+ * }
2015
+ */
2016
+ "application/json": components["schemas"]["ErrorResponse"];
2017
+ };
2018
+ };
2019
+ /** @description Conflict - CAS validation failed (entity was modified) */
2020
+ 409: {
2021
+ headers: {
2022
+ [name: string]: unknown;
2023
+ };
2024
+ content: {
2025
+ /**
2026
+ * @example {
2027
+ * "error": "Conflict: entity was modified",
2028
+ * "details": {
2029
+ * "expected": "bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy",
2030
+ * "actual": "bafyreinewabc123456789defghijklmnopqrstuvwxyz"
2031
+ * }
2032
+ * }
2033
+ */
2034
+ "application/json": components["schemas"]["CASErrorResponse"];
2035
+ };
2036
+ };
2037
+ };
2038
+ };
2039
+ delete?: never;
2040
+ options?: never;
2041
+ head?: never;
2042
+ patch?: never;
2043
+ trace?: never;
2044
+ };
2045
+ "/entities/{id}/collection": {
2046
+ parameters: {
2047
+ query?: never;
2048
+ header?: never;
2049
+ path?: never;
2050
+ cookie?: never;
2051
+ };
2052
+ /**
2053
+ * Get entity collection
2054
+ * @description Returns the collection ID that this entity belongs to. Returns null if the entity is not in any collection. If the entity IS a collection, returns its own ID.
2055
+ */
2056
+ get: {
2057
+ parameters: {
2058
+ query?: never;
2059
+ header?: never;
2060
+ path: {
2061
+ /** @description Entity ID (ULID) */
2062
+ id: string;
2063
+ };
2064
+ cookie?: never;
2065
+ };
2066
+ requestBody?: never;
2067
+ responses: {
2068
+ /** @description Collection lookup result */
2069
+ 200: {
2070
+ headers: {
2071
+ [name: string]: unknown;
2072
+ };
2073
+ content: {
2074
+ "application/json": components["schemas"]["EntityCollectionResponse"];
2075
+ };
2076
+ };
2077
+ /** @description Forbidden - Insufficient permissions */
2078
+ 403: {
2079
+ headers: {
2080
+ [name: string]: unknown;
2081
+ };
2082
+ content: {
2083
+ /**
2084
+ * @example {
2085
+ * "error": "Forbidden: You do not have permission to perform this action"
2086
+ * }
2087
+ */
2088
+ "application/json": components["schemas"]["ErrorResponse"];
2089
+ };
2090
+ };
2091
+ /** @description Not Found - Resource does not exist */
2092
+ 404: {
2093
+ headers: {
2094
+ [name: string]: unknown;
2095
+ };
2096
+ content: {
2097
+ /**
2098
+ * @example {
2099
+ * "error": "Entity not found"
2100
+ * }
2101
+ */
2102
+ "application/json": components["schemas"]["ErrorResponse"];
2103
+ };
2104
+ };
2105
+ };
2106
+ };
2107
+ put?: never;
2108
+ post?: never;
1793
2109
  delete?: never;
1794
2110
  options?: never;
1795
2111
  head?: never;
@@ -2065,17 +2381,17 @@ type paths = {
2065
2381
  put?: never;
2066
2382
  /**
2067
2383
  * Create file entity
2068
- * @description Creates a new file entity and returns a presigned upload URL.
2384
+ * @description Creates a new file entity.
2069
2385
  *
2070
2386
  * ## Flow
2071
2387
  * 1. Call this endpoint with file metadata (key, filename, content_type, size)
2072
- * 2. Receive entity data + presigned S3 upload URL (uploaded: false)
2073
- * 3. PUT the file content to the upload URL
2074
- * 4. Call POST /{id}/confirm-upload to verify and set uploaded: true
2388
+ * 2. Receive entity data (uploaded: false)
2389
+ * 3. POST the file content to /{id}/content
2390
+ * 4. Entity will be updated with uploaded: true and verified CID
2075
2391
  *
2076
2392
  * ## Key Best Practice
2077
- * Use the file's CID as the key for content-addressable storage.
2078
- * The system does NOT verify the CID - it's just metadata.
2393
+ * Use a unique identifier as the key (e.g., version number, timestamp).
2394
+ * The actual CID is computed during upload.
2079
2395
  */
2080
2396
  post: {
2081
2397
  parameters: {
@@ -2187,7 +2503,7 @@ type paths = {
2187
2503
  };
2188
2504
  /**
2189
2505
  * Get file metadata
2190
- * @description Returns file entity metadata. Use /download to get the file content.
2506
+ * @description Returns file entity metadata. Use /{id}/content to download the file content.
2191
2507
  */
2192
2508
  get: {
2193
2509
  parameters: {
@@ -2245,7 +2561,7 @@ type paths = {
2245
2561
  * @description Updates file metadata without changing the file content.
2246
2562
  *
2247
2563
  * ## Key Changes
2248
- * The key can be changed, but ONLY to a key that already exists in S3.
2564
+ * The key can be changed, but ONLY to a key that already exists in R2.
2249
2565
  * This allows "regressing" to a previous file version.
2250
2566
  *
2251
2567
  * To upload a new file, use POST /{id}/reupload instead.
@@ -2369,7 +2685,7 @@ type paths = {
2369
2685
  patch?: never;
2370
2686
  trace?: never;
2371
2687
  };
2372
- "/files/{id}/download": {
2688
+ "/files/{id}/content": {
2373
2689
  parameters: {
2374
2690
  query?: never;
2375
2691
  header?: never;
@@ -2377,8 +2693,16 @@ type paths = {
2377
2693
  cookie?: never;
2378
2694
  };
2379
2695
  /**
2380
- * Get download URL
2381
- * @description Returns a presigned URL for downloading the file content. URL expires in 5 minutes.
2696
+ * Download file content
2697
+ * @description Downloads the binary content of a file entity.
2698
+ *
2699
+ * ## Response Headers
2700
+ * - Content-Type: The MIME type of the file
2701
+ * - Content-Length: File size in bytes
2702
+ * - Content-Disposition: attachment; filename="original_filename"
2703
+ *
2704
+ * ## Streaming
2705
+ * Response is streamed directly from R2 storage.
2382
2706
  */
2383
2707
  get: {
2384
2708
  parameters: {
@@ -2392,13 +2716,13 @@ type paths = {
2392
2716
  };
2393
2717
  requestBody?: never;
2394
2718
  responses: {
2395
- /** @description Download URL generated */
2719
+ /** @description File content */
2396
2720
  200: {
2397
2721
  headers: {
2398
2722
  [name: string]: unknown;
2399
2723
  };
2400
2724
  content: {
2401
- "application/json": components["schemas"]["DownloadResponse"];
2725
+ "application/octet-stream": string;
2402
2726
  };
2403
2727
  };
2404
2728
  /** @description Forbidden - Insufficient permissions */
@@ -2432,36 +2756,26 @@ type paths = {
2432
2756
  };
2433
2757
  };
2434
2758
  put?: never;
2435
- post?: never;
2436
- delete?: never;
2437
- options?: never;
2438
- head?: never;
2439
- patch?: never;
2440
- trace?: never;
2441
- };
2442
- "/files/{id}/reupload": {
2443
- parameters: {
2444
- query?: never;
2445
- header?: never;
2446
- path?: never;
2447
- cookie?: never;
2448
- };
2449
- get?: never;
2450
- put?: never;
2451
2759
  /**
2452
- * Upload new file version
2453
- * @description Uploads a new version of a file.
2760
+ * Upload file content
2761
+ * @description Uploads the binary content for a file entity.
2454
2762
  *
2455
- * ## Flow
2456
- * 1. Call this endpoint with new key and file metadata
2457
- * 2. Receive updated entity + presigned upload URL (uploaded: false)
2458
- * 3. PUT the new file content to the upload URL
2459
- * 4. Call POST /{id}/confirm-upload to verify and set uploaded: true
2460
- * 5. Old file versions remain accessible via manifest history
2763
+ * ## Request
2764
+ * - Content-Type: The MIME type of the file (must match entity's content_type)
2765
+ * - Body: Binary file content (streaming supported)
2461
2766
  *
2462
- * ## Key Requirement
2463
- * The new key must NOT already exist in S3 (no overwrites).
2464
- * Previous file versions are preserved.
2767
+ * ## Limits
2768
+ * - Maximum file size: 500 MB
2769
+ *
2770
+ * ## Behavior
2771
+ * - Streams content directly to R2
2772
+ * - Computes CID from file bytes
2773
+ * - Updates entity with uploaded: true, verified size, and computed CID
2774
+ * - Atomic operation - either fully succeeds or fails
2775
+ *
2776
+ * ## Idempotency
2777
+ * Re-uploading content for an already-uploaded file will fail with 409 Conflict.
2778
+ * Use POST /{id}/reupload first to create a new version.
2465
2779
  */
2466
2780
  post: {
2467
2781
  parameters: {
@@ -2473,19 +2787,15 @@ type paths = {
2473
2787
  };
2474
2788
  cookie?: never;
2475
2789
  };
2476
- requestBody?: {
2477
- content: {
2478
- "application/json": components["schemas"]["ReuploadFileRequest"];
2479
- };
2480
- };
2790
+ requestBody?: never;
2481
2791
  responses: {
2482
- /** @description File version created */
2792
+ /** @description File content uploaded */
2483
2793
  200: {
2484
2794
  headers: {
2485
2795
  [name: string]: unknown;
2486
2796
  };
2487
2797
  content: {
2488
- "application/json": components["schemas"]["ReuploadFileResponse"];
2798
+ "application/json": components["schemas"]["UploadContentResponse"];
2489
2799
  };
2490
2800
  };
2491
2801
  /** @description Bad Request - Invalid input */
@@ -2573,6 +2883,29 @@ type paths = {
2573
2883
  "application/json": components["schemas"]["CASErrorResponse"];
2574
2884
  };
2575
2885
  };
2886
+ /** @description File too large (max 500 MB) */
2887
+ 413: {
2888
+ headers: {
2889
+ [name: string]: unknown;
2890
+ };
2891
+ content: {
2892
+ "application/json": components["schemas"]["ValidationErrorResponse"];
2893
+ };
2894
+ };
2895
+ /** @description Internal Server Error */
2896
+ 500: {
2897
+ headers: {
2898
+ [name: string]: unknown;
2899
+ };
2900
+ content: {
2901
+ /**
2902
+ * @example {
2903
+ * "error": "Internal server error"
2904
+ * }
2905
+ */
2906
+ "application/json": components["schemas"]["ErrorResponse"];
2907
+ };
2908
+ };
2576
2909
  };
2577
2910
  };
2578
2911
  delete?: never;
@@ -2581,7 +2914,7 @@ type paths = {
2581
2914
  patch?: never;
2582
2915
  trace?: never;
2583
2916
  };
2584
- "/files/{id}/confirm-upload": {
2917
+ "/files/{id}/reupload": {
2585
2918
  parameters: {
2586
2919
  query?: never;
2587
2920
  header?: never;
@@ -2591,20 +2924,18 @@ type paths = {
2591
2924
  get?: never;
2592
2925
  put?: never;
2593
2926
  /**
2594
- * Confirm upload completed
2595
- * @description Confirms that file content has been uploaded to S3.
2927
+ * Prepare for new file version
2928
+ * @description Prepares the entity for uploading a new file version.
2596
2929
  *
2597
2930
  * ## Flow
2598
- * 1. Create file entity (POST /files) - sets uploaded: false
2599
- * 2. PUT file content to the presigned upload URL
2600
- * 3. Call this endpoint to confirm - verifies file exists in S3, sets uploaded: true
2601
- *
2602
- * ## Verification
2603
- * The server verifies the file exists in S3 before setting uploaded: true.
2604
- * If the file doesn't exist, returns 400 error.
2931
+ * 1. Call this endpoint with new key and file metadata
2932
+ * 2. Receive updated entity (uploaded: false)
2933
+ * 3. POST the new file content to /{id}/content
2934
+ * 4. Entity will be updated with uploaded: true and verified CID
2605
2935
  *
2606
- * ## Idempotency
2607
- * If already uploaded: true, returns success without modification.
2936
+ * ## Key Requirement
2937
+ * The new key must NOT already exist in R2 (no overwrites).
2938
+ * Previous file versions remain accessible via manifest history.
2608
2939
  */
2609
2940
  post: {
2610
2941
  parameters: {
@@ -2618,17 +2949,17 @@ type paths = {
2618
2949
  };
2619
2950
  requestBody?: {
2620
2951
  content: {
2621
- "application/json": components["schemas"]["ConfirmUploadRequest"];
2952
+ "application/json": components["schemas"]["ReuploadFileRequest"];
2622
2953
  };
2623
2954
  };
2624
2955
  responses: {
2625
- /** @description Upload confirmed */
2956
+ /** @description Ready for new file version upload */
2626
2957
  200: {
2627
2958
  headers: {
2628
2959
  [name: string]: unknown;
2629
2960
  };
2630
2961
  content: {
2631
- "application/json": components["schemas"]["ConfirmUploadResponse"];
2962
+ "application/json": components["schemas"]["ReuploadFileResponse"];
2632
2963
  };
2633
2964
  };
2634
2965
  /** @description Bad Request - Invalid input */
@@ -4601,25 +4932,31 @@ type paths = {
4601
4932
  cookie?: never;
4602
4933
  };
4603
4934
  /**
4604
- * List events
4605
- * @description Returns entity change events in reverse chronological order (newest first).
4935
+ * List entity change events
4936
+ * @description Returns a cursor-based list of entity change events for client synchronization.
4606
4937
  *
4607
- * Each event represents a create or update operation on an entity. Use cursor-based pagination to walk through the event history.
4938
+ * **Usage:**
4939
+ * - Start with `?after=0` to get all events
4940
+ * - Use the returned `cursor` as `?after=` for the next page
4941
+ * - Poll periodically (e.g., every 10s) to stay in sync
4608
4942
  *
4609
- * **Use cases:**
4610
- * - Syncing entity changes to external systems
4611
- * - Building search indexes
4612
- * - Change tracking and audit logs
4943
+ * **Event data:**
4944
+ * - `id`: Auto-increment ID (use as cursor)
4945
+ * - `pi`: Entity ID that changed
4946
+ * - `cid`: New manifest CID
4947
+ * - `ts`: ISO timestamp
4613
4948
  *
4614
- * **Note:** This endpoint is public. Access control is enforced at the entity level - if you don't have permission to view an entity, you won't be able to fetch its manifest even if you see an event for it.
4949
+ * Events are ephemeral (30-day rolling window) - for full sync, use snapshots.
4615
4950
  */
4616
4951
  get: {
4617
4952
  parameters: {
4618
4953
  query?: {
4619
- /** @description Maximum events to return (1-100, default 50) */
4954
+ /** @description Return events with id > after (cursor for pagination) */
4955
+ after?: number | null;
4956
+ /** @description Maximum number of events to return (default: 100, max: 1000) */
4620
4957
  limit?: number;
4621
- /** @description Event CID to continue from (for pagination) */
4622
- cursor?: string;
4958
+ /** @description Network to query (default: main) */
4959
+ network?: "main" | "test";
4623
4960
  };
4624
4961
  header?: never;
4625
4962
  path?: never;
@@ -4627,7 +4964,7 @@ type paths = {
4627
4964
  };
4628
4965
  requestBody?: never;
4629
4966
  responses: {
4630
- /** @description Event list */
4967
+ /** @description Events list */
4631
4968
  200: {
4632
4969
  headers: {
4633
4970
  [name: string]: unknown;
@@ -5447,6 +5784,83 @@ type components = {
5447
5784
  peer?: string;
5448
5785
  }[];
5449
5786
  };
5787
+ EntityDeletedResponse: {
5788
+ /**
5789
+ * @description Entity ID (ULID format)
5790
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
5791
+ */
5792
+ id: string;
5793
+ /**
5794
+ * @description IPFS Content Identifier (CID)
5795
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5796
+ */
5797
+ cid: string;
5798
+ /**
5799
+ * Format: date-time
5800
+ * @description ISO timestamp when the entity was deleted
5801
+ */
5802
+ deleted_at: string;
5803
+ /**
5804
+ * @description Entity version number
5805
+ * @example 1
5806
+ */
5807
+ ver: number;
5808
+ /**
5809
+ * @description IPFS Content Identifier (CID)
5810
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5811
+ */
5812
+ prev_cid: string;
5813
+ };
5814
+ DeleteEntityRequest: {
5815
+ /**
5816
+ * @description Current tip CID for CAS validation. Request fails with 409 if this does not match.
5817
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5818
+ */
5819
+ expect_tip: string;
5820
+ /**
5821
+ * @description Optional note describing this change
5822
+ * @example Added Chapter 42: The Whiteness of the Whale
5823
+ */
5824
+ note?: string;
5825
+ /**
5826
+ * @description Reason for deleting the entity
5827
+ * @example Duplicate entry
5828
+ */
5829
+ reason?: string;
5830
+ };
5831
+ EntityUpdateResponse: components["schemas"]["EntityResponse"] & {
5832
+ /**
5833
+ * @description Previous version CID
5834
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5835
+ */
5836
+ prev_cid: string;
5837
+ };
5838
+ EntityRestoredResponse: components["schemas"]["EntityUpdateResponse"] & {
5839
+ /**
5840
+ * @description The version number that was restored from
5841
+ * @example 1
5842
+ */
5843
+ restored_from_ver: number;
5844
+ };
5845
+ RestoreEntityRequest: {
5846
+ /**
5847
+ * @description Current tip CID for CAS validation. Request fails with 409 if this does not match.
5848
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5849
+ */
5850
+ expect_tip: string;
5851
+ /**
5852
+ * @description Optional note describing this change
5853
+ * @example Added Chapter 42: The Whiteness of the Whale
5854
+ */
5855
+ note?: string;
5856
+ };
5857
+ EntityCollectionResponse: {
5858
+ /**
5859
+ * @description The collection ID this entity belongs to, or null if not in any collection
5860
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
5861
+ */
5862
+ collection_id: string | null;
5863
+ };
5450
5864
  AddRelationshipResponse: {
5451
5865
  source: components["schemas"]["EntityResponse"] & unknown;
5452
5866
  target?: components["schemas"]["EntityResponse"] & unknown;
@@ -5576,22 +5990,10 @@ type components = {
5576
5990
  * @example 1735214400000
5577
5991
  */
5578
5992
  ts: number;
5579
- /**
5580
- * Format: uri
5581
- * @description Presigned S3 URL for uploading file content
5582
- * @example https://arke-blocks.s3.amazonaws.com/01JFILE123.../v1?X-Amz-...
5583
- */
5584
- upload_url: string;
5585
- /**
5586
- * Format: date-time
5587
- * @description When the upload URL expires (15 minutes)
5588
- * @example 2025-12-26T12:00:00.000Z
5589
- */
5590
- upload_expires_at: string;
5591
5993
  };
5592
5994
  CreateFileRequest: {
5593
5995
  /**
5594
- * @description Storage key in S3. Best practice: use the CID.
5996
+ * @description Storage key in R2. Best practice: use the CID.
5595
5997
  * @example bafkreiabc123...
5596
5998
  */
5597
5999
  key: string;
@@ -5606,15 +6008,10 @@ type components = {
5606
6008
  */
5607
6009
  content_type: string;
5608
6010
  /**
5609
- * @description File size in bytes
6011
+ * @description Expected file size in bytes (verified on upload)
5610
6012
  * @example 1048576
5611
6013
  */
5612
6014
  size: number;
5613
- /**
5614
- * @description Content identifier (CID). Not verified, just metadata.
5615
- * @example bafkreiabc123...
5616
- */
5617
- cid?: string;
5618
6015
  /**
5619
6016
  * @description Description of the file
5620
6017
  * @example Q4 Financial Report
@@ -5650,34 +6047,14 @@ type components = {
5650
6047
  /** @enum {string} */
5651
6048
  type?: "file";
5652
6049
  };
5653
- DownloadResponse: {
5654
- /**
5655
- * Format: uri
5656
- * @description Presigned S3 URL for downloading file content
5657
- * @example https://arke-blocks.s3.amazonaws.com/01JFILE123.../v1?X-Amz-...
5658
- */
5659
- download_url: string;
5660
- /**
5661
- * Format: date-time
5662
- * @description When the download URL expires (5 minutes)
5663
- * @example 2025-12-26T12:00:00.000Z
5664
- */
5665
- expires_at: string;
5666
- /**
5667
- * @description Filename for download
5668
- * @example document.pdf
5669
- */
5670
- filename: string;
5671
- /**
5672
- * @description MIME type of the file
5673
- * @example application/pdf
5674
- */
5675
- content_type: string;
6050
+ UploadContentResponse: components["schemas"]["EntityResponse"] & {
6051
+ /** @enum {string} */
6052
+ type?: "file";
5676
6053
  /**
5677
- * @description File size in bytes
5678
- * @example 1048576
6054
+ * @description Previous version CID
6055
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5679
6056
  */
5680
- size: number;
6057
+ prev_cid: string;
5681
6058
  };
5682
6059
  UpdateFileResponse: components["schemas"]["FileResponse"] & {
5683
6060
  /**
@@ -5754,7 +6131,7 @@ type components = {
5754
6131
  */
5755
6132
  peer?: string;
5756
6133
  }[];
5757
- /** @description New storage key. Must already exist in S3 (for regression to old version). */
6134
+ /** @description New storage key. Must already exist in R2 (for regression to old version). */
5758
6135
  key?: string;
5759
6136
  /** @description New filename */
5760
6137
  filename?: string;
@@ -5762,23 +6139,15 @@ type components = {
5762
6139
  content_type?: string;
5763
6140
  /** @description New file size in bytes */
5764
6141
  size?: number;
5765
- /** @description New content identifier */
5766
- cid?: string;
5767
6142
  /** @description New description */
5768
6143
  description?: string;
5769
6144
  };
5770
- ReuploadFileResponse: components["schemas"]["UpdateFileResponse"] & {
5771
- /**
5772
- * Format: uri
5773
- * @description Presigned S3 URL for uploading new file content
5774
- */
5775
- upload_url: string;
6145
+ ReuploadFileResponse: components["schemas"]["FileResponse"] & {
5776
6146
  /**
5777
- * Format: date-time
5778
- * @description When the upload URL expires (15 minutes)
5779
- * @example 2025-12-26T12:00:00.000Z
6147
+ * @description Previous version CID
6148
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5780
6149
  */
5781
- upload_expires_at: string;
6150
+ prev_cid: string;
5782
6151
  };
5783
6152
  ReuploadFileRequest: {
5784
6153
  /**
@@ -5792,7 +6161,7 @@ type components = {
5792
6161
  */
5793
6162
  note?: string;
5794
6163
  /**
5795
- * @description New storage key. Must NOT already exist in S3.
6164
+ * @description New storage key. Must NOT already exist in R2.
5796
6165
  * @example v2
5797
6166
  */
5798
6167
  key: string;
@@ -5802,41 +6171,15 @@ type components = {
5802
6171
  */
5803
6172
  content_type: string;
5804
6173
  /**
5805
- * @description Size of the new file in bytes
6174
+ * @description Expected size of the new file in bytes (verified on upload)
5806
6175
  * @example 2097152
5807
6176
  */
5808
6177
  size: number;
5809
6178
  /** @description New filename (optional, keeps current if not provided) */
5810
6179
  filename?: string;
5811
- /** @description Content identifier for new file */
5812
- cid?: string;
5813
6180
  /** @description New description */
5814
6181
  description?: string;
5815
6182
  };
5816
- ConfirmUploadResponse: components["schemas"]["FileResponse"] & {
5817
- /**
5818
- * @description Previous version CID. Not present if upload was already confirmed.
5819
- * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5820
- */
5821
- prev_cid?: string;
5822
- /**
5823
- * @description True if upload was already confirmed. Entity was not modified.
5824
- * @example false
5825
- */
5826
- already_confirmed: boolean;
5827
- };
5828
- ConfirmUploadRequest: {
5829
- /**
5830
- * @description Current tip CID for CAS validation. Request fails with 409 if this does not match.
5831
- * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5832
- */
5833
- expect_tip: string;
5834
- /**
5835
- * @description Optional note describing this change
5836
- * @example Added Chapter 42: The Whiteness of the Whale
5837
- */
5838
- note?: string;
5839
- };
5840
6183
  CreateFolderResponse: {
5841
6184
  /**
5842
6185
  * @description Entity ID (ULID format)
@@ -6727,60 +7070,41 @@ type components = {
6727
7070
  ListAgentApiKeysResponse: {
6728
7071
  keys: components["schemas"]["AgentApiKeyInfo"][];
6729
7072
  };
6730
- EventItem: {
7073
+ Event: {
6731
7074
  /**
6732
- * @description CID of this event in the event chain
6733
- * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
7075
+ * @description Auto-increment event ID (use as cursor)
7076
+ * @example 12346
6734
7077
  */
6735
- event_cid: string;
7078
+ id: number;
6736
7079
  /**
6737
- * @description Type of entity change event
6738
- * @example create
6739
- * @enum {string}
6740
- */
6741
- type: "create" | "update";
6742
- /**
6743
- * @description Entity ID that was created or updated
7080
+ * @description Entity ID that changed
6744
7081
  * @example 01KDETYWYWM0MJVKM8DK3AEXPY
6745
7082
  */
6746
7083
  pi: string;
6747
7084
  /**
6748
- * @description Entity version number
6749
- * @example 1
6750
- */
6751
- ver: number;
6752
- /**
6753
- * @description CID of the entity manifest at this version
7085
+ * @description New manifest CID
6754
7086
  * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
6755
7087
  */
6756
- tip_cid: string;
7088
+ cid: string;
6757
7089
  /**
6758
- * Format: date-time
6759
- * @description When the event was recorded
6760
- * @example 2025-12-26T12:00:00.000Z
7090
+ * @description ISO timestamp of the event
7091
+ * @example 2025-01-15T12:00:01Z
6761
7092
  */
6762
7093
  ts: string;
6763
7094
  };
6764
7095
  EventsListResponse: {
6765
- /** @description Events in reverse chronological order */
6766
- items: components["schemas"]["EventItem"][];
6767
- /**
6768
- * @description Total events in the event chain
6769
- * @example 1542
6770
- */
6771
- total_events: number;
7096
+ /** @description List of events */
7097
+ events: components["schemas"]["Event"][];
6772
7098
  /**
6773
- * @description Total unique entity IDs across all events
6774
- * @example 987
7099
+ * @description Whether there are more events available
7100
+ * @example true
6775
7101
  */
6776
- total_pis: number;
6777
- /** @description Whether more events exist beyond this page */
6778
7102
  has_more: boolean;
6779
7103
  /**
6780
- * @description CID to use as "cursor" parameter for next page
6781
- * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
7104
+ * @description Cursor for the next page (pass as ?after= parameter)
7105
+ * @example 12347
6782
7106
  */
6783
- next_cursor: string | null;
7107
+ cursor: number;
6784
7108
  };
6785
7109
  };
6786
7110
  responses: never;