@nextsparkjs/core 0.1.0-beta.186 → 0.1.0-beta.188

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.
Files changed (163) hide show
  1. package/dist/components/app/guards/DeveloperGuard.d.ts.map +1 -1
  2. package/dist/components/app/guards/DeveloperGuard.js +8 -4
  3. package/dist/components/app/guards/SuperAdminGuard.d.ts.map +1 -1
  4. package/dist/components/app/guards/SuperAdminGuard.js +8 -4
  5. package/dist/components/dashboard/mobile/MobileTopBar.d.ts +10 -1
  6. package/dist/components/dashboard/mobile/MobileTopBar.d.ts.map +1 -1
  7. package/dist/components/dashboard/mobile/MobileTopBar.js +2 -1
  8. package/dist/components/devtools/api-explorer/ApiExplorer.js +4 -4
  9. package/dist/components/patterns/pages/PatternEditPage.d.ts +5 -1
  10. package/dist/components/patterns/pages/PatternEditPage.d.ts.map +1 -1
  11. package/dist/components/patterns/pages/PatternEditPage.js +16 -5
  12. package/dist/components/patterns/pages/PatternsCreatePage.d.ts +2 -1
  13. package/dist/components/patterns/pages/PatternsCreatePage.d.ts.map +1 -1
  14. package/dist/components/patterns/pages/PatternsCreatePage.js +17 -5
  15. package/dist/lib/api/entities.js +2 -1
  16. package/dist/lib/api/entity/generic-handler.d.ts.map +1 -1
  17. package/dist/lib/api/entity/generic-handler.js +18 -4
  18. package/dist/lib/api/entity-handler.js +2 -2
  19. package/dist/lib/auth-client.d.ts.map +1 -1
  20. package/dist/lib/auth-client.js +9 -1
  21. package/dist/lib/auth.d.ts.map +1 -1
  22. package/dist/lib/auth.js +24 -3
  23. package/dist/lib/email/templates.d.ts +3 -3
  24. package/dist/lib/email/templates.d.ts.map +1 -1
  25. package/dist/lib/entities/api-generator.js +5 -5
  26. package/dist/lib/entities/types.d.ts +12 -0
  27. package/dist/lib/entities/types.d.ts.map +1 -1
  28. package/dist/lib/services/api-docs.service.d.ts +5 -1
  29. package/dist/lib/services/api-docs.service.d.ts.map +1 -1
  30. package/dist/lib/services/api-presets.service.d.ts +6 -1
  31. package/dist/lib/services/api-presets.service.d.ts.map +1 -1
  32. package/dist/lib/services/feature.service.d.ts +58 -4
  33. package/dist/lib/services/feature.service.d.ts.map +1 -1
  34. package/dist/lib/services/permission.service.d.ts +10 -4
  35. package/dist/lib/services/permission.service.d.ts.map +1 -1
  36. package/dist/lib/services/plugin.service.d.ts +1 -1
  37. package/dist/lib/services/plugin.service.d.ts.map +1 -1
  38. package/dist/lib/template-resolver.d.ts +3 -3
  39. package/dist/lib/utils/cors.d.ts +13 -0
  40. package/dist/lib/utils/cors.d.ts.map +1 -1
  41. package/dist/lib/utils/cors.js +20 -0
  42. package/dist/messages/de/index.d.ts +2 -0
  43. package/dist/messages/de/index.d.ts.map +1 -1
  44. package/dist/messages/de/navigation.json +3 -1
  45. package/dist/messages/en/index.d.ts +2 -0
  46. package/dist/messages/en/index.d.ts.map +1 -1
  47. package/dist/messages/en/navigation.json +3 -1
  48. package/dist/messages/es/index.d.ts +2 -0
  49. package/dist/messages/es/index.d.ts.map +1 -1
  50. package/dist/messages/es/navigation.json +3 -1
  51. package/dist/messages/fr/index.d.ts +2 -0
  52. package/dist/messages/fr/index.d.ts.map +1 -1
  53. package/dist/messages/fr/navigation.json +3 -1
  54. package/dist/messages/it/index.d.ts +2 -0
  55. package/dist/messages/it/index.d.ts.map +1 -1
  56. package/dist/messages/it/navigation.json +3 -1
  57. package/dist/messages/pt/index.d.ts +2 -0
  58. package/dist/messages/pt/index.d.ts.map +1 -1
  59. package/dist/messages/pt/navigation.json +3 -1
  60. package/dist/nextspark-registries.d.ts +580 -236
  61. package/dist/templates/app/layout.ppr.tsx +6 -1
  62. package/dist/templates/app/layout.tsx +11 -2
  63. package/package.json +2 -2
  64. package/templates/app/layout.ppr.tsx +6 -1
  65. package/templates/app/layout.tsx +11 -2
  66. package/dist/components/app/misc/ThemeToggle.d.js +0 -0
  67. package/dist/components/teams/TeamSwitchModal.d.js +0 -0
  68. package/dist/components/ui/accordion.d.js +0 -0
  69. package/dist/components/ui/avatar.d.js +0 -0
  70. package/dist/components/ui/badge.d.js +0 -0
  71. package/dist/components/ui/button.d.js +0 -0
  72. package/dist/components/ui/card.d.js +0 -0
  73. package/dist/components/ui/dialog.d.js +0 -0
  74. package/dist/components/ui/dropdown-menu.d.js +0 -0
  75. package/dist/components/ui/input.d.js +0 -0
  76. package/dist/components/ui/progress.d.js +0 -0
  77. package/dist/components/ui/scroll-area.d.js +0 -0
  78. package/dist/components/ui/select.d.js +0 -0
  79. package/dist/components/ui/separator.d.js +0 -0
  80. package/dist/components/ui/table.d.js +0 -0
  81. package/dist/components/ui/textarea.d.js +0 -0
  82. package/dist/contexts/TeamContext.d.js +0 -0
  83. package/dist/hooks/useAuth.d.js +0 -0
  84. package/dist/hooks/useLastAuthMethod.d.js +0 -0
  85. package/dist/hooks/useOrigin.d.js +0 -0
  86. package/dist/lib/api/auth/dual-auth.d.js +0 -0
  87. package/dist/lib/api/auth.d.js +0 -0
  88. package/dist/lib/api/cache.d.js +0 -0
  89. package/dist/lib/api/keys.d.js +0 -0
  90. package/dist/lib/auth-client.d.js +0 -0
  91. package/dist/lib/auth-context.d.js +0 -0
  92. package/dist/lib/auth.d.js +0 -0
  93. package/dist/lib/billing/config-types.d.js +0 -0
  94. package/dist/lib/billing/enforcement.d.js +0 -0
  95. package/dist/lib/billing/helpers.d.js +0 -0
  96. package/dist/lib/billing/jobs.d.js +0 -0
  97. package/dist/lib/billing/types.d.js +0 -0
  98. package/dist/lib/blocks/loader.d.js +0 -0
  99. package/dist/lib/config/app.config.d.js +0 -0
  100. package/dist/lib/config/config-loader.d.js +0 -0
  101. package/dist/lib/config/config-sync.d.js +0 -0
  102. package/dist/lib/config/config-types.d.js +0 -0
  103. package/dist/lib/config/config-utils.d.js +0 -0
  104. package/dist/lib/config/dashboard-types.d.js +0 -0
  105. package/dist/lib/config/dashboard.config.d.js +0 -0
  106. package/dist/lib/config/icon-map.d.js +0 -0
  107. package/dist/lib/config/index.d.js +0 -7
  108. package/dist/lib/config/nextspark-types.d.js +0 -0
  109. package/dist/lib/config/roles-merge.d.js +0 -0
  110. package/dist/lib/config/types.d.js +0 -0
  111. package/dist/lib/db.d.js +0 -0
  112. package/dist/lib/email/factory.d.js +0 -0
  113. package/dist/lib/email/index.d.js +0 -3
  114. package/dist/lib/email/providers/console.d.js +0 -0
  115. package/dist/lib/email/providers/resend.d.js +0 -0
  116. package/dist/lib/email/templates.d.js +0 -0
  117. package/dist/lib/email/types.d.js +0 -0
  118. package/dist/lib/entities/types.d.js +0 -0
  119. package/dist/lib/permissions/system.d.js +0 -0
  120. package/dist/lib/permissions/types.d.js +0 -0
  121. package/dist/lib/plugins/hook-system.d.js +0 -0
  122. package/dist/lib/scheduled-actions/cleanup.d.js +0 -0
  123. package/dist/lib/scheduled-actions/index.d.js +0 -19
  124. package/dist/lib/scheduled-actions/initializer.d.js +0 -1
  125. package/dist/lib/scheduled-actions/processor.d.js +0 -0
  126. package/dist/lib/scheduled-actions/registry.d.js +0 -0
  127. package/dist/lib/scheduled-actions/scheduler.d.js +0 -0
  128. package/dist/lib/scheduled-actions/types.d.js +0 -0
  129. package/dist/lib/services/api-routes.service.d.js +0 -0
  130. package/dist/lib/services/entity-type.service.d.js +0 -0
  131. package/dist/lib/services/index.d.js +0 -40
  132. package/dist/lib/services/invoice.service.d.js +0 -0
  133. package/dist/lib/services/membership.service.d.js +0 -0
  134. package/dist/lib/services/meta.service.d.js +0 -0
  135. package/dist/lib/services/middleware.service.d.js +0 -0
  136. package/dist/lib/services/namespace.service.d.js +0 -0
  137. package/dist/lib/services/permission.service.d.js +0 -0
  138. package/dist/lib/services/plan.service.d.js +0 -0
  139. package/dist/lib/services/plugin.service.d.js +0 -0
  140. package/dist/lib/services/route-handler.service.d.js +0 -0
  141. package/dist/lib/services/scope.service.d.js +0 -0
  142. package/dist/lib/services/subscription.service.d.js +0 -0
  143. package/dist/lib/services/team-member.service.d.js +0 -0
  144. package/dist/lib/services/team.service.d.js +0 -0
  145. package/dist/lib/services/theme.service.d.js +0 -0
  146. package/dist/lib/services/usage.service.d.js +0 -0
  147. package/dist/lib/services/user-flags.service.d.js +0 -0
  148. package/dist/lib/services/user.service.d.js +0 -0
  149. package/dist/lib/teams/helpers.d.js +0 -0
  150. package/dist/lib/teams/permissions.d.js +0 -0
  151. package/dist/lib/teams/types.d.js +0 -0
  152. package/dist/lib/utils/config-merge.d.js +0 -0
  153. package/dist/lib/utils/file-logger.d.js +0 -0
  154. package/dist/lib/utils.d.js +0 -0
  155. package/dist/types/auth.d.js +0 -0
  156. package/dist/types/blocks.d.js +0 -0
  157. package/dist/types/meta.types.d.js +0 -0
  158. package/dist/types/plugin.d.js +0 -0
  159. package/dist/types/testing.types.d.js +0 -0
  160. package/dist/types/theme.d.js +0 -0
  161. package/dist/types/user.types.d.js +0 -0
  162. /package/dist/{components/app/layouts/PublicFooter.d.js → nextspark-registries.d.js} +0 -0
  163. /package/dist/{components/app/layouts/PublicNavbar.d.js → types/use-intl-react-shim.d.js} +0 -0
