@getstrata/bootstrap 0.2.63 → 0.2.65

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.65
4
+
5
+ - App listener discovery reads `src/listeners` from `process.cwd()` so a built `@getstrata/bootstrap` bundle still finds WorkHub registrars (`import.meta.dir` after `build:bootstrap` is the package dist). Listener boot calls each registrar every time (registrars are idempotent per `eventBus`).
6
+
7
+ ## 0.2.64
8
+
9
+ - `registerDefaultJobs()` no longer registers WorkHub `webhook.dispatch`. Apps that dispatch model webhooks should call `registerWebhookJobs()` (WorkHub’s webhook provider and `queue:work` do).
10
+
3
11
  ## 0.2.63
4
12
 
5
13
  - `HttpKernel.wrapWebGuest()` `home` accepts `string | ((user) => string | Promise<string>)` so signed-in guest redirects can follow the current team. Default remains `/organizations`.
package/README.md CHANGED
@@ -34,6 +34,8 @@ Sibling HTMX apps should bind `createCookieSessionAuthManager` from `@getstrata/
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`. `wrapWebGuest` is Laravel `guest` / `RedirectIfAuthenticated` (signed-in users go to `/organizations` by default; pass a string or `(user) => path` to override). `wrapWebLogin` / `wrapWebRegister` include that web group plus throttle — do not wrap them with `wrapWeb` again. The throttle callback should return an HTML form at 429 (WorkHub’s `/login` and `/register` do).
36
36
 
37
+ `registerDefaultJobs()` registers `cache.invalidate-tags` and `audit.export` only. WorkHub webhook dispatch is `registerWebhookJobs()` in the app webhook provider.
38
+
37
39
  These subpaths remain WorkHub-oriented and are not a generic starter API: `@getstrata/bootstrap/createRoutes` (includes SCIM), `@getstrata/bootstrap/schedule`, and `@getstrata/bootstrap/createWebRoutes` (redirects `/` to `/organizations`).
38
40
 
