@dench.com/cli 3.12.17-staging.1330 → 3.12.19-staging.1350

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/app-sdk.d.ts CHANGED
@@ -1031,7 +1031,7 @@ export interface ApiRequests {
1031
1031
  viewName: string;
1032
1032
  page?: number;
1033
1033
  pageSize?: number;
1034
- /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1034
+ /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", a member userId or email, or a comma-separated list of people (me and member ids or emails). Several people add one has_any rule (rows assigned to any of them); "unassigned" is exclusive and is is_empty. Rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1035
1035
  assignedTo?: string;
1036
1036
  /** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
1037
1037
  assigneeField?: string;
@@ -1265,7 +1265,7 @@ export interface ApiRequests {
1265
1265
  withReferences?: boolean;
1266
1266
  objectName: string;
1267
1267
  limit?: number;
1268
- /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1268
+ /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", a member userId or email, or a comma-separated list of people (me and member ids or emails). Several people add one has_any rule (rows assigned to any of them); "unassigned" is exclusive and is is_empty. Rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1269
1269
  assignedTo?: string;
1270
1270
  /** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
1271
1271
  assigneeField?: string;
@@ -1616,7 +1616,7 @@ export interface ApiRequests {
1616
1616
  };
1617
1617
  /** JSON string of the DSL when filters use operators like $gt/$in/$contains/$and/$or. Date fields and the system timestamps created_at/updated_at also accept $datePreset ("today", "yesterday", "this_week", "last_week", "this_month", "last_month", "this_quarter", "last_quarter", "this_year", "last_year"), and $inLast/$inNext rolling windows (a day count like 7, or {"amount":2,"unit":"weeks"} with unit days|weeks|months|quarters|years). On a date field, $gt/$gte/$lt/$lte take a day ("2026-11-03"), an ISO date-time with its offset or epoch ms; a top-level "timeZone" (IANA) says which zone a day bound means. A filter naming a field the object does not have is an error. Example: {"filter":{"updated_at":{"$datePreset":"this_month"}}}. */
1618
1618
  dslJson?: string;
1619
- /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1619
+ /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", a member userId or email, or a comma-separated list of people (me and member ids or emails). Several people add one has_any rule (rows assigned to any of them); "unassigned" is exclusive and is is_empty. Rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1620
1620
  assignedTo?: string;
1621
1621
  /** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
1622
1622
  assigneeField?: string;
@@ -1626,7 +1626,7 @@ export interface ApiRequests {
1626
1626
  objectName: string;
1627
1627
  dsl?: Record<string, unknown>;
1628
1628
  dslJson?: string;
1629
- /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1629
+ /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", a member userId or email, or a comma-separated list of people (me and member ids or emails). Several people add one has_any rule (rows assigned to any of them); "unassigned" is exclusive and is is_empty. Rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1630
1630
  assignedTo?: string;
1631
1631
  /** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
1632
1632
  assigneeField?: string;
@@ -1945,7 +1945,7 @@ export interface ApiRequests {
1945
1945
  /** Chance of closing per OPEN stage, 0..1, for the weighted forecast. Unlisted stages are spaced evenly; won = 1, lost = 0. */
1946
1946
  stageProbabilities?: Record<string, number>;
1947
1947
  };
1948
- /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1948
+ /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", a member userId or email, or a comma-separated list of people (me and member ids or emails). Several people add one has_any rule (rows assigned to any of them); "unassigned" is exclusive and is is_empty. Rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
1949
1949
  assignedTo?: string;
1950
1950
  /** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
1951
1951
  assigneeField?: string;
@@ -2367,7 +2367,7 @@ export interface ApiRequests {
2367
2367
  columns?: string[];
2368
2368
  /** Filter in the crm.query DSL, e.g. {"Status":"Open"} or {"Score":{"$gte":50}}. Field names are case-sensitive. */
2369
2369
  where?: Record<string, unknown>;
2370
- /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object's assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
2370
+ /** Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", a member userId or email, or a comma-separated list of people (me and member ids or emails). Several people add one has_any rule (rows assigned to any of them); "unassigned" is exclusive and is is_empty. Rows, totalCount, sums and analytics all follow it. Never saved onto the view. */
2371
2371
  assignedTo?: string;
2372
2372
  /** Which `user` field "assigned" means. Default: the analytics owner role, else the task `Assignee`, else a user field named like owner/assignee, else the first user field. */
2373
2373
  assigneeField?: string;
