@proveanything/smartlinks 2.1.22 → 2.1.24

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.
@@ -55,7 +55,7 @@ export declare function adminCardAge(at: number | null | undefined, now?: number
55
55
  /** Add the card styles to the page once (the views call it; hosts rendering on the server can too). */
56
56
  export declare function injectAdminCardStyles(doc?: Document | undefined): void;
57
57
  /** The card stylesheet, for hosts that prefer to ship it themselves. */
58
- export declare const ADMIN_CARD_CSS = "\n.slc-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:var(--slc-gap,16px)}\n.slc-grid>*{grid-column:span 12}\n@media (min-width:768px){.slc-grid>.slc-size-small{grid-column:span 6}.slc-grid>.slc-size-medium,.slc-grid>.slc-size-wide{grid-column:span 12}}\n@media (min-width:1100px){.slc-grid>.slc-size-small{grid-column:span 3}.slc-grid>.slc-size-medium{grid-column:span 6}.slc-grid>.slc-size-wide{grid-column:span 8}}\n.slc-card{--_bg:var(--slc-bg,var(--sl-color-surface,#fff));--_fg:var(--slc-fg,var(--sl-color-fg,#0f172a));--_muted:var(--slc-muted,var(--sl-color-muted,#64748b));--_border:var(--slc-border,var(--sl-color-border,#e2e8f0));--_accent:var(--slc-accent,var(--sl-color-accent,#2563eb));--_ok:var(--slc-ok,var(--sl-color-success,#059669));--_warn:var(--slc-attention,#b45309);--_err:var(--slc-error,var(--sl-color-danger,#dc2626));\n box-sizing:border-box;display:flex;flex-direction:column;gap:12px;min-height:148px;padding:16px 18px;border:1px solid var(--_border);border-radius:var(--slc-radius,var(--sl-radius-lg,14px));background:var(--_bg);color:var(--_fg);font:inherit;position:relative}\n.slc-head{display:flex;align-items:center;gap:8px;min-width:0}\n.slc-title{margin:0;font-size:.95rem;font-weight:600;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.slc-age{font-size:.75rem;color:var(--_muted);white-space:nowrap}\n.slc-refresh{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:6px;color:var(--_muted)}\n.slc-refresh:hover{background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_fg)}\n.slc-refresh:focus-visible{outline:2px solid var(--_accent)}\n.slc-spin{animation:slc-spin 1s linear infinite}\n@keyframes slc-spin{to{transform:rotate(360deg)}}\n.slc-valuerow{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 10px}\n.slc-value{font-size:2rem;line-height:1.1;font-weight:700;letter-spacing:-.02em;min-width:0;overflow-wrap:anywhere}\n.slc-value.slc-text{font-size:1.375rem;letter-spacing:-.01em}\n.slc-unit{font-size:1rem;font-weight:600;margin-left:2px;color:var(--_muted)}\n.slc-label{font-size:.875rem;color:var(--_muted)}\n.slc-trend{font-size:.75rem;font-weight:600;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_muted)}\n.slc-trend.slc-good{background:color-mix(in srgb,var(--_ok) 14%,transparent);color:var(--_ok)}\n.slc-trend.slc-bad{background:color-mix(in srgb,var(--_err) 12%,transparent);color:var(--_err)}\n.slc-status{display:flex;align-items:flex-start;gap:8px;font-size:.875rem}\n.slc-dot{flex:none;width:8px;height:8px;border-radius:50%;margin-top:6px;background:var(--_muted)}\n.slc-tone-ok .slc-dot{background:var(--_ok)}.slc-tone-attention .slc-dot{background:var(--_warn)}.slc-tone-error .slc-dot{background:var(--_err)}\n.slc-progress{display:flex;flex-direction:column;gap:4px;font-size:.75rem;color:var(--_muted)}\n.slc-bar{height:6px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 18%,transparent);overflow:hidden}\n.slc-bar>span{display:block;height:100%;background:var(--_accent);border-radius:inherit}\n.slc-items{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}\n.slc-item{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--_border);font-size:.875rem;min-width:0}\n.slc-item:first-child{border-top:0}\n.slc-item-main{flex:1;min-width:0}\n.slc-item-title,.slc-item-sub{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.slc-item-sub,.slc-item-meta{color:var(--_muted);font-size:.75rem}\n.slc-link{all:unset;cursor:pointer}\n.slc-link:hover .slc-item-title{text-decoration:underline}\n.slc-link:focus-visible{outline:2px solid var(--_accent);border-radius:4px}\n.slc-empty{font-size:.875rem;color:var(--_muted)}\n.slc-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:auto}\n.slc-btn{all:unset;cursor:pointer;font-size:.8125rem;font-weight:600;padding:6px 12px;border-radius:8px;border:1px solid var(--_border);color:var(--_fg)}\n.slc-btn:hover{background:color-mix(in srgb,var(--_muted) 10%,transparent)}\n.slc-btn.slc-primary{background:var(--_accent);border-color:var(--_accent);color:var(--slc-on-accent,var(--sl-color-on-accent,#fff))}\n.slc-btn:focus-visible{outline:2px solid var(--_accent);outline-offset:2px}\n.slc-note{font-size:.75rem;color:var(--_muted)}\n.slc-note.slc-err{color:var(--_err)}\n.slc-skel{height:12px;border-radius:6px;background:color-mix(in srgb,var(--_muted) 16%,transparent);animation:slc-pulse 1.4s ease-in-out infinite}\n@keyframes slc-pulse{50%{opacity:.5}}\n.slc-todo{display:flex;flex-direction:column;gap:6px;padding:12px 16px;border-radius:var(--slc-radius,var(--sl-radius-lg,14px));border:1px solid color-mix(in srgb,var(--slc-attention,#b45309) 35%,transparent);background:color-mix(in srgb,var(--slc-attention,#b45309) 7%,var(--slc-bg,var(--sl-color-surface,#fff)));color:var(--slc-fg,var(--sl-color-fg,#0f172a))}\n.slc-todo-title{margin:0 0 2px;font-size:.875rem;font-weight:600}\n.slc-todo-row{display:flex;align-items:center;gap:10px;font-size:.875rem}\n.slc-todo-row .slc-dot{margin-top:0;background:var(--slc-attention,#b45309)}\n.slc-todo-row.slc-tone-error .slc-dot{background:var(--slc-error,var(--sl-color-danger,#dc2626))}\n.slc-todo-text{flex:1;min-width:0}\n";
58
+ export declare const ADMIN_CARD_CSS = "\n.slc-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:var(--slc-gap,16px)}\n.slc-grid>*{grid-column:span 12}\n@media (min-width:768px){.slc-grid>.slc-size-small{grid-column:span 6}.slc-grid>.slc-size-medium,.slc-grid>.slc-size-wide{grid-column:span 12}}\n@media (min-width:1100px){.slc-grid>.slc-size-small{grid-column:span 3}.slc-grid>.slc-size-medium{grid-column:span 6}.slc-grid>.slc-size-wide{grid-column:span 8}}\n.slc-card{--_bg:var(--slc-bg,var(--sl-color-surface,#fff));--_fg:var(--slc-fg,var(--sl-color-fg,#0f172a));--_muted:var(--slc-muted,var(--sl-color-muted,#64748b));--_border:var(--slc-border,var(--sl-color-border,#e2e8f0));--_accent:var(--slc-accent,var(--sl-color-accent,#2563eb));--_ok:var(--slc-ok,var(--sl-color-success,#059669));--_warn:var(--slc-attention,#b45309);--_err:var(--slc-error,var(--sl-color-danger,#dc2626));\n box-sizing:border-box;display:flex;flex-direction:column;gap:12px;min-height:148px;padding:16px 18px;border:1px solid var(--_border);border-radius:var(--slc-radius,var(--sl-radius-lg,14px));background:var(--_bg);color:var(--_fg);font:inherit;position:relative}\n.slc-head{display:flex;align-items:center;gap:8px;min-width:0}\n.slc-title{margin:0;font-size:.95rem;font-weight:600;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.slc-age{font-size:.75rem;color:var(--_muted);white-space:nowrap}\n.slc-refresh{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:6px;color:var(--_muted)}\n.slc-refresh:hover{background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_fg)}\n.slc-refresh:focus-visible{outline:2px solid var(--_accent)}\n.slc-spin{animation:slc-spin 1s linear infinite}\n@keyframes slc-spin{to{transform:rotate(360deg)}}\n.slc-valuerow{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 10px}\n.slc-value{font-size:2rem;line-height:1.1;font-weight:700;letter-spacing:-.02em;min-width:0;overflow-wrap:anywhere}\n.slc-value.slc-text{font-size:1.375rem;letter-spacing:-.01em}\n.slc-unit{font-size:1rem;font-weight:600;margin-left:2px;color:var(--_muted)}\n.slc-label{font-size:.875rem;color:var(--_muted)}\n.slc-trend{font-size:.75rem;font-weight:600;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_muted)}\n.slc-trend.slc-good{background:color-mix(in srgb,var(--_ok) 14%,transparent);color:var(--_ok)}\n.slc-trend.slc-bad{background:color-mix(in srgb,var(--_err) 12%,transparent);color:var(--_err)}\n.slc-status{display:flex;align-items:flex-start;gap:8px;font-size:.875rem}\n.slc-dot{flex:none;width:8px;height:8px;border-radius:50%;margin-top:6px;background:var(--_muted)}\n.slc-tone-ok .slc-dot{background:var(--_ok)}.slc-tone-attention .slc-dot{background:var(--_warn)}.slc-tone-error .slc-dot{background:var(--_err)}\n.slc-progress{display:flex;flex-direction:column;gap:4px;font-size:.75rem;color:var(--_muted)}\n.slc-bar{height:6px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 18%,transparent);overflow:hidden}\n.slc-bar>span{display:block;height:100%;background:var(--_accent);border-radius:inherit}\n.slc-items{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}\n.slc-item{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--_border);font-size:.875rem;min-width:0}\n.slc-item:first-child{border-top:0}\n.slc-item-main{flex:1;min-width:0}\n.slc-item-img{width:36px;height:36px;flex:none;border-radius:8px;object-fit:cover;background:color-mix(in srgb,var(--_muted) 12%,transparent)}\n.slc-item-title,.slc-item-sub{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n.slc-item-sub,.slc-item-meta{color:var(--_muted);font-size:.75rem}\n.slc-link{all:unset;cursor:pointer}\n.slc-link:hover .slc-item-title{text-decoration:underline}\n.slc-link:focus-visible{outline:2px solid var(--_accent);border-radius:4px}\n.slc-empty{font-size:.875rem;color:var(--_muted)}\n.slc-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:auto}\n.slc-btn{all:unset;cursor:pointer;font-size:.8125rem;font-weight:600;padding:6px 12px;border-radius:8px;border:1px solid var(--_border);color:var(--_fg)}\n.slc-btn:hover{background:color-mix(in srgb,var(--_muted) 10%,transparent)}\n.slc-btn.slc-primary{background:var(--_accent);border-color:var(--_accent);color:var(--slc-on-accent,var(--sl-color-on-accent,#fff))}\n.slc-btn:focus-visible{outline:2px solid var(--_accent);outline-offset:2px}\n.slc-note{font-size:.75rem;color:var(--_muted)}\n.slc-note.slc-err{color:var(--_err)}\n.slc-skel{height:12px;border-radius:6px;background:color-mix(in srgb,var(--_muted) 16%,transparent);animation:slc-pulse 1.4s ease-in-out infinite}\n@keyframes slc-pulse{50%{opacity:.5}}\n.slc-todo{display:flex;flex-direction:column;gap:6px;padding:12px 16px;border-radius:var(--slc-radius,var(--sl-radius-lg,14px));border:1px solid color-mix(in srgb,var(--slc-attention,#b45309) 35%,transparent);background:color-mix(in srgb,var(--slc-attention,#b45309) 7%,var(--slc-bg,var(--sl-color-surface,#fff)));color:var(--slc-fg,var(--sl-color-fg,#0f172a))}\n.slc-todo-title{margin:0 0 2px;font-size:.875rem;font-weight:600}\n.slc-todo-row{display:flex;align-items:center;gap:10px;font-size:.875rem}\n.slc-todo-row .slc-dot{margin-top:0;background:var(--slc-attention,#b45309)}\n.slc-todo-row.slc-tone-error .slc-dot{background:var(--slc-error,var(--sl-color-danger,#dc2626))}\n.slc-todo-text{flex:1;min-width:0}\n";
59
59
  /** The card views, bound to the host's React. Call once per app (module scope). */
60
60
  export declare function createAdminCardViews(React: ReactLike): {
61
61
  AdminCardView: (props: AdminCardViewProps) => any;
@@ -28,60 +28,61 @@ export function adminCardAge(at, now = Date.now()) {
28
28
  return `${Math.round(s / 3600)} h ago`;
29
29
  return `${Math.round(s / 86400)} d ago`;
30
30
  }
31
- const CSS = `
32
- .slc-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:var(--slc-gap,16px)}
33
- .slc-grid>*{grid-column:span 12}
34
- @media (min-width:768px){.slc-grid>.slc-size-small{grid-column:span 6}.slc-grid>.slc-size-medium,.slc-grid>.slc-size-wide{grid-column:span 12}}
35
- @media (min-width:1100px){.slc-grid>.slc-size-small{grid-column:span 3}.slc-grid>.slc-size-medium{grid-column:span 6}.slc-grid>.slc-size-wide{grid-column:span 8}}
36
- .slc-card{--_bg:var(--slc-bg,var(--sl-color-surface,#fff));--_fg:var(--slc-fg,var(--sl-color-fg,#0f172a));--_muted:var(--slc-muted,var(--sl-color-muted,#64748b));--_border:var(--slc-border,var(--sl-color-border,#e2e8f0));--_accent:var(--slc-accent,var(--sl-color-accent,#2563eb));--_ok:var(--slc-ok,var(--sl-color-success,#059669));--_warn:var(--slc-attention,#b45309);--_err:var(--slc-error,var(--sl-color-danger,#dc2626));
37
- box-sizing:border-box;display:flex;flex-direction:column;gap:12px;min-height:148px;padding:16px 18px;border:1px solid var(--_border);border-radius:var(--slc-radius,var(--sl-radius-lg,14px));background:var(--_bg);color:var(--_fg);font:inherit;position:relative}
38
- .slc-head{display:flex;align-items:center;gap:8px;min-width:0}
39
- .slc-title{margin:0;font-size:.95rem;font-weight:600;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
40
- .slc-age{font-size:.75rem;color:var(--_muted);white-space:nowrap}
41
- .slc-refresh{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:6px;color:var(--_muted)}
42
- .slc-refresh:hover{background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_fg)}
43
- .slc-refresh:focus-visible{outline:2px solid var(--_accent)}
44
- .slc-spin{animation:slc-spin 1s linear infinite}
45
- @keyframes slc-spin{to{transform:rotate(360deg)}}
46
- .slc-valuerow{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 10px}
47
- .slc-value{font-size:2rem;line-height:1.1;font-weight:700;letter-spacing:-.02em;min-width:0;overflow-wrap:anywhere}
48
- .slc-value.slc-text{font-size:1.375rem;letter-spacing:-.01em}
49
- .slc-unit{font-size:1rem;font-weight:600;margin-left:2px;color:var(--_muted)}
50
- .slc-label{font-size:.875rem;color:var(--_muted)}
51
- .slc-trend{font-size:.75rem;font-weight:600;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_muted)}
52
- .slc-trend.slc-good{background:color-mix(in srgb,var(--_ok) 14%,transparent);color:var(--_ok)}
53
- .slc-trend.slc-bad{background:color-mix(in srgb,var(--_err) 12%,transparent);color:var(--_err)}
54
- .slc-status{display:flex;align-items:flex-start;gap:8px;font-size:.875rem}
55
- .slc-dot{flex:none;width:8px;height:8px;border-radius:50%;margin-top:6px;background:var(--_muted)}
56
- .slc-tone-ok .slc-dot{background:var(--_ok)}.slc-tone-attention .slc-dot{background:var(--_warn)}.slc-tone-error .slc-dot{background:var(--_err)}
57
- .slc-progress{display:flex;flex-direction:column;gap:4px;font-size:.75rem;color:var(--_muted)}
58
- .slc-bar{height:6px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 18%,transparent);overflow:hidden}
59
- .slc-bar>span{display:block;height:100%;background:var(--_accent);border-radius:inherit}
60
- .slc-items{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
61
- .slc-item{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--_border);font-size:.875rem;min-width:0}
62
- .slc-item:first-child{border-top:0}
63
- .slc-item-main{flex:1;min-width:0}
64
- .slc-item-title,.slc-item-sub{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
65
- .slc-item-sub,.slc-item-meta{color:var(--_muted);font-size:.75rem}
66
- .slc-link{all:unset;cursor:pointer}
67
- .slc-link:hover .slc-item-title{text-decoration:underline}
68
- .slc-link:focus-visible{outline:2px solid var(--_accent);border-radius:4px}
69
- .slc-empty{font-size:.875rem;color:var(--_muted)}
70
- .slc-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:auto}
71
- .slc-btn{all:unset;cursor:pointer;font-size:.8125rem;font-weight:600;padding:6px 12px;border-radius:8px;border:1px solid var(--_border);color:var(--_fg)}
72
- .slc-btn:hover{background:color-mix(in srgb,var(--_muted) 10%,transparent)}
73
- .slc-btn.slc-primary{background:var(--_accent);border-color:var(--_accent);color:var(--slc-on-accent,var(--sl-color-on-accent,#fff))}
74
- .slc-btn:focus-visible{outline:2px solid var(--_accent);outline-offset:2px}
75
- .slc-note{font-size:.75rem;color:var(--_muted)}
76
- .slc-note.slc-err{color:var(--_err)}
77
- .slc-skel{height:12px;border-radius:6px;background:color-mix(in srgb,var(--_muted) 16%,transparent);animation:slc-pulse 1.4s ease-in-out infinite}
78
- @keyframes slc-pulse{50%{opacity:.5}}
79
- .slc-todo{display:flex;flex-direction:column;gap:6px;padding:12px 16px;border-radius:var(--slc-radius,var(--sl-radius-lg,14px));border:1px solid color-mix(in srgb,var(--slc-attention,#b45309) 35%,transparent);background:color-mix(in srgb,var(--slc-attention,#b45309) 7%,var(--slc-bg,var(--sl-color-surface,#fff)));color:var(--slc-fg,var(--sl-color-fg,#0f172a))}
80
- .slc-todo-title{margin:0 0 2px;font-size:.875rem;font-weight:600}
81
- .slc-todo-row{display:flex;align-items:center;gap:10px;font-size:.875rem}
82
- .slc-todo-row .slc-dot{margin-top:0;background:var(--slc-attention,#b45309)}
83
- .slc-todo-row.slc-tone-error .slc-dot{background:var(--slc-error,var(--sl-color-danger,#dc2626))}
84
- .slc-todo-text{flex:1;min-width:0}
31
+ const CSS = `
32
+ .slc-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:var(--slc-gap,16px)}
33
+ .slc-grid>*{grid-column:span 12}
34
+ @media (min-width:768px){.slc-grid>.slc-size-small{grid-column:span 6}.slc-grid>.slc-size-medium,.slc-grid>.slc-size-wide{grid-column:span 12}}
35
+ @media (min-width:1100px){.slc-grid>.slc-size-small{grid-column:span 3}.slc-grid>.slc-size-medium{grid-column:span 6}.slc-grid>.slc-size-wide{grid-column:span 8}}
36
+ .slc-card{--_bg:var(--slc-bg,var(--sl-color-surface,#fff));--_fg:var(--slc-fg,var(--sl-color-fg,#0f172a));--_muted:var(--slc-muted,var(--sl-color-muted,#64748b));--_border:var(--slc-border,var(--sl-color-border,#e2e8f0));--_accent:var(--slc-accent,var(--sl-color-accent,#2563eb));--_ok:var(--slc-ok,var(--sl-color-success,#059669));--_warn:var(--slc-attention,#b45309);--_err:var(--slc-error,var(--sl-color-danger,#dc2626));
37
+ box-sizing:border-box;display:flex;flex-direction:column;gap:12px;min-height:148px;padding:16px 18px;border:1px solid var(--_border);border-radius:var(--slc-radius,var(--sl-radius-lg,14px));background:var(--_bg);color:var(--_fg);font:inherit;position:relative}
38
+ .slc-head{display:flex;align-items:center;gap:8px;min-width:0}
39
+ .slc-title{margin:0;font-size:.95rem;font-weight:600;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
40
+ .slc-age{font-size:.75rem;color:var(--_muted);white-space:nowrap}
41
+ .slc-refresh{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:6px;color:var(--_muted)}
42
+ .slc-refresh:hover{background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_fg)}
43
+ .slc-refresh:focus-visible{outline:2px solid var(--_accent)}
44
+ .slc-spin{animation:slc-spin 1s linear infinite}
45
+ @keyframes slc-spin{to{transform:rotate(360deg)}}
46
+ .slc-valuerow{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 10px}
47
+ .slc-value{font-size:2rem;line-height:1.1;font-weight:700;letter-spacing:-.02em;min-width:0;overflow-wrap:anywhere}
48
+ .slc-value.slc-text{font-size:1.375rem;letter-spacing:-.01em}
49
+ .slc-unit{font-size:1rem;font-weight:600;margin-left:2px;color:var(--_muted)}
50
+ .slc-label{font-size:.875rem;color:var(--_muted)}
51
+ .slc-trend{font-size:.75rem;font-weight:600;padding:2px 8px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 12%,transparent);color:var(--_muted)}
52
+ .slc-trend.slc-good{background:color-mix(in srgb,var(--_ok) 14%,transparent);color:var(--_ok)}
53
+ .slc-trend.slc-bad{background:color-mix(in srgb,var(--_err) 12%,transparent);color:var(--_err)}
54
+ .slc-status{display:flex;align-items:flex-start;gap:8px;font-size:.875rem}
55
+ .slc-dot{flex:none;width:8px;height:8px;border-radius:50%;margin-top:6px;background:var(--_muted)}
56
+ .slc-tone-ok .slc-dot{background:var(--_ok)}.slc-tone-attention .slc-dot{background:var(--_warn)}.slc-tone-error .slc-dot{background:var(--_err)}
57
+ .slc-progress{display:flex;flex-direction:column;gap:4px;font-size:.75rem;color:var(--_muted)}
58
+ .slc-bar{height:6px;border-radius:999px;background:color-mix(in srgb,var(--_muted) 18%,transparent);overflow:hidden}
59
+ .slc-bar>span{display:block;height:100%;background:var(--_accent);border-radius:inherit}
60
+ .slc-items{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
61
+ .slc-item{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--_border);font-size:.875rem;min-width:0}
62
+ .slc-item:first-child{border-top:0}
63
+ .slc-item-main{flex:1;min-width:0}
64
+ .slc-item-img{width:36px;height:36px;flex:none;border-radius:8px;object-fit:cover;background:color-mix(in srgb,var(--_muted) 12%,transparent)}
65
+ .slc-item-title,.slc-item-sub{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
66
+ .slc-item-sub,.slc-item-meta{color:var(--_muted);font-size:.75rem}
67
+ .slc-link{all:unset;cursor:pointer}
68
+ .slc-link:hover .slc-item-title{text-decoration:underline}
69
+ .slc-link:focus-visible{outline:2px solid var(--_accent);border-radius:4px}
70
+ .slc-empty{font-size:.875rem;color:var(--_muted)}
71
+ .slc-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:auto}
72
+ .slc-btn{all:unset;cursor:pointer;font-size:.8125rem;font-weight:600;padding:6px 12px;border-radius:8px;border:1px solid var(--_border);color:var(--_fg)}
73
+ .slc-btn:hover{background:color-mix(in srgb,var(--_muted) 10%,transparent)}
74
+ .slc-btn.slc-primary{background:var(--_accent);border-color:var(--_accent);color:var(--slc-on-accent,var(--sl-color-on-accent,#fff))}
75
+ .slc-btn:focus-visible{outline:2px solid var(--_accent);outline-offset:2px}
76
+ .slc-note{font-size:.75rem;color:var(--_muted)}
77
+ .slc-note.slc-err{color:var(--_err)}
78
+ .slc-skel{height:12px;border-radius:6px;background:color-mix(in srgb,var(--_muted) 16%,transparent);animation:slc-pulse 1.4s ease-in-out infinite}
79
+ @keyframes slc-pulse{50%{opacity:.5}}
80
+ .slc-todo{display:flex;flex-direction:column;gap:6px;padding:12px 16px;border-radius:var(--slc-radius,var(--sl-radius-lg,14px));border:1px solid color-mix(in srgb,var(--slc-attention,#b45309) 35%,transparent);background:color-mix(in srgb,var(--slc-attention,#b45309) 7%,var(--slc-bg,var(--sl-color-surface,#fff)));color:var(--slc-fg,var(--sl-color-fg,#0f172a))}
81
+ .slc-todo-title{margin:0 0 2px;font-size:.875rem;font-weight:600}
82
+ .slc-todo-row{display:flex;align-items:center;gap:10px;font-size:.875rem}
83
+ .slc-todo-row .slc-dot{margin-top:0;background:var(--slc-attention,#b45309)}
84
+ .slc-todo-row.slc-tone-error .slc-dot{background:var(--slc-error,var(--sl-color-danger,#dc2626))}
85
+ .slc-todo-text{flex:1;min-width:0}
85
86
  `;
86
87
  let injected = false;
87
88
  /** Add the card styles to the page once (the views call it; hosts rendering on the server can too). */
@@ -103,6 +104,20 @@ export function createAdminCardViews(React) {
103
104
  function useStyles() {
104
105
  React.useEffect(() => injectAdminCardStyles(), []);
105
106
  }
107
+ /** A row's meta: an ISO timestamp reads as a short date ("12 Nov"); anything else as given. */
108
+ function formatMeta(meta, lang) {
109
+ if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(meta))
110
+ return meta;
111
+ const d = new Date(meta);
112
+ if (Number.isNaN(d.getTime()))
113
+ return meta;
114
+ try {
115
+ return new Intl.DateTimeFormat(lang, { day: 'numeric', month: 'short' }).format(d);
116
+ }
117
+ catch (_a) {
118
+ return meta;
119
+ }
120
+ }
106
121
  function formatValue(v, lang) {
107
122
  if (typeof v === 'number') {
108
123
  try {
@@ -155,7 +170,7 @@ export function createAdminCardViews(React) {
155
170
  ? h('div', { className: 'slc-progress' }, h('div', { className: 'slc-bar', role: 'progressbar', 'aria-valuemin': 0, 'aria-valuemax': p.progress.total, 'aria-valuenow': p.progress.done }, h('span', { style: { width: `${Math.min(100, Math.round((p.progress.done / p.progress.total) * 100))}%` } })), h('span', null, p.progress.label || `${p.progress.done} of ${p.progress.total}`))
156
171
  : null, items.length && !showEmpty
157
172
  ? h('ul', { className: 'slc-items' }, ...items.map((it, i) => {
158
- const inner = h(React.Fragment, null, h('span', { className: 'slc-item-main' }, h('span', { className: 'slc-item-title' }, it.title), it.subtitle ? h('span', { className: 'slc-item-sub' }, it.subtitle) : null), it.meta ? h('span', { className: 'slc-item-meta' }, it.meta) : null);
173
+ const inner = h(React.Fragment, null, it.image ? h('img', { className: 'slc-item-img', src: it.image, alt: '', loading: 'lazy' }) : null, h('span', { className: 'slc-item-main' }, h('span', { className: 'slc-item-title' }, it.title), it.subtitle ? h('span', { className: 'slc-item-sub' }, it.subtitle) : null), it.meta ? h('span', { className: 'slc-item-meta' }, formatMeta(it.meta, lang)) : null);
159
174
  return h('li', { key: i, className: 'slc-item' }, it.path && onAction
160
175
  ? h('button', { type: 'button', className: 'slc-link', style: { display: 'flex', alignItems: 'center', gap: 8, flex: 1, minWidth: 0 }, onClick: () => act({ label: it.title, path: it.path }) }, inner)
161
176
  : inner);
@@ -1,3 +1,4 @@
1
+ import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
1
2
  import type { AppCase, CreateCaseInput, UpdateCaseInput, AppendHistoryInput, CaseSummaryRequest, CaseSummaryResponse, CaseListQueryParams, AppThread, CreateThreadInput, UpdateThreadInput, ReplyInput, ThreadListQueryParams, AppRecord, CreateRecordInput, CreateRecordResponse, UpdateRecordInput, UpsertRecordInput, UpsertRecordResponse, MatchRecordsInput, MatchResult, BulkUpsertItem, BulkUpsertResult, BulkDeleteResult, BulkDeleteInput, RecordListQueryParams, ResolveAllParams, ResolveAllResult, PreviewRuleParams, PreviewRuleResult, PaginatedResponse, AggregateRequest, AggregateResponse, RelatedResponse } from '../types/appObjects.js';
2
3
  export declare namespace app {
3
4
  /**
@@ -131,6 +132,31 @@ export declare namespace app {
131
132
  * @see {@link updateWithToken} — use the edit token for a follow-up amendment
132
133
  */
133
134
  function create(collectionId: string, appId: string, input: CreateRecordInput, admin?: boolean): Promise<CreateRecordResponse>;
135
+ /**
136
+ * The standard query on an app's records (admin only): filter, sort, page, count and total in one
137
+ * call, reaching into a record's own fields by path, and following a record to its `product` and
138
+ * its `contact`.
139
+ * POST /admin/collection/:collectionId/app/:appId/records/query
140
+ *
141
+ * Fields: id, recordType, ref, status, visibility, customId, productId, variantId, batchId, proofId,
142
+ * contactId, authorId, parentType, parentId, createdAt, updatedAt, startsAt, expiresAt, and the
143
+ * documents data, owner and admin, reached by path: `"data.status"`, `"data.line.name"`.
144
+ *
145
+ * ```typescript
146
+ * // How many work orders by status, and how many units on each
147
+ * await app.records.query(collectionId, appId, {
148
+ * where: { recordType: 'work_order' },
149
+ * groupBy: ['data.status'],
150
+ * aggregates: { orders: { count: true }, units: { sum: 'data.qty' } },
151
+ * })
152
+ * ```
153
+ */
154
+ function query(collectionId: string, appId: string, body?: StandardQuery): Promise<QueryResult>;
155
+ /**
156
+ * What a records query can use: its fields, what each can filter, sort, group or total, and its links.
157
+ * GET /admin/collection/:collectionId/app/:appId/records/query
158
+ */
159
+ function queryFields(collectionId: string, appId: string): Promise<QueryDescription>;
134
160
  /**
135
161
  * List records with optional query parameters
136
162
  * GET /records
@@ -1,4 +1,3 @@
1
- // src/api/appObjects.ts
2
1
  import { request, post, patch, del, put } from '../http.js';
3
2
  // ==================== APP NAMESPACE ====================
4
3
  export var app;
@@ -242,6 +241,37 @@ export var app;
242
241
  return post(path, input);
243
242
  }
244
243
  records_1.create = create;
244
+ /**
245
+ * The standard query on an app's records (admin only): filter, sort, page, count and total in one
246
+ * call, reaching into a record's own fields by path, and following a record to its `product` and
247
+ * its `contact`.
248
+ * POST /admin/collection/:collectionId/app/:appId/records/query
249
+ *
250
+ * Fields: id, recordType, ref, status, visibility, customId, productId, variantId, batchId, proofId,
251
+ * contactId, authorId, parentType, parentId, createdAt, updatedAt, startsAt, expiresAt, and the
252
+ * documents data, owner and admin, reached by path: `"data.status"`, `"data.line.name"`.
253
+ *
254
+ * ```typescript
255
+ * // How many work orders by status, and how many units on each
256
+ * await app.records.query(collectionId, appId, {
257
+ * where: { recordType: 'work_order' },
258
+ * groupBy: ['data.status'],
259
+ * aggregates: { orders: { count: true }, units: { sum: 'data.qty' } },
260
+ * })
261
+ * ```
262
+ */
263
+ async function query(collectionId, appId, body = {}) {
264
+ return post(`${basePath(collectionId, appId, true)}/query`, body);
265
+ }
266
+ records_1.query = query;
267
+ /**
268
+ * What a records query can use: its fields, what each can filter, sort, group or total, and its links.
269
+ * GET /admin/collection/:collectionId/app/:appId/records/query
270
+ */
271
+ async function queryFields(collectionId, appId) {
272
+ return request(`${basePath(collectionId, appId, true)}/query`);
273
+ }
274
+ records_1.queryFields = queryFields;
245
275
  /**
246
276
  * List records with optional query parameters
247
277
  * GET /records
@@ -0,0 +1,51 @@
1
+ import type { ConditionSet } from "../utils/conditions.js";
2
+ /** A saved condition: a named rule set pages, Hub blocks and apps refer to by id. */
3
+ export interface SavedCondition extends ConditionSet {
4
+ id: string;
5
+ /** What admins call it, e.g. "In the stadium". */
6
+ title: string;
7
+ /** Switched off: it passes for everyone. */
8
+ disabled?: boolean;
9
+ /** Removed (kept, marked deleted). Lists leave these out. */
10
+ deleted?: boolean;
11
+ [key: string]: any;
12
+ }
13
+ export type SaveConditionRequest = Omit<SavedCondition, "id" | "deleted">;
14
+ /**
15
+ * Saved conditions: named rule sets kept per collection (e.g. "UK only", "In the stadium"), so the same rule can be
16
+ * reused by id. They're checked on the device with `utils.validateCondition({ conditionId, collection })`, which
17
+ * loads a saved condition through `conditions.get` by itself.
18
+ *
19
+ * - Anyone can read a collection's saved conditions (`list`, `get`): they decide what a page shows.
20
+ * - Admins create and change them (`create`, `update`, `remove`).
21
+ */
22
+ export declare namespace conditions {
23
+ /** Every saved condition in the collection (removed ones left out). */
24
+ function list(collectionId: string, admin?: boolean): Promise<SavedCondition[]>;
25
+ /**
26
+ * One saved condition. Public reads 404 for a removed one; an admin read returns it with `deleted: true`.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const ukOnly = await conditions.get('coll_123', 'nfCmuWDY')
31
+ * ```
32
+ */
33
+ function get(collectionId: string, conditionId: string, admin?: boolean): Promise<SavedCondition>;
34
+ /**
35
+ * Save a new condition (admin).
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const c = await conditions.create('coll_123', {
40
+ * title: 'UK only',
41
+ * type: 'and',
42
+ * conditions: [{ type: 'country', countries: ['GB'], contains: true }],
43
+ * })
44
+ * ```
45
+ */
46
+ function create(collectionId: string, data: SaveConditionRequest): Promise<SavedCondition>;
47
+ /** Change a saved condition (admin). Send the fields to change; `conditions` is replaced whole. */
48
+ function update(collectionId: string, conditionId: string, data: Partial<SaveConditionRequest>): Promise<SavedCondition>;
49
+ /** Remove a saved condition (admin). It's kept, marked deleted, and passes for everyone from then on. */
50
+ function remove(collectionId: string, conditionId: string): Promise<SavedCondition>;
51
+ }
@@ -0,0 +1,57 @@
1
+ import { request, post, put, del } from "../http.js";
2
+ /**
3
+ * Saved conditions: named rule sets kept per collection (e.g. "UK only", "In the stadium"), so the same rule can be
4
+ * reused by id. They're checked on the device with `utils.validateCondition({ conditionId, collection })`, which
5
+ * loads a saved condition through `conditions.get` by itself.
6
+ *
7
+ * - Anyone can read a collection's saved conditions (`list`, `get`): they decide what a page shows.
8
+ * - Admins create and change them (`create`, `update`, `remove`).
9
+ */
10
+ export var conditions;
11
+ (function (conditions) {
12
+ const pub = (collectionId) => `/public/collection/${encodeURIComponent(collectionId)}/condition`;
13
+ const adm = (collectionId) => `/admin/collection/${encodeURIComponent(collectionId)}/condition`;
14
+ /** Every saved condition in the collection (removed ones left out). */
15
+ async function list(collectionId, admin = false) {
16
+ return request(admin ? adm(collectionId) : pub(collectionId));
17
+ }
18
+ conditions.list = list;
19
+ /**
20
+ * One saved condition. Public reads 404 for a removed one; an admin read returns it with `deleted: true`.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const ukOnly = await conditions.get('coll_123', 'nfCmuWDY')
25
+ * ```
26
+ */
27
+ async function get(collectionId, conditionId, admin = false) {
28
+ return request(`${admin ? adm(collectionId) : pub(collectionId)}/${encodeURIComponent(conditionId)}`);
29
+ }
30
+ conditions.get = get;
31
+ /**
32
+ * Save a new condition (admin).
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const c = await conditions.create('coll_123', {
37
+ * title: 'UK only',
38
+ * type: 'and',
39
+ * conditions: [{ type: 'country', countries: ['GB'], contains: true }],
40
+ * })
41
+ * ```
42
+ */
43
+ async function create(collectionId, data) {
44
+ return post(adm(collectionId), data);
45
+ }
46
+ conditions.create = create;
47
+ /** Change a saved condition (admin). Send the fields to change; `conditions` is replaced whole. */
48
+ async function update(collectionId, conditionId, data) {
49
+ return put(`${adm(collectionId)}/${encodeURIComponent(conditionId)}`, data);
50
+ }
51
+ conditions.update = update;
52
+ /** Remove a saved condition (admin). It's kept, marked deleted, and passes for everyone from then on. */
53
+ async function remove(collectionId, conditionId) {
54
+ return del(`${adm(collectionId)}/${encodeURIComponent(conditionId)}`);
55
+ }
56
+ conditions.remove = remove;
57
+ })(conditions || (conditions = {}));
@@ -1,5 +1,28 @@
1
1
  import { ContactResponse, ContactCreateRequest, ContactUpdateRequest, ContactListResponse, ContactSearchParams, ContactSearchResponse, PublicContactUpsertRequest, PublicContactUpsertResponse, UserSearchResponse, ContactPatch, PublicGetMyContactResponse, PublicUpdateMyContactResponse, ContactSchemaResponse, ContactDuplicatesResponse, ContactMergeResponse, ContactLinkLoginResponse } from "../types/index.js";
2
+ import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
2
3
  export declare namespace contact {
4
+ /**
5
+ * The standard query on contacts (admin only): filter, sort, page, count and total in one call.
6
+ * POST /admin/collection/:collectionId/contacts/query
7
+ *
8
+ * Fields: contactId, userId, firstName, lastName, displayName, company, email, phone, tags, source,
9
+ * locale, createdAt, updatedAt. Email and phone are the contact's main one. Deleted and erased
10
+ * contacts are never returned.
11
+ *
12
+ * ```typescript
13
+ * await contact.query(collectionId, {
14
+ * where: { tags: { hasAny: ['vip', 'trade'] }, createdAt: { gte: '2026-01-01' } },
15
+ * select: ['contactId', 'firstName', 'email'], count: true,
16
+ * })
17
+ * await contact.query(collectionId, { groupBy: ['company'], aggregates: { people: { count: true } } })
18
+ * ```
19
+ */
20
+ function query(collectionId: string, body?: StandardQuery): Promise<QueryResult>;
21
+ /**
22
+ * What a contacts query can use: its fields and what each can filter, sort, group or total.
23
+ * GET /admin/collection/:collectionId/contacts/query
24
+ */
25
+ function queryFields(collectionId: string): Promise<QueryDescription>;
3
26
  function create(collectionId: string, data: ContactCreateRequest): Promise<ContactResponse>;
4
27
  function list(collectionId: string, params?: {
5
28
  limit?: number;
@@ -1,6 +1,36 @@
1
1
  import { request, post, del, patch } from "../http.js";
2
2
  export var contact;
3
3
  (function (contact) {
4
+ /**
5
+ * The standard query on contacts (admin only): filter, sort, page, count and total in one call.
6
+ * POST /admin/collection/:collectionId/contacts/query
7
+ *
8
+ * Fields: contactId, userId, firstName, lastName, displayName, company, email, phone, tags, source,
9
+ * locale, createdAt, updatedAt. Email and phone are the contact's main one. Deleted and erased
10
+ * contacts are never returned.
11
+ *
12
+ * ```typescript
13
+ * await contact.query(collectionId, {
14
+ * where: { tags: { hasAny: ['vip', 'trade'] }, createdAt: { gte: '2026-01-01' } },
15
+ * select: ['contactId', 'firstName', 'email'], count: true,
16
+ * })
17
+ * await contact.query(collectionId, { groupBy: ['company'], aggregates: { people: { count: true } } })
18
+ * ```
19
+ */
20
+ async function query(collectionId, body = {}) {
21
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/contacts/query`;
22
+ return post(path, body);
23
+ }
24
+ contact.query = query;
25
+ /**
26
+ * What a contacts query can use: its fields and what each can filter, sort, group or total.
27
+ * GET /admin/collection/:collectionId/contacts/query
28
+ */
29
+ async function queryFields(collectionId) {
30
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/contacts/query`;
31
+ return request(path);
32
+ }
33
+ contact.queryFields = queryFields;
4
34
  async function create(collectionId, data) {
5
35
  const path = `/admin/collection/${encodeURIComponent(collectionId)}/contacts`;
6
36
  return post(path, data);
@@ -24,6 +24,7 @@ export { async } from "./async.js";
24
24
  export { jobs } from "./jobs.js";
25
25
  export { segments } from "./segments.js";
26
26
  export { userGroups } from "./userGroups.js";
27
+ export { conditions } from "./conditions.js";
27
28
  export { operations } from "./operations.js";
28
29
  export { journeys } from "./journeys.js";
29
30
  export { journeysAnalytics } from "./journeysAnalytics.js";
package/dist/api/index.js CHANGED
@@ -26,6 +26,7 @@ export { async } from "./async.js";
26
26
  export { jobs } from "./jobs.js";
27
27
  export { segments } from "./segments.js";
28
28
  export { userGroups } from "./userGroups.js";
29
+ export { conditions } from "./conditions.js";
29
30
  export { operations } from "./operations.js";
30
31
  export { journeys } from "./journeys.js";
31
32
  export { journeysAnalytics } from "./journeysAnalytics.js";
@@ -1,3 +1,4 @@
1
+ import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
1
2
  import { JsonValue, ProductClaimCreateRequestBody, ProductCreateRequest, ProductQueryRequest, ProductQueryResponse, ProductResponse, ProductUpdateRequest } from "../types/product.js";
2
3
  export declare namespace products {
3
4
  function get(collectionId: string, productId: string, admin?: boolean): Promise<ProductResponse>;
@@ -25,6 +26,27 @@ export declare namespace products {
25
26
  * ```
26
27
  */
27
28
  function query(collectionId: string, body: ProductQueryRequest, admin?: boolean): Promise<ProductQueryResponse>;
29
+ /**
30
+ * The standard query on products (admin only): the one query shape every resource is moving to, with
31
+ * counts, totals and filtering by facet. It sits beside `products.query`, whose own body is unchanged.
32
+ * POST /admin/collection/:collectionId/products/standard/query
33
+ *
34
+ * Fields: id, name, description, sku, gtin, schemaType, status, sortOrder, createdAt, updatedAt,
35
+ * facets. Facets are filtered by key: the facet by its key or name, the value by its key or name.
36
+ *
37
+ * ```typescript
38
+ * await products.standardQuery(collectionId, {
39
+ * where: { facets: { brand: 'Breville', category: { in: ['Toasters', 'Kettles'] } }, status: 'active' },
40
+ * select: ['id', 'name', 'sku'], count: true,
41
+ * })
42
+ * ```
43
+ */
44
+ function standardQuery(collectionId: string, body?: StandardQuery): Promise<QueryResult>;
45
+ /**
46
+ * What a products standard query can use: its fields and what each can filter, sort, group or total.
47
+ * GET /admin/collection/:collectionId/products/standard/query
48
+ */
49
+ function standardQueryFields(collectionId: string): Promise<QueryDescription>;
28
50
  function clone(collectionId: string, productId: string, body?: Record<string, JsonValue>): Promise<ProductResponse>;
29
51
  function listAssets(collectionId: string, productId: string, admin?: boolean): Promise<unknown>;
30
52
  function createClaimWindow(collectionId: string, productId: string, body: Record<string, JsonValue>): Promise<unknown>;
@@ -53,6 +53,35 @@ export var products;
53
53
  return post(path, body);
54
54
  }
55
55
  products.query = query;
56
+ /**
57
+ * The standard query on products (admin only): the one query shape every resource is moving to, with
58
+ * counts, totals and filtering by facet. It sits beside `products.query`, whose own body is unchanged.
59
+ * POST /admin/collection/:collectionId/products/standard/query
60
+ *
61
+ * Fields: id, name, description, sku, gtin, schemaType, status, sortOrder, createdAt, updatedAt,
62
+ * facets. Facets are filtered by key: the facet by its key or name, the value by its key or name.
63
+ *
64
+ * ```typescript
65
+ * await products.standardQuery(collectionId, {
66
+ * where: { facets: { brand: 'Breville', category: { in: ['Toasters', 'Kettles'] } }, status: 'active' },
67
+ * select: ['id', 'name', 'sku'], count: true,
68
+ * })
69
+ * ```
70
+ */
71
+ async function standardQuery(collectionId, body = {}) {
72
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/standard/query`;
73
+ return post(path, body);
74
+ }
75
+ products.standardQuery = standardQuery;
76
+ /**
77
+ * What a products standard query can use: its fields and what each can filter, sort, group or total.
78
+ * GET /admin/collection/:collectionId/products/standard/query
79
+ */
80
+ async function standardQueryFields(collectionId) {
81
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/standard/query`;
82
+ return request(path);
83
+ }
84
+ products.standardQueryFields = standardQueryFields;
56
85
  async function clone(collectionId, productId, body = {}) {
57
86
  const path = `/admin/collection/${encodeURIComponent(collectionId)}/products/${encodeURIComponent(productId)}/clone`;
58
87
  return post(path, body);
@@ -1,5 +1,35 @@
1
1
  import { ProofResponse, ProofCreateRequest, ProofUpdateRequest, ProofValuesUpdateRequest, ProofClaimRequest, ProofGrant, CreateGrantOptions, RedeemGrantOptions, RedeemGrantResult, ProofTransfer, TransferProofOptions, TransferProofResult, AcceptTransferOptions, CancelTransferOptions } from "../types/proof.js";
2
+ import type { StandardQuery, QueryResult, QueryDescription } from "../types/query.js";
2
3
  export declare namespace proof {
4
+ /**
5
+ * The standard query on proofs (admin only): filter, sort, page, count and total a collection's proofs
6
+ * in one call, and follow a proof to its `product` and its `owner` (the owner's contact).
7
+ * POST /admin/collection/:collectionId/proof/query
8
+ *
9
+ * Fields: id, productId, userId (the owner's login id), batchId, variantId, lotId, status, claimable,
10
+ * createdAt, updatedAt. A proof's own values are not returned by this call.
11
+ *
12
+ * ```typescript
13
+ * // How many people own each product
14
+ * await proof.query(collectionId, {
15
+ * where: { userId: { isNull: false } },
16
+ * groupBy: ['productId'],
17
+ * aggregates: { owners: { countDistinct: 'userId' } },
18
+ * })
19
+ * // The most recent owner of a product, with their name
20
+ * await proof.query(collectionId, {
21
+ * where: { productId: 'toaster', userId: { isNull: false } },
22
+ * orderBy: [{ createdAt: 'desc' }], limit: 1,
23
+ * expand: { owner: ['firstName', 'lastName', 'email'] },
24
+ * })
25
+ * ```
26
+ */
27
+ function query(collectionId: string, body?: StandardQuery): Promise<QueryResult>;
28
+ /**
29
+ * What a proofs query can use: its fields, what each can filter, sort, group or total, and its links.
30
+ * GET /admin/collection/:collectionId/proof/query
31
+ */
32
+ function queryFields(collectionId: string): Promise<QueryDescription>;
3
33
  /**
4
34
  * Retrieves a single Proof by Collection ID, Product ID, and Proof ID.
5
35
  * Both public and admin endpoints now include productId in the path.
package/dist/api/proof.js CHANGED
@@ -2,6 +2,43 @@
2
2
  import { request, post, put, del } from "../http.js";
3
3
  export var proof;
4
4
  (function (proof) {
5
+ /**
6
+ * The standard query on proofs (admin only): filter, sort, page, count and total a collection's proofs
7
+ * in one call, and follow a proof to its `product` and its `owner` (the owner's contact).
8
+ * POST /admin/collection/:collectionId/proof/query
9
+ *
10
+ * Fields: id, productId, userId (the owner's login id), batchId, variantId, lotId, status, claimable,
11
+ * createdAt, updatedAt. A proof's own values are not returned by this call.
12
+ *
13
+ * ```typescript
14
+ * // How many people own each product
15
+ * await proof.query(collectionId, {
16
+ * where: { userId: { isNull: false } },
17
+ * groupBy: ['productId'],
18
+ * aggregates: { owners: { countDistinct: 'userId' } },
19
+ * })
20
+ * // The most recent owner of a product, with their name
21
+ * await proof.query(collectionId, {
22
+ * where: { productId: 'toaster', userId: { isNull: false } },
23
+ * orderBy: [{ createdAt: 'desc' }], limit: 1,
24
+ * expand: { owner: ['firstName', 'lastName', 'email'] },
25
+ * })
26
+ * ```
27
+ */
28
+ async function query(collectionId, body = {}) {
29
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/proof/query`;
30
+ return post(path, body);
31
+ }
32
+ proof.query = query;
33
+ /**
34
+ * What a proofs query can use: its fields, what each can filter, sort, group or total, and its links.
35
+ * GET /admin/collection/:collectionId/proof/query
36
+ */
37
+ async function queryFields(collectionId) {
38
+ const path = `/admin/collection/${encodeURIComponent(collectionId)}/proof/query`;
39
+ return request(path);
40
+ }
41
+ proof.queryFields = queryFields;
5
42
  /**
6
43
  * Retrieves a single Proof by Collection ID, Product ID, and Proof ID.
7
44
  * Both public and admin endpoints now include productId in the path.