@agentpost-tools/resourceshark-sdk 0.0.0-stage → 0.2.0
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/LICENSE.md +25 -0
- package/README.md +41 -2
- package/dist/client-DEn-MdAz.d.ts +1703 -0
- package/dist/client-bcl2_fz8.js +289 -0
- package/dist/commit-93Qao_5l.d.ts +171 -0
- package/dist/commit-B_gOf0Ji.js +384 -0
- package/dist/helpers/index.d.ts +108 -0
- package/dist/helpers/index.js +299 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +3 -0
- package/dist/refusals-C8SBj-15.js +27 -0
- package/dist/server.d.ts +101 -0
- package/dist/server.js +250 -0
- package/dist/workflows/index.d.ts +103 -0
- package/dist/workflows/index.js +519 -0
- package/package.json +36 -4
|
@@ -0,0 +1,1703 @@
|
|
|
1
|
+
/** The portion of one scope's balance that belongs to a batch. */
|
|
2
|
+
interface BalanceBatch<T = string> {
|
|
3
|
+
batchId: BatchId;
|
|
4
|
+
code: string;
|
|
5
|
+
onHand: Quantity;
|
|
6
|
+
held: Quantity;
|
|
7
|
+
available: Quantity;
|
|
8
|
+
expiresAt?: T;
|
|
9
|
+
}
|
|
10
|
+
/** The quantities and freshness of one scope's balance. */
|
|
11
|
+
interface Balance<T = string> {
|
|
12
|
+
resourceId: ResourceId;
|
|
13
|
+
/** The scope read. */
|
|
14
|
+
scope: Scope;
|
|
15
|
+
onHand: Quantity;
|
|
16
|
+
held: Quantity;
|
|
17
|
+
expected: Quantity;
|
|
18
|
+
/** On hand less held, plus expected for backorders. A shortage caused by holds reads as zero. */
|
|
19
|
+
available: Quantity;
|
|
20
|
+
/** Moves with every change to the balance; 0 for a scope that has never had one. */
|
|
21
|
+
version: number;
|
|
22
|
+
/** When the answer was true. */
|
|
23
|
+
asOf: T;
|
|
24
|
+
/** Each batch's share of the balance, included when asked for by batch. */
|
|
25
|
+
batches?: BalanceBatch<T>[];
|
|
26
|
+
}
|
|
27
|
+
/** A balance as returned by a scope read. */
|
|
28
|
+
interface BalanceResponse<T = string> {
|
|
29
|
+
balance: Balance<T>;
|
|
30
|
+
}
|
|
31
|
+
/** The scope and optional breakdown to read. */
|
|
32
|
+
type BalanceQuery = {
|
|
33
|
+
placeId?: string | undefined;
|
|
34
|
+
condition?: string | undefined;
|
|
35
|
+
holderRef?: string | undefined;
|
|
36
|
+
instanceId?: string | undefined;
|
|
37
|
+
by?: 'batch' | undefined;
|
|
38
|
+
};
|
|
39
|
+
type AvailabilityRequest = {
|
|
40
|
+
lines: {
|
|
41
|
+
resourceId: string;
|
|
42
|
+
quantity: number;
|
|
43
|
+
scope?: {
|
|
44
|
+
placeId?: string | undefined;
|
|
45
|
+
condition?: string | undefined;
|
|
46
|
+
holderRef?: string | undefined;
|
|
47
|
+
instanceId?: string | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
from?: {
|
|
50
|
+
batchId?: string | undefined;
|
|
51
|
+
supplyId?: string | undefined;
|
|
52
|
+
} | undefined;
|
|
53
|
+
span?: {
|
|
54
|
+
start: string;
|
|
55
|
+
end: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
interface AvailabilityLine<T = string> {
|
|
60
|
+
resourceId: ResourceId;
|
|
61
|
+
scope: Scope;
|
|
62
|
+
/** The quantity asked about. */
|
|
63
|
+
quantity: Quantity;
|
|
64
|
+
available: Quantity;
|
|
65
|
+
expected: Quantity;
|
|
66
|
+
version: number;
|
|
67
|
+
asOf: T;
|
|
68
|
+
}
|
|
69
|
+
interface AvailabilityResponse<T = string> {
|
|
70
|
+
/** One per line asked about, in the same order. */
|
|
71
|
+
lines: AvailabilityLine<T>[];
|
|
72
|
+
}
|
|
73
|
+
/** The batch a resource's supply can name. */
|
|
74
|
+
interface Batch<T = string> {
|
|
75
|
+
id: BatchId;
|
|
76
|
+
resourceId: ResourceId;
|
|
77
|
+
code: string;
|
|
78
|
+
expiresAt?: T;
|
|
79
|
+
attributes?: Attributes;
|
|
80
|
+
version: number;
|
|
81
|
+
createdAt: T;
|
|
82
|
+
updatedAt: T;
|
|
83
|
+
}
|
|
84
|
+
/** What a caller sends to create a batch. */
|
|
85
|
+
type BatchCreate = {
|
|
86
|
+
resourceId: string;
|
|
87
|
+
code: string;
|
|
88
|
+
expiresAt?: string | undefined;
|
|
89
|
+
attributes?: Record<string, string> | undefined;
|
|
90
|
+
};
|
|
91
|
+
/** What a caller sends to edit a batch. */
|
|
92
|
+
type BatchPatch = {
|
|
93
|
+
resourceId?: string | undefined;
|
|
94
|
+
code?: string | undefined;
|
|
95
|
+
expiresAt?: string | null | undefined;
|
|
96
|
+
attributes?: Record<string, string> | null | undefined;
|
|
97
|
+
};
|
|
98
|
+
/** The filters and page size the batches list uses. */
|
|
99
|
+
type BatchesQuery = {
|
|
100
|
+
limit: number;
|
|
101
|
+
resourceId?: string | undefined;
|
|
102
|
+
after?: string | undefined;
|
|
103
|
+
};
|
|
104
|
+
/** A batch read or returned from a write. */
|
|
105
|
+
interface BatchResponse<T = string> {
|
|
106
|
+
batch: Batch<T>;
|
|
107
|
+
}
|
|
108
|
+
/** One page of batches, with the cursor for the next page when there is one. */
|
|
109
|
+
interface BatchesPage<T = string> {
|
|
110
|
+
batches: Batch<T>[];
|
|
111
|
+
next?: string;
|
|
112
|
+
}
|
|
113
|
+
/** The kind a principal may declare. A principal that declared none has no `kind`. */
|
|
114
|
+
type PrincipalKind = 'human' | 'agent' | 'service';
|
|
115
|
+
/** A principal that acted, with the kind it declared for itself. */
|
|
116
|
+
interface PrincipalRef {
|
|
117
|
+
kind?: PrincipalKind;
|
|
118
|
+
id: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Who made a change and for whom, as a change-feed event carries it: the
|
|
122
|
+
* actor, and the delegator when the actor acted under a delegation.
|
|
123
|
+
* ResourceShark's own changes, such as a sweep's, name the `service`
|
|
124
|
+
* principal `resourceshark`.
|
|
125
|
+
*/
|
|
126
|
+
interface ActingContext {
|
|
127
|
+
/** The principal that made the request with its own credential. Your project's secret key is `key:` and the key's name, with no `kind`. */
|
|
128
|
+
actor: PrincipalRef;
|
|
129
|
+
/** The delegator, when the actor acted under a delegation. */
|
|
130
|
+
onBehalfOf?: PrincipalRef;
|
|
131
|
+
}
|
|
132
|
+
/** What one line held or took from a resource. */
|
|
133
|
+
interface Claim<T = string> {
|
|
134
|
+
id: ClaimId;
|
|
135
|
+
resourceId: ResourceId;
|
|
136
|
+
/** The scope it takes from. */
|
|
137
|
+
scope: Scope;
|
|
138
|
+
/**
|
|
139
|
+
* Half-open, UTC. A consumption starts when it was taken and never ends;
|
|
140
|
+
* so does a hold's claim, from when it was placed. A claim on a resource
|
|
141
|
+
* counted in buckets has the span its line asked for, with an end.
|
|
142
|
+
*/
|
|
143
|
+
span: Span<T>;
|
|
144
|
+
/** What it takes. For a hold's claim, what it holds, or held until its hold was resolved. */
|
|
145
|
+
quantity: Quantity;
|
|
146
|
+
/**
|
|
147
|
+
* A claim with a span that ends, on a resource counted in buckets, is a
|
|
148
|
+
* `booking` once it is taken: a consumption there, or a hold's line once
|
|
149
|
+
* its hold is committed. A hold's line is `hold` until then.
|
|
150
|
+
*/
|
|
151
|
+
kind: 'hold' | 'consumption' | 'booking';
|
|
152
|
+
status: 'held' | 'committed' | 'released' | 'expired' | 'cancelled';
|
|
153
|
+
/** The hold it is a line of, for a claim of kind `hold`. */
|
|
154
|
+
holdId?: HoldId;
|
|
155
|
+
/** What its hold's commit took for good; the rest of `quantity` was released. */
|
|
156
|
+
committed?: Quantity;
|
|
157
|
+
/**
|
|
158
|
+
* The entries it drew from, when the resource keeps its supply apart. On
|
|
159
|
+
* a resource that lets its balance go below zero, they can cover less
|
|
160
|
+
* than the claim: the rest was owed, or a hold's line holds it with no
|
|
161
|
+
* entry until its commit takes it.
|
|
162
|
+
*/
|
|
163
|
+
pegs?: Peg[];
|
|
164
|
+
/** The conversion that took this claim's quantity. */
|
|
165
|
+
transformationId?: TransformationId;
|
|
166
|
+
/** What an estimate first took, kept once it is settled; `quantity` is then the real quantity. */
|
|
167
|
+
estimate?: Quantity;
|
|
168
|
+
/** The real quantity an estimate was settled at. Set once, by the settle. */
|
|
169
|
+
settled?: Quantity;
|
|
170
|
+
/** Your app's name for the holder, such as `principal:external:u_maya`. */
|
|
171
|
+
holderRef?: Ref;
|
|
172
|
+
/** What it was taken for. A claim taken by a hold commit carries the commit's evidence. */
|
|
173
|
+
evidence?: Evidence;
|
|
174
|
+
/** For a consume or hold commit, kept on the first claim that takes from each resource. */
|
|
175
|
+
sourceKey?: string;
|
|
176
|
+
actor: PrincipalRef;
|
|
177
|
+
onBehalfOf?: PrincipalRef;
|
|
178
|
+
createdAt: T;
|
|
179
|
+
updatedAt: T;
|
|
180
|
+
}
|
|
181
|
+
/** What one line asks to take or check. */
|
|
182
|
+
type ClaimLine = {
|
|
183
|
+
resourceId: string;
|
|
184
|
+
quantity: number;
|
|
185
|
+
scope?: {
|
|
186
|
+
placeId?: string | undefined;
|
|
187
|
+
condition?: string | undefined;
|
|
188
|
+
holderRef?: string | undefined;
|
|
189
|
+
instanceId?: string | undefined;
|
|
190
|
+
} | undefined;
|
|
191
|
+
from?: {
|
|
192
|
+
batchId?: string | undefined;
|
|
193
|
+
supplyId?: string | undefined;
|
|
194
|
+
} | undefined;
|
|
195
|
+
span?: {
|
|
196
|
+
start: string;
|
|
197
|
+
end: string;
|
|
198
|
+
} | undefined;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* One line a take, a hold, or a move couldn't cover, as `insufficient_supply`,
|
|
202
|
+
* `exhausted_until_supply`, and `assignment_infeasible` name it in
|
|
203
|
+
* `details.lines`.
|
|
204
|
+
*/
|
|
205
|
+
interface ShortLine<T = string> {
|
|
206
|
+
/** The line's index in the request. */
|
|
207
|
+
line: number;
|
|
208
|
+
resourceId: ResourceId;
|
|
209
|
+
/** The scope it asked for; on a resource with `identity: instance`, its `instanceId` names the unit. */
|
|
210
|
+
scope: Scope;
|
|
211
|
+
quantity: Quantity;
|
|
212
|
+
/** What the line could take now: on a unit, 0 when it isn't free. */
|
|
213
|
+
available: Quantity;
|
|
214
|
+
/** When the next supply on its scope that starts later starts, when there is some. */
|
|
215
|
+
nextSupplyAt?: T;
|
|
216
|
+
/** On a settle, the claim the line settles. */
|
|
217
|
+
claimId?: ClaimId;
|
|
218
|
+
}
|
|
219
|
+
/** What `insufficient_supply` carries in `details`: each short line and what it has available. */
|
|
220
|
+
interface InsufficientSupplyDetails<T = string> {
|
|
221
|
+
lines: ShortLine<T>[];
|
|
222
|
+
}
|
|
223
|
+
/** What `exhausted_until_supply` carries in `details`: each short line, and when the earliest of their next supply starts. */
|
|
224
|
+
interface ExhaustedUntilSupplyDetails<T = string> {
|
|
225
|
+
lines: ShortLine<T>[];
|
|
226
|
+
nextSupplyAt: T;
|
|
227
|
+
}
|
|
228
|
+
/** What `assignment_infeasible` carries in `details`: each short line, among them every line whose named unit isn't free. */
|
|
229
|
+
interface AssignmentInfeasibleDetails<T = string> {
|
|
230
|
+
lines: ShortLine<T>[];
|
|
231
|
+
}
|
|
232
|
+
type ConsumeRequest = {
|
|
233
|
+
lines: {
|
|
234
|
+
resourceId: string;
|
|
235
|
+
quantity: number;
|
|
236
|
+
scope?: {
|
|
237
|
+
placeId?: string | undefined;
|
|
238
|
+
condition?: string | undefined;
|
|
239
|
+
holderRef?: string | undefined;
|
|
240
|
+
instanceId?: string | undefined;
|
|
241
|
+
} | undefined;
|
|
242
|
+
from?: {
|
|
243
|
+
batchId?: string | undefined;
|
|
244
|
+
supplyId?: string | undefined;
|
|
245
|
+
} | undefined;
|
|
246
|
+
span?: {
|
|
247
|
+
start: string;
|
|
248
|
+
end: string;
|
|
249
|
+
} | undefined;
|
|
250
|
+
}[];
|
|
251
|
+
evidence: {
|
|
252
|
+
kind: string;
|
|
253
|
+
ref: string;
|
|
254
|
+
};
|
|
255
|
+
sourceKey: string;
|
|
256
|
+
estimate?: boolean | undefined;
|
|
257
|
+
};
|
|
258
|
+
interface ConsumeResponse<T = string> {
|
|
259
|
+
/** One per line, in the order of the lines. */
|
|
260
|
+
claims: Claim<T>[];
|
|
261
|
+
/** One per line in the same order. On a bucketed resource, this is the first bucket's movement. */
|
|
262
|
+
movements: Movement<T>[];
|
|
263
|
+
/** Set when the `sourceKey` already named this request: nothing was taken again. */
|
|
264
|
+
duplicate?: true;
|
|
265
|
+
}
|
|
266
|
+
/** The request that settles estimated consumptions. */
|
|
267
|
+
type SettleRequest = {
|
|
268
|
+
lines: {
|
|
269
|
+
claimId: string;
|
|
270
|
+
quantity: number;
|
|
271
|
+
}[];
|
|
272
|
+
sourceKey: string;
|
|
273
|
+
evidence?: {
|
|
274
|
+
kind: string;
|
|
275
|
+
ref: string;
|
|
276
|
+
} | undefined;
|
|
277
|
+
};
|
|
278
|
+
/** What a settle wrote. */
|
|
279
|
+
interface SettleResponse<T = string> {
|
|
280
|
+
/** One per line, settled, in the order of the lines. */
|
|
281
|
+
claims: Claim<T>[];
|
|
282
|
+
/** The `settle` movements, in the order of the lines, one for each claim whose real quantity differs from its estimate. Each names its claim. */
|
|
283
|
+
movements: Movement<T>[];
|
|
284
|
+
/** Set when the `sourceKey` already named this request: nothing was settled again. */
|
|
285
|
+
duplicate?: true;
|
|
286
|
+
}
|
|
287
|
+
/** The filters and page size the claims list uses. */
|
|
288
|
+
type ClaimsQuery = {
|
|
289
|
+
limit: number;
|
|
290
|
+
resourceId?: string | undefined;
|
|
291
|
+
holderRef?: string | undefined;
|
|
292
|
+
status?: 'held' | 'committed' | 'released' | 'expired' | 'cancelled' | undefined;
|
|
293
|
+
kind?: 'hold' | 'consumption' | 'booking' | undefined;
|
|
294
|
+
from?: string | undefined;
|
|
295
|
+
to?: string | undefined;
|
|
296
|
+
after?: string | undefined;
|
|
297
|
+
};
|
|
298
|
+
/** One page of claims, with the cursor for the next page when there is one. */
|
|
299
|
+
interface ClaimsPage<T = string> {
|
|
300
|
+
claims: Claim<T>[];
|
|
301
|
+
next?: string;
|
|
302
|
+
}
|
|
303
|
+
/** The claim read by ID. */
|
|
304
|
+
interface ClaimResponse<T = string> {
|
|
305
|
+
claim: Claim<T>;
|
|
306
|
+
}
|
|
307
|
+
type ResourcesharkConfig = {
|
|
308
|
+
retention: {
|
|
309
|
+
events: string;
|
|
310
|
+
resolvedHolds: string;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
interface ConfigRecord<T = string> extends ResourcesharkConfig {
|
|
314
|
+
version: number;
|
|
315
|
+
updatedAt: T;
|
|
316
|
+
updatedBy: string;
|
|
317
|
+
}
|
|
318
|
+
interface ConfigResponse<T = string> {
|
|
319
|
+
config: ConfigRecord<T>;
|
|
320
|
+
}
|
|
321
|
+
type Duration = string;
|
|
322
|
+
type ErrorClass = 'retry_later' | 'exhausted' | 'change_the_request';
|
|
323
|
+
/** What `stale_version` carries in `details`: the version the record is at, and on a count, the balance's on hand at that version. */
|
|
324
|
+
interface StaleVersionDetails {
|
|
325
|
+
version: number;
|
|
326
|
+
onHand?: Quantity;
|
|
327
|
+
}
|
|
328
|
+
/** What `key_in_use` carries in `details`: the field whose value is taken, and the value. */
|
|
329
|
+
interface KeyInUseDetails {
|
|
330
|
+
field: string;
|
|
331
|
+
value: string;
|
|
332
|
+
}
|
|
333
|
+
/** What `settings_locked` carries in `details`: the resource's version, and the settings that can no longer change. */
|
|
334
|
+
interface SettingsLockedDetails {
|
|
335
|
+
version: number;
|
|
336
|
+
fields: string[];
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* What `details` holds for each code whose details have one shape. A code
|
|
340
|
+
* left out has no details, or details that differ by where it came from:
|
|
341
|
+
* the Platform answers `invalid_request`, `forbidden`, and `conflict` with
|
|
342
|
+
* its own before a request reaches resourceshark, `invalid_quantity` names
|
|
343
|
+
* what each operation checked, and `duplicate_source` names the stored
|
|
344
|
+
* record only when the caller may read it.
|
|
345
|
+
*/
|
|
346
|
+
interface ErrorDetails extends FeedErrorDetails {
|
|
347
|
+
stale_version: StaleVersionDetails;
|
|
348
|
+
key_in_use: KeyInUseDetails;
|
|
349
|
+
settings_locked: SettingsLockedDetails;
|
|
350
|
+
insufficient_supply: InsufficientSupplyDetails;
|
|
351
|
+
exhausted_until_supply: ExhaustedUntilSupplyDetails;
|
|
352
|
+
assignment_infeasible: AssignmentInfeasibleDetails;
|
|
353
|
+
hold_expired: HoldExpiredDetails;
|
|
354
|
+
hold_resolved: HoldResolvedDetails;
|
|
355
|
+
}
|
|
356
|
+
/** The type of `details` for one code: its entry in {@link ErrorDetails}, or `unknown` for a code with none there. */
|
|
357
|
+
type ErrorDetailsOf<C extends string> = C extends keyof ErrorDetails ? ErrorDetails[C] : unknown;
|
|
358
|
+
type ErrorCode = 'invalid_request' | 'unauthenticated' | 'forbidden' | 'not_found' | 'conflict' | 'idempotency_mismatch' | 'stale_version' | 'payload_too_large' | 'internal_error' | 'key_in_use' | 'settings_locked' | 'insufficient_supply' | 'exhausted_until_supply' | 'assignment_infeasible' | 'hold_expired' | 'hold_resolved' | 'cursor_expired' | 'duplicate_source' | 'invalid_quantity';
|
|
359
|
+
interface ErrorBody {
|
|
360
|
+
error: {
|
|
361
|
+
code: ErrorCode;
|
|
362
|
+
class: ErrorClass;
|
|
363
|
+
message: string;
|
|
364
|
+
details?: unknown;
|
|
365
|
+
docs: string;
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
/** One change-feed record: CloudEvents 1.0, structured JSON. Written out in full, the kit's `ChangeEventBase` with this service's source, so the SDK's generated types need nothing from the kit. */
|
|
369
|
+
interface ChangeEvent<T = string> {
|
|
370
|
+
/** A plain ULID, unique to the event. */
|
|
371
|
+
id: string;
|
|
372
|
+
/** The event's place in the project's feed, from 1. Pass it as `after` to read the events after it. */
|
|
373
|
+
seq: number;
|
|
374
|
+
specversion: '1.0';
|
|
375
|
+
type: string;
|
|
376
|
+
/** `EVENT_SOURCE`, written out so the SDK's generated types need no value. */
|
|
377
|
+
source: '/resourceshark';
|
|
378
|
+
/** The record the event is about. */
|
|
379
|
+
subject?: string;
|
|
380
|
+
time: T;
|
|
381
|
+
datacontenttype: 'application/json';
|
|
382
|
+
data: {
|
|
383
|
+
/** Who made the change, and for whom. */
|
|
384
|
+
context: ActingContext;
|
|
385
|
+
[k: string]: unknown;
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
/** One page of the feed. `after=latest` answers no events and the newest `seq` as `next`; a cursor behind the oldest event kept is `cursor_expired`. */
|
|
389
|
+
interface EventsPage<T = string> {
|
|
390
|
+
events: ChangeEvent<T>[];
|
|
391
|
+
/** Pass as `after` to continue. Always present. A full page gives its last event's `seq`. A shorter page has caught up, so it gives the newest `seq` read, past any events a `types` filter skipped. */
|
|
392
|
+
next: number;
|
|
393
|
+
}
|
|
394
|
+
/** What one holder has on one resource. */
|
|
395
|
+
interface HolderBalance<T = string> {
|
|
396
|
+
resourceId: ResourceId;
|
|
397
|
+
/** Your app's name for the holder, such as `principal:external:u_maya`. */
|
|
398
|
+
holderRef: Ref;
|
|
399
|
+
onHand: Quantity;
|
|
400
|
+
held: Quantity;
|
|
401
|
+
available: Quantity;
|
|
402
|
+
/** Moves with every change to the balance; 0 for one that has never had one. */
|
|
403
|
+
version: number;
|
|
404
|
+
/** The holder's supply on hand, such as added entries and outputs, in the order a take draws from them. */
|
|
405
|
+
supply: SupplyEntry<T>[];
|
|
406
|
+
/** When the next of the holder's supply that starts later starts, when it has some. */
|
|
407
|
+
nextSupplyAt?: T;
|
|
408
|
+
}
|
|
409
|
+
/** A holder's balance on one resource. */
|
|
410
|
+
interface HolderBalanceResponse<T = string> {
|
|
411
|
+
balance: HolderBalance<T>;
|
|
412
|
+
}
|
|
413
|
+
/** One page of a holder's balances, with the cursor for the next page when there is one. */
|
|
414
|
+
interface HolderBalancesPage<T = string> {
|
|
415
|
+
balances: HolderBalance<T>[];
|
|
416
|
+
next?: string;
|
|
417
|
+
}
|
|
418
|
+
/** The place, condition, cursor, and page size the list of a holder's balances uses. */
|
|
419
|
+
type HolderBalancesQuery = {
|
|
420
|
+
limit: number;
|
|
421
|
+
placeId?: string | undefined;
|
|
422
|
+
condition?: string | undefined;
|
|
423
|
+
after?: string | undefined;
|
|
424
|
+
};
|
|
425
|
+
type HoldStatus = 'committed' | 'released' | 'expired' | 'cancelled' | 'open' | 'partially_committed';
|
|
426
|
+
/** One line of a hold, as its claim stands. */
|
|
427
|
+
interface HoldLine<T = string> {
|
|
428
|
+
claimId: ClaimId;
|
|
429
|
+
resourceId: ResourceId;
|
|
430
|
+
/** The scope it holds from. */
|
|
431
|
+
scope: Scope;
|
|
432
|
+
/** On a resource counted in buckets: the time the line holds, `[start, end)`. */
|
|
433
|
+
span?: FiniteSpan<T>;
|
|
434
|
+
/** What the line holds, or held until the hold was resolved. */
|
|
435
|
+
quantity: Quantity;
|
|
436
|
+
/** `cancelled` once a cancel gave back what its commit took. */
|
|
437
|
+
status: 'held' | 'committed' | 'released' | 'expired' | 'cancelled';
|
|
438
|
+
/** What the commit took for good; the rest of `quantity` was released. */
|
|
439
|
+
committed?: Quantity;
|
|
440
|
+
/** The supply entries the line holds from, or took from once committed, on a resource whose supply is told apart. */
|
|
441
|
+
pegs?: Peg[];
|
|
442
|
+
}
|
|
443
|
+
/** One cancel of a committed hold: the lines it gave back. */
|
|
444
|
+
interface HoldCancellation<T = string> {
|
|
445
|
+
at: T;
|
|
446
|
+
claimIds: ClaimId[];
|
|
447
|
+
evidence?: Evidence;
|
|
448
|
+
sourceKey: string;
|
|
449
|
+
}
|
|
450
|
+
/** How a hold ended. */
|
|
451
|
+
interface HoldResolution<T = string> {
|
|
452
|
+
/** When: the commit or the release, or, for an expiry, the `expiresAt` it ran out at. */
|
|
453
|
+
at: T;
|
|
454
|
+
/** What a commit was made for, such as the order. */
|
|
455
|
+
evidence?: Evidence;
|
|
456
|
+
/** The commit's `sourceKey`. */
|
|
457
|
+
sourceKey?: string;
|
|
458
|
+
}
|
|
459
|
+
interface Hold<T = string> {
|
|
460
|
+
id: HoldId;
|
|
461
|
+
/** A label supplied by the app for grouping holds. */
|
|
462
|
+
label?: Ref;
|
|
463
|
+
/** When it runs out, set by the server. */
|
|
464
|
+
expiresAt: T;
|
|
465
|
+
/** Whom it holds for. */
|
|
466
|
+
holderRef?: Ref;
|
|
467
|
+
/** What it was placed for, such as the checkout or the order. */
|
|
468
|
+
reference?: Evidence;
|
|
469
|
+
/** One per line asked for, in the same order. */
|
|
470
|
+
lines: HoldLine<T>[];
|
|
471
|
+
/** `expired` from `expiresAt` on if the hold was still open. */
|
|
472
|
+
status: HoldStatus;
|
|
473
|
+
/** Set once the hold is no longer open. */
|
|
474
|
+
resolution?: HoldResolution<T>;
|
|
475
|
+
/** Each cancel of the committed hold, in order. */
|
|
476
|
+
cancellations?: HoldCancellation<T>[];
|
|
477
|
+
sourceKey: string;
|
|
478
|
+
/** The principal that placed it with its own credential. */
|
|
479
|
+
actor: PrincipalRef;
|
|
480
|
+
onBehalfOf?: PrincipalRef;
|
|
481
|
+
createdAt: T;
|
|
482
|
+
updatedAt: T;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* A resolved hold once retention has removed its detail: what its
|
|
486
|
+
* `sourceKey` and its commit's still answer with. Its lines are the ones a
|
|
487
|
+
* commit took from, which stay as the record of what was taken.
|
|
488
|
+
*/
|
|
489
|
+
interface RetainedHold<T = string> {
|
|
490
|
+
id: HoldId;
|
|
491
|
+
/** How it ended. */
|
|
492
|
+
status: Exclude<HoldStatus, 'open'>;
|
|
493
|
+
resolution: HoldResolution<T>;
|
|
494
|
+
sourceKey: string;
|
|
495
|
+
lines: HoldLine<T>[];
|
|
496
|
+
/** When retention removed the rest, including the label, holder, and lines that took nothing. */
|
|
497
|
+
retainedAt: T;
|
|
498
|
+
}
|
|
499
|
+
type HoldCreate = {
|
|
500
|
+
lines: {
|
|
501
|
+
resourceId: string;
|
|
502
|
+
quantity: number;
|
|
503
|
+
scope?: {
|
|
504
|
+
placeId?: string | undefined;
|
|
505
|
+
condition?: string | undefined;
|
|
506
|
+
holderRef?: string | undefined;
|
|
507
|
+
instanceId?: string | undefined;
|
|
508
|
+
} | undefined;
|
|
509
|
+
from?: {
|
|
510
|
+
batchId?: string | undefined;
|
|
511
|
+
supplyId?: string | undefined;
|
|
512
|
+
} | undefined;
|
|
513
|
+
span?: {
|
|
514
|
+
start: string;
|
|
515
|
+
end: string;
|
|
516
|
+
} | undefined;
|
|
517
|
+
}[];
|
|
518
|
+
ttl: string;
|
|
519
|
+
sourceKey: string;
|
|
520
|
+
label?: string | undefined;
|
|
521
|
+
holderRef?: string | undefined;
|
|
522
|
+
reference?: {
|
|
523
|
+
kind: string;
|
|
524
|
+
ref: string;
|
|
525
|
+
} | undefined;
|
|
526
|
+
};
|
|
527
|
+
type HoldExtend = {
|
|
528
|
+
ttl: string;
|
|
529
|
+
};
|
|
530
|
+
type HoldCommit = {
|
|
531
|
+
evidence: {
|
|
532
|
+
kind: string;
|
|
533
|
+
ref: string;
|
|
534
|
+
};
|
|
535
|
+
sourceKey: string;
|
|
536
|
+
lines?: {
|
|
537
|
+
claimId: string;
|
|
538
|
+
quantity: number;
|
|
539
|
+
}[] | undefined;
|
|
540
|
+
};
|
|
541
|
+
type HoldCancel = {
|
|
542
|
+
sourceKey: string;
|
|
543
|
+
lines?: string[] | undefined;
|
|
544
|
+
evidence?: {
|
|
545
|
+
kind: string;
|
|
546
|
+
ref: string;
|
|
547
|
+
} | undefined;
|
|
548
|
+
};
|
|
549
|
+
type HoldReschedule = {
|
|
550
|
+
lines: {
|
|
551
|
+
claimId: string;
|
|
552
|
+
resourceId?: string | undefined;
|
|
553
|
+
scope?: {
|
|
554
|
+
placeId?: string | undefined;
|
|
555
|
+
condition?: string | undefined;
|
|
556
|
+
holderRef?: string | undefined;
|
|
557
|
+
instanceId?: string | undefined;
|
|
558
|
+
} | undefined;
|
|
559
|
+
span?: {
|
|
560
|
+
start: string;
|
|
561
|
+
end: string;
|
|
562
|
+
} | undefined;
|
|
563
|
+
}[];
|
|
564
|
+
sourceKey: string;
|
|
565
|
+
evidence?: {
|
|
566
|
+
kind: string;
|
|
567
|
+
ref: string;
|
|
568
|
+
} | undefined;
|
|
569
|
+
};
|
|
570
|
+
/** The query as a client writes it, before defaults apply. */
|
|
571
|
+
type HoldsQueryInput = {
|
|
572
|
+
holderRef?: string | undefined;
|
|
573
|
+
label?: string | undefined;
|
|
574
|
+
status?: 'committed' | 'released' | 'expired' | 'cancelled' | 'open' | 'partially_committed' | undefined;
|
|
575
|
+
after?: string | undefined;
|
|
576
|
+
limit?: unknown;
|
|
577
|
+
};
|
|
578
|
+
interface HoldResponse<T = string> {
|
|
579
|
+
/** A `RetainedHold`, with `retainedAt`, once retention has removed the hold's detail. */
|
|
580
|
+
hold: Hold<T> | RetainedHold<T>;
|
|
581
|
+
/** Set when the `sourceKey` already named this request: nothing was held again. */
|
|
582
|
+
duplicate?: true;
|
|
583
|
+
}
|
|
584
|
+
interface HoldCommitResponse<T = string> {
|
|
585
|
+
/** A `RetainedHold`, with `retainedAt`, when the commit is repeated after retention has removed the hold's detail. */
|
|
586
|
+
hold: Hold<T> | RetainedHold<T>;
|
|
587
|
+
/** What the commit moved, in the order of the lines: one for each line it took from or let go. */
|
|
588
|
+
movements: Movement<T>[];
|
|
589
|
+
/** Set when the `sourceKey` already named this commit: nothing was taken again. */
|
|
590
|
+
duplicate?: true;
|
|
591
|
+
}
|
|
592
|
+
interface HoldCancelResponse<T = string> {
|
|
593
|
+
/** A `RetainedHold`, with `retainedAt`, when the cancel is repeated after retention has removed the hold's detail. */
|
|
594
|
+
hold: Hold<T> | RetainedHold<T>;
|
|
595
|
+
/** What the cancel gave back, one for each line, in the order the hold lists them: on buckets, its first bucket's. */
|
|
596
|
+
movements: Movement<T>[];
|
|
597
|
+
/** Set when the `sourceKey` already named this cancel: nothing was given back again. */
|
|
598
|
+
duplicate?: true;
|
|
599
|
+
}
|
|
600
|
+
/** Where a hold line sits: its resource, its scope there, and its span. */
|
|
601
|
+
interface LinePosition<T = string> {
|
|
602
|
+
resourceId: ResourceId;
|
|
603
|
+
scope: Scope;
|
|
604
|
+
span: FiniteSpan<T>;
|
|
605
|
+
}
|
|
606
|
+
/** One line a reschedule moved: its hold, and where it sat before and after. */
|
|
607
|
+
interface RescheduledLine<T = string> {
|
|
608
|
+
claimId: ClaimId;
|
|
609
|
+
holdId: HoldId;
|
|
610
|
+
before: LinePosition<T>;
|
|
611
|
+
after: LinePosition<T>;
|
|
612
|
+
}
|
|
613
|
+
interface HoldRescheduleResponse<T = string> {
|
|
614
|
+
/**
|
|
615
|
+
* Each hold a line belongs to, in the order first named, in full and as
|
|
616
|
+
* it now is, which the caller is asked to be allowed to reschedule as a
|
|
617
|
+
* whole. A repeat under the `sourceKey` shows each as it is at the
|
|
618
|
+
* repeat, after any later change, and a `RetainedHold` once retention has
|
|
619
|
+
* removed its detail.
|
|
620
|
+
*/
|
|
621
|
+
holds: (Hold<T> | RetainedHold<T>)[];
|
|
622
|
+
/** The lines that moved, in request order, as they moved then, a repeat included; a line already where it was asked to be isn't listed. */
|
|
623
|
+
lines: RescheduledLine<T>[];
|
|
624
|
+
/** Set when the `sourceKey` already named this reschedule: nothing moved again. */
|
|
625
|
+
duplicate?: true;
|
|
626
|
+
}
|
|
627
|
+
interface HoldsPage<T = string> {
|
|
628
|
+
holds: Hold<T>[];
|
|
629
|
+
next?: string;
|
|
630
|
+
}
|
|
631
|
+
/** What `hold_resolved` carries in `details`: how the hold first ended. */
|
|
632
|
+
interface HoldResolvedDetails<T = string> {
|
|
633
|
+
holdId: HoldId;
|
|
634
|
+
status: Exclude<HoldStatus, 'open'>;
|
|
635
|
+
resolution: HoldResolution<T>;
|
|
636
|
+
}
|
|
637
|
+
/** What `hold_expired` carries in `details`, including availability for a commit while the hold's lines are still kept. */
|
|
638
|
+
interface HoldExpiredDetails<T = string> {
|
|
639
|
+
holdId: HoldId;
|
|
640
|
+
expiresAt: T;
|
|
641
|
+
lines?: {
|
|
642
|
+
claimId: ClaimId;
|
|
643
|
+
resourceId: ResourceId;
|
|
644
|
+
scope: Scope;
|
|
645
|
+
/** What the commit asked to take. */
|
|
646
|
+
quantity: Quantity;
|
|
647
|
+
available: Quantity;
|
|
648
|
+
}[];
|
|
649
|
+
}
|
|
650
|
+
type PlaceId = string;
|
|
651
|
+
type InstanceId = string;
|
|
652
|
+
type ResourceId = string;
|
|
653
|
+
type SupplyId = string;
|
|
654
|
+
type ClaimId = string;
|
|
655
|
+
type MovementId = string;
|
|
656
|
+
type TransferId = string;
|
|
657
|
+
type HoldId = string;
|
|
658
|
+
/** Identifies a batch that supply can name. */
|
|
659
|
+
type BatchId = string;
|
|
660
|
+
/** Identifies the conversion that links its inputs and outputs. */
|
|
661
|
+
type TransformationId = string;
|
|
662
|
+
/** Identifies a dated change to a bucketed resource's capacity. */
|
|
663
|
+
type ExceptionId = string;
|
|
664
|
+
type MovementReason = 'hold' | 'capacity' | 'count' | 'expected' | 'add' | 'release' | 'expire_hold' | 'commit' | 'use' | 'settle' | 'transfer' | 'adjustment' | 'reversal' | 'convert_in' | 'convert_out' | 'expire_supply' | 'cancel';
|
|
665
|
+
/** How one of a balance's quantities moved: signed, with the value before and after. */
|
|
666
|
+
interface QuantityChange {
|
|
667
|
+
quantity: Quantity;
|
|
668
|
+
before: Quantity;
|
|
669
|
+
after: Quantity;
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* How what a balance owes moved. Only a resource that keeps its supply
|
|
673
|
+
* apart and lets its balance go below zero owes: a take beyond what its
|
|
674
|
+
* live entries have takes what they have and owes the rest, which sits on
|
|
675
|
+
* no entry and never expires. Supply that becomes on hand while something
|
|
676
|
+
* is owed pays it first.
|
|
677
|
+
*/
|
|
678
|
+
interface OwedChange extends QuantityChange {
|
|
679
|
+
/** The supply entries whose units paid it down, and how much each paid. What came down without them was a claim's own debt given back. */
|
|
680
|
+
pegs?: Peg[];
|
|
681
|
+
}
|
|
682
|
+
/** The history of one change to a balance. */
|
|
683
|
+
interface Movement<T = string> extends QuantityChange {
|
|
684
|
+
id: MovementId;
|
|
685
|
+
/** The project's movement sequence: every movement in the project, in the order they committed. */
|
|
686
|
+
seq: number;
|
|
687
|
+
resourceId: ResourceId;
|
|
688
|
+
scope: Scope;
|
|
689
|
+
/** The bucket it moved, for a resource whose time is counted in buckets. */
|
|
690
|
+
bucketStart?: T;
|
|
691
|
+
/** How held moved, when it did. */
|
|
692
|
+
held?: QuantityChange;
|
|
693
|
+
expected?: QuantityChange;
|
|
694
|
+
/**
|
|
695
|
+
* How what the balance owes moved, when it did. On a take, what its
|
|
696
|
+
* `pegs` don't cover was owed. On an `add`, what paid it down left the
|
|
697
|
+
* entry at once, so the entry keeps the rest.
|
|
698
|
+
*/
|
|
699
|
+
owed?: OwedChange;
|
|
700
|
+
reason: MovementReason;
|
|
701
|
+
supplyId?: SupplyId;
|
|
702
|
+
/** The supply entries it drew from or returned to. */
|
|
703
|
+
pegs?: Peg[];
|
|
704
|
+
/** Set when everything it moved was from or for the same batch. */
|
|
705
|
+
batchId?: BatchId;
|
|
706
|
+
/** The conversion this movement was part of. */
|
|
707
|
+
transformationId?: TransformationId;
|
|
708
|
+
claimId?: ClaimId;
|
|
709
|
+
holdId?: HoldId;
|
|
710
|
+
transferId?: TransferId;
|
|
711
|
+
reversesId?: MovementId;
|
|
712
|
+
evidence?: Evidence;
|
|
713
|
+
note?: string;
|
|
714
|
+
/** The principal that made the change with its own credential. Your project's secret key is `key:` and the key's name, with no `kind`; ResourceShark's own changes are the `service` principal `resourceshark`. */
|
|
715
|
+
actor: PrincipalRef;
|
|
716
|
+
/** The delegator, when the actor acted under a delegation. */
|
|
717
|
+
onBehalfOf?: PrincipalRef;
|
|
718
|
+
at: T;
|
|
719
|
+
}
|
|
720
|
+
/** The filters and cursor the movement list uses. */
|
|
721
|
+
type MovementsQuery = {
|
|
722
|
+
after: number;
|
|
723
|
+
limit: number;
|
|
724
|
+
resourceId?: string | undefined;
|
|
725
|
+
placeId?: string | undefined;
|
|
726
|
+
holderRef?: string | undefined;
|
|
727
|
+
batchId?: string | undefined;
|
|
728
|
+
instanceId?: string | undefined;
|
|
729
|
+
order?: 'asc' | 'desc' | undefined;
|
|
730
|
+
};
|
|
731
|
+
interface MovementResponse<T = string> {
|
|
732
|
+
movement: Movement<T>;
|
|
733
|
+
}
|
|
734
|
+
interface MovementsPage<T = string> {
|
|
735
|
+
movements: Movement<T>[];
|
|
736
|
+
/** Pass as `after` to continue. The last movement's seq, or `after` on an empty page. */
|
|
737
|
+
next: number;
|
|
738
|
+
}
|
|
739
|
+
/** The selection, period, grouping, and holder a totals read reads. */
|
|
740
|
+
type TotalsQuery = {
|
|
741
|
+
resourceId?: string | undefined;
|
|
742
|
+
tag?: string | undefined;
|
|
743
|
+
from?: string | undefined;
|
|
744
|
+
to?: string | undefined;
|
|
745
|
+
groupBy?: string | undefined;
|
|
746
|
+
holderRef?: string | undefined;
|
|
747
|
+
};
|
|
748
|
+
/** A balance summed over scopes, each scope counted as a balance read counts it: an expired hold holds nothing, and supply past its expiry is not on hand. */
|
|
749
|
+
interface TotalsBalance {
|
|
750
|
+
onHand: Quantity;
|
|
751
|
+
held: Quantity;
|
|
752
|
+
available: Quantity;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Movements summed by reason: for each reason that occurred, the sum of
|
|
756
|
+
* what those movements changed on hand, signed, such as `{ add: 500, use:
|
|
757
|
+
* -150, reversal: -10 }`. A reason that moves only what is held or
|
|
758
|
+
* expected, such as `hold`, sums to 0. On a resource counted in buckets
|
|
759
|
+
* each movement moves one bucket, so a sum counts units times buckets,
|
|
760
|
+
* such as a room for three nights as 3.
|
|
761
|
+
*/
|
|
762
|
+
type MovementSums = Partial<Record<MovementReason, Quantity>>;
|
|
763
|
+
/** The totals of one value of the grouping attribute, or of the entries without it. */
|
|
764
|
+
interface TotalsGroup {
|
|
765
|
+
/** The attribute's value on these entries, or null for the entries that don't carry it. */
|
|
766
|
+
value: string | null;
|
|
767
|
+
/** What these entries have, as the resource's balance counts it. */
|
|
768
|
+
balance: TotalsBalance;
|
|
769
|
+
/** When a period was asked for: what movements in it changed on these entries, by reason. */
|
|
770
|
+
movements?: MovementSums;
|
|
771
|
+
}
|
|
772
|
+
/** One resource's totals. */
|
|
773
|
+
interface ResourceTotals {
|
|
774
|
+
resourceId: ResourceId;
|
|
775
|
+
key: string;
|
|
776
|
+
name: string;
|
|
777
|
+
unit: Unit;
|
|
778
|
+
/**
|
|
779
|
+
* The resource's balance over its scopes, or one holder's. Null on a
|
|
780
|
+
* resource counted in buckets: it has a balance for each bucket of
|
|
781
|
+
* time, and buckets of different times are never added together.
|
|
782
|
+
*/
|
|
783
|
+
balance: TotalsBalance | null;
|
|
784
|
+
/** When a period was asked for: the resource's movements in it, by reason. */
|
|
785
|
+
movements?: MovementSums;
|
|
786
|
+
/**
|
|
787
|
+
* When `groupBy` was asked for: the totals for each value of that
|
|
788
|
+
* attribute on the resource's supply entries, by value and the entries
|
|
789
|
+
* without it last. A unit counts in the group of the entry it sits on,
|
|
790
|
+
* and a movement in the groups of the entries it drew from or added to,
|
|
791
|
+
* so the groups add up to the resource's totals. What a balance owes,
|
|
792
|
+
* and what holds hold beyond its entries, sit on no entry and count in
|
|
793
|
+
* the null group, and so does what is available on a balance that has
|
|
794
|
+
* either. Null on a resource that
|
|
795
|
+
* keeps one running balance or counts in buckets: it keeps no supply
|
|
796
|
+
* entries apart, so there is nothing to group by.
|
|
797
|
+
*/
|
|
798
|
+
groups?: TotalsGroup[] | null;
|
|
799
|
+
}
|
|
800
|
+
/** Sums for each selected resource. */
|
|
801
|
+
interface TotalsReport<T = string> {
|
|
802
|
+
/** When the totals were read. A balance counts what had expired by then; a write that landed while the read ran may or may not be counted. */
|
|
803
|
+
asOf: T;
|
|
804
|
+
/** The period, when one was asked for. `from` is in it and `to` is not. */
|
|
805
|
+
from?: T;
|
|
806
|
+
to?: T;
|
|
807
|
+
groupBy?: string;
|
|
808
|
+
/** Your app's name for the holder, such as `principal:external:u_maya`. */
|
|
809
|
+
holderRef?: Ref;
|
|
810
|
+
/** The resources the selection matched, in the order they were created. */
|
|
811
|
+
resources: ResourceTotals[];
|
|
812
|
+
}
|
|
813
|
+
type ResourceCreate = {
|
|
814
|
+
key: string;
|
|
815
|
+
name: string;
|
|
816
|
+
unit: {
|
|
817
|
+
code: string;
|
|
818
|
+
singular: string;
|
|
819
|
+
plural: string;
|
|
820
|
+
precision: number;
|
|
821
|
+
};
|
|
822
|
+
settings: {
|
|
823
|
+
time: 'none' | 'buckets';
|
|
824
|
+
identity: 'count' | 'instance';
|
|
825
|
+
supplyExpiry: 'none' | 'expiring';
|
|
826
|
+
bucket?: {
|
|
827
|
+
size: 'step';
|
|
828
|
+
stepMinutes: number;
|
|
829
|
+
timeZone: string;
|
|
830
|
+
} | {
|
|
831
|
+
size: 'day' | 'month';
|
|
832
|
+
timeZone: string;
|
|
833
|
+
stepMinutes?: number | undefined;
|
|
834
|
+
} | undefined;
|
|
835
|
+
};
|
|
836
|
+
scope: {
|
|
837
|
+
places: boolean;
|
|
838
|
+
holders: boolean;
|
|
839
|
+
};
|
|
840
|
+
tracking: 'batch' | 'none';
|
|
841
|
+
shortage: 'deny' | 'backorder' | 'negative';
|
|
842
|
+
capacity?: number | undefined;
|
|
843
|
+
tags?: string[] | undefined;
|
|
844
|
+
attributes?: Record<string, string> | undefined;
|
|
845
|
+
contentRef?: string | undefined;
|
|
846
|
+
externalRef?: string | undefined;
|
|
847
|
+
};
|
|
848
|
+
type ResourcePatch = {
|
|
849
|
+
key?: string | undefined;
|
|
850
|
+
name?: string | undefined;
|
|
851
|
+
tracking?: 'batch' | 'none' | undefined;
|
|
852
|
+
shortage?: 'deny' | 'backorder' | 'negative' | undefined;
|
|
853
|
+
settings?: {
|
|
854
|
+
time?: 'none' | 'buckets' | undefined;
|
|
855
|
+
identity?: 'count' | 'instance' | undefined;
|
|
856
|
+
supplyExpiry?: 'none' | 'expiring' | undefined;
|
|
857
|
+
bucket?: {
|
|
858
|
+
size: 'step';
|
|
859
|
+
stepMinutes: number;
|
|
860
|
+
timeZone: string;
|
|
861
|
+
} | {
|
|
862
|
+
size: 'day' | 'month';
|
|
863
|
+
timeZone: string;
|
|
864
|
+
stepMinutes?: number | undefined;
|
|
865
|
+
} | null | undefined;
|
|
866
|
+
} | undefined;
|
|
867
|
+
scope?: {
|
|
868
|
+
places?: boolean | undefined;
|
|
869
|
+
holders?: boolean | undefined;
|
|
870
|
+
} | undefined;
|
|
871
|
+
unit?: {
|
|
872
|
+
code?: string | undefined;
|
|
873
|
+
singular?: string | undefined;
|
|
874
|
+
plural?: string | undefined;
|
|
875
|
+
precision?: number | undefined;
|
|
876
|
+
} | undefined;
|
|
877
|
+
capacity?: number | null | undefined;
|
|
878
|
+
attributes?: Record<string, string> | null | undefined;
|
|
879
|
+
contentRef?: string | null | undefined;
|
|
880
|
+
externalRef?: string | null | undefined;
|
|
881
|
+
tags?: string[] | undefined;
|
|
882
|
+
};
|
|
883
|
+
type ResourceDefinition = {
|
|
884
|
+
key: string;
|
|
885
|
+
name: string;
|
|
886
|
+
unit: {
|
|
887
|
+
code: string;
|
|
888
|
+
singular: string;
|
|
889
|
+
plural: string;
|
|
890
|
+
precision: number;
|
|
891
|
+
};
|
|
892
|
+
settings: {
|
|
893
|
+
time: 'none' | 'buckets';
|
|
894
|
+
identity: 'count' | 'instance';
|
|
895
|
+
supplyExpiry: 'none' | 'expiring';
|
|
896
|
+
bucket?: {
|
|
897
|
+
size: 'step';
|
|
898
|
+
stepMinutes: number;
|
|
899
|
+
timeZone: string;
|
|
900
|
+
} | {
|
|
901
|
+
size: 'day' | 'month';
|
|
902
|
+
timeZone: string;
|
|
903
|
+
stepMinutes?: number | undefined;
|
|
904
|
+
} | undefined;
|
|
905
|
+
};
|
|
906
|
+
scope: {
|
|
907
|
+
places: boolean;
|
|
908
|
+
holders: boolean;
|
|
909
|
+
};
|
|
910
|
+
tracking: 'batch' | 'none';
|
|
911
|
+
shortage: 'deny' | 'backorder' | 'negative';
|
|
912
|
+
tags: string[];
|
|
913
|
+
capacity?: number | undefined;
|
|
914
|
+
attributes?: Record<string, string> | undefined;
|
|
915
|
+
contentRef?: string | undefined;
|
|
916
|
+
externalRef?: string | undefined;
|
|
917
|
+
};
|
|
918
|
+
interface Resource<T = string> extends Omit<ResourceDefinition, 'capacity'> {
|
|
919
|
+
id: ResourceId;
|
|
920
|
+
capacity?: Quantity;
|
|
921
|
+
version: number;
|
|
922
|
+
archivedAt?: T;
|
|
923
|
+
}
|
|
924
|
+
type PlacesQuery = {
|
|
925
|
+
limit: number;
|
|
926
|
+
after?: string | undefined;
|
|
927
|
+
};
|
|
928
|
+
type ResourcesQuery = {
|
|
929
|
+
limit: number;
|
|
930
|
+
after?: string | undefined;
|
|
931
|
+
key?: string | undefined;
|
|
932
|
+
tag?: string | undefined;
|
|
933
|
+
};
|
|
934
|
+
type InstancesQuery = {
|
|
935
|
+
limit: number;
|
|
936
|
+
after?: string | undefined;
|
|
937
|
+
code?: string | undefined;
|
|
938
|
+
};
|
|
939
|
+
type FreeInstancesQuery = {
|
|
940
|
+
limit: number;
|
|
941
|
+
after?: string | undefined;
|
|
942
|
+
placeId?: string | undefined;
|
|
943
|
+
condition?: string | undefined;
|
|
944
|
+
holderRef?: string | undefined;
|
|
945
|
+
from?: string | undefined;
|
|
946
|
+
to?: string | undefined;
|
|
947
|
+
};
|
|
948
|
+
interface ResourceResponse<T = string> {
|
|
949
|
+
resource: Resource<T>;
|
|
950
|
+
/** With a change to a bucketed resource's `capacity`: the buckets now over it. */
|
|
951
|
+
overCapacity?: OverCapacity<T>;
|
|
952
|
+
}
|
|
953
|
+
interface ResourcesPage<T = string> {
|
|
954
|
+
resources: Resource<T>[];
|
|
955
|
+
next?: string;
|
|
956
|
+
}
|
|
957
|
+
type PlaceCreate = {
|
|
958
|
+
key: string;
|
|
959
|
+
name: string;
|
|
960
|
+
attributes?: Record<string, string> | undefined;
|
|
961
|
+
};
|
|
962
|
+
type PlacePatch = {
|
|
963
|
+
key?: string | undefined;
|
|
964
|
+
name?: string | undefined;
|
|
965
|
+
attributes?: Record<string, string> | null | undefined;
|
|
966
|
+
};
|
|
967
|
+
interface Place extends PlaceCreate {
|
|
968
|
+
id: PlaceId;
|
|
969
|
+
}
|
|
970
|
+
interface PlaceResponse {
|
|
971
|
+
place: Place;
|
|
972
|
+
}
|
|
973
|
+
interface PlacesPage {
|
|
974
|
+
places: Place[];
|
|
975
|
+
next?: string;
|
|
976
|
+
}
|
|
977
|
+
/** A period an instance is unavailable and counts toward no capacity. Half-open, with a finite end. */
|
|
978
|
+
interface UnavailableSpan<T = string> {
|
|
979
|
+
start: T;
|
|
980
|
+
end: T;
|
|
981
|
+
}
|
|
982
|
+
type InstanceCreate = {
|
|
983
|
+
code: string;
|
|
984
|
+
status: 'active' | 'retired';
|
|
985
|
+
unavailable?: {
|
|
986
|
+
start: string;
|
|
987
|
+
end: string;
|
|
988
|
+
}[] | undefined;
|
|
989
|
+
attributes?: Record<string, string> | undefined;
|
|
990
|
+
};
|
|
991
|
+
type InstancePatch = {
|
|
992
|
+
code?: string | undefined;
|
|
993
|
+
status?: 'active' | 'retired' | undefined;
|
|
994
|
+
unavailable?: {
|
|
995
|
+
start: string;
|
|
996
|
+
end: string;
|
|
997
|
+
}[] | null | undefined;
|
|
998
|
+
attributes?: Record<string, string> | null | undefined;
|
|
999
|
+
};
|
|
1000
|
+
interface Instance<T = string> extends Omit<InstanceCreate, 'unavailable'> {
|
|
1001
|
+
id: InstanceId;
|
|
1002
|
+
resourceId: ResourceId;
|
|
1003
|
+
unavailable?: UnavailableSpan<T>[];
|
|
1004
|
+
}
|
|
1005
|
+
interface InstanceResponse<T = string> {
|
|
1006
|
+
instance: Instance<T>;
|
|
1007
|
+
/** With a change to the status or unavailable spans of an instance of a bucketed resource: the buckets now over capacity. */
|
|
1008
|
+
overCapacity?: OverCapacity<T>;
|
|
1009
|
+
}
|
|
1010
|
+
/** A page of instances. A page of free units reads at most `MAX_FREE_SCAN` units, so it can hold fewer than `limit`, even none, and still give `next`. */
|
|
1011
|
+
interface InstancesPage<T = string> {
|
|
1012
|
+
instances: Instance<T>[];
|
|
1013
|
+
next?: string;
|
|
1014
|
+
}
|
|
1015
|
+
type SchedulePut = {
|
|
1016
|
+
patterns: {
|
|
1017
|
+
weekly: {
|
|
1018
|
+
day: number;
|
|
1019
|
+
start: string;
|
|
1020
|
+
end: string;
|
|
1021
|
+
capacity?: number | undefined;
|
|
1022
|
+
}[];
|
|
1023
|
+
from?: string | undefined;
|
|
1024
|
+
}[];
|
|
1025
|
+
timeZone?: string | undefined;
|
|
1026
|
+
};
|
|
1027
|
+
/** One weekly window, in the schedule's time zone. */
|
|
1028
|
+
interface WeeklyWindow {
|
|
1029
|
+
day: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
1030
|
+
/** `HH:MM`. */
|
|
1031
|
+
start: string;
|
|
1032
|
+
/** `HH:MM`, or `24:00` for the end of the day. */
|
|
1033
|
+
end: string;
|
|
1034
|
+
capacity?: Quantity;
|
|
1035
|
+
}
|
|
1036
|
+
/** A normal week, in effect from `from` until the next pattern starts. */
|
|
1037
|
+
interface WeeklyPattern {
|
|
1038
|
+
/** `YYYY-MM-DD` in the schedule's time zone. Missing on the first pattern. */
|
|
1039
|
+
from?: string;
|
|
1040
|
+
weekly: WeeklyWindow[];
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* A resource's normal week. A bucket takes the pattern in effect on the
|
|
1044
|
+
* local date it starts on, in the schedule's time zone. Inside that
|
|
1045
|
+
* pattern's hours a bucket holds its window's `capacity`, else the
|
|
1046
|
+
* resource's `capacity`, else as many of the resource's active instances
|
|
1047
|
+
* as are not unavailable for any part of it, else 0; outside them it holds
|
|
1048
|
+
* nothing. A pattern with no windows puts no limit on the hours. A step
|
|
1049
|
+
* bucket is inside the hours when one window holds all of it. A day is
|
|
1050
|
+
* inside them when a window falls on its weekday, and holds the largest
|
|
1051
|
+
* capacity that day's windows give. A month is longer than any window, so
|
|
1052
|
+
* patterns don't apply to it: it holds the resource's own capacity. An
|
|
1053
|
+
* exception then replaces what the pattern gives (`ScheduleException`).
|
|
1054
|
+
*
|
|
1055
|
+
* A pattern that has taken effect, `from` today or earlier, stays as it
|
|
1056
|
+
* is: a save changes, adds, or removes only patterns from tomorrow on.
|
|
1057
|
+
*/
|
|
1058
|
+
interface Schedule<T = string> {
|
|
1059
|
+
resourceId: ResourceId;
|
|
1060
|
+
timeZone: string;
|
|
1061
|
+
patterns: WeeklyPattern[];
|
|
1062
|
+
/** Moves with every save; send it in `If-Match` to save again. */
|
|
1063
|
+
version: number;
|
|
1064
|
+
updatedAt: T;
|
|
1065
|
+
}
|
|
1066
|
+
/** One claim in a bucket over capacity. */
|
|
1067
|
+
interface OverCapacityClaim {
|
|
1068
|
+
id: ClaimId;
|
|
1069
|
+
kind: 'hold' | 'consumption' | 'booking';
|
|
1070
|
+
/** `held` or `committed`. */
|
|
1071
|
+
status: 'held' | 'committed' | 'released' | 'expired' | 'cancelled';
|
|
1072
|
+
/** What it holds, or what it took. */
|
|
1073
|
+
quantity: Quantity;
|
|
1074
|
+
holdId?: HoldId;
|
|
1075
|
+
/** Your app's name for the holder, such as `principal:external:u_maya`. */
|
|
1076
|
+
holderRef?: Ref;
|
|
1077
|
+
}
|
|
1078
|
+
/** A bucket where what is held and taken is more than its capacity. */
|
|
1079
|
+
interface OverCapacityBucket<T = string> {
|
|
1080
|
+
span: FiniteSpan<T>;
|
|
1081
|
+
scope: Scope;
|
|
1082
|
+
capacity: Quantity;
|
|
1083
|
+
/** What bookings took. */
|
|
1084
|
+
taken: Quantity;
|
|
1085
|
+
/** What holds not past their expiry hold. */
|
|
1086
|
+
held: Quantity;
|
|
1087
|
+
/** Every claim in it, so your app can choose which to move, release, or cancel. */
|
|
1088
|
+
claims: OverCapacityClaim[];
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* What a change that moves capacity leaves over it, in buckets that have
|
|
1092
|
+
* not ended, nearest first. `more` is true when there may be more than the
|
|
1093
|
+
* answer lists: past `MAX_OVER_CAPACITY_BUCKETS` buckets or
|
|
1094
|
+
* `MAX_OVER_CAPACITY_CLAIMS` claims, or past the nearest 1,000 buckets a
|
|
1095
|
+
* claim has touched. `GET /slots` and `GET /claims` over a range read the
|
|
1096
|
+
* rest.
|
|
1097
|
+
*/
|
|
1098
|
+
interface OverCapacity<T = string> {
|
|
1099
|
+
buckets: OverCapacityBucket<T>[];
|
|
1100
|
+
more: boolean;
|
|
1101
|
+
}
|
|
1102
|
+
interface ScheduleResponse<T = string> {
|
|
1103
|
+
schedule: Schedule<T>;
|
|
1104
|
+
}
|
|
1105
|
+
interface ScheduleSaveResponse<T = string> extends ScheduleResponse<T> {
|
|
1106
|
+
overCapacity: OverCapacity<T>;
|
|
1107
|
+
}
|
|
1108
|
+
type ExceptionCreate = {
|
|
1109
|
+
span: {
|
|
1110
|
+
start: string;
|
|
1111
|
+
end: string;
|
|
1112
|
+
};
|
|
1113
|
+
capacity: number;
|
|
1114
|
+
sourceKey: string;
|
|
1115
|
+
reason?: string | undefined;
|
|
1116
|
+
};
|
|
1117
|
+
type ExceptionPatch = {
|
|
1118
|
+
span?: {
|
|
1119
|
+
start: string;
|
|
1120
|
+
end: string;
|
|
1121
|
+
} | undefined;
|
|
1122
|
+
capacity?: number | undefined;
|
|
1123
|
+
reason?: string | null | undefined;
|
|
1124
|
+
};
|
|
1125
|
+
interface ScheduleException<T = string> {
|
|
1126
|
+
id: ExceptionId;
|
|
1127
|
+
resourceId: ResourceId;
|
|
1128
|
+
span: FiniteSpan<T>;
|
|
1129
|
+
capacity: Quantity;
|
|
1130
|
+
reason?: string;
|
|
1131
|
+
/** Moves with every change; send it in `If-Match` to change it. */
|
|
1132
|
+
version: number;
|
|
1133
|
+
createdAt: T;
|
|
1134
|
+
updatedAt: T;
|
|
1135
|
+
}
|
|
1136
|
+
interface ExceptionResponse<T = string> {
|
|
1137
|
+
exception: ScheduleException<T>;
|
|
1138
|
+
overCapacity: OverCapacity<T>;
|
|
1139
|
+
}
|
|
1140
|
+
interface ExceptionCreateResponse<T = string> extends ExceptionResponse<T> {
|
|
1141
|
+
/** Set when the source key already named this request. */
|
|
1142
|
+
duplicate?: true;
|
|
1143
|
+
}
|
|
1144
|
+
interface ExceptionDeleteResponse<T = string> {
|
|
1145
|
+
overCapacity: OverCapacity<T>;
|
|
1146
|
+
}
|
|
1147
|
+
type ExceptionsQuery = {
|
|
1148
|
+
from?: string | undefined;
|
|
1149
|
+
to?: string | undefined;
|
|
1150
|
+
};
|
|
1151
|
+
/** At most `MAX_EXCEPTIONS`, so one answer holds them all, by start. */
|
|
1152
|
+
interface ExceptionsList<T = string> {
|
|
1153
|
+
exceptions: ScheduleException<T>[];
|
|
1154
|
+
}
|
|
1155
|
+
type SlotsQuery = {
|
|
1156
|
+
resourceId: string;
|
|
1157
|
+
from: string;
|
|
1158
|
+
to: string;
|
|
1159
|
+
placeId?: string | undefined;
|
|
1160
|
+
condition?: string | undefined;
|
|
1161
|
+
instanceId?: string | undefined;
|
|
1162
|
+
};
|
|
1163
|
+
/**
|
|
1164
|
+
* One bucket a claim can take, or one over capacity, with what it holds
|
|
1165
|
+
* and what is free. A bucket with no capacity is not a slot unless claims
|
|
1166
|
+
* are still in it. Where a daylight-saving change repeats an hour, both of
|
|
1167
|
+
* its buckets are slots with the same local time.
|
|
1168
|
+
*/
|
|
1169
|
+
interface Slot<T = string> {
|
|
1170
|
+
start: T;
|
|
1171
|
+
end: T;
|
|
1172
|
+
/** The resource's bucket time zone. */
|
|
1173
|
+
timeZone: string;
|
|
1174
|
+
/** Where the slot starts, on the local calendar and clock. */
|
|
1175
|
+
local: {
|
|
1176
|
+
date: string;
|
|
1177
|
+
time: string;
|
|
1178
|
+
};
|
|
1179
|
+
/** What the schedule gives the bucket. */
|
|
1180
|
+
capacity: Quantity;
|
|
1181
|
+
/** What bookings took. */
|
|
1182
|
+
taken: Quantity;
|
|
1183
|
+
/** What holds not past their expiry hold. */
|
|
1184
|
+
held: Quantity;
|
|
1185
|
+
/** Capacity less what is held and taken, and never below 0: the bucket is over capacity when `taken` and `held` come to more than `capacity`. */
|
|
1186
|
+
available: Quantity;
|
|
1187
|
+
}
|
|
1188
|
+
interface SlotsResponse<T = string> {
|
|
1189
|
+
slots: Slot<T>[];
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* An integer in the resource's base unit at its precision, as money is in
|
|
1193
|
+
* cents: grams at precision 0, meters at precision 2, so 1 is 1 cm. A
|
|
1194
|
+
* quantity with a fraction is refused with `invalid_quantity`.
|
|
1195
|
+
*/
|
|
1196
|
+
type Quantity = number;
|
|
1197
|
+
/** How much a claim or movement drew from one supply entry. */
|
|
1198
|
+
interface Peg {
|
|
1199
|
+
supplyId: SupplyId;
|
|
1200
|
+
quantity: Quantity;
|
|
1201
|
+
}
|
|
1202
|
+
/** An opaque reference to another system's record, such as `ord_01J…`. ResourceShark stores it and answers with it. */
|
|
1203
|
+
type Ref = string;
|
|
1204
|
+
/** What a change was made for, such as `{ kind: "order", ref: "ord_…" }`. */
|
|
1205
|
+
interface Evidence {
|
|
1206
|
+
kind: string;
|
|
1207
|
+
ref: Ref;
|
|
1208
|
+
}
|
|
1209
|
+
/** Half-open, `[start, end)`, in UTC. A null `end` is open-ended. */
|
|
1210
|
+
interface Span<T = string> {
|
|
1211
|
+
start: T;
|
|
1212
|
+
end: T | null;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Where a quantity sits. Each resource says which dimensions apply: stock
|
|
1216
|
+
* has places, prepaid credits have holders, and a resource with
|
|
1217
|
+
* `identity: instance` has units. A resource kept by place requires a
|
|
1218
|
+
* `placeId` and can carry a free-form condition label. Omitting the
|
|
1219
|
+
* condition selects the unlabeled balance. A resource that tells its units
|
|
1220
|
+
* apart requires an `instanceId`: each unit has a balance of its own, in
|
|
1221
|
+
* one place and under one label at a time, and a line on it moves one unit.
|
|
1222
|
+
*/
|
|
1223
|
+
interface Scope {
|
|
1224
|
+
placeId?: PlaceId;
|
|
1225
|
+
condition?: string;
|
|
1226
|
+
/** Your app's name for the holder, such as `principal:external:u_maya`. */
|
|
1227
|
+
holderRef?: Ref;
|
|
1228
|
+
instanceId?: InstanceId;
|
|
1229
|
+
}
|
|
1230
|
+
/** A resource's base unit, with its labels and its precision: the number of decimal places one unit of `Quantity` stands for. */
|
|
1231
|
+
interface Unit {
|
|
1232
|
+
code: string;
|
|
1233
|
+
singular: string;
|
|
1234
|
+
plural: string;
|
|
1235
|
+
precision: number;
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* The business's own labels. ResourceShark stores them and answers with them.
|
|
1239
|
+
*/
|
|
1240
|
+
type Attributes = Record<string, string>;
|
|
1241
|
+
/** Half-open, `[start, end)`, in UTC, with an end. */
|
|
1242
|
+
interface FiniteSpan<T = string> {
|
|
1243
|
+
start: T;
|
|
1244
|
+
end: T;
|
|
1245
|
+
}
|
|
1246
|
+
/** What a caller sends to move stock between scopes. */
|
|
1247
|
+
type TransferCreate = {
|
|
1248
|
+
resourceId: string;
|
|
1249
|
+
from: {
|
|
1250
|
+
placeId?: string | undefined;
|
|
1251
|
+
condition?: string | undefined;
|
|
1252
|
+
holderRef?: string | undefined;
|
|
1253
|
+
instanceId?: string | undefined;
|
|
1254
|
+
batchId?: string | undefined;
|
|
1255
|
+
supplyId?: string | undefined;
|
|
1256
|
+
};
|
|
1257
|
+
to: {
|
|
1258
|
+
placeId?: string | undefined;
|
|
1259
|
+
condition?: string | undefined;
|
|
1260
|
+
holderRef?: string | undefined;
|
|
1261
|
+
instanceId?: string | undefined;
|
|
1262
|
+
};
|
|
1263
|
+
quantity: number;
|
|
1264
|
+
sourceKey: string;
|
|
1265
|
+
evidence?: {
|
|
1266
|
+
kind: string;
|
|
1267
|
+
ref: string;
|
|
1268
|
+
} | undefined;
|
|
1269
|
+
note?: string | undefined;
|
|
1270
|
+
};
|
|
1271
|
+
/** What a caller sends to record a count. */
|
|
1272
|
+
type CountCreate = {
|
|
1273
|
+
version: number;
|
|
1274
|
+
resourceId: string;
|
|
1275
|
+
scope: {
|
|
1276
|
+
placeId?: string | undefined;
|
|
1277
|
+
condition?: string | undefined;
|
|
1278
|
+
holderRef?: string | undefined;
|
|
1279
|
+
instanceId?: string | undefined;
|
|
1280
|
+
};
|
|
1281
|
+
quantity: number;
|
|
1282
|
+
evidence?: {
|
|
1283
|
+
kind: string;
|
|
1284
|
+
ref: string;
|
|
1285
|
+
} | undefined;
|
|
1286
|
+
note?: string | undefined;
|
|
1287
|
+
from?: {
|
|
1288
|
+
batchId?: string | undefined;
|
|
1289
|
+
supplyId?: string | undefined;
|
|
1290
|
+
} | undefined;
|
|
1291
|
+
};
|
|
1292
|
+
/** What a caller sends to adjust or reverse stock. */
|
|
1293
|
+
type AdjustmentCreate = {
|
|
1294
|
+
note: string;
|
|
1295
|
+
sourceKey: string;
|
|
1296
|
+
resourceId: string;
|
|
1297
|
+
scope: {
|
|
1298
|
+
placeId?: string | undefined;
|
|
1299
|
+
condition?: string | undefined;
|
|
1300
|
+
holderRef?: string | undefined;
|
|
1301
|
+
instanceId?: string | undefined;
|
|
1302
|
+
};
|
|
1303
|
+
quantity: number;
|
|
1304
|
+
evidence?: {
|
|
1305
|
+
kind: string;
|
|
1306
|
+
ref: string;
|
|
1307
|
+
} | undefined;
|
|
1308
|
+
from?: {
|
|
1309
|
+
batchId?: string | undefined;
|
|
1310
|
+
supplyId?: string | undefined;
|
|
1311
|
+
} | undefined;
|
|
1312
|
+
} | {
|
|
1313
|
+
reverses: string;
|
|
1314
|
+
sourceKey: string;
|
|
1315
|
+
evidence?: {
|
|
1316
|
+
kind: string;
|
|
1317
|
+
ref: string;
|
|
1318
|
+
} | undefined;
|
|
1319
|
+
note?: string | undefined;
|
|
1320
|
+
};
|
|
1321
|
+
/** What a caller sends to record a conversion. */
|
|
1322
|
+
type TransformationCreate = {
|
|
1323
|
+
takes: {
|
|
1324
|
+
resourceId: string;
|
|
1325
|
+
quantity: number;
|
|
1326
|
+
scope?: {
|
|
1327
|
+
placeId?: string | undefined;
|
|
1328
|
+
condition?: string | undefined;
|
|
1329
|
+
holderRef?: string | undefined;
|
|
1330
|
+
instanceId?: string | undefined;
|
|
1331
|
+
} | undefined;
|
|
1332
|
+
from?: {
|
|
1333
|
+
batchId?: string | undefined;
|
|
1334
|
+
supplyId?: string | undefined;
|
|
1335
|
+
} | undefined;
|
|
1336
|
+
span?: {
|
|
1337
|
+
start: string;
|
|
1338
|
+
end: string;
|
|
1339
|
+
} | undefined;
|
|
1340
|
+
}[];
|
|
1341
|
+
adds: {
|
|
1342
|
+
resourceId: string;
|
|
1343
|
+
quantity: number;
|
|
1344
|
+
scope?: {
|
|
1345
|
+
placeId?: string | undefined;
|
|
1346
|
+
condition?: string | undefined;
|
|
1347
|
+
holderRef?: string | undefined;
|
|
1348
|
+
instanceId?: string | undefined;
|
|
1349
|
+
} | undefined;
|
|
1350
|
+
batchId?: string | undefined;
|
|
1351
|
+
batch?: {
|
|
1352
|
+
code: string;
|
|
1353
|
+
expiresAt?: string | undefined;
|
|
1354
|
+
attributes?: Record<string, string> | undefined;
|
|
1355
|
+
} | undefined;
|
|
1356
|
+
expiresAt?: string | undefined;
|
|
1357
|
+
attributes?: Record<string, string> | undefined;
|
|
1358
|
+
}[];
|
|
1359
|
+
evidence: {
|
|
1360
|
+
kind: string;
|
|
1361
|
+
ref: string;
|
|
1362
|
+
};
|
|
1363
|
+
sourceKey: string;
|
|
1364
|
+
};
|
|
1365
|
+
/** The record that links a conversion's inputs, outputs, and evidence. */
|
|
1366
|
+
interface Transformation<T = string> {
|
|
1367
|
+
id: TransformationId;
|
|
1368
|
+
takes: {
|
|
1369
|
+
claimId: ClaimId;
|
|
1370
|
+
movementId: MovementId;
|
|
1371
|
+
}[];
|
|
1372
|
+
adds: {
|
|
1373
|
+
supplyId: SupplyId;
|
|
1374
|
+
movementId: MovementId;
|
|
1375
|
+
}[];
|
|
1376
|
+
evidence: Evidence;
|
|
1377
|
+
sourceKey: string;
|
|
1378
|
+
actor: PrincipalRef;
|
|
1379
|
+
onBehalfOf?: PrincipalRef;
|
|
1380
|
+
createdAt: T;
|
|
1381
|
+
}
|
|
1382
|
+
/** A conversion with the movements and the supply it added. */
|
|
1383
|
+
interface TransformationResponse<T = string> {
|
|
1384
|
+
transformation: Transformation<T>;
|
|
1385
|
+
movements: Movement<T>[];
|
|
1386
|
+
supply: SupplyEntry<T>[];
|
|
1387
|
+
/** Set when the source key already named this request. */
|
|
1388
|
+
duplicate?: true;
|
|
1389
|
+
}
|
|
1390
|
+
interface TransferResponse<T = string> {
|
|
1391
|
+
transferId: TransferId;
|
|
1392
|
+
/** The movement out, then the movement in. */
|
|
1393
|
+
movements: [Movement<T>, Movement<T>];
|
|
1394
|
+
/** Set when the source key already named this request. */
|
|
1395
|
+
duplicate?: true;
|
|
1396
|
+
}
|
|
1397
|
+
interface CountResponse<T = string> {
|
|
1398
|
+
onHand: Quantity;
|
|
1399
|
+
version: number;
|
|
1400
|
+
movement?: Movement<T>;
|
|
1401
|
+
}
|
|
1402
|
+
interface AdjustmentResponse<T = string> {
|
|
1403
|
+
movement: Movement<T>;
|
|
1404
|
+
duplicate?: true;
|
|
1405
|
+
}
|
|
1406
|
+
type SupplyKind = 'output' | 'added' | 'expected';
|
|
1407
|
+
/** What arrived or is expected, and what remains of it. */
|
|
1408
|
+
interface SupplyEntry<T = string> {
|
|
1409
|
+
id: SupplyId;
|
|
1410
|
+
resourceId: ResourceId;
|
|
1411
|
+
/** The scope it was added to. */
|
|
1412
|
+
scope: Scope;
|
|
1413
|
+
kind: SupplyKind;
|
|
1414
|
+
quantity: Quantity;
|
|
1415
|
+
/**
|
|
1416
|
+
* What is free to take when pegging applies. Together with held, it is
|
|
1417
|
+
* what the entry still has. For expected supply it is what is still
|
|
1418
|
+
* due; for added supply that has not started, what will be on hand
|
|
1419
|
+
* when it does; and otherwise it is the quantity the entry was made
|
|
1420
|
+
* with. Where the balance owed something when the entry became on hand,
|
|
1421
|
+
* what paid it is not remaining: one whose start has come reads so
|
|
1422
|
+
* whether or not anything has landed it.
|
|
1423
|
+
*/
|
|
1424
|
+
remaining: Quantity;
|
|
1425
|
+
/** What open holds have pegged here, or zero when pegging does not apply. */
|
|
1426
|
+
held: Quantity;
|
|
1427
|
+
/** The expected entry this added entry fulfils. */
|
|
1428
|
+
fulfils?: SupplyId;
|
|
1429
|
+
/** For expected supply, when it is due. For added supply, when it starts: set when it was added to start later than it landed. */
|
|
1430
|
+
validFrom?: T;
|
|
1431
|
+
/** When what it has left stops being on hand. */
|
|
1432
|
+
expiresAt?: T;
|
|
1433
|
+
batchId?: BatchId;
|
|
1434
|
+
/** The business's own labels for this entry. ResourceShark stores them and answers with them. */
|
|
1435
|
+
attributes?: Attributes;
|
|
1436
|
+
/** Lower numbers are drawn first; a missing value counts as 0. */
|
|
1437
|
+
drawOrder?: number;
|
|
1438
|
+
evidence: Evidence;
|
|
1439
|
+
sourceKey: string;
|
|
1440
|
+
actor: PrincipalRef;
|
|
1441
|
+
onBehalfOf?: PrincipalRef;
|
|
1442
|
+
status: 'expired' | 'exhausted' | 'active' | 'pending' | 'reversed';
|
|
1443
|
+
createdAt: T;
|
|
1444
|
+
}
|
|
1445
|
+
/** The request as a client writes it, before defaults apply. */
|
|
1446
|
+
type SupplyCreateInput = {
|
|
1447
|
+
resourceId: string;
|
|
1448
|
+
kind: 'added' | 'expected';
|
|
1449
|
+
quantity: number;
|
|
1450
|
+
evidence: {
|
|
1451
|
+
kind: string;
|
|
1452
|
+
ref: string;
|
|
1453
|
+
};
|
|
1454
|
+
sourceKey: string;
|
|
1455
|
+
scope?: {
|
|
1456
|
+
placeId?: string | undefined;
|
|
1457
|
+
condition?: string | undefined;
|
|
1458
|
+
holderRef?: string | undefined;
|
|
1459
|
+
instanceId?: string | undefined;
|
|
1460
|
+
} | undefined;
|
|
1461
|
+
validFrom?: string | undefined;
|
|
1462
|
+
expiresAt?: string | undefined;
|
|
1463
|
+
drawOrder?: number | undefined;
|
|
1464
|
+
batchId?: string | undefined;
|
|
1465
|
+
fulfils?: string | undefined;
|
|
1466
|
+
attributes?: Record<string, string> | undefined;
|
|
1467
|
+
batch?: {
|
|
1468
|
+
code: string;
|
|
1469
|
+
expiresAt?: string | undefined;
|
|
1470
|
+
attributes?: Record<string, string> | undefined;
|
|
1471
|
+
} | undefined;
|
|
1472
|
+
};
|
|
1473
|
+
/** What a supply write recorded, with its movement when there is one. */
|
|
1474
|
+
interface SupplyResponse<T = string> {
|
|
1475
|
+
supply: SupplyEntry<T>;
|
|
1476
|
+
/** The movement that recorded what arrived or is expected. */
|
|
1477
|
+
movement?: Movement<T>;
|
|
1478
|
+
/** Set when the `sourceKey` already named this request: nothing was added again. */
|
|
1479
|
+
duplicate?: true;
|
|
1480
|
+
}
|
|
1481
|
+
/** The filters and page size the supply list uses. */
|
|
1482
|
+
type SupplyQuery = {
|
|
1483
|
+
limit: number;
|
|
1484
|
+
resourceId?: string | undefined;
|
|
1485
|
+
holderRef?: string | undefined;
|
|
1486
|
+
batchId?: string | undefined;
|
|
1487
|
+
status?: 'expired' | 'exhausted' | 'active' | 'pending' | 'reversed' | undefined;
|
|
1488
|
+
after?: string | undefined;
|
|
1489
|
+
};
|
|
1490
|
+
/** One page of supply, with the cursor for the next page when there is one. */
|
|
1491
|
+
interface SupplyPage<T = string> {
|
|
1492
|
+
supply: SupplyEntry<T>[];
|
|
1493
|
+
next?: string;
|
|
1494
|
+
}
|
|
1495
|
+
/** The supply entry read by ID. */
|
|
1496
|
+
interface SupplyGetResponse<T = string> {
|
|
1497
|
+
supply: SupplyEntry<T>;
|
|
1498
|
+
}
|
|
1499
|
+
/** The request that takes back a quantity from a supply entry. */
|
|
1500
|
+
type SupplyReverse = {
|
|
1501
|
+
quantity: number;
|
|
1502
|
+
evidence: {
|
|
1503
|
+
kind: string;
|
|
1504
|
+
ref: string;
|
|
1505
|
+
};
|
|
1506
|
+
sourceKey: string;
|
|
1507
|
+
};
|
|
1508
|
+
/** What a supply reversal took back. */
|
|
1509
|
+
interface SupplyReverseResponse<T = string> {
|
|
1510
|
+
supply: SupplyEntry<T>;
|
|
1511
|
+
/** The `reversal` movement, absent when the entry had not started. */
|
|
1512
|
+
movement?: Movement<T>;
|
|
1513
|
+
/** What was taken back. */
|
|
1514
|
+
taken: Quantity;
|
|
1515
|
+
/** Set when the `sourceKey` already named this request: nothing was taken again. */
|
|
1516
|
+
duplicate?: true;
|
|
1517
|
+
}
|
|
1518
|
+
/** A code the Platform answers with beside the shared ones. */
|
|
1519
|
+
type PlatformErrorCode = 'unavailable' | 'secret_key_invalid' | 'origin_not_allowed' | 'confirmation_required' | 'throttled' | 'quota_exceeded' | 'balance_exhausted' | 'not_ready';
|
|
1520
|
+
/** The details of `cursor_expired`: the feed's two ends, so a reader knows where to start again. */
|
|
1521
|
+
interface CursorExpiredDetails {
|
|
1522
|
+
/** The first `seq` still kept. */
|
|
1523
|
+
oldest: number;
|
|
1524
|
+
/** The newest `seq` written. */
|
|
1525
|
+
latest: number;
|
|
1526
|
+
}
|
|
1527
|
+
/** The details of the feed's codes. A service with a change feed extends its `ErrorDetails` from it. */
|
|
1528
|
+
interface FeedErrorDetails {
|
|
1529
|
+
/** The feed's two ends, so a reader knows where to start again. */
|
|
1530
|
+
cursor_expired: CursorExpiredDetails;
|
|
1531
|
+
}
|
|
1532
|
+
declare const HOSTED_BASE_URL = "https://api.agentpost.tools/v1/resources";
|
|
1533
|
+
interface ClientOptions {
|
|
1534
|
+
/** The API root. Defaults to {@link HOSTED_BASE_URL}. Set it to send requests through your own proxy, or to a stand-in during a test. */
|
|
1535
|
+
baseUrl?: string;
|
|
1536
|
+
/** A project's secret key on a server, or a user token for holder reads. */
|
|
1537
|
+
token?: string;
|
|
1538
|
+
fetch?: typeof fetch;
|
|
1539
|
+
headers?: Record<string, string>;
|
|
1540
|
+
}
|
|
1541
|
+
interface CallOptions {
|
|
1542
|
+
/** Overrides the client's token for this call. */
|
|
1543
|
+
token?: string;
|
|
1544
|
+
}
|
|
1545
|
+
interface WriteOptions extends CallOptions {
|
|
1546
|
+
/** The caller supplies the key. Retry the same write with the same key. */
|
|
1547
|
+
idempotencyKey: string;
|
|
1548
|
+
}
|
|
1549
|
+
interface VersionedOptions extends CallOptions {
|
|
1550
|
+
/** The record version the caller read. */
|
|
1551
|
+
ifMatch: number;
|
|
1552
|
+
idempotencyKey?: string;
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* A stable code to act on: one of ResourceShark's error codes, one of the
|
|
1556
|
+
* Platform's (such as `throttled`), or `unknown` when the response wasn't
|
|
1557
|
+
* the standard error shape. A code newer than this SDK still comes as the
|
|
1558
|
+
* API sent it.
|
|
1559
|
+
*/
|
|
1560
|
+
type ResourcesharkApiErrorCode = ErrorCode | PlatformErrorCode | 'unknown';
|
|
1561
|
+
/**
|
|
1562
|
+
* Each code with its `details`, so checking `code` gives `details` its
|
|
1563
|
+
* type, such as `{ lines }` for `insufficient_supply`. A code whose details
|
|
1564
|
+
* ResourceShark doesn't type, and every Platform code, has `details` as
|
|
1565
|
+
* sent.
|
|
1566
|
+
*/
|
|
1567
|
+
type DetailsByCode = { [C in ResourcesharkApiErrorCode]: {
|
|
1568
|
+
readonly code: C;
|
|
1569
|
+
readonly details?: ErrorDetailsOf<C>;
|
|
1570
|
+
}; }[ResourcesharkApiErrorCode];
|
|
1571
|
+
/** ResourceShark's refusal: the HTTP status, a stable code, its class and details, and the page that explains it. */
|
|
1572
|
+
type ResourcesharkApiError = Error & {
|
|
1573
|
+
readonly status: number;
|
|
1574
|
+
/** What to do next without knowing the code. Absent on a Platform code. */
|
|
1575
|
+
readonly errorClass?: ErrorClass;
|
|
1576
|
+
/** The page that explains the code. */
|
|
1577
|
+
readonly docs?: string;
|
|
1578
|
+
} & DetailsByCode;
|
|
1579
|
+
interface ResourcesharkApiErrorConstructor {
|
|
1580
|
+
/** Takes the code and details as the API sent them. */
|
|
1581
|
+
new (status: number, code: ResourcesharkApiErrorCode | (string & {}), message: string, details?: unknown, docs?: string, errorClass?: ErrorClass): ResourcesharkApiError;
|
|
1582
|
+
readonly prototype: ResourcesharkApiError;
|
|
1583
|
+
}
|
|
1584
|
+
declare const ResourcesharkApiError: ResourcesharkApiErrorConstructor;
|
|
1585
|
+
/** True when a response has the service's standard error body. */
|
|
1586
|
+
declare function isErrorBody(value: unknown): value is ErrorBody;
|
|
1587
|
+
/** Filters and pagination for a resource list, before server defaults apply. */
|
|
1588
|
+
type ResourcesQueryInput = Partial<ResourcesQuery>;
|
|
1589
|
+
/** A read of the change feed, before server defaults apply. */
|
|
1590
|
+
interface EventsQuery {
|
|
1591
|
+
/** The `seq` to read after, default 0 for the oldest change kept, or `'latest'` to start from now: no events, and `next` set to the newest `seq`. */
|
|
1592
|
+
after?: number | 'latest';
|
|
1593
|
+
/** The most events to answer with, from 1 to 500. Default 100. */
|
|
1594
|
+
limit?: number;
|
|
1595
|
+
/** Full event types to keep, as a list or separated by commas. Without it, every type. */
|
|
1596
|
+
types?: string | readonly string[];
|
|
1597
|
+
}
|
|
1598
|
+
interface ResourcesharkClient {
|
|
1599
|
+
config: {
|
|
1600
|
+
get(opts?: CallOptions): Promise<ConfigResponse>;
|
|
1601
|
+
put(body: ResourcesharkConfig, opts: VersionedOptions): Promise<ConfigResponse>;
|
|
1602
|
+
};
|
|
1603
|
+
resources: {
|
|
1604
|
+
create(body: ResourceCreate, opts?: CallOptions): Promise<ResourceResponse>;
|
|
1605
|
+
list(query?: ResourcesQueryInput): Promise<ResourcesPage>;
|
|
1606
|
+
get(id: ResourceId): Promise<ResourceResponse>;
|
|
1607
|
+
patch(id: ResourceId, body: ResourcePatch, opts: VersionedOptions): Promise<ResourceResponse>;
|
|
1608
|
+
archive(id: ResourceId, opts?: CallOptions): Promise<ResourceResponse>;
|
|
1609
|
+
};
|
|
1610
|
+
places: {
|
|
1611
|
+
create(body: PlaceCreate): Promise<PlaceResponse>;
|
|
1612
|
+
list(query?: Partial<PlacesQuery>): Promise<PlacesPage>;
|
|
1613
|
+
patch(id: PlaceId, body: PlacePatch): Promise<PlaceResponse>;
|
|
1614
|
+
};
|
|
1615
|
+
instances: {
|
|
1616
|
+
create(resourceId: ResourceId, body: InstanceCreate): Promise<InstanceResponse>;
|
|
1617
|
+
list(resourceId: ResourceId, query?: Partial<InstancesQuery>): Promise<InstancesPage>;
|
|
1618
|
+
patch(resourceId: ResourceId, iid: InstanceId, body: InstancePatch): Promise<InstanceResponse>;
|
|
1619
|
+
};
|
|
1620
|
+
freeInstances: {
|
|
1621
|
+
list(resourceId: ResourceId, query?: Partial<FreeInstancesQuery>): Promise<InstancesPage>;
|
|
1622
|
+
};
|
|
1623
|
+
supply: {
|
|
1624
|
+
create(body: SupplyCreateInput, opts: WriteOptions): Promise<SupplyResponse>;
|
|
1625
|
+
list(query?: Partial<SupplyQuery>): Promise<SupplyPage>;
|
|
1626
|
+
get(id: SupplyId): Promise<SupplyGetResponse>;
|
|
1627
|
+
reverse(id: SupplyId, body: SupplyReverse, opts: WriteOptions): Promise<SupplyReverseResponse>;
|
|
1628
|
+
};
|
|
1629
|
+
batches: {
|
|
1630
|
+
create(body: BatchCreate): Promise<BatchResponse>;
|
|
1631
|
+
list(query?: Partial<BatchesQuery>): Promise<BatchesPage>;
|
|
1632
|
+
get(id: BatchId): Promise<BatchResponse>;
|
|
1633
|
+
patch(id: BatchId, body: BatchPatch, opts: VersionedOptions): Promise<BatchResponse>;
|
|
1634
|
+
};
|
|
1635
|
+
claims: {
|
|
1636
|
+
consume(body: ConsumeRequest, opts: WriteOptions): Promise<ConsumeResponse>;
|
|
1637
|
+
settle(body: SettleRequest, opts: WriteOptions): Promise<SettleResponse>;
|
|
1638
|
+
list(query?: Partial<ClaimsQuery>): Promise<ClaimsPage>;
|
|
1639
|
+
get(id: ClaimId): Promise<ClaimResponse>;
|
|
1640
|
+
};
|
|
1641
|
+
holds: {
|
|
1642
|
+
create(body: HoldCreate, opts: WriteOptions): Promise<HoldResponse>;
|
|
1643
|
+
list(query?: HoldsQueryInput): Promise<HoldsPage>;
|
|
1644
|
+
get(id: HoldId): Promise<HoldResponse>;
|
|
1645
|
+
extend(id: HoldId, body: HoldExtend, opts: WriteOptions): Promise<HoldResponse>;
|
|
1646
|
+
commit(id: HoldId, body: HoldCommit, opts: WriteOptions): Promise<HoldCommitResponse>;
|
|
1647
|
+
release(id: HoldId, opts: WriteOptions): Promise<HoldResponse>;
|
|
1648
|
+
cancel(id: HoldId, body: HoldCancel, opts: WriteOptions): Promise<HoldCancelResponse>;
|
|
1649
|
+
reschedule(body: HoldReschedule, opts: WriteOptions): Promise<HoldRescheduleResponse>;
|
|
1650
|
+
};
|
|
1651
|
+
availability: {
|
|
1652
|
+
query(body: AvailabilityRequest): Promise<AvailabilityResponse>;
|
|
1653
|
+
};
|
|
1654
|
+
balances: {
|
|
1655
|
+
get(resourceId: ResourceId, query?: BalanceQuery): Promise<BalanceResponse>;
|
|
1656
|
+
};
|
|
1657
|
+
holderBalances: {
|
|
1658
|
+
list(holderRef: Ref, query?: Partial<HolderBalancesQuery>): Promise<HolderBalancesPage>;
|
|
1659
|
+
get(holderRef: Ref, resourceId: ResourceId, query?: Pick<HolderBalancesQuery, 'placeId' | 'condition'>): Promise<HolderBalanceResponse>;
|
|
1660
|
+
};
|
|
1661
|
+
schedules: {
|
|
1662
|
+
put(resourceId: ResourceId, body: SchedulePut, opts?: {
|
|
1663
|
+
ifMatch?: number;
|
|
1664
|
+
}): Promise<ScheduleSaveResponse>;
|
|
1665
|
+
get(resourceId: ResourceId): Promise<ScheduleResponse>;
|
|
1666
|
+
};
|
|
1667
|
+
exceptions: {
|
|
1668
|
+
create(resourceId: ResourceId, body: ExceptionCreate, opts: WriteOptions): Promise<ExceptionCreateResponse>;
|
|
1669
|
+
list(resourceId: ResourceId, query?: ExceptionsQuery): Promise<ExceptionsList>;
|
|
1670
|
+
patch(resourceId: ResourceId, eid: ExceptionId, body: ExceptionPatch, opts: VersionedOptions): Promise<ExceptionResponse>;
|
|
1671
|
+
delete(resourceId: ResourceId, eid: ExceptionId, opts?: CallOptions): Promise<ExceptionDeleteResponse>;
|
|
1672
|
+
};
|
|
1673
|
+
slots: {
|
|
1674
|
+
list(query: SlotsQuery): Promise<SlotsResponse>;
|
|
1675
|
+
};
|
|
1676
|
+
transfers: {
|
|
1677
|
+
create(body: TransferCreate, opts: WriteOptions): Promise<TransferResponse>;
|
|
1678
|
+
};
|
|
1679
|
+
counts: {
|
|
1680
|
+
create(body: CountCreate, opts: WriteOptions): Promise<CountResponse>;
|
|
1681
|
+
};
|
|
1682
|
+
adjustments: {
|
|
1683
|
+
create(body: AdjustmentCreate, opts: WriteOptions): Promise<AdjustmentResponse>;
|
|
1684
|
+
};
|
|
1685
|
+
transformations: {
|
|
1686
|
+
create(body: TransformationCreate, opts: WriteOptions): Promise<TransformationResponse>;
|
|
1687
|
+
get(id: TransformationId): Promise<TransformationResponse>;
|
|
1688
|
+
};
|
|
1689
|
+
movements: {
|
|
1690
|
+
list(query?: Partial<MovementsQuery>): Promise<MovementsPage>;
|
|
1691
|
+
get(id: MovementId): Promise<MovementResponse>;
|
|
1692
|
+
};
|
|
1693
|
+
reports: {
|
|
1694
|
+
totals(query: TotalsQuery & {
|
|
1695
|
+
attributes?: Record<string, string>;
|
|
1696
|
+
}): Promise<TotalsReport>;
|
|
1697
|
+
};
|
|
1698
|
+
events: {
|
|
1699
|
+
read(query?: EventsQuery): Promise<EventsPage>;
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1702
|
+
declare function createClient(options?: ClientOptions): ResourcesharkClient;
|
|
1703
|
+
export { ExceptionId as $, ResourcePatch as $t, Claim as A, TransferResponse as An, InstancesPage as At, CountResponse as B, MovementsQuery as Bt, BatchCreate as C, SupplyResponse as Cn, HoldsPage as Ct, BatchesPage as D, TotalsQuery as Dn, InstanceId as Dt, BatchResponse as E, TotalsBalance as En, InstanceCreate as Et, ClaimsQuery as F, MovementId as Ft, ErrorCode as G, PlaceResponse as Gt, Duration as H, PlaceCreate as Ht, ConfigResponse as I, MovementReason as It, EventsPage as J, Quantity as Jt, ErrorDetails as K, PlacesPage as Kt, ConsumeRequest as L, MovementResponse as Lt, ClaimLine as M, TransformationId as Mn, InsufficientSupplyDetails as Mt, ClaimResponse as N, TransformationResponse as Nn, KeyInUseDetails as Nt, BatchesQuery as O, TotalsReport as On, InstancePatch as Ot, ClaimsPage as P, Unit as Pn, Movement as Pt, ExceptionDeleteResponse as Q, ResourceId as Qt, ConsumeResponse as R, MovementSums as Rt, Batch as S, SupplyQuery as Sn, HolderBalancesQuery as St, BatchPatch as T, SupplyReverseResponse as Tn, Instance as Tt, ErrorBody as U, PlaceId as Ut, CursorExpiredDetails as V, Place as Vt, ErrorClass as W, PlacePatch as Wt, ExceptionCreate as X, Resource as Xt, Evidence as Y, Ref as Yt, ExceptionCreateResponse as Z, ResourceCreate as Zt, Attributes as _, SupplyCreateInput as _n, HoldRescheduleResponse as _t, ResourcesQueryInput as a, SchedulePut as an, FiniteSpan as at, BalanceQuery as b, SupplyId as bn, HolderBalanceResponse as bt, ResourcesharkApiErrorConstructor as c, Scope as cn, HoldCancel as ct, WriteOptions as d, SettleResponse as dn, HoldCommitResponse as dt, ResourceResponse as en, ExceptionPatch as et, createClient as f, ShortLine as fn, HoldCreate as ft, AssignmentInfeasibleDetails as g, StaleVersionDetails as gn, HoldReschedule as gt, AdjustmentResponse as h, SlotsResponse as hn, HoldId as ht, HOSTED_BASE_URL as i, RetainedHold as in, ExhaustedUntilSupplyDetails as it, ClaimId as j, TransformationCreate as jn, InstancesQuery as jt, ChangeEvent as k, TransferCreate as kn, InstanceResponse as kt, ResourcesharkClient as l, SettingsLockedDetails as ln, HoldCancelResponse as lt, AdjustmentCreate as m, SlotsQuery as mn, HoldExtend as mt, ClientOptions as n, ResourcesQuery as nn, ExceptionsList as nt, ResourcesharkApiError as o, ScheduleResponse as on, FreeInstancesQuery as ot, isErrorBody as p, Slot as pn, HoldExpiredDetails as pt, ErrorDetailsOf as q, PlacesQuery as qt, EventsQuery as r, ResourcesharkConfig as rn, ExceptionsQuery as rt, ResourcesharkApiErrorCode as s, ScheduleSaveResponse as sn, Hold as st, CallOptions as t, ResourcesPage as tn, ExceptionResponse as tt, VersionedOptions as u, SettleRequest as un, HoldCommit as ut, AvailabilityRequest as v, SupplyEntry as vn, HoldResolvedDetails as vt, BatchId as w, SupplyReverse as wn, HoldsQueryInput as wt, BalanceResponse as x, SupplyPage as xn, HolderBalancesPage as xt, AvailabilityResponse as y, SupplyGetResponse as yn, HoldResponse as yt, CountCreate as z, MovementsPage as zt };
|