@runlot/access 0.1.0-rc.73 → 0.1.0-rc.74

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/index.d.ts CHANGED
@@ -1,19 +1,21 @@
1
1
  export type AccessMode = "public" | "org" | "password" | "bypass";
2
2
  export type OrgRole = "admin" | "member" | "viewer";
3
3
  export interface Identity {
4
- /** front 가 판정한 모드. `public` 이면 나머지는 비어 있다. */
4
+ /** The mode the front decided. When it is `public`, the rest is empty. */
5
5
  mode: AccessMode;
6
- /** 사용자 id. `password` 모드는 `pw:…`, `bypass` 는 `bypass`. */
6
+ /** The user id. In `password` mode it is `pw:…`, in `bypass` it is
7
+ * `bypass`. */
7
8
  subject: string | null;
8
9
  email: string | null;
9
10
  orgRole: OrgRole | null;
10
11
  }
11
12
  /**
12
- * 요청의 신원. 헤더가 아예 없으면(front 밖에서 돈다 — 로컬 `wrangler dev` 류)
13
- * `public` 으로 읽는다: front 가 Mode 를 **항상** 붙이므로, 없는 것은 "판정이
14
- * 없었다" 이고 그것은 열린 것과 같다.
13
+ * The identity of the request. When the headers are absent entirely (running
14
+ * outside the front — local `wrangler dev` and the like) it reads as `public`:
15
+ * the front **always** attaches Mode, so its absence means "there was no
16
+ * decision", and that is the same as open.
15
17
  */
16
18
  export declare function identity(request: Request): Identity;
17
- /** 로그인이 있는가 — `public` 도 `bypass` 도 아닌 사람. */
19
+ /** Is there a login — somebody who is neither `public` nor `bypass`. */
18
20
  export declare function isSignedIn(who: Identity): boolean;
19
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,CAAC;AAClE,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,QAAQ;IACvB,8CAA8C;IAC9C,IAAI,EAAE,UAAU,CAAC;IACjB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAKD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,CAYnD;AAED,8CAA8C;AAC9C,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAEjD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,CAAC;AAClE,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,QAAQ;IACvB,0EAA0E;IAC1E,IAAI,EAAE,UAAU,CAAC;IACjB;oBACgB;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAKD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,CAYnD;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAEjD"}
package/dist/index.js CHANGED
@@ -1,19 +1,23 @@
1
- // `identity(request)` — front 가 붙인 신원을 읽는다 (docs/access.md §4.2).
1
+ // `identity(request)` — reads the identity the front attached
2
+ // (docs/access.md §4.2).
2
3
  //
3
- // `env.auth` 가 아니라 요청에서 읽는 이유는 취향이 아니라 제약이다: `env` 는
4
- // 워커 수명 동안 고정된 묶음이고 신원은 요청마다 다른 값이다. 요청에서 읽으면
5
- // 암묵 저장소(AsyncLocalStorage)가 스트리밍·waitUntil 경계에서 끊기는 문제가
6
- // 아예 없다.
4
+ // Reading it from the request rather than from `env.auth` is a constraint, not
5
+ // a taste: `env` is a bundle fixed for the lifetime of the worker, and the
6
+ // identity is a different value on every request. Reading it from the request
7
+ // means the problem of an implicit store (AsyncLocalStorage) being cut at a
8
+ // streaming or waitUntil boundary does not exist at all.
7
9
  //
8
- // 헤더는 front 가 인바운드 `Runlot-*` 를 전부 지운 뒤 붙이므로 위조가 안 된다
9
- // (proto/front-headers.md). 이 함수는 그것을 **믿는다** — 워커가 front 를 지나지
10
- // 않고 직접 열리는 배치는 없다.
10
+ // The headers cannot be forged, because the front attaches them after erasing
11
+ // every inbound `Runlot-*` (proto/front-headers.md). This function **trusts**
12
+ // that — there is no deployment where a worker is opened directly without
13
+ // passing through the front.
11
14
  const MODES = new Set(["public", "org", "password", "bypass"]);
12
15
  const ROLES = new Set(["admin", "member", "viewer"]);
13
16
  /**
14
- * 요청의 신원. 헤더가 아예 없으면(front 밖에서 돈다 — 로컬 `wrangler dev` 류)
15
- * `public` 으로 읽는다: front 가 Mode 를 **항상** 붙이므로, 없는 것은 "판정이
16
- * 없었다" 이고 그것은 열린 것과 같다.
17
+ * The identity of the request. When the headers are absent entirely (running
18
+ * outside the front — local `wrangler dev` and the like) it reads as `public`:
19
+ * the front **always** attaches Mode, so its absence means "there was no
20
+ * decision", and that is the same as open.
17
21
  */
18
22
  export function identity(request) {
19
23
  const h = request.headers;
@@ -29,7 +33,7 @@ export function identity(request) {
29
33
  orgRole: rawRole !== null && ROLES.has(rawRole) ? rawRole : null,
30
34
  };
31
35
  }
32
- /** 로그인이 있는가 — `public` 도 `bypass` 도 아닌 사람. */
36
+ /** Is there a login — somebody who is neither `public` nor `bypass`. */
33
37
  export function isSignedIn(who) {
34
38
  return who.mode === "org";
35
39
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names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,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAmB,CAAC,CAAC,CAAC,IAAI;KAC9E,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,GAAa;IACtC,OAAO,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runlot/access",
3
- "version": "0.1.0-rc.73",
3
+ "version": "0.1.0-rc.74",
4
4
  "description": "Reads the access identity (Runlot-Access-* headers) that Runlot attaches to a request",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -26,7 +26,7 @@
26
26
  "@types/node": "^22.10.2",
27
27
  "esbuild": "^0.24.2",
28
28
  "typescript": "^5.7.2",
29
- "@runlot/config": "0.1.0-rc.73"
29
+ "@runlot/config": "0.1.0-rc.74"
30
30
  },
31
31
  "scripts": {
32
32
  "test": "node build.mjs",