@milaboratories/pl-client 2.9.3 → 2.10.1

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": "@milaboratories/pl-client",
3
- "version": "2.9.3",
3
+ "version": "2.10.1",
4
4
  "engines": {
5
5
  "node": ">=20.3.0"
6
6
  },
@@ -32,12 +32,12 @@
32
32
  "undici": "~7.5.0",
33
33
  "utility-types": "^3.11.0",
34
34
  "yaml": "^2.7.0",
35
- "@milaboratories/ts-helpers": "^1.3.1",
36
- "@milaboratories/pl-http": "^1.1.2"
35
+ "@milaboratories/pl-http": "^1.1.2",
36
+ "@milaboratories/ts-helpers": "^1.3.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "typescript": "~5.5.4",
40
- "vite": "^5.4.11",
40
+ "vite": "^6.3.5",
41
41
  "@types/node": "~20.16.15",
42
42
  "@protobuf-ts/plugin": "2.9.6",
43
43
  "@types/http-proxy": "^1.17.16",
@@ -0,0 +1,10 @@
1
+ import type { ResourceType } from './types';
2
+
3
+ export type ErrorResourceData = {
4
+ message: string;
5
+ };
6
+
7
+ export const ErrorResourceType: ResourceType = {
8
+ name: 'json/resourceError',
9
+ version: '1',
10
+ };
@@ -36,6 +36,8 @@ import type { LRUCache } from 'lru-cache';
36
36
  import type { ResourceDataCacheRecord } from './cache';
37
37
  import type { TxStat } from './stat';
38
38
  import { initialTxStat } from './stat';
39
+ import type { ErrorResourceData } from './error_resource';
40
+ import { ErrorResourceType } from './error_resource';
39
41
 
40
42
  /** Reference to resource, used only within transaction */
41
43
  export interface ResourceRef {
@@ -440,6 +442,10 @@ export class PlTransaction {
440
442
  );
441
443
  }
442
444
 
445
+ public createError(message: string): ResourceRef {
446
+ return this.createValue(ErrorResourceType, JSON.stringify({ message } satisfies ErrorResourceData));
447
+ }
448
+
443
449
  public setResourceName(name: string, rId: AnyResourceRef): void {
444
450
  this.sendVoidAsync({
445
451
  oneofKind: 'resourceNameSet',
@@ -630,6 +636,13 @@ export class PlTransaction {
630
636
  this.lockOutputs(rID);
631
637
  }
632
638
 
639
+ public setResourceError(rId: AnyResourceRef, ref: AnyResourceRef): void {
640
+ this.sendVoidAsync({
641
+ oneofKind: 'resourceSetError',
642
+ resourceSetError: { resourceId: toResourceId(rId), errorResourceId: toResourceId(ref) },
643
+ });
644
+ }
645
+
633
646
  //
634
647
  // Fields
635
648
  //