@bella-baxter/fastify 0.1.1-preview.11

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.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @bella-baxter/fastify
3
+ *
4
+ * Fastify plugin — decorates the Fastify instance with a `bella` property
5
+ * containing a live-reloading BellaConfig instance.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import Fastify from 'fastify';
10
+ * import { bellaPlugin } from '@bella-baxter/fastify';
11
+ *
12
+ * const app = Fastify();
13
+ *
14
+ * await app.register(bellaPlugin, {
15
+ * baxterUrl: process.env.BELLA_BAXTER_URL!,
16
+ * environmentSlug: 'production',
17
+ * apiKey: process.env.BELLA_BAXTER_API_KEY!,
18
+ *
19
+ * });
20
+ *
21
+ * app.get('/health', async (request, reply) => {
22
+ * const dbUrl = app.bella.getOrThrow('DATABASE_URL');
23
+ * return { ok: true };
24
+ * });
25
+ *
26
+ * await app.listen({ port: 3000 });
27
+ * ```
28
+ *
29
+ * TypeScript: Fastify augments the type automatically via the plugin declaration.
30
+ */
31
+ import type { FastifyPluginAsync } from 'fastify';
32
+ import { BellaConfig, BellaSecrets, type BellaConfigOptions } from '@bella-baxter/sdk';
33
+ export { BellaConfig, type BellaConfigOptions };
34
+ declare module 'fastify' {
35
+ interface FastifyInstance {
36
+ bella: BellaConfig & BellaSecrets;
37
+ }
38
+ }
39
+ /**
40
+ * Fastify plugin that decorates the Fastify instance with `bella`.
41
+ * Uses `fastify-plugin` to avoid plugin scope isolation (bella is accessible from all routes).
42
+ */
43
+ export declare const bellaPlugin: FastifyPluginAsync<BellaConfigOptions>;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAmB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAqB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE1G,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,CAAC;AAEhD,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,eAAe;QACvB,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;KACnC;CACF;AAgBD;;;GAGG;AACH,eAAO,MAAM,WAAW,wCAGtB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @bella-baxter/fastify
3
+ *
4
+ * Fastify plugin — decorates the Fastify instance with a `bella` property
5
+ * containing a live-reloading BellaConfig instance.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import Fastify from 'fastify';
10
+ * import { bellaPlugin } from '@bella-baxter/fastify';
11
+ *
12
+ * const app = Fastify();
13
+ *
14
+ * await app.register(bellaPlugin, {
15
+ * baxterUrl: process.env.BELLA_BAXTER_URL!,
16
+ * environmentSlug: 'production',
17
+ * apiKey: process.env.BELLA_BAXTER_API_KEY!,
18
+ *
19
+ * });
20
+ *
21
+ * app.get('/health', async (request, reply) => {
22
+ * const dbUrl = app.bella.getOrThrow('DATABASE_URL');
23
+ * return { ok: true };
24
+ * });
25
+ *
26
+ * await app.listen({ port: 3000 });
27
+ * ```
28
+ *
29
+ * TypeScript: Fastify augments the type automatically via the plugin declaration.
30
+ */
31
+ import fp from 'fastify-plugin';
32
+ import { BellaConfig, createBellaConfig } from '@bella-baxter/sdk';
33
+ export { BellaConfig };
34
+ const bellaPluginImpl = async (fastify, options) => {
35
+ const bella = await createBellaConfig(options);
36
+ fastify.decorate('bella', bella);
37
+ fastify.addHook('onClose', (_instance, done) => {
38
+ bella.destroy();
39
+ done();
40
+ });
41
+ };
42
+ /**
43
+ * Fastify plugin that decorates the Fastify instance with `bella`.
44
+ * Uses `fastify-plugin` to avoid plugin scope isolation (bella is accessible from all routes).
45
+ */
46
+ export const bellaPlugin = fp(bellaPluginImpl, {
47
+ fastify: '>=4',
48
+ name: 'bella-baxter',
49
+ });
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAgB,iBAAiB,EAA2B,MAAM,mBAAmB,CAAC;AAE1G,OAAO,EAAE,WAAW,EAA2B,CAAC;AAQhD,MAAM,eAAe,GAA2C,KAAK,EACnE,OAAwB,EACxB,OAA2B,EAC3B,EAAE;IACF,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAE/C,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAEjC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE;QAC7C,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC,eAAe,EAAE;IAC7C,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,cAAc;CACrB,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@bella-baxter/fastify",
3
+ "version": "0.1.1-preview.11",
4
+ "description": "Bella Baxter Fastify plugin — decorates the Fastify instance with live-reloading secrets",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "dependencies": {
18
+ "@bella-baxter/sdk": "0.1.1-preview.11"
19
+ },
20
+ "peerDependencies": {
21
+ "fastify": ">=4",
22
+ "fastify-plugin": ">=4"
23
+ },
24
+ "devDependencies": {
25
+ "typescript": "^5.9.3",
26
+ "@types/node": "^25.5.0",
27
+ "fastify": "^5.8.2",
28
+ "fastify-plugin": "^5.1.0"
29
+ },
30
+ "keywords": [
31
+ "bella-baxter",
32
+ "secrets",
33
+ "fastify",
34
+ "plugin"
35
+ ],
36
+ "license": "MIT",
37
+ "scripts": {
38
+ "build": "tsc",
39
+ "typecheck": "tsc --noEmit"
40
+ }
41
+ }