@oxy.so/contracts 6.25.0 → 6.26.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.
@@ -17,6 +17,16 @@
17
17
  * is the SHAPE of what a client writes: only the keys a character has, each an
18
18
  * id-like string, a `#rrggbb` paint, a spacing in range. The client resolves
19
19
  * the ids and falls back on a default look for one it cannot draw.
20
+ *
21
+ * ## A bot's colour is its account's, not its character's
22
+ *
23
+ * A bot is painted in its account's `color` (`User.color`, a Bloom preset key):
24
+ * Bloom draws a bot account's character in it (`avatarCharacterInColor`,
25
+ * `@oxy.so/bloom` 20), so a character needs no paint of its own and a bot whose
26
+ * owner changes its colour changes everywhere at once. A character is therefore
27
+ * valid with a preset or a shape alone. `color` and `bodyColor` are still
28
+ * accepted from writers that send them, and a renderer that knows the account's
29
+ * colour ignores them.
20
30
  */
21
31
  Object.defineProperty(exports, "__esModule", { value: true });
22
32
  exports.AVATAR_PICKABLE_COLORS = exports.AVATAR_PICKABLE_SHAPES = exports.avatarCharacterSchema = exports.AVATAR_EYE_SPACING = void 0;
@@ -31,7 +41,8 @@ const idSchema = zod_1.z.string().regex(ID);
31
41
  /**
32
42
  * A character a client sends. `.strict()` so a misspelled field is a refusal
33
43
  * now rather than a look that never takes effect. A character with nothing in
34
- * it draws nothing: it needs a preset, or a shape and a paint.
44
+ * it draws nothing: it needs a preset or a shape. It needs no paint: the
45
+ * account's colour paints it (see the file comment).
35
46
  */
36
47
  exports.avatarCharacterSchema = zod_1.z
37
48
  .object({
@@ -54,8 +65,9 @@ exports.avatarCharacterSchema = zod_1.z
54
65
  .optional(),
55
66
  })
56
67
  .strict()
57
- .refine((c) => c.preset !== undefined ||
58
- (c.shape !== undefined && (c.color !== undefined || c.bodyColor !== undefined)), { message: 'A character needs a preset, or a shape and a color' });
68
+ .refine((c) => c.preset !== undefined || c.shape !== undefined, {
69
+ message: 'A character needs a preset or a shape',
70
+ });
59
71
  /** The validated character, or `null` for anything that is not one. */
60
72
  function parseAvatarCharacter(value) {
61
73
  const parsed = exports.avatarCharacterSchema.safeParse(value);
@@ -16,6 +16,16 @@
16
16
  * is the SHAPE of what a client writes: only the keys a character has, each an
17
17
  * id-like string, a `#rrggbb` paint, a spacing in range. The client resolves
18
18
  * the ids and falls back on a default look for one it cannot draw.
19
+ *
20
+ * ## A bot's colour is its account's, not its character's
21
+ *
22
+ * A bot is painted in its account's `color` (`User.color`, a Bloom preset key):
23
+ * Bloom draws a bot account's character in it (`avatarCharacterInColor`,
24
+ * `@oxy.so/bloom` 20), so a character needs no paint of its own and a bot whose
25
+ * owner changes its colour changes everywhere at once. A character is therefore
26
+ * valid with a preset or a shape alone. `color` and `bodyColor` are still
27
+ * accepted from writers that send them, and a renderer that knows the account's
28
+ * colour ignores them.
19
29
  */
20
30
  import { z } from 'zod';
21
31
  const ID = /^[a-z][a-z0-9_]{0,39}$/;
@@ -26,7 +36,8 @@ const idSchema = z.string().regex(ID);
26
36
  /**
27
37
  * A character a client sends. `.strict()` so a misspelled field is a refusal
28
38
  * now rather than a look that never takes effect. A character with nothing in
29
- * it draws nothing: it needs a preset, or a shape and a paint.
39
+ * it draws nothing: it needs a preset or a shape. It needs no paint: the
40
+ * account's colour paints it (see the file comment).
30
41
  */
31
42
  export const avatarCharacterSchema = z
32
43
  .object({
@@ -49,8 +60,9 @@ export const avatarCharacterSchema = z
49
60
  .optional(),
50
61
  })
51
62
  .strict()
52
- .refine((c) => c.preset !== undefined ||
53
- (c.shape !== undefined && (c.color !== undefined || c.bodyColor !== undefined)), { message: 'A character needs a preset, or a shape and a color' });
63
+ .refine((c) => c.preset !== undefined || c.shape !== undefined, {
64
+ message: 'A character needs a preset or a shape',
65
+ });
54
66
  /** The validated character, or `null` for anything that is not one. */
55
67
  export function parseAvatarCharacter(value) {
56
68
  const parsed = avatarCharacterSchema.safeParse(value);
@@ -16,6 +16,16 @@
16
16
  * is the SHAPE of what a client writes: only the keys a character has, each an
17
17
  * id-like string, a `#rrggbb` paint, a spacing in range. The client resolves
18
18
  * the ids and falls back on a default look for one it cannot draw.
19
+ *
20
+ * ## A bot's colour is its account's, not its character's
21
+ *
22
+ * A bot is painted in its account's `color` (`User.color`, a Bloom preset key):
23
+ * Bloom draws a bot account's character in it (`avatarCharacterInColor`,
24
+ * `@oxy.so/bloom` 20), so a character needs no paint of its own and a bot whose
25
+ * owner changes its colour changes everywhere at once. A character is therefore
26
+ * valid with a preset or a shape alone. `color` and `bodyColor` are still
27
+ * accepted from writers that send them, and a renderer that knows the account's
28
+ * colour ignores them.
19
29
  */
20
30
  import { z } from 'zod';
21
31
  /** The flat shape of Bloom's `AvatarCharacter`; every field is optional (a preset supplies the rest). */
@@ -40,7 +50,8 @@ export declare const AVATAR_EYE_SPACING: {
40
50
  /**
41
51
  * A character a client sends. `.strict()` so a misspelled field is a refusal
42
52
  * now rather than a look that never takes effect. A character with nothing in
43
- * it draws nothing: it needs a preset, or a shape and a paint.
53
+ * it draws nothing: it needs a preset or a shape. It needs no paint: the
54
+ * account's colour paints it (see the file comment).
44
55
  */
45
56
  export declare const avatarCharacterSchema: z.ZodType<AvatarCharacter, unknown>;
46
57
  /** The validated character, or `null` for anything that is not one. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/contracts",
3
- "version": "6.25.0",
3
+ "version": "6.26.0",
4
4
  "description": "OxyHQ API contracts — single source of truth for request/response Zod schemas and inferred types, shared by the backend and the client SDKs",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -89,6 +89,6 @@
89
89
  "@types/node": "^26.6.6",
90
90
  "jest": "^30.5.2",
91
91
  "typescript": "~6.0.3",
92
- "@oxy.so/bloom": "17.15.0"
92
+ "@oxy.so/bloom": "19.8.3"
93
93
  }
94
94
  }