nucleus-core-ts 0.9.953 → 0.9.955

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/bin/cli.ts CHANGED
@@ -1,131 +1,131 @@
1
- #!/usr/bin/env bun
2
-
3
- /**
4
- * Nucleus CLI — the single front door to nucleus-core-ts.
5
- *
6
- * nucleus init scaffold a new project (interactive)
7
- * nucleus dev … run locally (up | down | run)
8
- * nucleus add … extend an existing project (entity | feature | oauth)
9
- * nucleus validate validate config.json against the schema
10
- * nucleus doctor check the local environment (bun, postgres, redis, …)
11
- * nucleus generate generate the Drizzle schema from config.json
12
- */
13
-
14
- import { spawn } from 'node:child_process'
15
- import { dirname, join } from 'node:path'
16
- import { fileURLToPath } from 'node:url'
17
- import { banner, c, log } from './lib/ui'
18
- import { doctorCommand } from './lib/commands/doctor'
19
- import { validateCommand } from './lib/commands/validate'
20
- import { initCommand } from './lib/commands/init'
21
- import { devCommand } from './lib/commands/dev'
22
- import { addCommand } from './lib/commands/add'
23
-
24
- const here = dirname(fileURLToPath(import.meta.url))
25
- const rootDir = join(here, '..')
26
-
27
- const argv = process.argv.slice(2)
28
- const firstArg = argv[0] ?? ''
29
- const looksLikeFile = firstArg.endsWith('.json') || firstArg.startsWith('./') || firstArg.startsWith('/')
30
- const command = looksLikeFile ? 'generate' : firstArg
31
-
32
- async function pkgVersion(): Promise<string> {
33
- try {
34
- return (JSON.parse(await Bun.file(join(rootDir, 'package.json')).text()) as { version: string }).version
35
- } catch {
36
- return '?'
37
- }
38
- }
39
-
40
- function showHelp(version: string) {
41
- banner(`Nucleus CLI v${version}`, 'nucleus-core-ts — config-driven backend framework')
42
- log(`
43
- ${c.bold('Usage')} ${c.cyan('nucleus')} ${c.dim('<command> [options]')}
44
-
45
- ${c.bold('Create & evolve')}
46
- ${c.cyan('init')} ${c.dim('[--preset <p>] [-o <dir>] [-y]')} build a config + scaffold a runnable backend (zero-to-running)
47
- ${c.cyan('add')} ${c.dim('entity | feature <n> | oauth <p>')} extend this project's config in place (+ regenerate)
48
- ${c.cyan('scaffold')} full-project scaffold (backend+frontend+k8s+pipelines) from a config.json
49
- ${c.cyan('generate')} ${c.dim('<config.json> <outDir>')} generate the Drizzle schema + relations from config
50
- ${c.cyan('validate')} ${c.dim('[config.json]')} validate a config against the JSON-Schema + cross-field rules
51
-
52
- ${c.bold('Local dev')}
53
- ${c.cyan('dev')} ${c.dim('[up | down]')} run the app; ${c.dim('up')} starts Postgres+Redis, ${c.dim('down')} stops them
54
- ${c.cyan('doctor')} check the local environment can run a Nucleus project
55
-
56
- ${c.bold('Maintenance')}
57
- ${c.cyan('audit:purge-noise')} ${c.dim('[--execute]')} delete historical low-signal audit_logs rows (dry-run by default)
58
- ${c.cyan('help')}${c.dim(', ')}${c.cyan('--version')} this help / the installed version
59
-
60
- ${c.dim('init = preset → runnable backend · scaffold (= new) = full project · Aliases: generate = gen, validate = check')}
61
- `)
62
- }
63
-
64
- function runScript(scriptRelPath: string, args: string[]): Promise<never> {
65
- return new Promise<never>(() => {
66
- const proc = spawn('bun', ['run', join(rootDir, scriptRelPath), ...args], { cwd: process.cwd(), stdio: 'inherit' })
67
- proc.on('close', (code) => process.exit(code ?? 1))
68
- })
69
- }
70
-
71
- switch (command) {
72
- case 'init':
73
- process.exit(await initCommand(argv.slice(1)))
74
- break
75
-
76
- case 'dev':
77
- process.exit(await devCommand(argv.slice(1)))
78
- break
79
-
80
- case 'add':
81
- process.exit(await addCommand(argv.slice(1)))
82
- break
83
-
84
- case 'scaffold':
85
- case 'new': {
86
- // Full-project scaffold (backend + frontend + k8s + pipelines) from an
87
- // existing config.json. `init` is the leaner, config-building local-dev path.
88
- const { scaffold } = await import(join(rootDir, 'infra', 'scripts', 'generate-project.ts'))
89
- await scaffold(join(rootDir, 'infra'))
90
- break
91
- }
92
-
93
- case 'generate':
94
- case 'gen': {
95
- const genArgs = looksLikeFile ? argv : argv.slice(1)
96
- await runScript(join('scripts', 'generate-schema.ts'), genArgs)
97
- break
98
- }
99
-
100
- case 'validate':
101
- case 'check':
102
- process.exit(await validateCommand(argv.slice(1)))
103
- break
104
-
105
- case 'doctor':
106
- process.exit(await doctorCommand())
107
- break
108
-
109
- case 'audit:purge-noise':
110
- case 'audit-purge-noise':
111
- await runScript(join('scripts', 'audit-purge-noise.ts'), argv.slice(1))
112
- break
113
-
114
- case '--version':
115
- case '-v':
116
- log(await pkgVersion())
117
- break
118
-
119
- case 'help':
120
- case '--help':
121
- case '-h':
122
- case '':
123
- case undefined:
124
- showHelp(await pkgVersion())
125
- break
126
-
127
- default:
128
- log(`${c.red('Unknown command:')} ${command}\n`)
129
- showHelp(await pkgVersion())
130
- process.exit(1)
131
- }
1
+ #!/usr/bin/env bun
2
+
3
+ /**
4
+ * Nucleus CLI — the single front door to nucleus-core-ts.
5
+ *
6
+ * nucleus init scaffold a new project (interactive)
7
+ * nucleus dev … run locally (up | down | run)
8
+ * nucleus add … extend an existing project (entity | feature | oauth)
9
+ * nucleus validate validate config.json against the schema
10
+ * nucleus doctor check the local environment (bun, postgres, redis, …)
11
+ * nucleus generate generate the Drizzle schema from config.json
12
+ */
13
+
14
+ import { spawn } from 'node:child_process'
15
+ import { dirname, join } from 'node:path'
16
+ import { fileURLToPath } from 'node:url'
17
+ import { banner, c, log } from './lib/ui'
18
+ import { doctorCommand } from './lib/commands/doctor'
19
+ import { validateCommand } from './lib/commands/validate'
20
+ import { initCommand } from './lib/commands/init'
21
+ import { devCommand } from './lib/commands/dev'
22
+ import { addCommand } from './lib/commands/add'
23
+
24
+ const here = dirname(fileURLToPath(import.meta.url))
25
+ const rootDir = join(here, '..')
26
+
27
+ const argv = process.argv.slice(2)
28
+ const firstArg = argv[0] ?? ''
29
+ const looksLikeFile = firstArg.endsWith('.json') || firstArg.startsWith('./') || firstArg.startsWith('/')
30
+ const command = looksLikeFile ? 'generate' : firstArg
31
+
32
+ async function pkgVersion(): Promise<string> {
33
+ try {
34
+ return (JSON.parse(await Bun.file(join(rootDir, 'package.json')).text()) as { version: string }).version
35
+ } catch {
36
+ return '?'
37
+ }
38
+ }
39
+
40
+ function showHelp(version: string) {
41
+ banner(`Nucleus CLI v${version}`, 'nucleus-core-ts — config-driven backend framework')
42
+ log(`
43
+ ${c.bold('Usage')} ${c.cyan('nucleus')} ${c.dim('<command> [options]')}
44
+
45
+ ${c.bold('Create & evolve')}
46
+ ${c.cyan('init')} ${c.dim('[--preset <p>] [-o <dir>] [-y]')} build a config + scaffold a runnable backend (zero-to-running)
47
+ ${c.cyan('add')} ${c.dim('entity | feature <n> | oauth <p>')} extend this project's config in place (+ regenerate)
48
+ ${c.cyan('scaffold')} full-project scaffold (backend+frontend+k8s+pipelines) from a config.json
49
+ ${c.cyan('generate')} ${c.dim('<config.json> <outDir>')} generate the Drizzle schema + relations from config
50
+ ${c.cyan('validate')} ${c.dim('[config.json]')} validate a config against the JSON-Schema + cross-field rules
51
+
52
+ ${c.bold('Local dev')}
53
+ ${c.cyan('dev')} ${c.dim('[up | down]')} run the app; ${c.dim('up')} starts Postgres+Redis, ${c.dim('down')} stops them
54
+ ${c.cyan('doctor')} check the local environment can run a Nucleus project
55
+
56
+ ${c.bold('Maintenance')}
57
+ ${c.cyan('audit:purge-noise')} ${c.dim('[--execute]')} delete historical low-signal audit_logs rows (dry-run by default)
58
+ ${c.cyan('help')}${c.dim(', ')}${c.cyan('--version')} this help / the installed version
59
+
60
+ ${c.dim('init = preset → runnable backend · scaffold (= new) = full project · Aliases: generate = gen, validate = check')}
61
+ `)
62
+ }
63
+
64
+ function runScript(scriptRelPath: string, args: string[]): Promise<never> {
65
+ return new Promise<never>(() => {
66
+ const proc = spawn('bun', ['run', join(rootDir, scriptRelPath), ...args], { cwd: process.cwd(), stdio: 'inherit' })
67
+ proc.on('close', (code) => process.exit(code ?? 1))
68
+ })
69
+ }
70
+
71
+ switch (command) {
72
+ case 'init':
73
+ process.exit(await initCommand(argv.slice(1)))
74
+ break
75
+
76
+ case 'dev':
77
+ process.exit(await devCommand(argv.slice(1)))
78
+ break
79
+
80
+ case 'add':
81
+ process.exit(await addCommand(argv.slice(1)))
82
+ break
83
+
84
+ case 'scaffold':
85
+ case 'new': {
86
+ // Full-project scaffold (backend + frontend + k8s + pipelines) from an
87
+ // existing config.json. `init` is the leaner, config-building local-dev path.
88
+ const { scaffold } = await import(join(rootDir, 'infra', 'scripts', 'generate-project.ts'))
89
+ await scaffold(join(rootDir, 'infra'))
90
+ break
91
+ }
92
+
93
+ case 'generate':
94
+ case 'gen': {
95
+ const genArgs = looksLikeFile ? argv : argv.slice(1)
96
+ await runScript(join('scripts', 'generate-schema.ts'), genArgs)
97
+ break
98
+ }
99
+
100
+ case 'validate':
101
+ case 'check':
102
+ process.exit(await validateCommand(argv.slice(1)))
103
+ break
104
+
105
+ case 'doctor':
106
+ process.exit(await doctorCommand())
107
+ break
108
+
109
+ case 'audit:purge-noise':
110
+ case 'audit-purge-noise':
111
+ await runScript(join('scripts', 'audit-purge-noise.ts'), argv.slice(1))
112
+ break
113
+
114
+ case '--version':
115
+ case '-v':
116
+ log(await pkgVersion())
117
+ break
118
+
119
+ case 'help':
120
+ case '--help':
121
+ case '-h':
122
+ case '':
123
+ case undefined:
124
+ showHelp(await pkgVersion())
125
+ break
126
+
127
+ default:
128
+ log(`${c.red('Unknown command:')} ${command}\n`)
129
+ showHelp(await pkgVersion())
130
+ process.exit(1)
131
+ }
package/dist/.build-ok CHANGED
@@ -1 +1 @@
1
- 0.9.953
1
+ 0.9.955
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import 'reflect-metadata';
2
2
  export * from './src/Client';
