@geekmidas/constructs 10.0.0-alpha.1 → 10.0.0-alpha.10
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/README.md +1 -0
- package/dist/{Construct-CdhThxDI.mjs → Construct-BD5neF7w.mjs} +14 -1
- package/dist/Construct-BD5neF7w.mjs.map +1 -0
- package/dist/{Construct-WhCXIOPV.d.cts → Construct-C0ijr2qp.d.cts} +14 -1
- package/dist/Construct-C0ijr2qp.d.cts.map +1 -0
- package/dist/{Construct-B-xc0SE9.d.mts → Construct-Ct8nalEi.d.mts} +14 -1
- package/dist/Construct-Ct8nalEi.d.mts.map +1 -0
- package/dist/{Construct-roId57cU.cjs → Construct-CyS3RpTL.cjs} +14 -1
- package/dist/Construct-CyS3RpTL.cjs.map +1 -0
- package/dist/Cron-DmQ8vQ4b.d.cts +39 -0
- package/dist/Cron-DmQ8vQ4b.d.cts.map +1 -0
- package/dist/Cron-dh4rUgib.d.mts +39 -0
- package/dist/Cron-dh4rUgib.d.mts.map +1 -0
- package/dist/CronBuilder-BquXDbDI.d.cts +44 -0
- package/dist/CronBuilder-BquXDbDI.d.cts.map +1 -0
- package/dist/CronBuilder-CGgY2080.d.mts +44 -0
- package/dist/CronBuilder-CGgY2080.d.mts.map +1 -0
- package/dist/CronBuilder-CYKT5RiO.mjs +93 -0
- package/dist/CronBuilder-CYKT5RiO.mjs.map +1 -0
- package/dist/CronBuilder-Da0C0edR.cjs +105 -0
- package/dist/CronBuilder-Da0C0edR.cjs.map +1 -0
- package/dist/{Endpoint-BKR5QH6O.d.mts → Endpoint-BjWKinFA.d.mts} +2 -2
- package/dist/{Endpoint-BQ9O0P1w.d.cts.map → Endpoint-BjWKinFA.d.mts.map} +1 -1
- package/dist/{Endpoint-BTj58Gob.mjs → Endpoint-DCQPMdUX.mjs} +3 -3
- package/dist/{Endpoint-BTj58Gob.mjs.map → Endpoint-DCQPMdUX.mjs.map} +1 -1
- package/dist/{Endpoint-BBkV6l0k.cjs → Endpoint-DcWXE-SZ.cjs} +3 -3
- package/dist/{Endpoint-BBkV6l0k.cjs.map → Endpoint-DcWXE-SZ.cjs.map} +1 -1
- package/dist/{Endpoint-BQ9O0P1w.d.cts → Endpoint-dav89W6-.d.cts} +2 -2
- package/dist/Endpoint-dav89W6-.d.cts.map +1 -0
- package/dist/{EndpointFactory-DYoGLaIT.cjs → EndpointFactory-CdWB7wPw.cjs} +7 -5
- package/dist/EndpointFactory-CdWB7wPw.cjs.map +1 -0
- package/dist/{EndpointFactory-BejSTzbB.mjs → EndpointFactory-CjV8F_lJ.mjs} +7 -5
- package/dist/EndpointFactory-CjV8F_lJ.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-wMsCyMgt.cjs → HonoEndpointAdaptor-DtL9j19R.cjs} +5 -6
- package/dist/{HonoEndpointAdaptor-wMsCyMgt.cjs.map → HonoEndpointAdaptor-DtL9j19R.cjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-7aYNdqJq.mjs → HonoEndpointAdaptor-P1ahhZHu.mjs} +4 -5
- package/dist/{HonoEndpointAdaptor-7aYNdqJq.mjs.map → HonoEndpointAdaptor-P1ahhZHu.mjs.map} +1 -1
- package/dist/{Queue-D6WeziRD.d.cts → Queue-D7ZuwBhy.d.cts} +2 -2
- package/dist/{Queue-D6WeziRD.d.cts.map → Queue-D7ZuwBhy.d.cts.map} +1 -1
- package/dist/{Queue-DpUeqdC8.d.mts → Queue-gVGfi2Yk.d.mts} +2 -2
- package/dist/{Queue-DpUeqdC8.d.mts.map → Queue-gVGfi2Yk.d.mts.map} +1 -1
- package/dist/{Subscriber-4rBJgDKI.d.mts → Subscriber-2mEi0ImH.d.cts} +3 -3
- package/dist/{Subscriber-4rBJgDKI.d.mts.map → Subscriber-2mEi0ImH.d.cts.map} +1 -1
- package/dist/{Subscriber-DVQowdyj.d.cts → Subscriber-xTJ9ayPN.d.mts} +3 -3
- package/dist/{Subscriber-DVQowdyj.d.cts.map → Subscriber-xTJ9ayPN.d.mts.map} +1 -1
- package/dist/SubscriberBuilder-4OPehf2R.cjs +120 -0
- package/dist/SubscriberBuilder-4OPehf2R.cjs.map +1 -0
- package/dist/SubscriberBuilder-BjkbeT9l.mjs +108 -0
- package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +1 -0
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts +62 -0
- package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +1 -0
- package/dist/SubscriberBuilder-waNhzjSM.d.cts +62 -0
- package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +1 -0
- package/dist/{Topic-Ohx9dvWr.d.cts → Topic-19QeHBIR.d.cts} +2 -2
- package/dist/{Topic-Ohx9dvWr.d.cts.map → Topic-19QeHBIR.d.cts.map} +1 -1
- package/dist/{Topic-cmy2jOUy.d.mts → Topic-DuFeqkBh.d.mts} +2 -2
- package/dist/{Topic-cmy2jOUy.d.mts.map → Topic-DuFeqkBh.d.mts.map} +1 -1
- package/dist/adaptors/aws.cjs +243 -10
- package/dist/adaptors/aws.cjs.map +1 -1
- package/dist/adaptors/aws.d.cts +99 -10
- package/dist/adaptors/aws.d.cts.map +1 -1
- package/dist/adaptors/aws.d.mts +99 -10
- package/dist/adaptors/aws.d.mts.map +1 -1
- package/dist/adaptors/aws.mjs +240 -7
- package/dist/adaptors/aws.mjs.map +1 -1
- package/dist/adaptors/hono.cjs +6 -7
- package/dist/adaptors/hono.d.cts +6 -6
- package/dist/adaptors/hono.d.cts.map +1 -1
- package/dist/adaptors/hono.d.mts +6 -6
- package/dist/adaptors/hono.d.mts.map +1 -1
- package/dist/adaptors/hono.mjs +6 -7
- package/dist/adaptors/testing.cjs +9 -10
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +6 -6
- package/dist/adaptors/testing.d.mts +6 -6
- package/dist/adaptors/testing.mjs +6 -7
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/auth.cjs +2 -2
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +10 -10
- package/dist/auth.d.cts.map +1 -1
- package/dist/auth.d.mts +10 -10
- package/dist/auth.d.mts.map +1 -1
- package/dist/auth.mjs +2 -2
- package/dist/auth.mjs.map +1 -1
- package/dist/{cache-CdQ7OLpR.d.cts → cache-BrRz3fEB.d.mts} +3 -3
- package/dist/{cache-CdQ7OLpR.d.cts.map → cache-BrRz3fEB.d.mts.map} +1 -1
- package/dist/{cache-DYoJFcfd.d.mts → cache-BtZY_tHe.d.cts} +3 -3
- package/dist/{cache-DYoJFcfd.d.mts.map → cache-BtZY_tHe.d.cts.map} +1 -1
- package/dist/cache.d.cts +2 -2
- package/dist/cache.d.mts +2 -2
- package/dist/{construct-interface-BqwRNYA2.d.mts → construct-interface-D9d4Gm4p.d.cts} +2 -2
- package/dist/{construct-interface-BqwRNYA2.d.mts.map → construct-interface-D9d4Gm4p.d.cts.map} +1 -1
- package/dist/{construct-interface-D2nNkHUN.d.cts → construct-interface-g5GM5pwR.d.mts} +2 -2
- package/dist/{construct-interface-D2nNkHUN.d.cts.map → construct-interface-g5GM5pwR.d.mts.map} +1 -1
- package/dist/construct-interface.d.cts +1 -1
- package/dist/construct-interface.d.mts +1 -1
- package/dist/credential.d.cts +1 -1
- package/dist/credential.d.mts +1 -1
- package/dist/crons/index.cjs +68 -86
- package/dist/crons/index.cjs.map +1 -1
- package/dist/crons/index.d.cts +36 -48
- package/dist/crons/index.d.cts.map +1 -1
- package/dist/crons/index.d.mts +36 -48
- package/dist/crons/index.d.mts.map +1 -1
- package/dist/crons/index.mjs +65 -82
- package/dist/crons/index.mjs.map +1 -1
- package/dist/database/kysely.d.cts +2 -2
- package/dist/database/kysely.d.mts +2 -2
- package/dist/email.d.cts +1 -1
- package/dist/email.d.mts +1 -1
- package/dist/endpoints/index.cjs +6 -7
- package/dist/endpoints/index.d.cts +5 -5
- package/dist/endpoints/index.d.mts +5 -5
- package/dist/endpoints/index.mjs +5 -6
- package/dist/file-server.d.cts +1 -1
- package/dist/file-server.d.mts +1 -1
- package/dist/functions/index.cjs +3 -4
- package/dist/functions/index.d.cts +4 -4
- package/dist/functions/index.d.mts +4 -4
- package/dist/functions/index.mjs +3 -3
- package/dist/{functions-Cpff1uZH.mjs → functions-14lpEFL4.mjs} +22 -9
- package/dist/functions-14lpEFL4.mjs.map +1 -0
- package/dist/{functions-DukjG8ov.cjs → functions-i_la-N5r.cjs} +21 -14
- package/dist/functions-i_la-N5r.cjs.map +1 -0
- package/dist/{index-D5zqAJ2e.d.cts → index-Bd5FqCoe.d.cts} +5 -5
- package/dist/{index-Cvz551AO.d.mts.map → index-Bd5FqCoe.d.cts.map} +1 -1
- package/dist/index-BknhM6Ux.d.mts +31 -0
- package/dist/index-BknhM6Ux.d.mts.map +1 -0
- package/dist/index-CBSfrowv.d.cts +31 -0
- package/dist/index-CBSfrowv.d.cts.map +1 -0
- package/dist/{index-BTvozlUD.d.cts → index-D24Xm79M.d.cts} +19 -11
- package/dist/index-D24Xm79M.d.cts.map +1 -0
- package/dist/{index-L7pz0R0T.d.mts → index-_ajboYxK.d.mts} +26 -17
- package/dist/index-_ajboYxK.d.mts.map +1 -0
- package/dist/{index-Cvz551AO.d.mts → index-lAO9egTb.d.mts} +5 -5
- package/dist/{index-D5zqAJ2e.d.cts.map → index-lAO9egTb.d.mts.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{lazyAccessors-DM6HcXQk.mjs → lazyAccessors-BoJN3SMd.mjs} +41 -2
- package/dist/lazyAccessors-BoJN3SMd.mjs.map +1 -0
- package/dist/{lazyAccessors-DrJj8NpA.cjs → lazyAccessors-e3j2oE2m.cjs} +52 -1
- package/dist/lazyAccessors-e3j2oE2m.cjs.map +1 -0
- package/dist/object-storage.d.cts +1 -1
- package/dist/object-storage.d.mts +1 -1
- package/dist/{processAudits-Bc8rz6Ev.cjs → processAudits-CGqttuXm.cjs} +1 -1
- package/dist/{processAudits-Bc8rz6Ev.cjs.map → processAudits-CGqttuXm.cjs.map} +1 -1
- package/dist/{processAudits-D89tICM4.mjs → processAudits-Dmts9H_b.mjs} +1 -1
- package/dist/{processAudits-D89tICM4.mjs.map → processAudits-Dmts9H_b.mjs.map} +1 -1
- package/dist/queue/index.cjs +1 -1
- package/dist/queue/index.d.cts +5 -5
- package/dist/queue/index.d.mts +5 -5
- package/dist/queue/index.mjs +1 -1
- package/dist/rest-api.cjs +6 -8
- package/dist/rest-api.cjs.map +1 -1
- package/dist/rest-api.d.cts +16 -24
- package/dist/rest-api.d.cts.map +1 -1
- package/dist/rest-api.d.mts +16 -24
- package/dist/rest-api.d.mts.map +1 -1
- package/dist/rest-api.mjs +6 -8
- package/dist/rest-api.mjs.map +1 -1
- package/dist/site.cjs +2 -2
- package/dist/site.cjs.map +1 -1
- package/dist/site.d.cts +9 -16
- package/dist/site.d.cts.map +1 -1
- package/dist/site.d.mts +9 -16
- package/dist/site.d.mts.map +1 -1
- package/dist/site.mjs +2 -2
- package/dist/site.mjs.map +1 -1
- package/dist/subscribers/index.cjs +6 -108
- package/dist/subscribers/index.d.cts +6 -63
- package/dist/subscribers/index.d.mts +6 -63
- package/dist/subscribers/index.mjs +5 -105
- package/dist/topic/index.cjs +1 -1
- package/dist/topic/index.d.cts +4 -32
- package/dist/topic/index.d.mts +4 -32
- package/dist/topic/index.mjs +1 -1
- package/dist/worker.cjs +166 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.cts +146 -0
- package/dist/worker.d.cts.map +1 -0
- package/dist/worker.d.mts +145 -0
- package/dist/worker.d.mts.map +1 -0
- package/dist/worker.mjs +165 -0
- package/dist/worker.mjs.map +1 -0
- package/package.json +58 -66
- package/dist/AWSScheduledFunction-9bJS4WdJ.d.cts +0 -122
- package/dist/AWSScheduledFunction-9bJS4WdJ.d.cts.map +0 -1
- package/dist/AWSScheduledFunction-BJjj8B5V.mjs +0 -243
- package/dist/AWSScheduledFunction-BJjj8B5V.mjs.map +0 -1
- package/dist/AWSScheduledFunction-BO5iEMSh.d.mts +0 -122
- package/dist/AWSScheduledFunction-BO5iEMSh.d.mts.map +0 -1
- package/dist/AWSScheduledFunction-qu4ieRZR.cjs +0 -255
- package/dist/AWSScheduledFunction-qu4ieRZR.cjs.map +0 -1
- package/dist/Construct-B-xc0SE9.d.mts.map +0 -1
- package/dist/Construct-CdhThxDI.mjs.map +0 -1
- package/dist/Construct-WhCXIOPV.d.cts.map +0 -1
- package/dist/Construct-roId57cU.cjs.map +0 -1
- package/dist/Endpoint-BKR5QH6O.d.mts.map +0 -1
- package/dist/EndpointFactory-BejSTzbB.mjs.map +0 -1
- package/dist/EndpointFactory-DYoGLaIT.cjs.map +0 -1
- package/dist/functions-Cpff1uZH.mjs.map +0 -1
- package/dist/functions-DukjG8ov.cjs.map +0 -1
- package/dist/index-BTvozlUD.d.cts.map +0 -1
- package/dist/index-L7pz0R0T.d.mts.map +0 -1
- package/dist/lazyAccessors-DM6HcXQk.mjs.map +0 -1
- package/dist/lazyAccessors-DrJj8NpA.cjs.map +0 -1
- package/dist/publisher-CGEo8UKD.mjs +0 -41
- package/dist/publisher-CGEo8UKD.mjs.map +0 -1
- package/dist/publisher-CqGsXB2X.cjs +0 -53
- package/dist/publisher-CqGsXB2X.cjs.map +0 -1
- package/dist/subscribers/index.cjs.map +0 -1
- package/dist/subscribers/index.d.cts.map +0 -1
- package/dist/subscribers/index.d.mts.map +0 -1
- package/dist/subscribers/index.mjs.map +0 -1
- package/dist/topic/index.d.cts.map +0 -1
- package/dist/topic/index.d.mts.map +0 -1
package/dist/site.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.cjs","names":["id: ConstructName<TName>","config: StaticSiteConfig","dependencies: readonly Dependency[]","constructs: readonly Declarable[]","edgeTo"],"sources":["../src/site.ts"],"sourcesContent":["/**\n * `StaticSite` — a frontend, declared like anything else.\n *\n * The point is not that a site needs provisioning; it is that a site is the\n * *consumer* whose edges make four hand-maintained lists derivable. Declaring it\n * is what turns \"which origins does the API allow\" from something a person keeps\n * in step into something the graph already knows.\n *\n * ```ts\n * export const console = new StaticSite('Console', { path: 'apps/console' })\n * .dependsOn([api, auth]);\n * ```\n *\n * It has no `.service`. A site is not a process that registers clients — it is\n * built, and the values it needs are inlined or fetched by its own framework —\n * so the edge is {@link Declarable} rather than {@link Consumable}, and the\n * asymmetry is the honest one: a site consumes addresses, not connections.\n *\n * Only the static variant ships. SSR deploy shapes are unstable and each one is\n * its own maintenance, so they follow rather than arrive together; Expo and\n * mobile are out of scope entirely, because an app store is not infrastructure\n * and there is no URL to hand anyone.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\tprovideKey,\n\ttype SiteDeclaration,\n} from '@geekmidas/manifest';\nimport { type Declarable, edgeTo } from './construct-interface';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"site.cjs","names":["id: ConstructName<TName>","config: StaticSiteConfig","dependencies: readonly Dependency[]","constructs: readonly Declarable[]","edgeTo"],"sources":["../src/site.ts"],"sourcesContent":["/**\n * `StaticSite` — a frontend, declared like anything else.\n *\n * The point is not that a site needs provisioning; it is that a site is the\n * *consumer* whose edges make four hand-maintained lists derivable. Declaring it\n * is what turns \"which origins does the API allow\" from something a person keeps\n * in step into something the graph already knows.\n *\n * ```ts\n * export const console = new StaticSite('Console', { path: 'apps/console' })\n * .dependsOn([api, auth]);\n * ```\n *\n * It has no `.service`. A site is not a process that registers clients — it is\n * built, and the values it needs are inlined or fetched by its own framework —\n * so the edge is {@link Declarable} rather than {@link Consumable}, and the\n * asymmetry is the honest one: a site consumes addresses, not connections.\n *\n * Only the static variant ships. SSR deploy shapes are unstable and each one is\n * its own maintenance, so they follow rather than arrive together; Expo and\n * mobile are out of scope entirely, because an app store is not infrastructure\n * and there is no URL to hand anyone.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\tprovideKey,\n\ttype SiteDeclaration,\n} from '@geekmidas/manifest';\nimport { type Declarable, edgeTo } from './construct-interface';\n\n/**\n * Where a site's source lives, and the little else a layout can differ by.\n *\n * Only `path` is required: `new StaticSite('Web', { path: 'apps/web' })` is a\n * complete site.\n */\nexport interface StaticSiteConfig {\n\t/**\n\t * Where its source lives, relative to the workspace root — `'apps/web'`.\n\t *\n\t * Required, the same field `RestApi` and `BetterAuth` take. It was\n\t * inferred from the id, which made a site's home whatever was on disk.\n\t */\n\tpath: string;\n\t/**\n\t * The port it answers on locally.\n\t *\n\t * Normally omitted: ports are assigned in a stable order, so adding a site\n\t * does not renumber the ones already running.\n\t */\n\tport?: number;\n\t/**\n\t * Modules to import when sniffing which env vars this site reads.\n\t *\n\t * A frontend's values are inlined at build time, so the build has to know\n\t * which ones it reads before it reads them.\n\t */\n\tconfig?: { client?: string; server?: string };\n\t/**\n\t * Whether the base domain points at this site.\n\t *\n\t * A project with one site needs this no more than a project with one\n\t * database needs to say which database. It matters when there are several\n\t * and none is called `web`: the base domain then belongs to whichever site\n\t * says so, rather than to whichever file the glob happened to reach first.\n\t */\n\troot?: boolean;\n\t/**\n\t * Which framework builds it.\n\t *\n\t * It selects how values are delivered — `VITE_`, `NEXT_PUBLIC_`, a fetched\n\t * `config.json` — and never which values there are. One neutral name from the\n\t * construct, one serialisation per framework, the same rule as everywhere\n\t * else.\n\t */\n\tvariant?: SiteDeclaration['variant'];\n}\n\nexport class StaticSite<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\treadonly keys: { url: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: StaticSiteConfig,\n\t\t/**\n\t\t * Internal: how `.dependsOn()` carries edges into the copy it returns.\n\t\t * Written as a parameter rather than a mutable field so the builder can\n\t\t * stay immutable without a clone method, the same shape\n\t\t * `KyselyDatabase` uses for its derived forms.\n\t\t */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t) {\n\t\tthis.id = canonicalId(id as string) as TName;\n\t\tthis.keys = { url: provideKey(this.id, 'url') };\n\t}\n\n\t/**\n\t * What this site calls.\n\t *\n\t * Immutable, like every other builder here: it returns a new site rather than\n\t * mutating this one, so a module that exports both a base and a variant of it\n\t * cannot have the second silently change the first.\n\t *\n\t * Takes {@link Declarable} rather than {@link Consumable} because a site's\n\t * edge is a build-time link and not a service injection — requiring a client\n\t * would exclude exactly the surfaces a frontend actually depends on.\n\t */\n\tdependsOn(constructs: readonly Declarable[]): StaticSite<TName> {\n\t\treturn new StaticSite<TName>(this.id as ConstructName<TName>, this.config, [\n\t\t\t...this.dependencies,\n\t\t\t...constructs.map(edgeTo),\n\t\t]);\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'site',\n\t\t\t\tid: this.id,\n\t\t\t\tvariant: this.config.variant ?? 'static',\n\t\t\t\tapp: {\n\t\t\t\t\tpath: this.config.path,\n\t\t\t\t\t...(this.config.port ? { port: this.config.port } : {}),\n\t\t\t\t\t...(this.config.config ? { config: this.config.config } : {}),\n\t\t\t\t},\n\t\t\t\t...(this.config.root ? { root: true } : {}),\n\t\t\t\tdependencies: this.dependencies,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;AAkFA,IAAa,aAAb,MAAa,WAEb;CACC,AAAS;CACT,AAAS;CAET,YACCA,IACiBC,QAOAC,eAAsC,CAAE,GACxD;EARgB;EAOA;AAEjB,OAAK,KAAK,sCAAY,GAAa;AACnC,OAAK,OAAO,EAAE,KAAK,qCAAW,KAAK,IAAI,MAAM,CAAE;CAC/C;;;;;;;;;;;;CAaD,UAAUC,YAAsD;AAC/D,SAAO,IAAI,WAAkB,KAAK,IAA4B,KAAK,QAAQ,CAC1E,GAAG,KAAK,cACR,GAAG,WAAW,IAAIC,mCAAO,AACzB;CACD;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,SAAS,KAAK,OAAO,WAAW;GAChC,KAAK;IACJ,MAAM,KAAK,OAAO;IAClB,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,OAAO,KAAM,IAAG,CAAE;IACtD,GAAI,KAAK,OAAO,SAAS,EAAE,QAAQ,KAAK,OAAO,OAAQ,IAAG,CAAE;GAC5D;GACD,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAM,IAAG,CAAE;GAC1C,cAAc,KAAK;GACnB,UAAU,CAAC,KAAK,KAAK,GAAI;EACzB,CACD;CACD;AACD"}
|
package/dist/site.d.cts
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
import { Declarable } from "./construct-interface-
|
|
1
|
+
import { Declarable } from "./construct-interface-D9d4Gm4p.cjs";
|
|
2
2
|
import { ConstructName, Declaration, Dependency, SiteDeclaration } from "@geekmidas/manifest";
|
|
3
3
|
|
|
4
4
|
//#region src/site.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Where a site's source lives, and the little else a layout can differ by.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* and worth separating. A site *is* its app — there is nothing to separate it
|
|
12
|
-
* from, and `{ app: { path } }` would be a wrapper around the only thing in it.
|
|
13
|
-
*
|
|
14
|
-
* Every field is optional, so `new StaticSite('Web')` is a complete site.
|
|
9
|
+
* Only `path` is required: `new StaticSite('Web', { path: 'apps/web' })` is a
|
|
10
|
+
* complete site.
|
|
15
11
|
*/
|
|
16
12
|
interface StaticSiteConfig {
|
|
17
13
|
/**
|
|
18
|
-
* Where its source lives, relative to the workspace root
|
|
19
|
-
*
|
|
20
|
-
* Optional, and normally omitted: `apps/<kebab-id>` where that directory
|
|
21
|
-
* exists, and the workspace root otherwise. `StaticSite('Web')` means
|
|
22
|
-
* `apps/web`, which is the thing the id already said.
|
|
14
|
+
* Where its source lives, relative to the workspace root — `'apps/web'`.
|
|
23
15
|
*
|
|
24
|
-
*
|
|
16
|
+
* Required, the same field `RestApi` and `BetterAuth` take. It was
|
|
17
|
+
* inferred from the id, which made a site's home whatever was on disk.
|
|
25
18
|
*/
|
|
26
|
-
path
|
|
19
|
+
path: string;
|
|
27
20
|
/**
|
|
28
21
|
* The port it answers on locally.
|
|
29
22
|
*
|
|
@@ -73,7 +66,7 @@ declare class StaticSite<TName extends string = string> implements Declarable<TN
|
|
|
73
66
|
readonly keys: {
|
|
74
67
|
url: string;
|
|
75
68
|
};
|
|
76
|
-
constructor(id: ConstructName<TName>, config
|
|
69
|
+
constructor(id: ConstructName<TName>, config: StaticSiteConfig,
|
|
77
70
|
/**
|
|
78
71
|
* Internal: how `.dependsOn()` carries edges into the copy it returns.
|
|
79
72
|
* Written as a parameter rather than a mutable field so the builder can
|
package/dist/site.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.cts","names":[],"sources":["../src/site.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"site.d.cts","names":[],"sources":["../src/site.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;UAwCiB,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuCN;;cAGE,qDACD,WAAW;;;;;;;;;eAET;;;;kBAIR,cAAc,gBACO;;;;;;;0BAOe;;;;;;;;;;;;iCAiBV,eAAe,WAAW;aAO9C"}
|
package/dist/site.d.mts
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
|
-
import { Declarable } from "./construct-interface-
|
|
1
|
+
import { Declarable } from "./construct-interface-g5GM5pwR.mjs";
|
|
2
2
|
import { ConstructName, Declaration, Dependency, SiteDeclaration } from "@geekmidas/manifest";
|
|
3
3
|
|
|
4
4
|
//#region src/site.d.ts
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Where a site's source lives, and the little else a layout can differ by.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* and worth separating. A site *is* its app — there is nothing to separate it
|
|
12
|
-
* from, and `{ app: { path } }` would be a wrapper around the only thing in it.
|
|
13
|
-
*
|
|
14
|
-
* Every field is optional, so `new StaticSite('Web')` is a complete site.
|
|
9
|
+
* Only `path` is required: `new StaticSite('Web', { path: 'apps/web' })` is a
|
|
10
|
+
* complete site.
|
|
15
11
|
*/
|
|
16
12
|
interface StaticSiteConfig {
|
|
17
13
|
/**
|
|
18
|
-
* Where its source lives, relative to the workspace root
|
|
19
|
-
*
|
|
20
|
-
* Optional, and normally omitted: `apps/<kebab-id>` where that directory
|
|
21
|
-
* exists, and the workspace root otherwise. `StaticSite('Web')` means
|
|
22
|
-
* `apps/web`, which is the thing the id already said.
|
|
14
|
+
* Where its source lives, relative to the workspace root — `'apps/web'`.
|
|
23
15
|
*
|
|
24
|
-
*
|
|
16
|
+
* Required, the same field `RestApi` and `BetterAuth` take. It was
|
|
17
|
+
* inferred from the id, which made a site's home whatever was on disk.
|
|
25
18
|
*/
|
|
26
|
-
path
|
|
19
|
+
path: string;
|
|
27
20
|
/**
|
|
28
21
|
* The port it answers on locally.
|
|
29
22
|
*
|
|
@@ -73,7 +66,7 @@ declare class StaticSite<TName extends string = string> implements Declarable<TN
|
|
|
73
66
|
readonly keys: {
|
|
74
67
|
url: string;
|
|
75
68
|
};
|
|
76
|
-
constructor(id: ConstructName<TName>, config
|
|
69
|
+
constructor(id: ConstructName<TName>, config: StaticSiteConfig,
|
|
77
70
|
/**
|
|
78
71
|
* Internal: how `.dependsOn()` carries edges into the copy it returns.
|
|
79
72
|
* Written as a parameter rather than a mutable field so the builder can
|
package/dist/site.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.d.mts","names":[],"sources":["../src/site.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"site.d.mts","names":[],"sources":["../src/site.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;UAwCiB,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuCN;;cAGE,qDACD,WAAW;;;;;;;;;eAET;;;;kBAIR,cAAc,gBACO;;;;;;;0BAOe;;;;;;;;;;;;iCAiBV,eAAe,WAAW;aAO9C"}
|
package/dist/site.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { canonicalId, provideKey } from "@geekmidas/manifest";
|
|
|
5
5
|
var StaticSite = class StaticSite {
|
|
6
6
|
id;
|
|
7
7
|
keys;
|
|
8
|
-
constructor(id, config
|
|
8
|
+
constructor(id, config, dependencies = []) {
|
|
9
9
|
this.config = config;
|
|
10
10
|
this.dependencies = dependencies;
|
|
11
11
|
this.id = canonicalId(id);
|
|
@@ -31,7 +31,7 @@ var StaticSite = class StaticSite {
|
|
|
31
31
|
id: this.id,
|
|
32
32
|
variant: this.config.variant ?? "static",
|
|
33
33
|
app: {
|
|
34
|
-
|
|
34
|
+
path: this.config.path,
|
|
35
35
|
...this.config.port ? { port: this.config.port } : {},
|
|
36
36
|
...this.config.config ? { config: this.config.config } : {}
|
|
37
37
|
},
|
package/dist/site.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site.mjs","names":["id: ConstructName<TName>","config: StaticSiteConfig","dependencies: readonly Dependency[]","constructs: readonly Declarable[]"],"sources":["../src/site.ts"],"sourcesContent":["/**\n * `StaticSite` — a frontend, declared like anything else.\n *\n * The point is not that a site needs provisioning; it is that a site is the\n * *consumer* whose edges make four hand-maintained lists derivable. Declaring it\n * is what turns \"which origins does the API allow\" from something a person keeps\n * in step into something the graph already knows.\n *\n * ```ts\n * export const console = new StaticSite('Console', { path: 'apps/console' })\n * .dependsOn([api, auth]);\n * ```\n *\n * It has no `.service`. A site is not a process that registers clients — it is\n * built, and the values it needs are inlined or fetched by its own framework —\n * so the edge is {@link Declarable} rather than {@link Consumable}, and the\n * asymmetry is the honest one: a site consumes addresses, not connections.\n *\n * Only the static variant ships. SSR deploy shapes are unstable and each one is\n * its own maintenance, so they follow rather than arrive together; Expo and\n * mobile are out of scope entirely, because an app store is not infrastructure\n * and there is no URL to hand anyone.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\tprovideKey,\n\ttype SiteDeclaration,\n} from '@geekmidas/manifest';\nimport { type Declarable, edgeTo } from './construct-interface';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"site.mjs","names":["id: ConstructName<TName>","config: StaticSiteConfig","dependencies: readonly Dependency[]","constructs: readonly Declarable[]"],"sources":["../src/site.ts"],"sourcesContent":["/**\n * `StaticSite` — a frontend, declared like anything else.\n *\n * The point is not that a site needs provisioning; it is that a site is the\n * *consumer* whose edges make four hand-maintained lists derivable. Declaring it\n * is what turns \"which origins does the API allow\" from something a person keeps\n * in step into something the graph already knows.\n *\n * ```ts\n * export const console = new StaticSite('Console', { path: 'apps/console' })\n * .dependsOn([api, auth]);\n * ```\n *\n * It has no `.service`. A site is not a process that registers clients — it is\n * built, and the values it needs are inlined or fetched by its own framework —\n * so the edge is {@link Declarable} rather than {@link Consumable}, and the\n * asymmetry is the honest one: a site consumes addresses, not connections.\n *\n * Only the static variant ships. SSR deploy shapes are unstable and each one is\n * its own maintenance, so they follow rather than arrive together; Expo and\n * mobile are out of scope entirely, because an app store is not infrastructure\n * and there is no URL to hand anyone.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\tprovideKey,\n\ttype SiteDeclaration,\n} from '@geekmidas/manifest';\nimport { type Declarable, edgeTo } from './construct-interface';\n\n/**\n * Where a site's source lives, and the little else a layout can differ by.\n *\n * Only `path` is required: `new StaticSite('Web', { path: 'apps/web' })` is a\n * complete site.\n */\nexport interface StaticSiteConfig {\n\t/**\n\t * Where its source lives, relative to the workspace root — `'apps/web'`.\n\t *\n\t * Required, the same field `RestApi` and `BetterAuth` take. It was\n\t * inferred from the id, which made a site's home whatever was on disk.\n\t */\n\tpath: string;\n\t/**\n\t * The port it answers on locally.\n\t *\n\t * Normally omitted: ports are assigned in a stable order, so adding a site\n\t * does not renumber the ones already running.\n\t */\n\tport?: number;\n\t/**\n\t * Modules to import when sniffing which env vars this site reads.\n\t *\n\t * A frontend's values are inlined at build time, so the build has to know\n\t * which ones it reads before it reads them.\n\t */\n\tconfig?: { client?: string; server?: string };\n\t/**\n\t * Whether the base domain points at this site.\n\t *\n\t * A project with one site needs this no more than a project with one\n\t * database needs to say which database. It matters when there are several\n\t * and none is called `web`: the base domain then belongs to whichever site\n\t * says so, rather than to whichever file the glob happened to reach first.\n\t */\n\troot?: boolean;\n\t/**\n\t * Which framework builds it.\n\t *\n\t * It selects how values are delivered — `VITE_`, `NEXT_PUBLIC_`, a fetched\n\t * `config.json` — and never which values there are. One neutral name from the\n\t * construct, one serialisation per framework, the same rule as everywhere\n\t * else.\n\t */\n\tvariant?: SiteDeclaration['variant'];\n}\n\nexport class StaticSite<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\treadonly keys: { url: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: StaticSiteConfig,\n\t\t/**\n\t\t * Internal: how `.dependsOn()` carries edges into the copy it returns.\n\t\t * Written as a parameter rather than a mutable field so the builder can\n\t\t * stay immutable without a clone method, the same shape\n\t\t * `KyselyDatabase` uses for its derived forms.\n\t\t */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t) {\n\t\tthis.id = canonicalId(id as string) as TName;\n\t\tthis.keys = { url: provideKey(this.id, 'url') };\n\t}\n\n\t/**\n\t * What this site calls.\n\t *\n\t * Immutable, like every other builder here: it returns a new site rather than\n\t * mutating this one, so a module that exports both a base and a variant of it\n\t * cannot have the second silently change the first.\n\t *\n\t * Takes {@link Declarable} rather than {@link Consumable} because a site's\n\t * edge is a build-time link and not a service injection — requiring a client\n\t * would exclude exactly the surfaces a frontend actually depends on.\n\t */\n\tdependsOn(constructs: readonly Declarable[]): StaticSite<TName> {\n\t\treturn new StaticSite<TName>(this.id as ConstructName<TName>, this.config, [\n\t\t\t...this.dependencies,\n\t\t\t...constructs.map(edgeTo),\n\t\t]);\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'site',\n\t\t\t\tid: this.id,\n\t\t\t\tvariant: this.config.variant ?? 'static',\n\t\t\t\tapp: {\n\t\t\t\t\tpath: this.config.path,\n\t\t\t\t\t...(this.config.port ? { port: this.config.port } : {}),\n\t\t\t\t\t...(this.config.config ? { config: this.config.config } : {}),\n\t\t\t\t},\n\t\t\t\t...(this.config.root ? { root: true } : {}),\n\t\t\t\tdependencies: this.dependencies,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;AAkFA,IAAa,aAAb,MAAa,WAEb;CACC,AAAS;CACT,AAAS;CAET,YACCA,IACiBC,QAOAC,eAAsC,CAAE,GACxD;EARgB;EAOA;AAEjB,OAAK,KAAK,YAAY,GAAa;AACnC,OAAK,OAAO,EAAE,KAAK,WAAW,KAAK,IAAI,MAAM,CAAE;CAC/C;;;;;;;;;;;;CAaD,UAAUC,YAAsD;AAC/D,SAAO,IAAI,WAAkB,KAAK,IAA4B,KAAK,QAAQ,CAC1E,GAAG,KAAK,cACR,GAAG,WAAW,IAAI,OAAO,AACzB;CACD;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,SAAS,KAAK,OAAO,WAAW;GAChC,KAAK;IACJ,MAAM,KAAK,OAAO;IAClB,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,OAAO,KAAM,IAAG,CAAE;IACtD,GAAI,KAAK,OAAO,SAAS,EAAE,QAAQ,KAAK,OAAO,OAAQ,IAAG,CAAE;GAC5D;GACD,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAM,IAAG,CAAE;GAC1C,cAAc,KAAK;GACnB,UAAU,CAAC,KAAK,KAAK,GAAI;EACzB,CACD;CACD;AACD"}
|
|
@@ -1,109 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const __geekmidas_logger_console = require_chunk.__toESM(require("@geekmidas/logger/console"));
|
|
1
|
+
require('../construct-interface-BfjcOD_E.cjs');
|
|
2
|
+
require('../Construct-CyS3RpTL.cjs');
|
|
3
|
+
require('../clone-Dy0cR2SZ.cjs');
|
|
4
|
+
const require_SubscriberBuilder = require('../SubscriberBuilder-4OPehf2R.cjs');
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__IS_SUBSCRIBER__ = true;
|
|
10
|
-
static isSubscriber(obj) {
|
|
11
|
-
return Boolean(obj && obj.__IS_SUBSCRIBER__ === true && obj.type === require_Construct.ConstructType.Subscriber);
|
|
12
|
-
}
|
|
13
|
-
constructor(handler, timeout = 3e4, _subscribedEvents, outputSchema, services = [], logger = __geekmidas_logger_console.DEFAULT_LOGGER, publisherService, topicName, constructs = []) {
|
|
14
|
-
super(require_Construct.ConstructType.Subscriber, logger, services, [], publisherService, outputSchema, timeout, void 0, void 0, constructs);
|
|
15
|
-
this.handler = handler;
|
|
16
|
-
this.timeout = timeout;
|
|
17
|
-
this._subscribedEvents = _subscribedEvents;
|
|
18
|
-
this.outputSchema = outputSchema;
|
|
19
|
-
this.services = services;
|
|
20
|
-
this.logger = logger;
|
|
21
|
-
this.publisherService = publisherService;
|
|
22
|
-
this.topicName = topicName;
|
|
23
|
-
}
|
|
24
|
-
get subscribedEvents() {
|
|
25
|
-
return this._subscribedEvents;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/subscribers/SubscriberBuilder.ts
|
|
31
|
-
var SubscriberBuilder = class {
|
|
32
|
-
_subscribedEvents = [];
|
|
33
|
-
_timeout;
|
|
34
|
-
outputSchema;
|
|
35
|
-
_services = [];
|
|
36
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
37
|
-
_constructs = [];
|
|
38
|
-
_logger = __geekmidas_logger_console.DEFAULT_LOGGER;
|
|
39
|
-
_publisher;
|
|
40
|
-
_topicName;
|
|
41
|
-
constructor() {
|
|
42
|
-
this._timeout = 3e4;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Bind this subscriber to a {@link Topic} — the preferred way to type and wire
|
|
46
|
-
* a fan-out consumer. It supplies the subscribable event types (and their
|
|
47
|
-
* payloads) from the topic's contract and records the binding for the manifest,
|
|
48
|
-
* so infra wires the SNS subscription.
|
|
49
|
-
*
|
|
50
|
-
* Prefer this over typing via a hand-written publisher service: a consumer does
|
|
51
|
-
* not publish, so binding a topic does *not* require the topic's publisher
|
|
52
|
-
* connection string (least privilege). Use `.publisher(...)` only when the
|
|
53
|
-
* subscriber actually publishes follow-up events.
|
|
54
|
-
*/
|
|
55
|
-
topic(topic) {
|
|
56
|
-
return require_clone.cloneWith(this, { _topicName: topic.name });
|
|
57
|
-
}
|
|
58
|
-
timeout(timeout) {
|
|
59
|
-
return require_clone.cloneWith(this, { _timeout: timeout });
|
|
60
|
-
}
|
|
61
|
-
output(schema) {
|
|
62
|
-
return require_clone.cloneWith(this, { outputSchema: schema });
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
66
|
-
* topic.
|
|
67
|
-
*
|
|
68
|
-
* It records the edge and dissolves each construct's client into the
|
|
69
|
-
* handler's service record under the construct's own id, so
|
|
70
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
71
|
-
*
|
|
72
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
73
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
74
|
-
*/
|
|
75
|
-
dependsOn(constructs) {
|
|
76
|
-
const services = require_construct_interface.servicesOf(constructs);
|
|
77
|
-
return require_clone.cloneWith(this, {
|
|
78
|
-
_services: [...this._services, ...services],
|
|
79
|
-
_constructs: require_construct_interface.idsOf(constructs, this._constructs)
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
services(services) {
|
|
83
|
-
return require_clone.cloneWith(this, { _services: [...this._services, ...services] });
|
|
84
|
-
}
|
|
85
|
-
logger(logger) {
|
|
86
|
-
return require_clone.cloneWith(this, { _logger: logger });
|
|
87
|
-
}
|
|
88
|
-
publisher(publisher) {
|
|
89
|
-
return require_clone.cloneWith(this, { _publisher: publisher });
|
|
90
|
-
}
|
|
91
|
-
subscribe(event) {
|
|
92
|
-
const eventsToAdd = Array.isArray(event) ? event : [event];
|
|
93
|
-
return require_clone.cloneWith(this, { _subscribedEvents: [...this._subscribedEvents, ...eventsToAdd] });
|
|
94
|
-
}
|
|
95
|
-
handle(fn) {
|
|
96
|
-
const subscriber = new Subscriber(fn, this._timeout, this._subscribedEvents, this.outputSchema, this._services, this._logger, this._publisher, this._topicName, this._constructs);
|
|
97
|
-
return subscriber;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region src/subscribers/index.ts
|
|
103
|
-
const s = new SubscriberBuilder();
|
|
104
|
-
|
|
105
|
-
//#endregion
|
|
106
|
-
exports.Subscriber = Subscriber;
|
|
107
|
-
exports.SubscriberBuilder = SubscriberBuilder;
|
|
108
|
-
exports.s = s;
|
|
109
|
-
//# sourceMappingURL=index.cjs.map
|
|
6
|
+
exports.Subscriber = require_SubscriberBuilder.Subscriber;
|
|
7
|
+
exports.SubscriberBuilder = require_SubscriberBuilder.SubscriberBuilder;
|
|
@@ -1,63 +1,6 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import
|
|
3
|
-
import { Subscriber
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { Logger } from "@geekmidas/logger";
|
|
8
|
-
import { Service } from "@geekmidas/services";
|
|
9
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
10
|
-
|
|
11
|
-
//#region src/subscribers/SubscriberBuilder.d.ts
|
|
12
|
-
declare class SubscriberBuilder<TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TSubscribedEvents extends any[] = []> {
|
|
13
|
-
private _subscribedEvents;
|
|
14
|
-
private _timeout?;
|
|
15
|
-
private outputSchema?;
|
|
16
|
-
private _services;
|
|
17
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
18
|
-
_constructs: string[];
|
|
19
|
-
private _logger;
|
|
20
|
-
private _publisher?;
|
|
21
|
-
private _topicName?;
|
|
22
|
-
constructor();
|
|
23
|
-
/**
|
|
24
|
-
* Bind this subscriber to a {@link Topic} — the preferred way to type and wire
|
|
25
|
-
* a fan-out consumer. It supplies the subscribable event types (and their
|
|
26
|
-
* payloads) from the topic's contract and records the binding for the manifest,
|
|
27
|
-
* so infra wires the SNS subscription.
|
|
28
|
-
*
|
|
29
|
-
* Prefer this over typing via a hand-written publisher service: a consumer does
|
|
30
|
-
* not publish, so binding a topic does *not* require the topic's publisher
|
|
31
|
-
* connection string (least privilege). Use `.publisher(...)` only when the
|
|
32
|
-
* subscriber actually publishes follow-up events.
|
|
33
|
-
*/
|
|
34
|
-
topic<TName extends string, TEvents extends TopicEvents>(topic: Topic<TName, TEvents>): SubscriberBuilder<TServices, TLogger, OutSchema, EventPublisher<TopicMessage<TEvents>>, TEventPublisherServiceName, TSubscribedEvents>;
|
|
35
|
-
timeout(timeout: number): this;
|
|
36
|
-
output<T extends StandardSchemaV1>(schema: T): SubscriberBuilder<TServices, TLogger, T, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
37
|
-
/**
|
|
38
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
39
|
-
* topic.
|
|
40
|
-
*
|
|
41
|
-
* It records the edge and dissolves each construct's client into the
|
|
42
|
-
* handler's service record under the construct's own id, so
|
|
43
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
44
|
-
*
|
|
45
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
46
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
47
|
-
*/
|
|
48
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): SubscriberBuilder<[...TServices, ...ServicesOf<T>], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
49
|
-
services<T extends Service[]>(services: T): SubscriberBuilder<[...TServices, ...T], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
50
|
-
logger<T extends Logger>(logger: T): SubscriberBuilder<TServices, T, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
51
|
-
publisher<T extends EventPublisher<any>, TName extends string>(publisher: Service<TName, T>): SubscriberBuilder<TServices, TLogger, OutSchema, T, TName, TSubscribedEvents>;
|
|
52
|
-
subscribe<TEvent extends (TEventPublisher extends EventPublisher<any> ? ExtractPublisherMessage<TEventPublisher>['type'] | ExtractPublisherMessage<TEventPublisher>['type'][] : never)>(event: TEvent): SubscriberBuilder<TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TEvent extends any[] ? [...TSubscribedEvents, ...TEvent] : [...TSubscribedEvents, TEvent]>;
|
|
53
|
-
handle(fn: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>): Subscriber<TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=SubscriberBuilder.d.ts.map
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/subscribers/index.d.ts
|
|
58
|
-
declare const s: SubscriberBuilder<[], _geekmidas_logger19.Logger, undefined, undefined, string, []>;
|
|
59
|
-
//# sourceMappingURL=index.d.ts.map
|
|
60
|
-
|
|
61
|
-
//#endregion
|
|
62
|
-
export { Subscriber, SubscriberBuilder, s };
|
|
63
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import "../Construct-C0ijr2qp.cjs";
|
|
2
|
+
import "../construct-interface-D9d4Gm4p.cjs";
|
|
3
|
+
import { Subscriber } from "../Subscriber-2mEi0ImH.cjs";
|
|
4
|
+
import "../Topic-19QeHBIR.cjs";
|
|
5
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-waNhzjSM.cjs";
|
|
6
|
+
export { Subscriber, SubscriberBuilder };
|
|
@@ -1,63 +1,6 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import
|
|
3
|
-
import { Subscriber
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import * as _geekmidas_logger19 from "@geekmidas/logger";
|
|
8
|
-
import { Logger } from "@geekmidas/logger";
|
|
9
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
10
|
-
|
|
11
|
-
//#region src/subscribers/SubscriberBuilder.d.ts
|
|
12
|
-
declare class SubscriberBuilder<TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TSubscribedEvents extends any[] = []> {
|
|
13
|
-
private _subscribedEvents;
|
|
14
|
-
private _timeout?;
|
|
15
|
-
private outputSchema?;
|
|
16
|
-
private _services;
|
|
17
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
18
|
-
_constructs: string[];
|
|
19
|
-
private _logger;
|
|
20
|
-
private _publisher?;
|
|
21
|
-
private _topicName?;
|
|
22
|
-
constructor();
|
|
23
|
-
/**
|
|
24
|
-
* Bind this subscriber to a {@link Topic} — the preferred way to type and wire
|
|
25
|
-
* a fan-out consumer. It supplies the subscribable event types (and their
|
|
26
|
-
* payloads) from the topic's contract and records the binding for the manifest,
|
|
27
|
-
* so infra wires the SNS subscription.
|
|
28
|
-
*
|
|
29
|
-
* Prefer this over typing via a hand-written publisher service: a consumer does
|
|
30
|
-
* not publish, so binding a topic does *not* require the topic's publisher
|
|
31
|
-
* connection string (least privilege). Use `.publisher(...)` only when the
|
|
32
|
-
* subscriber actually publishes follow-up events.
|
|
33
|
-
*/
|
|
34
|
-
topic<TName extends string, TEvents extends TopicEvents>(topic: Topic<TName, TEvents>): SubscriberBuilder<TServices, TLogger, OutSchema, EventPublisher<TopicMessage<TEvents>>, TEventPublisherServiceName, TSubscribedEvents>;
|
|
35
|
-
timeout(timeout: number): this;
|
|
36
|
-
output<T extends StandardSchemaV1>(schema: T): SubscriberBuilder<TServices, TLogger, T, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
37
|
-
/**
|
|
38
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
39
|
-
* topic.
|
|
40
|
-
*
|
|
41
|
-
* It records the edge and dissolves each construct's client into the
|
|
42
|
-
* handler's service record under the construct's own id, so
|
|
43
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
44
|
-
*
|
|
45
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
46
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
47
|
-
*/
|
|
48
|
-
dependsOn<const T extends readonly Consumable[]>(constructs: T): SubscriberBuilder<[...TServices, ...ServicesOf<T>], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
49
|
-
services<T extends Service[]>(services: T): SubscriberBuilder<[...TServices, ...T], TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
50
|
-
logger<T extends Logger>(logger: T): SubscriberBuilder<TServices, T, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
51
|
-
publisher<T extends EventPublisher<any>, TName extends string>(publisher: Service<TName, T>): SubscriberBuilder<TServices, TLogger, OutSchema, T, TName, TSubscribedEvents>;
|
|
52
|
-
subscribe<TEvent extends (TEventPublisher extends EventPublisher<any> ? ExtractPublisherMessage<TEventPublisher>['type'] | ExtractPublisherMessage<TEventPublisher>['type'][] : never)>(event: TEvent): SubscriberBuilder<TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TEvent extends any[] ? [...TSubscribedEvents, ...TEvent] : [...TSubscribedEvents, TEvent]>;
|
|
53
|
-
handle(fn: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>): Subscriber<TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, TSubscribedEvents>;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=SubscriberBuilder.d.ts.map
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/subscribers/index.d.ts
|
|
58
|
-
declare const s: SubscriberBuilder<[], _geekmidas_logger19.Logger, undefined, undefined, string, []>;
|
|
59
|
-
//# sourceMappingURL=index.d.ts.map
|
|
60
|
-
|
|
61
|
-
//#endregion
|
|
62
|
-
export { Subscriber, SubscriberBuilder, s };
|
|
63
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
import "../Construct-Ct8nalEi.mjs";
|
|
2
|
+
import "../construct-interface-g5GM5pwR.mjs";
|
|
3
|
+
import { Subscriber } from "../Subscriber-xTJ9ayPN.mjs";
|
|
4
|
+
import "../Topic-DuFeqkBh.mjs";
|
|
5
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-Dptmo-1A.mjs";
|
|
6
|
+
export { Subscriber, SubscriberBuilder };
|
|
@@ -1,106 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import "../Construct-BD5neF7w.mjs";
|
|
2
|
+
import "../construct-interface-Z4CpS8tK.mjs";
|
|
3
|
+
import "../clone-DblgEZZa.mjs";
|
|
4
|
+
import { Subscriber, SubscriberBuilder } from "../SubscriberBuilder-BjkbeT9l.mjs";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
var Subscriber = class extends Construct {
|
|
8
|
-
__IS_SUBSCRIBER__ = true;
|
|
9
|
-
static isSubscriber(obj) {
|
|
10
|
-
return Boolean(obj && obj.__IS_SUBSCRIBER__ === true && obj.type === ConstructType.Subscriber);
|
|
11
|
-
}
|
|
12
|
-
constructor(handler, timeout = 3e4, _subscribedEvents, outputSchema, services = [], logger = DEFAULT_LOGGER, publisherService, topicName, constructs = []) {
|
|
13
|
-
super(ConstructType.Subscriber, logger, services, [], publisherService, outputSchema, timeout, void 0, void 0, constructs);
|
|
14
|
-
this.handler = handler;
|
|
15
|
-
this.timeout = timeout;
|
|
16
|
-
this._subscribedEvents = _subscribedEvents;
|
|
17
|
-
this.outputSchema = outputSchema;
|
|
18
|
-
this.services = services;
|
|
19
|
-
this.logger = logger;
|
|
20
|
-
this.publisherService = publisherService;
|
|
21
|
-
this.topicName = topicName;
|
|
22
|
-
}
|
|
23
|
-
get subscribedEvents() {
|
|
24
|
-
return this._subscribedEvents;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/subscribers/SubscriberBuilder.ts
|
|
30
|
-
var SubscriberBuilder = class {
|
|
31
|
-
_subscribedEvents = [];
|
|
32
|
-
_timeout;
|
|
33
|
-
outputSchema;
|
|
34
|
-
_services = [];
|
|
35
|
-
/** The construct ids `.dependsOn()` named — what the manifest records. */
|
|
36
|
-
_constructs = [];
|
|
37
|
-
_logger = DEFAULT_LOGGER;
|
|
38
|
-
_publisher;
|
|
39
|
-
_topicName;
|
|
40
|
-
constructor() {
|
|
41
|
-
this._timeout = 3e4;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Bind this subscriber to a {@link Topic} — the preferred way to type and wire
|
|
45
|
-
* a fan-out consumer. It supplies the subscribable event types (and their
|
|
46
|
-
* payloads) from the topic's contract and records the binding for the manifest,
|
|
47
|
-
* so infra wires the SNS subscription.
|
|
48
|
-
*
|
|
49
|
-
* Prefer this over typing via a hand-written publisher service: a consumer does
|
|
50
|
-
* not publish, so binding a topic does *not* require the topic's publisher
|
|
51
|
-
* connection string (least privilege). Use `.publisher(...)` only when the
|
|
52
|
-
* subscriber actually publishes follow-up events.
|
|
53
|
-
*/
|
|
54
|
-
topic(topic) {
|
|
55
|
-
return cloneWith(this, { _topicName: topic.name });
|
|
56
|
-
}
|
|
57
|
-
timeout(timeout) {
|
|
58
|
-
return cloneWith(this, { _timeout: timeout });
|
|
59
|
-
}
|
|
60
|
-
output(schema) {
|
|
61
|
-
return cloneWith(this, { outputSchema: schema });
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Depend on constructs — a database, a bucket, a mail sender, a queue, a
|
|
65
|
-
* topic.
|
|
66
|
-
*
|
|
67
|
-
* It records the edge and dissolves each construct's client into the
|
|
68
|
-
* handler's service record under the construct's own id, so
|
|
69
|
-
* `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
|
|
70
|
-
*
|
|
71
|
-
* Constructs only. A `Service` does not match the shape, which is what keeps
|
|
72
|
-
* env sniffing confined to `.services()` and the explicit lift.
|
|
73
|
-
*/
|
|
74
|
-
dependsOn(constructs) {
|
|
75
|
-
const services = servicesOf(constructs);
|
|
76
|
-
return cloneWith(this, {
|
|
77
|
-
_services: [...this._services, ...services],
|
|
78
|
-
_constructs: idsOf(constructs, this._constructs)
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
services(services) {
|
|
82
|
-
return cloneWith(this, { _services: [...this._services, ...services] });
|
|
83
|
-
}
|
|
84
|
-
logger(logger) {
|
|
85
|
-
return cloneWith(this, { _logger: logger });
|
|
86
|
-
}
|
|
87
|
-
publisher(publisher) {
|
|
88
|
-
return cloneWith(this, { _publisher: publisher });
|
|
89
|
-
}
|
|
90
|
-
subscribe(event) {
|
|
91
|
-
const eventsToAdd = Array.isArray(event) ? event : [event];
|
|
92
|
-
return cloneWith(this, { _subscribedEvents: [...this._subscribedEvents, ...eventsToAdd] });
|
|
93
|
-
}
|
|
94
|
-
handle(fn) {
|
|
95
|
-
const subscriber = new Subscriber(fn, this._timeout, this._subscribedEvents, this.outputSchema, this._services, this._logger, this._publisher, this._topicName, this._constructs);
|
|
96
|
-
return subscriber;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/subscribers/index.ts
|
|
102
|
-
const s = new SubscriberBuilder();
|
|
103
|
-
|
|
104
|
-
//#endregion
|
|
105
|
-
export { Subscriber, SubscriberBuilder, s };
|
|
106
|
-
//# sourceMappingURL=index.mjs.map
|
|
6
|
+
export { Subscriber, SubscriberBuilder };
|
package/dist/topic/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('../chunk-DWy1uDak.cjs');
|
|
2
|
-
const require_Construct = require('../Construct-
|
|
2
|
+
const require_Construct = require('../Construct-CyS3RpTL.cjs');
|
|
3
3
|
const require_clone = require('../clone-Dy0cR2SZ.cjs');
|
|
4
4
|
const __geekmidas_manifest = require_chunk.__toESM(require("@geekmidas/manifest"));
|
|
5
5
|
const __geekmidas_logger_console = require_chunk.__toESM(require("@geekmidas/logger/console"));
|
package/dist/topic/index.d.cts
CHANGED
|
@@ -1,32 +1,4 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import { Topic, TopicEvents, TopicMessage } from "../Topic-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
//#region src/topic/TopicBuilder.d.ts
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Builds a {@link Topic} — `t.topic('users').events({ 'user.created': schema, … })`.
|
|
9
|
-
* The event map is the topic's contract: it types the derived `topic.publisher`
|
|
10
|
-
* and the subscribers that bind via `s.topic(topic)`.
|
|
11
|
-
*/
|
|
12
|
-
declare class TopicBuilder<TName extends string = string, TEvents extends TopicEvents = TopicEvents> {
|
|
13
|
-
private _name?;
|
|
14
|
-
private _logger;
|
|
15
|
-
/** The topic name — drives the infra topic and its `<NAME>_*` env vars. */
|
|
16
|
-
topic<T extends string>(name: T): TopicBuilder<T, TEvents>;
|
|
17
|
-
logger(logger: Logger): this;
|
|
18
|
-
/**
|
|
19
|
-
* The event contract — a map of event type → payload schema. Building the
|
|
20
|
-
* topic requires this; it's what types the publisher and subscribers.
|
|
21
|
-
*/
|
|
22
|
-
events<T extends TopicEvents>(events: T): Topic<TName, T>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=TopicBuilder.d.ts.map
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/topic/index.d.ts
|
|
27
|
-
declare const t: TopicBuilder<string, TopicEvents>;
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
29
|
-
|
|
30
|
-
//#endregion
|
|
31
|
-
export { Topic, TopicBuilder, TopicEvents, TopicMessage, t };
|
|
32
|
-
//# sourceMappingURL=index.d.cts.map
|
|
1
|
+
import "../Construct-C0ijr2qp.cjs";
|
|
2
|
+
import { Topic, TopicEvents, TopicMessage } from "../Topic-19QeHBIR.cjs";
|
|
3
|
+
import { TopicBuilder, t } from "../index-CBSfrowv.cjs";
|
|
4
|
+
export { Topic, TopicBuilder, TopicEvents, TopicMessage, t };
|