@robbeverhelst/do 1.87.0 → 1.89.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 +116 -479
  2. package/package.json +1 -1
package/dist/do.js CHANGED
@@ -4371,6 +4371,7 @@ var userSettings = pgTable("user_settings", {
4371
4371
  density: settingsDensity("density").notNull().default("comfortable"),
4372
4372
  accent: settingsAccent("accent").notNull().default("teal"),
4373
4373
  enabledModules: text("enabled_modules").array().notNull().default([]),
4374
+ autoRollOverdue: boolean("auto_roll_overdue").notNull().default(false),
4374
4375
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
4375
4376
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
4376
4377
  }, (t) => [unique("user_settings_tenant_user_uniq").on(t.tenantId, t.userId)]);
@@ -4479,7 +4480,8 @@ var notificationType = pgEnum("notification_type", [
4479
4480
  "contact_date_due",
4480
4481
  "automation",
4481
4482
  "streak_at_risk",
4482
- "reflection_nudge"
4483
+ "reflection_nudge",
4484
+ "shutdown_nudge"
4483
4485
  ]);
4484
4486
  var notifications = pgTable("notifications", {
4485
4487
  id: text("id").primaryKey(),
@@ -19740,6 +19742,11 @@ var linkGoogleInputSchema = exports_external.object({
19740
19742
  code: exports_external.string().min(1),
19741
19743
  state: exports_external.string().min(1)
19742
19744
  });
19745
+ // ../../packages/schema/src/contracts/pagination.ts
19746
+ var paginationQuerySchema = exports_external.object({
19747
+ limit: exports_external.coerce.number().int().positive().optional(),
19748
+ cursor: exports_external.string().min(1).optional()
19749
+ });
19743
19750
  // ../../packages/schema/src/contracts/value-sets.ts
19744
19751
  var areaColorSchema = exports_external.enum(areaColor.enumValues);
19745
19752
  var reviewCadenceSchema = exports_external.enum(reviewCadence.enumValues);
@@ -19784,41 +19791,6 @@ var barcodeLookupResultSchema = exports_external.object({
19784
19791
  title: exports_external.string().nullable(),
19785
19792
  category: exports_external.string().nullable()
19786
19793
  });
19787
- // ../../packages/schema/src/contracts/books.ts
19788
- var bookCoverQuerySchema = exports_external.object({
19789
- title: exports_external.string().min(1).max(300)
19790
- });
19791
- var bookCoverResultSchema = exports_external.object({
19792
- coverUrl: exports_external.string().url().nullable(),
19793
- author: exports_external.string().nullable()
19794
- });
19795
- // ../../packages/schema/src/contracts/watch.ts
19796
- var watchPosterQuerySchema = exports_external.object({
19797
- title: exports_external.string().min(1).max(300)
19798
- });
19799
- var watchPosterResultSchema = exports_external.object({
19800
- posterUrl: exports_external.string().url().nullable(),
19801
- year: exports_external.number().int().nullable(),
19802
- kind: exports_external.enum(["movie", "show"]).nullable()
19803
- });
19804
- // ../../packages/schema/src/contracts/games.ts
19805
- var gameCoverQuerySchema = exports_external.object({
19806
- title: exports_external.string().min(1).max(300)
19807
- });
19808
- var gameCoverResultSchema = exports_external.object({
19809
- coverUrl: exports_external.string().url().nullable(),
19810
- year: exports_external.number().int().nullable(),
19811
- platform: exports_external.string().nullable()
19812
- });
19813
- // ../../packages/schema/src/contracts/music.ts
19814
- var albumCoverQuerySchema = exports_external.object({
19815
- title: exports_external.string().min(1).max(300)
19816
- });
19817
- var albumCoverResultSchema = exports_external.object({
19818
- coverUrl: exports_external.string().url().nullable(),
19819
- year: exports_external.number().int().nullable(),
19820
- artist: exports_external.string().nullable()
19821
- });
19822
19794
  // ../../packages/schema/src/contracts/tasks.ts
19823
19795
  var taskSchema = createSelectSchema(tasks, {
19824
19796
  scheduledAt: exports_external.coerce.date().nullable(),
@@ -20226,12 +20198,6 @@ var MODULE_KEYS = [
20226
20198
  "shopping",
20227
20199
  "inventory",
20228
20200
  "meals",
20229
- "library",
20230
- "watchlist",
20231
- "games",
20232
- "cellar",
20233
- "places",
20234
- "music",
20235
20201
  "contacts",
20236
20202
  "automations"
20237
20203
  ];
@@ -20331,48 +20297,6 @@ var FEATURE_MODULES = [
20331
20297
  group: "Household",
20332
20298
  defaultEnabled: true
20333
20299
  },
20334
- {
20335
- key: "library",
20336
- label: "Library",
20337
- description: "Books and things you catalog.",
20338
- group: "Collections",
20339
- defaultEnabled: true
20340
- },
20341
- {
20342
- key: "watchlist",
20343
- label: "Watchlist",
20344
- description: "Films and shows to watch.",
20345
- group: "Collections",
20346
- defaultEnabled: true
20347
- },
20348
- {
20349
- key: "games",
20350
- label: "Games",
20351
- description: "Games to play and backlog.",
20352
- group: "Collections",
20353
- defaultEnabled: true
20354
- },
20355
- {
20356
- key: "cellar",
20357
- label: "Cellar",
20358
- description: "Wines and bottles you keep.",
20359
- group: "Collections",
20360
- defaultEnabled: true
20361
- },
20362
- {
20363
- key: "places",
20364
- label: "Places",
20365
- description: "Spots to visit and remember.",
20366
- group: "Collections",
20367
- defaultEnabled: true
20368
- },
20369
- {
20370
- key: "music",
20371
- label: "Music",
20372
- description: "Albums and records to hear.",
20373
- group: "Collections",
20374
- defaultEnabled: true
20375
- },
20376
20300
  {
20377
20301
  key: "contacts",
20378
20302
  label: "Contacts",
@@ -20421,7 +20345,8 @@ var updateUserSettingsInputSchema = createUpdateSchema(userSettings, {
20421
20345
  theme: settingsThemeSchema.optional(),
20422
20346
  density: settingsDensitySchema.optional(),
20423
20347
  accent: settingsAccentSchema.optional(),
20424
- enabledModules: exports_external.array(exports_external.string().trim().min(1)).transform(normalizeEnabledModules).optional()
20348
+ enabledModules: exports_external.array(exports_external.string().trim().min(1)).transform(normalizeEnabledModules).optional(),
20349
+ autoRollOverdue: exports_external.boolean().optional()
20425
20350
  }).omit({ id: true, tenantId: true, userId: true, createdAt: true, updatedAt: true }).strict();
20426
20351
  // ../../packages/schema/src/contracts/notifications.ts
20427
20352
  var notificationSchema = createSelectSchema(notifications, {
@@ -20451,6 +20376,19 @@ var todayResponseSchema = exports_external.object({
20451
20376
  overdueTasks: exports_external.array(taskViewSchema),
20452
20377
  overdueOccurrences: exports_external.array(occurrenceViewSchema)
20453
20378
  });
20379
+ var rolloverInputSchema = exports_external.object({
20380
+ taskIds: exports_external.array(exports_external.string().min(1)).default([]),
20381
+ occurrenceIds: exports_external.array(exports_external.string().min(1)).default([]),
20382
+ action: exports_external.enum(["reschedule", "drop"]),
20383
+ to: exports_external.coerce.date().optional()
20384
+ }).refine((v) => v.action !== "reschedule" || v.to !== undefined, {
20385
+ message: "`to` is required when action is `reschedule`",
20386
+ path: ["to"]
20387
+ });
20388
+ var rolloverResultSchema = exports_external.object({
20389
+ tasks: exports_external.number().int().nonnegative(),
20390
+ occurrences: exports_external.number().int().nonnegative()
20391
+ });
20454
20392
  var reviewDayStatSchema = exports_external.object({
20455
20393
  date: exports_external.string(),
20456
20394
  completedTasks: exports_external.number().int().nonnegative(),
@@ -20531,15 +20469,6 @@ var shoppingListDetailSchema = shoppingListViewSchema.extend({
20531
20469
  });
20532
20470
  var setShoppingItemCheckedInputSchema = exports_external.object({ isChecked: exports_external.boolean() }).strict();
20533
20471
  // ../../packages/schema/src/presets/facets.ts
20534
- var MEDIA_SHELF_DISPLAY_KIND = "media-shelf";
20535
- var bookStatusValues = ["to-read", "reading", "read"];
20536
- var bookStatusSchema = exports_external.enum(bookStatusValues);
20537
- var mediaShelfFacetSchema = exports_external.object({
20538
- author: exports_external.string().min(1).max(200).nullish(),
20539
- coverUrl: exports_external.string().url().max(2048).nullish(),
20540
- status: bookStatusSchema.default("to-read"),
20541
- rating: exports_external.number().int().min(1).max(5).nullish()
20542
- }).strict();
20543
20472
  var PANTRY_DISPLAY_KIND = "pantry";
20544
20473
  var WARDROBE_DISPLAY_KIND = "wardrobe";
20545
20474
  var TOOLS_DISPLAY_KIND = "tools";
@@ -20575,75 +20504,11 @@ var medsFacetSchema = exports_external.object({
20575
20504
  refillBy: isoDateString.nullish(),
20576
20505
  prescription: exports_external.boolean().nullish()
20577
20506
  }).strict();
20578
- var WATCH_SHELF_DISPLAY_KIND = "watch-shelf";
20579
- var watchKindValues = ["movie", "show"];
20580
- var watchKindSchema = exports_external.enum(watchKindValues);
20581
- var watchStatusValues = ["to-watch", "watching", "watched"];
20582
- var watchStatusSchema = exports_external.enum(watchStatusValues);
20583
- var watchFacetSchema = exports_external.object({
20584
- kind: watchKindSchema.default("movie"),
20585
- status: watchStatusSchema.default("to-watch"),
20586
- rating: exports_external.number().int().min(1).max(5).nullish(),
20587
- year: exports_external.number().int().min(1888).max(2200).nullish(),
20588
- posterUrl: exports_external.string().url().max(2048).nullish()
20589
- }).strict();
20590
- var GAME_SHELF_DISPLAY_KIND = "game-shelf";
20591
- var gameStatusValues = ["backlog", "playing", "beaten", "dropped"];
20592
- var gameStatusSchema = exports_external.enum(gameStatusValues);
20593
- var gameFacetSchema = exports_external.object({
20594
- status: gameStatusSchema.default("backlog"),
20595
- platform: exports_external.string().min(1).max(100).nullish(),
20596
- rating: exports_external.number().int().min(1).max(5).nullish(),
20597
- hoursPlayed: exports_external.number().min(0).max(1e5).nullish(),
20598
- coverUrl: exports_external.string().url().max(2048).nullish()
20599
- }).strict();
20600
- var BOTTLE_SHELF_DISPLAY_KIND = "bottle-shelf";
20601
- var bottleTypeValues = ["wine", "whisky", "other"];
20602
- var bottleTypeSchema = exports_external.enum(bottleTypeValues);
20603
- var bottleFacetSchema = exports_external.object({
20604
- type: bottleTypeSchema.default("wine"),
20605
- region: exports_external.string().min(1).max(200).nullish(),
20606
- vintage: exports_external.number().int().min(1000).max(2200).nullish(),
20607
- rating: exports_external.number().int().min(1).max(5).nullish(),
20608
- drinkBy: isoDateString.nullish(),
20609
- quantity: exports_external.number().int().min(0).max(1e5).nullish()
20610
- }).strict();
20611
- var PLACE_SHELF_DISPLAY_KIND = "place-shelf";
20612
- var placeStatusValues = ["want", "visited"];
20613
- var placeStatusSchema = exports_external.enum(placeStatusValues);
20614
- var placeFacetSchema = exports_external.object({
20615
- status: placeStatusSchema.default("want"),
20616
- country: exports_external.string().min(1).max(120).nullish(),
20617
- city: exports_external.string().min(1).max(120).nullish(),
20618
- lat: exports_external.number().min(-90).max(90).nullish(),
20619
- lng: exports_external.number().min(-180).max(180).nullish(),
20620
- rating: exports_external.number().int().min(1).max(5).nullish(),
20621
- tripLink: exports_external.string().min(1).max(2048).nullish()
20622
- }).strict();
20623
- var ALBUM_SHELF_DISPLAY_KIND = "album-shelf";
20624
- var albumStatusValues = ["want", "owned", "listened"];
20625
- var albumStatusSchema = exports_external.enum(albumStatusValues);
20626
- var albumFormatValues = ["vinyl", "digital", "cd"];
20627
- var albumFormatSchema = exports_external.enum(albumFormatValues);
20628
- var albumFacetSchema = exports_external.object({
20629
- status: albumStatusSchema.default("want"),
20630
- artist: exports_external.string().min(1).max(200).nullish(),
20631
- format: albumFormatSchema.nullish(),
20632
- rating: exports_external.number().int().min(1).max(5).nullish(),
20633
- year: exports_external.number().int().min(1860).max(2200).nullish(),
20634
- coverUrl: exports_external.string().url().max(2048).nullish()
20635
- }).strict();
20636
20507
  var facetSchemasByDisplayKind = {
20637
- [MEDIA_SHELF_DISPLAY_KIND]: mediaShelfFacetSchema,
20638
20508
  [PANTRY_DISPLAY_KIND]: pantryFacetSchema,
20639
20509
  [WARDROBE_DISPLAY_KIND]: wardrobeFacetSchema,
20640
20510
  [TOOLS_DISPLAY_KIND]: toolsFacetSchema,
20641
- [MEDS_DISPLAY_KIND]: medsFacetSchema,
20642
- [WATCH_SHELF_DISPLAY_KIND]: watchFacetSchema,
20643
- [GAME_SHELF_DISPLAY_KIND]: gameFacetSchema,
20644
- [BOTTLE_SHELF_DISPLAY_KIND]: bottleFacetSchema,
20645
- [PLACE_SHELF_DISPLAY_KIND]: placeFacetSchema,
20646
- [ALBUM_SHELF_DISPLAY_KIND]: albumFacetSchema
20511
+ [MEDS_DISPLAY_KIND]: medsFacetSchema
20647
20512
  };
20648
20513
 
20649
20514
  // ../../packages/schema/src/contracts/inventory.ts
@@ -22256,7 +22121,7 @@ var filmFacetSchema = exports_external.object({
22256
22121
  episodeCount: exports_external.number().int().min(1).max(1e4).nullish(),
22257
22122
  currentEpisode: exports_external.number().int().min(0).max(1e4).nullish()
22258
22123
  }).strict();
22259
- var gameFacetSchema2 = exports_external.object({
22124
+ var gameFacetSchema = exports_external.object({
22260
22125
  platform: exports_external.string().min(1).max(120).nullish(),
22261
22126
  coverUrl,
22262
22127
  completion: exports_external.number().int().min(0).max(100).nullish()
@@ -22266,7 +22131,7 @@ var musicFacetSchema = exports_external.object({
22266
22131
  year: exports_external.number().int().min(1860).max(2100).nullish(),
22267
22132
  coverUrl
22268
22133
  }).strict();
22269
- var placeFacetSchema2 = exports_external.object({
22134
+ var placeFacetSchema = exports_external.object({
22270
22135
  address: exports_external.string().min(1).max(400).nullish(),
22271
22136
  lat: exports_external.number().min(-90).max(90).nullish(),
22272
22137
  lng: exports_external.number().min(-180).max(180).nullish()
@@ -22325,7 +22190,7 @@ var COLLECTION_TYPES = {
22325
22190
  done: "Beaten",
22326
22191
  dropped: "Dropped"
22327
22192
  },
22328
- facetSchema: gameFacetSchema2,
22193
+ facetSchema: gameFacetSchema,
22329
22194
  view: "grid",
22330
22195
  subtitleKey: "platform",
22331
22196
  lookupId: "igdb",
@@ -22348,7 +22213,7 @@ var COLLECTION_TYPES = {
22348
22213
  itemNoun: "place",
22349
22214
  statuses: ["want", "done"],
22350
22215
  statusLabels: { want: "Want", done: "Been" },
22351
- facetSchema: placeFacetSchema2,
22216
+ facetSchema: placeFacetSchema,
22352
22217
  view: "map",
22353
22218
  subtitleKey: "address",
22354
22219
  lookupId: "nominatim"
@@ -22456,12 +22321,6 @@ var presetEntitySchema = exports_external.enum([
22456
22321
  "habit",
22457
22322
  "list",
22458
22323
  "inventory",
22459
- "library",
22460
- "watchlist",
22461
- "games",
22462
- "cellar",
22463
- "places",
22464
- "music",
22465
22324
  "routine",
22466
22325
  "area",
22467
22326
  "project",
@@ -22817,38 +22676,6 @@ var automationPresets = [
22817
22676
  }
22818
22677
  ];
22819
22678
 
22820
- // ../../packages/schema/src/presets/features/cellar.ts
22821
- var bottles = [
22822
- { title: "Rioja Reserva", type: "wine", region: "Rioja", vintage: 2016 },
22823
- { title: "Lagavulin 16", type: "whisky", region: "Islay", vintage: 2008 },
22824
- { title: "Barolo", type: "wine", region: "Piedmont", vintage: 2018 }
22825
- ];
22826
- var cellarPreset = {
22827
- key: "cellar",
22828
- entity: "cellar",
22829
- name: "Cellar",
22830
- description: "Wine & whisky you keep \u2014 type, region, vintage and ratings.",
22831
- icon: "\uD83C\uDF77",
22832
- color: "#9f1239",
22833
- category: "Collecting",
22834
- displayKind: BOTTLE_SHELF_DISPLAY_KIND,
22835
- recipe: {
22836
- nodes: [
22837
- {
22838
- ref: "list",
22839
- kind: "shopping_list",
22840
- title: "Cellar",
22841
- displayKind: BOTTLE_SHELF_DISPLAY_KIND,
22842
- items: bottles.map((b) => ({
22843
- title: b.title,
22844
- facet: { type: b.type, region: b.region, vintage: b.vintage, quantity: 1 }
22845
- }))
22846
- }
22847
- ]
22848
- }
22849
- };
22850
- var cellarPresets = [cellarPreset];
22851
-
22852
22679
  // ../../packages/schema/src/presets/features/challenges.ts
22853
22680
  var challengePresetDefs = [
22854
22681
  {
@@ -22996,38 +22823,6 @@ var contactPresets = contactCircleDefs.map((def) => ({
22996
22823
  }
22997
22824
  }));
22998
22825
 
22999
- // ../../packages/schema/src/presets/features/games.ts
23000
- var games2 = [
23001
- { title: "Hollow Knight: Silksong", platform: "PC" },
23002
- { title: "Elden Ring", platform: "PS5" },
23003
- { title: "Baldur's Gate 3", platform: "PC" }
23004
- ];
23005
- var gamesPreset = {
23006
- key: "games",
23007
- entity: "games",
23008
- name: "Games to play",
23009
- description: "A backlog of games \u2014 covers, status and ratings.",
23010
- icon: "\uD83C\uDFAE",
23011
- color: "#8b5cf6",
23012
- category: "Playing",
23013
- displayKind: GAME_SHELF_DISPLAY_KIND,
23014
- recipe: {
23015
- nodes: [
23016
- {
23017
- ref: "list",
23018
- kind: "shopping_list",
23019
- title: "Games to play",
23020
- displayKind: GAME_SHELF_DISPLAY_KIND,
23021
- items: games2.map((g) => ({
23022
- title: g.title,
23023
- facet: { platform: g.platform, status: "backlog" }
23024
- }))
23025
- }
23026
- ]
23027
- }
23028
- };
23029
- var gamesPresets = [gamesPreset];
23030
-
23031
22826
  // ../../packages/schema/src/presets/features/habits.ts
23032
22827
  var habitPresets = [
23033
22828
  {
@@ -23652,37 +23447,7 @@ var listPresetDefs = [
23652
23447
  items: ["Change HVAC filter", "Clean gutters", "Test smoke alarms", "Descale kettle"]
23653
23448
  }
23654
23449
  ];
23655
- var booksToRead = [
23656
- { title: "Atomic Habits", author: "James Clear" },
23657
- { title: "Deep Work", author: "Cal Newport" },
23658
- { title: "The Pragmatic Programmer", author: "Andrew Hunt" }
23659
- ];
23660
- var booksToReadPreset = {
23661
- key: "books-to-read",
23662
- entity: "library",
23663
- name: "Books to Read",
23664
- description: "Your reading queue \u2014 covers, status and ratings.",
23665
- icon: "\uD83D\uDCDA",
23666
- color: "#f59e0b",
23667
- category: "Reading",
23668
- displayKind: MEDIA_SHELF_DISPLAY_KIND,
23669
- recipe: {
23670
- nodes: [
23671
- {
23672
- ref: "list",
23673
- kind: "shopping_list",
23674
- title: "Books to Read",
23675
- displayKind: MEDIA_SHELF_DISPLAY_KIND,
23676
- items: booksToRead.map((book) => ({
23677
- title: book.title,
23678
- facet: { author: book.author, status: "to-read" }
23679
- }))
23680
- }
23681
- ]
23682
- }
23683
- };
23684
23450
  var shoppingListPresets = [
23685
- booksToReadPreset,
23686
23451
  ...listPresetDefs.map((def) => ({
23687
23452
  key: def.key,
23688
23453
  entity: "list",
@@ -23910,70 +23675,6 @@ var mealPresets = [
23910
23675
  }
23911
23676
  ];
23912
23677
 
23913
- // ../../packages/schema/src/presets/features/music.ts
23914
- var albums = [
23915
- { title: "In Rainbows", artist: "Radiohead", year: 2007 },
23916
- { title: "Blonde", artist: "Frank Ocean", year: 2016 },
23917
- { title: "Random Access Memories", artist: "Daft Punk", year: 2013 }
23918
- ];
23919
- var musicPreset = {
23920
- key: "music",
23921
- entity: "music",
23922
- name: "Albums",
23923
- description: "Albums to hear and own \u2014 artist, format, status and ratings.",
23924
- icon: "\uD83D\uDCBF",
23925
- color: "#db2777",
23926
- category: "Listening",
23927
- displayKind: ALBUM_SHELF_DISPLAY_KIND,
23928
- recipe: {
23929
- nodes: [
23930
- {
23931
- ref: "list",
23932
- kind: "shopping_list",
23933
- title: "Albums",
23934
- displayKind: ALBUM_SHELF_DISPLAY_KIND,
23935
- items: albums.map((a) => ({
23936
- title: a.title,
23937
- facet: { artist: a.artist, year: a.year, status: "want" }
23938
- }))
23939
- }
23940
- ]
23941
- }
23942
- };
23943
- var musicPresets = [musicPreset];
23944
-
23945
- // ../../packages/schema/src/presets/features/places.ts
23946
- var places = [
23947
- { title: "Kyoto temples", country: "Japan", city: "Kyoto" },
23948
- { title: "Northern Lights", country: "Iceland", city: "Reykjav\xEDk" },
23949
- { title: "Patagonia trek", country: "Argentina", city: "El Chalt\xE9n" }
23950
- ];
23951
- var placesPreset = {
23952
- key: "places",
23953
- entity: "places",
23954
- name: "Places to go",
23955
- description: "A bucket-list of places \u2014 want/visited, location and ratings.",
23956
- icon: "\uD83D\uDCCD",
23957
- color: "#0d9488",
23958
- category: "Exploring",
23959
- displayKind: PLACE_SHELF_DISPLAY_KIND,
23960
- recipe: {
23961
- nodes: [
23962
- {
23963
- ref: "list",
23964
- kind: "shopping_list",
23965
- title: "Places to go",
23966
- displayKind: PLACE_SHELF_DISPLAY_KIND,
23967
- items: places.map((p) => ({
23968
- title: p.title,
23969
- facet: { country: p.country, city: p.city, status: "want" }
23970
- }))
23971
- }
23972
- ]
23973
- }
23974
- };
23975
- var placesPresets = [placesPreset];
23976
-
23977
23678
  // ../../packages/schema/src/presets/features/projects.ts
23978
23679
  var projectPresetDefs = [
23979
23680
  {
@@ -24162,47 +23863,10 @@ var routinePresets = routinePresetDefs.map((def) => ({
24162
23863
  }
24163
23864
  }));
24164
23865
 
24165
- // ../../packages/schema/src/presets/features/watchlist.ts
24166
- var watchlistTitles = [
24167
- { title: "Dune: Part Two", kind: "movie", year: 2024 },
24168
- { title: "Oppenheimer", kind: "movie", year: 2023 },
24169
- { title: "Severance", kind: "show", year: 2022 }
24170
- ];
24171
- var watchlistPreset = {
24172
- key: "watchlist",
24173
- entity: "watchlist",
24174
- name: "Watchlist",
24175
- description: "Films & shows to watch \u2014 posters, status and ratings.",
24176
- icon: "\uD83C\uDFAC",
24177
- color: "#6366f1",
24178
- category: "Watching",
24179
- displayKind: WATCH_SHELF_DISPLAY_KIND,
24180
- recipe: {
24181
- nodes: [
24182
- {
24183
- ref: "list",
24184
- kind: "shopping_list",
24185
- title: "Watchlist",
24186
- displayKind: WATCH_SHELF_DISPLAY_KIND,
24187
- items: watchlistTitles.map((t) => ({
24188
- title: t.title,
24189
- facet: { kind: t.kind, year: t.year, status: "to-watch" }
24190
- }))
24191
- }
24192
- ]
24193
- }
24194
- };
24195
- var watchlistPresets = [watchlistPreset];
24196
-
24197
23866
  // ../../packages/schema/src/presets/features/index.ts
24198
23867
  var featurePresets = [
24199
23868
  ...habitPresets,
24200
23869
  ...shoppingListPresets,
24201
- ...watchlistPresets,
24202
- ...gamesPresets,
24203
- ...cellarPresets,
24204
- ...placesPresets,
24205
- ...musicPresets,
24206
23870
  ...inventoryPresets,
24207
23871
  ...routinePresets,
24208
23872
  ...areaPresets,
@@ -24468,7 +24132,7 @@ function parseCapture2(input, now) {
24468
24132
 
24469
24133
  // src/meta.ts
24470
24134
  var CLI_NAME = "do";
24471
- var VERSION = "1.87.0";
24135
+ var VERSION = "1.89.0";
24472
24136
  var API_PREFIX = "/api/v1";
24473
24137
  var DEFAULT_API_URL = "http://localhost:3001";
24474
24138
 
@@ -24502,6 +24166,16 @@ class DoClient {
24502
24166
  delete(path) {
24503
24167
  return this.request("DELETE", path, {});
24504
24168
  }
24169
+ async getPage(path, opts = {}) {
24170
+ const res = await this.send("GET", path, opts);
24171
+ if (res.status === 204)
24172
+ return { data: [], nextCursor: null };
24173
+ const text2 = await res.text();
24174
+ const parsed = text2.length > 0 ? safeJson(text2) : undefined;
24175
+ if (!res.ok)
24176
+ throw httpError(res.status, parsed);
24177
+ return normalizePage(parsed);
24178
+ }
24505
24179
  url(path, query) {
24506
24180
  const origin = this.opts.apiUrl.replace(/\/+$/, "");
24507
24181
  const url2 = new URL(`${origin}${API_PREFIX}${path}`);
@@ -24550,6 +24224,16 @@ function unwrapEnvelope(body) {
24550
24224
  }
24551
24225
  return body;
24552
24226
  }
24227
+ function normalizePage(body) {
24228
+ if (typeof body === "object" && body !== null && !Array.isArray(body) && "nextCursor" in body) {
24229
+ const record2 = body;
24230
+ if (Array.isArray(record2.data)) {
24231
+ const nextCursor = typeof record2.nextCursor === "string" ? record2.nextCursor : null;
24232
+ return { data: record2.data, nextCursor };
24233
+ }
24234
+ }
24235
+ return { data: Array.isArray(body) ? body : [], nextCursor: null };
24236
+ }
24553
24237
  function safeJson(text2) {
24554
24238
  try {
24555
24239
  return JSON.parse(text2);
@@ -24781,102 +24465,6 @@ var ENTITIES = [
24781
24465
  canDelete: true
24782
24466
  }
24783
24467
  },
24784
- {
24785
- name: "library",
24786
- path: "/library",
24787
- readScope: "collections:read",
24788
- returns: "ShoppingList",
24789
- canGet: true,
24790
- listFlags: [],
24791
- write: {
24792
- scope: "collections:write",
24793
- createSchema: createShoppingListInputSchema,
24794
- createInput: "CreateShoppingListInput",
24795
- updateSchema: updateShoppingListInputSchema,
24796
- updateInput: "UpdateShoppingListInput",
24797
- canDelete: true
24798
- }
24799
- },
24800
- {
24801
- name: "watchlist",
24802
- path: "/watchlist",
24803
- readScope: "collections:read",
24804
- returns: "ShoppingList",
24805
- canGet: true,
24806
- listFlags: [],
24807
- write: {
24808
- scope: "collections:write",
24809
- createSchema: createShoppingListInputSchema,
24810
- createInput: "CreateShoppingListInput",
24811
- updateSchema: updateShoppingListInputSchema,
24812
- updateInput: "UpdateShoppingListInput",
24813
- canDelete: true
24814
- }
24815
- },
24816
- {
24817
- name: "games",
24818
- path: "/games",
24819
- readScope: "collections:read",
24820
- returns: "ShoppingList",
24821
- canGet: true,
24822
- listFlags: [],
24823
- write: {
24824
- scope: "collections:write",
24825
- createSchema: createShoppingListInputSchema,
24826
- createInput: "CreateShoppingListInput",
24827
- updateSchema: updateShoppingListInputSchema,
24828
- updateInput: "UpdateShoppingListInput",
24829
- canDelete: true
24830
- }
24831
- },
24832
- {
24833
- name: "cellar",
24834
- path: "/cellar",
24835
- readScope: "collections:read",
24836
- returns: "ShoppingList",
24837
- canGet: true,
24838
- listFlags: [],
24839
- write: {
24840
- scope: "collections:write",
24841
- createSchema: createShoppingListInputSchema,
24842
- createInput: "CreateShoppingListInput",
24843
- updateSchema: updateShoppingListInputSchema,
24844
- updateInput: "UpdateShoppingListInput",
24845
- canDelete: true
24846
- }
24847
- },
24848
- {
24849
- name: "places",
24850
- path: "/places",
24851
- readScope: "collections:read",
24852
- returns: "ShoppingList",
24853
- canGet: true,
24854
- listFlags: [],
24855
- write: {
24856
- scope: "collections:write",
24857
- createSchema: createShoppingListInputSchema,
24858
- createInput: "CreateShoppingListInput",
24859
- updateSchema: updateShoppingListInputSchema,
24860
- updateInput: "UpdateShoppingListInput",
24861
- canDelete: true
24862
- }
24863
- },
24864
- {
24865
- name: "music",
24866
- path: "/music",
24867
- readScope: "collections:read",
24868
- returns: "ShoppingList",
24869
- canGet: true,
24870
- listFlags: [],
24871
- write: {
24872
- scope: "collections:write",
24873
- createSchema: createShoppingListInputSchema,
24874
- createInput: "CreateShoppingListInput",
24875
- updateSchema: updateShoppingListInputSchema,
24876
- updateInput: "UpdateShoppingListInput",
24877
- canDelete: true
24878
- }
24879
- },
24880
24468
  {
24881
24469
  name: "inventory-items",
24882
24470
  path: "/inventory-items",
@@ -24964,6 +24552,14 @@ function entityOperations(e) {
24964
24552
  }
24965
24553
 
24966
24554
  // src/registry.ts
24555
+ var PAGINATION_FLAGS = [
24556
+ { name: "limit", type: "string", description: "Max rows to return (1\u2013100)." },
24557
+ {
24558
+ name: "cursor",
24559
+ type: "string",
24560
+ description: "Opaque keyset cursor from a previous page's nextCursor."
24561
+ }
24562
+ ];
24967
24563
  var GLOBAL_FLAGS = [
24968
24564
  { name: "json", type: "boolean", description: "Emit JSON (automatic when stdout is piped)." },
24969
24565
  { name: "quiet", type: "boolean", description: "Suppress human output (errors still report)." },
@@ -25115,7 +24711,7 @@ var COMMAND_SPECS = [
25115
24711
  {
25116
24712
  name: "entity",
25117
24713
  type: "string",
25118
- description: "Filter to one gallery facet (habit|list|library|watchlist|games|cellar|places|music|routine|area|project|recipe|contact|challenge|automation)."
24714
+ description: "Filter to one gallery facet (habit|list|routine|area|project|recipe|contact|challenge|automation)."
25119
24715
  }
25120
24716
  ],
25121
24717
  scopes: ["presets:read"],
@@ -25151,7 +24747,8 @@ var COMMAND_SPECS = [
25151
24747
  type: "string",
25152
24748
  description: "Filter to one Status (want|have|doing|done|dropped)."
25153
24749
  },
25154
- { name: "tag", type: "string", description: "Filter to Items carrying this tag." }
24750
+ { name: "tag", type: "string", description: "Filter to Items carrying this tag." },
24751
+ ...PAGINATION_FLAGS
25155
24752
  ],
25156
24753
  scopes: ["collections:read"],
25157
24754
  returns: "CollectionItemView"
@@ -25523,11 +25120,18 @@ function buildManifest() {
25523
25120
  }
25524
25121
  } : {},
25525
25122
  returns: e.returns,
25526
- listFlags: e.listFlags.map((f) => ({
25527
- name: f.name,
25528
- description: f.description,
25529
- required: f.required ?? false
25530
- }))
25123
+ listFlags: [
25124
+ ...e.listFlags.map((f) => ({
25125
+ name: f.name,
25126
+ description: f.description,
25127
+ required: f.required ?? false
25128
+ })),
25129
+ ...PAGINATION_FLAGS.map((f) => ({
25130
+ name: f.name,
25131
+ description: f.description,
25132
+ required: false
25133
+ }))
25134
+ ]
25531
25135
  })),
25532
25136
  exitCodes: {
25533
25137
  success: EXIT.OK,
@@ -25647,17 +25251,35 @@ function renderWhoami(data, mode) {
25647
25251
  `);
25648
25252
  }
25649
25253
  function renderList(data, mode) {
25650
- if (!Array.isArray(data))
25254
+ const page = asPage(data);
25255
+ if (page === undefined)
25651
25256
  return renderRecord(data, mode);
25652
- if (data.length === 0)
25653
- return paint(mode, "dim", "(no records)");
25654
- const lines = data.map((row) => {
25655
- const label = labelOf(row);
25656
- const id = idOf(row);
25657
- return id ? ` ${label} ${paint(mode, "dim", id)}` : ` ${label}`;
25658
- });
25659
- return [`${data.length} record(s):`, ...lines].join(`
25257
+ const { rows, nextCursor } = page;
25258
+ const body = rows.length === 0 ? paint(mode, "dim", "(no records)") : [
25259
+ `${rows.length} record(s):`,
25260
+ ...rows.map((row) => {
25261
+ const label = labelOf(row);
25262
+ const id = idOf(row);
25263
+ return id ? ` ${label} ${paint(mode, "dim", id)}` : ` ${label}`;
25264
+ })
25265
+ ].join(`
25660
25266
  `);
25267
+ if (nextCursor === null)
25268
+ return body;
25269
+ return `${body}
25270
+ ${paint(mode, "dim", `\u2026 more \u2014 rerun with --cursor ${nextCursor}`)}`;
25271
+ }
25272
+ function asPage(data) {
25273
+ if (Array.isArray(data))
25274
+ return { rows: data, nextCursor: null };
25275
+ if (data !== null && typeof data === "object" && "nextCursor" in data) {
25276
+ const record2 = data;
25277
+ if (Array.isArray(record2.data)) {
25278
+ const nextCursor = typeof record2.nextCursor === "string" ? record2.nextCursor : null;
25279
+ return { rows: record2.data, nextCursor };
25280
+ }
25281
+ }
25282
+ return;
25661
25283
  }
25662
25284
  function renderRecord(data, mode) {
25663
25285
  if (data === null || typeof data !== "object")
@@ -25847,7 +25469,8 @@ async function dispatchEntity(entity, rest, flags, requireClient) {
25847
25469
  else if (f.required)
25848
25470
  throw usageError(`\`${entity.name} list\` requires --${f.name}`);
25849
25471
  }
25850
- return { data: await client.get(entity.path, { query }), render: renderList };
25472
+ applyPageFlags(query, flags);
25473
+ return { data: await client.getPage(entity.path, { query }), render: renderList };
25851
25474
  }
25852
25475
  if (op === "get") {
25853
25476
  if (!entity.canGet)
@@ -26015,7 +25638,8 @@ var HANDLERS = {
26015
25638
  status: flagString(flags, "status"),
26016
25639
  tag: flagString(flags, "tag")
26017
25640
  };
26018
- return { data: await requireClient().get("/collection", { query }), render: renderList };
25641
+ applyPageFlags(query, flags);
25642
+ return { data: await requireClient().getPage("/collection", { query }), render: renderList };
26019
25643
  },
26020
25644
  "collection add": async ({ args, flags, requireClient }) => {
26021
25645
  const { title, tags: tags2 } = parseTitleTags(args);
@@ -26229,6 +25853,19 @@ var HANDLERS = {
26229
25853
  render: () => `${CLI_NAME} ${VERSION}`
26230
25854
  })
26231
25855
  };
25856
+ function applyPageFlags(query, flags) {
25857
+ const limit = flagString(flags, "limit");
25858
+ if (limit !== undefined) {
25859
+ const n = Number(limit);
25860
+ if (!Number.isInteger(n) || n <= 0) {
25861
+ throw usageError("--limit must be a positive integer");
25862
+ }
25863
+ query.limit = String(n);
25864
+ }
25865
+ const cursor = flagString(flags, "cursor");
25866
+ if (cursor !== undefined)
25867
+ query.cursor = cursor;
25868
+ }
26232
25869
  async function setModuleVisibility(args, requireClient, on) {
26233
25870
  const key = requireArg(args, 0, "module key");
26234
25871
  if (!isModuleKey(key)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robbeverhelst/do",
3
- "version": "1.87.0",
3
+ "version": "1.89.0",
4
4
  "private": false,
5
5
  "description": "do — the agent-drivable CLI over the public /api/v1 surface",
6
6
  "type": "module",