@robbeverhelst/do 1.44.0 → 1.45.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.
Files changed (2) hide show
  1. package/dist/do.js +136 -1
  2. package/package.json +1 -1
package/dist/do.js CHANGED
@@ -4545,6 +4545,36 @@ var inventoryItems = pgTable("inventory_items", {
4545
4545
  }, (t) => [
4546
4546
  index("inventory_items_tenant_idx").on(t.tenantId)
4547
4547
  ]);
4548
+ // ../../packages/schema/src/db/collection.ts
4549
+ var collectionItems = pgTable("collection_items", {
4550
+ id: text("id").primaryKey().references(() => nodes.id),
4551
+ tenantId: text("tenant_id").notNull().references(() => tenants.id),
4552
+ type: text("type").$type().notNull(),
4553
+ status: text("status").$type().notNull().default("want"),
4554
+ quantity: doublePrecision("quantity"),
4555
+ facet: jsonb("facet").$type(),
4556
+ areaId: text("area_id").references(() => areas.id),
4557
+ tags: text("tags").array().notNull().default([]),
4558
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
4559
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
4560
+ }, (t) => [
4561
+ index("collection_items_tenant_type_idx").on(t.tenantId, t.type),
4562
+ index("collection_items_tenant_idx").on(t.tenantId),
4563
+ index("collection_items_area_idx").on(t.areaId),
4564
+ index("collection_items_tags_idx").using("gin", t.tags)
4565
+ ]);
4566
+ var collectionEntries = pgTable("collection_entries", {
4567
+ id: text("id").primaryKey(),
4568
+ tenantId: text("tenant_id").notNull().references(() => tenants.id),
4569
+ itemId: text("item_id").notNull().references(() => collectionItems.id),
4570
+ occurredOn: date("occurred_on").notNull(),
4571
+ rating: integer("rating"),
4572
+ note: text("note"),
4573
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
4574
+ }, (t) => [
4575
+ index("collection_entries_item_occurred_idx").on(t.itemId, t.occurredOn),
4576
+ index("collection_entries_tenant_idx").on(t.tenantId)
4577
+ ]);
4548
4578
  // ../../packages/schema/src/db/recipes.ts
4549
4579
  var mealType = pgEnum("meal_type", ["breakfast", "lunch", "dinner", "snack"]);