3
- export type { SystemAddressEntity, SystemClaimEntity, SystemFileEntity, SystemMonitoringMetricEntity, SystemPaymentCustomerEntity, SystemPaymentInvoiceEntity, SystemPaymentMethodEntity, SystemPaymentPriceEntity, SystemPaymentProductEntity, SystemPaymentSubscriptionEntity, SystemPaymentTransactionEntity, SystemPaymentWebhookLogEntity, SystemPhoneEntity, SystemProfileEntity, SystemRoleClaimEntity, SystemRoleEntity, SystemUserCohortEntity, SystemUserEntity, SystemUserRoleEntity, } from './src/Client/ApiCaller/types';
3
+ export type { SystemAddressEntity, SystemAuditLogEntity, SystemClaimEntity, SystemFileEntity, SystemMonitoringMetricEntity, SystemPaymentCustomerEntity, SystemPaymentInvoiceEntity, SystemPaymentMethodEntity, SystemPaymentPriceEntity, SystemPaymentProductEntity, SystemPaymentSubscriptionEntity, SystemPaymentTransactionEntity, SystemPaymentWebhookLogEntity, SystemPhoneEntity, SystemProfileEntity, SystemRoleClaimEntity, SystemRoleEntity, SystemUserCohortEntity, SystemUserEntity, SystemUserRoleEntity, } from './src/Client/ApiCaller/types';
4
4
  export { NucleusElysiaPlugin } from './src/ElysiaPlugin';
