@robbeverhelst/do 1.284.0 → 1.285.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/dist/do.js +149 -3
- package/package.json +1 -1
package/dist/do.js
CHANGED
|
@@ -25324,7 +25324,8 @@ var runQuestSchema = object({
|
|
|
25324
25324
|
}).strict();
|
|
25325
25325
|
var runNextStepsSchema = object({
|
|
25326
25326
|
items: array(shortText.pipe(string2().min(1))).max(3),
|
|
25327
|
-
pinned: boolean3().default(false)
|
|
25327
|
+
pinned: boolean3().default(false),
|
|
25328
|
+
note: text5.nullish()
|
|
25328
25329
|
}).strict();
|
|
25329
25330
|
var runChoiceSchema = object({
|
|
25330
25331
|
ref: ref.nullish(),
|
|
@@ -26008,10 +26009,78 @@ var animalLogInputSchema = discriminatedUnion("kind", [
|
|
|
26008
26009
|
occurredAt: occurredAtSchema
|
|
26009
26010
|
}).strict()
|
|
26010
26011
|
]);
|
|
26012
|
+
var animalVetVisitSourceSchema = _enum2(["sticker", "photo", "said"]);
|
|
26013
|
+
var visitTextSchema = string2().trim().min(1).max(120);
|
|
26014
|
+
var visitCostSchema = object({
|
|
26015
|
+
amount: number2().positive().max(1e5),
|
|
26016
|
+
currency: string2().trim().length(3).default("EUR")
|
|
26017
|
+
}).strict();
|
|
26018
|
+
var animalVetVisitInputSchema = object({
|
|
26019
|
+
id: ulidSchema,
|
|
26020
|
+
at: exports_coerce.date().optional(),
|
|
26021
|
+
vetContactId: ulidSchema.optional(),
|
|
26022
|
+
clinician: visitTextSchema.optional(),
|
|
26023
|
+
reason: visitTextSchema.optional(),
|
|
26024
|
+
vaccine: object({ name: visitTextSchema, source: animalVetVisitSourceSchema.optional() }).strict().optional(),
|
|
26025
|
+
dewormer: visitTextSchema.optional(),
|
|
26026
|
+
weight: object({
|
|
26027
|
+
value: number2().positive().max(200000),
|
|
26028
|
+
unit: _enum2(["g", "kg"]).default("kg")
|
|
26029
|
+
}).strict().optional(),
|
|
26030
|
+
nextDates: array(object({
|
|
26031
|
+
id: ulidSchema,
|
|
26032
|
+
label: visitTextSchema,
|
|
26033
|
+
date: string2().regex(/^\d{4}-\d{2}-\d{2}$/, "expected YYYY-MM-DD")
|
|
26034
|
+
}).strict()).max(5).default([]),
|
|
26035
|
+
files: array(object({ id: ulidSchema, name: visitTextSchema.optional() }).strict()).max(5).default([]),
|
|
26036
|
+
cost: visitCostSchema.optional()
|
|
26037
|
+
}).strict();
|
|
26038
|
+
var animalVetVisitPatchSchema = object({
|
|
26039
|
+
vetContactId: ulidSchema.nullable().optional(),
|
|
26040
|
+
clinician: visitTextSchema.nullable().optional(),
|
|
26041
|
+
reason: visitTextSchema.nullable().optional(),
|
|
26042
|
+
vaccine: object({ name: visitTextSchema, source: animalVetVisitSourceSchema.optional() }).strict().nullable().optional(),
|
|
26043
|
+
dewormer: visitTextSchema.nullable().optional(),
|
|
26044
|
+
cost: visitCostSchema.nullable().optional()
|
|
26045
|
+
}).strict().refine((v) => Object.keys(v).length > 0, { message: "Change at least one field." });
|
|
26046
|
+
var animalVetVisitSchema = object({
|
|
26047
|
+
id: ulidSchema,
|
|
26048
|
+
animal: object({
|
|
26049
|
+
id: ulidSchema,
|
|
26050
|
+
title: string2(),
|
|
26051
|
+
speciesKey: string2().nullable(),
|
|
26052
|
+
speciesClass: animalClassSchema.nullable()
|
|
26053
|
+
}),
|
|
26054
|
+
at: exports_coerce.date(),
|
|
26055
|
+
vet: nodeRefSchema.nullable(),
|
|
26056
|
+
clinician: string2().nullable(),
|
|
26057
|
+
reason: string2().nullable(),
|
|
26058
|
+
vaccine: object({ name: string2(), source: animalVetVisitSourceSchema.nullable() }).nullable(),
|
|
26059
|
+
dewormer: string2().nullable(),
|
|
26060
|
+
weight: object({
|
|
26061
|
+
grams: number2(),
|
|
26062
|
+
deltaGrams: number2().nullable(),
|
|
26063
|
+
since: string2().nullable()
|
|
26064
|
+
}).nullable(),
|
|
26065
|
+
keyDates: array(object({ id: string2(), label: string2(), date: string2() })),
|
|
26066
|
+
files: array(object({ id: string2(), name: string2() })),
|
|
26067
|
+
cost: object({ amount: number2(), currency: string2() }).nullable(),
|
|
26068
|
+
byAgent: boolean3(),
|
|
26069
|
+
undone: boolean3()
|
|
26070
|
+
});
|
|
26011
26071
|
var animalTimelineEntrySchema = object({
|
|
26012
26072
|
id: string2(),
|
|
26013
26073
|
at: exports_coerce.date(),
|
|
26014
|
-
kind: _enum2([
|
|
26074
|
+
kind: _enum2([
|
|
26075
|
+
"weight",
|
|
26076
|
+
"length",
|
|
26077
|
+
"eggs",
|
|
26078
|
+
"note",
|
|
26079
|
+
"vet_visit",
|
|
26080
|
+
"period_started",
|
|
26081
|
+
"period_ended",
|
|
26082
|
+
"key_date"
|
|
26083
|
+
]),
|
|
26015
26084
|
animalId: ulidSchema,
|
|
26016
26085
|
animalTitle: string2(),
|
|
26017
26086
|
value: number2().nullable(),
|
|
@@ -28370,7 +28439,7 @@ function parseCapture2(input, now) {
|
|
|
28370
28439
|
|
|
28371
28440
|
// src/meta.ts
|
|
28372
28441
|
var CLI_NAME = "do";
|
|
28373
|
-
var VERSION = "1.
|
|
28442
|
+
var VERSION = "1.285.0";
|
|
28374
28443
|
var API_PREFIX = "/api/v1";
|
|
28375
28444
|
var DEFAULT_API_URL = "http://localhost:3001";
|
|
28376
28445
|
|
|
@@ -33379,6 +33448,54 @@ var COMMAND_SPECS = [
|
|
|
33379
33448
|
returns: "AnimalTimelineEntry",
|
|
33380
33449
|
notes: 'POST /api/v1/animals/{id}/log (`animal_log`). `do animals log <hens> eggs 2`, `do animals log <dog> weight 37.8 --unit kg`, `do animals log <hen> note "eating again"`. Eggs are the day\'s count: logging again that day replaces it.'
|
|
33381
33450
|
},
|
|
33451
|
+
{
|
|
33452
|
+
path: ["animals", "vet-visit"],
|
|
33453
|
+
summary: "Log a vet visit in one call: where, the vaccine, the dewormer, the weight, the next dates, the photos, the cost.",
|
|
33454
|
+
args: [{ name: "id", required: true, description: "Animal ULID." }],
|
|
33455
|
+
flags: [
|
|
33456
|
+
{
|
|
33457
|
+
name: "data",
|
|
33458
|
+
type: "string",
|
|
33459
|
+
description: "JSON: { vetContactId?, clinician?, reason?, vaccine?: { name, source? }, dewormer?, weight?: { value, unit? }, nextDates?: [{ label, date }], files?: [{ id, name? }], cost?: { amount, currency? }, at? }. The visit's and each date's ids are minted."
|
|
33460
|
+
}
|
|
33461
|
+
],
|
|
33462
|
+
scopes: ["animals:write"],
|
|
33463
|
+
returns: "AnimalVetVisit",
|
|
33464
|
+
notes: 'POST /api/v1/animals/{id}/vet-visits (`animal_vet_visit`, mockup 03). The visit is the receipt: post it with `receipt: { nodeId: <visit id> }`. `do animals vet-visit <dog> --data \'{"reason":"booster","vaccine":{"name":"DHPPi + L4","source":"sticker"},"weight":{"value":37.8}}\'`.'
|
|
33465
|
+
},
|
|
33466
|
+
{
|
|
33467
|
+
path: ["animals", "vet-visit-get"],
|
|
33468
|
+
summary: "Read a vet visit as its receipt reads.",
|
|
33469
|
+
args: [{ name: "visitId", required: true, description: "Vet visit ULID." }],
|
|
33470
|
+
flags: [],
|
|
33471
|
+
scopes: ["animals:read"],
|
|
33472
|
+
returns: "AnimalVetVisit",
|
|
33473
|
+
notes: "GET /api/v1/animals/vet-visits/{visitId}."
|
|
33474
|
+
},
|
|
33475
|
+
{
|
|
33476
|
+
path: ["animals", "vet-visit-edit"],
|
|
33477
|
+
summary: "Put a vet visit's fields right (the receipt's Edit).",
|
|
33478
|
+
args: [{ name: "visitId", required: true, description: "Vet visit ULID." }],
|
|
33479
|
+
flags: [
|
|
33480
|
+
{
|
|
33481
|
+
name: "data",
|
|
33482
|
+
type: "string",
|
|
33483
|
+
description: "JSON: any of vetContactId, clinician, reason, vaccine, dewormer, cost (null clears one)."
|
|
33484
|
+
}
|
|
33485
|
+
],
|
|
33486
|
+
scopes: ["animals:write"],
|
|
33487
|
+
returns: "AnimalVetVisit",
|
|
33488
|
+
notes: "PATCH /api/v1/animals/vet-visits/{visitId}. The newest version wins."
|
|
33489
|
+
},
|
|
33490
|
+
{
|
|
33491
|
+
path: ["animals", "vet-visit-undo"],
|
|
33492
|
+
summary: "Take a vet visit back (the receipt's Undo).",
|
|
33493
|
+
args: [{ name: "visitId", required: true, description: "Vet visit ULID." }],
|
|
33494
|
+
flags: [],
|
|
33495
|
+
scopes: ["animals:write"],
|
|
33496
|
+
returns: "AnimalVetVisit",
|
|
33497
|
+
notes: "POST /api/v1/animals/vet-visits/{visitId}/undo. The visit, its weight, its key dates and the filed photos all go back."
|
|
33498
|
+
},
|
|
33382
33499
|
{
|
|
33383
33500
|
path: ["runs", "change"],
|
|
33384
33501
|
summary: "Apply a chat update to a run: its changes, with a receipt and Undo.",
|
|
@@ -38339,6 +38456,35 @@ var HANDLERS = {
|
|
|
38339
38456
|
const body = parseInput(animalLogInputSchema, { ...fact, ...at ? { occurredAt: at } : {} });
|
|
38340
38457
|
return { data: await requireClient().post(`/animals/${id}/log`, body), render: renderRecord };
|
|
38341
38458
|
},
|
|
38459
|
+
"animals vet-visit": async ({ args, flags, requireClient }) => {
|
|
38460
|
+
const id = requireArg(args, 0, "animal id");
|
|
38461
|
+
const raw = readDataFlag(flags);
|
|
38462
|
+
const body = parseInput(animalVetVisitInputSchema, {
|
|
38463
|
+
id: ulid3(),
|
|
38464
|
+
...raw,
|
|
38465
|
+
nextDates: (raw.nextDates ?? []).map((d) => ({ id: ulid3(), ...d }))
|
|
38466
|
+
});
|
|
38467
|
+
return {
|
|
38468
|
+
data: await requireClient().post(`/animals/${id}/vet-visits`, body),
|
|
38469
|
+
render: renderRecord
|
|
38470
|
+
};
|
|
38471
|
+
},
|
|
38472
|
+
"animals vet-visit-get": async ({ args, requireClient }) => ({
|
|
38473
|
+
data: await requireClient().get(`/animals/vet-visits/${requireArg(args, 0, "visit id")}`),
|
|
38474
|
+
render: renderRecord
|
|
38475
|
+
}),
|
|
38476
|
+
"animals vet-visit-edit": async ({ args, flags, requireClient }) => {
|
|
38477
|
+
const visitId = requireArg(args, 0, "visit id");
|
|
38478
|
+
const body = parseInput(animalVetVisitPatchSchema, readDataFlag(flags));
|
|
38479
|
+
return {
|
|
38480
|
+
data: await requireClient().patch(`/animals/vet-visits/${visitId}`, body),
|
|
38481
|
+
render: renderRecord
|
|
38482
|
+
};
|
|
38483
|
+
},
|
|
38484
|
+
"animals vet-visit-undo": async ({ args, requireClient }) => ({
|
|
38485
|
+
data: await requireClient().post(`/animals/vet-visits/${requireArg(args, 0, "visit id")}/undo`, {}),
|
|
38486
|
+
render: renderRecord
|
|
38487
|
+
}),
|
|
38342
38488
|
"runs change": async ({ args, flags, requireClient }) => {
|
|
38343
38489
|
const id = requireArg(args, 0, "run id");
|
|
38344
38490
|
const body = { ...readDataFlag(flags) };
|
package/package.json
CHANGED