@tinycloud/node-sdk 2.6.1 → 2.6.2-beta.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/dist/core.js CHANGED
@@ -1844,7 +1844,8 @@ var _TinyCloudNode = class _TinyCloudNode {
1844
1844
  return operation ? [operation] : [];
1845
1845
  })
1846
1846
  );
1847
- return this.wasmBindings.invokeAny(grant?.session ?? session, entries, facts);
1847
+ const invocationSession = !grant || grant.provenance === "primary" ? session : grant.session;
1848
+ return this.wasmBindings.invokeAny(invocationSession, entries, facts);
1848
1849
  };
1849
1850
  this.explicitHost = config.host;
1850
1851
  this.config = {
@@ -4398,7 +4399,8 @@ var _TinyCloudNode = class _TinyCloudNode {
4398
4399
  const { subset, missing } = isCapabilitySubset(expandedEntries, granted);
4399
4400
  if (!subset) {
4400
4401
  const runtimeGrant = this.findGrantForOperations(
4401
- this.permissionEntriesToOperations(expandedEntries, session)
4402
+ this.permissionEntriesToOperations(expandedEntries, session),
4403
+ { excludePrimary: true }
4402
4404
  );
4403
4405
  if (runtimeGrant) {
4404
4406
  const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
@@ -4857,7 +4859,10 @@ var _TinyCloudNode = class _TinyCloudNode {
4857
4859
  path,
4858
4860
  action
4859
4861
  });
4860
- return grant?.session ?? fallback;
4862
+ if (!grant) {
4863
+ return fallback;
4864
+ }
4865
+ return grant.provenance === "primary" ? fallback : grant.session;
4861
4866
  }
4862
4867
  findGrantForOperations(operations, options) {
4863
4868
  if (operations.length === 0) {