5
5
  /**
6
6
  * The request-body ceiling an install's own upload settings imply.
@@ -11,5 +11,5 @@ export { createServerFactory, type ServerFactory } from './server';
11
11
  * in the app and not the one that holds the accounts.
12
12
  */
13
13
  export { SYSTEM_TABLES } from './system-tables';
14
- export type { AdminCreateUserPayload, AdminCreateUserResponse, AllGeneratedEndpoints, AllGeneratedEndpointsWithConfig, AllGeneratedEndpointsWithEntityTypes, ApiCallerConfig, ApiResponse, AuthEndpointDefinitions, AuthenticationConfig, AuthFeatureConfig, AuthFeatureKey, BaseErrorResponse, BulkCreateUsersPayload, BulkCreateUsersResponse, BulkEndpointKey, ChangeUserIdPayload, ChangeUserIdResponse, ChatActionResponse, ChatAttachmentDTO, ChatConversationDTO, ChatConversationListResponse, ChatConversationResponse, ChatCreateConversationPayload, ChatEndpointDefinitions, ChatMessageDTO, ChatMessageListResponse, ChatMessageResponse, ChatParticipantDTO, ChatParticipantsResponse, ChatReadResponse, ChatSendMessagePayload, CheckSubdomainPayload, CheckSubdomainResponse, ClientHookConfig, CohortBulkOpsResponse, CohortEndpointDefinitions, CohortPayload, CohortUpdatePayload, ConfigEndpointDefinitions, ConfigEnvResponse, ConfigGetResponse, ConfigOverridesClearResponse, ConfigOverridesGetResponse, ConfigRestartPayload, ConfigRestartResponse, ConfigSectionGetResponse, ConfigSectionMeta, ConfigSectionsListResponse, ConfigSectionUpdatePayload, ConfigSectionUpdateResponse, CookieStore, CreateHostnamePayload, CreateHostnameResponse, CreateRegistrationPayload, DeleteResponse, DnsInstructionDTO, DomainEndpointDefinitions, DomainHostnameDTO, DomainHostnameListResponse, DomainHostnameResponse, DomainInstructionsResponse, DomainRegistrationDTO, DomainRegistrationListResponse, DomainRegistrationResponse, DomainResolutionDTO, DomainResolveResponse, EndpointAction, EndpointActions, EndpointDefinition, EndpointMethod, EndpointState, EntityEndpointKey, EntityRecord, ExtraEndpoints, FlowDeleteResponse, FlowDetailResponse, FlowListResponse, FlowPublishResponse, FlowSavePayload, FlowSaveResponse, GeneratedAuthEndpoints, GeneratedEndpointsFromConfig, HeadersStore, HttpMethod, ImpersonatePayload, ImpersonateResponse, ImpersonateStopResponse, InferEntity, ListResponse, LiveCpuLog, LiveDaprEvent, LiveDaprEventType, LiveMemoryLog, LiveMonitoringChangeSettingsPayload, LiveMonitoringConfigs, LiveMonitoringLogLimits, LiveMonitoringLogsResponse, LiveMonitoringSettingsResponse, LiveMonitoringStreamSnapshot, LiveMonitoringStreamUpdate, LiveRequest, LiveWorkerInfo, LiveWsEvent, LiveWsEventType, LoginPayload, LoginSuccess, LoginSuccessData, MagicLinkPayload, MarketplaceBalanceDTO, MarketplaceBalanceResponse, MarketplaceEndpointDefinitions, MeResponse, MeResponseData, MeSuccessResponse, MonitoringEndpointDefinitions, MutationResponse, NotificationListResponse, NotificationSeenAllResponse, NotificationSeenResponse, NotificationUnseenCountResponse, OpenDisputePayload, PaginationMeta, PasswordChangePayload, PasswordResetConfirmPayload, PasswordResetRequestPayload, PasswordResetResponse, PasswordSetPayload, PaymentDisputeDTO, PaymentDisputeListResponse, PaymentDisputeResponse, PaymentSplitDTO, PaymentSplitListResponse, PaymentSplitResponse, PayoutRequestDTO, PayoutRequestListResponse, PayoutRequestResponse, ProvisionTenantPayload, ProvisionTenantResponse, RecordSplitPayload, RefreshSuccess, RefreshSuccessData, RegisterPayload, RegisterSuccess, RegisterSuccessData, RequestPayoutPayload, ResolvedEnvEntry, SelfSignupPayload, SelfSignupResponse, ServerFactoryConfig, SessionApprovePayload, SessionApproveResponse, SessionCurrentResponse, SessionInfo, SessionRejectPayload, SessionRejectResponse, SessionRevokeAllPayload, SessionRevokeAllResponse, SessionRevokePayload, SessionRevokeResponse, SessionStatsResponse, SessionsListResponse, SessionsPendingResponse, SettlementPolicyDTO, SettlementPolicyPayload, SettlementPolicyResponse, SingleResponse, StandardQueryParams, StandardReturn, StartOptions, SystemAddressEntity, SystemClaimEntity, SystemFileEntity, SystemMonitoringMetricEntity, SystemPhoneEntity, SystemProfileEntity, SystemRoleClaimEntity, SystemRoleEntity, SystemUserCohortEntity, SystemUserEntity, SystemUserRoleEntity, TenantDetailResponse, TenantEndpointDefinitions, TenantListItem, TenantListResponse, TenantReactivatePayload, TenantReactivateResponse, TenantSuspendPayload, TenantSuspendResponse, UserData, VerificationDecidePayload, VerificationDecideResponse, VerificationEndpointDefinitions, VerificationPendingResponse, VerificationStartPayload, VerificationStartResponse, VerificationStatusResponse, WebAuthnAuthenticationOptions, WebAuthnAuthenticationResponseJSON, WebAuthnAuthenticatorAttachment, WebAuthnAuthOptionsPayload, WebAuthnAuthOptionsResponse, WebAuthnAuthVerifyPayload, WebAuthnAuthVerifyResponse, WebAuthnCredentialSummary, WebAuthnDeviceType, WebAuthnListResponse, WebAuthnPublicKeyCredentialDescriptor, WebAuthnRegisterOptionsPayload, WebAuthnRegisterOptionsResponse, WebAuthnRegisterVerifyPayload, WebAuthnRegisterVerifyResponse, WebAuthnRegistrationOptions, WebAuthnRegistrationResponseJSON, WebAuthnRenamePayload, WebAuthnRenameResponse, WebAuthnRevokePayload, WebAuthnRevokeResponse, WebAuthnTransport, } from './types';
14
+ export type { AdminCreateUserPayload, AdminCreateUserResponse, AlertEvent, AlertType, AllGeneratedEndpoints, AllGeneratedEndpointsWithConfig, AllGeneratedEndpointsWithEntityTypes, ApiCallerConfig, ApiResponse, ApplicationMetrics, AuditCategory, AuditSeverity, AuthEndpointDefinitions, AuthenticationConfig, AuthFeatureConfig, AuthFeatureKey, BaseErrorResponse, BulkCreateUsersPayload, BulkCreateUsersResponse, BulkEndpointKey, ChangeUserIdPayload, ChangeUserIdResponse, ChatActionResponse, ChatAttachmentDTO, ChatConversationDTO, ChatConversationListResponse, ChatConversationResponse, ChatCreateConversationPayload, ChatEndpointDefinitions, ChatMessageDTO, ChatMessageListResponse, ChatMessageResponse, ChatParticipantDTO, ChatParticipantsResponse, ChatReadResponse, ChatSendMessagePayload, CheckSubdomainPayload, CheckSubdomainResponse, ClientHookConfig, CohortBulkOpsResponse, CohortEndpointDefinitions, CohortPayload, CohortUpdatePayload, ConfigEndpointDefinitions, ConfigEnvResponse, ConfigGetResponse, ConfigOverridesClearResponse, ConfigOverridesGetResponse, ConfigRestartPayload, ConfigRestartResponse, ConfigSectionGetResponse, ConfigSectionMeta, ConfigSectionsListResponse, ConfigSectionUpdatePayload, ConfigSectionUpdateResponse, CookieStore, CreateHostnamePayload, CreateHostnameResponse, CreateRegistrationPayload, DatabaseMetrics, DeleteResponse, DnsInstructionDTO, DomainEndpointDefinitions, DomainHostnameDTO, DomainHostnameListResponse, DomainHostnameResponse, DomainInstructionsResponse, DomainRegistrationDTO, DomainRegistrationListResponse, DomainRegistrationResponse, DomainResolutionDTO, DomainResolveResponse, EndpointAction, EndpointActions, EndpointDefinition, EndpointMethod, EndpointState, EntityEndpointKey, EntityRecord, ExtraEndpoints, FlowDeleteResponse, FlowDetailResponse, FlowListResponse, FlowPublishResponse, FlowSavePayload, FlowSaveResponse, GeneratedAuthEndpoints, GeneratedEndpointsFromConfig, HeadersStore, HttpMethod, ImpersonatePayload, ImpersonateResponse, ImpersonateStopResponse, InferEntity, ListResponse, LiveCpuLog, LiveDaprEvent, LiveDaprEventType, LiveMemoryLog, LiveMonitoringChangeSettingsPayload, LiveMonitoringConfigs, LiveMonitoringLogLimits, LiveMonitoringLogsResponse, LiveMonitoringSettingsResponse, LiveMonitoringStreamSnapshot, LiveMonitoringStreamUpdate, LiveRequest, LiveWorkerInfo, LiveWsEvent, LiveWsEventType, LoginPayload, LoginSuccess, LoginSuccessData, LogLevel, MagicLinkPayload, MarketplaceBalanceDTO, MarketplaceBalanceResponse, MarketplaceEndpointDefinitions, MeResponse, MeResponseData, MeSuccessResponse, MetricPeak, MonitoringAcknowledgeResponse, MonitoringAlertsResponse, MonitoringEndpointDefinitions, MonitoringHistoryResponse, MonitoringSnapshot, MonitoringSnapshotResponse, MutationResponse, NotificationListResponse, NotificationSeenAllResponse, NotificationSeenResponse, NotificationUnseenCountResponse, OpenDisputePayload, PaginationMeta, PasswordChangePayload, PasswordResetConfirmPayload, PasswordResetRequestPayload, PasswordResetResponse, PasswordSetPayload, PaymentDisputeDTO, PaymentDisputeListResponse, PaymentDisputeResponse, PaymentSplitDTO, PaymentSplitListResponse, PaymentSplitResponse, PayoutRequestDTO, PayoutRequestListResponse, PayoutRequestResponse, ProvisionTenantPayload, ProvisionTenantResponse, RecordSplitPayload, RedisMetrics, RefreshSuccess, RefreshSuccessData, RegisterPayload, RegisterSuccess, RegisterSuccessData, RequestPayoutPayload, ResolvedEnvEntry, SelfSignupPayload, SelfSignupResponse, ServerFactoryConfig, ServerLogPage, ServerLogQuery, ServerLogRecord, ServerLogSource, ServerLogsResponse, SessionApprovePayload, SessionApproveResponse, SessionCurrentResponse, SessionInfo, SessionRejectPayload, SessionRejectResponse, SessionRevokeAllPayload, SessionRevokeAllResponse, SessionRevokePayload, SessionRevokeResponse, SessionStatsResponse, SessionsListResponse, SessionsPendingResponse, SettlementPolicyDTO, SettlementPolicyPayload, SettlementPolicyResponse, SingleResponse, StandardQueryParams, StandardReturn, StartOptions, SystemAddressEntity, SystemAuditLogEntity, SystemClaimEntity, SystemFileEntity, SystemMetrics, SystemMonitoringMetricEntity, SystemPhoneEntity, SystemProfileEntity, SystemRoleClaimEntity, SystemRoleEntity, SystemUserCohortEntity, SystemUserEntity, SystemUserRoleEntity, TenantDetailResponse, TenantEndpointDefinitions, TenantListItem, TenantListResponse, TenantReactivatePayload, TenantReactivateResponse, TenantSuspendPayload, TenantSuspendResponse, UserData, VerificationDecidePayload, VerificationDecideResponse, VerificationEndpointDefinitions, VerificationPendingResponse, VerificationStartPayload, VerificationStartResponse, VerificationStatusResponse, WebAuthnAuthenticationOptions, WebAuthnAuthenticationResponseJSON, WebAuthnAuthenticatorAttachment, WebAuthnAuthOptionsPayload, WebAuthnAuthOptionsResponse, WebAuthnAuthVerifyPayload, WebAuthnAuthVerifyResponse, WebAuthnCredentialSummary, WebAuthnDeviceType, WebAuthnListResponse, WebAuthnPublicKeyCredentialDescriptor, WebAuthnRegisterOptionsPayload, WebAuthnRegisterOptionsResponse, WebAuthnRegisterVerifyPayload, WebAuthnRegisterVerifyResponse, WebAuthnRegistrationOptions, WebAuthnRegistrationResponseJSON, WebAuthnRenamePayload, WebAuthnRenameResponse, WebAuthnRevokePayload, WebAuthnRevokeResponse, WebAuthnTransport, } from './types';
15
15
  export { AUTH_ENDPOINT_CONFIGS, AUTH_ENDPOINTS, CHAT_ENDPOINTS, COHORT_ENDPOINTS, CONFIG_ENDPOINTS, DOMAIN_ENDPOINTS, MARKETPLACE_ENDPOINTS, MONITORING_ENDPOINTS, PAYMENT_ENDPOINTS, TENANT_ENDPOINTS, VERIFICATION_ENDPOINTS, } from './types';
