@stonecrop/stonecrop 0.12.0 → 0.12.2

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": "@stonecrop/stonecrop",
3
- "version": "0.12.0",
3
+ "version": "0.12.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -34,7 +34,7 @@
34
34
  "pinia-shared-state": "^1.0.1",
35
35
  "pinia-xstate": "^3.0.0",
36
36
  "xstate": "^5.25.0",
37
- "@stonecrop/schema": "0.12.0"
37
+ "@stonecrop/schema": "0.12.2"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "pinia": "^3.0.4",
@@ -60,16 +60,16 @@
60
60
  "vue-router": "^5.0.6",
61
61
  "vite": "^7.3.2",
62
62
  "vitest": "^4.1.5",
63
- "@stonecrop/aform": "0.12.0",
63
+ "@stonecrop/atable": "0.12.2",
64
64
  "stonecrop-rig": "0.7.0",
65
- "@stonecrop/atable": "0.12.0"
65
+ "@stonecrop/aform": "0.12.2"
66
66
  },
67
67
  "description": "Schema-driven framework with XState workflows and HST state management",
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
71
  "engines": {
72
- "node": ">=22.5.0"
72
+ "node": ">=24.0.0"
73
73
  },
74
74
  "scripts": {
75
75
  "_phase:build": "heft build && vite build && rushx docs",
package/src/stonecrop.ts CHANGED
@@ -378,11 +378,12 @@ export class Stonecrop {
378
378
 
379
379
  /**
380
380
  * Get single record from server using the configured data client.
381
- * @param doctype - The doctype
381
+ * @param doctype - The doctype slug string or Doctype object
382
382
  * @param recordId - The record ID
383
383
  * @throws Error if no data client has been configured
384
+ * @throws Error if a slug string is given and no matching doctype is found in the registry
384
385
  */
385
- async getRecord(doctype: Doctype, recordId: string): Promise<void> {
386
+ async getRecord(doctype: string | Doctype, recordId: string): Promise<void> {
386
387
  if (!this._client) {
387
388
  throw new Error(
388
389
  'No data client configured. Call setClient() with a DataClient implementation ' +
@@ -390,10 +391,15 @@ export class Stonecrop {
390
391
  )
391
392
  }
392
393
 
393
- const record = await this._client.getRecord(doctype, recordId)
394
+ const resolved = typeof doctype === 'string' ? this.registry.getDoctype(doctype) : doctype
395
+ if (!resolved) {
396
+ throw new Error(`Doctype not found: ${typeof doctype === 'string' ? doctype : doctype.slug}`)
397
+ }
398
+
399
+ const record = await this._client.getRecord(resolved, recordId)
394
400
 
395
401
  if (record) {
396
- this.addRecord(doctype, recordId, record)
402
+ this.addRecord(resolved, recordId, record)
397
403
  }
398
404
  }
399
405
 
@@ -485,7 +491,7 @@ export class Stonecrop {
485
491
  initialState =
486
492
  typeof (workflow as { initial?: unknown }).initial === 'string'
487
493
  ? (workflow as { initial: string }).initial
488
- : Object.keys(workflow.states ?? {})[0] ?? ''
494
+ : (Object.keys(workflow.states ?? {})[0] ?? '')
489
495
  }
490
496
 
491
497
  return status || initialState
package/src/stores/hst.ts CHANGED
@@ -590,7 +590,7 @@ class HSTProxy implements HSTNode {
590
590
 
591
591
  return Boolean(
592
592
  (hasGetMethod && hasSetMethod && hasHasMethod && hasImmutableMarkers) ||
593
- (hasGetMethod && hasSetMethod && isImmutableConstructor)
593
+ (hasGetMethod && hasSetMethod && isImmutableConstructor)
594
594
  )
595
595
  }
596
596