@oxyhq/core 21.1.0 → 21.2.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.
@@ -180,6 +180,21 @@ export interface CreateAccountInput {
180
180
  };
181
181
  bio?: string;
182
182
  avatar?: string;
183
+ /**
184
+ * Named color preset KEY — `'blue'`, `'mint'`, … — never a hex value. The
185
+ * account graph's half of `User.color`, which every account DTO already
186
+ * carries; this is how one gets WRITTEN for an account you administer.
187
+ *
188
+ * Set it HERE rather than after the fact. For a managed account the colour is
189
+ * a visual identity, and an account that is discoverable without one and
190
+ * acquires it on a second request is a face that changes by itself.
191
+ *
192
+ * Omitted is not "no colour": the platform assigns a random preset, exactly as
193
+ * it did before this field existed. A reserved preset is refused unless the
194
+ * account has a claim to it — the administrator's own entitlements are not the
195
+ * ones weighed.
196
+ */
197
+ color?: string;
183
198
  /**
184
199
  * What the account is about. ORDERED — the FIRST element is the primary
185
200
  * category, so a picker must submit them in the order the user arranged them
@@ -224,6 +239,15 @@ export interface UpdateAccountInput {
224
239
  };
225
240
  bio?: string | null;
226
241
  avatar?: string | null;
242
+ /**
243
+ * Named color preset KEY, same vocabulary as `CreateAccountInput['color']`.
244
+ *
245
+ * NOT nullable, unlike `bio` and `avatar`: the column is `NOT NULL` with a
246
+ * default, so an account always HAS a colour and there is no "clear" to
247
+ * express. Sending the value the account already carries is always accepted,
248
+ * so a client may PATCH back the object it was served.
249
+ */
250
+ color?: string;
227
251
  /**
228
252
  * Replaces the WHOLE list, in the order given — there is no add/remove verb,
229
253
  * because a partial edit cannot express a re-ordering and the order is what
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxyhq/core",
3
- "version": "21.1.0",
3
+ "version": "21.2.0",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -116,7 +116,7 @@
116
116
  "dependencies": {
117
117
  "@noble/ciphers": "^1.3.0",
118
118
  "@noble/hashes": "^1.8.0",
119
- "@oxyhq/contracts": "^0.31.0",
119
+ "@oxyhq/contracts": "^0.32.0",
120
120
  "@oxyhq/protocol": "^0.2.0",
121
121
  "@scure/bip39": "^1.6.0",
122
122
  "@types/elliptic": "^6.4.18",
@@ -201,6 +201,21 @@ export interface CreateAccountInput {
201
201
  name?: { first?: string; last?: string; displayName?: string };
202
202
  bio?: string;
203
203
  avatar?: string;
204
+ /**
205
+ * Named color preset KEY — `'blue'`, `'mint'`, … — never a hex value. The
206
+ * account graph's half of `User.color`, which every account DTO already
207
+ * carries; this is how one gets WRITTEN for an account you administer.
208
+ *
209
+ * Set it HERE rather than after the fact. For a managed account the colour is
210
+ * a visual identity, and an account that is discoverable without one and
211
+ * acquires it on a second request is a face that changes by itself.
212
+ *
213
+ * Omitted is not "no colour": the platform assigns a random preset, exactly as
214
+ * it did before this field existed. A reserved preset is refused unless the
215
+ * account has a claim to it — the administrator's own entitlements are not the
216
+ * ones weighed.
217
+ */
218
+ color?: string;
204
219
  /**
205
220
  * What the account is about. ORDERED — the FIRST element is the primary
206
221
  * category, so a picker must submit them in the order the user arranged them
@@ -242,6 +257,15 @@ export interface UpdateAccountInput {
242
257
  name?: { first?: string; last?: string; displayName?: string };
243
258
  bio?: string | null;
244
259
  avatar?: string | null;
260
+ /**
261
+ * Named color preset KEY, same vocabulary as `CreateAccountInput['color']`.
262
+ *
263
+ * NOT nullable, unlike `bio` and `avatar`: the column is `NOT NULL` with a
264
+ * default, so an account always HAS a colour and there is no "clear" to
265
+ * express. Sending the value the account already carries is always accepted,
266
+ * so a client may PATCH back the object it was served.
267
+ */
268
+ color?: string;
245
269
  /**
246
270
  * Replaces the WHOLE list, in the order given — there is no add/remove verb,
247
271
  * because a partial edit cannot express a re-ordering and the order is what
@@ -255,13 +255,20 @@ describe('OxyServices.accounts', () => {
255
255
  it('posts the payload, unwraps `account`, and busts every list', async () => {
256
256
  makeRequestSpy.mockResolvedValue({ account: accountNodeFixture });
257
257
 
258
- const result = await oxy.createAccount({ kind: 'organization', username: 'oxy-org' });
258
+ const result = await oxy.createAccount({
259
+ kind: 'organization',
260
+ username: 'oxy-org',
261
+ color: 'purple',
262
+ });
259
263
 
260
264
  expect(result).toEqual(accountNodeFixture);
265
+ // `color` rides the CREATE body, not a follow-up patch: an account that is
266
+ // discoverable without its colour and acquires one on a second request is
267
+ // a face that changes by itself.
261
268
  expect(makeRequestSpy).toHaveBeenCalledWith(
262
269
  'POST',
263
270
  '/accounts',
264
- { kind: 'organization', username: 'oxy-org' },
271
+ { kind: 'organization', username: 'oxy-org', color: 'purple' },
265
272
  expect.objectContaining({ cache: false }),
266
273
  );
267
274
  expect(clearEntrySpy).toHaveBeenCalledWith('GET:/accounts');
@@ -273,13 +280,13 @@ describe('OxyServices.accounts', () => {
273
280
  it('patches, unwraps `account`, and busts the detail + lists', async () => {
274
281
  makeRequestSpy.mockResolvedValue({ account: accountNodeFixture });
275
282
 
276
- const result = await oxy.updateAccount('acc1', { bio: 'hello' });
283
+ const result = await oxy.updateAccount('acc1', { bio: 'hello', color: 'mint' });
277
284
 
278
285
  expect(result).toEqual(accountNodeFixture);
279
286
  expect(makeRequestSpy).toHaveBeenCalledWith(
280
287
  'PATCH',
281
288
  '/accounts/acc1',
282
- { bio: 'hello' },
289
+ { bio: 'hello', color: 'mint' },
283
290
  expect.objectContaining({ cache: false }),
284
291
  );
285
292
  expect(clearEntrySpy).toHaveBeenCalledWith('GET:/accounts/acc1');