@getstrata/core 0.5.81 → 0.5.83

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @getstrata/core changelog
2
2
 
3
+ ## 0.5.83
4
+
5
+ - `MEMBER_ABILITIES` includes `auth:tokens:delete` so Jetstream-style personal access token revoke works for members (`DELETE /auth/tokens/:id`). HTML `/account/tokens/:id/revoke` was already authenticated-only.
6
+ - `buildOtpauthUrl()` defaults the issuer through `appDisplayName()` (`APP_NAME`).
7
+
8
+ ## 0.5.82
9
+
10
+ - `MEMBER_ABILITIES` includes `organizations:create` so Jetstream-style extra teams work for members (HTML `POST /organizations` and JSON `POST /organizations`). `OrganizationPolicy.create` already allowed any authenticated user.
11
+
3
12
  ## 0.5.81
4
13
 
5
14
  - `@getstrata/core/auth/intendedUrlCookie` (`createIntendedUrlCookie`, `readIntendedUrl`, `clearIntendedUrlCookie`, `createIntendedUrlCookieFromRequest`). Fortify intended URL after HTML email verification: register with `redirect=` and Laravel `verified` HTML redirects stash `${APP_KEY_PREFIX}_intended` (`INTENDED_URL_COOKIE_NAME`, default `workhub_intended`; TTL `INTENDED_URL_TTL_SECONDS`, default 86400s). `GET /verify-email` honors and clears it.
