@getstrata/bootstrap 0.2.55 → 0.2.57

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,13 @@
1
1
  # @getstrata/bootstrap changelog
2
2
 
3
+ ## 0.2.57
4
+
5
+ - Peer `@getstrata/core` `^0.5.70` for optional OAuth `redirectUri`.
6
+
7
+ ## 0.2.56
8
+
9
+ - Peer `@getstrata/core` `^0.5.69` for `MembershipLookup.updateMemberRole`.
10
+
3
11
  ## 0.2.55
4
12
 
5
13
  - HttpKernel and route builders read `isViewsEnabled` / `isSpaEnabled` from `@getstrata/core/runtime/frontendMode` instead of WorkHub `src/config/frontend`.
package/README.md CHANGED
@@ -30,7 +30,7 @@ import { createHttpKernel, createAppContext, coreProviders } from "@getstrata/bo
30
30
 
31
31
  `createAppContext()` does not call `assertProductionSecrets`. WorkHub calls that from `App.serve()` / `queue:work`. Sibling HTMX apps can call it in production without WorkHub API tokens when feature flags are off — see [SIBLING-HTMX.md](../../docs/SIBLING-HTMX.md).
32
32
 
33
- Sibling HTMX apps should bind `createCookieSessionAuthManager` from `@getstrata/bootstrap/web/session` instead of HMAC `SessionGuard`. Use `signIn` / `signOut` (or the redirect helpers) instead of calling `CookieSessionStore` from controllers. Pass `mapUser` to map roles in the app. Pass `loadSessionUser` when the default `learn_subscriber` / `is_admin` SELECT does not match your schema.
33
+ Sibling HTMX apps should bind `createCookieSessionAuthManager` from `@getstrata/bootstrap/web/session` instead of HMAC `SessionGuard`. Use `signIn` / `signOut` (or the redirect helpers) instead of calling `CookieSessionStore` from controllers. Pass `mapUser` to map roles in the app. Pass `loadSessionUser` when the default `learn_subscriber` / `is_admin` SELECT does not match your schema. WorkHub’s table is `sessions` (`0031_create_sessions`); its loader is `loadWorkhubSessionUser` (maps `users.role`, decrypts email). WorkHub web login itself stays on HMAC `SessionGuard`.
34
34
 
35
35
  `wrapWeb` applies the web group (CSRF + flash) and `withErrorHandling`, so CSRF `ForbiddenError` becomes an HTML 403 in `FRONTEND_MODE=server-htmx`. `wrapWebLogin` / `wrapWebRegister` include that web group plus throttle — do not wrap them with `wrapWeb` again.
36
36
 
