@tinycloud/node-sdk 2.6.1 → 2.6.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/dist/core.cjs CHANGED
@@ -1859,7 +1859,8 @@ var _TinyCloudNode = class _TinyCloudNode {
1859
1859
  return operation ? [operation] : [];
1860
1860
  })
1861
1861
  );
1862
- return this.wasmBindings.invokeAny(grant?.session ?? session, entries, facts);
1862
+ const invocationSession = !grant || grant.provenance === "primary" ? session : grant.session;
1863
+ return this.wasmBindings.invokeAny(invocationSession, entries, facts);
1863
1864
  };
1864
1865
  this.explicitHost = config.host;
1865
1866
  this.config = {
@@ -4413,7 +4414,8 @@ var _TinyCloudNode = class _TinyCloudNode {
4413
4414
  const { subset, missing } = (0, import_sdk_core8.isCapabilitySubset)(expandedEntries, granted);
4414
4415
  if (!subset) {
4415
4416
  const runtimeGrant = this.findGrantForOperations(
4416
- this.permissionEntriesToOperations(expandedEntries, session)
4417
+ this.permissionEntriesToOperations(expandedEntries, session),
4418
+ { excludePrimary: true }
4417
4419
  );
4418
4420
  if (runtimeGrant) {
4419
4421
  const marginMs = _TinyCloudNode.SESSION_EXPIRY_SAFETY_MARGIN_MS;
@@ -4872,7 +4874,10 @@ var _TinyCloudNode = class _TinyCloudNode {
4872
4874
  path,
4873
4875
  action
4874
4876
  });
4875
- return grant?.session ?? fallback;
4877
+ if (!grant) {
4878
+ return fallback;
4879
+ }
4880
+ return grant.provenance === "primary" ? fallback : grant.session;
4876
4881
  }
4877
4882
  findGrantForOperations(operations, options) {
4878
4883
  if (operations.length === 0) {