@infuro/cms-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,543 @@
1
+ import { S as StorageService } from './index-DP3LK1XN.js';
2
+ export { A as AnalyticsHandlerConfig, a as AuthHandlersConfig, B as BlogBySlugConfig, C as ChangePasswordConfig, b as CmsApiHandlerConfig, c as CmsGetter, d as CrudHandlerOptions, D as DashboardStatsConfig, E as EntityMap, F as ForgotPasswordConfig, e as FormBySlugConfig, I as InviteAcceptConfig, f as SetPasswordConfig, g as SettingsApiConfig, U as UploadHandlerConfig, h as UserAuthApiConfig, i as UserAvatarConfig, j as UserProfileConfig, k as UsersApiConfig, l as createAnalyticsHandlers, m as createBlogBySlugHandler, n as createChangePasswordHandler, o as createCmsApiHandler, p as createCrudByIdHandler, q as createCrudHandler, r as createDashboardStatsHandler, s as createForgotPasswordHandler, t as createFormBySlugHandler, u as createInviteAcceptHandler, v as createSetPasswordHandler, w as createSettingsApiHandlers, x as createUploadHandler, y as createUserAuthApiRouter, z as createUserAvatarHandler, G as createUserProfileHandler, H as createUsersApiHandlers } from './index-DP3LK1XN.js';
3
+ import { ClassValue } from 'clsx';
4
+ import * as typeorm from 'typeorm';
5
+ import { EntityTarget } from 'typeorm';
6
+ export { AuthHelpers, CmsMiddlewareConfig, GetSession, NextAuthOptionsConfig, NextAuthUser, OPEN_ENDPOINTS, PERMISSION_REQUIRED_ENDPOINTS, SessionUser, createAuthHelpers, createCmsMiddleware, defaultPublicApiMethods, getNextAuthOptions, getRequiredPermission, isOpenEndpoint, isPublicMethod } from './auth.js';
7
+ export { A as AdminNavItem, D as DEFAULT_ADMIN_NAV } from './config-DJ5CmQvS.js';
8
+ import 'next-auth';
9
+
10
+ interface PluginContext {
11
+ dataSource: unknown;
12
+ config: Record<string, string>;
13
+ logger: Logger;
14
+ }
15
+ interface Logger {
16
+ info(message: string, ...args: unknown[]): void;
17
+ warn(message: string, ...args: unknown[]): void;
18
+ error(message: string, ...args: unknown[]): void;
19
+ }
20
+ /** Plugin init may return an instance (e.g. service) that will be returned by getPlugin(name). */
21
+ interface CmsPlugin<TInstance = unknown> {
22
+ name: string;
23
+ version: string;
24
+ init(context: PluginContext): Promise<void | TInstance>;
25
+ destroy?(): Promise<void>;
26
+ }
27
+
28
+ interface CreateCmsAppOptions {
29
+ dataSource: unknown;
30
+ config?: Record<string, string>;
31
+ plugins?: CmsPlugin[];
32
+ logger?: PluginContext['logger'];
33
+ }
34
+ interface CmsApp {
35
+ dataSource: unknown;
36
+ getPlugin<T = unknown>(name: string): T | undefined;
37
+ }
38
+ declare function createCmsApp(options: CreateCmsAppOptions): Promise<CmsApp>;
39
+
40
+ interface ERPAuthToken {
41
+ access_token: string;
42
+ token_type: string;
43
+ expires_in: number;
44
+ expires_at?: number;
45
+ }
46
+ declare class ERPAuthService {
47
+ private baseUrl;
48
+ private credentials;
49
+ private token;
50
+ constructor(config: {
51
+ baseUrl?: string;
52
+ clientId: string;
53
+ clientSecret: string;
54
+ tenantId: string;
55
+ });
56
+ authenticate(): Promise<ERPAuthToken>;
57
+ getValidToken(): Promise<string>;
58
+ makeAuthenticatedRequest(url: string, options?: RequestInit): Promise<Response>;
59
+ }
60
+
61
+ interface ContactFormData {
62
+ firstName: string;
63
+ lastName: string;
64
+ email: string;
65
+ phone?: string;
66
+ industry?: string;
67
+ message?: string;
68
+ }
69
+ interface ERPSubmissionResult {
70
+ success: boolean;
71
+ contactId: string;
72
+ opportunityId?: string;
73
+ error?: string;
74
+ }
75
+ declare class ERPSubmissionService {
76
+ private baseUrl;
77
+ private pipelineId;
78
+ private pipelineStageId;
79
+ private auth;
80
+ constructor(config: {
81
+ baseUrl?: string;
82
+ pipelineId: string;
83
+ pipelineStageId: string;
84
+ auth: ERPAuthService;
85
+ });
86
+ submitContact(formData: ContactFormData): Promise<ERPSubmissionResult>;
87
+ extractContactData(formData: Record<string, unknown>, formFields: {
88
+ id: string | number;
89
+ type: string;
90
+ label: string;
91
+ }[]): ContactFormData | null;
92
+ }
93
+
94
+ interface ERPPluginConfig {
95
+ baseUrl?: string;
96
+ clientId: string;
97
+ clientSecret: string;
98
+ tenantId: string;
99
+ pipelineId?: string;
100
+ pipelineStageId?: string;
101
+ }
102
+ interface ERPPluginInstance {
103
+ auth: ERPAuthService;
104
+ submission: ERPSubmissionService;
105
+ }
106
+ declare function erpPlugin(config: ERPPluginConfig): CmsPlugin<ERPPluginInstance>;
107
+
108
+ interface EmailPluginConfig$1 {
109
+ type: 'AWS' | 'SMTP' | 'GMAIL' | 'SENDGRID';
110
+ user?: string;
111
+ password?: string;
112
+ from: string;
113
+ to: string;
114
+ region?: string;
115
+ accessKeyId?: string;
116
+ secretAccessKey?: string;
117
+ }
118
+ interface EmailData {
119
+ subject: string;
120
+ html: string;
121
+ text?: string;
122
+ to?: string;
123
+ from?: string;
124
+ }
125
+ interface EmailServiceInterface {
126
+ send(emailData: EmailData): Promise<boolean>;
127
+ }
128
+ declare class EmailService implements EmailServiceInterface {
129
+ private config;
130
+ private sesClient?;
131
+ private transporter?;
132
+ constructor(config: EmailPluginConfig$1);
133
+ send(emailData: EmailData): Promise<boolean>;
134
+ }
135
+ declare const emailTemplates: {
136
+ formSubmission: (data: {
137
+ formName: string;
138
+ contactName: string;
139
+ contactEmail: string;
140
+ formData: unknown;
141
+ }) => {
142
+ subject: string;
143
+ html: string;
144
+ text: string;
145
+ };
146
+ contactSubmission: (data: {
147
+ name: string;
148
+ email: string;
149
+ phone?: string;
150
+ message?: string;
151
+ }) => {
152
+ subject: string;
153
+ html: string;
154
+ text: string;
155
+ };
156
+ passwordReset: (data: {
157
+ resetLink: string;
158
+ }) => {
159
+ subject: string;
160
+ html: string;
161
+ text: string;
162
+ };
163
+ };
164
+
165
+ interface EmailPluginConfig {
166
+ type: 'AWS' | 'SMTP' | 'GMAIL' | 'SENDGRID';
167
+ user?: string;
168
+ password?: string;
169
+ from: string;
170
+ to: string;
171
+ region?: string;
172
+ accessKeyId?: string;
173
+ secretAccessKey?: string;
174
+ }
175
+ declare function emailPlugin(config: EmailPluginConfig): CmsPlugin<EmailService>;
176
+
177
+ interface AnalyticsData {
178
+ visitors: number;
179
+ pageViews: number;
180
+ bounceRate: number;
181
+ avgSessionDuration: number;
182
+ topPages: Array<{
183
+ page: string;
184
+ views: number;
185
+ }>;
186
+ trafficSources: Array<{
187
+ source: string;
188
+ sessions: number;
189
+ }>;
190
+ geographicData: Array<{
191
+ country: string;
192
+ sessions: number;
193
+ }>;
194
+ dailyUsers: Array<{
195
+ date: string;
196
+ users: number;
197
+ }>;
198
+ }
199
+ interface AnalyticsPluginConfig$1 {
200
+ privateKey: string;
201
+ clientEmail: string;
202
+ viewId: string;
203
+ }
204
+ declare class AnalyticsService {
205
+ private analytics;
206
+ private viewId;
207
+ constructor(config: AnalyticsPluginConfig$1);
208
+ getAnalyticsData(days?: number): Promise<AnalyticsData>;
209
+ private runReport;
210
+ private getVisitors;
211
+ private getPageViews;
212
+ private getBounceRate;
213
+ private getAvgSessionDuration;
214
+ private getTopPages;
215
+ private getTrafficSources;
216
+ private getGeographicData;
217
+ private getDailyUsers;
218
+ }
219
+
220
+ interface AnalyticsPluginConfig {
221
+ privateKey?: string;
222
+ clientEmail?: string;
223
+ viewId?: string;
224
+ }
225
+ declare function analyticsPlugin(config?: AnalyticsPluginConfig): CmsPlugin<AnalyticsService>;
226
+
227
+ /** Provider-agnostic SMS interface. Implementations (Twilio, AWS SNS, etc.) can be added later. */
228
+ interface SmsServiceInterface {
229
+ send(to: string, message: string): Promise<boolean>;
230
+ }
231
+ interface SmsPluginConfig {
232
+ provider?: string;
233
+ [key: string]: string | undefined;
234
+ }
235
+ /** Stub SMS plugin - no implementation yet. Register and implement in app or extend core later. */
236
+ declare function smsPlugin(_config?: SmsPluginConfig): CmsPlugin<SmsServiceInterface | null>;
237
+
238
+ /** Provider-agnostic payment interface. Implementations (Stripe, Razorpay, PayPal) can be added later. */
239
+ interface PaymentServiceInterface {
240
+ createPaymentIntent?(amount: number, currency: string, metadata?: Record<string, string>): Promise<{
241
+ clientSecret: string;
242
+ } | null>;
243
+ capturePayment?(paymentId: string): Promise<boolean>;
244
+ }
245
+ interface PaymentPluginConfig {
246
+ provider?: string;
247
+ [key: string]: string | undefined;
248
+ }
249
+ /** Stub payment plugin - no implementation yet. Register and implement in app or extend core later. */
250
+ declare function paymentPlugin(_config?: PaymentPluginConfig): CmsPlugin<PaymentServiceInterface | null>;
251
+
252
+ interface S3StoragePluginConfig {
253
+ region: string;
254
+ accessKeyId: string;
255
+ secretAccessKey: string;
256
+ bucket: string;
257
+ baseUrl?: string;
258
+ prefix?: string;
259
+ }
260
+ declare function s3StoragePlugin(config: Partial<S3StoragePluginConfig> & {
261
+ bucket: string;
262
+ }): CmsPlugin<StorageService>;
263
+
264
+ interface LocalStoragePluginConfig {
265
+ /** Directory relative to process.cwd() (e.g. "public/uploads"). */
266
+ dir?: string;
267
+ /** Public URL prefix for returned URLs (e.g. "" for "/uploads/..."). */
268
+ publicPath?: string;
269
+ }
270
+ declare function localStoragePlugin(config?: LocalStoragePluginConfig): CmsPlugin<StorageService>;
271
+
272
+ declare function cn(...inputs: ClassValue[]): string;
273
+ declare function generateSlug(title: string): string;
274
+ declare function validateSlug(slug: string): boolean;
275
+ declare function formatDate(date: Date | string): string;
276
+ declare function formatDateTime(date: Date | string): string;
277
+ declare function formatDateOnly(date: Date | string): string;
278
+ declare function truncateText(text: string, maxLength: number): string;
279
+
280
+ declare class Permission {
281
+ id: number;
282
+ groupId: number;
283
+ entity: string;
284
+ canCreate: boolean;
285
+ canRead: boolean;
286
+ canUpdate: boolean;
287
+ canDelete: boolean;
288
+ createdAt: Date;
289
+ updatedAt: Date;
290
+ deletedAt: Date | null;
291
+ deleted: boolean;
292
+ createdBy: number | null;
293
+ updatedBy: number | null;
294
+ deletedBy: number | null;
295
+ group: UserGroup;
296
+ }
297
+
298
+ declare class UserGroup {
299
+ id: number;
300
+ name: string;
301
+ createdAt: Date;
302
+ updatedAt: Date;
303
+ deletedAt: Date | null;
304
+ deleted: boolean;
305
+ createdBy: number | null;
306
+ updatedBy: number | null;
307
+ deletedBy: number | null;
308
+ permissions: Permission[];
309
+ users: User[];
310
+ }
311
+
312
+ declare class User {
313
+ id: number;
314
+ name: string;
315
+ email: string;
316
+ password: string | null;
317
+ blocked: boolean;
318
+ groupId: number | null;
319
+ createdAt: Date;
320
+ updatedAt: Date;
321
+ deletedAt: Date | null;
322
+ deleted: boolean;
323
+ createdBy: number | null;
324
+ updatedBy: number | null;
325
+ deletedBy: number | null;
326
+ group: UserGroup | null;
327
+ }
328
+
329
+ declare class PasswordResetToken {
330
+ id: number;
331
+ email: string;
332
+ token: string;
333
+ expiresAt: Date;
334
+ createdAt: Date;
335
+ }
336
+
337
+ declare class Category {
338
+ id: number;
339
+ name: string;
340
+ createdAt: Date;
341
+ updatedAt: Date;
342
+ deletedAt: Date | null;
343
+ deleted: boolean;
344
+ createdBy: number | null;
345
+ updatedBy: number | null;
346
+ deletedBy: number | null;
347
+ blogs: Blog[];
348
+ }
349
+
350
+ declare class Seo {
351
+ id: number;
352
+ title: string | null;
353
+ description: string | null;
354
+ keywords: string | null;
355
+ ogTitle: string | null;
356
+ ogDescription: string | null;
357
+ ogImage: string | null;
358
+ slug: string;
359
+ createdAt: Date;
360
+ updatedAt: Date;
361
+ deletedAt: Date | null;
362
+ deleted: boolean;
363
+ createdBy: number | null;
364
+ updatedBy: number | null;
365
+ deletedBy: number | null;
366
+ blogs: Blog[];
367
+ }
368
+
369
+ declare class Comment {
370
+ id: number;
371
+ content: string;
372
+ blogId: number;
373
+ authorId: number;
374
+ createdAt: Date;
375
+ updatedAt: Date;
376
+ deletedAt: Date | null;
377
+ deleted: boolean;
378
+ createdBy: number | null;
379
+ updatedBy: number | null;
380
+ deletedBy: number | null;
381
+ author: User;
382
+ blog: Blog;
383
+ }
384
+
385
+ declare class Tag {
386
+ id: number;
387
+ name: string;
388
+ createdAt: Date;
389
+ updatedAt: Date;
390
+ deletedAt: Date | null;
391
+ deleted: boolean;
392
+ createdBy: number | null;
393
+ updatedBy: number | null;
394
+ deletedBy: number | null;
395
+ blogs: Blog[];
396
+ }
397
+
398
+ declare class Blog {
399
+ id: number;
400
+ title: string;
401
+ content: string;
402
+ coverImage: string | null;
403
+ authorId: number;
404
+ categoryId: number | null;
405
+ seoId: number | null;
406
+ published: boolean;
407
+ createdAt: Date;
408
+ updatedAt: Date;
409
+ deletedAt: Date | null;
410
+ deleted: boolean;
411
+ createdBy: number | null;
412
+ updatedBy: number | null;
413
+ deletedBy: number | null;
414
+ slug: string;
415
+ author: User;
416
+ category: Category | null;
417
+ seo: Seo | null;
418
+ comments: Comment[];
419
+ tags: Tag[];
420
+ }
421
+
422
+ declare class FormField {
423
+ id: number;
424
+ formId: number;
425
+ label: string;
426
+ type: string;
427
+ placeholder: string | null;
428
+ options: string | null;
429
+ required: boolean;
430
+ validation: string | null;
431
+ order: number;
432
+ groupId: number;
433
+ columnWidth: number;
434
+ createdAt: Date;
435
+ updatedAt: Date;
436
+ deletedAt: Date | null;
437
+ deleted: boolean;
438
+ createdBy: number | null;
439
+ updatedBy: number | null;
440
+ deletedBy: number | null;
441
+ form: Form;
442
+ }
443
+
444
+ declare class Form {
445
+ id: number;
446
+ name: string;
447
+ description: string | null;
448
+ campaign: string | null;
449
+ slug: string;
450
+ published: boolean;
451
+ createdAt: Date;
452
+ updatedAt: Date;
453
+ deletedAt: Date | null;
454
+ deleted: boolean;
455
+ createdBy: number | null;
456
+ updatedBy: number | null;
457
+ deletedBy: number | null;
458
+ fields: FormField[];
459
+ submissions: FormSubmission[];
460
+ }
461
+
462
+ declare class FormSubmission {
463
+ id: number;
464
+ formId: number;
465
+ contactId: number | null;
466
+ data: Record<string, unknown>;
467
+ ipAddress: string | null;
468
+ userAgent: string | null;
469
+ createdAt: Date;
470
+ updatedAt: Date;
471
+ form: Form;
472
+ contact: Contact | null;
473
+ }
474
+
475
+ declare class Contact {
476
+ id: number;
477
+ name: string;
478
+ email: string;
479
+ phone: string | null;
480
+ createdAt: Date;
481
+ updatedAt: Date;
482
+ deletedAt: Date | null;
483
+ deleted: boolean;
484
+ createdBy: number | null;
485
+ updatedBy: number | null;
486
+ deletedBy: number | null;
487
+ form_submissions: FormSubmission[];
488
+ }
489
+
490
+ declare class Config {
491
+ id: number;
492
+ settings: string;
493
+ key: string;
494
+ value: string;
495
+ type: 'public' | 'private';
496
+ encrypted: boolean;
497
+ createdAt: Date;
498
+ updatedAt: Date;
499
+ deletedAt: Date | null;
500
+ deleted: boolean;
501
+ createdBy: number | null;
502
+ updatedBy: number | null;
503
+ deletedBy: number | null;
504
+ }
505
+
506
+ declare class Media {
507
+ id: number;
508
+ filename: string;
509
+ url: string;
510
+ mimeType: string;
511
+ size: number;
512
+ alt: string | null;
513
+ isPublic: boolean;
514
+ createdAt: Date;
515
+ updatedAt: Date;
516
+ deletedAt: Date | null;
517
+ deleted: boolean;
518
+ }
519
+
520
+ declare class Page {
521
+ id: number;
522
+ title: string;
523
+ slug: string;
524
+ content: object;
525
+ published: boolean;
526
+ theme: string;
527
+ parentId: number | null;
528
+ parent: Page | null;
529
+ seoId: number | null;
530
+ seo: Seo | null;
531
+ createdAt: Date;
532
+ updatedAt: Date;
533
+ deletedAt: Date | null;
534
+ deleted: boolean;
535
+ createdBy: number | null;
536
+ updatedBy: number | null;
537
+ deletedBy: number | null;
538
+ }
539
+
540
+ /** Map API resource segment (e.g. "blogs", "form_submissions") to entity. Used by CRUD handler. */
541
+ declare const CMS_ENTITY_MAP: Record<string, EntityTarget<typeorm.ObjectLiteral>>;
542
+
543
+ export { type AnalyticsPluginConfig, Blog, CMS_ENTITY_MAP, Category, type CmsApp, type CmsPlugin, Comment, Config, Contact, type CreateCmsAppOptions, type ERPPluginConfig, type ERPPluginInstance, type EmailData, type EmailPluginConfig, EmailService, type EmailServiceInterface, Form, FormField, FormSubmission, type LocalStoragePluginConfig, type Logger, Media, Page, PasswordResetToken, Permission, type PluginContext, type S3StoragePluginConfig, Seo, StorageService, Tag, User, UserGroup, analyticsPlugin, cn, createCmsApp, emailPlugin, emailTemplates, erpPlugin, formatDate, formatDateOnly, formatDateTime, generateSlug, localStoragePlugin, paymentPlugin, s3StoragePlugin, smsPlugin, truncateText, validateSlug };