@hazem3500/palette 0.9.116 → 0.9.117

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/NODE.md CHANGED
@@ -257,4 +257,4 @@ project/repo/branch authentication and PAT `comments:read`; writes retain guest
257
257
  consent and author/reviewer checks and PAT `comments:write`. No token enablement
258
258
  policy changes are included.
259
259
 
260
- Proxy token operator allowances: `PALETTE_PROXY_TOKEN_ALL_PROJECTS=true` enables All your projects; `PALETTE_PROXY_TOKEN_NO_EXPIRY=true` enables Never expires. Both default to false and require `PALETTE_PROXY_ACCESS_TOKENS=true`. Their `KOMO_` aliases apply when the corresponding `PALETTE_` value is unset. Finite expiry remains capped at 365 days. All-project grants include current and future projects the account owns or has joined, checked on every use; removing membership removes access unless another ownership or membership grant remains. Disable an allowance to reject existing tokens using it, or revoke individual tokens when offboarding. Non-proxy token policy is unchanged.
260
+ Proxy token operator allowances: `PALETTE_PROXY_TOKEN_ALL_PROJECTS=true` enables All your projects; `PALETTE_PROXY_TOKEN_NO_EXPIRY=true` enables Never expires. Both default to false and require `PALETTE_PROXY_ACCESS_TOKENS=true`. Their `KOMO_` aliases apply when the corresponding `PALETTE_` value is unset. Finite expiry remains capped at 365 days. All-project grants include current and future projects the account owns, has explicit access to, or has joined while they remain public. Access is checked on every use; private projects require ownership or an active membership grant, so removing a private membership takes effect immediately. Disable an allowance to reject existing tokens using it, or revoke individual tokens when offboarding. Non-proxy token policy is unchanged.
package/README.md CHANGED
@@ -952,4 +952,4 @@ existing tokens remain usable. Nonproxy token policy is unchanged. Snapshot GET
952
952
  requires `comments:read`, the granted project and an allowed Origin. No deployment
953
953
  is enabled by this configuration example.
954
954
 
955
- Proxy token operator allowances: `PALETTE_PROXY_TOKEN_ALL_PROJECTS=true` enables All your projects; `PALETTE_PROXY_TOKEN_NO_EXPIRY=true` enables Never expires. Both default to false and require `PALETTE_PROXY_ACCESS_TOKENS=true`. Their `KOMO_` aliases apply when the corresponding `PALETTE_` value is unset. Finite expiry remains capped at 365 days. All-project grants include current and future projects the account owns or has joined, checked on every use; removing membership removes access unless another ownership or membership grant remains. Disable an allowance to reject existing tokens using it, or revoke individual tokens when offboarding. Non-proxy token policy is unchanged.
955
+ Proxy token operator allowances: `PALETTE_PROXY_TOKEN_ALL_PROJECTS=true` enables All your projects; `PALETTE_PROXY_TOKEN_NO_EXPIRY=true` enables Never expires. Both default to false and require `PALETTE_PROXY_ACCESS_TOKENS=true`. Their `KOMO_` aliases apply when the corresponding `PALETTE_` value is unset. Finite expiry remains capped at 365 days. All-project grants include current and future projects the account owns, has explicit access to, or has joined while they remain public. Access is checked on every use; private projects require ownership or an active membership grant, so removing a private membership takes effect immediately. Disable an allowance to reject existing tokens using it, or revoke individual tokens when offboarding. Non-proxy token policy is unchanged.
package/dist/node.mjs CHANGED
@@ -870,8 +870,8 @@ function auditStatement(env2, actor, action, target, detail) {
870
870
  var pruneAudit = (db2, now) => db2.prepare("DELETE FROM audit_log WHERE at<?").bind(now - AUDIT_RETENTION);
871
871
  async function accountProjects(env2, userId, activeMembership = false) {
872
872
  const rows = await env2.DB.prepare(
873
- `SELECT id AS project FROM workspaces WHERE owner_id=? UNION SELECT project FROM ${activeMembership ? "project_access" : "project_members"} WHERE user_id=? UNION SELECT project FROM project_owners WHERE user_id=?`
874
- ).bind(userId, userId, userId).all();
873
+ `SELECT id AS project FROM workspaces WHERE owner_id=? UNION SELECT project FROM ${activeMembership ? "project_access" : "project_members"} WHERE user_id=? UNION SELECT project FROM project_owners WHERE user_id=?${activeMembership ? " UNION SELECT m.project FROM project_members m WHERE m.user_id=? AND NOT EXISTS(SELECT 1 FROM project_settings s WHERE s.project=m.project AND s.access='private')" : ""}`
874
+ ).bind(userId, userId, userId, ...activeMembership ? [userId] : []).all();
875
875
  return rows.results.map((row) => row.project).sort();
876
876
  }
877
877
  var publicToken = (row, now) => ({
package/dist/server.js CHANGED
@@ -729,8 +729,8 @@ function auditStatement(env, actor, action, target, detail) {
729
729
  var pruneAudit = (db, now) => db.prepare("DELETE FROM audit_log WHERE at<?").bind(now - AUDIT_RETENTION);
730
730
  async function accountProjects(env, userId, activeMembership = false) {
731
731
  const rows = await env.DB.prepare(
732
- `SELECT id AS project FROM workspaces WHERE owner_id=? UNION SELECT project FROM ${activeMembership ? "project_access" : "project_members"} WHERE user_id=? UNION SELECT project FROM project_owners WHERE user_id=?`
733
- ).bind(userId, userId, userId).all();
732
+ `SELECT id AS project FROM workspaces WHERE owner_id=? UNION SELECT project FROM ${activeMembership ? "project_access" : "project_members"} WHERE user_id=? UNION SELECT project FROM project_owners WHERE user_id=?${activeMembership ? " UNION SELECT m.project FROM project_members m WHERE m.user_id=? AND NOT EXISTS(SELECT 1 FROM project_settings s WHERE s.project=m.project AND s.access='private')" : ""}`
733
+ ).bind(userId, userId, userId, ...activeMembership ? [userId] : []).all();
734
734
  return rows.results.map((row) => row.project).sort();
735
735
  }
736
736
  var publicToken = (row, now) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazem3500/palette",
3
- "version": "0.9.116",
3
+ "version": "0.9.117",
4
4
  "description": "Point, area, and threaded comments for website branches.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/server/tokens.ts CHANGED
@@ -101,9 +101,9 @@ export const pruneAudit = (db: D1Database, now: number) =>
101
101
  /** Projects an account holder may limit a token to: owned or joined. */
102
102
  export async function accountProjects(env: Env, userId: string, activeMembership = false) {
103
103
  const rows = await env.DB.prepare(
104
- `SELECT id AS project FROM workspaces WHERE owner_id=? UNION SELECT project FROM ${activeMembership ? "project_access" : "project_members"} WHERE user_id=? UNION SELECT project FROM project_owners WHERE user_id=?`
104
+ `SELECT id AS project FROM workspaces WHERE owner_id=? UNION SELECT project FROM ${activeMembership ? "project_access" : "project_members"} WHERE user_id=? UNION SELECT project FROM project_owners WHERE user_id=?${activeMembership ? " UNION SELECT m.project FROM project_members m WHERE m.user_id=? AND NOT EXISTS(SELECT 1 FROM project_settings s WHERE s.project=m.project AND s.access='private')" : ""}`
105
105
  )
106
- .bind(userId, userId, userId)
106
+ .bind(userId, userId, userId, ...(activeMembership ? [userId] : []))
107
107
  .all<{ project: string }>();
108
108
  return rows.results.map((row) => row.project).sort();
109
109
  }