@@ -1,9 +1,11 @@
1
- import type { LiveCpuLog as _LiveCpuLog, LiveDaprEvent as _LiveDaprEvent, LiveDaprEventType as _LiveDaprEventType, LiveMemoryLog as _LiveMemoryLog, LiveMonitoringChangeSettingsPayload as _LiveMonitoringChangeSettingsPayload, LiveMonitoringConfigs as _LiveMonitoringConfigs, LiveMonitoringLogLimits as _LiveMonitoringLogLimits, LiveMonitoringLogsResponse as _LiveMonitoringLogsResponse, LiveMonitoringSettingsResponse as _LiveMonitoringSettingsResponse, LiveMonitoringStreamSnapshot as _LiveMonitoringStreamSnapshot, LiveMonitoringStreamUpdate as _LiveMonitoringStreamUpdate, LiveRequest as _LiveRequest, LiveWorkerInfo as _LiveWorkerInfo, LiveWsEvent as _LiveWsEvent, LiveWsEventType as _LiveWsEventType } from '../../Services/Monitoring/types';
1
+ import type { AuditCategory as _AuditCategory, AuditSeverity as _AuditSeverity } from '../../Services/Logger/auditTaxonomy';
2
+ import type { ServerLogPage as _ServerLogPage, ServerLogQuery as _ServerLogQuery, ServerLogRecord as _ServerLogRecord, ServerLogSource as _ServerLogSource } from '../../Services/Logger/ServerLogBuffer';
3
+ import type { LogLevel as _LogLevel } from '../../Services/Logger/types';
4
+ import type { AlertEvent as _AlertEvent, AlertType as _AlertType, ApplicationMetrics as _ApplicationMetrics, DatabaseMetrics as _DatabaseMetrics, LiveCpuLog as _LiveCpuLog, LiveDaprEvent as _LiveDaprEvent, LiveDaprEventType as _LiveDaprEventType, LiveMemoryLog as _LiveMemoryLog, LiveMonitoringChangeSettingsPayload as _LiveMonitoringChangeSettingsPayload, LiveMonitoringConfigs as _LiveMonitoringConfigs, LiveMonitoringLogLimits as _LiveMonitoringLogLimits, LiveMonitoringLogsResponse as _LiveMonitoringLogsResponse, LiveMonitoringSettingsResponse as _LiveMonitoringSettingsResponse, LiveMonitoringStreamSnapshot as _LiveMonitoringStreamSnapshot, LiveMonitoringStreamUpdate as _LiveMonitoringStreamUpdate, LiveRequest as _LiveRequest, LiveWorkerInfo as _LiveWorkerInfo, LiveWsEvent as _LiveWsEvent, LiveWsEventType as _LiveWsEventType, MetricPeak as _MetricPeak, MonitoringSnapshot as _MonitoringSnapshot, RedisMetrics as _RedisMetrics, SystemMetrics as _SystemMetrics } from '../../Services/Monitoring/types';
2
5
  import type { NucleusConfigOptions, NucleusTable, PaginationMeta, StandardQueryParams, StandardReturn } from '../../types';