39
41
  See the [strata](https://github.com/EyK-26/strata) monorepo reference app for full module patterns.
@@ -329,14 +329,21 @@ var eventsProvider = {
329
329
  var events_default = eventsProvider;
330
330
 
331
331
  // ../../src/bootstrap/discoverListeners.ts
332
- import { readdirSync as readdirSync2 } from "fs";
332
+ import { existsSync, readdirSync as readdirSync2 } from "fs";
333
333
  import { join as join2 } from "path";
334
334
  import { pathToFileURL as pathToFileURL2 } from "url";
335
+ function resolveListenersDirectory() {
336
+ const fromCwd = join2(process.cwd(), "src", "listeners");
337
+ if (existsSync(fromCwd)) {
338
+ return fromCwd;
339
+ }
340
+ return join2(import.meta.dir, "../listeners");
341
+ }
335
342
  async function loadDiscoveredListeners() {
336
- const listenersDirectory = join2(import.meta.dir, "../listeners");
343
+ const listenersDirectory = resolveListenersDirectory();
337
344
  let entries;
338
345
  try {
339
- entries = readdirSync2(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".ts")).map((entry) => entry.name);
346
+ entries = readdirSync2(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && /\.(ts|js)$/.test(entry.name)).map((entry) => entry.name);
340
347
  } catch (error) {
341
348
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
342
349
  return [];
@@ -412,8 +419,8 @@ var listenersProvider = {
412
419
  registerListenerGroup("cache.invalidate-on-model-write", () => {
413
420
  registerInvalidateCacheOnModelWriteListeners();
414
421
  });
415
- for (const [index, registerListener] of discoverListeners().entries()) {
416
- registerListenerGroup(`app.listener.${index}`, registerListener);
422
+ for (const registerListener of discoverListeners()) {
423
+ registerListener();
417
424
  }
418
425
  }
419
426
  };
@@ -437,7 +444,6 @@ import {
437
444
  } from "@getstrata/core/queue/createAppQueue";
438
445
 
439
446
  // ../../src/bootstrap/queue/defaultJobs.ts
440
- import { DispatchWebhookJob } from "@getstrata/core/jobs/dispatchWebhookJob";
441
447
  import { ExportAuditLogsJob } from "@getstrata/core/jobs/exportAuditLogsJob";
442
448
  import { InvalidateCacheTagsJob as InvalidateCacheTagsJob2 } from "@getstrata/core/jobs/invalidateCacheTagsJob";
443
449
  import { jobRegistry } from "@getstrata/core/queue/jobRegistry";
@@ -446,7 +452,6 @@ function registerDefaultJobs() {
446
452
  jobRegistry.register("cache.invalidate-tags", () => {
447
453
  return new InvalidateCacheTagsJob2(resolveApplicationCache2());
448
454
  });
449
- jobRegistry.register("webhook.dispatch", () => new DispatchWebhookJob);
450
455
  jobRegistry.register("audit.export", () => new ExportAuditLogsJob);
451
456
  }
452
457
 
@@ -329,14 +329,21 @@ var eventsProvider = {
329
329
  var events_default = eventsProvider;
330
330
 
331
331
  // ../../src/bootstrap/discoverListeners.ts
332
- import { readdirSync as readdirSync2 } from "fs";
332
+ import { existsSync, readdirSync as readdirSync2 } from "fs";
333
333
  import { join as join2 } from "path";
334
334
  import { pathToFileURL as pathToFileURL2 } from "url";
335
+ function resolveListenersDirectory() {
336
+ const fromCwd = join2(process.cwd(), "src", "listeners");
337
+ if (existsSync(fromCwd)) {
338
+ return fromCwd;
339
+ }
340
+ return join2(import.meta.dir, "../listeners");
341
+ }
335
342
  async function loadDiscoveredListeners() {
336
- const listenersDirectory = join2(import.meta.dir, "../listeners");
343
+ const listenersDirectory = resolveListenersDirectory();
337
344
  let entries;
338
345
  try {
339
- entries = readdirSync2(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".ts")).map((entry) => entry.name);
346
+ entries = readdirSync2(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && /\.(ts|js)$/.test(entry.name)).map((entry) => entry.name);
340
347
  } catch (error) {
341
348
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
342
349
  return [];
@@ -412,8 +419,8 @@ var listenersProvider = {
412
419
  registerListenerGroup("cache.invalidate-on-model-write", () => {
413
420
  registerInvalidateCacheOnModelWriteListeners();
414
421
  });
415
- for (const [index, registerListener] of discoverListeners().entries()) {
416
- registerListenerGroup(`app.listener.${index}`, registerListener);
422
+ for (const registerListener of discoverListeners()) {
423
+ registerListener();
417
424
  }
418
425
  }
419
426
  };
@@ -437,7 +444,6 @@ import {
437
444
  } from "@getstrata/core/queue/createAppQueue";
438
445
 
439
446
  // ../../src/bootstrap/queue/defaultJobs.ts
440
- import { DispatchWebhookJob } from "@getstrata/core/jobs/dispatchWebhookJob";
441
447
  import { ExportAuditLogsJob } from "@getstrata/core/jobs/exportAuditLogsJob";
442
448
  import { InvalidateCacheTagsJob as InvalidateCacheTagsJob2 } from "@getstrata/core/jobs/invalidateCacheTagsJob";
443
449
  import { jobRegistry } from "@getstrata/core/queue/jobRegistry";
@@ -446,7 +452,6 @@ function registerDefaultJobs() {
446
452
  jobRegistry.register("cache.invalidate-tags", () => {
447
453
  return new InvalidateCacheTagsJob2(resolveApplicationCache2());
448
454
  });
449
- jobRegistry.register("webhook.dispatch", () => new DispatchWebhookJob);
450
455
  jobRegistry.register("audit.export", () => new ExportAuditLogsJob);
451
456
  }
452
457
 
@@ -240,14 +240,21 @@ var eventsProvider = {
240
240
  var events_default = eventsProvider;
241
241
 
242
242
  // ../../src/bootstrap/discoverListeners.ts
243
- import { readdirSync } from "fs";
243
+ import { existsSync, readdirSync } from "fs";
244
244
  import { join } from "path";
245
245
  import { pathToFileURL } from "url";
246
+ function resolveListenersDirectory() {
247
+ const fromCwd = join(process.cwd(), "src", "listeners");
248
+ if (existsSync(fromCwd)) {
249
+ return fromCwd;
250
+ }
251
+ return join(import.meta.dir, "../listeners");
252
+ }
246
253
  async function loadDiscoveredListeners() {
247
- const listenersDirectory = join(import.meta.dir, "../listeners");
254
+ const listenersDirectory = resolveListenersDirectory();
248
255
  let entries;
249
256
  try {
250
- entries = readdirSync(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".ts")).map((entry) => entry.name);
257
+ entries = readdirSync(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && /\.(ts|js)$/.test(entry.name)).map((entry) => entry.name);
251
258
  } catch (error) {
252
259
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
253
260
  return [];
@@ -402,8 +409,8 @@ var listenersProvider = {
402
409
  registerListenerGroup("cache.invalidate-on-model-write", () => {
403
410
  registerInvalidateCacheOnModelWriteListeners();
404
411
  });
405
- for (const [index, registerListener] of discoverListeners().entries()) {
406
- registerListenerGroup(`app.listener.${index}`, registerListener);
412
+ for (const registerListener of discoverListeners()) {
413
+ registerListener();
407
414
  }
408
415
  }
409
416
  };
@@ -427,7 +434,6 @@ import {
427
434
  } from "@getstrata/core/queue/createAppQueue";
428
435
 
429
436
  // ../../src/bootstrap/queue/defaultJobs.ts
430
- import { DispatchWebhookJob } from "@getstrata/core/jobs/dispatchWebhookJob";
431
437
  import { ExportAuditLogsJob } from "@getstrata/core/jobs/exportAuditLogsJob";
432
438
  import { InvalidateCacheTagsJob as InvalidateCacheTagsJob2 } from "@getstrata/core/jobs/invalidateCacheTagsJob";
433
439
  import { jobRegistry } from "@getstrata/core/queue/jobRegistry";
@@ -436,7 +442,6 @@ function registerDefaultJobs() {
436
442
  jobRegistry.register("cache.invalidate-tags", () => {
437
443
  return new InvalidateCacheTagsJob2(resolveApplicationCache2());
438
444
  });
439
- jobRegistry.register("webhook.dispatch", () => new DispatchWebhookJob);
440
445
  jobRegistry.register("audit.export", () => new ExportAuditLogsJob);
441
446
  }
442
447
 
@@ -2,7 +2,6 @@
2
2
  var __jsonParse = (a) => JSON.parse(a);
3
3
 
4
4
  // ../../src/bootstrap/queue/defaultJobs.ts
5
- import { DispatchWebhookJob } from "@getstrata/core/jobs/dispatchWebhookJob";
6
5
  import { ExportAuditLogsJob } from "@getstrata/core/jobs/exportAuditLogsJob";
7
6
  import { InvalidateCacheTagsJob } from "@getstrata/core/jobs/invalidateCacheTagsJob";
8
7
  import { jobRegistry } from "@getstrata/core/queue/jobRegistry";
@@ -11,7 +10,6 @@ function registerDefaultJobs() {
11
10
  jobRegistry.register("cache.invalidate-tags", () => {
12
11
  return new InvalidateCacheTagsJob(resolveApplicationCache());
13
12
  });
14
- jobRegistry.register("webhook.dispatch", () => new DispatchWebhookJob);
15
13
  jobRegistry.register("audit.export", () => new ExportAuditLogsJob);
16
14
  }
17
15
  export {
package/dist/index.js CHANGED
@@ -734,14 +734,21 @@ var eventsProvider = {
734
734
  var events_default = eventsProvider;
735
735
 
736
736
  // ../../src/bootstrap/discoverListeners.ts
737
- import { readdirSync as readdirSync2 } from "fs";
737
+ import { existsSync, readdirSync as readdirSync2 } from "fs";
738
738
  import { join as join2 } from "path";
739
739
  import { pathToFileURL as pathToFileURL2 } from "url";
740
+ function resolveListenersDirectory() {
741
+ const fromCwd = join2(process.cwd(), "src", "listeners");
742
+ if (existsSync(fromCwd)) {
743
+ return fromCwd;
744
+ }
745
+ return join2(import.meta.dir, "../listeners");
746
+ }
740
747
  async function loadDiscoveredListeners() {
741
- const listenersDirectory = join2(import.meta.dir, "../listeners");
748
+ const listenersDirectory = resolveListenersDirectory();
742
749
  let entries;
743
750
  try {
744
- entries = readdirSync2(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".ts")).map((entry) => entry.name);
751
+ entries = readdirSync2(listenersDirectory, { withFileTypes: true }).filter((entry) => entry.isFile() && /\.(ts|js)$/.test(entry.name)).map((entry) => entry.name);
745
752
  } catch (error) {
746
753
  if (error instanceof Error && "code" in error && error.code === "ENOENT") {
747
754
  return [];
@@ -803,8 +810,8 @@ var listenersProvider = {
803
810
  registerListenerGroup("cache.invalidate-on-model-write", () => {
804
811
  registerInvalidateCacheOnModelWriteListeners();
805
812
  });
806
- for (const [index, registerListener] of discoverListeners().entries()) {
807
- registerListenerGroup(`app.listener.${index}`, registerListener);
813
+ for (const registerListener of discoverListeners()) {
814
+ registerListener();
808
815
  }
809
816
  }
810
817
  };
@@ -828,7 +835,6 @@ import {
828
835
  } from "@getstrata/core/queue/createAppQueue";
829
836
 
830
837
  // ../../src/bootstrap/queue/defaultJobs.ts
831
- import { DispatchWebhookJob } from "@getstrata/core/jobs/dispatchWebhookJob";
832
838
  import { ExportAuditLogsJob } from "@getstrata/core/jobs/exportAuditLogsJob";
833
839
  import { InvalidateCacheTagsJob as InvalidateCacheTagsJob2 } from "@getstrata/core/jobs/invalidateCacheTagsJob";
834
840
  import { jobRegistry } from "@getstrata/core/queue/jobRegistry";
@@ -837,7 +843,6 @@ function registerDefaultJobs() {
837
843
  jobRegistry.register("cache.invalidate-tags", () => {
838
844
  return new InvalidateCacheTagsJob2(resolveApplicationCache2());
839
845
  });
840
- jobRegistry.register("webhook.dispatch", () => new DispatchWebhookJob);
841
846
  jobRegistry.register("audit.export", () => new ExportAuditLogsJob);
842
847
  }
843
848
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/bootstrap",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
4
4
  "description": "Strata application bootstrap — HttpKernel, DI, web session helpers",
5
5
  "type": "module",
6
6
  "license": "MIT",