@withmarfa/client 0.0.77 → 0.0.78

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +262 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -240,6 +240,26 @@ interface paths {
240
240
  patch?: never;
241
241
  trace?: never;
242
242
  };
243
+ "/items/counts": {
244
+ parameters: {
245
+ query?: never;
246
+ header?: never;
247
+ path?: never;
248
+ cookie?: never;
249
+ };
250
+ get?: never;
251
+ put?: never;
252
+ /**
253
+ * Count linked items and rows
254
+ * @description Returns, for each of up to 100 items, how many active items an edge type links to it, by status group, or how many rows it holds in one table. Name exactly one of `backref`, `edge` and `table`.
255
+ */
256
+ post: operations["countItemLinks"];
257
+ delete?: never;
258
+ options?: never;
259
+ head?: never;
260
+ patch?: never;
261
+ trace?: never;
262
+ };
243
263
  "/items/bulk": {
244
264
  parameters: {
245
265
  query?: never;
@@ -11646,6 +11666,248 @@ interface operations {
11646
11666
  };
11647
11667
  };
11648
11668
  };
11669
+ countItemLinks: {
11670
+ parameters: {
11671
+ query?: never;
11672
+ header?: {
11673
+ /** @description The ID of the instance you expect, as `GET /` returns it. If another instance answers at this address, Marfa returns `409 instance_changed` and doesn't write. Leave it out to send the request to whichever instance answers. */
11674
+ "X-Marfa-Instance-Id"?: string;
11675
+ };
11676
+ path?: never;
11677
+ cookie?: never;
11678
+ };
11679
+ requestBody: {
11680
+ content: {
11681
+ "application/json": {
11682
+ /**
11683
+ * @description The IDs of the items to count for, at most 100. An ID named twice is answered once.
11684
+ * @example [
11685
+ * "01a1011a-4902-76cf-a4a9-88e99c038c8d",
11686
+ * "01a1011c-2f86-76b6-9594-050c109f4957"
11687
+ * ]
11688
+ */
11689
+ ids: string[];
11690
+ /**
11691
+ * @description An edge type. Counts the active items that edges of this type leave each item for, as `backref[<edge type>]` selects them: `parent-of` counts children.
11692
+ * @example parent-of
11693
+ */
11694
+ backref?: string;
11695
+ /**
11696
+ * @description An edge type. Counts the active items that have an edge of this type to each item, as `edge[<edge type>]` selects them: `in-collection` counts a collection's members.
11697
+ * @example in-collection
11698
+ */
11699
+ edge?: string;
11700
+ /**
11701
+ * @description A table name. Counts the rows each item holds in that table. An item whose type declares no such table counts 0.
11702
+ * @example messages
11703
+ */
11704
+ table?: string;
11705
+ };
11706
+ };
11707
+ };
11708
+ responses: {
11709
+ /** @description Returns one count for each ID, in the order `ids` named them. */
11710
+ 200: {
11711
+ headers: {
11712
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11713
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11714
+ [name: string]: unknown;
11715
+ };
11716
+ content: {
11717
+ /**
11718
+ * @example {
11719
+ * "counts": [
11720
+ * {
11721
+ * "id": "01a1011a-4902-76cf-a4a9-88e99c038c8d",
11722
+ * "total": 7,
11723
+ * "status_groups": {
11724
+ * "not_started": 2,
11725
+ * "in_progress": 1,
11726
+ * "completed": 3,
11727
+ * "canceled": 1
11728
+ * }
11729
+ * },
11730
+ * {
11731
+ * "id": "01a1011c-2f86-76b6-9594-050c109f4957",
11732
+ * "total": 0,
11733
+ * "status_groups": {
11734
+ * "not_started": 0,
11735
+ * "in_progress": 0,
11736
+ * "completed": 0,
11737
+ * "canceled": 0
11738
+ * }
11739
+ * }
11740
+ * ]
11741
+ * }
11742
+ */
11743
+ "application/json": {
11744
+ /** @description The counts, in the order `ids` named them, each ID once. */
11745
+ counts: {
11746
+ /**
11747
+ * @description The ID of the item counted for.
11748
+ * @example 01a1011a-4902-76cf-a4a9-88e99c038c8d
11749
+ */
11750
+ id: string;
11751
+ /** @description How many items, or rows, the item links to or holds. 0 for an item that doesn't exist or that you can't read. */
11752
+ total: number;
11753
+ /** @description How many of the counted items are in each status group. Items with no status, or a status word their type doesn't declare, are in none. Absent for a table's rows. */
11754
+ status_groups?: {
11755
+ /** @description Items in the `not_started` group. */
11756
+ not_started: number;
11757
+ /** @description Items in the `in_progress` group. */
11758
+ in_progress: number;
11759
+ /** @description Items in the `completed` group. */
11760
+ completed: number;
11761
+ /** @description Items in the `canceled` group. */
11762
+ canceled: number;
11763
+ };
11764
+ }[];
11765
+ };
11766
+ };
11767
+ };
11768
+ /**
11769
+ * @description - `missing_required_field`: `ids` is missing.
11770
+ * - `validation_error`: `ids` is not a list or has more than 100 IDs, none or more than one of `backref`, `edge` and `table` is named, an edge type or a table name is blank or malformed, or the body has a field this endpoint doesn't take.
11771
+ * - `invalid_id`: an ID in `ids` is not a valid item ID.
11772
+ */
11773
+ 400: {
11774
+ headers: {
11775
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11776
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11777
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11778
+ [name: string]: unknown;
11779
+ };
11780
+ content: {
11781
+ "application/json": components["schemas"]["InvalidIdOrMissingRequiredFieldOrValidationErrorRefusal"];
11782
+ };
11783
+ };
11784
+ /** @description `unauthorized`: the request has no credential, or its credential is not valid. For a key that has expired, `details.expired_at` says when it expired. */
11785
+ 401: {
11786
+ headers: {
11787
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11788
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11789
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11790
+ [name: string]: unknown;
11791
+ };
11792
+ content: {
11793
+ "application/json": components["schemas"]["UnauthorizedRefusal"];
11794
+ };
11795
+ };
11796
+ /**
11797
+ * @description - `type_not_permitted`: your credential reaches no type. If it reaches some types, items of the others are left out instead.
11798
+ * - `edge_type_not_permitted`: you can't read the edge type.
11799
+ */
11800
+ 403: {
11801
+ headers: {
11802
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11803
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11804
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11805
+ [name: string]: unknown;
11806
+ };
11807
+ content: {
11808
+ "application/json": components["schemas"]["EdgePermissionDeniedOrTypeNotPermittedRefusal"];
11809
+ };
11810
+ };
11811
+ /** @description `request_timeout`: the request body didn't arrive whole within 180 seconds. Nothing changed, and Marfa closed the connection. Send the request again. A body larger than about 21 MiB can't arrive in that time over a 1 Mbit/s link, so send it in smaller requests. */
11812
+ 408: {
11813
+ headers: {
11814
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11815
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11816
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11817
+ [name: string]: unknown;
11818
+ };
11819
+ content: {
11820
+ "application/json": components["schemas"]["RequestTimeoutRefusal"];
11821
+ };
11822
+ };
11823
+ /** @description `instance_changed`: `X-Marfa-Instance-Id` names another instance. Nothing is written. Rebuild the working copy from the instance at this address. */
11824
+ 409: {
11825
+ headers: {
11826
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11827
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11828
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11829
+ [name: string]: unknown;
11830
+ };
11831
+ content: {
11832
+ "application/json": components["schemas"]["InstanceChangedRefusal"];
11833
+ };
11834
+ };
11835
+ /** @description `contract_mismatch`: `X-Marfa-Contract` names another contract version than this instance speaks, or is not a whole number. Nothing was done. */
11836
+ 412: {
11837
+ headers: {
11838
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11839
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11840
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11841
+ [name: string]: unknown;
11842
+ };
11843
+ content: {
11844
+ "application/json": components["schemas"]["ContractMismatchRefusal"];
11845
+ };
11846
+ };
11847
+ /** @description `request_too_large`: the request body is larger than this instance accepts. */
11848
+ 413: {
11849
+ headers: {
11850
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11851
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11852
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11853
+ [name: string]: unknown;
11854
+ };
11855
+ content: {
11856
+ "application/json": components["schemas"]["RequestTooLargeRefusal"];
11857
+ };
11858
+ };
11859
+ /** @description `rate_limited`: you sent too many requests. Wait for the number of seconds in `Retry-After`, then try again. */
11860
+ 429: {
11861
+ headers: {
11862
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11863
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11864
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11865
+ "Retry-After": components["headers"]["Retry-After"];
11866
+ [name: string]: unknown;
11867
+ };
11868
+ content: {
11869
+ "application/json": components["schemas"]["RateLimitedRefusal"];
11870
+ };
11871
+ };
11872
+ /** @description `internal_error`: Marfa failed in a way it didn't expect, and the request may not have completed. Read what you changed before you repeat a write. */
11873
+ 500: {
11874
+ headers: {
11875
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11876
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11877
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11878
+ [name: string]: unknown;
11879
+ };
11880
+ content: {
11881
+ "application/json": components["schemas"]["InternalErrorRefusal"];
11882
+ };
11883
+ };
11884
+ /** @description `write_contention`: the database was busy, and Marfa couldn't complete the request in time. Nothing changed. Try the request again. While a restore runs, `details.reason` is `restore_running`. */
11885
+ 503: {
11886
+ headers: {
11887
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11888
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11889
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11890
+ "Retry-After": components["headers"]["Retry-After"];
11891
+ [name: string]: unknown;
11892
+ };
11893
+ content: {
11894
+ "application/json": components["schemas"]["WriteContentionRefusal"];
11895
+ };
11896
+ };
11897
+ /** @description `insufficient_storage`: the disk that holds the instance's data has no room for the request, or the request would leave less free than the instance keeps in reserve. Nothing changed, unless `details.write_outcome` is `unknown`, which means the write may have landed: read what you changed before you repeat it. Free space on the disk, then try the request again. */
11898
+ 507: {
11899
+ headers: {
11900
+ "X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
11901
+ "X-Request-ID": components["headers"]["X-Request-ID"];
11902
+ "X-Error-Code": components["headers"]["X-Error-Code"];
11903
+ [name: string]: unknown;
11904
+ };
11905
+ content: {
11906
+ "application/json": components["schemas"]["InsufficientStorageRefusal"];
11907
+ };
11908
+ };
11909
+ };
11910
+ };
11649
11911
  bulkUpsertItems: {
11650
11912
  parameters: {
11651
11913
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withmarfa/client",
3
- "version": "0.0.77",
3
+ "version": "0.0.78",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",