3
6
  import type { HttpMethod } from '../ServerFetch/types';
4
7
  import type { SystemTables } from './system-tables';
5
- export type { PaginationMeta, StandardQueryParams, StandardReturn };
6
- export type { HttpMethod };
8
+ export type { HttpMethod, PaginationMeta, StandardQueryParams, StandardReturn };
7
9
  export interface ApiResponse<TSuccess, TError> {
8
10
  isSuccess: boolean;
9
11
  data?: TSuccess;
@@ -2520,6 +2522,16 @@ export type SystemPaymentSubscriptionEntity = InferEntity<SystemTables, 'payment
2520
2522
  export type SystemPaymentInvoiceEntity = InferEntity<SystemTables, 'payment_invoices'>;
2521
2523
  export type SystemUserCohortEntity = InferEntity<SystemTables, 'user_cohorts'>;
2522
2524
  export type SystemMonitoringMetricEntity = InferEntity<SystemTables, 'monitoring_metrics'>;
2525
+ /**
2526
+ * An audit row, for the panels that read one.
2527
+ *
2528
+ * Every nucleus service writes `audit_logs` — this is not the identity
2529
+ * service's private table — so a screen that wants "who changed what on THIS
2530
+ * service" needs the row type as much as the users screen needs
2531
+ * {@link SystemUserEntity}. It was the one system entity missing here, which
2532
+ * pushed each consumer into hand-writing it.
2533
+ */
2534
+ export type SystemAuditLogEntity = InferEntity<SystemTables, 'audit_logs'>;
2523
2535
  export type MeResponseData = {
2524
2536
  user: SystemUserEntity;
2525
2537
  profile: SystemProfileEntity | null;
@@ -2544,6 +2556,81 @@ export type LiveMonitoringChangeSettingsPayload = _LiveMonitoringChangeSettingsP
2544
2556
  export type LiveMonitoringStreamSnapshot = _LiveMonitoringStreamSnapshot;
2545
2557
  export type LiveMonitoringStreamUpdate = _LiveMonitoringStreamUpdate;
2546
2558
  export type LiveMonitoringLogsResponse = _LiveMonitoringLogsResponse;
2559
+ /**
2560
+ * The metrics half of monitoring, for the panel that draws it.
2561
+ *
2562
+ * The live types above describe the per-request tail; these describe what the
2563
+ * collectors measured — and until now they existed only on the server side, so
2564
+ * every screen that wanted to render `/monitoring/snapshot` had to hand-write
2565
+ * its own copy of `SystemMetrics`. Two copies of a shape the server owns is two
2566
+ * places for it to drift, and the drift is silent: the panel keeps compiling
2567
+ * and quietly reads a field the server stopped sending.
2568
+ */
2569
+ export type SystemMetrics = _SystemMetrics;
2570
+ export type ApplicationMetrics = _ApplicationMetrics;
2571
+ export type DatabaseMetrics = _DatabaseMetrics;
2572
+ export type RedisMetrics = _RedisMetrics;
2573
+ export type MetricPeak = _MetricPeak;
2574
+ export type MonitoringSnapshot = _MonitoringSnapshot;
2575
+ export type AlertType = _AlertType;
2576
+ export type AlertEvent = _AlertEvent;
2577
+ /** `GET {basePath}/snapshot` — `data` is null before the first collection. */
2578
+ export type MonitoringSnapshotResponse = {
2579
+ isSuccess: boolean;
2580
+ message: string;
2581
+ data: MonitoringSnapshot | null;
2582
+ };
2583
+ /** `GET {basePath}/history?minutes=N` — capped server-side at `history.maxMinutes`. */
2584
+ export type MonitoringHistoryResponse = {
2585
+ isSuccess: boolean;
2586
+ message: string;
2587
+ data: {
2588
+ minutes: number;
2589
+ count: number;
2590
+ snapshots: MonitoringSnapshot[];
2591
+ };
2592
+ };
2593
+ /** `GET {basePath}/alerts` — only alerts still active, acknowledged or not. */
2594
+ export type MonitoringAlertsResponse = {
2595
+ isSuccess: boolean;
2596
+ message: string;
2597
+ data: {
2598
+ count: number;
2599
+ alerts: AlertEvent[];
2600
+ };
2601
+ };
2602
+ /** `POST {basePath}/alerts/:alertId/acknowledge`. */
2603
+ export type MonitoringAcknowledgeResponse = {
2604
+ isSuccess: boolean;
2605
+ message: string;
2606
+ data: {
2607
+ alertId: string;
2608
+ } | null;
2609
+ };
2610
+ /**
2611
+ * The server's own log, as the admin panel reads it.
2612
+ *
2613
+ * Exported for the same reason as the metrics types above: the buffer and its
2614
+ * query shape live in the framework, so a panel that hand-writes them is a
2615
+ * second copy that drifts silently the day a field is added.
2616
+ */
2617
+ export type LogLevel = _LogLevel;
2618
+ export type ServerLogSource = _ServerLogSource;
2619
+ export type ServerLogRecord = _ServerLogRecord;
2620
+ export type ServerLogQuery = _ServerLogQuery;
2621
+ export type ServerLogPage = _ServerLogPage;
2622
+ /** `GET {basePath}/server-logs` — a page, plus what is available to filter by. */
2623
+ export type ServerLogsResponse = {
2624
+ isSuccess: boolean;
2625
+ message: string;
2626
+ data: ServerLogPage & {
2627
+ scopes: string[];
2628
+ levelCounts: Record<LogLevel, number>;
2629
+ };
2630
+ };
2631
+ /** How `audit_logs` rows are classified, so a viewer can rank them the same way. */
2632
+ export type AuditSeverity = _AuditSeverity;
2633
+ export type AuditCategory = _AuditCategory;
2547
2634
  export declare const MONITORING_ENDPOINTS: {
2548
2635
  MONITORING_HEALTH_CHECK: {
2549
2636
  method: "GET";
@@ -1,9 +1,9 @@
1
1
  import { deduplicatedRefresh } from './httpProxy';
2
2
  import { addQueryParam, createProxyLogger, httpToWs, matchPath, parseCookies, rewritePath } from './utils';
3
- /**
4
- * True when an access token is absent or within `skewMs` of expiring. Decodes the JWT
5
- * exp WITHOUT verifying (verification happens at the backend) — this only decides whether
6
- * to pre-emptively refresh before the WS handshake.
3
+ /**
4
+ * True when an access token is absent or within `skewMs` of expiring. Decodes the JWT
5
+ * exp WITHOUT verifying (verification happens at the backend) — this only decides whether
6
+ * to pre-emptively refresh before the WS handshake.
7
7
  */ function accessTokenExpiringSoon(token, skewMs = 60000) {
8
8
  if (!token) return true;
9
9
  try {
@@ -16,20 +16,20 @@ import { addQueryParam, createProxyLogger, httpToWs, matchPath, parseCookies, re
16
16
  return true;
17
17
  }
18
18
  }
19
- /**
20
- * Keeps the proxy→backend socket alive with a PROTOCOL ping, not a data frame.
21
- *
22
- * This used to send `''`. An empty text frame is still application data, so it
23
- * arrived at the backend's `message` handler, where `JSON.parse('')` throws —
24
- * and nucleus' own PubSub route logged "Failed to parse client message" once per
25
- * interval per connected client. On a busy IDP that is the entire debug log, and
26
- * it names the proxy's own heartbeat as a misbehaving client.
27
- *
28
- * `ping()` is a control frame: it never reaches `message`, the peer answers with
29
- * pong automatically, and it resets the idle timer the same way. Bun's WebSocket
30
- * client implements it; the JSON heartbeat is the fallback for a runtime that
31
- * does not, because `{"type":"ping"}` is a frame the PubSub route understands and
32
- * replies to, rather than one it can only fail to parse.
19
+ /**
20
+ * Keeps the proxy→backend socket alive with a PROTOCOL ping, not a data frame.
21
+ *
22
+ * This used to send `''`. An empty text frame is still application data, so it
23
+ * arrived at the backend's `message` handler, where `JSON.parse('')` throws —
24
+ * and nucleus' own PubSub route logged "Failed to parse client message" once per
25
+ * interval per connected client. On a busy IDP that is the entire debug log, and
26
+ * it names the proxy's own heartbeat as a misbehaving client.
27
+ *
28
+ * `ping()` is a control frame: it never reaches `message`, the peer answers with
29
+ * pong automatically, and it resets the idle timer the same way. Bun's WebSocket
30
+ * client implements it; the JSON heartbeat is the fallback for a runtime that
31
+ * does not, because `{"type":"ping"}` is a frame the PubSub route understands and
32
+ * replies to, rather than one it can only fail to parse.
33
33
  */ function pingBackend(backendWs) {
34
34
  const withPing = backendWs;
35
35
  if (typeof withPing.ping === 'function') {
@@ -51,14 +51,14 @@ export function createWsProxyHandler(config) {
51
51
  }
52
52
  return null;
53
53
  }
54
- /**
55
- * The backend URL, plus whether this handshake carries a credential at all.
56
- *
57
- * The second half is the point. This function already KNEW when it had no
58
- * token — it logged "No token found" and handed back a URL anyway, and the
59
- * caller upgraded the socket regardless. That silence is what turns one
60
- * logged-out browser tab into a permanent reconnect storm; see the refusal in
61
- * `upgrade()` for the measurements.
54
+ /**
55
+ * The backend URL, plus whether this handshake carries a credential at all.
56
+ *
57
+ * The second half is the point. This function already KNEW when it had no
58
+ * token — it logged "No token found" and handed back a URL anyway, and the
59
+ * caller upgraded the socket regardless. That silence is what turns one
60
+ * logged-out browser tab into a permanent reconnect storm; see the refusal in
61
+ * `upgrade()` for the measurements.
62
62
  */ async function buildBackendUrl(path, target, cookies, query) {
63
63
  let baseUrl = target.url.replace(/\/$/, '');
64
64
  if (baseUrl.startsWith('http')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.9.953",
3
+ "version": "0.9.955",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",