@crossworks/client-types 0.400.61 → 0.400.70

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossworks/client-types",
3
- "version": "0.400.61",
3
+ "version": "0.400.70",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
package/src/dto/auth.ts CHANGED
@@ -3,13 +3,18 @@
3
3
  * before anyone has signed in, and the first-run signup body.
4
4
  */
5
5
 
6
- /** GET /api/auth/bootstrap-state. Public and boolean-only. */
6
+ import type { PasswordRule } from './workspaces';
7
+
8
+ /** GET /api/auth/bootstrap-state. Public: booleans and the password rule. */
7
9
  export type BootstrapStateDTO = {
8
10
  /** No account exists yet: the login screen shows "create your login". */
9
11
  firstRun: boolean;
10
12
  /** Signup asks for the installer's setup code (MANTLE_SETUP_CODE). Only
11
13
  * ever true while `firstRun` is. Absent on a brain from before the field. */
12
14
  setupCodeRequired?: boolean;
15
+ /** The rule a new password must meet, for a form to show as the person
16
+ * types. Absent on a brain from before the field. */
17
+ passwordRule?: PasswordRule;
13
18
  };
14
19
 
15
20
  /** POST /api/auth/signup. Open only while no account exists. */
package/src/dto/rows.ts CHANGED
@@ -706,7 +706,9 @@ export type BoxPolicyReport = {
706
706
  /** MANTLE_POLICY_MODEL_DENY patterns (lowercase) and
707
707
  * MANTLE_POLICY_PROVIDER_ALLOW ids (null: any provider). */
708
708
  models: { deny: string[]; providerAllow: string[] | null };
709
- /** MANTLE_POLICY_PASSWORD_MIN: `set` false is today's rule (8, no list). */
709
+ /** MANTLE_POLICY_PASSWORD_MIN: `set` false means no forced change at
710
+ * sign-in. A new password meets the rule either way (8 characters, the
711
+ * kinds, the common list: server/web/lib/auth/password-rule.ts). */
710
712
  passwords: { set: boolean; min: number; commonList: boolean };
711
713
  /** Every enabled assistant, worker or embedder route the model block
712
714
  * refuses: `ref` is `agent:<slug>`, `worker:<kind>` or `embedding`. */
@@ -258,14 +258,27 @@ export type AuthWhoami = {
258
258
  passwordRule?: PasswordRule;
259
259
  };
260
260
 
261
- /** The password rule in force (docs/policy.md): at least `min` characters,
262
- * and, under a box policy, not a common password (`commonList`). */
263
- export type PasswordRule = { min: number; commonList: boolean };
261
+ /** The rule a new password must meet (docs/policy.md): at least `min`
262
+ * characters, at most `maxBytes` UTF-8 bytes, `kinds` of the four kinds
263
+ * (small letters, capitals, digits, symbols) below `passphrase` characters,
264
+ * and not a common password (`commonList`). `maxBytes`, `kinds` and
265
+ * `passphrase` are absent from a server before the 2026-11 rule. */
266
+ export type PasswordRule = {
267
+ min: number;
268
+ commonList: boolean;
269
+ maxBytes?: number;
270
+ kinds?: number;
271
+ passphrase?: number;
272
+ };
264
273
 
265
274
  /** Every `code` a refused new password carries (HTTP 400 `{ error, code,
266
275
  * min }`), and the hold's 403 code. */
267
276
  export type PasswordErrorCode =
268
- 'password_too_short' | 'password_too_long' | 'password_common' | 'password_change_required';
277
+ | 'password_too_short'
278
+ | 'password_too_long'
279
+ | 'password_weak'
280
+ | 'password_common'
281
+ | 'password_change_required';
269
282
 
270
283
  /** Every `code` a /api/workspaces refusal carries. */
271
284
  export type WorkspaceErrorCode =
package/src/kinds.ts CHANGED
@@ -63,8 +63,11 @@ export type KindSpec = {
63
63
  readonly class: KindClass;
64
64
  readonly tree: KindTreeSpec | null;
65
65
  /** May carry a public link (SHAREABLE_TYPES). 'files-folder': a folder,
66
- * only strictly under the `files` root (canShareNode). */
67
- readonly publicLink: boolean | 'files-folder';
66
+ * only strictly under the `files` root (canShareNode). 'moderator': its
67
+ * link runs code for anyone (an app, a Present canvas), so only a
68
+ * Moderator of its home opens, changes or closes it (linkNeedsModerator);
69
+ * `true`: whoever may edit the item. */
70
+ readonly publicLink: boolean | 'files-folder' | 'moderator';
68
71
  /** May be shared with one contact (CONTACT_SHAREABLE_TYPES). */
69
72
  readonly contactShare: boolean;
70
73
  /** May be granted to a linked brain by category (PEER_SHAREABLE_TYPES). */
@@ -671,7 +674,7 @@ export const ITEM_KINDS = {
671
674
  sorts: ['name', 'updated'],
672
675
  shareable: true,
673
676
  },
674
- publicLink: true,
677
+ publicLink: 'moderator',
675
678
  contactShare: true,
676
679
  peerShare: false,
677
680
  searchable: false,
@@ -801,7 +804,7 @@ export const ITEM_KINDS = {
801
804
  sorts: ['updated', 'name'],
802
805
  shareable: true,
803
806
  },
804
- publicLink: true,
807
+ publicLink: 'moderator',
805
808
  contactShare: false,
806
809
  peerShare: false,
807
810
  searchable: true,
@@ -854,6 +857,15 @@ export function kindSpecOf(type: string): KindSpec | null {
854
857
  : null;
855
858
  }
856
859
 
860
+ /** Whether only a Moderator of the item's home may open, change or close its
861
+ * link (`publicLink: 'moderator'`: an app, a Present canvas, whose link runs
862
+ * code for anyone), not whoever may edit it. THE one rule: assertMayLink,
863
+ * the grants panel's mayLink, the share routes' check and the link tools'
864
+ * words all read it. */
865
+ export function linkNeedsModerator(type: string): boolean {
866
+ return kindSpecOf(type)?.publicLink === 'moderator';
867
+ }
868
+
857
869
  /** The class of `type` (mantle_kind_class in TS); an unknown value is
858
870
  * 'admin_only', as the SQL's ELSE. */
859
871
  export function kindClassOf(type: string): KindClass {
@@ -863,7 +875,7 @@ export function kindClassOf(type: string): KindClass {
863
875
  // ── Typed selections the derived lists use ──────────────────────────────────
864
876
 
865
877
  export type WorkspaceKind = KindsWhere<{ class: 'workspace' }>;
866
- export type PublicLinkKind = KindsWhere<{ publicLink: true | 'files-folder' }>;
878
+ export type PublicLinkKind = KindsWhere<{ publicLink: true | 'files-folder' | 'moderator' }>;
867
879
  export type ContactShareKind = KindsWhere<{ contactShare: true }>;
868
880
  export type PeerShareKind = KindsWhere<{ peerShare: true }>;
869
881
  export type SearchableKind = KindsWhere<{ searchable: true }>;