@geekmidas/manifest 9.1.0 → 9.2.1
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 +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +19 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @geekmidas/manifest
|
|
2
2
|
|
|
3
|
+
## 9.2.1
|
|
4
|
+
|
|
5
|
+
## 9.2.0
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- [#312](https://github.com/geekmidas/toolbox/pull/312) [`bccee5d`](https://github.com/geekmidas/toolbox/commit/bccee5d54b3675f284cd7380c8a1293fdfb6afb7) Thanks [@geekmidas](https://github.com/geekmidas)! - The manifest records each construct's monitors
|
|
10
|
+
|
|
11
|
+
Functions, crons and routes set with `.monitor()` now carry a `monitoring` list in the build manifest, so infrastructure can provision what they report to without reading the code:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
{
|
|
15
|
+
name: 'nightlySync',
|
|
16
|
+
schedule: 'cron(0 8 * * ? *)',
|
|
17
|
+
environment: ['MONITORING_URL'],
|
|
18
|
+
monitoring: [{ type: 'heartbeat', provider: 'betterStack', env: 'MONITORING_URL' }],
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`heartbeat.betterStack()` and `heartbeat.healthchecks()` record their provider; a custom `heartbeat()` records only its `env`, and a hand-written monitor its service name as `type`. A construct without monitors has no `monitoring` field. On the `server` provider, where one route serves the whole app, that route lists the distinct monitors across its endpoints.
|
|
23
|
+
|
|
24
|
+
A heartbeat's URL variable is now required rather than optional, so the manifest lists it as `MONITORING_URL` instead of `MONITORING_URL?` and a deploy that does not set it is caught. If it is still missing at runtime, the monitor is skipped with a warning and the run goes on.
|
|
25
|
+
|
|
3
26
|
## 9.1.0
|
|
4
27
|
|
|
5
28
|
## 9.0.2
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["field: ManifestField<T> | undefined"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Deployment manifest types — the build output of `gkm build` that enumerates a\n * project's deployable units (routes, functions, crons, subscribers, queues)\n * with the metadata an infrastructure layer needs to provision them.\n *\n * `gkm build` writes a single TypeScript module per provider\n * (`<out>/manifest/aws.ts`) of the form:\n *\n * ```ts\n * export const manifest = { routes: [...], functions: [...], ... } as const;\n * export type Route = (typeof manifest.routes)[number];\n * // ...derived types\n * ```\n *\n * This is the dependency-free data contract shared between the producer\n * (`@geekmidas/cli`) and consumers (e.g. `@geekmidas/cloud/sst`'s `fromManifest`\n * integrators).\n */\n\n/**\n * A manifest field is either a flat list or, when the build is partitioned\n * (e.g. by authorizer), an object keyed by partition name. Readonly-tolerant so\n * the `as const` generated manifest assigns cleanly.\n */\nexport type ManifestField<T> =\n\t| readonly T[]\n\t| Readonly<Record<string, readonly T[]>>;\n\n/** Flatten a manifest field (array or partitioned) into a plain array. */\nexport function flattenManifestField<T>(\n\tfield: ManifestField<T> | undefined,\n): T[] {\n\tif (!field) return [];\n\treturn Array.isArray(field)\n\t\t? [...field]\n\t\t: Object.values(field as Record<string, readonly T[]>).flat();\n}\n\n/** A single HTTP route. */\nexport interface RouteInfo {\n\t/** Route path, e.g. `/users/{id}`. */\n\tpath: string;\n\t/** HTTP method, e.g. `GET`. */\n\tmethod: string;\n\t/** Bundled handler entrypoint. */\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\t/** Required environment variables (a trailing `?` marks an optional var). */\n\tenvironment?: readonly string[];\n\t/** Authorizer name: `none`, `iam`, or a declared authorizer. */\n\tauthorizer: string;\n}\n\n/** A standalone Lambda function. */\nexport interface FunctionInfo {\n\tname: string;\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/** A scheduled (cron) function. */\nexport interface CronInfo {\n\tname: string;\n\thandler: string;\n\t/** Schedule expression, e.g. `rate(1 day)` or `cron(0 12 * * ? *)`. */\n\tschedule: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/** An event subscriber function (topic/queue resolved by `transport`). */\nexport interface SubscriberInfo {\n\tname: string;\n\thandler: string;\n\tsubscribedEvents: readonly string[];\n\t/** Delivery transport — `topic` (SNS fan-out) or `queue` (SQS). */\n\ttransport?: 'topic' | 'queue';\n\t/** The {@link TopicInfo.name} this subscriber binds to (via `s.topic(topic)`). */\n\ttopic?: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * A pub/sub topic — fan-out. A *resource* (no handler): it declares the event\n * contract; producers publish via the derived publisher and {@link SubscriberInfo}s\n * bind to it. Infra provisions an SNS topic.\n */\nexport interface TopicInfo {\n\tname: string;\n\t/** The event type names this topic carries. */\n\tevents: readonly string[];\n\t/** Whether the topic is FIFO. */\n\tfifo?: boolean;\n}\n\n/** A queue worker — a queue and its single consumer. */\nexport interface QueueInfo {\n\tname: string;\n\thandler: string;\n\t/** SQS event-source batch size. */\n\tbatchSize?: number;\n\t/** Whether the queue is FIFO. */\n\tfifo?: boolean;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * The full deployment manifest — the shape of `export const manifest` in a\n * generated `manifest/<provider>.ts`. Each field is a {@link ManifestField}\n * (flat or partitioned).\n */\nexport interface Manifest {\n\troutes: ManifestField<RouteInfo>;\n\tfunctions?: ManifestField<FunctionInfo>;\n\tcrons?: ManifestField<CronInfo>;\n\tsubscribers?: ManifestField<SubscriberInfo>;\n\tqueues?: ManifestField<QueueInfo>;\n\ttopics?: ManifestField<TopicInfo>;\n}\n"],"mappings":";;;AA6BA,SAAgB,qBACfA,OACM;AACN,MAAK,MAAO,QAAO,CAAE;AACrB,QAAO,MAAM,QAAQ,MAAM,GACxB,CAAC,GAAG,KAAM,IACV,OAAO,OAAO,MAAsC,CAAC,MAAM;AAC9D"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["field: ManifestField<T> | undefined"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Deployment manifest types — the build output of `gkm build` that enumerates a\n * project's deployable units (routes, functions, crons, subscribers, queues)\n * with the metadata an infrastructure layer needs to provision them.\n *\n * `gkm build` writes a single TypeScript module per provider\n * (`<out>/manifest/aws.ts`) of the form:\n *\n * ```ts\n * export const manifest = { routes: [...], functions: [...], ... } as const;\n * export type Route = (typeof manifest.routes)[number];\n * // ...derived types\n * ```\n *\n * This is the dependency-free data contract shared between the producer\n * (`@geekmidas/cli`) and consumers (e.g. `@geekmidas/cloud/sst`'s `fromManifest`\n * integrators).\n */\n\n/**\n * A manifest field is either a flat list or, when the build is partitioned\n * (e.g. by authorizer), an object keyed by partition name. Readonly-tolerant so\n * the `as const` generated manifest assigns cleanly.\n */\nexport type ManifestField<T> =\n\t| readonly T[]\n\t| Readonly<Record<string, readonly T[]>>;\n\n/** Flatten a manifest field (array or partitioned) into a plain array. */\nexport function flattenManifestField<T>(\n\tfield: ManifestField<T> | undefined,\n): T[] {\n\tif (!field) return [];\n\treturn Array.isArray(field)\n\t\t? [...field]\n\t\t: Object.values(field as Record<string, readonly T[]>).flat();\n}\n\n/**\n * A monitor set with `.monitor()`, so infrastructure can provision what it\n * reports to, e.g. create a heartbeat and set its URL in `env`.\n */\nexport interface MonitorInfo {\n\t/** The kind of monitor, e.g. `heartbeat`. */\n\ttype: string;\n\t/** The service it reports to, e.g. `betterStack`. Absent for a custom one. */\n\tprovider?: string;\n\t/** The environment variable it reads its target from. */\n\tenv?: string;\n}\n\n/** A single HTTP route. */\nexport interface RouteInfo {\n\t/** Route path, e.g. `/users/{id}`. */\n\tpath: string;\n\t/** HTTP method, e.g. `GET`. */\n\tmethod: string;\n\t/** Bundled handler entrypoint. */\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\t/** Required environment variables (a trailing `?` marks an optional var). */\n\tenvironment?: readonly string[];\n\t/** Authorizer name: `none`, `iam`, or a declared authorizer. */\n\tauthorizer: string;\n\t/** Monitors set with `.monitor()`; absent when there are none. */\n\tmonitoring?: readonly MonitorInfo[];\n}\n\n/** A standalone Lambda function. */\nexport interface FunctionInfo {\n\tname: string;\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n\t/** Monitors set with `.monitor()`; absent when there are none. */\n\tmonitoring?: readonly MonitorInfo[];\n}\n\n/** A scheduled (cron) function. */\nexport interface CronInfo {\n\tname: string;\n\thandler: string;\n\t/** Schedule expression, e.g. `rate(1 day)` or `cron(0 12 * * ? *)`. */\n\tschedule: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n\t/** Monitors set with `.monitor()`; absent when there are none. */\n\tmonitoring?: readonly MonitorInfo[];\n}\n\n/** An event subscriber function (topic/queue resolved by `transport`). */\nexport interface SubscriberInfo {\n\tname: string;\n\thandler: string;\n\tsubscribedEvents: readonly string[];\n\t/** Delivery transport — `topic` (SNS fan-out) or `queue` (SQS). */\n\ttransport?: 'topic' | 'queue';\n\t/** The {@link TopicInfo.name} this subscriber binds to (via `s.topic(topic)`). */\n\ttopic?: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * A pub/sub topic — fan-out. A *resource* (no handler): it declares the event\n * contract; producers publish via the derived publisher and {@link SubscriberInfo}s\n * bind to it. Infra provisions an SNS topic.\n */\nexport interface TopicInfo {\n\tname: string;\n\t/** The event type names this topic carries. */\n\tevents: readonly string[];\n\t/** Whether the topic is FIFO. */\n\tfifo?: boolean;\n}\n\n/** A queue worker — a queue and its single consumer. */\nexport interface QueueInfo {\n\tname: string;\n\thandler: string;\n\t/** SQS event-source batch size. */\n\tbatchSize?: number;\n\t/** Whether the queue is FIFO. */\n\tfifo?: boolean;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * The full deployment manifest — the shape of `export const manifest` in a\n * generated `manifest/<provider>.ts`. Each field is a {@link ManifestField}\n * (flat or partitioned).\n */\nexport interface Manifest {\n\troutes: ManifestField<RouteInfo>;\n\tfunctions?: ManifestField<FunctionInfo>;\n\tcrons?: ManifestField<CronInfo>;\n\tsubscribers?: ManifestField<SubscriberInfo>;\n\tqueues?: ManifestField<QueueInfo>;\n\ttopics?: ManifestField<TopicInfo>;\n}\n"],"mappings":";;;AA6BA,SAAgB,qBACfA,OACM;AACN,MAAK,MAAO,QAAO,CAAE;AACrB,QAAO,MAAM,QAAQ,MAAM,GACxB,CAAC,GAAG,KAAM,IACV,OAAO,OAAO,MAAsC,CAAC,MAAM;AAC9D"}
|
package/dist/index.d.cts
CHANGED
|
@@ -25,6 +25,18 @@
|
|
|
25
25
|
type ManifestField<T> = readonly T[] | Readonly<Record<string, readonly T[]>>;
|
|
26
26
|
/** Flatten a manifest field (array or partitioned) into a plain array. */
|
|
27
27
|
declare function flattenManifestField<T>(field: ManifestField<T> | undefined): T[];
|
|
28
|
+
/**
|
|
29
|
+
* A monitor set with `.monitor()`, so infrastructure can provision what it
|
|
30
|
+
* reports to, e.g. create a heartbeat and set its URL in `env`.
|
|
31
|
+
*/
|
|
32
|
+
interface MonitorInfo {
|
|
33
|
+
/** The kind of monitor, e.g. `heartbeat`. */
|
|
34
|
+
type: string;
|
|
35
|
+
/** The service it reports to, e.g. `betterStack`. Absent for a custom one. */
|
|
36
|
+
provider?: string;
|
|
37
|
+
/** The environment variable it reads its target from. */
|
|
38
|
+
env?: string;
|
|
39
|
+
}
|
|
28
40
|
/** A single HTTP route. */
|
|
29
41
|
interface RouteInfo {
|
|
30
42
|
/** Route path, e.g. `/users/{id}`. */
|
|
@@ -39,6 +51,8 @@ interface RouteInfo {
|
|
|
39
51
|
environment?: readonly string[];
|
|
40
52
|
/** Authorizer name: `none`, `iam`, or a declared authorizer. */
|
|
41
53
|
authorizer: string;
|
|
54
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
55
|
+
monitoring?: readonly MonitorInfo[];
|
|
42
56
|
}
|
|
43
57
|
/** A standalone Lambda function. */
|
|
44
58
|
interface FunctionInfo {
|
|
@@ -47,6 +61,8 @@ interface FunctionInfo {
|
|
|
47
61
|
timeout?: number;
|
|
48
62
|
memorySize?: number;
|
|
49
63
|
environment?: readonly string[];
|
|
64
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
65
|
+
monitoring?: readonly MonitorInfo[];
|
|
50
66
|
}
|
|
51
67
|
/** A scheduled (cron) function. */
|
|
52
68
|
interface CronInfo {
|
|
@@ -57,6 +73,8 @@ interface CronInfo {
|
|
|
57
73
|
timeout?: number;
|
|
58
74
|
memorySize?: number;
|
|
59
75
|
environment?: readonly string[];
|
|
76
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
77
|
+
monitoring?: readonly MonitorInfo[];
|
|
60
78
|
}
|
|
61
79
|
/** An event subscriber function (topic/queue resolved by `transport`). */
|
|
62
80
|
interface SubscriberInfo {
|
|
@@ -110,5 +128,5 @@ interface Manifest {
|
|
|
110
128
|
}
|
|
111
129
|
//# sourceMappingURL=index.d.ts.map
|
|
112
130
|
//#endregion
|
|
113
|
-
export { CronInfo, FunctionInfo, Manifest, ManifestField, QueueInfo, RouteInfo, SubscriberInfo, TopicInfo, flattenManifestField };
|
|
131
|
+
export { CronInfo, FunctionInfo, Manifest, ManifestField, MonitorInfo, QueueInfo, RouteInfo, SubscriberInfo, TopicInfo, flattenManifestField };
|
|
114
132
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;;AAEW;AAGX;;;;;AAEI;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;;AAEW;AAGX;;;;;AAEI;AAWJ;AAUA;AAkBA;AAWA;AAaA;AAkBA;AASA;AAiBA;;AACuB,KAnHX,aAmHW,CAAA,CAAA,CAAA,GAAA,SAlHX,CAkHW,EAAA,GAjHpB,QAiHoB,CAjHX,MAiHW,CAAA,MAAA,EAAA,SAjHa,CAiHb,EAAA,CAAA,CAAA;;AACI,iBA/GX,oBA+GW,CAAA,CAAA,CAAA,CAAA,KAAA,EA9GnB,aA8GmB,CA9GL,CA8GK,CAAA,GAAA,SAAA,CAAA,EA7GxB,CA6GwB,EAAA;;;;;AAEZ,UApGE,WAAA,CAoGF;EAAa;EACK,IAAvB,EAAA,MAAA;EAAa;EACU,QAAvB,CAAA,EAAA,MAAA;EAAa;;;;UA5FN,SAAA;;;;;;;;;;;;;;wBAcM;;;UAIN,YAAA;;;;;;;wBAOM;;;UAIN,QAAA;;;;;;;;;wBASM;;;UAIN,cAAA;;;;;;;;;;;;;;;;;UAkBA,SAAA;;;;;;;;UASA,SAAA;;;;;;;;;;;;;;;;UAiBA,QAAA;UACR,cAAc;cACV,cAAc;UAClB,cAAc;gBACR,cAAc;WACnB,cAAc;WACd,cAAc"}
|
package/dist/index.d.mts
CHANGED
|
@@ -25,6 +25,18 @@
|
|
|
25
25
|
type ManifestField<T> = readonly T[] | Readonly<Record<string, readonly T[]>>;
|
|
26
26
|
/** Flatten a manifest field (array or partitioned) into a plain array. */
|
|
27
27
|
declare function flattenManifestField<T>(field: ManifestField<T> | undefined): T[];
|
|
28
|
+
/**
|
|
29
|
+
* A monitor set with `.monitor()`, so infrastructure can provision what it
|
|
30
|
+
* reports to, e.g. create a heartbeat and set its URL in `env`.
|
|
31
|
+
*/
|
|
32
|
+
interface MonitorInfo {
|
|
33
|
+
/** The kind of monitor, e.g. `heartbeat`. */
|
|
34
|
+
type: string;
|
|
35
|
+
/** The service it reports to, e.g. `betterStack`. Absent for a custom one. */
|
|
36
|
+
provider?: string;
|
|
37
|
+
/** The environment variable it reads its target from. */
|
|
38
|
+
env?: string;
|
|
39
|
+
}
|
|
28
40
|
/** A single HTTP route. */
|
|
29
41
|
interface RouteInfo {
|
|
30
42
|
/** Route path, e.g. `/users/{id}`. */
|
|
@@ -39,6 +51,8 @@ interface RouteInfo {
|
|
|
39
51
|
environment?: readonly string[];
|
|
40
52
|
/** Authorizer name: `none`, `iam`, or a declared authorizer. */
|
|
41
53
|
authorizer: string;
|
|
54
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
55
|
+
monitoring?: readonly MonitorInfo[];
|
|
42
56
|
}
|
|
43
57
|
/** A standalone Lambda function. */
|
|
44
58
|
interface FunctionInfo {
|
|
@@ -47,6 +61,8 @@ interface FunctionInfo {
|
|
|
47
61
|
timeout?: number;
|
|
48
62
|
memorySize?: number;
|
|
49
63
|
environment?: readonly string[];
|
|
64
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
65
|
+
monitoring?: readonly MonitorInfo[];
|
|
50
66
|
}
|
|
51
67
|
/** A scheduled (cron) function. */
|
|
52
68
|
interface CronInfo {
|
|
@@ -57,6 +73,8 @@ interface CronInfo {
|
|
|
57
73
|
timeout?: number;
|
|
58
74
|
memorySize?: number;
|
|
59
75
|
environment?: readonly string[];
|
|
76
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
77
|
+
monitoring?: readonly MonitorInfo[];
|
|
60
78
|
}
|
|
61
79
|
/** An event subscriber function (topic/queue resolved by `transport`). */
|
|
62
80
|
interface SubscriberInfo {
|
|
@@ -110,5 +128,5 @@ interface Manifest {
|
|
|
110
128
|
}
|
|
111
129
|
//# sourceMappingURL=index.d.ts.map
|
|
112
130
|
//#endregion
|
|
113
|
-
export { CronInfo, FunctionInfo, Manifest, ManifestField, QueueInfo, RouteInfo, SubscriberInfo, TopicInfo, flattenManifestField };
|
|
131
|
+
export { CronInfo, FunctionInfo, Manifest, ManifestField, MonitorInfo, QueueInfo, RouteInfo, SubscriberInfo, TopicInfo, flattenManifestField };
|
|
114
132
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;;AAEW;AAGX;;;;;AAEI;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;AAwBA;;;;;;AAEW;AAGX;;;;;AAEI;AAWJ;AAUA;AAkBA;AAWA;AAaA;AAkBA;AASA;AAiBA;;AACuB,KAnHX,aAmHW,CAAA,CAAA,CAAA,GAAA,SAlHX,CAkHW,EAAA,GAjHpB,QAiHoB,CAjHX,MAiHW,CAAA,MAAA,EAAA,SAjHa,CAiHb,EAAA,CAAA,CAAA;;AACI,iBA/GX,oBA+GW,CAAA,CAAA,CAAA,CAAA,KAAA,EA9GnB,aA8GmB,CA9GL,CA8GK,CAAA,GAAA,SAAA,CAAA,EA7GxB,CA6GwB,EAAA;;;;;AAEZ,UApGE,WAAA,CAoGF;EAAa;EACK,IAAvB,EAAA,MAAA;EAAa;EACU,QAAvB,CAAA,EAAA,MAAA;EAAa;;;;UA5FN,SAAA;;;;;;;;;;;;;;wBAcM;;;UAIN,YAAA;;;;;;;wBAOM;;;UAIN,QAAA;;;;;;;;;wBASM;;;UAIN,cAAA;;;;;;;;;;;;;;;;;UAkBA,SAAA;;;;;;;;UASA,SAAA;;;;;;;;;;;;;;;;UAiBA,QAAA;UACR,cAAc;cACV,cAAc;UAClB,cAAc;gBACR,cAAc;WACnB,cAAc;WACd,cAAc"}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["field: ManifestField<T> | undefined"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Deployment manifest types — the build output of `gkm build` that enumerates a\n * project's deployable units (routes, functions, crons, subscribers, queues)\n * with the metadata an infrastructure layer needs to provision them.\n *\n * `gkm build` writes a single TypeScript module per provider\n * (`<out>/manifest/aws.ts`) of the form:\n *\n * ```ts\n * export const manifest = { routes: [...], functions: [...], ... } as const;\n * export type Route = (typeof manifest.routes)[number];\n * // ...derived types\n * ```\n *\n * This is the dependency-free data contract shared between the producer\n * (`@geekmidas/cli`) and consumers (e.g. `@geekmidas/cloud/sst`'s `fromManifest`\n * integrators).\n */\n\n/**\n * A manifest field is either a flat list or, when the build is partitioned\n * (e.g. by authorizer), an object keyed by partition name. Readonly-tolerant so\n * the `as const` generated manifest assigns cleanly.\n */\nexport type ManifestField<T> =\n\t| readonly T[]\n\t| Readonly<Record<string, readonly T[]>>;\n\n/** Flatten a manifest field (array or partitioned) into a plain array. */\nexport function flattenManifestField<T>(\n\tfield: ManifestField<T> | undefined,\n): T[] {\n\tif (!field) return [];\n\treturn Array.isArray(field)\n\t\t? [...field]\n\t\t: Object.values(field as Record<string, readonly T[]>).flat();\n}\n\n/** A single HTTP route. */\nexport interface RouteInfo {\n\t/** Route path, e.g. `/users/{id}`. */\n\tpath: string;\n\t/** HTTP method, e.g. `GET`. */\n\tmethod: string;\n\t/** Bundled handler entrypoint. */\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\t/** Required environment variables (a trailing `?` marks an optional var). */\n\tenvironment?: readonly string[];\n\t/** Authorizer name: `none`, `iam`, or a declared authorizer. */\n\tauthorizer: string;\n}\n\n/** A standalone Lambda function. */\nexport interface FunctionInfo {\n\tname: string;\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/** A scheduled (cron) function. */\nexport interface CronInfo {\n\tname: string;\n\thandler: string;\n\t/** Schedule expression, e.g. `rate(1 day)` or `cron(0 12 * * ? *)`. */\n\tschedule: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/** An event subscriber function (topic/queue resolved by `transport`). */\nexport interface SubscriberInfo {\n\tname: string;\n\thandler: string;\n\tsubscribedEvents: readonly string[];\n\t/** Delivery transport — `topic` (SNS fan-out) or `queue` (SQS). */\n\ttransport?: 'topic' | 'queue';\n\t/** The {@link TopicInfo.name} this subscriber binds to (via `s.topic(topic)`). */\n\ttopic?: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * A pub/sub topic — fan-out. A *resource* (no handler): it declares the event\n * contract; producers publish via the derived publisher and {@link SubscriberInfo}s\n * bind to it. Infra provisions an SNS topic.\n */\nexport interface TopicInfo {\n\tname: string;\n\t/** The event type names this topic carries. */\n\tevents: readonly string[];\n\t/** Whether the topic is FIFO. */\n\tfifo?: boolean;\n}\n\n/** A queue worker — a queue and its single consumer. */\nexport interface QueueInfo {\n\tname: string;\n\thandler: string;\n\t/** SQS event-source batch size. */\n\tbatchSize?: number;\n\t/** Whether the queue is FIFO. */\n\tfifo?: boolean;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * The full deployment manifest — the shape of `export const manifest` in a\n * generated `manifest/<provider>.ts`. Each field is a {@link ManifestField}\n * (flat or partitioned).\n */\nexport interface Manifest {\n\troutes: ManifestField<RouteInfo>;\n\tfunctions?: ManifestField<FunctionInfo>;\n\tcrons?: ManifestField<CronInfo>;\n\tsubscribers?: ManifestField<SubscriberInfo>;\n\tqueues?: ManifestField<QueueInfo>;\n\ttopics?: ManifestField<TopicInfo>;\n}\n"],"mappings":";;AA6BA,SAAgB,qBACfA,OACM;AACN,MAAK,MAAO,QAAO,CAAE;AACrB,QAAO,MAAM,QAAQ,MAAM,GACxB,CAAC,GAAG,KAAM,IACV,OAAO,OAAO,MAAsC,CAAC,MAAM;AAC9D"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["field: ManifestField<T> | undefined"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * Deployment manifest types — the build output of `gkm build` that enumerates a\n * project's deployable units (routes, functions, crons, subscribers, queues)\n * with the metadata an infrastructure layer needs to provision them.\n *\n * `gkm build` writes a single TypeScript module per provider\n * (`<out>/manifest/aws.ts`) of the form:\n *\n * ```ts\n * export const manifest = { routes: [...], functions: [...], ... } as const;\n * export type Route = (typeof manifest.routes)[number];\n * // ...derived types\n * ```\n *\n * This is the dependency-free data contract shared between the producer\n * (`@geekmidas/cli`) and consumers (e.g. `@geekmidas/cloud/sst`'s `fromManifest`\n * integrators).\n */\n\n/**\n * A manifest field is either a flat list or, when the build is partitioned\n * (e.g. by authorizer), an object keyed by partition name. Readonly-tolerant so\n * the `as const` generated manifest assigns cleanly.\n */\nexport type ManifestField<T> =\n\t| readonly T[]\n\t| Readonly<Record<string, readonly T[]>>;\n\n/** Flatten a manifest field (array or partitioned) into a plain array. */\nexport function flattenManifestField<T>(\n\tfield: ManifestField<T> | undefined,\n): T[] {\n\tif (!field) return [];\n\treturn Array.isArray(field)\n\t\t? [...field]\n\t\t: Object.values(field as Record<string, readonly T[]>).flat();\n}\n\n/**\n * A monitor set with `.monitor()`, so infrastructure can provision what it\n * reports to, e.g. create a heartbeat and set its URL in `env`.\n */\nexport interface MonitorInfo {\n\t/** The kind of monitor, e.g. `heartbeat`. */\n\ttype: string;\n\t/** The service it reports to, e.g. `betterStack`. Absent for a custom one. */\n\tprovider?: string;\n\t/** The environment variable it reads its target from. */\n\tenv?: string;\n}\n\n/** A single HTTP route. */\nexport interface RouteInfo {\n\t/** Route path, e.g. `/users/{id}`. */\n\tpath: string;\n\t/** HTTP method, e.g. `GET`. */\n\tmethod: string;\n\t/** Bundled handler entrypoint. */\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\t/** Required environment variables (a trailing `?` marks an optional var). */\n\tenvironment?: readonly string[];\n\t/** Authorizer name: `none`, `iam`, or a declared authorizer. */\n\tauthorizer: string;\n\t/** Monitors set with `.monitor()`; absent when there are none. */\n\tmonitoring?: readonly MonitorInfo[];\n}\n\n/** A standalone Lambda function. */\nexport interface FunctionInfo {\n\tname: string;\n\thandler: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n\t/** Monitors set with `.monitor()`; absent when there are none. */\n\tmonitoring?: readonly MonitorInfo[];\n}\n\n/** A scheduled (cron) function. */\nexport interface CronInfo {\n\tname: string;\n\thandler: string;\n\t/** Schedule expression, e.g. `rate(1 day)` or `cron(0 12 * * ? *)`. */\n\tschedule: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n\t/** Monitors set with `.monitor()`; absent when there are none. */\n\tmonitoring?: readonly MonitorInfo[];\n}\n\n/** An event subscriber function (topic/queue resolved by `transport`). */\nexport interface SubscriberInfo {\n\tname: string;\n\thandler: string;\n\tsubscribedEvents: readonly string[];\n\t/** Delivery transport — `topic` (SNS fan-out) or `queue` (SQS). */\n\ttransport?: 'topic' | 'queue';\n\t/** The {@link TopicInfo.name} this subscriber binds to (via `s.topic(topic)`). */\n\ttopic?: string;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * A pub/sub topic — fan-out. A *resource* (no handler): it declares the event\n * contract; producers publish via the derived publisher and {@link SubscriberInfo}s\n * bind to it. Infra provisions an SNS topic.\n */\nexport interface TopicInfo {\n\tname: string;\n\t/** The event type names this topic carries. */\n\tevents: readonly string[];\n\t/** Whether the topic is FIFO. */\n\tfifo?: boolean;\n}\n\n/** A queue worker — a queue and its single consumer. */\nexport interface QueueInfo {\n\tname: string;\n\thandler: string;\n\t/** SQS event-source batch size. */\n\tbatchSize?: number;\n\t/** Whether the queue is FIFO. */\n\tfifo?: boolean;\n\ttimeout?: number;\n\tmemorySize?: number;\n\tenvironment?: readonly string[];\n}\n\n/**\n * The full deployment manifest — the shape of `export const manifest` in a\n * generated `manifest/<provider>.ts`. Each field is a {@link ManifestField}\n * (flat or partitioned).\n */\nexport interface Manifest {\n\troutes: ManifestField<RouteInfo>;\n\tfunctions?: ManifestField<FunctionInfo>;\n\tcrons?: ManifestField<CronInfo>;\n\tsubscribers?: ManifestField<SubscriberInfo>;\n\tqueues?: ManifestField<QueueInfo>;\n\ttopics?: ManifestField<TopicInfo>;\n}\n"],"mappings":";;AA6BA,SAAgB,qBACfA,OACM;AACN,MAAK,MAAO,QAAO,CAAE;AACrB,QAAO,MAAM,QAAQ,MAAM,GACxB,CAAC,GAAG,KAAM,IACV,OAAO,OAAO,MAAsC,CAAC,MAAM;AAC9D"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -36,6 +36,19 @@ export function flattenManifestField<T>(
|
|
|
36
36
|
: Object.values(field as Record<string, readonly T[]>).flat();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* A monitor set with `.monitor()`, so infrastructure can provision what it
|
|
41
|
+
* reports to, e.g. create a heartbeat and set its URL in `env`.
|
|
42
|
+
*/
|
|
43
|
+
export interface MonitorInfo {
|
|
44
|
+
/** The kind of monitor, e.g. `heartbeat`. */
|
|
45
|
+
type: string;
|
|
46
|
+
/** The service it reports to, e.g. `betterStack`. Absent for a custom one. */
|
|
47
|
+
provider?: string;
|
|
48
|
+
/** The environment variable it reads its target from. */
|
|
49
|
+
env?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
/** A single HTTP route. */
|
|
40
53
|
export interface RouteInfo {
|
|
41
54
|
/** Route path, e.g. `/users/{id}`. */
|
|
@@ -50,6 +63,8 @@ export interface RouteInfo {
|
|
|
50
63
|
environment?: readonly string[];
|
|
51
64
|
/** Authorizer name: `none`, `iam`, or a declared authorizer. */
|
|
52
65
|
authorizer: string;
|
|
66
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
67
|
+
monitoring?: readonly MonitorInfo[];
|
|
53
68
|
}
|
|
54
69
|
|
|
55
70
|
/** A standalone Lambda function. */
|
|
@@ -59,6 +74,8 @@ export interface FunctionInfo {
|
|
|
59
74
|
timeout?: number;
|
|
60
75
|
memorySize?: number;
|
|
61
76
|
environment?: readonly string[];
|
|
77
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
78
|
+
monitoring?: readonly MonitorInfo[];
|
|
62
79
|
}
|
|
63
80
|
|
|
64
81
|
/** A scheduled (cron) function. */
|
|
@@ -70,6 +87,8 @@ export interface CronInfo {
|
|
|
70
87
|
timeout?: number;
|
|
71
88
|
memorySize?: number;
|
|
72
89
|
environment?: readonly string[];
|
|
90
|
+
/** Monitors set with `.monitor()`; absent when there are none. */
|
|
91
|
+
monitoring?: readonly MonitorInfo[];
|
|
73
92
|
}
|
|
74
93
|
|
|
75
94
|
/** An event subscriber function (topic/queue resolved by `transport`). */
|