@@ -743,7 +743,7 @@ function assertScimIfMatch(request, etagSource) {
743
743
  // ../../src/modules/scim/service.ts
744
744
  import { hashPassword as hashPassword3 } from "@getstrata/core/auth/password";
745
745
  import { resolveService } from "@getstrata/core/contracts/di";
746
- import { NotFoundError as NotFoundError4 } from "@getstrata/core/errors/http";
746
+ import { NotFoundError as NotFoundError5 } from "@getstrata/core/errors/http";
747
747
  import { currentTenantId as currentTenantId4 } from "@getstrata/core/tenant/tenantContext";
748
748
 
749
749
  // ../../src/domain/scim.ts
@@ -755,6 +755,9 @@ var SCIM_SCHEMAS = {
755
755
  serviceProviderConfig: "urn:ietf:params:scim:schemas:core:2.0:ServiceProviderConfig"
756
756
  };
757
757
 
758
+ // ../../src/modules/organization/memberRepository.ts
759
+ import { NotFoundError } from "@getstrata/core/errors/http";
760
+
758
761
  // ../../src/config/database.ts
759
762
  function readInteger(name, fallback) {
760
763
  const parsed = Number.parseInt(process.env[name] ?? String(fallback), 10);
@@ -912,6 +915,19 @@ class OrganizationMemberRepository {
912
915
  }
913
916
  return row;
914
917
  }
918
+ async updateMemberRole(organizationId, userId, role) {
919
+ const rows = await connection_default`
920
+ UPDATE organization_member
921
+ SET role = ${role}
922
+ WHERE organization_id = ${organizationId} AND user_id = ${userId}
923
+ RETURNING id, organization_id, user_id, role, created_at
924
+ `;
925
+ const row = rows[0];
926
+ if (!row) {
927
+ throw new NotFoundError(`Organization member ${userId} not found.`);
928
+ }
929
+ return row;
930
+ }
915
931
  async removeMember(organizationId, userId) {
916
932
  const rows = await connection_default`
917
933
  DELETE FROM organization_member
@@ -925,7 +941,7 @@ var memberRepository_default = OrganizationMemberRepository;
925
941
 
926
942
  // ../../src/modules/organization/repository.ts
927
943
  import { BaseRepository } from "@getstrata/core/database/baseRepository";
928
- import { NotFoundError } from "@getstrata/core/errors/http";
944
+ import { NotFoundError as NotFoundError2 } from "@getstrata/core/errors/http";
929
945
  import { currentTenantId } from "@getstrata/core/tenant/tenantContext";
930
946
 
931
947
  // ../../src/modules/organization/table.ts
@@ -964,7 +980,7 @@ class OrganizationRepository extends BaseRepository {
964
980
  async findForTenantOrThrow(id, tenantId = currentTenantId()) {
965
981
  const organization = await this.findById(id);
966
982
  if (!organization || organization.tenant_id !== tenantId) {
967
- throw new NotFoundError(`SCIM group ${id} not found.`);
983
+ throw new NotFoundError2(`SCIM group ${id} not found.`);
968
984
  }
969
985
  return organization;
970
986
  }
@@ -1054,7 +1070,7 @@ var notificationTable = defineTable3({
1054
1070
  });
1055
1071
 
1056
1072
  // ../../src/modules/user/notificationService.ts
1057
- import { NotFoundError as NotFoundError2 } from "@getstrata/core/errors/http";
1073
+ import { NotFoundError as NotFoundError3 } from "@getstrata/core/errors/http";
1058
1074
 
1059
1075
  // ../../src/modules/user/oauthIdentityRepository.ts
1060
1076
  import { BaseRepository as BaseRepository4 } from "@getstrata/core/database/baseRepository";
@@ -1112,7 +1128,7 @@ var userTable = defineTable5({
1112
1128
 
1113
1129
  // ../../src/modules/user/tokenService.ts
1114
1130
  import { hashApiToken as hashApiToken2 } from "@getstrata/core/auth/tokenHash";
1115
- import { ForbiddenError, NotFoundError as NotFoundError3 } from "@getstrata/core/errors/http";
1131
+ import { ForbiddenError, NotFoundError as NotFoundError4 } from "@getstrata/core/errors/http";
1116
1132
  import { resolveDefaultTokenExpiryDays as resolveDefaultTokenExpiryDays2 } from "@getstrata/core/security/tokenExpiry";
1117
1133
 
1118
1134
  // ../../src/modules/user/provider.ts
@@ -1170,7 +1186,7 @@ class ScimService {
1170
1186
  async findUserRecord(id) {
1171
1187
  const user = await this.users.findById(id);
1172
1188
  if (!user || user.tenant_id !== currentTenantId4()) {
1173
- throw new NotFoundError4(`SCIM user ${id} not found.`);
1189
+ throw new NotFoundError5(`SCIM user ${id} not found.`);
1174
1190
  }
1175
1191
  return user;
1176
1192
  }
@@ -1212,7 +1228,7 @@ class ScimService {
1212
1228
  const user = await this.findUserRecord(id);
1213
1229
  const deleted = await this.users.deleteById(id);
1214
1230
  if (!deleted) {
1215
- throw new NotFoundError4(`SCIM user ${id} not found.`);
1231
+ throw new NotFoundError5(`SCIM user ${id} not found.`);
1216
1232
  }
1217
1233
  return { id: user.id, updated_at: user.updated_at };
1218
1234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/bootstrap",
3
- "version": "0.2.55",
3
+ "version": "0.2.57",
4
4
  "description": "Strata application bootstrap — HttpKernel, DI, web session helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -180,7 +180,7 @@
180
180
  "access": "public"
181
181
  },
182
182
  "peerDependencies": {
183
- "@getstrata/core": "^0.5.68",
183
+ "@getstrata/core": "^0.5.70",
184
184
  "typescript": "^5.9.0"
185
185
  }
186
186
  }