package/README.md CHANGED
@@ -82,7 +82,7 @@ import type { Migration } from "@getstrata/core/database/migrations/types";
82
82
  Package name: **`@getstrata/core`** (npm org [`@getstrata`](https://www.npmjs.com/org/getstrata)).
83
83
 
84
84
  1. Add `NPM_TOKEN` to GitHub repository secrets.
85
- 2. Tag a release: `git tag v0.5.83 && git push origin v0.5.83`
85
+ 2. Tag a release: `git tag v0.5.84 && git push origin v0.5.84`
86
86
  3. [Release workflow](../../.github/workflows/release.yml) builds and runs `npm publish --access public`.
87
87
 
88
88
  Previously published as `@eyk-workhub/framework@0.1.0`, deprecated in favor of this package.
@@ -1,5 +1,5 @@
1
- declare const MEMBER_ABILITIES: readonly ["organizations:read", "projects:read", "projects:create", "tasks:read", "tasks:create", "comments:read", "comments:create", "attachments:read", "attachments:create", "auth:tokens:read", "auth:tokens:write"];
2
- declare const ADMIN_ABILITIES: readonly ["organizations:read", "projects:read", "projects:create", "tasks:read", "tasks:create", "comments:read", "comments:create", "attachments:read", "attachments:create", "auth:tokens:read", "auth:tokens:write", "organizations:create", "organizations:update", "organizations:delete", "projects:update", "projects:delete", "tasks:update", "tasks:delete", "comments:update", "comments:delete", "attachments:delete", "webhooks:read", "webhooks:write", "audit:read"];
1
+ declare const MEMBER_ABILITIES: readonly ["organizations:read", "organizations:create", "projects:read", "projects:create", "tasks:read", "tasks:create", "comments:read", "comments:create", "attachments:read", "attachments:create", "auth:tokens:read", "auth:tokens:write", "auth:tokens:delete"];
2
+ declare const ADMIN_ABILITIES: readonly ["organizations:read", "organizations:create", "projects:read", "projects:create", "tasks:read", "tasks:create", "comments:read", "comments:create", "attachments:read", "attachments:create", "auth:tokens:read", "auth:tokens:write", "auth:tokens:delete", "organizations:create", "organizations:update", "organizations:delete", "projects:update", "projects:delete", "tasks:update", "tasks:delete", "comments:update", "comments:delete", "attachments:delete", "webhooks:read", "webhooks:write", "audit:read"];
3
3
  declare const PLATFORM_ADMIN_ABILITIES: readonly ["*"];
4
4
  interface AbilityCatalog {
5
5
  member: readonly string[];
@@ -47,6 +47,7 @@ function resolveAuthUserDirectory(container) {
47
47
  // ../../src/core/auth/abilityCatalog.ts
48
48
  var MEMBER_ABILITIES = [
49
49
  "organizations:read",
50
+ "organizations:create",
50
51
  "projects:read",
51
52
  "projects:create",
52
53
  "tasks:read",
@@ -56,7 +57,8 @@ var MEMBER_ABILITIES = [
56
57
  "attachments:read",
57
58
  "attachments:create",
58
59
  "auth:tokens:read",
59
- "auth:tokens:write"
60
+ "auth:tokens:write",
61
+ "auth:tokens:delete"
60
62
  ];
61
63
  var ADMIN_ABILITIES = [
62
64
  ...MEMBER_ABILITIES,
@@ -1,6 +1,62 @@
1
1
  // @bun
2
2
  // ../../src/core/security/totp.ts
3
3
  import { createHmac, randomBytes } from "crypto";
4
+
5
+ // ../../src/core/runtime/appKeyPrefix.ts
6
+ function appKeyPrefix() {
7
+ return process.env.APP_KEY_PREFIX?.trim() || "workhub";
8
+ }
9
+ function appCookieName(kind) {
10
+ return `${appKeyPrefix()}_${kind}`;
11
+ }
12
+ function appDevSecret(kind) {
13
+ return `${appKeyPrefix()}-dev-${kind}`;
14
+ }
15
+ function namespacedRedisKey(kind) {
16
+ return `${appKeyPrefix()}:${kind}`;
17
+ }
18
+ function smtpEhloHost() {
19
+ const raw = process.env.MAIL_EHLO?.trim() || `${appKeyPrefix()}.local`;
20
+ const safe = raw.replace(/[^a-zA-Z0-9.-]/g, "");
21
+ return safe || "strata.local";
22
+ }
23
+ function siemEventType() {
24
+ return process.env.SIEM_EVENT_TYPE?.trim() || `${appKeyPrefix()}.audit`;
25
+ }
26
+ function appUserAgent() {
27
+ return process.env.APP_USER_AGENT?.trim() || appKeyPrefix();
28
+ }
29
+ function otelServiceName() {
30
+ return process.env.OTEL_SERVICE_NAME?.trim() || `${appKeyPrefix()}-api`;
31
+ }
32
+ function webhookSignatureHeader() {
33
+ return process.env.WEBHOOK_SIGNATURE_HEADER?.trim() || `x-${appKeyPrefix()}-signature`;
34
+ }
35
+ function appDisplayName() {
36
+ return process.env.APP_NAME?.trim() || "WorkHub";
37
+ }
38
+ function appEnv() {
39
+ return process.env.APP_ENV?.trim() || "local";
40
+ }
41
+ function appUrl() {
42
+ return (process.env.APP_URL?.trim() || "http://localhost:3000").replace(/\/$/, "");
43
+ }
44
+ function apiPrefix() {
45
+ const raw = process.env.API_PREFIX?.trim() || "/api/v1";
46
+ const withSlash = raw.startsWith("/") ? raw : `/${raw}`;
47
+ const trimmed = withSlash.replace(/\/+$/, "");
48
+ return trimmed || "/api/v1";
49
+ }
50
+ function sdkClientClassName() {
51
+ const override = process.env.APP_SDK_CLASS?.trim();
52
+ if (override && /^[A-Za-z_][A-Za-z0-9_]*$/.test(override)) {
53
+ return override;
54
+ }
55
+ const fromName = appDisplayName().replace(/[^A-Za-z0-9]/g, "");
56
+ return fromName ? `${fromName}Client` : "AppClient";
57
+ }
58
+
59
+ // ../../src/core/security/totp.ts
4
60
  function decodeBase32(input) {
5
61
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
6
62
  const normalized = input.replace(/=+$/u, "").toUpperCase();
@@ -35,7 +91,7 @@ function generateTotpSecret(byteLength = 20) {
35
91
  return encodeBase32(randomBytes(byteLength));
36
92
  }
37
93
  function buildOtpauthUrl(options) {
38
- const issuer = options.issuer?.trim() || process.env.APP_NAME?.trim() || "WorkHub";
94
+ const issuer = options.issuer?.trim() || appDisplayName();
39
95
  const label = `${issuer}:${options.account}`;
40
96
  const params = new URLSearchParams({
41
97
  secret: options.secret,
package/dist/index.js CHANGED
@@ -198,6 +198,7 @@ function resolveAuthUserDirectory(container) {
198
198
  // ../../src/core/auth/abilityCatalog.ts
199
199
  var MEMBER_ABILITIES = [
200
200
  "organizations:read",
201
+ "organizations:create",
201
202
  "projects:read",
202
203
  "projects:create",
203
204
  "tasks:read",
@@ -207,7 +208,8 @@ var MEMBER_ABILITIES = [
207
208
  "attachments:read",
208
209
  "attachments:create",
209
210
  "auth:tokens:read",
210
- "auth:tokens:write"
211
+ "auth:tokens:write",
212
+ "auth:tokens:delete"
211
213
  ];
212
214
  var ADMIN_ABILITIES = [
213
215
  ...MEMBER_ABILITIES,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/core",
3
- "version": "0.5.81",
3
+ "version": "0.5.83",
4
4
  "description": "Strata — Laravel-inspired Bun framework public API",
5
5
  "type": "module",
6
6
  "license": "MIT",