@arke-institute/sdk 2.3.0 → 2.3.1

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-04T14:33:00.781Z
10
10
  */
11
11
  type paths = {
12
12
  "/auth/register": {
@@ -1790,6 +1790,252 @@ 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
+ };
1793
2039
  delete?: never;
1794
2040
  options?: never;
1795
2041
  head?: never;
@@ -2065,17 +2311,17 @@ type paths = {
2065
2311
  put?: never;
2066
2312
  /**
2067
2313
  * Create file entity
2068
- * @description Creates a new file entity and returns a presigned upload URL.
2314
+ * @description Creates a new file entity.
2069
2315
  *
2070
2316
  * ## Flow
2071
2317
  * 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
2318
+ * 2. Receive entity data (uploaded: false)
2319
+ * 3. POST the file content to /{id}/content
2320
+ * 4. Entity will be updated with uploaded: true and verified CID
2075
2321
  *
2076
2322
  * ## 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.
2323
+ * Use a unique identifier as the key (e.g., version number, timestamp).
2324
+ * The actual CID is computed during upload.
2079
2325
  */
2080
2326
  post: {
2081
2327
  parameters: {
@@ -2187,7 +2433,7 @@ type paths = {
2187
2433
  };
2188
2434
  /**
2189
2435
  * Get file metadata
2190
- * @description Returns file entity metadata. Use /download to get the file content.
2436
+ * @description Returns file entity metadata. Use /{id}/content to download the file content.
2191
2437
  */
2192
2438
  get: {
2193
2439
  parameters: {
@@ -2245,7 +2491,7 @@ type paths = {
2245
2491
  * @description Updates file metadata without changing the file content.
2246
2492
  *
2247
2493
  * ## Key Changes
2248
- * The key can be changed, but ONLY to a key that already exists in S3.
2494
+ * The key can be changed, but ONLY to a key that already exists in R2.
2249
2495
  * This allows "regressing" to a previous file version.
2250
2496
  *
2251
2497
  * To upload a new file, use POST /{id}/reupload instead.
@@ -2369,7 +2615,7 @@ type paths = {
2369
2615
  patch?: never;
2370
2616
  trace?: never;
2371
2617
  };
2372
- "/files/{id}/download": {
2618
+ "/files/{id}/content": {
2373
2619
  parameters: {
2374
2620
  query?: never;
2375
2621
  header?: never;
@@ -2377,8 +2623,16 @@ type paths = {
2377
2623
  cookie?: never;
2378
2624
  };
2379
2625
  /**
2380
- * Get download URL
2381
- * @description Returns a presigned URL for downloading the file content. URL expires in 5 minutes.
2626
+ * Download file content
2627
+ * @description Downloads the binary content of a file entity.
2628
+ *
2629
+ * ## Response Headers
2630
+ * - Content-Type: The MIME type of the file
2631
+ * - Content-Length: File size in bytes
2632
+ * - Content-Disposition: attachment; filename="original_filename"
2633
+ *
2634
+ * ## Streaming
2635
+ * Response is streamed directly from R2 storage.
2382
2636
  */
2383
2637
  get: {
2384
2638
  parameters: {
@@ -2392,13 +2646,13 @@ type paths = {
2392
2646
  };
2393
2647
  requestBody?: never;
2394
2648
  responses: {
2395
- /** @description Download URL generated */
2649
+ /** @description File content */
2396
2650
  200: {
2397
2651
  headers: {
2398
2652
  [name: string]: unknown;
2399
2653
  };
2400
2654
  content: {
2401
- "application/json": components["schemas"]["DownloadResponse"];
2655
+ "application/octet-stream": string;
2402
2656
  };
2403
2657
  };
2404
2658
  /** @description Forbidden - Insufficient permissions */
@@ -2432,36 +2686,26 @@ type paths = {
2432
2686
  };
2433
2687
  };
2434
2688
  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
2689
  /**
2452
- * Upload new file version
2453
- * @description Uploads a new version of a file.
2690
+ * Upload file content
2691
+ * @description Uploads the binary content for a file entity.
2454
2692
  *
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
2693
+ * ## Request
2694
+ * - Content-Type: The MIME type of the file (must match entity's content_type)
2695
+ * - Body: Binary file content (streaming supported)
2461
2696
  *
2462
- * ## Key Requirement
2463
- * The new key must NOT already exist in S3 (no overwrites).
2464
- * Previous file versions are preserved.
2697
+ * ## Limits
2698
+ * - Maximum file size: 500 MB
2699
+ *
2700
+ * ## Behavior
2701
+ * - Streams content directly to R2
2702
+ * - Computes CID from file bytes
2703
+ * - Updates entity with uploaded: true, verified size, and computed CID
2704
+ * - Atomic operation - either fully succeeds or fails
2705
+ *
2706
+ * ## Idempotency
2707
+ * Re-uploading content for an already-uploaded file will fail with 409 Conflict.
2708
+ * Use POST /{id}/reupload first to create a new version.
2465
2709
  */
2466
2710
  post: {
2467
2711
  parameters: {
@@ -2473,19 +2717,15 @@ type paths = {
2473
2717
  };
2474
2718
  cookie?: never;
2475
2719
  };
2476
- requestBody?: {
2477
- content: {
2478
- "application/json": components["schemas"]["ReuploadFileRequest"];
2479
- };
2480
- };
2720
+ requestBody?: never;
2481
2721
  responses: {
2482
- /** @description File version created */
2722
+ /** @description File content uploaded */
2483
2723
  200: {
2484
2724
  headers: {
2485
2725
  [name: string]: unknown;
2486
2726
  };
2487
2727
  content: {
2488
- "application/json": components["schemas"]["ReuploadFileResponse"];
2728
+ "application/json": components["schemas"]["UploadContentResponse"];
2489
2729
  };
2490
2730
  };
2491
2731
  /** @description Bad Request - Invalid input */
@@ -2573,6 +2813,29 @@ type paths = {
2573
2813
  "application/json": components["schemas"]["CASErrorResponse"];
2574
2814
  };
2575
2815
  };
2816
+ /** @description File too large (max 500 MB) */
2817
+ 413: {
2818
+ headers: {
2819
+ [name: string]: unknown;
2820
+ };
2821
+ content: {
2822
+ "application/json": components["schemas"]["ValidationErrorResponse"];
2823
+ };
2824
+ };
2825
+ /** @description Internal Server Error */
2826
+ 500: {
2827
+ headers: {
2828
+ [name: string]: unknown;
2829
+ };
2830
+ content: {
2831
+ /**
2832
+ * @example {
2833
+ * "error": "Internal server error"
2834
+ * }
2835
+ */
2836
+ "application/json": components["schemas"]["ErrorResponse"];
2837
+ };
2838
+ };
2576
2839
  };
2577
2840
  };
2578
2841
  delete?: never;
@@ -2581,7 +2844,7 @@ type paths = {
2581
2844
  patch?: never;
2582
2845
  trace?: never;
2583
2846
  };
2584
- "/files/{id}/confirm-upload": {
2847
+ "/files/{id}/reupload": {
2585
2848
  parameters: {
2586
2849
  query?: never;
2587
2850
  header?: never;
@@ -2591,20 +2854,18 @@ type paths = {
2591
2854
  get?: never;
2592
2855
  put?: never;
2593
2856
  /**
2594
- * Confirm upload completed
2595
- * @description Confirms that file content has been uploaded to S3.
2857
+ * Prepare for new file version
2858
+ * @description Prepares the entity for uploading a new file version.
2596
2859
  *
2597
2860
  * ## 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.
2861
+ * 1. Call this endpoint with new key and file metadata
2862
+ * 2. Receive updated entity (uploaded: false)
2863
+ * 3. POST the new file content to /{id}/content
2864
+ * 4. Entity will be updated with uploaded: true and verified CID
2605
2865
  *
2606
- * ## Idempotency
2607
- * If already uploaded: true, returns success without modification.
2866
+ * ## Key Requirement
2867
+ * The new key must NOT already exist in R2 (no overwrites).
2868
+ * Previous file versions remain accessible via manifest history.
2608
2869
  */
2609
2870
  post: {
2610
2871
  parameters: {
@@ -2618,17 +2879,17 @@ type paths = {
2618
2879
  };
2619
2880
  requestBody?: {
2620
2881
  content: {
2621
- "application/json": components["schemas"]["ConfirmUploadRequest"];
2882
+ "application/json": components["schemas"]["ReuploadFileRequest"];
2622
2883
  };
2623
2884
  };
2624
2885
  responses: {
2625
- /** @description Upload confirmed */
2886
+ /** @description Ready for new file version upload */
2626
2887
  200: {
2627
2888
  headers: {
2628
2889
  [name: string]: unknown;
2629
2890
  };
2630
2891
  content: {
2631
- "application/json": components["schemas"]["ConfirmUploadResponse"];
2892
+ "application/json": components["schemas"]["ReuploadFileResponse"];
2632
2893
  };
2633
2894
  };
2634
2895
  /** @description Bad Request - Invalid input */
@@ -4601,25 +4862,31 @@ type paths = {
4601
4862
  cookie?: never;
4602
4863
  };
4603
4864
  /**
4604
- * List events
4605
- * @description Returns entity change events in reverse chronological order (newest first).
4865
+ * List entity change events
4866
+ * @description Returns a cursor-based list of entity change events for client synchronization.
4606
4867
  *
4607
- * Each event represents a create or update operation on an entity. Use cursor-based pagination to walk through the event history.
4868
+ * **Usage:**
4869
+ * - Start with `?after=0` to get all events
4870
+ * - Use the returned `cursor` as `?after=` for the next page
4871
+ * - Poll periodically (e.g., every 10s) to stay in sync
4608
4872
  *
4609
- * **Use cases:**
4610
- * - Syncing entity changes to external systems
4611
- * - Building search indexes
4612
- * - Change tracking and audit logs
4873
+ * **Event data:**
4874
+ * - `id`: Auto-increment ID (use as cursor)
4875
+ * - `pi`: Entity ID that changed
4876
+ * - `cid`: New manifest CID
4877
+ * - `ts`: ISO timestamp
4613
4878
  *
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.
4879
+ * Events are ephemeral (30-day rolling window) - for full sync, use snapshots.
4615
4880
  */
4616
4881
  get: {
4617
4882
  parameters: {
4618
4883
  query?: {
4619
- /** @description Maximum events to return (1-100, default 50) */
4884
+ /** @description Return events with id > after (cursor for pagination) */
4885
+ after?: number | null;
4886
+ /** @description Maximum number of events to return (default: 100, max: 1000) */
4620
4887
  limit?: number;
4621
- /** @description Event CID to continue from (for pagination) */
4622
- cursor?: string;
4888
+ /** @description Network to query (default: main) */
4889
+ network?: "main" | "test";
4623
4890
  };
4624
4891
  header?: never;
4625
4892
  path?: never;
@@ -4627,7 +4894,7 @@ type paths = {
4627
4894
  };
4628
4895
  requestBody?: never;
4629
4896
  responses: {
4630
- /** @description Event list */
4897
+ /** @description Events list */
4631
4898
  200: {
4632
4899
  headers: {
4633
4900
  [name: string]: unknown;
@@ -5447,6 +5714,76 @@ type components = {
5447
5714
  peer?: string;
5448
5715
  }[];
5449
5716
  };
5717
+ EntityDeletedResponse: {
5718
+ /**
5719
+ * @description Entity ID (ULID format)
5720
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
5721
+ */
5722
+ id: string;
5723
+ /**
5724
+ * @description IPFS Content Identifier (CID)
5725
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5726
+ */
5727
+ cid: string;
5728
+ /**
5729
+ * Format: date-time
5730
+ * @description ISO timestamp when the entity was deleted
5731
+ */
5732
+ deleted_at: string;
5733
+ /**
5734
+ * @description Entity version number
5735
+ * @example 1
5736
+ */
5737
+ ver: number;
5738
+ /**
5739
+ * @description IPFS Content Identifier (CID)
5740
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5741
+ */
5742
+ prev_cid: string;
5743
+ };
5744
+ DeleteEntityRequest: {
5745
+ /**
5746
+ * @description Current tip CID for CAS validation. Request fails with 409 if this does not match.
5747
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5748
+ */
5749
+ expect_tip: string;
5750
+ /**
5751
+ * @description Optional note describing this change
5752
+ * @example Added Chapter 42: The Whiteness of the Whale
5753
+ */
5754
+ note?: string;
5755
+ /**
5756
+ * @description Reason for deleting the entity
5757
+ * @example Duplicate entry
5758
+ */
5759
+ reason?: string;
5760
+ };
5761
+ EntityUpdateResponse: components["schemas"]["EntityResponse"] & {
5762
+ /**
5763
+ * @description Previous version CID
5764
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5765
+ */
5766
+ prev_cid: string;
5767
+ };
5768
+ EntityRestoredResponse: components["schemas"]["EntityUpdateResponse"] & {
5769
+ /**
5770
+ * @description The version number that was restored from
5771
+ * @example 1
5772
+ */
5773
+ restored_from_ver: number;
5774
+ };
5775
+ RestoreEntityRequest: {
5776
+ /**
5777
+ * @description Current tip CID for CAS validation. Request fails with 409 if this does not match.
5778
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5779
+ */
5780
+ expect_tip: string;
5781
+ /**
5782
+ * @description Optional note describing this change
5783
+ * @example Added Chapter 42: The Whiteness of the Whale
5784
+ */
5785
+ note?: string;
5786
+ };
5450
5787
  AddRelationshipResponse: {
5451
5788
  source: components["schemas"]["EntityResponse"] & unknown;
5452
5789
  target?: components["schemas"]["EntityResponse"] & unknown;
@@ -5576,22 +5913,10 @@ type components = {
5576
5913
  * @example 1735214400000
5577
5914
  */
5578
5915
  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
5916
  };
5592
5917
  CreateFileRequest: {
5593
5918
  /**
5594
- * @description Storage key in S3. Best practice: use the CID.
5919
+ * @description Storage key in R2. Best practice: use the CID.
5595
5920
  * @example bafkreiabc123...
5596
5921
  */
5597
5922
  key: string;
@@ -5606,15 +5931,10 @@ type components = {
5606
5931
  */
5607
5932
  content_type: string;
5608
5933
  /**
5609
- * @description File size in bytes
5934
+ * @description Expected file size in bytes (verified on upload)
5610
5935
  * @example 1048576
5611
5936
  */
5612
5937
  size: number;
5613
- /**
5614
- * @description Content identifier (CID). Not verified, just metadata.
5615
- * @example bafkreiabc123...
5616
- */
5617
- cid?: string;
5618
5938
  /**
5619
5939
  * @description Description of the file
5620
5940
  * @example Q4 Financial Report
@@ -5650,34 +5970,14 @@ type components = {
5650
5970
  /** @enum {string} */
5651
5971
  type?: "file";
5652
5972
  };
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;
5973
+ UploadContentResponse: components["schemas"]["EntityResponse"] & {
5974
+ /** @enum {string} */
5975
+ type?: "file";
5676
5976
  /**
5677
- * @description File size in bytes
5678
- * @example 1048576
5977
+ * @description Previous version CID
5978
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5679
5979
  */
5680
- size: number;
5980
+ prev_cid: string;
5681
5981
  };
5682
5982
  UpdateFileResponse: components["schemas"]["FileResponse"] & {
5683
5983
  /**
@@ -5754,7 +6054,7 @@ type components = {
5754
6054
  */
5755
6055
  peer?: string;
5756
6056
  }[];
5757
- /** @description New storage key. Must already exist in S3 (for regression to old version). */
6057
+ /** @description New storage key. Must already exist in R2 (for regression to old version). */
5758
6058
  key?: string;
5759
6059
  /** @description New filename */
5760
6060
  filename?: string;
@@ -5762,23 +6062,15 @@ type components = {
5762
6062
  content_type?: string;
5763
6063
  /** @description New file size in bytes */
5764
6064
  size?: number;
5765
- /** @description New content identifier */
5766
- cid?: string;
5767
6065
  /** @description New description */
5768
6066
  description?: string;
5769
6067
  };
5770
- ReuploadFileResponse: components["schemas"]["UpdateFileResponse"] & {
6068
+ ReuploadFileResponse: components["schemas"]["FileResponse"] & {
5771
6069
  /**
5772
- * Format: uri
5773
- * @description Presigned S3 URL for uploading new file content
5774
- */
5775
- upload_url: string;
5776
- /**
5777
- * Format: date-time
5778
- * @description When the upload URL expires (15 minutes)
5779
- * @example 2025-12-26T12:00:00.000Z
6070
+ * @description Previous version CID
6071
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
5780
6072
  */
5781
- upload_expires_at: string;
6073
+ prev_cid: string;
5782
6074
  };
5783
6075
  ReuploadFileRequest: {
5784
6076
  /**
@@ -5792,7 +6084,7 @@ type components = {
5792
6084
  */
5793
6085
  note?: string;
5794
6086
  /**
5795
- * @description New storage key. Must NOT already exist in S3.
6087
+ * @description New storage key. Must NOT already exist in R2.
5796
6088
  * @example v2
5797
6089
  */
5798
6090
  key: string;
@@ -5802,41 +6094,15 @@ type components = {
5802
6094
  */
5803
6095
  content_type: string;
5804
6096
  /**
5805
- * @description Size of the new file in bytes
6097
+ * @description Expected size of the new file in bytes (verified on upload)
5806
6098
  * @example 2097152
5807
6099
  */
5808
6100
  size: number;
5809
6101
  /** @description New filename (optional, keeps current if not provided) */
5810
6102
  filename?: string;
5811
- /** @description Content identifier for new file */
5812
- cid?: string;
5813
6103
  /** @description New description */
5814
6104
  description?: string;
5815
6105
  };
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
6106
  CreateFolderResponse: {
5841
6107
  /**
5842
6108
  * @description Entity ID (ULID format)
@@ -6727,60 +6993,41 @@ type components = {
6727
6993
  ListAgentApiKeysResponse: {
6728
6994
  keys: components["schemas"]["AgentApiKeyInfo"][];
6729
6995
  };
6730
- EventItem: {
6731
- /**
6732
- * @description CID of this event in the event chain
6733
- * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
6734
- */
6735
- event_cid: string;
6996
+ Event: {
6736
6997
  /**
6737
- * @description Type of entity change event
6738
- * @example create
6739
- * @enum {string}
6998
+ * @description Auto-increment event ID (use as cursor)
6999
+ * @example 12346
6740
7000
  */
6741
- type: "create" | "update";
7001
+ id: number;
6742
7002
  /**
6743
- * @description Entity ID that was created or updated
7003
+ * @description Entity ID that changed
6744
7004
  * @example 01KDETYWYWM0MJVKM8DK3AEXPY
6745
7005
  */
6746
7006
  pi: string;
6747
7007
  /**
6748
- * @description Entity version number
6749
- * @example 1
6750
- */
6751
- ver: number;
6752
- /**
6753
- * @description CID of the entity manifest at this version
7008
+ * @description New manifest CID
6754
7009
  * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
6755
7010
  */
6756
- tip_cid: string;
7011
+ cid: string;
6757
7012
  /**
6758
- * Format: date-time
6759
- * @description When the event was recorded
6760
- * @example 2025-12-26T12:00:00.000Z
7013
+ * @description ISO timestamp of the event
7014
+ * @example 2025-01-15T12:00:01Z
6761
7015
  */
6762
7016
  ts: string;
6763
7017
  };
6764
7018
  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;
7019
+ /** @description List of events */
7020
+ events: components["schemas"]["Event"][];
6772
7021
  /**
6773
- * @description Total unique entity IDs across all events
6774
- * @example 987
7022
+ * @description Whether there are more events available
7023
+ * @example true
6775
7024
  */
6776
- total_pis: number;
6777
- /** @description Whether more events exist beyond this page */
6778
7025
  has_more: boolean;
6779
7026
  /**
6780
- * @description CID to use as "cursor" parameter for next page
6781
- * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
7027
+ * @description Cursor for the next page (pass as ?after= parameter)
7028
+ * @example 12347
6782
7029
  */
6783
- next_cursor: string | null;
7030
+ cursor: number;
6784
7031
  };
6785
7032
  };
6786
7033
  responses: never;