@quantum-hub/qhub-service 1.4.0 → 1.6.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.
- package/README.md +39 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,45 @@ const logs = await client.api().getLogs({id: serviceExecution.id!})
|
|
|
43
43
|
await client.api().cancelExecution({id: serviceExecution.id!})
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## Data Pool Access Grants
|
|
47
|
+
|
|
48
|
+
Service executions that read from or write to data pools require a short-lived JWT grant.
|
|
49
|
+
The client can acquire these grants automatically by calling the Hub Platform API on your behalf.
|
|
50
|
+
|
|
51
|
+
Pass a `HubPlatformClient` (constructed with a personal access token as the `apiKey` parameter) to the `HubServiceClient`, then supply one or more `DataPoolGrant` entries via the `run()` options:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import {HubServiceClient, HubPlatformClient} from '@quantum-hub/qhub-service'
|
|
55
|
+
import {DataPoolPermission, type DataPoolGrant} from '@quantum-hub/qhub-service/datapool'
|
|
56
|
+
|
|
57
|
+
const platformClient = new HubPlatformClient({
|
|
58
|
+
apiKey: '...',
|
|
59
|
+
organizationId: '...',
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const client = new HubServiceClient(serviceEndpoint, accessKeyId, secretAccessKey, undefined, platformClient)
|
|
63
|
+
|
|
64
|
+
const grants: DataPoolGrant[] = [
|
|
65
|
+
{
|
|
66
|
+
name: 'input_data',
|
|
67
|
+
datapoolId: 'dp-abc123',
|
|
68
|
+
applicationId: 'app-xyz789',
|
|
69
|
+
permission: DataPoolPermission.VIEW,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'output_data',
|
|
73
|
+
datapoolId: 'dp-def456',
|
|
74
|
+
applicationId: 'app-xyz789',
|
|
75
|
+
permission: DataPoolPermission.MODIFY,
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
const serviceExecution = await client.run({shots: 100}, undefined, undefined, {grants})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For each grant, the client injects a `DataPoolReference` (with the issued JWT) into the request under the supplied `name`.
|
|
83
|
+
Grants are cached per `(datapoolId, applicationId, permission)` until shortly before the JWT expires.
|
|
84
|
+
|
|
46
85
|
## License
|
|
47
86
|
|
|
48
87
|
[Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) | Copyright 2026-now Kipu Quantum GmbH
|
|
49
|
-
|