@robbeverhelst/do 1.20.10 → 1.22.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 +226 -26
- package/package.json +1 -1
package/dist/do.js
CHANGED
|
@@ -1177,6 +1177,33 @@ function mapColumnsInSQLToAlias(query, alias) {
|
|
|
1177
1177
|
}));
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
1180
|
+
// ../../node_modules/.bun/drizzle-orm@0.45.2+c7294ea0f0c54ed0/node_modules/drizzle-orm/pg-core/checks.js
|
|
1181
|
+
class CheckBuilder {
|
|
1182
|
+
constructor(name, value) {
|
|
1183
|
+
this.name = name;
|
|
1184
|
+
this.value = value;
|
|
1185
|
+
}
|
|
1186
|
+
static [entityKind] = "PgCheckBuilder";
|
|
1187
|
+
brand;
|
|
1188
|
+
build(table) {
|
|
1189
|
+
return new Check(table, this);
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
class Check {
|
|
1194
|
+
constructor(table, builder) {
|
|
1195
|
+
this.table = table;
|
|
1196
|
+
this.name = builder.name;
|
|
1197
|
+
this.value = builder.value;
|
|
1198
|
+
}
|
|
1199
|
+
static [entityKind] = "PgCheck";
|
|
1200
|
+
name;
|
|
1201
|
+
value;
|
|
1202
|
+
}
|
|
1203
|
+
function check(name, value) {
|
|
1204
|
+
return new CheckBuilder(name, value);
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1180
1207
|
// ../../node_modules/.bun/drizzle-orm@0.45.2+c7294ea0f0c54ed0/node_modules/drizzle-orm/utils.js
|
|
1181
1208
|
function orderSelectedFields(fields, pathPrefix) {
|
|
1182
1209
|
return Object.entries(fields).reduce((result, [name, field]) => {
|
|
@@ -4202,8 +4229,29 @@ var nodes = pgTable("nodes", {
|
|
|
4202
4229
|
index("nodes_tenant_type_idx").on(t.tenantId, t.type),
|
|
4203
4230
|
index("nodes_parent_idx").on(t.parentId)
|
|
4204
4231
|
]);
|
|
4232
|
+
// ../../packages/schema/src/db/areas.ts
|
|
4233
|
+
var areaColor = pgEnum("area_color", [
|
|
4234
|
+
"teal",
|
|
4235
|
+
"purple",
|
|
4236
|
+
"amber",
|
|
4237
|
+
"rose",
|
|
4238
|
+
"blue",
|
|
4239
|
+
"green",
|
|
4240
|
+
"red",
|
|
4241
|
+
"slate"
|
|
4242
|
+
]);
|
|
4243
|
+
var reviewCadence = pgEnum("review_cadence", ["weekly", "monthly", "quarterly"]);
|
|
4244
|
+
var areas = pgTable("areas", {
|
|
4245
|
+
id: text("id").primaryKey().references(() => nodes.id),
|
|
4246
|
+
tenantId: text("tenant_id").notNull().references(() => tenants.id),
|
|
4247
|
+
color: areaColor("color").notNull().default("teal"),
|
|
4248
|
+
icon: text("icon"),
|
|
4249
|
+
reviewCadence: reviewCadence("review_cadence")
|
|
4250
|
+
}, (t) => [index("areas_tenant_idx").on(t.tenantId)]);
|
|
4251
|
+
|
|
4205
4252
|
// ../../packages/schema/src/db/core.ts
|
|
4206
4253
|
var routineKind = pgEnum("routine_kind", ["sequence", "time_blocked"]);
|
|
4254
|
+
var routineStepRef = pgEnum("routine_step_ref", ["free", "habit", "task"]);
|
|
4207
4255
|
var projectStatus = pgEnum("project_status", [
|
|
4208
4256
|
"planning",
|
|
4209
4257
|
"active",
|
|
@@ -4229,18 +4277,33 @@ var routines = pgTable("routines", {
|
|
|
4229
4277
|
tenantId: text("tenant_id").notNull().references(() => tenants.id),
|
|
4230
4278
|
kind: routineKind("kind").notNull().default("sequence"),
|
|
4231
4279
|
notes: text("notes"),
|
|
4232
|
-
recurrenceRuleId: text("recurrence_rule_id").references(() => recurrenceRules.id)
|
|
4233
|
-
|
|
4280
|
+
recurrenceRuleId: text("recurrence_rule_id").references(() => recurrenceRules.id),
|
|
4281
|
+
areaId: text("area_id").references(() => areas.id)
|
|
4282
|
+
}, (t) => [
|
|
4283
|
+
index("routines_tenant_idx").on(t.tenantId),
|
|
4284
|
+
index("routines_tenant_area_idx").on(t.tenantId, t.areaId)
|
|
4285
|
+
]);
|
|
4234
4286
|
var routineSteps = pgTable("routine_steps", {
|
|
4235
4287
|
id: text("id").primaryKey(),
|
|
4236
4288
|
tenantId: text("tenant_id").notNull().references(() => tenants.id),
|
|
4237
4289
|
routineId: text("routine_id").notNull().references(() => routines.id),
|
|
4238
4290
|
title: text("title").notNull(),
|
|
4291
|
+
refKind: routineStepRef("ref_kind").notNull().default("free"),
|
|
4292
|
+
habitId: text("habit_id").references(() => habits.id),
|
|
4293
|
+
taskId: text("task_id").references(() => tasks.id),
|
|
4239
4294
|
sortOrder: integer("sort_order").notNull().default(0),
|
|
4240
4295
|
durationMinutes: integer("duration_minutes"),
|
|
4241
4296
|
notes: text("notes"),
|
|
4242
4297
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
4243
|
-
}, (t) => [
|
|
4298
|
+
}, (t) => [
|
|
4299
|
+
index("routine_steps_routine_order_idx").on(t.routineId, t.sortOrder),
|
|
4300
|
+
index("routine_steps_habit_idx").on(t.habitId),
|
|
4301
|
+
check("routine_steps_ref_kind_chk", sql`(
|
|
4302
|
+
(${t.refKind} = 'free' AND ${t.habitId} IS NULL AND ${t.taskId} IS NULL) OR
|
|
4303
|
+
(${t.refKind} = 'habit' AND ${t.habitId} IS NOT NULL AND ${t.taskId} IS NULL) OR
|
|
4304
|
+
(${t.refKind} = 'task' AND ${t.taskId} IS NOT NULL AND ${t.habitId} IS NULL)
|
|
4305
|
+
)`)
|
|
4306
|
+
]);
|
|
4244
4307
|
var routineRuns = pgTable("routine_runs", {
|
|
4245
4308
|
id: text("id").primaryKey(),
|
|
4246
4309
|
tenantId: text("tenant_id").notNull().references(() => tenants.id),
|
|
@@ -4256,13 +4319,19 @@ var routineRunSteps = pgTable("routine_run_steps", {
|
|
|
4256
4319
|
runId: text("run_id").notNull().references(() => routineRuns.id),
|
|
4257
4320
|
stepId: text("step_id").notNull().references(() => routineSteps.id),
|
|
4258
4321
|
title: text("title").notNull(),
|
|
4322
|
+
refKind: routineStepRef("ref_kind").notNull().default("free"),
|
|
4323
|
+
habitId: text("habit_id").references(() => habits.id),
|
|
4324
|
+
habitEntryId: text("habit_entry_id").references(() => habitEntries.id),
|
|
4259
4325
|
sortOrder: integer("sort_order").notNull().default(0),
|
|
4260
4326
|
durationMinutes: integer("duration_minutes"),
|
|
4261
4327
|
status: routineRunStepStatus("status").notNull().default("pending"),
|
|
4262
4328
|
elapsedSeconds: integer("elapsed_seconds").notNull().default(0),
|
|
4263
4329
|
carriedOver: boolean("carried_over").notNull().default(false),
|
|
4264
4330
|
completedAt: timestamp("completed_at", { withTimezone: true })
|
|
4265
|
-
}, (t) => [
|
|
4331
|
+
}, (t) => [
|
|
4332
|
+
index("routine_run_steps_run_order_idx").on(t.runId, t.sortOrder),
|
|
4333
|
+
check("routine_run_steps_ref_kind_chk", sql`(${t.refKind} <> 'habit' OR ${t.habitId} IS NOT NULL)`)
|
|
4334
|
+
]);
|
|
4266
4335
|
var projects = pgTable("projects", {
|
|
4267
4336
|
id: text("id").primaryKey().references(() => nodes.id),
|
|
4268
4337
|
tenantId: text("tenant_id").notNull().references(() => tenants.id),
|
|
@@ -4270,8 +4339,12 @@ var projects = pgTable("projects", {
|
|
|
4270
4339
|
progress: integer("progress").notNull().default(0),
|
|
4271
4340
|
notes: text("notes"),
|
|
4272
4341
|
startAt: timestamp("start_at", { withTimezone: true }),
|
|
4273
|
-
dueAt: timestamp("due_at", { withTimezone: true })
|
|
4274
|
-
|
|
4342
|
+
dueAt: timestamp("due_at", { withTimezone: true }),
|
|
4343
|
+
areaId: text("area_id").references(() => areas.id)
|
|
4344
|
+
}, (t) => [
|
|
4345
|
+
index("projects_tenant_idx").on(t.tenantId),
|
|
4346
|
+
index("projects_tenant_area_idx").on(t.tenantId, t.areaId)
|
|
4347
|
+
]);
|
|
4275
4348
|
var projectMilestones = pgTable("project_milestones", {
|
|
4276
4349
|
id: text("id").primaryKey(),
|
|
4277
4350
|
tenantId: text("tenant_id").notNull().references(() => tenants.id),
|
|
@@ -4293,7 +4366,7 @@ var userSettings = pgTable("user_settings", {
|
|
|
4293
4366
|
theme: settingsTheme("theme").notNull().default("system"),
|
|
4294
4367
|
density: settingsDensity("density").notNull().default("comfortable"),
|
|
4295
4368
|
accent: settingsAccent("accent").notNull().default("teal"),
|
|
4296
|
-
|
|
4369
|
+
enabledModules: text("enabled_modules").array().notNull().default([]),
|
|
4297
4370
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
4298
4371
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
4299
4372
|
}, (t) => [unique("user_settings_tenant_user_uniq").on(t.tenantId, t.userId)]);
|
|
@@ -4308,6 +4381,7 @@ var habitMeasurementType = pgEnum("habit_measurement_type", [
|
|
|
4308
4381
|
"negative"
|
|
4309
4382
|
]);
|
|
4310
4383
|
var habitPeriod = pgEnum("habit_period", ["day", "week", "month"]);
|
|
4384
|
+
var habitEntrySource = pgEnum("habit_entry_source", ["manual", "routine"]);
|
|
4311
4385
|
var recurrenceMode = pgEnum("recurrence_mode", ["rigid", "flexible"]);
|
|
4312
4386
|
var recurrenceFreq = pgEnum("recurrence_freq", ["daily", "weekly", "monthly", "yearly"]);
|
|
4313
4387
|
var recurrenceUnit = pgEnum("recurrence_unit", ["day", "week", "month"]);
|
|
@@ -4331,9 +4405,11 @@ var tasks = pgTable("tasks", {
|
|
|
4331
4405
|
durationMinutes: integer("duration_minutes"),
|
|
4332
4406
|
tags: text("tags").array().notNull().default([]),
|
|
4333
4407
|
recurrenceRuleId: text("recurrence_rule_id").references(() => recurrenceRules.id),
|
|
4334
|
-
projectId: text("project_id").references(() => projects.id)
|
|
4408
|
+
projectId: text("project_id").references(() => projects.id),
|
|
4409
|
+
areaId: text("area_id").references(() => areas.id)
|
|
4335
4410
|
}, (t) => [
|
|
4336
4411
|
index("tasks_tenant_project_idx").on(t.tenantId, t.projectId),
|
|
4412
|
+
index("tasks_tenant_area_idx").on(t.tenantId, t.areaId),
|
|
4337
4413
|
index("tasks_tenant_status_idx").on(t.tenantId, t.status),
|
|
4338
4414
|
index("tasks_tenant_scheduled_idx").on(t.tenantId, t.scheduledAt),
|
|
4339
4415
|
index("tasks_tenant_due_idx").on(t.tenantId, t.dueAt)
|
|
@@ -4346,13 +4422,18 @@ var habits = pgTable("habits", {
|
|
|
4346
4422
|
targetUnit: text("target_unit"),
|
|
4347
4423
|
period: habitPeriod("period").notNull().default("day"),
|
|
4348
4424
|
frequencyCount: integer("frequency_count").notNull().default(1),
|
|
4349
|
-
recurrenceRuleId: text("recurrence_rule_id").references(() => recurrenceRules.id)
|
|
4350
|
-
|
|
4425
|
+
recurrenceRuleId: text("recurrence_rule_id").references(() => recurrenceRules.id),
|
|
4426
|
+
areaId: text("area_id").references(() => areas.id)
|
|
4427
|
+
}, (t) => [
|
|
4428
|
+
index("habits_tenant_idx").on(t.tenantId),
|
|
4429
|
+
index("habits_tenant_area_idx").on(t.tenantId, t.areaId)
|
|
4430
|
+
]);
|
|
4351
4431
|
var habitEntries = pgTable("habit_entries", {
|
|
4352
4432
|
id: text("id").primaryKey(),
|
|
4353
4433
|
tenantId: text("tenant_id").notNull().references(() => tenants.id),
|
|
4354
4434
|
habitId: text("habit_id").notNull().references(() => habits.id),
|
|
4355
4435
|
value: doublePrecision("value").notNull().default(1),
|
|
4436
|
+
source: habitEntrySource("source").notNull().default("manual"),
|
|
4356
4437
|
occurredAt: timestamp("occurred_at", { withTimezone: true }).notNull(),
|
|
4357
4438
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
4358
4439
|
}, (t) => [index("habit_entries_habit_occurred_idx").on(t.habitId, t.occurredAt)]);
|
|
@@ -5058,7 +5139,7 @@ __export(exports_external, {
|
|
|
5058
5139
|
clone: () => clone,
|
|
5059
5140
|
cidrv6: () => cidrv62,
|
|
5060
5141
|
cidrv4: () => cidrv42,
|
|
5061
|
-
check: () =>
|
|
5142
|
+
check: () => check2,
|
|
5062
5143
|
catch: () => _catch2,
|
|
5063
5144
|
boolean: () => boolean3,
|
|
5064
5145
|
bigint: () => bigint3,
|
|
@@ -17175,7 +17256,7 @@ __export(exports_schemas2, {
|
|
|
17175
17256
|
codec: () => codec,
|
|
17176
17257
|
cidrv6: () => cidrv62,
|
|
17177
17258
|
cidrv4: () => cidrv42,
|
|
17178
|
-
check: () =>
|
|
17259
|
+
check: () => check2,
|
|
17179
17260
|
catch: () => _catch2,
|
|
17180
17261
|
boolean: () => boolean3,
|
|
17181
17262
|
bigint: () => bigint3,
|
|
@@ -17467,8 +17548,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
17467
17548
|
reg.add(this, meta2);
|
|
17468
17549
|
return this;
|
|
17469
17550
|
},
|
|
17470
|
-
refine(
|
|
17471
|
-
return this.check(refine(
|
|
17551
|
+
refine(check2, params) {
|
|
17552
|
+
return this.check(refine(check2, params));
|
|
17472
17553
|
},
|
|
17473
17554
|
superRefine(refinement, params) {
|
|
17474
17555
|
return this.check(superRefine(refinement, params));
|
|
@@ -18610,7 +18691,7 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
|
18610
18691
|
ZodType.init(inst, def);
|
|
18611
18692
|
inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params);
|
|
18612
18693
|
});
|
|
18613
|
-
function
|
|
18694
|
+
function check2(fn) {
|
|
18614
18695
|
const ch = new $ZodCheck({
|
|
18615
18696
|
check: "custom"
|
|
18616
18697
|
});
|
|
@@ -19513,6 +19594,8 @@ var taskViewSchema = taskSchema.extend({
|
|
|
19513
19594
|
deletedAt: exports_external.coerce.date().nullable()
|
|
19514
19595
|
});
|
|
19515
19596
|
var taskProjectIdSchema = ulidSchema.nullish();
|
|
19597
|
+
var taskAreaIdSchema = ulidSchema.nullish();
|
|
19598
|
+
var taskAreaNameSchema = exports_external.string().trim().min(1).nullish();
|
|
19516
19599
|
var createTaskInputSchema = exports_external.object({
|
|
19517
19600
|
id: ulidSchema,
|
|
19518
19601
|
title: exports_external.string().min(1),
|
|
@@ -19526,7 +19609,9 @@ var createTaskInputSchema = exports_external.object({
|
|
|
19526
19609
|
dueAt: exports_external.coerce.date().nullish(),
|
|
19527
19610
|
durationMinutes: exports_external.number().int().positive().nullish(),
|
|
19528
19611
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
19529
|
-
projectId: taskProjectIdSchema
|
|
19612
|
+
projectId: taskProjectIdSchema,
|
|
19613
|
+
areaId: taskAreaIdSchema,
|
|
19614
|
+
areaName: taskAreaNameSchema
|
|
19530
19615
|
});
|
|
19531
19616
|
var updateTaskInputSchema = exports_external.object({
|
|
19532
19617
|
title: exports_external.string().min(1).optional(),
|
|
@@ -19540,7 +19625,8 @@ var updateTaskInputSchema = exports_external.object({
|
|
|
19540
19625
|
dueAt: exports_external.coerce.date().nullish(),
|
|
19541
19626
|
durationMinutes: exports_external.number().int().positive().nullish(),
|
|
19542
19627
|
tags: exports_external.array(exports_external.string()).optional(),
|
|
19543
|
-
projectId: taskProjectIdSchema
|
|
19628
|
+
projectId: taskProjectIdSchema,
|
|
19629
|
+
areaId: taskAreaIdSchema
|
|
19544
19630
|
}).strict();
|
|
19545
19631
|
var taskListFilterSchema = exports_external.enum(["all", "unsorted"]);
|
|
19546
19632
|
// ../../packages/schema/src/contracts/habits.ts
|
|
@@ -19556,6 +19642,7 @@ var habitMeasurementTypeSchema = exports_external.enum([
|
|
|
19556
19642
|
"negative"
|
|
19557
19643
|
]);
|
|
19558
19644
|
var habitPeriodSchema = exports_external.enum(["day", "week", "month"]);
|
|
19645
|
+
var habitEntrySourceSchema = exports_external.enum(habitEntrySource.enumValues);
|
|
19559
19646
|
var createHabitInputSchema = exports_external.object({
|
|
19560
19647
|
id: ulidSchema,
|
|
19561
19648
|
title: exports_external.string().min(1),
|
|
@@ -19563,18 +19650,21 @@ var createHabitInputSchema = exports_external.object({
|
|
|
19563
19650
|
targetValue: exports_external.number().nonnegative().nullish(),
|
|
19564
19651
|
targetUnit: exports_external.string().min(1).nullish(),
|
|
19565
19652
|
period: habitPeriodSchema.default("day"),
|
|
19566
|
-
frequencyCount: exports_external.number().int().positive().default(1)
|
|
19653
|
+
frequencyCount: exports_external.number().int().positive().default(1),
|
|
19654
|
+
areaId: ulidSchema.nullish()
|
|
19567
19655
|
});
|
|
19568
19656
|
var updateHabitInputSchema = exports_external.object({
|
|
19569
19657
|
title: exports_external.string().min(1),
|
|
19570
19658
|
targetValue: exports_external.number().nonnegative().nullable(),
|
|
19571
19659
|
targetUnit: exports_external.string().min(1).nullable(),
|
|
19572
19660
|
period: habitPeriodSchema,
|
|
19573
|
-
frequencyCount: exports_external.number().int().positive()
|
|
19661
|
+
frequencyCount: exports_external.number().int().positive(),
|
|
19662
|
+
areaId: ulidSchema.nullish()
|
|
19574
19663
|
}).partial();
|
|
19575
19664
|
var createHabitEntryInputSchema = exports_external.object({
|
|
19576
19665
|
id: ulidSchema,
|
|
19577
19666
|
value: exports_external.number().nonnegative().default(1),
|
|
19667
|
+
source: habitEntrySourceSchema.default("manual"),
|
|
19578
19668
|
occurredAt: exports_external.coerce.date().optional()
|
|
19579
19669
|
});
|
|
19580
19670
|
var habitStreakSchema = exports_external.object({
|
|
@@ -19584,10 +19674,15 @@ var habitStreakSchema = exports_external.object({
|
|
|
19584
19674
|
periodTarget: exports_external.number(),
|
|
19585
19675
|
satisfiedToday: exports_external.boolean()
|
|
19586
19676
|
});
|
|
19677
|
+
var habitRoutineRefSchema = exports_external.object({
|
|
19678
|
+
id: ulidSchema,
|
|
19679
|
+
title: exports_external.string()
|
|
19680
|
+
});
|
|
19587
19681
|
var habitSummarySchema = habitSchema.extend({
|
|
19588
19682
|
title: exports_external.string(),
|
|
19589
19683
|
createdAt: exports_external.coerce.date(),
|
|
19590
|
-
streak: habitStreakSchema
|
|
19684
|
+
streak: habitStreakSchema,
|
|
19685
|
+
inRoutines: exports_external.array(habitRoutineRefSchema).default([])
|
|
19591
19686
|
});
|
|
19592
19687
|
var habitHeatmapCellSchema = exports_external.object({
|
|
19593
19688
|
date: exports_external.string(),
|
|
@@ -19647,6 +19742,7 @@ var updateOccurrenceInputSchema = exports_external.object({
|
|
|
19647
19742
|
}).strict();
|
|
19648
19743
|
// ../../packages/schema/src/contracts/routines.ts
|
|
19649
19744
|
var routineKindSchema = exports_external.enum(routineKind.enumValues);
|
|
19745
|
+
var routineStepRefSchema = exports_external.enum(routineStepRef.enumValues);
|
|
19650
19746
|
var routineSchema = createSelectSchema(routines);
|
|
19651
19747
|
var routineStepSchema = createSelectSchema(routineSteps, {
|
|
19652
19748
|
createdAt: exports_external.coerce.date()
|
|
@@ -19654,9 +19750,61 @@ var routineStepSchema = createSelectSchema(routineSteps, {
|
|
|
19654
19750
|
var routineStepInputSchema = exports_external.object({
|
|
19655
19751
|
id: ulidSchema,
|
|
19656
19752
|
title: exports_external.string().min(1),
|
|
19753
|
+
refKind: routineStepRefSchema.default("free"),
|
|
19754
|
+
habitId: ulidSchema.nullish(),
|
|
19755
|
+
taskId: ulidSchema.nullish(),
|
|
19756
|
+
newHabit: createHabitInputSchema.optional(),
|
|
19657
19757
|
sortOrder: exports_external.number().int().min(0).optional(),
|
|
19658
19758
|
durationMinutes: exports_external.number().int().positive().nullish(),
|
|
19659
19759
|
notes: exports_external.string().nullish()
|
|
19760
|
+
}).superRefine((step, ctx) => {
|
|
19761
|
+
if (step.refKind === "habit") {
|
|
19762
|
+
const linkId = step.newHabit?.id ?? step.habitId;
|
|
19763
|
+
if (!linkId) {
|
|
19764
|
+
ctx.addIssue({
|
|
19765
|
+
code: exports_external.ZodIssueCode.custom,
|
|
19766
|
+
message: "a habit step needs habitId or newHabit",
|
|
19767
|
+
path: ["habitId"]
|
|
19768
|
+
});
|
|
19769
|
+
}
|
|
19770
|
+
if (step.newHabit && step.habitId && step.newHabit.id !== step.habitId) {
|
|
19771
|
+
ctx.addIssue({
|
|
19772
|
+
code: exports_external.ZodIssueCode.custom,
|
|
19773
|
+
message: "habitId must equal newHabit.id",
|
|
19774
|
+
path: ["habitId"]
|
|
19775
|
+
});
|
|
19776
|
+
}
|
|
19777
|
+
if (step.taskId) {
|
|
19778
|
+
ctx.addIssue({
|
|
19779
|
+
code: exports_external.ZodIssueCode.custom,
|
|
19780
|
+
message: "a habit step cannot also set taskId",
|
|
19781
|
+
path: ["taskId"]
|
|
19782
|
+
});
|
|
19783
|
+
}
|
|
19784
|
+
} else if (step.refKind === "task") {
|
|
19785
|
+
if (!step.taskId) {
|
|
19786
|
+
ctx.addIssue({
|
|
19787
|
+
code: exports_external.ZodIssueCode.custom,
|
|
19788
|
+
message: "a task step needs taskId",
|
|
19789
|
+
path: ["taskId"]
|
|
19790
|
+
});
|
|
19791
|
+
}
|
|
19792
|
+
if (step.habitId || step.newHabit) {
|
|
19793
|
+
ctx.addIssue({
|
|
19794
|
+
code: exports_external.ZodIssueCode.custom,
|
|
19795
|
+
message: "a task step cannot set a habit link",
|
|
19796
|
+
path: ["habitId"]
|
|
19797
|
+
});
|
|
19798
|
+
}
|
|
19799
|
+
} else {
|
|
19800
|
+
if (step.habitId || step.taskId || step.newHabit) {
|
|
19801
|
+
ctx.addIssue({
|
|
19802
|
+
code: exports_external.ZodIssueCode.custom,
|
|
19803
|
+
message: "a free step cannot set a habit/task link",
|
|
19804
|
+
path: ["refKind"]
|
|
19805
|
+
});
|
|
19806
|
+
}
|
|
19807
|
+
}
|
|
19660
19808
|
});
|
|
19661
19809
|
var createRoutineInputSchema = exports_external.object({
|
|
19662
19810
|
id: ulidSchema,
|
|
@@ -19664,6 +19812,7 @@ var createRoutineInputSchema = exports_external.object({
|
|
|
19664
19812
|
parentId: ulidSchema.nullish(),
|
|
19665
19813
|
kind: routineKindSchema.optional(),
|
|
19666
19814
|
notes: exports_external.string().nullish(),
|
|
19815
|
+
areaId: ulidSchema.nullish(),
|
|
19667
19816
|
steps: exports_external.array(routineStepInputSchema).optional()
|
|
19668
19817
|
});
|
|
19669
19818
|
var updateRoutineInputSchema = exports_external.object({
|
|
@@ -19671,6 +19820,7 @@ var updateRoutineInputSchema = exports_external.object({
|
|
|
19671
19820
|
parentId: ulidSchema.nullish(),
|
|
19672
19821
|
kind: routineKindSchema.optional(),
|
|
19673
19822
|
notes: exports_external.string().nullish(),
|
|
19823
|
+
areaId: ulidSchema.nullish(),
|
|
19674
19824
|
steps: exports_external.array(routineStepInputSchema).optional()
|
|
19675
19825
|
}).strict();
|
|
19676
19826
|
var routineViewSchema = routineSchema.extend({
|
|
@@ -19692,10 +19842,13 @@ var routineRunSchema = createSelectSchema(routineRuns, {
|
|
|
19692
19842
|
var routineRunStepSchema = createSelectSchema(routineRunSteps, {
|
|
19693
19843
|
completedAt: exports_external.coerce.date().nullable()
|
|
19694
19844
|
});
|
|
19845
|
+
var routineRunStepViewSchema = routineRunStepSchema.extend({
|
|
19846
|
+
habit: habitSummarySchema.nullable().default(null)
|
|
19847
|
+
});
|
|
19695
19848
|
var routineRunViewSchema = routineRunSchema.extend({
|
|
19696
19849
|
routineTitle: exports_external.string(),
|
|
19697
19850
|
kind: routineKindSchema,
|
|
19698
|
-
steps: exports_external.array(
|
|
19851
|
+
steps: exports_external.array(routineRunStepViewSchema)
|
|
19699
19852
|
});
|
|
19700
19853
|
var startRoutineRunInputSchema = exports_external.object({
|
|
19701
19854
|
id: ulidSchema,
|
|
@@ -19703,7 +19856,9 @@ var startRoutineRunInputSchema = exports_external.object({
|
|
|
19703
19856
|
});
|
|
19704
19857
|
var updateRoutineRunStepInputSchema = exports_external.object({
|
|
19705
19858
|
status: routineRunStepStatusSchema.optional(),
|
|
19706
|
-
elapsedSeconds: exports_external.number().int().nonnegative().optional()
|
|
19859
|
+
elapsedSeconds: exports_external.number().int().nonnegative().optional(),
|
|
19860
|
+
habitValue: exports_external.number().nonnegative().optional(),
|
|
19861
|
+
logAgain: exports_external.boolean().optional()
|
|
19707
19862
|
}).strict();
|
|
19708
19863
|
var updateRoutineRunInputSchema = exports_external.object({
|
|
19709
19864
|
status: routineRunStatusSchema.optional()
|
|
@@ -19735,6 +19890,7 @@ var createProjectInputSchema = exports_external.object({
|
|
|
19735
19890
|
notes: exports_external.string().nullish(),
|
|
19736
19891
|
startAt: exports_external.coerce.date().nullish(),
|
|
19737
19892
|
dueAt: exports_external.coerce.date().nullish(),
|
|
19893
|
+
areaId: ulidSchema.nullish(),
|
|
19738
19894
|
milestones: exports_external.array(projectMilestoneInputSchema).optional()
|
|
19739
19895
|
});
|
|
19740
19896
|
var updateProjectInputSchema = exports_external.object({
|
|
@@ -19745,6 +19901,7 @@ var updateProjectInputSchema = exports_external.object({
|
|
|
19745
19901
|
notes: exports_external.string().nullish(),
|
|
19746
19902
|
startAt: exports_external.coerce.date().nullish(),
|
|
19747
19903
|
dueAt: exports_external.coerce.date().nullish(),
|
|
19904
|
+
areaId: ulidSchema.nullish(),
|
|
19748
19905
|
milestones: exports_external.array(projectMilestoneInputSchema).optional()
|
|
19749
19906
|
}).strict();
|
|
19750
19907
|
var projectViewSchema = projectSchema.extend({
|
|
@@ -19763,6 +19920,40 @@ var projectDetailSchema = projectViewSchema.extend({
|
|
|
19763
19920
|
tasks: exports_external.array(taskViewSchema)
|
|
19764
19921
|
});
|
|
19765
19922
|
var attachTaskInputSchema = exports_external.object({ taskId: ulidSchema });
|
|
19923
|
+
// ../../packages/schema/src/contracts/areas.ts
|
|
19924
|
+
var areaColorSchema = exports_external.enum(areaColor.enumValues);
|
|
19925
|
+
var reviewCadenceSchema = exports_external.enum(reviewCadence.enumValues);
|
|
19926
|
+
var areaSchema = createSelectSchema(areas);
|
|
19927
|
+
var areaIconSchema = exports_external.string().trim().min(1).max(64);
|
|
19928
|
+
var createAreaInputSchema = exports_external.object({
|
|
19929
|
+
id: ulidSchema,
|
|
19930
|
+
title: exports_external.string().min(1),
|
|
19931
|
+
color: areaColorSchema.optional(),
|
|
19932
|
+
icon: areaIconSchema.nullish(),
|
|
19933
|
+
reviewCadence: reviewCadenceSchema.nullish()
|
|
19934
|
+
});
|
|
19935
|
+
var updateAreaInputSchema = exports_external.object({
|
|
19936
|
+
title: exports_external.string().min(1).optional(),
|
|
19937
|
+
color: areaColorSchema.optional(),
|
|
19938
|
+
icon: areaIconSchema.nullish(),
|
|
19939
|
+
reviewCadence: reviewCadenceSchema.nullish()
|
|
19940
|
+
}).strict();
|
|
19941
|
+
var areaViewSchema = areaSchema.extend({
|
|
19942
|
+
title: exports_external.string(),
|
|
19943
|
+
createdAt: exports_external.coerce.date(),
|
|
19944
|
+
updatedAt: exports_external.coerce.date(),
|
|
19945
|
+
deletedAt: exports_external.coerce.date().nullable(),
|
|
19946
|
+
projectCount: exports_external.number().int().min(0),
|
|
19947
|
+
taskCount: exports_external.number().int().min(0),
|
|
19948
|
+
habitCount: exports_external.number().int().min(0),
|
|
19949
|
+
routineCount: exports_external.number().int().min(0)
|
|
19950
|
+
});
|
|
19951
|
+
var areaDetailSchema = areaViewSchema.extend({
|
|
19952
|
+
projects: exports_external.array(projectViewSchema),
|
|
19953
|
+
habits: exports_external.array(habitSummarySchema),
|
|
19954
|
+
routines: exports_external.array(routineViewSchema),
|
|
19955
|
+
tasks: exports_external.array(taskViewSchema)
|
|
19956
|
+
});
|
|
19766
19957
|
// ../../packages/schema/src/contracts/settings.ts
|
|
19767
19958
|
var settingsThemeSchema = exports_external.enum(settingsTheme.enumValues);
|
|
19768
19959
|
var settingsDensitySchema = exports_external.enum(settingsDensity.enumValues);
|
|
@@ -19779,7 +19970,7 @@ var updateUserSettingsInputSchema = exports_external.object({
|
|
|
19779
19970
|
theme: settingsThemeSchema.optional(),
|
|
19780
19971
|
density: settingsDensitySchema.optional(),
|
|
19781
19972
|
accent: settingsAccentSchema.optional(),
|
|
19782
|
-
|
|
19973
|
+
enabledModules: exports_external.array(exports_external.string().trim().min(1)).optional()
|
|
19783
19974
|
}).strict();
|
|
19784
19975
|
// ../../packages/schema/src/contracts/notifications.ts
|
|
19785
19976
|
var notificationTypeSchema = exports_external.enum(["task_due", "occurrence_due"]);
|
|
@@ -20827,6 +21018,7 @@ var insightsOverviewSchema = exports_external.object({
|
|
|
20827
21018
|
// ../../packages/schema/src/capture.ts
|
|
20828
21019
|
var TAG_RE = /(?:^|\s)#([\p{L}\p{N}][\p{L}\p{N}_-]*)/gu;
|
|
20829
21020
|
var PRIORITY_RE = /(?:^|\s)!([\p{L}]+)/gu;
|
|
21021
|
+
var AREA_RE = /(?:^|\s)~([\p{L}\p{N}][\p{L}\p{N}_-]*)/gu;
|
|
20830
21022
|
var PRIORITY_ALIASES = {
|
|
20831
21023
|
none: "none",
|
|
20832
21024
|
n: "none",
|
|
@@ -20853,8 +21045,16 @@ function parseCapture(input) {
|
|
|
20853
21045
|
if (mapped)
|
|
20854
21046
|
priority = mapped;
|
|
20855
21047
|
}
|
|
20856
|
-
|
|
20857
|
-
|
|
21048
|
+
let area;
|
|
21049
|
+
for (const match of input.matchAll(AREA_RE)) {
|
|
21050
|
+
const token = match[1]?.toLowerCase();
|
|
21051
|
+
if (token) {
|
|
21052
|
+
area = token;
|
|
21053
|
+
break;
|
|
21054
|
+
}
|
|
21055
|
+
}
|
|
21056
|
+
const title = input.replace(TAG_RE, " ").replace(PRIORITY_RE, " ").replace(AREA_RE, " ").replace(/\s+/g, " ").trim();
|
|
21057
|
+
return { title, tags, ...priority ? { priority } : {}, ...area ? { area } : {} };
|
|
20858
21058
|
}
|
|
20859
21059
|
// ../../node_modules/.bun/ulidx@2.4.1/node_modules/ulidx/dist/node/index.js
|
|
20860
21060
|
import crypto from "crypto";
|
|
@@ -21108,7 +21308,7 @@ function parseCapture2(input) {
|
|
|
21108
21308
|
|
|
21109
21309
|
// src/meta.ts
|
|
21110
21310
|
var CLI_NAME = "do";
|
|
21111
|
-
var VERSION = "1.
|
|
21311
|
+
var VERSION = "1.22.0";
|
|
21112
21312
|
var API_PREFIX = "/api/v1";
|
|
21113
21313
|
var DEFAULT_API_URL = "http://localhost:3001";
|
|
21114
21314
|
|