githolon 0.36.0 → 0.38.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +8 -1
  2. package/package.json +3 -3
package/dist/cli.mjs CHANGED
@@ -746,7 +746,14 @@ function setDeviceKey(principal, key) {
746
746
  saveCreds(c);
747
747
  }
748
748
  function principalHeaders(principal) {
749
- return /^[\w-]+\.[\w-]+\.[\w-]+$/.test(principal) ? { "x-nomos-auth": principal } : { "x-nomos-principal": principal };
749
+ if (!/^[\w-]+\.[\w-]+\.[\w-]+$/.test(principal)) return { "x-nomos-principal": principal };
750
+ const headers = { "x-nomos-auth": principal };
751
+ try {
752
+ const payload = JSON.parse(Buffer.from(principal.split(".")[1], "base64url").toString("utf8"));
753
+ if (typeof payload.sub === "string" && payload.sub) headers["x-nomos-principal"] = payload.sub;
754
+ } catch {
755
+ }
756
+ return headers;
750
757
  }
751
758
  function sessionFromGotrue(d) {
752
759
  if (typeof d.access_token !== "string" || typeof d.refresh_token !== "string") return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "githolon",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "type": "module",
5
5
  "description": "githolon — the Nomos developer CLI: Rails-style generators for @githolon/dsl domains + the package compiler. Kernel-independent.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@bjorn3/browser_wasi_shim": "0.4.2",
32
- "@githolon/client": "^0.36.0",
33
- "@githolon/dsl": "^0.36.0",
32
+ "@githolon/client": "^0.38.0",
33
+ "@githolon/dsl": "^0.38.0",
34
34
  "isomorphic-git": "^1.38.4"
35
35
  },
36
36
  "devDependencies": {