@robbeverhelst/do 1.308.1 → 1.308.2

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 +112 -50
  2. package/package.json +1 -1
package/dist/do.js CHANGED
@@ -4630,8 +4630,16 @@ var animals = pgTable("animals", {
4630
4630
  }, (t) => [index("animals_tenant_idx").on(t.tenantId), index("animals_species_idx").on(t.speciesId)]);
4631
4631
  var animalLostCards = pgTable("animal_lost_cards", {
4632
4632
  animalId: text("animal_id").primaryKey().references(() => animals.id, { onDelete: "cascade" }),
4633
+ id: text("id").notNull().unique(),
4633
4634
  tenantId: text("tenant_id").notNull().references(() => tenants.id),
4634
- token: text("token").notNull().unique(),
4635
+ token: text("token").unique(),
4636
+ tokenHash: text("token_hash").notNull().unique(),
4637
+ tokenSealed: text("token_sealed"),
4638
+ expiresAt: timestamp("expires_at", { withTimezone: true }),
4639
+ revokedAt: timestamp("revoked_at", { withTimezone: true }),
4640
+ opens: integer("opens").notNull().default(0),
4641
+ lastOpenedAt: timestamp("last_opened_at", { withTimezone: true }),
4642
+ createdByUserId: text("created_by_user_id").references(() => users.id),
4635
4643
  photoFileId: text("photo_file_id"),
4636
4644
  phone: text("phone"),
4637
4645
  showChipped: boolean("show_chipped").notNull().default(false),
@@ -5721,6 +5729,8 @@ var invites = pgTable("invites", {
5721
5729
  type: inviteType("type").notNull(),
5722
5730
  email: text("email"),
5723
5731
  token: text("token").unique(),
5732
+ tokenHash: text("token_hash").unique(),
5733
+ tokenSealed: text("token_sealed"),
5724
5734
  role: baseRole("role").notNull().default("member"),
5725
5735
  customRoleId: text("custom_role_id").references(() => roles.id),
5726
5736
  invitedByUserId: text("invited_by_user_id").references(() => users.id),
@@ -5749,7 +5759,7 @@ var shareLinks = pgTable("share_links", {
5749
5759
  id: text("id").primaryKey(),
5750
5760
  tenantId: text("tenant_id").notNull().references(() => tenants.id),
5751
5761
  nodeId: text("node_id").notNull().references(() => nodes.id),
5752
- token: text("token").notNull().unique(),
5762
+ tokenHash: text("token_hash").notNull().unique(),
5753
5763
  capability: capability("capability").notNull().default("view"),
5754
5764
  createdByUserId: text("created_by_user_id").references(() => users.id),
5755
5765
  expiresAt: timestamp("expires_at", { withTimezone: true }),
@@ -29358,7 +29368,7 @@ var inviteSchema = createSelectSchema(invites, {
29358
29368
  acceptedAt: exports_coerce.date().nullable(),
29359
29369
  createdAt: exports_coerce.date(),
29360
29370
  updatedAt: exports_coerce.date()
29361
- });
29371
+ }).omit({ tokenHash: true, tokenSealed: true });
29362
29372
  var createInviteInputSchema = object({
29363
29373
  id: ulidSchema,
29364
29374
  type: _enum2(["email", "link", "guest"]),
@@ -29423,7 +29433,7 @@ var shareLinkSchema = createSelectSchema(shareLinks, {
29423
29433
  createdAt: exports_coerce.date(),
29424
29434
  updatedAt: exports_coerce.date()
29425
29435
  });
29426
- var shareLinkPublicSchema = shareLinkSchema.omit({ token: true });
29436
+ var shareLinkPublicSchema = shareLinkSchema.omit({ tokenHash: true });
29427
29437
  var createShareLinkInputSchema = createInsertSchema(shareLinks, {
29428
29438
  id: ulidSchema,
29429
29439
  nodeId: ulidSchema,
@@ -29431,7 +29441,7 @@ var createShareLinkInputSchema = createInsertSchema(shareLinks, {
29431
29441
  expiresAt: exports_coerce.date().nullish()
29432
29442
  }).omit({
29433
29443
  tenantId: true,
29434
- token: true,
29444
+ tokenHash: true,
29435
29445
  createdByUserId: true,
29436
29446
  revokedAt: true,
29437
29447
  createdAt: true,
@@ -32296,6 +32306,24 @@ var householdOperations = defineOperations({
32296
32306
  })
32297
32307
  });
32298
32308
 
32309
+ // ../../packages/schema/src/operations/incidents.ts
32310
+ var incidentOperations = defineOperations({
32311
+ ...crudOperations({
32312
+ segment: "incidents",
32313
+ tag: "Incidents",
32314
+ noun: "incident",
32315
+ read: "documents:read",
32316
+ write: "documents:write",
32317
+ create: createIncidentInputSchema,
32318
+ update: updateIncidentInputSchema,
32319
+ listQuery: [
32320
+ { name: "status", description: "Only this status (`open`, `claimed`, `closed`)." },
32321
+ { name: "policyId", description: "Only the incidents under this policy (a document id)." }
32322
+ ],
32323
+ listQuerySchema: incidentsQuerySchema
32324
+ })
32325
+ });
32326
+
32299
32327
  // ../../packages/schema/src/operations/inventory-items.ts
32300
32328
  var inventoryItemOperations = defineOperations({
32301
32329
  ...crudOperations({
@@ -32701,6 +32729,38 @@ var journalOperations = defineOperations({
32701
32729
  }
32702
32730
  });
32703
32731
 
32732
+ // ../../packages/schema/src/operations/key-dates.ts
32733
+ var keyDateOperations = defineOperations({
32734
+ ...crudOperations({
32735
+ segment: "key-dates",
32736
+ tag: "Key dates",
32737
+ noun: "key date",
32738
+ read: "key-dates:read",
32739
+ write: "key-dates:write",
32740
+ create: createKeyDateInputSchema,
32741
+ update: updateKeyDateInputSchema,
32742
+ listQuery: [
32743
+ {
32744
+ name: "nodeId",
32745
+ description: "Only the key dates on this node (a contact, a document, \u2026)."
32746
+ },
32747
+ {
32748
+ name: "kind",
32749
+ description: "Only this kind (`birthday`, `renews`, `cancel_by`, `expires`, `follow_up`, `due_back`, \u2026)."
32750
+ },
32751
+ {
32752
+ name: "from",
32753
+ description: "Only dates whose next occurrence is on or after this day (`YYYY-MM-DD`)."
32754
+ },
32755
+ {
32756
+ name: "to",
32757
+ description: "Only dates whose next occurrence is on or before this day (`YYYY-MM-DD`)."
32758
+ }
32759
+ ],
32760
+ listQuerySchema: keyDatesQuerySchema
32761
+ })
32762
+ });
32763
+
32704
32764
  // ../../packages/schema/src/operations/keys.ts
32705
32765
  var keyOperations = defineOperations({
32706
32766
  list: {
@@ -33125,6 +33185,32 @@ var periodOperations = defineOperations({
33125
33185
  })
33126
33186
  });
33127
33187
 
33188
+ // ../../packages/schema/src/operations/places.ts
33189
+ var placeOperations = defineOperations({
33190
+ ...crudOperations({
33191
+ segment: "places",
33192
+ tag: "Places",
33193
+ noun: "place",
33194
+ read: "places:read",
33195
+ write: "places:write",
33196
+ create: createPlaceInputSchema,
33197
+ update: updatePlaceInputSchema
33198
+ }),
33199
+ importHouse: {
33200
+ method: "post",
33201
+ path: "/places/import",
33202
+ scopes: ["places:write"],
33203
+ tag: "Places",
33204
+ summary: "Import Places from house.json",
33205
+ description: "Import the rooms of one house from Gaard's `house.json` (`{ file, houseIndex? }`; the first house by default). Each room not imported before becomes a Place with its floor and outline; rooms already imported, even ones deleted since, are skipped, so do keeps what it owns. No sync with Gaard. Returns `{ created, skipped, places }`; fires `place.imported`.",
33206
+ body: importPlacesInputSchema,
33207
+ status: 200,
33208
+ response: { description: "`{ created, skipped, places }`." },
33209
+ errors: { 400: true },
33210
+ webhook: "place.imported"
33211
+ }
33212
+ });
33213
+
33128
33214
  // ../../packages/schema/src/operations/planning-rules.ts
33129
33215
  var planningRuleOperations = defineOperations({
33130
33216
  ...crudOperations({
@@ -35256,7 +35342,7 @@ function parseCapture2(input, now) {
35256
35342
 
35257
35343
  // src/meta.ts
35258
35344
  var CLI_NAME = "do";
35259
- var VERSION = "1.308.1";
35345
+ var VERSION = "1.308.2";
35260
35346
  var API_PREFIX = "/api/v1";
35261
35347
  var DEFAULT_API_URL = "http://localhost:3001";
35262
35348
 
@@ -35765,22 +35851,13 @@ var ENTITIES = [
35765
35851
  createInput: "CreateAreaInput",
35766
35852
  updateInput: "UpdateAreaInput"
35767
35853
  }),
35768
- {
35854
+ entityFromOperations(placeOperations, {
35769
35855
  name: "places",
35770
- path: "/places",
35771
- readScopes: ["places:read"],
35772
35856
  returns: "PlaceView",
35773
- canGet: true,
35774
35857
  listFlags: [],
35775
- write: {
35776
- scopes: ["places:write"],
35777
- createSchema: createPlaceInputSchema,
35778
- createInput: "CreatePlaceInput",
35779
- updateSchema: updatePlaceInputSchema,
35780
- updateInput: "UpdatePlaceInput",
35781
- canDelete: true
35782
- }
35783
- },
35858
+ createInput: "CreatePlaceInput",
35859
+ updateInput: "UpdatePlaceInput"
35860
+ }),
35784
35861
  entityFromOperations(routineOperations, {
35785
35862
  name: "routines",
35786
35863
  returns: "RoutineView",
@@ -35959,12 +36036,9 @@ var ENTITIES = [
35959
36036
  createInput: "CreateGuestInput",
35960
36037
  updateInput: "UpdateGuestInput"
35961
36038
  }),
35962
- {
36039
+ entityFromOperations(keyDateOperations, {
35963
36040
  name: "key-dates",
35964
- path: "/key-dates",
35965
- readScopes: ["key-dates:read"],
35966
36041
  returns: "KeyDateView",
35967
- canGet: true,
35968
36042
  listFlags: [
35969
36043
  { name: "node", description: "only the key dates on this node id", query: "nodeId" },
35970
36044
  {
@@ -35983,15 +36057,9 @@ var ENTITIES = [
35983
36057
  query: "to"
35984
36058
  }
35985
36059
  ],
35986
- write: {
35987
- scopes: ["key-dates:write"],
35988
- createSchema: createKeyDateInputSchema,
35989
- createInput: "CreateKeyDateInput",
35990
- updateSchema: updateKeyDateInputSchema,
35991
- updateInput: "UpdateKeyDateInput",
35992
- canDelete: true
35993
- }
35994
- },
36060
+ createInput: "CreateKeyDateInput",
36061
+ updateInput: "UpdateKeyDateInput"
36062
+ }),
35995
36063
  {
35996
36064
  name: "documents",
35997
36065
  path: "/documents",
@@ -36024,12 +36092,9 @@ var ENTITIES = [
36024
36092
  canDelete: true
36025
36093
  }
36026
36094
  },
36027
- {
36095
+ entityFromOperations(incidentOperations, {
36028
36096
  name: "incidents",
36029
- path: "/incidents",
36030
- readScopes: ["documents:read"],
36031
36097
  returns: "IncidentView",
36032
- canGet: true,
36033
36098
  listFlags: [
36034
36099
  { name: "status", description: "only this status (open, claimed, closed)", query: "status" },
36035
36100
  {
@@ -36038,15 +36103,9 @@ var ENTITIES = [
36038
36103
  query: "policyId"
36039
36104
  }
36040
36105
  ],
36041
- write: {
36042
- scopes: ["documents:write"],
36043
- createSchema: createIncidentInputSchema,
36044
- createInput: "CreateIncidentInput",
36045
- updateSchema: updateIncidentInputSchema,
36046
- updateInput: "UpdateIncidentInput",
36047
- canDelete: true
36048
- }
36049
- },
36106
+ createInput: "CreateIncidentInput",
36107
+ updateInput: "UpdateIncidentInput"
36108
+ }),
36050
36109
  entityFromOperations(periodOperations, {
36051
36110
  name: "periods",
36052
36111
  returns: "PeriodView",
@@ -38255,9 +38314,9 @@ var COMMAND_SPECS = [
38255
38314
  description: "The rest of the create body (JSON), e.g. claimNo; overrides the flags."
38256
38315
  }
38257
38316
  ],
38258
- scopes: ["documents:write"],
38317
+ scopes: [...incidentOperations.create.scopes],
38259
38318
  returns: "IncidentView",
38260
- notes: `POST /api/v1/incidents. A policy or Place that isn't a live one in the Space is a 400. Tick steps off with \`do incidents update <id> --data '{"steps":[{"id":"photos","done":true}]}'\`.`
38319
+ notes: `${routeOf(incidentOperations.create)}. A policy or Place that isn't a live one in the Space is a 400. Tick steps off with \`do incidents update <id> --data '{"steps":[{"id":"photos","done":true}]}'\`.`
38261
38320
  },
38262
38321
  {
38263
38322
  path: ["notes", "backlinks"],
@@ -40848,7 +40907,7 @@ var COMMAND_SPECS = [
40848
40907
  description: "Which house in the file (0 = the first, the default)."
40849
40908
  }
40850
40909
  ],
40851
- scopes: ["places:write"],
40910
+ scopes: [...placeOperations.importHouse.scopes],
40852
40911
  returns: "ImportPlacesResult",
40853
40912
  notes: "Each room becomes a Place; rooms already imported (even ones deleted since) are skipped, so do keeps what it owns. No sync with Gaard. Returns { created, skipped, places }."
40854
40913
  },
@@ -44572,7 +44631,10 @@ var HANDLERS = {
44572
44631
  ...fromFlags,
44573
44632
  ...readDataFlag(flags)
44574
44633
  });
44575
- return { data: await requireClient().post("/incidents", body), render: renderRecord };
44634
+ return {
44635
+ data: await requireClient().post(pathOf(incidentOperations.create), body),
44636
+ render: renderRecord
44637
+ };
44576
44638
  },
44577
44639
  "food log": async ({ flags, requireClient }) => {
44578
44640
  if (flagString(flags, "data") === undefined)
@@ -46761,7 +46823,7 @@ var HANDLERS = {
46761
46823
  file,
46762
46824
  ...house !== undefined ? { houseIndex: Number(house) } : {}
46763
46825
  });
46764
- const result = importPlacesResultSchema.parse(await requireClient().post("/places/import", body));
46826
+ const result = importPlacesResultSchema.parse(await requireClient().post(pathOf(placeOperations.importHouse), body));
46765
46827
  return { data: result, render: renderRecord };
46766
46828
  },
46767
46829
  "people note": async ({ flags, requireClient }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robbeverhelst/do",
3
- "version": "1.308.1",
3
+ "version": "1.308.2",
4
4
  "private": false,
5
5
  "description": "do — the agent-drivable CLI over the public /api/v1 surface",
6
6
  "homepage": "https://github.com/robbeverhelst/do/tree/main/apps/cli",