@withmarfa/client 0.0.5 → 0.0.6
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/README.md +1 -1
- package/dist/index.d.ts +57 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ for await (const item of everyItem) {
|
|
|
26
26
|
}
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
An operation that takes raw bytes, such as `POST /blobs`, takes them as a `Blob`, an `ArrayBuffer`, a typed array or a `ReadableStream`, sent as they are, with the `Content-Type` the caller names, else a `Blob`'s own type, else the one the operation declares: `await marfa.POST("/blobs", { body: bytes, headers: { "Content-Type": "image/png" } })`.
|
|
30
30
|
|
|
31
31
|
## The contract
|
|
32
32
|
|
package/dist/index.d.ts
CHANGED
|
@@ -259,7 +259,7 @@ interface paths {
|
|
|
259
259
|
put?: never;
|
|
260
260
|
/**
|
|
261
261
|
* Apply a bulk action
|
|
262
|
-
* @description Applies one action to every item that matches a filter: change state, purge, update tags, tier, properties or own time. It matches only items you can write. With `dry_run: true` it returns the matched IDs; otherwise it queues a job.
|
|
262
|
+
* @description Applies one action to every item that matches a filter: change state, purge, update tags, tier, properties or own time. It matches only items you can write. With `dry_run: true` it returns the matched IDs; otherwise it queues a bulk-action job.
|
|
263
263
|
*/
|
|
264
264
|
post: operations["applyBulkAction"];
|
|
265
265
|
delete?: never;
|
|
@@ -277,7 +277,7 @@ interface paths {
|
|
|
277
277
|
};
|
|
278
278
|
/**
|
|
279
279
|
* Get a bulk-action job
|
|
280
|
-
* @description Returns a bulk-action job's status and counts, and its `result` once it has finished. Only the credential that queued the job, or
|
|
280
|
+
* @description Returns a bulk-action job's status and counts, and its `result` once it has finished. Only the credential that queued the job, or the operator key, can read it.
|
|
281
281
|
*/
|
|
282
282
|
get: operations["getBulkActionJob"];
|
|
283
283
|
put?: never;
|
|
@@ -1724,7 +1724,7 @@ interface components {
|
|
|
1724
1724
|
[key: string]: unknown;
|
|
1725
1725
|
};
|
|
1726
1726
|
/**
|
|
1727
|
-
* @description How Marfa resolves a conflict on one field. `last_writer_wins` takes the later write. `keep_both_copies` keeps the losing value in a new item tagged `conflicted-copy
|
|
1727
|
+
* @description How Marfa resolves a conflict on one field. `last_writer_wins` takes the later write. `keep_both_copies` keeps the losing value in a new item tagged `conflicted-copy`, with a `derived-from` edge to the original.
|
|
1728
1728
|
* @enum {string}
|
|
1729
1729
|
*/
|
|
1730
1730
|
MergeStrategy: "last_writer_wins" | "keep_both_copies";
|
|
@@ -2131,6 +2131,23 @@ interface components {
|
|
|
2131
2131
|
};
|
|
2132
2132
|
};
|
|
2133
2133
|
};
|
|
2134
|
+
/** @description An error response. */
|
|
2135
|
+
EdgeNotFoundOrEdgeTypeNotFoundOrItemNotFoundRefusal: {
|
|
2136
|
+
/** @description What went wrong. */
|
|
2137
|
+
error: {
|
|
2138
|
+
/**
|
|
2139
|
+
* @description A machine-readable code for the error. Use it in your logic.
|
|
2140
|
+
* @enum {string}
|
|
2141
|
+
*/
|
|
2142
|
+
code: "edge_not_found" | "edge_type_not_found" | "item_not_found";
|
|
2143
|
+
/** @description A description of the error for a person to read. It can change, so don't match on it. */
|
|
2144
|
+
message: string;
|
|
2145
|
+
/** @description More about the error, such as the field it concerns. Each code defines its own details. */
|
|
2146
|
+
details?: {
|
|
2147
|
+
[key: string]: unknown;
|
|
2148
|
+
};
|
|
2149
|
+
};
|
|
2150
|
+
};
|
|
2134
2151
|
/** @description A stale write that carried nothing to merge: the error and the item now. */
|
|
2135
2152
|
ItemStaleVersion: {
|
|
2136
2153
|
error: components["schemas"]["VersionConflictError"] & unknown;
|
|
@@ -2184,6 +2201,23 @@ interface components {
|
|
|
2184
2201
|
};
|
|
2185
2202
|
};
|
|
2186
2203
|
/** @description An error response. */
|
|
2204
|
+
EdgeNotFoundOrItemNotFoundRefusal: {
|
|
2205
|
+
/** @description What went wrong. */
|
|
2206
|
+
error: {
|
|
2207
|
+
/**
|
|
2208
|
+
* @description A machine-readable code for the error. Use it in your logic.
|
|
2209
|
+
* @enum {string}
|
|
2210
|
+
*/
|
|
2211
|
+
code: "edge_not_found" | "item_not_found";
|
|
2212
|
+
/** @description A description of the error for a person to read. It can change, so don't match on it. */
|
|
2213
|
+
message: string;
|
|
2214
|
+
/** @description More about the error, such as the field it concerns. Each code defines its own details. */
|
|
2215
|
+
details?: {
|
|
2216
|
+
[key: string]: unknown;
|
|
2217
|
+
};
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
/** @description An error response. */
|
|
2187
2221
|
InvalidIdOrInvalidTransitionOrValidationErrorRefusal: {
|
|
2188
2222
|
/** @description What went wrong. */
|
|
2189
2223
|
error: {
|
|
@@ -2524,23 +2558,6 @@ interface components {
|
|
|
2524
2558
|
};
|
|
2525
2559
|
};
|
|
2526
2560
|
};
|
|
2527
|
-
/** @description An error response. */
|
|
2528
|
-
EdgeNotFoundOrEdgeTypeNotFoundOrItemNotFoundRefusal: {
|
|
2529
|
-
/** @description What went wrong. */
|
|
2530
|
-
error: {
|
|
2531
|
-
/**
|
|
2532
|
-
* @description A machine-readable code for the error. Use it in your logic.
|
|
2533
|
-
* @enum {string}
|
|
2534
|
-
*/
|
|
2535
|
-
code: "edge_not_found" | "edge_type_not_found" | "item_not_found";
|
|
2536
|
-
/** @description A description of the error for a person to read. It can change, so don't match on it. */
|
|
2537
|
-
message: string;
|
|
2538
|
-
/** @description More about the error, such as the field it concerns. Each code defines its own details. */
|
|
2539
|
-
details?: {
|
|
2540
|
-
[key: string]: unknown;
|
|
2541
|
-
};
|
|
2542
|
-
};
|
|
2543
|
-
};
|
|
2544
2561
|
/** @description A stale update's answer: the refusal and the current edge. */
|
|
2545
2562
|
EdgeVersionConflict: {
|
|
2546
2563
|
error: components["schemas"]["VersionConflictError"] & unknown;
|
|
@@ -3069,7 +3086,7 @@ interface components {
|
|
|
3069
3086
|
Occurrence: {
|
|
3070
3087
|
/** @description When the occurrence starts, in UTC. */
|
|
3071
3088
|
starts_at: string;
|
|
3072
|
-
/** @description When the occurrence ends, in UTC. One computed from a rule lasts as long as its series' first; any other ends at its item's `ends_at`. Absent when it has no end. */
|
|
3089
|
+
/** @description When the occurrence ends, in UTC. A whole-day event ends at midnight in its `timezone`, or in UTC if it has none. One computed from a rule lasts as long as its series' first; any other ends at its item's `ends_at`. Absent when it has no end. */
|
|
3073
3090
|
ends_at?: string;
|
|
3074
3091
|
item: components["schemas"]["Item"] & unknown;
|
|
3075
3092
|
/** @description The ID of the recurring event the occurrence belongs to. Absent on an event that doesn't recur. */
|
|
@@ -5090,7 +5107,10 @@ interface operations {
|
|
|
5090
5107
|
"application/json": components["schemas"]["TypeNotPermittedRefusal"];
|
|
5091
5108
|
};
|
|
5092
5109
|
};
|
|
5093
|
-
/**
|
|
5110
|
+
/**
|
|
5111
|
+
* @description - `item_not_found`: no item has this ID, or its type is one you can't read. If the item is in the trash and you can read its type, `details.trashed` is `true`.
|
|
5112
|
+
* - `edge_not_found`: a repeat under the `Idempotency-Key` would show an edge you can no longer read.
|
|
5113
|
+
*/
|
|
5094
5114
|
404: {
|
|
5095
5115
|
headers: {
|
|
5096
5116
|
"X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
|
|
@@ -5103,7 +5123,7 @@ interface operations {
|
|
|
5103
5123
|
[name: string]: unknown;
|
|
5104
5124
|
};
|
|
5105
5125
|
content: {
|
|
5106
|
-
"application/json": components["schemas"]["
|
|
5126
|
+
"application/json": components["schemas"]["EdgeNotFoundOrItemNotFoundRefusal"];
|
|
5107
5127
|
};
|
|
5108
5128
|
};
|
|
5109
5129
|
/**
|
|
@@ -5254,7 +5274,7 @@ interface operations {
|
|
|
5254
5274
|
};
|
|
5255
5275
|
};
|
|
5256
5276
|
responses: {
|
|
5257
|
-
/** @description Returns the updated item and its metadata. If `conflict=auto` resolved a collision, `conflict_resolution` lists the fields and strategies. A `keep_both_copies` field keeps the current value and puts yours on a new sibling tagged `conflicted-copy
|
|
5277
|
+
/** @description Returns the updated item and its metadata. If `conflict=auto` resolved a collision, `conflict_resolution` lists the fields and strategies. A `keep_both_copies` field keeps the current value and puts yours on a new sibling tagged `conflicted-copy`, with a `derived-from` edge to this item. */
|
|
5258
5278
|
200: {
|
|
5259
5279
|
headers: {
|
|
5260
5280
|
"X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
|
|
@@ -5267,7 +5287,7 @@ interface operations {
|
|
|
5267
5287
|
};
|
|
5268
5288
|
content: {
|
|
5269
5289
|
"application/json": components["schemas"]["ItemWithMetadata"] & {
|
|
5270
|
-
/** @description What Marfa did to resolve a conflict. Present only when `conflict=auto` resolved one. `conflicted_copy_id` is the ID of the sibling item that holds the losing values. */
|
|
5290
|
+
/** @description What Marfa did to resolve a conflict. Present only when `conflict=auto` resolved one. `conflicted_copy_id` is the ID of the sibling item that holds the losing values, which has a `derived-from` edge to this item. */
|
|
5271
5291
|
conflict_resolution?: {
|
|
5272
5292
|
fields: string[];
|
|
5273
5293
|
strategy: {
|
|
@@ -5338,6 +5358,7 @@ interface operations {
|
|
|
5338
5358
|
/**
|
|
5339
5359
|
* @description - `item_not_found`: no item has this ID, its type is one you can't read, or an edge target doesn't exist or has a type you can't read. For an item in the trash, `details.trashed` is `true` if you can read its type.
|
|
5340
5360
|
* - `edge_type_not_found`: an edge names an edge type that doesn't exist.
|
|
5361
|
+
* - `edge_not_found`: a repeat under the `Idempotency-Key` would show an edge you can no longer read.
|
|
5341
5362
|
*/
|
|
5342
5363
|
404: {
|
|
5343
5364
|
headers: {
|
|
@@ -5351,7 +5372,7 @@ interface operations {
|
|
|
5351
5372
|
[name: string]: unknown;
|
|
5352
5373
|
};
|
|
5353
5374
|
content: {
|
|
5354
|
-
"application/json": components["schemas"]["
|
|
5375
|
+
"application/json": components["schemas"]["EdgeNotFoundOrEdgeTypeNotFoundOrItemNotFoundRefusal"];
|
|
5355
5376
|
};
|
|
5356
5377
|
};
|
|
5357
5378
|
/**
|
|
@@ -5744,7 +5765,10 @@ interface operations {
|
|
|
5744
5765
|
"application/json": components["schemas"]["TypeNotPermittedRefusal"];
|
|
5745
5766
|
};
|
|
5746
5767
|
};
|
|
5747
|
-
/**
|
|
5768
|
+
/**
|
|
5769
|
+
* @description - `item_not_found`: no item has this ID, or its type is one you can't read.
|
|
5770
|
+
* - `edge_not_found`: a repeat under the `Idempotency-Key` would show an edge you can no longer read.
|
|
5771
|
+
*/
|
|
5748
5772
|
404: {
|
|
5749
5773
|
headers: {
|
|
5750
5774
|
"X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
|
|
@@ -5757,7 +5781,7 @@ interface operations {
|
|
|
5757
5781
|
[name: string]: unknown;
|
|
5758
5782
|
};
|
|
5759
5783
|
content: {
|
|
5760
|
-
"application/json": components["schemas"]["
|
|
5784
|
+
"application/json": components["schemas"]["EdgeNotFoundOrItemNotFoundRefusal"];
|
|
5761
5785
|
};
|
|
5762
5786
|
};
|
|
5763
5787
|
/** @description - `idempotency_key_in_flight`: a request with this `Idempotency-Key` is still running, and this one wrote nothing. Retry. */
|
|
@@ -7492,7 +7516,7 @@ interface operations {
|
|
|
7492
7516
|
"application/json": components["schemas"]["UnauthorizedRefusal"];
|
|
7493
7517
|
};
|
|
7494
7518
|
};
|
|
7495
|
-
/** @description - `forbidden`: another credential queued the job, and yours
|
|
7519
|
+
/** @description - `forbidden`: another credential queued the job, and yours isn't the operator key. */
|
|
7496
7520
|
403: {
|
|
7497
7521
|
headers: {
|
|
7498
7522
|
"X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
|
|
@@ -7626,7 +7650,7 @@ interface operations {
|
|
|
7626
7650
|
"application/json": components["schemas"]["UnauthorizedRefusal"];
|
|
7627
7651
|
};
|
|
7628
7652
|
};
|
|
7629
|
-
/** @description - `forbidden`: another credential queued the job, and yours
|
|
7653
|
+
/** @description - `forbidden`: another credential queued the job, and yours isn't the operator key. */
|
|
7630
7654
|
403: {
|
|
7631
7655
|
headers: {
|
|
7632
7656
|
"X-Marfa-Contract": components["headers"]["X-Marfa-Contract"];
|
|
@@ -10814,8 +10838,8 @@ interface operations {
|
|
|
10814
10838
|
* @description - `missing_required_field`: `fields` is missing.
|
|
10815
10839
|
* - `validation_error`: `id` is malformed, or `parent` isn't registered or makes too deep a chain.
|
|
10816
10840
|
* - `invalid_schema`: the schema is invalid, such as a `link_field` that isn't a string field.
|
|
10817
|
-
* - `property_shadows_field`: a field
|
|
10818
|
-
* - `inheritance_violation`: the type
|
|
10841
|
+
* - `property_shadows_field`: a field is named like one every item has, such as `source_id`.
|
|
10842
|
+
* - `inheritance_violation`: the type reshapes an inherited field.
|
|
10819
10843
|
*/
|
|
10820
10844
|
400: {
|
|
10821
10845
|
headers: {
|
|
@@ -11601,7 +11625,7 @@ interface operations {
|
|
|
11601
11625
|
listOccurrences: {
|
|
11602
11626
|
parameters: {
|
|
11603
11627
|
query: {
|
|
11604
|
-
/** @description Window start, ISO 8601. An event overlaps the window if it starts before `to` and ends after this time.
|
|
11628
|
+
/** @description Window start, ISO 8601. An event overlaps the window if it starts before `to` and ends after this time. Its end is `ends_at`, else its start plus `duration`. A whole-day event fills whole days in its `timezone`, or in UTC if it has none. */
|
|
11605
11629
|
from: string;
|
|
11606
11630
|
/** @description Window end, ISO 8601. The window can span at most 400 days. An event with no length is in the window if it starts at or after `from` and before this time. */
|
|
11607
11631
|
to: string;
|