@hyperscale0/sdk 3.1.0 → 3.2.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/README.md CHANGED
@@ -1,25 +1,74 @@
1
1
  # @hyperscale0/sdk
2
2
 
3
3
  One client for every Hyperscale Product. Platform types ship with the package.
4
- Instrument fields and public action inputs come from the admitted Build at runtime.
4
+ Object kinds, fields and action availability come from the admitted Build at runtime.
5
5
 
6
6
  ```js
7
7
  import { createClient } from "@hyperscale0/sdk";
8
8
 
9
+ const productId = process.env.HYPERSCALE_PRODUCT_ID;
9
10
  const client = createClient({
10
11
  apiKey: process.env.HYPERSCALE_API_KEY,
11
- productId: process.env.HYPERSCALE_PRODUCT_ID,
12
+ productId,
12
13
  });
13
- const { instruments, actions } = await client.discover();
14
+ const discovery = await client.call("product.objects.discover", { productId });
15
+ // Choose a kind and supply metadata according to its createSchema.
16
+ const kind = discovery.kinds[0].kind;
17
+ const object = await client.call(
18
+ "product.objects.create",
19
+ { productId, kind },
20
+ {
21
+ idempotencyKey: "object-create-001",
22
+ },
23
+ );
24
+ const available = await client.call("product.objects.actions", {
25
+ productId,
26
+ kind,
27
+ objectId: object.objectId,
28
+ });
29
+ ```
30
+
31
+ Choose the intended action by name. Check `availability.status` and collect its
32
+ `requiredNow` fields and requirements against `fieldsSchema` and `inputSchema`.
33
+ After that review, execute it with the complete context returned by the server:
34
+
35
+ ```js
36
+ const action = available.actions.find((item) => item.name === chosenActionName);
37
+ if (!action || action.availability.status !== "available") {
38
+ throw new Error("The selected action is unavailable");
39
+ }
40
+ const result = await client.call(
41
+ "product.objects.execute",
42
+ {
43
+ productId,
44
+ kind,
45
+ objectId: object.objectId,
46
+ action: action.name,
47
+ expectedRevision: available.revision,
48
+ productBuildId: action.productBuildId,
49
+ digest: action.digest,
50
+ target: action.target,
51
+ fields: collectedFields,
52
+ input: collectedInput,
53
+ },
54
+ { idempotencyKey: "object-action-001" },
55
+ );
14
56
  ```
15
57
 
16
- Use `client.call(operationName, input, { idempotencyKey })` for platform operations.
17
- Their names and types match the operation descriptors.
58
+ `chosenActionName`, `collectedFields` and `collectedInput` are application inputs
59
+ from that review. Object creation does not create an agreement or move money.
60
+ Use `product.objects.list` and `product.objects.retrieve` to read stored objects.
61
+ These six operations use the descriptor-backed generic operation transport in
62
+ `client.call`. Names and types match the operation descriptors.
63
+
64
+ Copy the whole target, including `instanceId` when present. Refresh availability
65
+ after a revision or Build conflict. Reuse the same key and body for an uncertain
66
+ request. The client never retries a mutation automatically.
18
67
 
19
- Call `client.act(name, input, { idempotencyKey })` with an action name and input
20
- from discovery. Reuse the same idempotency key and input when retrying a request.
21
- The client never retries a mutation automatically. Keys stay in your environment.
22
- Set `baseUrl` and `environment` to select an estate and sandbox or live plane.
68
+ Low-level `instruments()`, `actions()` and `act()` remain for admitted inspection
69
+ and operations. Instrument creation stays internal to object attachment execution.
70
+ Keys stay in your environment. Set `baseUrl` and `environment` to select an estate
71
+ and sandbox or live plane.
23
72
 
24
73
  Security: https://hyperscale0.ai/security
25
74
 
package/client.d.ts CHANGED
@@ -8,7 +8,7 @@ export type * from "./platform.js";
8
8
  import type {
9
9
  sandbox_rehearsal_createOutput,
10
10
  payment_reminder_delivery_retrieveOutput,
11
- } from "../../generated/sdk/tenant_portal.ts";
11
+ } from "./portal.js";
12
12
 
13
13
  export interface ClientOptions {
14
14
  apiKey?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperscale0/sdk",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "LicenseRef-Hyperscale-Proprietary",
@@ -22,5 +22,5 @@
22
22
  "publishConfig": {
23
23
  "access": "public"
24
24
  },
25
- "gitHead": "1ffed3f20362cb9e934d527f1df3e9d35585347c"
25
+ "gitHead": "3b813081ba55675872e8d00fe853549a0ffe174d"
26
26
  }