@molecule/api-bonds-default-express 1.0.0
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/LICENSE +115 -0
- package/dist/billing.d.ts +54 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +228 -0
- package/dist/browser-guard.d.ts +2 -0
- package/dist/browser-guard.d.ts.map +1 -0
- package/dist/browser-guard.js +18 -0
- package/dist/handlers.d.ts +91 -0
- package/dist/handlers.d.ts.map +1 -0
- package/dist/handlers.js +128 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/middleware.d.ts +23 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +41 -0
- package/dist/migrate.d.ts +17 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +16 -0
- package/dist/resources.d.ts +18 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +18 -0
- package/dist/routes.d.ts +124 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +166 -0
- package/dist/schemas.d.ts +23 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +18 -0
- package/dist/setup.d.ts +132 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +507 -0
- package/package.json +377 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common zod schemas extracted from inline duplicates across the fleet:
|
|
3
|
+
* - 91 apps inline `z.object({ id: z.string().min(1) })`
|
|
4
|
+
* - 43 apps inline `z.object({ id: z.string().uuid() })`
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
/**
|
|
10
|
+
* Standard route-param schema for `:id`. Accepts any non-empty string.
|
|
11
|
+
* Pair with `validateParams(idParamSchema)`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const idParamSchema: z.ZodObject<{
|
|
14
|
+
id: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/**
|
|
17
|
+
* Strict variant of `idParamSchema` that requires a UUID. Use when the
|
|
18
|
+
* underlying column is a uuid.
|
|
19
|
+
*/
|
|
20
|
+
export declare const uuidParamSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;GAGG;AACH,eAAO,MAAM,aAAa;;iBAAsC,CAAA;AAEhE;;;GAGG;AACH,eAAO,MAAM,eAAe;;iBAAsC,CAAA"}
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common zod schemas extracted from inline duplicates across the fleet:
|
|
3
|
+
* - 91 apps inline `z.object({ id: z.string().min(1) })`
|
|
4
|
+
* - 43 apps inline `z.object({ id: z.string().uuid() })`
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
/**
|
|
10
|
+
* Standard route-param schema for `:id`. Accepts any non-empty string.
|
|
11
|
+
* Pair with `validateParams(idParamSchema)`.
|
|
12
|
+
*/
|
|
13
|
+
export const idParamSchema = z.object({ id: z.string().min(1) });
|
|
14
|
+
/**
|
|
15
|
+
* Strict variant of `idParamSchema` that requires a UUID. Use when the
|
|
16
|
+
* underlying column is a uuid.
|
|
17
|
+
*/
|
|
18
|
+
export const uuidParamSchema = z.object({ id: z.string().uuid() });
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default Express-based API bond wirings.
|
|
3
|
+
*
|
|
4
|
+
* Centralizes the 10 byte-identical `api/src/bonds/<name>.ts` setup
|
|
5
|
+
* functions that every flagship app shipped before this package
|
|
6
|
+
* existed. Each function preserves the legacy name (`setupConfigEnv`,
|
|
7
|
+
* `setupDatabasePostgresql`, ...) so per-app `bonds/<name>.ts` files
|
|
8
|
+
* can become 1-line re-exports without changing `bonds/index.ts` call
|
|
9
|
+
* sites.
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
12
|
+
*/
|
|
13
|
+
/** Wires `@molecule/api-config-env` to `@molecule/api-config`. */
|
|
14
|
+
export declare function setupConfigEnv(): void;
|
|
15
|
+
/** Wires `@molecule/api-database-postgresql` to `@molecule/api-database`. */
|
|
16
|
+
export declare function setupDatabasePostgresql(): void;
|
|
17
|
+
/** Wires `@molecule/api-jwt-jsonwebtoken` to `@molecule/api-jwt`. */
|
|
18
|
+
export declare function setupJwtJsonwebtoken(): void;
|
|
19
|
+
/** Wires `@molecule/api-middleware-body-parser-express` to `@molecule/api-middleware-body-parser`. */
|
|
20
|
+
export declare function setupMiddlewareBodyParserExpress(): void;
|
|
21
|
+
/** Wires `@molecule/api-middleware-cookie-parser-express` to `@molecule/api-middleware-cookie-parser`. */
|
|
22
|
+
export declare function setupMiddlewareCookieParserExpress(): void;
|
|
23
|
+
/** Wires `@molecule/api-middleware-cors-express` to `@molecule/api-middleware-cors`. */
|
|
24
|
+
export declare function setupMiddlewareCorsExpress(): void;
|
|
25
|
+
/** Wires `@molecule/api-password-bcrypt` to `@molecule/api-password`. */
|
|
26
|
+
export declare function setupPasswordBcrypt(): void;
|
|
27
|
+
/** Wires `@molecule/api-secrets-env` to `@molecule/api-secrets`. */
|
|
28
|
+
export declare function setupSecretsEnv(): void;
|
|
29
|
+
/** Registers the device service from `@molecule/api-resource-device` on the bond system. */
|
|
30
|
+
export declare function setupServiceDevice(): void;
|
|
31
|
+
/** Wires `@molecule/api-two-factor-otplib` to `@molecule/api-two-factor`. */
|
|
32
|
+
export declare function setupTwoFactorOtplib(): void;
|
|
33
|
+
/** Wires `@molecule/api-emails-mailgun` to `@molecule/api-emails`. */
|
|
34
|
+
export declare function setupEmailsMailgun(): void;
|
|
35
|
+
/** Registers `@molecule/api-payments-stripe` as a named `'stripe'` payments provider. */
|
|
36
|
+
export declare function setupPaymentsStripe(): void;
|
|
37
|
+
/** Registers the plan + paymentRecord services from `@molecule/api-resource-payment`. */
|
|
38
|
+
export declare function setupServicePayment(): void;
|
|
39
|
+
/** Wires `@molecule/api-search-meilisearch` to `@molecule/api-search`. */
|
|
40
|
+
export declare function setupSearchMeilisearch(): void;
|
|
41
|
+
/** Wires `@molecule/api-uploads-s3` to `@molecule/api-uploads`. */
|
|
42
|
+
export declare function setupUploadsS3(): void;
|
|
43
|
+
/** Wires `@molecule/api-image-sharp` to `@molecule/api-image`. */
|
|
44
|
+
export declare function setupImageSharp(): Promise<void>;
|
|
45
|
+
/** Wires `@molecule/api-permissions-custom` to `@molecule/api-permissions`. */
|
|
46
|
+
export declare function setupPermissionsCustom(): Promise<void>;
|
|
47
|
+
/** Wires `@molecule/api-reporting-database` to `@molecule/api-reporting`. */
|
|
48
|
+
export declare function setupReportingDatabase(): Promise<void>;
|
|
49
|
+
/** Wires `@molecule/api-realtime-socketio` to `@molecule/api-realtime`. */
|
|
50
|
+
export declare function setupRealtimeSocketio(): Promise<void>;
|
|
51
|
+
/** Wires `@molecule/api-realtime-ws` to `@molecule/api-realtime`. */
|
|
52
|
+
export declare function setupRealtimeWs(): Promise<void>;
|
|
53
|
+
/** Wires `@molecule/api-realtime-sse` to `@molecule/api-realtime`. */
|
|
54
|
+
export declare function setupRealtimeSse(): Promise<void>;
|
|
55
|
+
/** Wires `@molecule/api-cron-node-cron` to `@molecule/api-cron`. */
|
|
56
|
+
export declare function setupCronNodeCron(): Promise<void>;
|
|
57
|
+
/** Wires `@molecule/api-encryption-aes` to `@molecule/api-encryption`. */
|
|
58
|
+
export declare function setupEncryptionAes(): Promise<void>;
|
|
59
|
+
/** Wires `@molecule/api-push-notifications-web-push` to `@molecule/api-push-notifications`. */
|
|
60
|
+
export declare function setupPushNotificationsWebPush(): Promise<void>;
|
|
61
|
+
/** Wires `@molecule/api-import-export-csv` to `@molecule/api-import-export`. */
|
|
62
|
+
export declare function setupImportExportCsv(): Promise<void>;
|
|
63
|
+
/** Registers `@molecule/api-ai-anthropic` as a named `'anthropic'` AI provider. */
|
|
64
|
+
export declare function setupAiAnthropic(): Promise<void>;
|
|
65
|
+
/** Wires `@molecule/api-audit-database` to `@molecule/api-audit`. */
|
|
66
|
+
export declare function setupAuditDatabase(): Promise<void>;
|
|
67
|
+
/** Wires `@molecule/api-pdf-pdfkit` to `@molecule/api-pdf`. */
|
|
68
|
+
export declare function setupPdfPdfkit(): Promise<void>;
|
|
69
|
+
/** Wires a no-op default analytics provider so `@molecule/api-analytics` calls succeed. */
|
|
70
|
+
export declare function setupApiAnalyticsDefault(): Promise<void>;
|
|
71
|
+
/** Wires `@molecule/api-geolocation-mapbox` to `@molecule/api-geolocation`. */
|
|
72
|
+
export declare function setupGeolocationMapbox(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Wires `@molecule/api-error-tracking-sentry` to `@molecule/api-error-tracking`.
|
|
75
|
+
*
|
|
76
|
+
* Safe to wire unconditionally: without `SENTRY_DSN` the Sentry provider is a
|
|
77
|
+
* documented no-op (the boot config report flags the missing key), so an app
|
|
78
|
+
* that hasn't configured Sentry yet boots and runs untouched.
|
|
79
|
+
*/
|
|
80
|
+
export declare function setupErrorTrackingSentry(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Wires `@molecule/api-error-tracking-console` to `@molecule/api-error-tracking`.
|
|
83
|
+
*
|
|
84
|
+
* Zero-credential development default: captures are logged as structured
|
|
85
|
+
* lines through the bonded logger instead of being sent to a remote service.
|
|
86
|
+
*/
|
|
87
|
+
export declare function setupErrorTrackingConsole(): Promise<void>;
|
|
88
|
+
/** Wires `@molecule/api-cache-redis` to `@molecule/api-cache`. */
|
|
89
|
+
export declare function setupCacheRedis(): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Wires `@molecule/api-queue-memory` to `@molecule/api-queue` — the
|
|
92
|
+
* zero-credential in-process queue (single-process/dev; swap to
|
|
93
|
+
* redis/rabbitmq/sqs for multi-instance production).
|
|
94
|
+
*/
|
|
95
|
+
export declare function setupQueueMemory(): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Wires `@molecule/api-queue-redis` to `@molecule/api-queue`. Outside
|
|
98
|
+
* production, when `REDIS_URL` is absent, falls back to
|
|
99
|
+
* `@molecule/api-queue-memory` — the zero-credential in-process queue — so
|
|
100
|
+
* queue-backed features (background jobs, async delivery workers) run out of
|
|
101
|
+
* the box, mirroring `setupCacheRedis`.
|
|
102
|
+
*/
|
|
103
|
+
export declare function setupQueueRedis(): Promise<void>;
|
|
104
|
+
/** Registers `@molecule/api-ai-openai` as a named `'openai'` AI provider. */
|
|
105
|
+
export declare function setupAiOpenai(): Promise<void>;
|
|
106
|
+
/** Wires `@molecule/api-ai-embeddings-openai` to `@molecule/api-ai-embeddings`. */
|
|
107
|
+
export declare function setupAiEmbeddingsOpenai(): Promise<void>;
|
|
108
|
+
/** Wires `@molecule/api-webhook-http` to `@molecule/api-webhook`. */
|
|
109
|
+
export declare function setupWebhookHttp(): Promise<void>;
|
|
110
|
+
/** Wires `@molecule/api-ai-vector-store-pgvector` to `@molecule/api-ai-vector-store`. */
|
|
111
|
+
export declare function setupAiVectorStorePgvector(): Promise<void>;
|
|
112
|
+
/** Wires `@molecule/api-ai-speech-openai` to `@molecule/api-ai-speech`. */
|
|
113
|
+
export declare function setupAiSpeechOpenai(): Promise<void>;
|
|
114
|
+
/** Wires `@molecule/api-workflow-database` to `@molecule/api-workflow`. */
|
|
115
|
+
export declare function setupWorkflowDatabase(): Promise<void>;
|
|
116
|
+
/** Wires `@molecule/api-http-fetch` to `@molecule/api-http`. */
|
|
117
|
+
export declare function setupHttpFetch(): Promise<void>;
|
|
118
|
+
/** Registers `@molecule/api-notifications-webhook` as a named `'webhook'` notifications provider. */
|
|
119
|
+
export declare function setupNotificationsWebhook(): Promise<void>;
|
|
120
|
+
/** Wires `@molecule/api-geolocation-google` to `@molecule/api-geolocation`. */
|
|
121
|
+
export declare function setupGeolocationGoogle(): Promise<void>;
|
|
122
|
+
/** Wires `@molecule/api-media-streaming-hls` to `@molecule/api-media-streaming`. */
|
|
123
|
+
export declare function setupMediaStreamingHls(): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Wires `@molecule/api-rate-limit-memory` to `@molecule/api-rate-limit`.
|
|
126
|
+
*
|
|
127
|
+
* This is the default brute-force-protection backend for `mlcl`-generated apps
|
|
128
|
+
* (single-instance). Multi-instance deployments should swap in
|
|
129
|
+
* `@molecule/api-rate-limit-redis` so the throttle is shared across replicas.
|
|
130
|
+
*/
|
|
131
|
+
export declare function setupRateLimitMemory(): Promise<void>;
|
|
132
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAoEH,kEAAkE;AAClE,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,6EAA6E;AAC7E,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C;AAED,qEAAqE;AACrE,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,sGAAsG;AACtG,wBAAgB,gCAAgC,IAAI,IAAI,CAGvD;AAED,0GAA0G;AAC1G,wBAAgB,kCAAkC,IAAI,IAAI,CAGzD;AAED,wFAAwF;AACxF,wBAAgB,0BAA0B,IAAI,IAAI,CAGjD;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED,oEAAoE;AACpE,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,IAAI,IAAI,C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