@@ -1,52 +1,77 @@
1
1
  /**
2
- * Ambient type declarations for @nextspark/registries/*
2
+ * Ambient type declarations for @nextsparkjs/registries/*
3
3
  *
4
- * These modules are external and resolved by the consumer project's bundler.
5
- * The actual implementations are generated at install time in .nextspark/registries/
4
+ * These modules are virtual: a consumer project generates their real content
5
+ * (via `nextspark registry:build`) into `.nextspark/registries/` at build
6
+ * time. `packages/core` imports from them in its own source but never
7
+ * generates them itself, so it needs these ambient declarations to
8
+ * typecheck in isolation.
9
+ *
10
+ * Reconciled against the actual import surface in `packages/core/src`
11
+ * (see #131) — every module/export here is backed by a real `import` in the
12
+ * source tree, not aspirational. If you add a new import from
13
+ * `@nextsparkjs/registries/*`, add its shape here too.
6
14
  *
7
- * This file provides TypeScript with the type information it needs for compilation.
8
15
  * NOTE: This file must NOT have any imports to work as global declarations.
9
16
  */
10
17
 
11
18
  // ============================================================================
12
19
  // Billing Registry
13
20
  // ============================================================================
14
- declare module '@nextspark/registries/billing-registry' {
15
- export interface PlanDefinition {
16
- id: string
17
- slug: string
18
- name: string
19
- description?: string
20
- price: number
21
- interval: 'month' | 'year'
22
- features: string[]
23
- limits?: Record<string, number>
24
- visibility?: 'public' | 'private'
25
- }
21
+ declare module '@nextsparkjs/registries/billing-registry' {
22
+ // Mirrors packages/core/src/lib/billing/config-types.ts exactly (not
23
+ // imported — see permissions-registry above for why): billing/queries.ts
24
+ // type-annotates its return values against that hand-written type.
25
+ export type PlanType = 'free' | 'paid' | 'enterprise'
26
+ export type PlanVisibility = 'public' | 'hidden' | 'invite_only'
27
+ export type PaymentProvider = 'stripe' | 'polar'
26
28
 
27
29
  export interface FeatureDefinition {
28
- key: string
29
30
  name: string
30
31
  description?: string
31
32
  }
32
33
 
33
34
  export interface LimitDefinition {
34
- key: string
35
35
  name: string
36
- max: number
37
- resetPeriod?: string
36
+ unit: 'count' | 'bytes' | 'calls'
37
+ resetPeriod: 'never' | 'daily' | 'monthly' | 'yearly'
38
+ }
39
+
40
+ export interface PlanDefinition {
41
+ slug: string
42
+ name: string
43
+ description?: string
44
+ type: PlanType
45
+ visibility?: PlanVisibility
46
+ price?: { monthly: number; yearly: number }
47
+ trialDays?: number
48
+ features: string[]
49
+ limits: Record<string, number>
50
+ providerPriceIds?: { monthly?: string | null; yearly?: string | null }
51
+ }
52
+
53
+ export interface ActionMappings {
54
+ permissions?: Record<string, string>
55
+ features: Record<string, string>
56
+ limits: Record<string, string>
38
57
  }
39
58
 
40
59
  export interface BillingConfig {
41
- enabled: boolean
42
- provider: string
60
+ provider: PaymentProvider
61
+ currency: string
62
+ defaultPlan: string
43
63
  plans: PlanDefinition[]
44
- features: FeatureDefinition[]
45
- limits: LimitDefinition[]
64
+ features: Record<string, FeatureDefinition>
65
+ limits: Record<string, LimitDefinition>
66
+ actionMappings: ActionMappings
46
67
  }
47
68
 
48
69
  export const BILLING_REGISTRY: BillingConfig
49
- export const BILLING_MATRIX: Record<string, Record<string, boolean | number | string>>
70
+ // features[featureSlug][planSlug] -> has feature; limits[limitSlug][planSlug] -> value.
71
+ export const BILLING_MATRIX: {
72
+ features: Record<string, Record<string, boolean>>
73
+ limits: Record<string, Record<string, number>>
74
+ }
50
75
  export const PUBLIC_PLANS: readonly PlanDefinition[]
51
76
  export const BILLING_METADATA: {
52
77
  generatedAt: string
@@ -58,26 +83,89 @@ declare module '@nextspark/registries/billing-registry' {
58
83
  // ============================================================================
59
84
  // Block Registry
60
85
  // ============================================================================
61
- declare module '@nextspark/registries/block-registry' {
62
- export type BlockCategory = 'features' | 'cta' | 'faq' | 'content' | 'hero' | 'pricing' | 'stats' | 'testimonials' | string
86
+ declare module '@nextsparkjs/registries/block-registry' {
87
+ // Mirrors packages/core/src/types/blocks.ts's BlockConfig/FieldDefinition
88
+ // exactly (not imported — see permissions-registry above for why): core's
89
+ // own block.service.ts type-annotates its return values against that
90
+ // hand-written type, so registry values must be structurally identical
91
+ // to it, not just "close enough".
92
+ export type FieldType =
93
+ | 'text' | 'textarea' | 'url' | 'email' | 'number' | 'color' | 'image'
94
+ | 'media-library' | 'select' | 'checkbox' | 'radio' | 'rich-text'
95
+ | 'array' | 'date' | 'time'
96
+ export type FieldTab = 'content' | 'design' | 'advanced'
97
+
98
+ export type BlockCategory =
99
+ | 'hero' | 'content' | 'features' | 'cta' | 'testimonials' | 'media'
100
+ | 'forms' | 'navigation' | 'footer' | 'pricing' | 'team' | 'stats'
101
+ | 'faq' | 'newsletter' | 'other'
63
102
 
64
103
  export interface FieldDefinition {
65
104
  name: string
66
105
  label: string
67
- type: string
68
- tab?: string
106
+ type: FieldType
107
+ tab: FieldTab
69
108
  required?: boolean
70
- defaultValue?: unknown
109
+ default?: unknown
110
+ placeholder?: string
111
+ description?: string
112
+ helpText?: string
113
+ minLength?: number
114
+ maxLength?: number
115
+ rows?: number
116
+ min?: number
117
+ max?: number
118
+ step?: number
119
+ options?: Array<{ label: string; value: string | number }>
120
+ checkboxLabel?: string
121
+ accept?: string
122
+ maxSize?: number
123
+ aspectRatio?: string
124
+ itemType?: FieldType
125
+ itemFields?: FieldDefinition[]
126
+ minItems?: number
127
+ maxItems?: number
128
+ targetEntity?: string
129
+ displayField?: string
130
+ valueField?: string
131
+ relationshipType?: 'manyToOne' | 'manyToMany'
132
+ condition?: {
133
+ field: string
134
+ operator: 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan'
135
+ value: unknown
136
+ }
137
+ group?: string
138
+ groupLabel?: string
139
+ }
140
+
141
+ export interface BlockExample {
142
+ name: string
143
+ description?: string
144
+ props: Record<string, unknown>
71
145
  }
72
146
 
73
147
  export interface BlockConfig {
74
148
  slug: string
75
149
  name: string
76
- description?: string
150
+ description: string
77
151
  category: BlockCategory
78
152
  icon?: string
79
- fields?: FieldDefinition[]
80
- examples?: Record<string, unknown>[]
153
+ componentPath?: string
154
+ schemaPath?: string
155
+ fieldsPath?: string
156
+ thumbnail?: string
157
+ fieldDefinitions: FieldDefinition[]
158
+ examples: BlockExample[]
159
+ scope?: Array<'pages' | 'posts' | string>
160
+ allowInPatterns?: boolean
161
+ schemaType?: string
162
+ tags?: string[]
163
+ isCore?: boolean
164
+ source?: 'core' | 'theme' | 'plugin'
165
+ sourceId?: string
166
+ version?: string
167
+ deprecated?: boolean
168
+ replacedBy?: string
81
169
  }
82
170
 
83
171
  export const BLOCK_REGISTRY: Record<string, BlockConfig>
@@ -87,6 +175,12 @@ declare module '@nextspark/registries/block-registry' {
87
175
  blockCount: number
88
176
  categories: string[]
89
177
  }
178
+ // Lazy-loaded (client) and eagerly-loaded (SSR) component maps, keyed by
179
+ // block slug — populated by the registry generator, not by core. `any`
180
+ // props are correct here: each block's component has its own distinct
181
+ // props type, unifiable only as `ComponentType<any>` in a shared map.
182
+ export const BLOCK_COMPONENTS: Record<string, React.LazyExoticComponent<React.ComponentType<any>> | React.ComponentType<any>>
183
+ export const BLOCK_COMPONENTS_SSR: Record<string, React.ComponentType<any>>
90
184
 
91
185
  export function getBlock(name: string): BlockConfig | undefined
92
186
  export function getBlocksByCategory(category: BlockCategory): BlockConfig[]
@@ -94,9 +188,11 @@ declare module '@nextspark/registries/block-registry' {
94
188
  }
95
189
 
96
190
  // ============================================================================
97
- // Entity Registry (Server)
191
+ // Entity Registry (Server) — declared for completeness; no direct import
192
+ // found in packages/core/src today, but kept in case a consumer-facing
193
+ // contract still expects it.
98
194
  // ============================================================================
99
- declare module '@nextspark/registries/entity-registry' {
195
+ declare module '@nextsparkjs/registries/entity-registry' {
100
196
  export interface EntityConfig {
101
197
  slug: string
102
198
  label: string
@@ -135,7 +231,7 @@ declare module '@nextspark/registries/entity-registry' {
135
231
  // ============================================================================
136
232
  // Entity Registry (Client)
137
233
  // ============================================================================
138
- declare module '@nextspark/registries/entity-registry.client' {
234
+ declare module '@nextsparkjs/registries/entity-registry.client' {
139
235
  export interface ClientSidebarFieldConfig {
140
236
  name: string
141
237
  type: string
@@ -149,20 +245,25 @@ declare module '@nextspark/registries/entity-registry.client' {
149
245
  }
150
246
 
151
247
  export interface ClientEntityConfig {
152
- slug: string
153
- label: string
154
- labelPlural: string
155
- icon?: string
156
- enabled: boolean
157
- showInMenu: boolean
158
- permissions?: Record<string, string[]>
159
- fields?: Array<{
160
- name: string
161
- label: string
162
- type: string
163
- tab?: string
164
- required?: boolean
165
- }>
248
+ // Matches the REAL shape apps/dev's registry:build actually generates
249
+ // (packages/cli's entity-registry.client.ts template) — verified against
250
+ // a live-regenerated apps/dev/.nextspark/registries/entity-registry.client.ts,
251
+ // not guessed. A prior version of this ambient declaration invented a
252
+ // flat slug/label/labelPlural/enabled/showInMenu shape that never existed
253
+ // anywhere; it went uncaught because none of this package's own
254
+ // ClientEntityConfig consumers happened to read those particular fields
255
+ // (#131 follow-up).
256
+ name: string
257
+ apiPath: string
258
+ displayName: string
259
+ features: {
260
+ enabled: boolean
261
+ showInMenu?: boolean
262
+ canCreate?: boolean
263
+ canEdit?: boolean
264
+ canDelete?: boolean
265
+ searchable?: boolean
266
+ }
166
267
  builder?: {
167
268
  enabled?: boolean
168
269
  sidebarFields?: string[]
@@ -171,6 +272,12 @@ declare module '@nextspark/registries/entity-registry.client' {
171
272
  seo?: boolean
172
273
  public?: { basePath: string }
173
274
  }
275
+ taxonomies?: {
276
+ enabled?: boolean
277
+ types?: Array<{ type: string; label?: string; [key: string]: unknown }>
278
+ [key: string]: unknown
279
+ }
280
+ access?: { basePath?: string; [key: string]: unknown }
174
281
  }
175
282
 
176
283
  export interface ClientEntityRegistry {
@@ -187,289 +294,515 @@ declare module '@nextspark/registries/entity-registry.client' {
187
294
  export function hasEntity(name: string): boolean
188
295
  export function getEntityDisplayName(slug: string): string
189
296
  export function getAllEntityConfigs(): ClientEntityConfig[]
297
+
298
+ // Child-entity relation helpers (relation-display, simple-relation-select).
299
+ // Always returns an object (never null) — callers check `.isChild`.
300
+ export interface ParsedChildEntity {
301
+ isChild: boolean
302
+ parentEntity?: string
303
+ childType?: string
304
+ [key: string]: unknown
305
+ }
306
+ export function parseChildEntity(entityType: string): ParsedChildEntity
307
+
308
+ // Metadata-system adapter object (not a factory) consumed directly by
309
+ // lib/api/entities.ts as `clientMetaSystemAdapter.getApiPath(...)`.
310
+ export const clientMetaSystemAdapter: {
311
+ getApiPath(entityType: string): string | null
312
+ getAllEntityConfigs(): Array<{
313
+ name: string
314
+ apiPath?: string
315
+ features?: { enabled?: boolean; canDelete?: boolean; canEdit?: boolean; [key: string]: unknown }
316
+ [key: string]: unknown
317
+ }>
318
+ }
319
+ }
320
+
321
+ // ============================================================================
322
+ // Entity Types (search/type metadata — distinct from entity-registry)
323
+ // ============================================================================
324
+ declare module '@nextsparkjs/registries/entity-types' {
325
+ export type EntityName = string
326
+ export type SystemSearchType = 'task' | 'page' | 'setting' | 'entity' | string
327
+ export type SearchResultType = EntityName | SystemSearchType
328
+
329
+ export const SEARCH_TYPE_PRIORITIES: Record<string, number>
330
+ export const ENTITY_METADATA: {
331
+ generatedAt: string
332
+ entityNames: EntityName[]
333
+ totalEntities: number
334
+ }
190
335
  }
191
336
 
192
337
  // ============================================================================
193
338
  // Theme Registry
194
339
  // ============================================================================
195
- declare module '@nextspark/registries/theme-registry' {
340
+ declare module '@nextsparkjs/registries/theme-registry' {
341
+ // Mirrors packages/core/src/types/theme.ts's ThemeConfig — its own index
342
+ // signature (`[key: string]: any`) makes it permissive enough that only
343
+ // the required fields need to match exactly.
196
344
  export interface ThemeConfig {
197
345
  name: string
198
346
  displayName: string
347
+ version: string
199
348
  description?: string
200
- version?: string
201
349
  author?: string
350
+ [key: string]: any
202
351
  }
203
352
 
204
- export interface DashboardConfig {
205
- sidebarCollapsible?: boolean
206
- showBreadcrumbs?: boolean
207
- defaultRoute?: string
353
+ export interface ThemeEntity {
354
+ slug: string
355
+ [key: string]: unknown
208
356
  }
209
357
 
210
- export interface AppConfig {
211
- name: string
212
- description?: string
213
- url?: string
358
+ export interface ThemeRouteFile {
359
+ path: string
360
+ [key: string]: unknown
214
361
  }
215
362
 
216
- export interface DevConfig {
217
- debug?: boolean
218
- showDevTools?: boolean
219
- }
363
+ export type ThemeName = string
220
364
 
221
- export const THEME_REGISTRY: {
222
- active: string
365
+ export interface ThemeRegistryEntry {
366
+ name: string
223
367
  config: ThemeConfig
224
- dashboard: DashboardConfig
225
- app: AppConfig
226
- dev: DevConfig
368
+ // `any` (not `unknown`): themes extend these with arbitrary, theme-specific
369
+ // shapes (customSidebarSections, docs.public, etc.) that core only passes
370
+ // through — an index signature here would still force `unknown` on
371
+ // property access and break every consumer's own narrower usage.
372
+ dashboardConfig?: Record<string, any>
373
+ appConfig?: Record<string, any>
374
+ devConfig?: Record<string, any> | null
375
+ entities?: ThemeEntity[]
376
+ routeFiles?: ThemeRouteFile[]
377
+ plugins?: string[]
227
378
  }
228
379
 
380
+ export const THEME_REGISTRY: Record<string, ThemeRegistryEntry>
381
+
229
382
  export const THEME_METADATA: {
230
383
  generatedAt: string
231
384
  activeTheme: string
385
+ themes: string[]
386
+ totalThemes: number
232
387
  }
233
388
  }
234
389
 
235
390
  // ============================================================================
236
391
  // Permissions Registry
237
- // ============================================================================
238
- declare module '@nextspark/registries/permissions-registry' {
239
- export interface PermissionConfig {
240
- roles: Record<string, string[]>
241
- permissions: string[]
242
- }
243
-
244
- export const PERMISSIONS_REGISTRY: PermissionConfig
392
+ //
393
+ // Real shape is entirely different from the old ambient declaration (which
394
+ // declared a single PERMISSIONS_REGISTRY object) — permission.service.ts
395
+ // imports a dozen independent pre-computed data structures directly.
396
+ // ============================================================================
397
+ declare module '@nextsparkjs/registries/permissions-registry' {
398
+ // Inlined instead of imported: nested `import type` inside a
399
+ // `declare module` block silently degrades every consumer's inferred
400
+ // types to `any` in this TS setup (isolatedModules + bundler resolution),
401
+ // which is exactly why the original file said "must not have any
402
+ // imports". Kept structurally compatible with lib/permissions/types.ts.
403
+ export type Permission = `${string}.${string}`
404
+ // Consuming code re-exports/returns these as plain mutable arrays — not
405
+ // `readonly` here, to stay assignable to those signatures.
406
+ export interface ResolvedPermission {
407
+ id: Permission
408
+ label: string
409
+ description?: string
410
+ category: string
411
+ roles: string[]
412
+ dangerous?: boolean
413
+ requires?: Permission[]
414
+ source: 'core' | 'theme' | 'entity'
415
+ disabled: boolean
416
+ }
417
+
418
+ export const ALL_PERMISSIONS: Permission[]
419
+ export const ALL_PERMISSIONS_SET: ReadonlySet<Permission>
420
+ export const ALL_RESOLVED_PERMISSIONS: ResolvedPermission[]
421
+ export const PERMISSIONS_BY_ROLE: Record<string, ReadonlySet<Permission>>
422
+ export const ROLE_PERMISSIONS_ARRAY: Record<string, Permission[]>
423
+ export const PERMISSIONS_BY_CATEGORY: Record<string, ResolvedPermission[]>
424
+ export const FULL_MATRIX: Record<string, Record<string, boolean>>
425
+ export const UI_SECTIONS: {
426
+ key: string
427
+ label: string
428
+ permissions: Permission[]
429
+ }[]
430
+ export const AVAILABLE_ROLES: string[]
431
+ export const TEAM_PERMISSIONS_BY_ROLE: Record<string, string[]>
245
432
  export const PERMISSIONS_METADATA: {
246
433
  generatedAt: string
247
- roleCount: number
248
434
  permissionCount: number
249
435
  }
250
-
251
- export function getPermissionsForRole(role: string): string[]
252
- export function hasPermission(role: string, permission: string): boolean
253
- export function getAllRoles(): string[]
254
- export function getAllPermissions(): string[]
436
+ export const ROLE_HIERARCHY: Record<string, number>
437
+ export const ROLE_DISPLAY_NAMES: Record<string, string>
438
+ export const ROLE_DESCRIPTIONS: Record<string, string>
439
+ export const DEFAULT_TEAM_ROLE: string
255
440
  }
256
441
 
257
442
  // ============================================================================
258
443
  // Plugin Registry (Server)
259
444
  // ============================================================================
260
- declare module '@nextspark/registries/plugin-registry' {
261
- export interface PluginConfig {
262
- name: string
263
- displayName: string
264
- description?: string
265
- version?: string
266
- enabled: boolean
267
- author?: string
445
+ declare module '@nextsparkjs/registries/plugin-registry' {
446
+ export interface RouteFileEndpoint {
447
+ path: string
448
+ methods: string[]
449
+ [key: string]: unknown
450
+ }
451
+
452
+ export interface PluginEntity {
453
+ slug: string
454
+ [key: string]: unknown
268
455
  }
269
456
 
457
+ export type PluginName = string
458
+
270
459
  export interface PluginRegistryEntry {
271
- config: PluginConfig
272
- hooks?: Record<string, Function>
460
+ name: string
461
+ config: Record<string, unknown>
462
+ enabled: boolean
463
+ entities?: PluginEntity[]
464
+ routes?: RouteFileEndpoint[]
465
+ hooks?: Record<string, (...args: unknown[]) => unknown>
273
466
  }
274
467
 
275
468
  export const PLUGIN_REGISTRY: Record<string, PluginRegistryEntry>
469
+ export const ROUTE_METADATA: {
470
+ generatedAt: string
471
+ handlerCount: number
472
+ }
276
473
  export const PLUGIN_METADATA: {
277
474
  generatedAt: string
278
475
  pluginCount: number
279
476
  enabledCount: number
280
477
  }
281
-
282
- export function getPlugin(name: string): PluginRegistryEntry | undefined
283
- export function getAllPlugins(): PluginRegistryEntry[]
284
- export function getEnabledPlugins(): PluginRegistryEntry[]
285
- export function isPluginEnabled(name: string): boolean
286
478
  }
287
479
 
288
480
  // ============================================================================
289
481
  // Plugin Registry (Client)
290
482
  // ============================================================================
291
- declare module '@nextspark/registries/plugin-registry.client' {
292
- export interface ClientPluginConfig {
293
- name: string
294
- displayName: string
295
- enabled: boolean
296
- features?: string[]
483
+ declare module '@nextsparkjs/registries/plugin-registry.client' {
484
+ export interface PluginNavItem {
485
+ label: string
486
+ href: string
487
+ icon?: string
488
+ description?: string
489
+ [key: string]: unknown
297
490
  }
298
491
 
299
- export const PLUGIN_REGISTRY: Record<string, ClientPluginConfig>
300
-
301
- export function getPlugin(name: string): ClientPluginConfig | undefined
302
- export function getAllPlugins(): ClientPluginConfig[]
303
- export function isPluginEnabled(name: string): boolean
492
+ export function getPluginNavItems(context: string): PluginNavItem[]
304
493
  }
305
494
 
306
495
  // ============================================================================
307
496
  // Template Registry (Server)
308
497
  // ============================================================================
309
- declare module '@nextspark/registries/template-registry' {
498
+ declare module '@nextsparkjs/registries/template-registry' {
499
+ export type TemplatePath = string
500
+
501
+ export interface TemplateOverride {
502
+ themeName: string
503
+ templateType: string
504
+ [key: string]: unknown
505
+ }
506
+
310
507
  export interface TemplateRegistryEntry {
311
- path: string
312
- component: React.ComponentType<any>
313
- source: 'core' | 'theme' | 'plugin'
314
- metadata?: Record<string, unknown>
508
+ appPath: TemplatePath
509
+ component: unknown
510
+ template: TemplateOverride
511
+ alternatives: TemplateOverride[]
315
512
  }
316
513
 
317
514
  export const TEMPLATE_REGISTRY: Record<string, TemplateRegistryEntry>
318
- export const LAYOUT_REGISTRY: Record<string, TemplateRegistryEntry>
319
515
  export const TEMPLATE_METADATA: {
320
516
  generatedAt: string
321
- templateCount: number
322
- layoutCount: number
323
- }
324
-
325
- export function getTemplate(path: string): TemplateRegistryEntry | undefined
326
- export function getLayout(path: string): TemplateRegistryEntry | undefined
327
- }
328
-
329
- // ============================================================================
330
- // Template Registry (Client)
331
- // ============================================================================
332
- declare module '@nextspark/registries/template-registry.client' {
333
- export interface ClientTemplateEntry {
334
- path: string
335
- component: React.ComponentType<any>
517
+ totalTemplates: number
518
+ templateTypes: string[]
336
519
  }
337
-
338
- export const TEMPLATE_REGISTRY: Record<string, ClientTemplateEntry>
339
-
340
- export function getTemplate(path: string): ClientTemplateEntry | undefined
341
520
  }
342
521
 
343
522
  // ============================================================================
344
523
  // Testing Registry
524
+ //
525
+ // Real shape is four independent top-level exports, not a single nested
526
+ // TESTING_REGISTRY object like the old ambient declaration had.
345
527
  // ============================================================================
346
- declare module '@nextspark/registries/testing-registry' {
347
- export interface TestFeature {
528
+ declare module '@nextsparkjs/registries/testing-registry' {
529
+ export type FeatureCategory = string
530
+ export type FlowCategory = string
531
+
532
+ export interface FeatureEntry {
348
533
  key: string
349
534
  name: string
350
- description?: string
351
- category?: string
535
+ description: string
536
+ category: FeatureCategory
537
+ tag: string
352
538
  tags?: string[]
353
- enabled?: boolean
354
- testing?: {
539
+ testing: {
540
+ testCount: number
541
+ hasTests: boolean
355
542
  selectors?: Record<string, string>
356
543
  flows?: string[]
357
544
  }
358
545
  }
359
546
 
360
- export interface TestFlow {
547
+ export interface FlowEntry {
361
548
  key: string
362
549
  name: string
363
- description?: string
364
- steps?: string[]
550
+ description: string
551
+ category: FlowCategory
552
+ tag: string
365
553
  tags?: string[]
554
+ steps?: string[]
555
+ criticalPath?: boolean
556
+ testing: {
557
+ testCount: number
558
+ hasTests: boolean
559
+ }
366
560
  }
367
561
 
368
- export interface TestBlock {
369
- slug: string
370
- name: string
371
- fields?: Array<{
372
- name: string
373
- label: string
374
- type: string
375
- tab?: string
376
- }>
377
- examples?: Record<string, unknown>[]
378
- }
379
-
380
- export const TESTING_REGISTRY: {
381
- features: TestFeature[]
382
- flows: TestFlow[]
383
- blocks: TestBlock[]
384
- selectors: Record<string, string>
562
+ export const FEATURE_REGISTRY: Record<string, FeatureEntry>
563
+ export const FLOW_REGISTRY: Record<string, FlowEntry>
564
+ // Keyed by fixed category names (consumers do `keyof typeof TAGS_REGISTRY`
565
+ // and cast each category's value to their own local shape), not an index
566
+ // signature.
567
+ export const TAGS_REGISTRY: {
568
+ layers: Record<string, { tag: string; testCount: number; files: string[] }>
569
+ priorities: Record<string, { tag: string; testCount: number; files: string[] }>
570
+ features: Record<string, { tag: string; testCount: number; files: string[] }>
571
+ flows: Record<string, { tag: string; testCount: number; files: string[] }>
572
+ blocks: Record<string, { tag: string; testCount: number; files: string[] }>
573
+ roles: Record<string, { tag: string; testCount: number; files: string[] }>
574
+ operations: Record<string, { tag: string; testCount: number; files: string[] }>
575
+ other: Record<string, { tag: string; testCount: number; files: string[] }>
576
+ }
577
+ export const COVERAGE_SUMMARY: {
578
+ features: { total: number; withTests: number; withoutTests: number }
579
+ flows: { total: number; withTests: number; withoutTests: number }
580
+ tags: { testFiles: number }
385
581
  }
386
-
387
- export function getFeature(name: string): TestFeature | undefined
388
- export function getFlow(name: string): TestFlow | undefined
389
- export function getBlock(name: string): TestBlock | undefined
390
- export function getSelector(name: string): string | undefined
391
582
  }
392
583
 
393
584
  // ============================================================================
394
585
  // Translation Registry
395
- // ============================================================================
396
- declare module '@nextspark/registries/translation-registry' {
397
- export type SupportedLocale = 'en' | 'es' | string
398
-
399
- export const TRANSLATION_REGISTRY: {
400
- locales: SupportedLocale[]
401
- defaultLocale: SupportedLocale
402
- messages: Record<SupportedLocale, Record<string, unknown>>
403
- }
404
-
405
- export const TRANSLATION_METADATA: {
406
- generatedAt: string
407
- localeCount: number
408
- defaultLocale: string
409
- }
410
-
411
- export function getMessages(locale: SupportedLocale): Record<string, unknown>
412
- export function getSupportedLocales(): SupportedLocale[]
586
+ //
587
+ // Real shape is three independent lazy-loader maps, not a single
588
+ // TRANSLATION_REGISTRY object like the old ambient declaration had.
589
+ // ============================================================================
590
+ declare module '@nextsparkjs/registries/translation-registry' {
591
+ export type TranslationLoader = () => Promise<Record<string, unknown>>
592
+
593
+ // theme -> locale -> loader
594
+ export const THEME_TRANSLATION_LOADERS: Record<string, Record<string, TranslationLoader>>
595
+ // theme -> entity -> locale -> loader
596
+ export const ENTITY_TRANSLATION_LOADERS: Record<string, Record<string, Record<string, TranslationLoader>>>
597
+ // pluginName -> entity -> locale -> loader
598
+ export const PLUGIN_ENTITY_TRANSLATION_LOADERS: Record<string, Record<string, Record<string, TranslationLoader>>>
413
599
  }
414
600
 
415
601
  // ============================================================================
416
602
  // Route Handlers Registry
603
+ //
604
+ // Real shape is API-route metadata + theme/plugin handler maps, not the
605
+ // single ROUTE_HANDLERS export the old ambient declaration had.
417
606
  // ============================================================================
418
- declare module '@nextspark/registries/route-handlers' {
419
- export interface RouteHandler {
607
+ declare module '@nextsparkjs/registries/route-handlers' {
608
+ export interface ApiRouteEntry {
420
609
  path: string
421
- methods: ('GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE')[]
422
- handler: Function
423
- source: 'core' | 'theme' | 'plugin'
610
+ methods: string[]
611
+ source?: string
612
+ subcategory?: string
613
+ [key: string]: unknown
424
614
  }
425
615
 
426
- export const ROUTE_HANDLERS: Record<string, RouteHandler>
427
- export const ROUTE_METADATA: {
616
+ export const API_ROUTES_METADATA: {
617
+ core: ApiRouteEntry[]
618
+ entities: ApiRouteEntry[]
619
+ theme: ApiRouteEntry[]
620
+ plugins: ApiRouteEntry[]
621
+ }
622
+ export const API_ROUTES_SUMMARY: {
623
+ totalRoutes: number
624
+ byCategory: Record<'core' | 'entity' | 'theme' | 'plugin', number>
428
625
  generatedAt: string
429
- handlerCount: number
430
626
  }
627
+
628
+ // A single Next.js Route Handler function for one HTTP method.
629
+ export type RouteHandler = (
630
+ request: import('next/server').NextRequest,
631
+ context: { params: Promise<Record<string, string>> }
632
+ ) => Promise<Response> | Response
633
+
634
+ // Keyed by route key, then by HTTP method.
635
+ export const THEME_ROUTE_HANDLERS: Record<string, Record<string, RouteHandler>>
636
+ export const PLUGIN_ROUTE_HANDLERS: Record<string, Record<string, RouteHandler>>
431
637
  }
432
638
 
433
639
  // ============================================================================
434
640
  // Docs Registry
435
- // ============================================================================
436
- declare module '@nextspark/registries/docs-registry' {
641
+ //
642
+ // DocPageMeta / DocSectionMeta / DocsRegistryStructure are real, hand-written
643
+ // types in packages/core/src/types/docs.ts — this module only supplies the
644
+ // runtime values and query functions the generator produces.
645
+ // ============================================================================
646
+ declare module '@nextsparkjs/registries/docs-registry' {
647
+ // Inlined instead of imported (see permissions-registry above for why) —
648
+ // kept structurally compatible with src/types/docs.ts.
437
649
  export interface DocPageMeta {
438
650
  slug: string
439
651
  title: string
440
- description?: string
441
- order?: number
652
+ order: number
653
+ path: string
654
+ source: 'public' | 'superadmin'
442
655
  }
443
656
 
444
657
  export interface DocSectionMeta {
445
- slug: string
446
658
  title: string
447
- description?: string
659
+ slug: string
660
+ order: number
448
661
  pages: DocPageMeta[]
449
- source: 'core' | 'theme' | 'plugin'
662
+ source: 'public' | 'superadmin'
450
663
  }
451
664
 
452
- export const DOCS_REGISTRY: {
453
- sections: DocSectionMeta[]
665
+ export interface DocsRegistryStructure {
666
+ public: DocSectionMeta[]
667
+ superadmin: DocSectionMeta[]
668
+ all: DocSectionMeta[]
454
669
  }
455
670
 
671
+ export const DOCS_REGISTRY: DocsRegistryStructure
672
+
456
673
  export function getAllDocSections(): DocSectionMeta[]
674
+ export function getPublicDocSections(): DocSectionMeta[]
675
+ export function getSuperadminDocSections(): DocSectionMeta[]
457
676
  export function findDocSection(slug: string): DocSectionMeta | undefined
677
+ export function findDocSectionInCategory(
678
+ slug: string,
679
+ category: 'public' | 'superadmin'
680
+ ): DocSectionMeta | undefined
458
681
  export function findDocPage(sectionSlug: string, pageSlug: string): DocPageMeta | undefined
459
682
  }
460
683
 
461
684
  // ============================================================================
462
- // Middleware Registry
685
+ // API Docs Registry
463
686
  // ============================================================================
464
- declare module '@nextspark/registries/middleware-registry' {
465
- export interface MiddlewareConfig {
466
- name: string
467
- matcher: string | string[]
468
- handler: Function
469
- order?: number
687
+ declare module '@nextsparkjs/registries/api-docs-registry' {
688
+ // Mirrors packages/core/src/types/api-presets.ts's ApiDocEntry /
689
+ // ApiDocsRegistryStructure exactly (not imported — see permissions-registry
690
+ // above for why): devtools components type-annotate against that
691
+ // hand-written file directly, not against this registry module.
692
+ export type ApiPresetSource = 'entity' | 'route' | 'core'
693
+
694
+ export interface ApiDocEntry {
695
+ path: string
696
+ title: string
697
+ endpoint: string
698
+ source?: ApiPresetSource
699
+ }
700
+
701
+ export const API_DOCS_REGISTRY: {
702
+ docs: Record<string, ApiDocEntry>
703
+ meta: { totalDocs: number; generatedAt: string; themeName: string }
704
+ }
705
+
706
+ export function getDocForEndpoint(endpoint: string): ApiDocEntry | undefined
707
+ export function hasDoc(endpoint: string): boolean
708
+ export function getAllDocEndpoints(): string[]
709
+ }
710
+
711
+ // ============================================================================
712
+ // API Presets Registry
713
+ // ============================================================================
714
+ declare module '@nextsparkjs/registries/api-presets-registry' {
715
+ // Mirrors packages/core/src/types/api-presets.ts's ApiPreset /
716
+ // ApiEndpointPresets / ApiPresetsRegistryStructure exactly (not imported —
717
+ // see permissions-registry above for why).
718
+ export type ApiPresetSource = 'entity' | 'route' | 'core'
719
+
720
+ export interface PresetSessionConfig {
721
+ crossTeam?: boolean
722
+ teamId?: string
723
+ authType?: 'session' | 'apiKey'
724
+ }
725
+
726
+ export interface ApiPreset {
727
+ id: string
728
+ title: string
729
+ description?: string
730
+ method: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE' | 'OPTIONS'
731
+ path?: string
732
+ pathParams?: Record<string, string>
733
+ params?: Record<string, string | number | boolean>
734
+ queryParams?: Record<string, string | number | boolean>
735
+ headers?: Record<string, string>
736
+ payload?: Record<string, unknown>
737
+ sessionConfig?: PresetSessionConfig
738
+ tags?: string[]
739
+ }
740
+
741
+ export interface ApiEndpointPresets {
742
+ endpoint?: string
743
+ summary?: string
744
+ presets: ApiPreset[]
745
+ sourcePath?: string
746
+ source?: ApiPresetSource
747
+ }
748
+
749
+ export const API_PRESETS_REGISTRY: {
750
+ endpoints: Record<string, ApiEndpointPresets>
751
+ meta: { totalEndpoints: number; totalPresets: number; generatedAt: string; themeName: string }
752
+ }
753
+
754
+ export function getPresetsForEndpoint(endpoint: string): ApiEndpointPresets | undefined
755
+ export function getPresetsByMethod(endpoint: string, method: string): ApiPreset[]
756
+ export function getAllPresets(): ApiEndpointPresets[]
757
+ export function hasPresets(endpoint: string): boolean
758
+ }
759
+
760
+ // ============================================================================
761
+ // Email Registry
762
+ //
763
+ // Keyed by slug ('verify-email', 'reset-password', 'otp-verification',
764
+ // 'team-invitation', plus any consumer-defined slugs). Callers index with a
765
+ // known literal and pass their own typed `data`, so `any` here is the
766
+ // correct (and only sound) parameter type for the shared function shape.
767
+ // ============================================================================
768
+ declare module '@nextsparkjs/registries/email-registry' {
769
+ // Mirrors packages/core/src/lib/email/types.ts's EmailContent — callers
770
+ // in lib/email/send.ts type-check the result against that hand-written
771
+ // type, so `unknown` here would make every call site fail.
772
+ export interface EmailContent {
773
+ subject: string
774
+ html: string
775
+ text?: string
470
776
  }
471
777
 
472
- export const MIDDLEWARE_REGISTRY: MiddlewareConfig[]
778
+ export const EMAIL_REGISTRY: Record<
779
+ string,
780
+ (data: any, locale?: string) => EmailContent | Promise<EmailContent>
781
+ >
782
+ }
783
+
784
+ // ============================================================================
785
+ // Middleware Registry
786
+ // ============================================================================
787
+ declare module '@nextsparkjs/registries/middleware-registry' {
788
+ // Inline `import(...)` type queries instead of file-level `import type`
789
+ // (see permissions-registry above for why) — next/server is a real,
790
+ // stable package so referencing its types this way is exact, not a
791
+ // structural approximation like the other inlined modules.
792
+ export type ThemeName = string
793
+
794
+ export interface MiddlewareRegistryEntry {
795
+ exists: boolean
796
+ middleware: (
797
+ request: import('next/server').NextRequest,
798
+ // `any`, not a shallow shape: SessionUser is a complex better-auth
799
+ // inferred type ($Infer.Session.user & extra fields) core can't
800
+ // reproduce structurally here without importing it.
801
+ user?: any
802
+ ) => Promise<import('next/server').NextResponse | null>
803
+ }
804
+
805
+ export const MIDDLEWARE_REGISTRY: Record<string, MiddlewareRegistryEntry>
473
806
  export const MIDDLEWARE_METADATA: {
474
807
  generatedAt: string
475
808
  middlewareCount: number
@@ -478,52 +811,63 @@ declare module '@nextspark/registries/middleware-registry' {
478
811
 
479
812
  // ============================================================================
480
813
  // Namespace Registry
814
+ //
815
+ // Real export is NAMESPACE_CONFIG (singular config object), not
816
+ // NAMESPACE_REGISTRY like the old ambient declaration had.
481
817
  // ============================================================================
482
- declare module '@nextspark/registries/namespace-registry' {
483
- export interface NamespaceConfig {
484
- name: string
485
- prefix: string
486
- routes?: string[]
818
+ declare module '@nextsparkjs/registries/namespace-registry' {
819
+ export interface RouteNamespaceConfig {
820
+ core: string[]
821
+ entities: string[]
822
+ strategy: string
487
823
  }
488
824
 
489
- export const NAMESPACE_REGISTRY: Record<string, NamespaceConfig>
490
- export const NAMESPACE_METADATA: {
491
- generatedAt: string
492
- namespaceCount: number
825
+ export interface NamespaceConfig {
826
+ core: string[]
827
+ entities: string[]
828
+ routes: Record<string, RouteNamespaceConfig>
829
+ entityPaths: string[]
493
830
  }
831
+
832
+ export const NAMESPACE_CONFIG: NamespaceConfig
494
833
  }
495
834
 
496
835
  // ============================================================================
497
836
  // Scope Registry
837
+ //
838
+ // Real exports are SCOPE_CONFIG / API_CONFIG, not SCOPE_REGISTRY like the
839
+ // old ambient declaration had.
498
840
  // ============================================================================
499
- declare module '@nextspark/registries/scope-registry' {
841
+ declare module '@nextsparkjs/registries/scope-registry' {
842
+ // SCOPE_CONFIG/API_CONFIG are each a single fixed-shape object, not maps
843
+ // keyed by scope name.
500
844
  export interface ScopeConfig {
501
- name: string
502
- permissions: string[]
503
- description?: string
845
+ base: string[]
846
+ roles: Record<string, string[]>
847
+ flags: Record<string, string[]>
848
+ restrictions: Record<string, { remove?: string[]; allow_only?: string[] }>
504
849
  }
505
850
 
506
- export const SCOPE_REGISTRY: Record<string, ScopeConfig>
507
- export const SCOPE_METADATA: {
508
- generatedAt: string
509
- scopeCount: number
851
+ export interface ApiConfig {
852
+ filters: { allowed: string[] }
853
+ entityPaths: string[]
510
854
  }
855
+
856
+ export const SCOPE_CONFIG: ScopeConfig
857
+ export const API_CONFIG: ApiConfig
511
858
  }
512
859
 
513
860
  // ============================================================================
514
861
  // Scheduled Actions Registry
862
+ //
863
+ // Keyed by theme name, not a flat array like the old ambient declaration
864
+ // had — each entry exposes registerAllHandlers() (initializer.ts).
515
865
  // ============================================================================
516
- declare module '@nextspark/registries/scheduled-actions-registry' {
517
- export interface ScheduledAction {
518
- name: string
519
- cron: string
520
- handler: Function
521
- enabled?: boolean
866
+ declare module '@nextsparkjs/registries/scheduled-actions-registry' {
867
+ export interface ScheduledActionsModule {
868
+ registerAllHandlers: () => void
869
+ registerRecurringActions: () => Promise<void>
522
870
  }
523
871
 
524
- export const SCHEDULED_ACTIONS_REGISTRY: ScheduledAction[]
525
- export const SCHEDULED_ACTIONS_METADATA: {
526
- generatedAt: string
527
- actionCount: number
528
- }
872
+ export const SCHEDULED_ACTIONS_REGISTRY: Record<string, ScheduledActionsModule | undefined>
529
873
  }