@l4yercak3/cli 1.3.2 → 2.0.0-alpha.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/README.md +10 -220
- package/dist/api/client.d.ts +12 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +37 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/platform.d.ts +161 -0
- package/dist/api/platform.d.ts.map +1 -0
- package/dist/api/platform.js +70 -0
- package/dist/api/platform.js.map +1 -0
- package/dist/bin/sevenlayers.d.ts +3 -0
- package/dist/bin/sevenlayers.d.ts.map +1 -0
- package/dist/bin/sevenlayers.js +198 -0
- package/dist/bin/sevenlayers.js.map +1 -0
- package/dist/commands/agent/catalog.d.ts +5 -0
- package/dist/commands/agent/catalog.d.ts.map +1 -0
- package/dist/commands/agent/catalog.js +142 -0
- package/dist/commands/agent/catalog.js.map +1 -0
- package/dist/commands/agent/drift.d.ts +5 -0
- package/dist/commands/agent/drift.d.ts.map +1 -0
- package/dist/commands/agent/drift.js +113 -0
- package/dist/commands/agent/drift.js.map +1 -0
- package/dist/commands/agent/init.d.ts +5 -0
- package/dist/commands/agent/init.d.ts.map +1 -0
- package/dist/commands/agent/init.js +75 -0
- package/dist/commands/agent/init.js.map +1 -0
- package/dist/commands/agent/permissions.d.ts +5 -0
- package/dist/commands/agent/permissions.d.ts.map +1 -0
- package/dist/commands/agent/permissions.js +88 -0
- package/dist/commands/agent/permissions.js.map +1 -0
- package/dist/commands/agent/runner.d.ts +14 -0
- package/dist/commands/agent/runner.d.ts.map +1 -0
- package/dist/commands/agent/runner.js +59 -0
- package/dist/commands/agent/runner.js.map +1 -0
- package/dist/commands/agent/shared.d.ts +13 -0
- package/dist/commands/agent/shared.d.ts.map +1 -0
- package/dist/commands/agent/shared.js +31 -0
- package/dist/commands/agent/shared.js.map +1 -0
- package/dist/commands/agent/template.d.ts +5 -0
- package/dist/commands/agent/template.d.ts.map +1 -0
- package/dist/commands/agent/template.js +104 -0
- package/dist/commands/agent/template.js.map +1 -0
- package/dist/commands/app/connect.d.ts +7 -0
- package/dist/commands/app/connect.d.ts.map +1 -0
- package/dist/commands/app/connect.js +12 -0
- package/dist/commands/app/connect.js.map +1 -0
- package/dist/commands/app/init.d.ts +7 -0
- package/dist/commands/app/init.d.ts.map +1 -0
- package/dist/commands/app/init.js +12 -0
- package/dist/commands/app/init.js.map +1 -0
- package/dist/commands/app/link.d.ts +3 -0
- package/dist/commands/app/link.d.ts.map +1 -0
- package/dist/commands/app/link.js +92 -0
- package/dist/commands/app/link.js.map +1 -0
- package/dist/commands/app/pages.d.ts +15 -0
- package/dist/commands/app/pages.d.ts.map +1 -0
- package/dist/commands/app/pages.js +180 -0
- package/dist/commands/app/pages.js.map +1 -0
- package/dist/commands/app/register.d.ts +3 -0
- package/dist/commands/app/register.d.ts.map +1 -0
- package/dist/commands/app/register.js +120 -0
- package/dist/commands/app/register.js.map +1 -0
- package/dist/commands/app/remote.d.ts +14 -0
- package/dist/commands/app/remote.d.ts.map +1 -0
- package/dist/commands/app/remote.js +44 -0
- package/dist/commands/app/remote.js.map +1 -0
- package/dist/commands/app/setup.d.ts +3 -0
- package/dist/commands/app/setup.d.ts.map +1 -0
- package/dist/commands/app/setup.js +299 -0
- package/dist/commands/app/setup.js.map +1 -0
- package/dist/commands/app/shared.d.ts +9 -0
- package/dist/commands/app/shared.d.ts.map +1 -0
- package/dist/commands/app/shared.js +122 -0
- package/dist/commands/app/shared.js.map +1 -0
- package/dist/commands/app/sync.d.ts +7 -0
- package/dist/commands/app/sync.d.ts.map +1 -0
- package/dist/commands/app/sync.js +107 -0
- package/dist/commands/app/sync.js.map +1 -0
- package/dist/commands/booking/check.d.ts +3 -0
- package/dist/commands/booking/check.d.ts.map +1 -0
- package/dist/commands/booking/check.js +68 -0
- package/dist/commands/booking/check.js.map +1 -0
- package/dist/commands/booking/setup.d.ts +3 -0
- package/dist/commands/booking/setup.d.ts.map +1 -0
- package/dist/commands/booking/setup.js +95 -0
- package/dist/commands/booking/setup.js.map +1 -0
- package/dist/commands/booking/shared.d.ts +31 -0
- package/dist/commands/booking/shared.d.ts.map +1 -0
- package/dist/commands/booking/shared.js +112 -0
- package/dist/commands/booking/shared.js.map +1 -0
- package/dist/commands/booking/smoke.d.ts +3 -0
- package/dist/commands/booking/smoke.d.ts.map +1 -0
- package/dist/commands/booking/smoke.js +101 -0
- package/dist/commands/booking/smoke.js.map +1 -0
- package/dist/commands/cms/bind.d.ts +3 -0
- package/dist/commands/cms/bind.d.ts.map +1 -0
- package/dist/commands/cms/bind.js +212 -0
- package/dist/commands/cms/bind.js.map +1 -0
- package/dist/commands/cms/content.d.ts +40 -0
- package/dist/commands/cms/content.d.ts.map +1 -0
- package/dist/commands/cms/content.js +169 -0
- package/dist/commands/cms/content.js.map +1 -0
- package/dist/commands/cms/doctor.d.ts +3 -0
- package/dist/commands/cms/doctor.d.ts.map +1 -0
- package/dist/commands/cms/doctor.js +69 -0
- package/dist/commands/cms/doctor.js.map +1 -0
- package/dist/commands/cms/migrate.d.ts +3 -0
- package/dist/commands/cms/migrate.d.ts.map +1 -0
- package/dist/commands/cms/migrate.js +78 -0
- package/dist/commands/cms/migrate.js.map +1 -0
- package/dist/commands/cms/registry.d.ts +3 -0
- package/dist/commands/cms/registry.d.ts.map +1 -0
- package/dist/commands/cms/registry.js +161 -0
- package/dist/commands/cms/registry.js.map +1 -0
- package/dist/commands/cms/seed.d.ts +3 -0
- package/dist/commands/cms/seed.d.ts.map +1 -0
- package/dist/commands/cms/seed.js +102 -0
- package/dist/commands/cms/seed.js.map +1 -0
- package/dist/commands/cms/shared.d.ts +22 -0
- package/dist/commands/cms/shared.d.ts.map +1 -0
- package/dist/commands/cms/shared.js +82 -0
- package/dist/commands/cms/shared.js.map +1 -0
- package/dist/commands/doctor/target.d.ts +3 -0
- package/dist/commands/doctor/target.d.ts.map +1 -0
- package/dist/commands/doctor/target.js +46 -0
- package/dist/commands/doctor/target.js.map +1 -0
- package/dist/commands/env/list.d.ts +3 -0
- package/dist/commands/env/list.d.ts.map +1 -0
- package/dist/commands/env/list.js +28 -0
- package/dist/commands/env/list.js.map +1 -0
- package/dist/commands/env/set.d.ts +3 -0
- package/dist/commands/env/set.d.ts.map +1 -0
- package/dist/commands/env/set.js +36 -0
- package/dist/commands/env/set.js.map +1 -0
- package/dist/commands/env/use.d.ts +3 -0
- package/dist/commands/env/use.d.ts.map +1 -0
- package/dist/commands/env/use.js +15 -0
- package/dist/commands/env/use.js.map +1 -0
- package/dist/commands/legacy/connect.d.ts +3 -0
- package/dist/commands/legacy/connect.d.ts.map +1 -0
- package/dist/commands/legacy/connect.js +8 -0
- package/dist/commands/legacy/connect.js.map +1 -0
- package/dist/commands/legacy/pages.d.ts +3 -0
- package/dist/commands/legacy/pages.d.ts.map +1 -0
- package/dist/commands/legacy/pages.js +16 -0
- package/dist/commands/legacy/pages.js.map +1 -0
- package/dist/commands/legacy/spread.d.ts +3 -0
- package/dist/commands/legacy/spread.d.ts.map +1 -0
- package/dist/commands/legacy/spread.js +8 -0
- package/dist/commands/legacy/spread.js.map +1 -0
- package/dist/commands/legacy/sync.d.ts +3 -0
- package/dist/commands/legacy/sync.d.ts.map +1 -0
- package/dist/commands/legacy/sync.js +8 -0
- package/dist/commands/legacy/sync.js.map +1 -0
- package/dist/config/env-diff.d.ts +10 -0
- package/dist/config/env-diff.d.ts.map +1 -0
- package/dist/config/env-diff.js +24 -0
- package/dist/config/env-diff.js.map +1 -0
- package/dist/config/env-parser.d.ts +20 -0
- package/dist/config/env-parser.d.ts.map +1 -0
- package/dist/config/env-parser.js +70 -0
- package/dist/config/env-parser.js.map +1 -0
- package/dist/config/env-writer.d.ts +22 -0
- package/dist/config/env-writer.d.ts.map +1 -0
- package/dist/config/env-writer.js +172 -0
- package/dist/config/env-writer.js.map +1 -0
- package/dist/config/profile-store.d.ts +29 -0
- package/dist/config/profile-store.d.ts.map +1 -0
- package/dist/config/profile-store.js +257 -0
- package/dist/config/profile-store.js.map +1 -0
- package/dist/core/args.d.ts +11 -0
- package/dist/core/args.d.ts.map +1 -0
- package/dist/core/args.js +106 -0
- package/dist/core/args.js.map +1 -0
- package/dist/core/colors.d.ts +6 -0
- package/dist/core/colors.d.ts.map +1 -0
- package/dist/core/colors.js +29 -0
- package/dist/core/colors.js.map +1 -0
- package/dist/safety/target-guard.d.ts +16 -0
- package/dist/safety/target-guard.d.ts.map +1 -0
- package/dist/safety/target-guard.js +55 -0
- package/dist/safety/target-guard.js.map +1 -0
- package/dist/testing/booking-smoke.d.ts +17 -0
- package/dist/testing/booking-smoke.d.ts.map +1 -0
- package/dist/testing/booking-smoke.js +43 -0
- package/dist/testing/booking-smoke.js.map +1 -0
- package/dist/tests/agent-commands.test.d.ts +2 -0
- package/dist/tests/agent-commands.test.d.ts.map +1 -0
- package/dist/tests/agent-commands.test.js +180 -0
- package/dist/tests/agent-commands.test.js.map +1 -0
- package/dist/tests/agent-governance.test.d.ts +2 -0
- package/dist/tests/agent-governance.test.d.ts.map +1 -0
- package/dist/tests/agent-governance.test.js +233 -0
- package/dist/tests/agent-governance.test.js.map +1 -0
- package/dist/tests/app-commands.test.d.ts +2 -0
- package/dist/tests/app-commands.test.d.ts.map +1 -0
- package/dist/tests/app-commands.test.js +462 -0
- package/dist/tests/app-commands.test.js.map +1 -0
- package/dist/tests/booking-commands.test.d.ts +2 -0
- package/dist/tests/booking-commands.test.d.ts.map +1 -0
- package/dist/tests/booking-commands.test.js +204 -0
- package/dist/tests/booking-commands.test.js.map +1 -0
- package/dist/tests/booking-smoke.test.d.ts +2 -0
- package/dist/tests/booking-smoke.test.d.ts.map +1 -0
- package/dist/tests/booking-smoke.test.js +183 -0
- package/dist/tests/booking-smoke.test.js.map +1 -0
- package/dist/tests/cms-commands.test.d.ts +2 -0
- package/dist/tests/cms-commands.test.d.ts.map +1 -0
- package/dist/tests/cms-commands.test.js +254 -0
- package/dist/tests/cms-commands.test.js.map +1 -0
- package/dist/tests/cms-ops.test.d.ts +2 -0
- package/dist/tests/cms-ops.test.d.ts.map +1 -0
- package/dist/tests/cms-ops.test.js +125 -0
- package/dist/tests/cms-ops.test.js.map +1 -0
- package/dist/tests/env-writer.test.d.ts +2 -0
- package/dist/tests/env-writer.test.d.ts.map +1 -0
- package/dist/tests/env-writer.test.js +90 -0
- package/dist/tests/env-writer.test.js.map +1 -0
- package/dist/tests/profile-store.test.d.ts +2 -0
- package/dist/tests/profile-store.test.d.ts.map +1 -0
- package/dist/tests/profile-store.test.js +88 -0
- package/dist/tests/profile-store.test.js.map +1 -0
- package/dist/tests/target-guard.test.d.ts +2 -0
- package/dist/tests/target-guard.test.d.ts.map +1 -0
- package/dist/tests/target-guard.test.js +132 -0
- package/dist/tests/target-guard.test.js.map +1 -0
- package/dist/ui/logo.d.ts +2 -0
- package/dist/ui/logo.d.ts.map +1 -0
- package/dist/ui/logo.js +22 -0
- package/dist/ui/logo.js.map +1 -0
- package/package.json +17 -53
- package/.claude/settings.local.json +0 -36
- package/.cursor/rules.md +0 -203
- package/.eslintrc.js +0 -31
- package/CLAUDE.md +0 -100
- package/bin/cli.js +0 -116
- package/docs/ADDING_FRAMEWORK_DETECTORS.md +0 -391
- package/docs/ADDING_NEW_PROJECT_TYPE.md +0 -156
- package/docs/ARCHITECTURE_RELATIONSHIPS.md +0 -411
- package/docs/CLI_AUTHENTICATION.md +0 -214
- package/docs/CLI_PAGE_DETECTION_REQUIREMENTS.md +0 -519
- package/docs/CRM-PIPELINES-SEQUENCES-SPEC.md +0 -429
- package/docs/DETECTOR_ARCHITECTURE.md +0 -326
- package/docs/DEVELOPMENT.md +0 -194
- package/docs/IMPLEMENTATION_PHASES.md +0 -468
- package/docs/INTEGRATION_PATHS_ARCHITECTURE.md +0 -1543
- package/docs/OAUTH_CLARIFICATION.md +0 -258
- package/docs/OAUTH_SETUP_GUIDE_TEMPLATE.md +0 -211
- package/docs/PHASE_0_PROGRESS.md +0 -120
- package/docs/PHASE_1_COMPLETE.md +0 -366
- package/docs/PHASE_SUMMARY.md +0 -149
- package/docs/PLAN.md +0 -511
- package/docs/README.md +0 -56
- package/docs/STRIPE_INTEGRATION.md +0 -447
- package/docs/SUMMARY.md +0 -230
- package/docs/UPDATED_PLAN.md +0 -447
- package/docs/mcp_server/MCP_EXTENSION_GUIDE.md +0 -1313
- package/docs/mcp_server/MCP_SERVER_ARCHITECTURE.md +0 -1481
- package/docs/mcp_server/applicationOntology.ts +0 -817
- package/docs/mcp_server/cliApplications.ts +0 -639
- package/docs/mcp_server/crmOntology.ts +0 -1063
- package/docs/mcp_server/eventOntology.ts +0 -1183
- package/docs/mcp_server/formsOntology.ts +0 -1401
- package/docs/mcp_server/ontologySchemas.ts +0 -185
- package/docs/mcp_server/schema.ts +0 -250
- package/docs/microsass_production_machine/CLI_API_REFERENCE.md +0 -1197
- package/docs/microsass_production_machine/CLI_PRODUCT_VISION.md +0 -676
- package/docs/microsass_production_machine/CLI_REQUIREMENTS.md +0 -606
- package/docs/microsass_production_machine/CONNECTED_APPLICATIONS_SPEC.md +0 -390
- package/docs/microsass_production_machine/IMPLEMENTATION_ROADMAP.md +0 -725
- package/docs/microsass_production_machine/OBJECT_MAPPINGS.md +0 -808
- package/docs/microsass_production_machine/REFERENCE_IMPLEMENTATION.md +0 -532
- package/src/api/backend-client.js +0 -449
- package/src/commands/api-keys.js +0 -119
- package/src/commands/connect.js +0 -253
- package/src/commands/login.js +0 -332
- package/src/commands/logout.js +0 -30
- package/src/commands/mcp-server.js +0 -85
- package/src/commands/mcp-setup.js +0 -686
- package/src/commands/pages.js +0 -317
- package/src/commands/scaffold.js +0 -409
- package/src/commands/spread.js +0 -861
- package/src/commands/status.js +0 -62
- package/src/commands/sync.js +0 -169
- package/src/commands/upgrade.js +0 -48
- package/src/config/config-manager.js +0 -206
- package/src/detectors/api-client-detector.js +0 -85
- package/src/detectors/base-detector.js +0 -77
- package/src/detectors/database-detector.js +0 -245
- package/src/detectors/expo-detector.js +0 -166
- package/src/detectors/github-detector.js +0 -74
- package/src/detectors/index.js +0 -106
- package/src/detectors/mapping-suggestor.js +0 -119
- package/src/detectors/model-detector.js +0 -318
- package/src/detectors/nextjs-detector.js +0 -139
- package/src/detectors/oauth-detector.js +0 -122
- package/src/detectors/page-detector.js +0 -480
- package/src/detectors/registry.js +0 -121
- package/src/generators/api-client-generator.js +0 -223
- package/src/generators/api-only/client.js +0 -683
- package/src/generators/api-only/index.js +0 -96
- package/src/generators/api-only/types.js +0 -618
- package/src/generators/api-only/webhooks.js +0 -377
- package/src/generators/env-generator.js +0 -191
- package/src/generators/expo-auth-generator.js +0 -1009
- package/src/generators/gitignore-generator.js +0 -92
- package/src/generators/index.js +0 -166
- package/src/generators/manifest-generator.js +0 -154
- package/src/generators/mcp-guide-generator.js +0 -256
- package/src/generators/nextauth-generator.js +0 -247
- package/src/generators/oauth-guide-generator.js +0 -277
- package/src/generators/quickstart/components/index.js +0 -1699
- package/src/generators/quickstart/components-mobile/index.js +0 -1440
- package/src/generators/quickstart/database/convex.js +0 -1257
- package/src/generators/quickstart/database/index.js +0 -34
- package/src/generators/quickstart/database/supabase.js +0 -1132
- package/src/generators/quickstart/hooks/index.js +0 -1065
- package/src/generators/quickstart/index.js +0 -191
- package/src/generators/quickstart/pages/index.js +0 -1466
- package/src/generators/quickstart/screens/index.js +0 -1498
- package/src/logo.js +0 -116
- package/src/mcp/auth.js +0 -127
- package/src/mcp/registry/domains/applications.js +0 -516
- package/src/mcp/registry/domains/benefits.js +0 -798
- package/src/mcp/registry/domains/codegen.js +0 -894
- package/src/mcp/registry/domains/core.js +0 -324
- package/src/mcp/registry/domains/crm.js +0 -591
- package/src/mcp/registry/domains/events.js +0 -649
- package/src/mcp/registry/domains/forms.js +0 -696
- package/src/mcp/registry/index.js +0 -164
- package/src/mcp/server.js +0 -116
- package/src/utils/file-utils.js +0 -117
- package/src/utils/init-helpers.js +0 -243
- package/src/utils/prompt-utils.js +0 -195
- package/templates/CLAUDE.md +0 -86
- package/tests/api-client-detector.test.js +0 -214
- package/tests/api-client-generator.test.js +0 -176
- package/tests/backend-client.test.js +0 -640
- package/tests/base-detector.test.js +0 -101
- package/tests/commands/login.test.js +0 -143
- package/tests/commands/logout.test.js +0 -84
- package/tests/commands/status.test.js +0 -167
- package/tests/config-manager.test.js +0 -321
- package/tests/database-detector.test.js +0 -221
- package/tests/detector-index.test.js +0 -209
- package/tests/detector-registry.test.js +0 -93
- package/tests/env-generator.test.js +0 -278
- package/tests/expo-detector.test.js +0 -263
- package/tests/file-utils.test.js +0 -194
- package/tests/generators-index.test.js +0 -454
- package/tests/github-detector.test.js +0 -145
- package/tests/gitignore-generator.test.js +0 -109
- package/tests/logo.test.js +0 -96
- package/tests/nextauth-generator.test.js +0 -255
- package/tests/nextjs-detector.test.js +0 -235
- package/tests/oauth-detector.test.js +0 -264
- package/tests/oauth-guide-generator.test.js +0 -273
- package/tests/page-detector.test.js +0 -371
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Webhooks Generator
|
|
3
|
-
* Generates webhook handling utilities for the L4YERCAK3 API
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const { ensureDir, writeFileWithBackup, checkFileOverwrite } = require('../../utils/file-utils');
|
|
9
|
-
|
|
10
|
-
class WebhooksGenerator {
|
|
11
|
-
/**
|
|
12
|
-
* Generate the webhooks utility file
|
|
13
|
-
* @param {Object} options - Generation options
|
|
14
|
-
* @returns {Promise<string|null>} - Path to generated file or null if skipped
|
|
15
|
-
*/
|
|
16
|
-
async generate(options) {
|
|
17
|
-
const { projectPath, isTypeScript } = options;
|
|
18
|
-
|
|
19
|
-
// Determine output directory
|
|
20
|
-
let outputDir;
|
|
21
|
-
if (fs.existsSync(path.join(projectPath, 'src'))) {
|
|
22
|
-
outputDir = path.join(projectPath, 'src', 'lib', 'l4yercak3');
|
|
23
|
-
} else {
|
|
24
|
-
outputDir = path.join(projectPath, 'lib', 'l4yercak3');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
ensureDir(outputDir);
|
|
28
|
-
|
|
29
|
-
const extension = isTypeScript ? 'ts' : 'js';
|
|
30
|
-
const outputPath = path.join(outputDir, `webhooks.${extension}`);
|
|
31
|
-
|
|
32
|
-
const action = await checkFileOverwrite(outputPath);
|
|
33
|
-
if (action === 'skip') {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const content = isTypeScript
|
|
38
|
-
? this.generateTypeScriptWebhooks()
|
|
39
|
-
: this.generateJavaScriptWebhooks();
|
|
40
|
-
|
|
41
|
-
return writeFileWithBackup(outputPath, content, action);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
generateTypeScriptWebhooks() {
|
|
45
|
-
return `/**
|
|
46
|
-
* L4YERCAK3 Webhook Utilities
|
|
47
|
-
* Auto-generated by @l4yercak3/cli
|
|
48
|
-
*
|
|
49
|
-
* Utilities for handling webhook events from L4YERCAK3.
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
import { createHmac, timingSafeEqual } from 'crypto';
|
|
53
|
-
|
|
54
|
-
export interface WebhookEvent<T = Record<string, unknown>> {
|
|
55
|
-
id: string;
|
|
56
|
-
type: WebhookEventType;
|
|
57
|
-
timestamp: string;
|
|
58
|
-
data: T;
|
|
59
|
-
organizationId: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type WebhookEventType =
|
|
63
|
-
| 'contact.created'
|
|
64
|
-
| 'contact.updated'
|
|
65
|
-
| 'contact.deleted'
|
|
66
|
-
| 'organization.created'
|
|
67
|
-
| 'organization.updated'
|
|
68
|
-
| 'event.created'
|
|
69
|
-
| 'event.updated'
|
|
70
|
-
| 'event.published'
|
|
71
|
-
| 'event.cancelled'
|
|
72
|
-
| 'attendee.registered'
|
|
73
|
-
| 'attendee.checked_in'
|
|
74
|
-
| 'attendee.cancelled'
|
|
75
|
-
| 'form.submitted'
|
|
76
|
-
| 'order.created'
|
|
77
|
-
| 'order.paid'
|
|
78
|
-
| 'order.refunded'
|
|
79
|
-
| 'invoice.created'
|
|
80
|
-
| 'invoice.sent'
|
|
81
|
-
| 'invoice.paid'
|
|
82
|
-
| 'invoice.overdue'
|
|
83
|
-
| 'benefit_claim.submitted'
|
|
84
|
-
| 'benefit_claim.approved'
|
|
85
|
-
| 'benefit_claim.rejected'
|
|
86
|
-
| 'benefit_claim.paid'
|
|
87
|
-
| 'commission.calculated'
|
|
88
|
-
| 'commission.paid'
|
|
89
|
-
| 'certificate.issued';
|
|
90
|
-
|
|
91
|
-
export interface VerifyOptions {
|
|
92
|
-
/** The raw request body as a string or Buffer */
|
|
93
|
-
payload: string | Buffer;
|
|
94
|
-
/** The signature from the X-L4yercak3-Signature header */
|
|
95
|
-
signature: string;
|
|
96
|
-
/** Your webhook secret from the L4YERCAK3 dashboard */
|
|
97
|
-
secret: string;
|
|
98
|
-
/** Tolerance in seconds for timestamp validation (default: 300 = 5 minutes) */
|
|
99
|
-
tolerance?: number;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export class WebhookVerificationError extends Error {
|
|
103
|
-
constructor(message: string) {
|
|
104
|
-
super(message);
|
|
105
|
-
this.name = 'WebhookVerificationError';
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Verify a webhook signature and parse the event
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* \`\`\`ts
|
|
114
|
-
* // In your Next.js API route
|
|
115
|
-
* import { verifyWebhookSignature, WebhookEvent } from '@/lib/l4yercak3';
|
|
116
|
-
*
|
|
117
|
-
* export async function POST(req: Request) {
|
|
118
|
-
* const payload = await req.text();
|
|
119
|
-
* const signature = req.headers.get('x-l4yercak3-signature') || '';
|
|
120
|
-
*
|
|
121
|
-
* try {
|
|
122
|
-
* const event = verifyWebhookSignature({
|
|
123
|
-
* payload,
|
|
124
|
-
* signature,
|
|
125
|
-
* secret: process.env.L4YERCAK3_WEBHOOK_SECRET!,
|
|
126
|
-
* });
|
|
127
|
-
*
|
|
128
|
-
* switch (event.type) {
|
|
129
|
-
* case 'contact.created':
|
|
130
|
-
* // Handle new contact
|
|
131
|
-
* break;
|
|
132
|
-
* case 'order.paid':
|
|
133
|
-
* // Handle paid order
|
|
134
|
-
* break;
|
|
135
|
-
* }
|
|
136
|
-
*
|
|
137
|
-
* return new Response('OK', { status: 200 });
|
|
138
|
-
* } catch (error) {
|
|
139
|
-
* console.error('Webhook error:', error);
|
|
140
|
-
* return new Response('Invalid signature', { status: 400 });
|
|
141
|
-
* }
|
|
142
|
-
* }
|
|
143
|
-
* \`\`\`
|
|
144
|
-
*/
|
|
145
|
-
export function verifyWebhookSignature<T = Record<string, unknown>>(
|
|
146
|
-
options: VerifyOptions
|
|
147
|
-
): WebhookEvent<T> {
|
|
148
|
-
const { payload, signature, secret, tolerance = 300 } = options;
|
|
149
|
-
|
|
150
|
-
if (!signature) {
|
|
151
|
-
throw new WebhookVerificationError('Missing signature header');
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Parse the signature header (format: t=timestamp,v1=signature)
|
|
155
|
-
const parts = signature.split(',').reduce((acc, part) => {
|
|
156
|
-
const [key, value] = part.split('=');
|
|
157
|
-
acc[key] = value;
|
|
158
|
-
return acc;
|
|
159
|
-
}, {} as Record<string, string>);
|
|
160
|
-
|
|
161
|
-
const timestamp = parts['t'];
|
|
162
|
-
const signatureHash = parts['v1'];
|
|
163
|
-
|
|
164
|
-
if (!timestamp || !signatureHash) {
|
|
165
|
-
throw new WebhookVerificationError('Invalid signature format');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Check timestamp tolerance
|
|
169
|
-
const timestampNum = parseInt(timestamp, 10);
|
|
170
|
-
const now = Math.floor(Date.now() / 1000);
|
|
171
|
-
if (Math.abs(now - timestampNum) > tolerance) {
|
|
172
|
-
throw new WebhookVerificationError('Timestamp outside tolerance window');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Compute expected signature
|
|
176
|
-
const payloadStr = typeof payload === 'string' ? payload : payload.toString('utf8');
|
|
177
|
-
const signedPayload = \`\${timestamp}.\${payloadStr}\`;
|
|
178
|
-
const expectedSignature = createHmac('sha256', secret)
|
|
179
|
-
.update(signedPayload)
|
|
180
|
-
.digest('hex');
|
|
181
|
-
|
|
182
|
-
// Constant-time comparison
|
|
183
|
-
const expectedBuffer = Buffer.from(expectedSignature);
|
|
184
|
-
const receivedBuffer = Buffer.from(signatureHash);
|
|
185
|
-
|
|
186
|
-
if (expectedBuffer.length !== receivedBuffer.length) {
|
|
187
|
-
throw new WebhookVerificationError('Invalid signature');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (!timingSafeEqual(expectedBuffer, receivedBuffer)) {
|
|
191
|
-
throw new WebhookVerificationError('Invalid signature');
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// Parse and return the event
|
|
195
|
-
try {
|
|
196
|
-
return JSON.parse(payloadStr) as WebhookEvent<T>;
|
|
197
|
-
} catch {
|
|
198
|
-
throw new WebhookVerificationError('Invalid JSON payload');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Type guard helpers for specific webhook events
|
|
204
|
-
*/
|
|
205
|
-
export function isContactEvent(event: WebhookEvent): event is WebhookEvent<{ contact: unknown }> {
|
|
206
|
-
return event.type.startsWith('contact.');
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export function isEventEvent(event: WebhookEvent): event is WebhookEvent<{ event: unknown }> {
|
|
210
|
-
return event.type.startsWith('event.');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export function isOrderEvent(event: WebhookEvent): event is WebhookEvent<{ order: unknown }> {
|
|
214
|
-
return event.type.startsWith('order.');
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export function isInvoiceEvent(event: WebhookEvent): event is WebhookEvent<{ invoice: unknown }> {
|
|
218
|
-
return event.type.startsWith('invoice.');
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export function isBenefitClaimEvent(event: WebhookEvent): event is WebhookEvent<{ claim: unknown }> {
|
|
222
|
-
return event.type.startsWith('benefit_claim.');
|
|
223
|
-
}
|
|
224
|
-
`;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
generateJavaScriptWebhooks() {
|
|
228
|
-
return `/**
|
|
229
|
-
* L4YERCAK3 Webhook Utilities
|
|
230
|
-
* Auto-generated by @l4yercak3/cli
|
|
231
|
-
*
|
|
232
|
-
* Utilities for handling webhook events from L4YERCAK3.
|
|
233
|
-
*/
|
|
234
|
-
|
|
235
|
-
const { createHmac, timingSafeEqual } = require('crypto');
|
|
236
|
-
|
|
237
|
-
class WebhookVerificationError extends Error {
|
|
238
|
-
constructor(message) {
|
|
239
|
-
super(message);
|
|
240
|
-
this.name = 'WebhookVerificationError';
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Verify a webhook signature and parse the event
|
|
246
|
-
*
|
|
247
|
-
* @param {Object} options
|
|
248
|
-
* @param {string|Buffer} options.payload - The raw request body
|
|
249
|
-
* @param {string} options.signature - The signature from X-L4yercak3-Signature header
|
|
250
|
-
* @param {string} options.secret - Your webhook secret
|
|
251
|
-
* @param {number} [options.tolerance=300] - Timestamp tolerance in seconds
|
|
252
|
-
* @returns {Object} The verified webhook event
|
|
253
|
-
* @throws {WebhookVerificationError} If verification fails
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* // In your Next.js API route
|
|
257
|
-
* const { verifyWebhookSignature } = require('@/lib/l4yercak3');
|
|
258
|
-
*
|
|
259
|
-
* export default async function handler(req, res) {
|
|
260
|
-
* const payload = req.body;
|
|
261
|
-
* const signature = req.headers['x-l4yercak3-signature'];
|
|
262
|
-
*
|
|
263
|
-
* try {
|
|
264
|
-
* const event = verifyWebhookSignature({
|
|
265
|
-
* payload: JSON.stringify(payload),
|
|
266
|
-
* signature,
|
|
267
|
-
* secret: process.env.L4YERCAK3_WEBHOOK_SECRET,
|
|
268
|
-
* });
|
|
269
|
-
*
|
|
270
|
-
* switch (event.type) {
|
|
271
|
-
* case 'contact.created':
|
|
272
|
-
* // Handle new contact
|
|
273
|
-
* break;
|
|
274
|
-
* case 'order.paid':
|
|
275
|
-
* // Handle paid order
|
|
276
|
-
* break;
|
|
277
|
-
* }
|
|
278
|
-
*
|
|
279
|
-
* res.status(200).json({ received: true });
|
|
280
|
-
* } catch (error) {
|
|
281
|
-
* console.error('Webhook error:', error);
|
|
282
|
-
* res.status(400).json({ error: 'Invalid signature' });
|
|
283
|
-
* }
|
|
284
|
-
* }
|
|
285
|
-
*/
|
|
286
|
-
function verifyWebhookSignature(options) {
|
|
287
|
-
const { payload, signature, secret, tolerance = 300 } = options;
|
|
288
|
-
|
|
289
|
-
if (!signature) {
|
|
290
|
-
throw new WebhookVerificationError('Missing signature header');
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// Parse the signature header (format: t=timestamp,v1=signature)
|
|
294
|
-
const parts = signature.split(',').reduce((acc, part) => {
|
|
295
|
-
const [key, value] = part.split('=');
|
|
296
|
-
acc[key] = value;
|
|
297
|
-
return acc;
|
|
298
|
-
}, {});
|
|
299
|
-
|
|
300
|
-
const timestamp = parts['t'];
|
|
301
|
-
const signatureHash = parts['v1'];
|
|
302
|
-
|
|
303
|
-
if (!timestamp || !signatureHash) {
|
|
304
|
-
throw new WebhookVerificationError('Invalid signature format');
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// Check timestamp tolerance
|
|
308
|
-
const timestampNum = parseInt(timestamp, 10);
|
|
309
|
-
const now = Math.floor(Date.now() / 1000);
|
|
310
|
-
if (Math.abs(now - timestampNum) > tolerance) {
|
|
311
|
-
throw new WebhookVerificationError('Timestamp outside tolerance window');
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// Compute expected signature
|
|
315
|
-
const payloadStr = typeof payload === 'string' ? payload : payload.toString('utf8');
|
|
316
|
-
const signedPayload = \`\${timestamp}.\${payloadStr}\`;
|
|
317
|
-
const expectedSignature = createHmac('sha256', secret)
|
|
318
|
-
.update(signedPayload)
|
|
319
|
-
.digest('hex');
|
|
320
|
-
|
|
321
|
-
// Constant-time comparison
|
|
322
|
-
const expectedBuffer = Buffer.from(expectedSignature);
|
|
323
|
-
const receivedBuffer = Buffer.from(signatureHash);
|
|
324
|
-
|
|
325
|
-
if (expectedBuffer.length !== receivedBuffer.length) {
|
|
326
|
-
throw new WebhookVerificationError('Invalid signature');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
if (!timingSafeEqual(expectedBuffer, receivedBuffer)) {
|
|
330
|
-
throw new WebhookVerificationError('Invalid signature');
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// Parse and return the event
|
|
334
|
-
try {
|
|
335
|
-
return JSON.parse(payloadStr);
|
|
336
|
-
} catch {
|
|
337
|
-
throw new WebhookVerificationError('Invalid JSON payload');
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Type guard helpers for specific webhook events
|
|
343
|
-
*/
|
|
344
|
-
function isContactEvent(event) {
|
|
345
|
-
return event.type && event.type.startsWith('contact.');
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
function isEventEvent(event) {
|
|
349
|
-
return event.type && event.type.startsWith('event.');
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
function isOrderEvent(event) {
|
|
353
|
-
return event.type && event.type.startsWith('order.');
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
function isInvoiceEvent(event) {
|
|
357
|
-
return event.type && event.type.startsWith('invoice.');
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function isBenefitClaimEvent(event) {
|
|
361
|
-
return event.type && event.type.startsWith('benefit_claim.');
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
module.exports = {
|
|
365
|
-
verifyWebhookSignature,
|
|
366
|
-
WebhookVerificationError,
|
|
367
|
-
isContactEvent,
|
|
368
|
-
isEventEvent,
|
|
369
|
-
isOrderEvent,
|
|
370
|
-
isInvoiceEvent,
|
|
371
|
-
isBenefitClaimEvent,
|
|
372
|
-
};
|
|
373
|
-
`;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
module.exports = new WebhooksGenerator();
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Environment File Generator
|
|
3
|
-
* Generates .env.local file with configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const fs = require('fs');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
class EnvGenerator {
|
|
10
|
-
/**
|
|
11
|
-
* Generate or update .env.local file
|
|
12
|
-
*/
|
|
13
|
-
generate(options) {
|
|
14
|
-
const {
|
|
15
|
-
projectPath,
|
|
16
|
-
apiKey,
|
|
17
|
-
backendUrl,
|
|
18
|
-
organizationId,
|
|
19
|
-
features,
|
|
20
|
-
oauthProviders,
|
|
21
|
-
isMobile,
|
|
22
|
-
} = options;
|
|
23
|
-
|
|
24
|
-
// Use EXPO_PUBLIC_ for Expo, NEXT_PUBLIC_ for Next.js
|
|
25
|
-
const publicPrefix = isMobile ? 'EXPO_PUBLIC_' : 'NEXT_PUBLIC_';
|
|
26
|
-
|
|
27
|
-
const envPath = path.join(projectPath, '.env.local');
|
|
28
|
-
const existingEnv = this.readExistingEnv(envPath);
|
|
29
|
-
|
|
30
|
-
// Merge with new values
|
|
31
|
-
const envVars = {
|
|
32
|
-
...existingEnv,
|
|
33
|
-
// Core API configuration
|
|
34
|
-
// If apiKey is null (user skipped), preserve existing value
|
|
35
|
-
L4YERCAK3_API_KEY: apiKey || existingEnv.L4YERCAK3_API_KEY || 'your_api_key_here',
|
|
36
|
-
L4YERCAK3_BACKEND_URL: backendUrl,
|
|
37
|
-
L4YERCAK3_ORGANIZATION_ID: organizationId,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// Add public backend URL with appropriate prefix
|
|
41
|
-
envVars[`${publicPrefix}L4YERCAK3_BACKEND_URL`] = backendUrl;
|
|
42
|
-
|
|
43
|
-
// Add OAuth variables if OAuth is enabled
|
|
44
|
-
if (features.includes('oauth') && oauthProviders) {
|
|
45
|
-
if (oauthProviders.includes('google')) {
|
|
46
|
-
envVars.GOOGLE_CLIENT_ID = existingEnv.GOOGLE_CLIENT_ID || 'your_google_client_id_here';
|
|
47
|
-
envVars.GOOGLE_CLIENT_SECRET = existingEnv.GOOGLE_CLIENT_SECRET || 'your_google_client_secret_here';
|
|
48
|
-
}
|
|
49
|
-
if (oauthProviders.includes('microsoft')) {
|
|
50
|
-
envVars.AZURE_CLIENT_ID = existingEnv.AZURE_CLIENT_ID || 'your_azure_client_id_here';
|
|
51
|
-
envVars.AZURE_CLIENT_SECRET = existingEnv.AZURE_CLIENT_SECRET || 'your_azure_client_secret_here';
|
|
52
|
-
envVars.AZURE_TENANT_ID = existingEnv.AZURE_TENANT_ID || 'your_azure_tenant_id_here';
|
|
53
|
-
}
|
|
54
|
-
if (oauthProviders.includes('github')) {
|
|
55
|
-
envVars.GITHUB_CLIENT_ID = existingEnv.GITHUB_CLIENT_ID || 'your_github_client_id_here';
|
|
56
|
-
envVars.GITHUB_CLIENT_SECRET = existingEnv.GITHUB_CLIENT_SECRET || 'your_github_client_secret_here';
|
|
57
|
-
}
|
|
58
|
-
envVars.NEXTAUTH_URL = existingEnv.NEXTAUTH_URL || 'http://localhost:3000';
|
|
59
|
-
envVars.NEXTAUTH_SECRET = existingEnv.NEXTAUTH_SECRET || 'generate_with_openssl_rand_base64_32';
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Add Stripe variables if Stripe is enabled
|
|
63
|
-
if (features.includes('stripe')) {
|
|
64
|
-
const stripePublicKey = `${publicPrefix}STRIPE_PUBLISHABLE_KEY`;
|
|
65
|
-
envVars[stripePublicKey] = existingEnv[stripePublicKey] || existingEnv.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY || 'your_stripe_publishable_key_here';
|
|
66
|
-
envVars.STRIPE_SECRET_KEY = existingEnv.STRIPE_SECRET_KEY || 'your_stripe_secret_key_here';
|
|
67
|
-
envVars.STRIPE_WEBHOOK_SECRET = existingEnv.STRIPE_WEBHOOK_SECRET || 'your_stripe_webhook_secret_here';
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Store isMobile for formatting
|
|
71
|
-
envVars._isMobile = isMobile;
|
|
72
|
-
|
|
73
|
-
// Write env file
|
|
74
|
-
const envContent = this.formatEnvFile(envVars);
|
|
75
|
-
fs.writeFileSync(envPath, envContent, 'utf8');
|
|
76
|
-
|
|
77
|
-
return envPath;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Read existing .env.local file
|
|
82
|
-
*/
|
|
83
|
-
readExistingEnv(envPath) {
|
|
84
|
-
const envVars = {};
|
|
85
|
-
|
|
86
|
-
if (!fs.existsSync(envPath)) {
|
|
87
|
-
return envVars;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
const content = fs.readFileSync(envPath, 'utf8');
|
|
92
|
-
const lines = content.split('\n');
|
|
93
|
-
|
|
94
|
-
for (const line of lines) {
|
|
95
|
-
const trimmed = line.trim();
|
|
96
|
-
if (trimmed && !trimmed.startsWith('#')) {
|
|
97
|
-
const match = trimmed.match(/^([^=]+)=(.*)$/);
|
|
98
|
-
if (match) {
|
|
99
|
-
const key = match[1].trim();
|
|
100
|
-
const value = match[2].trim();
|
|
101
|
-
envVars[key] = value;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
} catch (error) {
|
|
106
|
-
// Error reading file, return empty object
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return envVars;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Format environment variables as .env file
|
|
114
|
-
*/
|
|
115
|
-
formatEnvFile(envVars) {
|
|
116
|
-
const isMobile = envVars._isMobile;
|
|
117
|
-
const publicPrefix = isMobile ? 'EXPO_PUBLIC_' : 'NEXT_PUBLIC_';
|
|
118
|
-
const platformName = isMobile ? 'Expo/React Native' : 'Next.js';
|
|
119
|
-
const deploymentPlatforms = isMobile ? 'EAS Build, Expo Go' : 'Vercel, Netlify, etc.';
|
|
120
|
-
|
|
121
|
-
let content = `# L4YERCAK3 Configuration
|
|
122
|
-
# Auto-generated by @l4yercak3/cli
|
|
123
|
-
# DO NOT commit this file to git - it contains sensitive credentials
|
|
124
|
-
#
|
|
125
|
-
# This file is for LOCAL DEVELOPMENT (${platformName}).
|
|
126
|
-
# For production, set these variables in your deployment platform (${deploymentPlatforms}).
|
|
127
|
-
|
|
128
|
-
# Core API Configuration
|
|
129
|
-
L4YERCAK3_API_KEY=${envVars.L4YERCAK3_API_KEY}
|
|
130
|
-
L4YERCAK3_BACKEND_URL=${envVars.L4YERCAK3_BACKEND_URL}
|
|
131
|
-
L4YERCAK3_ORGANIZATION_ID=${envVars.L4YERCAK3_ORGANIZATION_ID}
|
|
132
|
-
${publicPrefix}L4YERCAK3_BACKEND_URL=${envVars[`${publicPrefix}L4YERCAK3_BACKEND_URL`]}
|
|
133
|
-
|
|
134
|
-
`;
|
|
135
|
-
|
|
136
|
-
// Add OAuth section if present
|
|
137
|
-
if (envVars.GOOGLE_CLIENT_ID || envVars.AZURE_CLIENT_ID || envVars.GITHUB_CLIENT_ID) {
|
|
138
|
-
content += `# OAuth Configuration
|
|
139
|
-
# Get your OAuth credentials from:
|
|
140
|
-
# - Google: https://console.cloud.google.com/apis/credentials
|
|
141
|
-
# - Microsoft: https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps
|
|
142
|
-
# - GitHub: https://github.com/settings/developers
|
|
143
|
-
|
|
144
|
-
`;
|
|
145
|
-
if (envVars.GOOGLE_CLIENT_ID) {
|
|
146
|
-
content += `GOOGLE_CLIENT_ID=${envVars.GOOGLE_CLIENT_ID}
|
|
147
|
-
GOOGLE_CLIENT_SECRET=${envVars.GOOGLE_CLIENT_SECRET}
|
|
148
|
-
|
|
149
|
-
`;
|
|
150
|
-
}
|
|
151
|
-
if (envVars.AZURE_CLIENT_ID) {
|
|
152
|
-
content += `AZURE_CLIENT_ID=${envVars.AZURE_CLIENT_ID}
|
|
153
|
-
AZURE_CLIENT_SECRET=${envVars.AZURE_CLIENT_SECRET}
|
|
154
|
-
AZURE_TENANT_ID=${envVars.AZURE_TENANT_ID}
|
|
155
|
-
|
|
156
|
-
`;
|
|
157
|
-
}
|
|
158
|
-
if (envVars.GITHUB_CLIENT_ID) {
|
|
159
|
-
content += `GITHUB_CLIENT_ID=${envVars.GITHUB_CLIENT_ID}
|
|
160
|
-
GITHUB_CLIENT_SECRET=${envVars.GITHUB_CLIENT_SECRET}
|
|
161
|
-
|
|
162
|
-
`;
|
|
163
|
-
}
|
|
164
|
-
if (envVars.NEXTAUTH_URL) {
|
|
165
|
-
content += `# NextAuth.js Configuration
|
|
166
|
-
# NEXTAUTH_URL: Set to http://localhost:3000 for development
|
|
167
|
-
# For production, set this in your hosting platform (Vercel auto-sets this)
|
|
168
|
-
NEXTAUTH_URL=${envVars.NEXTAUTH_URL}
|
|
169
|
-
# Generate with: openssl rand -base64 32
|
|
170
|
-
NEXTAUTH_SECRET=${envVars.NEXTAUTH_SECRET}
|
|
171
|
-
|
|
172
|
-
`;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Add Stripe section if present
|
|
177
|
-
const stripePublicKey = envVars[`${publicPrefix}STRIPE_PUBLISHABLE_KEY`];
|
|
178
|
-
if (stripePublicKey) {
|
|
179
|
-
content += `# Stripe Configuration
|
|
180
|
-
${publicPrefix}STRIPE_PUBLISHABLE_KEY=${stripePublicKey}
|
|
181
|
-
STRIPE_SECRET_KEY=${envVars.STRIPE_SECRET_KEY}
|
|
182
|
-
STRIPE_WEBHOOK_SECRET=${envVars.STRIPE_WEBHOOK_SECRET}
|
|
183
|
-
|
|
184
|
-
`;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return content;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
module.exports = new EnvGenerator();
|