4550
4580
  var recipes = pgTable("recipes", {
@@ -20480,6 +20510,60 @@ var restockInputSchema = exports_external.object({
20480
20510
  listId: ulidSchema.optional(),
20481
20511
  itemIds: exports_external.array(ulidSchema).optional()
20482
20512
  }).strict();
20513
+ // ../../packages/schema/src/contracts/collection.ts
20514
+ var collectionStatusValues = ["want", "have", "doing", "done", "dropped"];
20515
+ var collectionStatusSchema = exports_external.enum(collectionStatusValues);
20516
+ var collectionTypeValues = ["book", "film", "game", "music", "place", "wine"];
20517
+ var collectionTypeSchema = exports_external.enum(collectionTypeValues);
20518
+ var collectionViewValues = ["grid", "shelf", "map"];
20519
+ var collectionViewSchema = exports_external.enum(collectionViewValues);
20520
+ var collectionFacetSchema = exports_external.record(exports_external.string(), exports_external.unknown());
20521
+ var collectionItemSchema = createSelectSchema(collectionItems, {
20522
+ facet: collectionFacetSchema.nullable(),
20523
+ tags: exports_external.array(exports_external.string()),
20524
+ createdAt: exports_external.coerce.date(),
20525
+ updatedAt: exports_external.coerce.date()
20526
+ });
20527
+ var createCollectionItemInputSchema = exports_external.object({
20528
+ id: ulidSchema,
20529
+ type: collectionTypeSchema,
20530
+ title: exports_external.string().min(1),
20531
+ status: collectionStatusSchema.optional(),
20532
+ quantity: exports_external.number().min(0).nullish(),
20533
+ parentId: ulidSchema.nullish(),
20534
+ areaId: ulidSchema.nullish(),
20535
+ tags: exports_external.array(exports_external.string().min(1)).optional(),
20536
+ facet: collectionFacetSchema.nullish()
20537
+ });
20538
+ var updateCollectionItemInputSchema = exports_external.object({
20539
+ title: exports_external.string().min(1).optional(),
20540
+ status: collectionStatusSchema.optional(),
20541
+ quantity: exports_external.number().min(0).nullish(),
20542
+ parentId: ulidSchema.nullish(),
20543
+ areaId: ulidSchema.nullish(),
20544
+ tags: exports_external.array(exports_external.string().min(1)).optional(),
20545
+ facet: collectionFacetSchema.nullish()
20546
+ }).strict();
20547
+ var collectionEntrySchema = createSelectSchema(collectionEntries, {
20548
+ createdAt: exports_external.coerce.date()
20549
+ });
20550
+ var createCollectionEntryInputSchema = exports_external.object({
20551
+ id: ulidSchema,
20552
+ occurredOn: exports_external.string().regex(/^\d{4}-\d{2}-\d{2}$/, "must be an ISO date (YYYY-MM-DD)"),
20553
+ rating: exports_external.number().int().min(1).max(5).nullish(),
20554
+ note: exports_external.string().max(2000).nullish()
20555
+ });
20556
+ var collectionItemViewSchema = collectionItemSchema.extend({
20557
+ title: exports_external.string(),
20558
+ parentId: ulidSchema.nullable(),
20559
+ type: exports_external.string(),
20560
+ status: exports_external.string(),
20561
+ rating: exports_external.number().int().min(1).max(5).nullable(),
20562
+ deletedAt: exports_external.coerce.date().nullable()
20563
+ });
20564
+ var collectionItemDetailSchema = collectionItemViewSchema.extend({
20565
+ entries: exports_external.array(collectionEntrySchema)
20566
+ });
20483
20567
  // ../../packages/schema/src/contracts/recipes.ts
20484
20568
  var recipeSchema = createSelectSchema(recipes);
20485
20569
  var recipeIngredientSchema = createSelectSchema(recipeIngredients, {
@@ -21482,6 +21566,57 @@ function parseCapture(input) {
21482
21566
  const title = input.replace(TAG_RE, " ").replace(PRIORITY_RE, " ").replace(AREA_RE, " ").replace(/\s+/g, " ").trim();
21483
21567
  return { title, tags, ...priority ? { priority } : {}, ...area ? { area } : {} };
21484
21568
  }
21569
+ // ../../packages/schema/src/presets/collection-types.ts
21570
+ var bookFacetSchema = exports_external.object({
21571
+ author: exports_external.string().min(1).max(200).nullish(),
21572
+ coverUrl: exports_external.string().url().max(2048).nullish(),
21573
+ pageCount: exports_external.number().int().min(1).max(1e5).nullish()
21574
+ }).strict();
21575
+ var stubFacetSchema = exports_external.object({}).strict();
21576
+ var ALL_STATUSES = collectionStatusValues;
21577
+ var DEFAULT_STATUS_LABELS = {
21578
+ want: "Want",
21579
+ have: "Have",
21580
+ doing: "Doing",
21581
+ done: "Done",
21582
+ dropped: "Dropped"
21583
+ };
21584
+ function stubType(key, label, itemNoun) {
21585
+ return {
21586
+ key,
21587
+ label,
21588
+ itemNoun,
21589
+ statuses: ALL_STATUSES,
21590
+ statusLabels: DEFAULT_STATUS_LABELS,
21591
+ facetSchema: stubFacetSchema,
21592
+ view: "grid",
21593
+ stub: true
21594
+ };
21595
+ }
21596
+ var COLLECTION_TYPES = {
21597
+ book: {
21598
+ key: "book",
21599
+ label: "Books",
21600
+ itemNoun: "book",
21601
+ statuses: ["want", "have", "doing", "done", "dropped"],
21602
+ statusLabels: {
21603
+ want: "Want to read",
21604
+ have: "Owned",
21605
+ doing: "Reading",
21606
+ done: "Read",
21607
+ dropped: "Abandoned"
21608
+ },
21609
+ facetSchema: bookFacetSchema,
21610
+ view: "shelf",
21611
+ lookupId: "open-library"
21612
+ },
21613
+ film: stubType("film", "Films & TV", "title"),
21614
+ game: stubType("game", "Games", "game"),
21615
+ music: stubType("music", "Music", "album"),
21616
+ place: stubType("place", "Places", "place"),
21617
+ wine: stubType("wine", "Wines", "bottle")
21618
+ };
21619
+ var COLLECTION_TYPE_LIST = collectionTypeValues.map((k) => COLLECTION_TYPES[k]);
21485
21620
  // ../../packages/schema/src/presets/recipe.ts
21486
21621
  var presetEntitySchema = exports_external.enum([
21487
21622
  "habit",
@@ -23500,7 +23635,7 @@ function parseCapture2(input) {
23500
23635
 
23501
23636
  // src/meta.ts
23502
23637
  var CLI_NAME = "do";
23503
- var VERSION = "1.44.0";
23638
+ var VERSION = "1.45.0";
23504
23639
  var API_PREFIX = "/api/v1";
23505
23640
  var DEFAULT_API_URL = "http://localhost:3001";
23506
23641
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robbeverhelst/do",
3
- "version": "1.44.0",
3
+ "version": "1.45.0",
4
4
  "private": false,
5
5
  "description": "do — the agent-drivable CLI over the public /api/v1 surface",
6
6
  "type": "module",