@@ -4715,6 +4715,9 @@ export interface ApiResponses {
4715
4715
  target: {
4716
4716
  kind: "user";
4717
4717
  userId: string;
4718
+ } | {
4719
+ kind: "users";
4720
+ userIds: string[];
4718
4721
  } | {
4719
4722
  kind: "unassigned";
4720
4723
  };
package/crm-analytics.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * get [--view V] read config (+ the view's own dashboard)
10
10
  * compute [--view V] [--period P] [--panel ID ...] [--panels JSON] [--filters JSON]
11
- * [--assigned-to me|unassigned|<user>] [--assignee-field F] personal scope
11
+ * [--assigned-to me|unassigned|<user>[,…]] [--assignee-field F] personal scope
12
12
  * save <panelId> --panel JSON [--view V] create / replace one panel
13
13
  * update <panelId> --patch JSON [--view V] edit part of one panel (null clears)
14
14
  * hide <panelId> [--view V] keep it off the strip (full view only)
package/crm-comments.ts CHANGED
@@ -511,7 +511,7 @@ export async function runActivityCommand(ctx: CrmCliContext): Promise<void> {
511
511
  const entry = (await callQuery(
512
512
  ctx,
513
513
  makeFunctionReference<"query">("functions/crm/entries:get"),
514
- { objectName, entryId },
514
+ { objectName, entryId, missingAsNull: true },
515
515
  )) as { fields?: Record<string, unknown> } | null;
516
516
  const raw = entry?.fields?.Notes ?? entry?.fields?.notes;
517
517
  notes = typeof raw === "string" && raw.trim() ? raw : null;
package/crm.ts CHANGED
@@ -319,7 +319,7 @@ function resolveLimitFlag(
319
319
  * The personal assignee scope flags shared by every read that supports it
320
320
  * (`views entries`, `entries list`, `query`, `analytics compute`):
321
321
  *
322
- * --assigned-to me|unassigned|<userId|email> (alias: --mine)
322
+ * --assigned-to me|unassigned|<userId|email>[,…] (alias: --mine)
323
323
  * --assignee-field <Field> which `user` field counts
324
324
  *
325
325
  * Forwarded verbatim as `assignedTo` / `assigneeField`; the server resolves
@@ -346,7 +346,7 @@ export function resolveAssigneeScopeFlags(args: string[]): {
346
346
  const assignedTo = mine ? "me" : assignedToRaw?.trim();
347
347
  if (assignedTo !== undefined && assignedTo === "") {
348
348
  throw new CrmCliError(
349
- "--assigned-to needs a value: me, unassigned, or a member userId / email.",
349
+ "--assigned-to needs a value: me, unassigned, a member userId / email, or a comma-separated list of people.",
350
350
  );
351
351
  }
352
352
  if (assigneeField !== undefined && assignedTo === undefined) {
@@ -1189,7 +1189,7 @@ export async function runCrmCommand(opts: {
1189
1189
  console.log(`Usage: dench crm query <object> [--with-references] [--where '<JSON>'] [--select Name,Email] [--sort -Score] [--limit N] [--timezone <IANA zone>] [--json]
1190
1190
  --timezone America/Los_Angeles The zone date filters mean (day bounds like "2026-11-03"); defaults to $TZ, else UTC.
1191
1191
  --page [--cursor '<continueCursor>'] Return {page,isDone,continueCursor} in index order; omit --sort.
1192
- --assigned-to me|unassigned|<userId|email> (or --mine) [--assignee-field <Field>]
1192
+ --assigned-to me|unassigned|<userId|email>[,…] (or --mine) [--assignee-field <Field>]
1193
1193
  Default limit: 100. Maximum: 1000 for a one-shot array, 100 for a cursor page.
1194
1194
  Continue cursor pages until isDone, including empty filtered pages.
1195
1195
  Example: dench crm query company --where '{"Status":"New"}' --select Name --limit 25 --json`);
@@ -2811,22 +2811,21 @@ async function runEntriesCommand(ctx: CrmCliContext): Promise<void> {
2811
2811
  const withContext = hasFlag(ctx.args, "--with-context");
2812
2812
  const compact = hasFlag(ctx.args, "--compact");
2813
2813
  assertNoUnknownFlags(ctx.args, "crm entries get");
2814
- const entry = withCrmEntryDeepLinks(
2815
- ctx,
2816
- objectName,
2817
- withContext
2818
- ? await callAction(
2819
- ctx,
2820
- makeFunctionReference<"action">(
2821
- "functions/crm/recordRead:getEntry",
2822
- ),
2823
- { objectName, entryId, withContext: true },
2824
- )
2825
- : await callQuery(ctx, api.entries.get, {
2826
- objectName,
2827
- entryId: entryId as any,
2828
- }),
2829
- );
2814
+ const rawEntry = withContext
2815
+ ? await callAction(
2816
+ ctx,
2817
+ makeFunctionReference<"action">(
2818
+ "functions/crm/recordRead:getEntry",
2819
+ ),
2820
+ { objectName, entryId, withContext: true, missingAsNull: true },
2821
+ )
2822
+ : await callQuery(ctx, api.entries.get, {
2823
+ objectName,
2824
+ entryId: entryId as any,
2825
+ missingAsNull: true,
2826
+ });
2827
+ if (!rawEntry) throw new CrmCliError("Entry not found");
2828
+ const entry = withCrmEntryDeepLinks(ctx, objectName, rawEntry);
2830
2829
  const printEntry = (value: unknown) => {
2831
2830
  if (compact) {
2832
2831
  // Normalize references before measuring the exact emitted JSON. No
@@ -3180,7 +3179,9 @@ async function snapshotEntriesBeforeBulkDelete(
3180
3179
  const entry = await queryWithTransientRetry(ctx, api.entries.get, {
3181
3180
  objectName,
3182
3181
  entryId: entryId as any,
3182
+ missingAsNull: true,
3183
3183
  });
3184
+ if (!entry) throw new CrmCliError("Entry not found");
3184
3185
  lines.push(JSON.stringify(entry));
3185
3186
  }
3186
3187
  } catch (error) {
@@ -4991,6 +4992,7 @@ async function enrichCellThroughGateway(
4991
4992
  await callQuery(ctx, api.entries.get, {
4992
4993
  objectName: args.objectName,
4993
4994
  entryId: args.entryId,
4995
+ missingAsNull: true,
4994
4996
  }),
4995
4997
  );
4996
4998
  if (!entry) throw new CrmCliError("Entry not found");
@@ -5370,10 +5372,11 @@ Views (saved CRM subsets):
5370
5372
  dench crm views list <object> [--json]
5371
5373
  dench crm views get <object> <view-name> [--json]
5372
5374
  dench crm views entries <object> <view-name> [--limit N] [--page N] [--with-meta] [--json]
5373
- [--assigned-to me|unassigned|<userId|email>] [--assignee-field <Field>]
5375
+ [--assigned-to me|unassigned|<userId|email>[,…]] [--assignee-field <Field>]
5374
5376
  --assigned-to (alias --mine) is the PERSONAL scope the toolbar's
5375
5377
  avatar pill applies: rows whose people field includes that member
5376
- (or is empty for "unassigned"). It never touches the saved view.
5378
+ (or any of a comma-separated list, or is empty for "unassigned").
5379
+ It never touches the saved view.
5377
5380
  The field defaults to the analytics owner role → Assignee → a
5378
5381
  field named like owner/assignee → the first user field.
5379
5382
  dench crm views create <object> <view-name> [--where '{"Status":"Hot"}']
@@ -5492,7 +5495,7 @@ Fields (columns):
5492
5495
 
5493
5496
  Entries (rows):
5494
5497
  dench crm entries list <object> [--with-references] [--limit N] [--with-meta [--cursor '<continueCursor>']] [--json]
5495
- [--assigned-to me|unassigned|<userId|email> | --mine] [--assignee-field <Field>]
5498
+ [--assigned-to me|unassigned|<userId|email>[,…] | --mine] [--assignee-field <Field>]
5496
5499
  --with-meta includes readable pagination; totalCount is the entire object's catalog count,
5497
5500
  not a readable or assigned total. Continue only when continueCursor is returned, preserving filters.
5498
5501
  Scoped reads may be truncated with no cursor (hasMore: null); repeating the same call will not advance.
@@ -5637,7 +5640,7 @@ Query DSL:
5637
5640
  dench crm query <object> [--with-references] --where '{"Status":"New"}' --select Name,Email --sort -Score --limit 100
5638
5641
  dench crm query <object> [--with-references] --page --select Name,Email --limit 100 [--cursor '<continueCursor>'] --json
5639
5642
  Cursor pages use index order (omit --sort). Continue until isDone, including empty filtered pages.
5640
- [--assigned-to me|unassigned|<userId|email> | --mine] [--assignee-field <Field>]
5643
+ [--assigned-to me|unassigned|<userId|email>[,…] | --mine] [--assignee-field <Field>]
5641
5644
  --mine AND-s "assigned to me" onto --where without you having to
5642
5645
  know your own userId or the object's people field.
5643
5646
  Operators: $eq $ne $in $nin $gt $gte $lt $lte $exists
@@ -5712,7 +5715,7 @@ Import / export:
5712
5715
  dench crm export <object> --format csv|jsonl [--limit N]
5713
5716
  Pages with a real cursor and verifies no duplicate ids before
5714
5717
  emitting; a summary (exportedCount/uniqueIds) is printed to stderr.
5715
- dench crm exports start <object> [--columns Name,Email] [--where '<JSON>'] [--assigned-to me|unassigned|<userId|email>] [--assignee-field <Field>]
5718
+ dench crm exports start <object> [--columns Name,Email] [--where '<JSON>'] [--assigned-to me|unassigned|<userId|email>[,…]] [--assignee-field <Field>]
5716
5719
  Builds the CSV on the server into the workspace files (/exports) and
5717
5720
  returns a jobId at once. Up to 50,000 rows; one export per workspace.
5718
5721
  dench crm exports get <jobId>
@@ -5757,7 +5760,7 @@ Analytics (the dashboard strip above every object table — same math the UI dra
5757
5760
  that saved view's own dashboard (viewAnalytics; null when it inherits).
5758
5761
  dench crm analytics compute <object> [--view <view-name>] [--period this_week|this_month|last_month|this_quarter|last_quarter|this_year]
5759
5762
  [--panel <id> ...] [--panels '<JSON array of panel defs>'] [--filters '<FilterGroup JSON>'] [--json]
5760
- [--assigned-to me|unassigned|<userId|email> | --mine] [--assignee-field <Field>]
5763
+ [--assigned-to me|unassigned|<userId|email>[,…] | --mine] [--assignee-field <Field>]
5761
5764
  Chart-ready buckets / series / values for the stored dashboard, a
5762
5765
  subset of its panels (--panel), or ad-hoc definitions (--panels; nothing
5763
5766
  is persisted). --period scopes every panel AND fills previousValue from
@@ -321,7 +321,7 @@ const assigneeScopeRequest = {
321
321
  .string()
322
322
  .optional()
323
323
  .describe(
324
- 'Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", or a member userId or email. Adds one has_any / is_empty rule on the object\'s assignee user field; rows, totalCount, sums and analytics all follow it. Never saved onto the view.',
324
+ 'Personal scope: "me" (the signed-in member / the human behind an agent session), "unassigned", a member userId or email, or a comma-separated list of people (me and member ids or emails). Several people add one has_any rule (rows assigned to any of them); "unassigned" is exclusive and is is_empty. Rows, totalCount, sums and analytics all follow it. Never saved onto the view.',
325
325
  ),
326
326
  assigneeField: z
327
327
  .string()
@@ -336,6 +336,10 @@ const assigneeScopeResponse = z
336
336
  field: z.string().describe("The user field the scope keyed on."),
337
337
  target: z.union([
338
338
  z.object({ kind: z.literal("user"), userId: z.string() }),
339
+ z.object({
340
+ kind: z.literal("users"),
341
+ userIds: z.array(z.string()),
342
+ }),
339
343
  z.object({ kind: z.literal("unassigned") }),
340
344
  ]),
341
345
  })
@@ -26,6 +26,12 @@ export type ConvexOperation = {
26
26
  fixedArgs?: Record<string, unknown>;
27
27
  /** Reshape validated input into backend args (e.g. update-many -> batch ops). */
28
28
  transformArgs?: (input: Record<string, unknown>) => Record<string, unknown>;
29
+ /**
30
+ * When set, a `null` result from the Convex function becomes a 404
31
+ * `{ code: "not_found", message }` instead of `200 null` — pairs with
32
+ * `missingAsNull: true` so expected 404 lookups never throw inside Convex.
33
+ */
34
+ notFoundOnNull?: string;
29
35
  };
30
36
 
31
37
  export type GatewayOperation = {
@@ -1757,10 +1763,12 @@ const rawApiOperations = [
1757
1763
  transformArgs: (input) => ({
1758
1764
  objectName: input.objectName,
1759
1765
  entryId: input.entryId,
1766
+ missingAsNull: true,
1760
1767
  ...(input.withContext === true || input.withContext === "true"
1761
1768
  ? { withContext: true }
1762
1769
  : {}),
1763
1770
  }),
1771
+ notFoundOnNull: "Entry not found",
1764
1772
  },
1765
1773
  }),
1766
1774
  op({