@sonicjs-cms/core 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -1
- package/dist/app-Db0AfT5F.d.cts +100 -0
- package/dist/app-Db0AfT5F.d.ts +100 -0
- package/dist/{chunk-R57VFNP3.js → chunk-3ZLCMOCM.js} +441 -433
- package/dist/chunk-3ZLCMOCM.js.map +1 -0
- package/dist/{chunk-ZUK55KZB.js → chunk-4C433FET.js} +5 -3
- package/dist/chunk-4C433FET.js.map +1 -0
- package/dist/{chunk-OORGXYDA.js → chunk-5TRX2JHU.js} +5 -32
- package/dist/chunk-5TRX2JHU.js.map +1 -0
- package/dist/{chunk-K4Z3IHOK.js → chunk-7CXL5K7N.js} +5 -248
- package/dist/chunk-7CXL5K7N.js.map +1 -0
- package/dist/{chunk-WBX5YMTB.cjs → chunk-7KCDFDRI.cjs} +27 -15
- package/dist/chunk-7KCDFDRI.cjs.map +1 -0
- package/dist/chunk-CAMM3MJV.js +1550 -0
- package/dist/chunk-CAMM3MJV.js.map +1 -0
- package/dist/{chunk-HKEK7UNV.js → chunk-CPXAVWCU.js} +3 -3
- package/dist/{chunk-HKEK7UNV.js.map → chunk-CPXAVWCU.js.map} +1 -1
- package/dist/{chunk-F5ESJXI2.cjs → chunk-DTLB6UIH.cjs} +3 -3
- package/dist/{chunk-F5ESJXI2.cjs.map → chunk-DTLB6UIH.cjs.map} +1 -1
- package/dist/{chunk-AINTFRTC.cjs → chunk-ES3BRZQJ.cjs} +252 -2
- package/dist/chunk-ES3BRZQJ.cjs.map +1 -0
- package/dist/chunk-HBJU3I2Y.cjs +1552 -0
- package/dist/chunk-HBJU3I2Y.cjs.map +1 -0
- package/dist/{chunk-UEYMFNBN.cjs → chunk-KP4DVEX5.cjs} +7 -36
- package/dist/chunk-KP4DVEX5.cjs.map +1 -0
- package/dist/{chunk-2DIWLDCA.cjs → chunk-MPFSSBIY.cjs} +541 -533
- package/dist/chunk-MPFSSBIY.cjs.map +1 -0
- package/dist/{chunk-HV2I6API.cjs → chunk-NAYD76QF.cjs} +4 -251
- package/dist/chunk-NAYD76QF.cjs.map +1 -0
- package/dist/{chunk-L232U757.js → chunk-Q52ZQFMB.js} +249 -3
- package/dist/chunk-Q52ZQFMB.js.map +1 -0
- package/dist/{chunk-NMVOTNSL.js → chunk-RRKXFGIO.js} +28 -16
- package/dist/chunk-RRKXFGIO.js.map +1 -0
- package/dist/{chunk-YTMFJLJZ.cjs → chunk-TT266RYM.cjs} +5 -3
- package/dist/chunk-TT266RYM.cjs.map +1 -0
- package/dist/collection-config-FLlGtsh9.d.cts +107 -0
- package/dist/collection-config-FLlGtsh9.d.ts +107 -0
- package/dist/filter-bar.template-By4jeiw_.d.cts +140 -0
- package/dist/filter-bar.template-By4jeiw_.d.ts +140 -0
- package/dist/index.cjs +146 -165
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -0
- package/dist/index.d.ts +43 -5
- package/dist/index.js +19 -14
- package/dist/index.js.map +1 -1
- package/dist/middleware.cjs +24 -33
- package/dist/middleware.d.cts +89 -0
- package/dist/middleware.d.ts +89 -2
- package/dist/middleware.js +3 -4
- package/dist/migrations-B2CDNN76.js +4 -0
- package/dist/{migrations-IHERIQVD.js.map → migrations-B2CDNN76.js.map} +1 -1
- package/dist/migrations-IBKKBIKR.cjs +13 -0
- package/dist/{migrations-POFD5KNG.cjs.map → migrations-IBKKBIKR.cjs.map} +1 -1
- package/dist/plugin-bootstrap-C0E3jdz-.d.cts +8339 -0
- package/dist/plugin-bootstrap-CDh0JHtW.d.ts +8339 -0
- package/dist/plugin-manifest-BCMx9CAq.d.cts +35 -0
- package/dist/plugin-manifest-BCMx9CAq.d.ts +35 -0
- package/dist/plugin-zvZpaiP5.d.cts +357 -0
- package/dist/plugin-zvZpaiP5.d.ts +357 -0
- package/dist/plugins.cjs +7 -7
- package/dist/plugins.d.cts +330 -0
- package/dist/plugins.d.ts +330 -2
- package/dist/plugins.js +1 -1
- package/dist/routes.cjs +27 -27
- package/dist/routes.d.cts +224 -0
- package/dist/routes.d.ts +224 -2
- package/dist/routes.js +7 -7
- package/dist/services.cjs +41 -41
- package/dist/services.d.cts +236 -0
- package/dist/services.d.ts +236 -2
- package/dist/services.js +4 -4
- package/dist/telemetry-BFBIjBxK.d.cts +36 -0
- package/dist/telemetry-BFBIjBxK.d.ts +36 -0
- package/dist/templates.d.cts +133 -0
- package/dist/templates.d.ts +133 -2
- package/dist/types.d.cts +7 -0
- package/dist/types.d.ts +7 -2
- package/dist/utils.cjs +27 -27
- package/dist/utils.d.cts +53 -0
- package/dist/utils.d.ts +53 -2
- package/dist/utils.js +2 -2
- package/dist/version-vktVAxhe.d.cts +195 -0
- package/dist/version-vktVAxhe.d.ts +195 -0
- package/migrations/001_initial_schema.sql +1 -1
- package/package.json +3 -1
- package/dist/chunk-2DIWLDCA.cjs.map +0 -1
- package/dist/chunk-AINTFRTC.cjs.map +0 -1
- package/dist/chunk-HV2I6API.cjs.map +0 -1
- package/dist/chunk-K4Z3IHOK.js.map +0 -1
- package/dist/chunk-L232U757.js.map +0 -1
- package/dist/chunk-NMVOTNSL.js.map +0 -1
- package/dist/chunk-OORGXYDA.js.map +0 -1
- package/dist/chunk-R57VFNP3.js.map +0 -1
- package/dist/chunk-T7IYBGGO.cjs +0 -746
- package/dist/chunk-T7IYBGGO.cjs.map +0 -1
- package/dist/chunk-UEYMFNBN.cjs.map +0 -1
- package/dist/chunk-WBX5YMTB.cjs.map +0 -1
- package/dist/chunk-YTMFJLJZ.cjs.map +0 -1
- package/dist/chunk-ZPMFT2JW.js +0 -744
- package/dist/chunk-ZPMFT2JW.js.map +0 -1
- package/dist/chunk-ZUK55KZB.js.map +0 -1
- package/dist/migrations-IHERIQVD.js +0 -4
- package/dist/migrations-POFD5KNG.cjs +0 -13
- package/migrations/013_code_examples_plugin.sql +0 -177
- /package/migrations/{021_add_otp_login.sql → 026_add_otp_login.sql} +0 -0
package/dist/services.cjs
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
3
|
+
var chunkES3BRZQJ_cjs = require('./chunk-ES3BRZQJ.cjs');
|
|
4
|
+
var chunkNAYD76QF_cjs = require('./chunk-NAYD76QF.cjs');
|
|
5
|
+
var chunkHBJU3I2Y_cjs = require('./chunk-HBJU3I2Y.cjs');
|
|
6
|
+
require('./chunk-7KCDFDRI.cjs');
|
|
7
7
|
require('./chunk-IGJUBJBW.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
Object.defineProperty(exports, "CACHE_CONFIGS", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkES3BRZQJ_cjs.CACHE_CONFIGS; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "CacheService", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkES3BRZQJ_cjs.CacheService; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "Logger", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkES3BRZQJ_cjs.Logger; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "SettingsService", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkES3BRZQJ_cjs.SettingsService; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "TelemetryService", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkES3BRZQJ_cjs.TelemetryService; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "createInstallationIdentity", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkES3BRZQJ_cjs.createInstallationIdentity; }
|
|
26
34
|
});
|
|
27
35
|
Object.defineProperty(exports, "getCacheService", {
|
|
28
36
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkES3BRZQJ_cjs.getCacheService; }
|
|
30
38
|
});
|
|
31
39
|
Object.defineProperty(exports, "getLogger", {
|
|
32
40
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunkES3BRZQJ_cjs.getLogger; }
|
|
34
42
|
});
|
|
35
|
-
Object.defineProperty(exports, "
|
|
43
|
+
Object.defineProperty(exports, "getTelemetryService", {
|
|
36
44
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunkES3BRZQJ_cjs.getTelemetryService; }
|
|
38
46
|
});
|
|
39
|
-
Object.defineProperty(exports, "
|
|
47
|
+
Object.defineProperty(exports, "initLogger", {
|
|
40
48
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunkES3BRZQJ_cjs.initLogger; }
|
|
42
50
|
});
|
|
43
|
-
Object.defineProperty(exports, "
|
|
51
|
+
Object.defineProperty(exports, "initTelemetry", {
|
|
44
52
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunkES3BRZQJ_cjs.initTelemetry; }
|
|
46
54
|
});
|
|
47
|
-
Object.defineProperty(exports, "
|
|
55
|
+
Object.defineProperty(exports, "PluginBootstrapService", {
|
|
48
56
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunkNAYD76QF_cjs.PluginBootstrapService; }
|
|
50
58
|
});
|
|
51
|
-
Object.defineProperty(exports, "
|
|
59
|
+
Object.defineProperty(exports, "PluginService", {
|
|
52
60
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunkNAYD76QF_cjs.PluginService; }
|
|
54
62
|
});
|
|
55
|
-
Object.defineProperty(exports, "
|
|
63
|
+
Object.defineProperty(exports, "cleanupRemovedCollections", {
|
|
56
64
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
65
|
+
get: function () { return chunkNAYD76QF_cjs.cleanupRemovedCollections; }
|
|
58
66
|
});
|
|
59
67
|
Object.defineProperty(exports, "fullCollectionSync", {
|
|
60
68
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
69
|
+
get: function () { return chunkNAYD76QF_cjs.fullCollectionSync; }
|
|
62
70
|
});
|
|
63
71
|
Object.defineProperty(exports, "getAvailableCollectionNames", {
|
|
64
72
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunkNAYD76QF_cjs.getAvailableCollectionNames; }
|
|
66
74
|
});
|
|
67
75
|
Object.defineProperty(exports, "getManagedCollections", {
|
|
68
76
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
70
|
-
});
|
|
71
|
-
Object.defineProperty(exports, "getTelemetryService", {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
get: function () { return chunkHV2I6API_cjs.getTelemetryService; }
|
|
74
|
-
});
|
|
75
|
-
Object.defineProperty(exports, "initTelemetry", {
|
|
76
|
-
enumerable: true,
|
|
77
|
-
get: function () { return chunkHV2I6API_cjs.initTelemetry; }
|
|
77
|
+
get: function () { return chunkNAYD76QF_cjs.getManagedCollections; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "isCollectionManaged", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunkNAYD76QF_cjs.isCollectionManaged; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "loadCollectionConfig", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunkNAYD76QF_cjs.loadCollectionConfig; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "loadCollectionConfigs", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunkNAYD76QF_cjs.loadCollectionConfigs; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "registerCollections", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunkNAYD76QF_cjs.registerCollections; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "syncCollection", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunkNAYD76QF_cjs.syncCollection; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "syncCollections", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunkNAYD76QF_cjs.syncCollections; }
|
|
102
102
|
});
|
|
103
103
|
Object.defineProperty(exports, "validateCollectionConfig", {
|
|
104
104
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunkNAYD76QF_cjs.validateCollectionConfig; }
|
|
106
106
|
});
|
|
107
107
|
Object.defineProperty(exports, "MigrationService", {
|
|
108
108
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunkHBJU3I2Y_cjs.MigrationService; }
|
|
110
110
|
});
|
|
111
111
|
//# sourceMappingURL=services.cjs.map
|
|
112
112
|
//# sourceMappingURL=services.cjs.map
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
export { C as CorePlugin, p as LogCategory, q as LogEntry, t as LogFilter, o as LogLevel, L as Logger, m as Migration, M as MigrationService, n as MigrationStatus, k as PluginBootstrapService, P as PluginService, e as cleanupRemovedCollections, f as fullCollectionSync, g as getAvailableCollectionNames, h as getLogger, d as getManagedCollections, j as initLogger, i as isCollectionManaged, a as loadCollectionConfig, l as loadCollectionConfigs, r as registerCollections, c as syncCollection, b as syncCollections, v as validateCollectionConfig } from './plugin-bootstrap-C0E3jdz-.cjs';
|
|
2
|
+
import { b as TelemetryConfig, c as TelemetryIdentity, T as TelemetryEvent, a as TelemetryProperties } from './telemetry-BFBIjBxK.cjs';
|
|
3
|
+
import './collection-config-FLlGtsh9.cjs';
|
|
4
|
+
import '@cloudflare/workers-types';
|
|
5
|
+
import 'drizzle-zod';
|
|
6
|
+
import 'drizzle-orm/sqlite-core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Simple Cache Service
|
|
10
|
+
*
|
|
11
|
+
* Provides basic caching functionality for the core package
|
|
12
|
+
* Can be extended with KV or other storage backends
|
|
13
|
+
*/
|
|
14
|
+
interface CacheConfig {
|
|
15
|
+
ttl: number;
|
|
16
|
+
keyPrefix: string;
|
|
17
|
+
}
|
|
18
|
+
declare class CacheService {
|
|
19
|
+
private config;
|
|
20
|
+
private memoryCache;
|
|
21
|
+
constructor(config: CacheConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Generate cache key with prefix
|
|
24
|
+
*/
|
|
25
|
+
generateKey(type: string, identifier?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get value from cache
|
|
28
|
+
*/
|
|
29
|
+
get<T>(key: string): Promise<T | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Get value from cache with source information
|
|
32
|
+
*/
|
|
33
|
+
getWithSource<T>(key: string): Promise<{
|
|
34
|
+
hit: boolean;
|
|
35
|
+
data: T | null;
|
|
36
|
+
source: string;
|
|
37
|
+
ttl?: number;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Set value in cache
|
|
41
|
+
*/
|
|
42
|
+
set(key: string, value: any, ttl?: number): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Delete specific key from cache
|
|
45
|
+
*/
|
|
46
|
+
delete(key: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Invalidate cache keys matching a pattern
|
|
49
|
+
* For memory cache, we do simple string matching
|
|
50
|
+
*/
|
|
51
|
+
invalidate(pattern: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all cache
|
|
54
|
+
*/
|
|
55
|
+
clear(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Get value from cache or set it using a callback
|
|
58
|
+
*/
|
|
59
|
+
getOrSet<T>(key: string, callback: () => Promise<T>, ttl?: number): Promise<T>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Cache configurations for different data types
|
|
63
|
+
*/
|
|
64
|
+
declare const CACHE_CONFIGS: {
|
|
65
|
+
api: {
|
|
66
|
+
ttl: number;
|
|
67
|
+
keyPrefix: string;
|
|
68
|
+
};
|
|
69
|
+
user: {
|
|
70
|
+
ttl: number;
|
|
71
|
+
keyPrefix: string;
|
|
72
|
+
};
|
|
73
|
+
content: {
|
|
74
|
+
ttl: number;
|
|
75
|
+
keyPrefix: string;
|
|
76
|
+
};
|
|
77
|
+
collection: {
|
|
78
|
+
ttl: number;
|
|
79
|
+
keyPrefix: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Get cache service instance for a config
|
|
84
|
+
*/
|
|
85
|
+
declare function getCacheService(config: CacheConfig): CacheService;
|
|
86
|
+
|
|
87
|
+
interface Setting {
|
|
88
|
+
id: string;
|
|
89
|
+
category: string;
|
|
90
|
+
key: string;
|
|
91
|
+
value: string;
|
|
92
|
+
created_at: number;
|
|
93
|
+
updated_at: number;
|
|
94
|
+
}
|
|
95
|
+
interface GeneralSettings {
|
|
96
|
+
siteName: string;
|
|
97
|
+
siteDescription: string;
|
|
98
|
+
adminEmail: string;
|
|
99
|
+
timezone: string;
|
|
100
|
+
language: string;
|
|
101
|
+
maintenanceMode: boolean;
|
|
102
|
+
}
|
|
103
|
+
declare class SettingsService {
|
|
104
|
+
private db;
|
|
105
|
+
constructor(db: D1Database);
|
|
106
|
+
/**
|
|
107
|
+
* Get a setting value by category and key
|
|
108
|
+
*/
|
|
109
|
+
getSetting(category: string, key: string): Promise<any | null>;
|
|
110
|
+
/**
|
|
111
|
+
* Get all settings for a category
|
|
112
|
+
*/
|
|
113
|
+
getCategorySettings(category: string): Promise<Record<string, any>>;
|
|
114
|
+
/**
|
|
115
|
+
* Set a setting value
|
|
116
|
+
*/
|
|
117
|
+
setSetting(category: string, key: string, value: any): Promise<boolean>;
|
|
118
|
+
/**
|
|
119
|
+
* Set multiple settings at once
|
|
120
|
+
*/
|
|
121
|
+
setMultipleSettings(category: string, settings: Record<string, any>): Promise<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Get general settings with defaults
|
|
124
|
+
*/
|
|
125
|
+
getGeneralSettings(userEmail?: string): Promise<GeneralSettings>;
|
|
126
|
+
/**
|
|
127
|
+
* Save general settings
|
|
128
|
+
*/
|
|
129
|
+
saveGeneralSettings(settings: Partial<GeneralSettings>): Promise<boolean>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Telemetry Service
|
|
134
|
+
*
|
|
135
|
+
* Privacy-first telemetry service using PostHog
|
|
136
|
+
* - No PII collection
|
|
137
|
+
* - Opt-out by default
|
|
138
|
+
* - Silent failures (never blocks app)
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* TelemetryService class
|
|
143
|
+
*
|
|
144
|
+
* Handles all telemetry tracking in a privacy-conscious way
|
|
145
|
+
*/
|
|
146
|
+
declare class TelemetryService {
|
|
147
|
+
private config;
|
|
148
|
+
private identity;
|
|
149
|
+
private client;
|
|
150
|
+
private enabled;
|
|
151
|
+
private eventQueue;
|
|
152
|
+
private isInitialized;
|
|
153
|
+
constructor(config?: Partial<TelemetryConfig>);
|
|
154
|
+
/**
|
|
155
|
+
* Initialize the telemetry service
|
|
156
|
+
*/
|
|
157
|
+
initialize(identity: TelemetryIdentity): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Track a telemetry event
|
|
160
|
+
*/
|
|
161
|
+
track(event: TelemetryEvent, properties?: TelemetryProperties): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Track installation started
|
|
164
|
+
*/
|
|
165
|
+
trackInstallationStarted(properties?: TelemetryProperties): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Track installation completed
|
|
168
|
+
*/
|
|
169
|
+
trackInstallationCompleted(properties?: TelemetryProperties): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Track installation failed
|
|
172
|
+
*/
|
|
173
|
+
trackInstallationFailed(error: Error | string, properties?: TelemetryProperties): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Track dev server started
|
|
176
|
+
*/
|
|
177
|
+
trackDevServerStarted(properties?: TelemetryProperties): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Track page view in admin UI
|
|
180
|
+
*/
|
|
181
|
+
trackPageView(route: string, properties?: TelemetryProperties): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Track error (sanitized)
|
|
184
|
+
*/
|
|
185
|
+
trackError(error: Error | string, properties?: TelemetryProperties): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Track plugin activation
|
|
188
|
+
*/
|
|
189
|
+
trackPluginActivated(properties?: TelemetryProperties): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Track migration run
|
|
192
|
+
*/
|
|
193
|
+
trackMigrationRun(properties?: TelemetryProperties): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Flush queued events
|
|
196
|
+
*/
|
|
197
|
+
private flushQueue;
|
|
198
|
+
/**
|
|
199
|
+
* Sanitize properties to ensure no PII
|
|
200
|
+
*/
|
|
201
|
+
private sanitizeProperties;
|
|
202
|
+
/**
|
|
203
|
+
* Get SonicJS version
|
|
204
|
+
*/
|
|
205
|
+
private getVersion;
|
|
206
|
+
/**
|
|
207
|
+
* Shutdown the telemetry service
|
|
208
|
+
*/
|
|
209
|
+
shutdown(): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Enable telemetry
|
|
212
|
+
*/
|
|
213
|
+
enable(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Disable telemetry
|
|
216
|
+
*/
|
|
217
|
+
disable(): void;
|
|
218
|
+
/**
|
|
219
|
+
* Check if telemetry is enabled
|
|
220
|
+
*/
|
|
221
|
+
isEnabled(): boolean;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get the telemetry service instance
|
|
225
|
+
*/
|
|
226
|
+
declare function getTelemetryService(config?: Partial<TelemetryConfig>): TelemetryService;
|
|
227
|
+
/**
|
|
228
|
+
* Initialize telemetry service
|
|
229
|
+
*/
|
|
230
|
+
declare function initTelemetry(identity: TelemetryIdentity, config?: Partial<TelemetryConfig>): Promise<TelemetryService>;
|
|
231
|
+
/**
|
|
232
|
+
* Create a new installation identity
|
|
233
|
+
*/
|
|
234
|
+
declare function createInstallationIdentity(projectName?: string): TelemetryIdentity;
|
|
235
|
+
|
|
236
|
+
export { CACHE_CONFIGS, type CacheConfig, CacheService, type GeneralSettings, type Setting, SettingsService, TelemetryService, createInstallationIdentity, getCacheService, getTelemetryService, initTelemetry };
|
package/dist/services.d.ts
CHANGED
|
@@ -1,2 +1,236 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { C as CorePlugin, p as LogCategory, q as LogEntry, t as LogFilter, o as LogLevel, L as Logger, m as Migration, M as MigrationService, n as MigrationStatus, k as PluginBootstrapService, P as PluginService, e as cleanupRemovedCollections, f as fullCollectionSync, g as getAvailableCollectionNames, h as getLogger, d as getManagedCollections, j as initLogger, i as isCollectionManaged, a as loadCollectionConfig, l as loadCollectionConfigs, r as registerCollections, c as syncCollection, b as syncCollections, v as validateCollectionConfig } from './plugin-bootstrap-CDh0JHtW.js';
|
|
2
|
+
import { b as TelemetryConfig, c as TelemetryIdentity, T as TelemetryEvent, a as TelemetryProperties } from './telemetry-BFBIjBxK.js';
|
|
3
|
+
import './collection-config-FLlGtsh9.js';
|
|
4
|
+
import '@cloudflare/workers-types';
|
|
5
|
+
import 'drizzle-zod';
|
|
6
|
+
import 'drizzle-orm/sqlite-core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Simple Cache Service
|
|
10
|
+
*
|
|
11
|
+
* Provides basic caching functionality for the core package
|
|
12
|
+
* Can be extended with KV or other storage backends
|
|
13
|
+
*/
|
|
14
|
+
interface CacheConfig {
|
|
15
|
+
ttl: number;
|
|
16
|
+
keyPrefix: string;
|
|
17
|
+
}
|
|
18
|
+
declare class CacheService {
|
|
19
|
+
private config;
|
|
20
|
+
private memoryCache;
|
|
21
|
+
constructor(config: CacheConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Generate cache key with prefix
|
|
24
|
+
*/
|
|
25
|
+
generateKey(type: string, identifier?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get value from cache
|
|
28
|
+
*/
|
|
29
|
+
get<T>(key: string): Promise<T | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Get value from cache with source information
|
|
32
|
+
*/
|
|
33
|
+
getWithSource<T>(key: string): Promise<{
|
|
34
|
+
hit: boolean;
|
|
35
|
+
data: T | null;
|
|
36
|
+
source: string;
|
|
37
|
+
ttl?: number;
|
|
38
|
+
}>;
|
|
39
|
+
/**
|
|
40
|
+
* Set value in cache
|
|
41
|
+
*/
|
|
42
|
+
set(key: string, value: any, ttl?: number): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Delete specific key from cache
|
|
45
|
+
*/
|
|
46
|
+
delete(key: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Invalidate cache keys matching a pattern
|
|
49
|
+
* For memory cache, we do simple string matching
|
|
50
|
+
*/
|
|
51
|
+
invalidate(pattern: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Clear all cache
|
|
54
|
+
*/
|
|
55
|
+
clear(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Get value from cache or set it using a callback
|
|
58
|
+
*/
|
|
59
|
+
getOrSet<T>(key: string, callback: () => Promise<T>, ttl?: number): Promise<T>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Cache configurations for different data types
|
|
63
|
+
*/
|
|
64
|
+
declare const CACHE_CONFIGS: {
|
|
65
|
+
api: {
|
|
66
|
+
ttl: number;
|
|
67
|
+
keyPrefix: string;
|
|
68
|
+
};
|
|
69
|
+
user: {
|
|
70
|
+
ttl: number;
|
|
71
|
+
keyPrefix: string;
|
|
72
|
+
};
|
|
73
|
+
content: {
|
|
74
|
+
ttl: number;
|
|
75
|
+
keyPrefix: string;
|
|
76
|
+
};
|
|
77
|
+
collection: {
|
|
78
|
+
ttl: number;
|
|
79
|
+
keyPrefix: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Get cache service instance for a config
|
|
84
|
+
*/
|
|
85
|
+
declare function getCacheService(config: CacheConfig): CacheService;
|
|
86
|
+
|
|
87
|
+
interface Setting {
|
|
88
|
+
id: string;
|
|
89
|
+
category: string;
|
|
90
|
+
key: string;
|
|
91
|
+
value: string;
|
|
92
|
+
created_at: number;
|
|
93
|
+
updated_at: number;
|
|
94
|
+
}
|
|
95
|
+
interface GeneralSettings {
|
|
96
|
+
siteName: string;
|
|
97
|
+
siteDescription: string;
|
|
98
|
+
adminEmail: string;
|
|
99
|
+
timezone: string;
|
|
100
|
+
language: string;
|
|
101
|
+
maintenanceMode: boolean;
|
|
102
|
+
}
|
|
103
|
+
declare class SettingsService {
|
|
104
|
+
private db;
|
|
105
|
+
constructor(db: D1Database);
|
|
106
|
+
/**
|
|
107
|
+
* Get a setting value by category and key
|
|
108
|
+
*/
|
|
109
|
+
getSetting(category: string, key: string): Promise<any | null>;
|
|
110
|
+
/**
|
|
111
|
+
* Get all settings for a category
|
|
112
|
+
*/
|
|
113
|
+
getCategorySettings(category: string): Promise<Record<string, any>>;
|
|
114
|
+
/**
|
|
115
|
+
* Set a setting value
|
|
116
|
+
*/
|
|
117
|
+
setSetting(category: string, key: string, value: any): Promise<boolean>;
|
|
118
|
+
/**
|
|
119
|
+
* Set multiple settings at once
|
|
120
|
+
*/
|
|
121
|
+
setMultipleSettings(category: string, settings: Record<string, any>): Promise<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Get general settings with defaults
|
|
124
|
+
*/
|
|
125
|
+
getGeneralSettings(userEmail?: string): Promise<GeneralSettings>;
|
|
126
|
+
/**
|
|
127
|
+
* Save general settings
|
|
128
|
+
*/
|
|
129
|
+
saveGeneralSettings(settings: Partial<GeneralSettings>): Promise<boolean>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Telemetry Service
|
|
134
|
+
*
|
|
135
|
+
* Privacy-first telemetry service using PostHog
|
|
136
|
+
* - No PII collection
|
|
137
|
+
* - Opt-out by default
|
|
138
|
+
* - Silent failures (never blocks app)
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* TelemetryService class
|
|
143
|
+
*
|
|
144
|
+
* Handles all telemetry tracking in a privacy-conscious way
|
|
145
|
+
*/
|
|
146
|
+
declare class TelemetryService {
|
|
147
|
+
private config;
|
|
148
|
+
private identity;
|
|
149
|
+
private client;
|
|
150
|
+
private enabled;
|
|
151
|
+
private eventQueue;
|
|
152
|
+
private isInitialized;
|
|
153
|
+
constructor(config?: Partial<TelemetryConfig>);
|
|
154
|
+
/**
|
|
155
|
+
* Initialize the telemetry service
|
|
156
|
+
*/
|
|
157
|
+
initialize(identity: TelemetryIdentity): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Track a telemetry event
|
|
160
|
+
*/
|
|
161
|
+
track(event: TelemetryEvent, properties?: TelemetryProperties): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Track installation started
|
|
164
|
+
*/
|
|
165
|
+
trackInstallationStarted(properties?: TelemetryProperties): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Track installation completed
|
|
168
|
+
*/
|
|
169
|
+
trackInstallationCompleted(properties?: TelemetryProperties): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Track installation failed
|
|
172
|
+
*/
|
|
173
|
+
trackInstallationFailed(error: Error | string, properties?: TelemetryProperties): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* Track dev server started
|
|
176
|
+
*/
|
|
177
|
+
trackDevServerStarted(properties?: TelemetryProperties): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Track page view in admin UI
|
|
180
|
+
*/
|
|
181
|
+
trackPageView(route: string, properties?: TelemetryProperties): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Track error (sanitized)
|
|
184
|
+
*/
|
|
185
|
+
trackError(error: Error | string, properties?: TelemetryProperties): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Track plugin activation
|
|
188
|
+
*/
|
|
189
|
+
trackPluginActivated(properties?: TelemetryProperties): Promise<void>;
|
|
190
|
+
/**
|
|
191
|
+
* Track migration run
|
|
192
|
+
*/
|
|
193
|
+
trackMigrationRun(properties?: TelemetryProperties): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Flush queued events
|
|
196
|
+
*/
|
|
197
|
+
private flushQueue;
|
|
198
|
+
/**
|
|
199
|
+
* Sanitize properties to ensure no PII
|
|
200
|
+
*/
|
|
201
|
+
private sanitizeProperties;
|
|
202
|
+
/**
|
|
203
|
+
* Get SonicJS version
|
|
204
|
+
*/
|
|
205
|
+
private getVersion;
|
|
206
|
+
/**
|
|
207
|
+
* Shutdown the telemetry service
|
|
208
|
+
*/
|
|
209
|
+
shutdown(): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Enable telemetry
|
|
212
|
+
*/
|
|
213
|
+
enable(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Disable telemetry
|
|
216
|
+
*/
|
|
217
|
+
disable(): void;
|
|
218
|
+
/**
|
|
219
|
+
* Check if telemetry is enabled
|
|
220
|
+
*/
|
|
221
|
+
isEnabled(): boolean;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get the telemetry service instance
|
|
225
|
+
*/
|
|
226
|
+
declare function getTelemetryService(config?: Partial<TelemetryConfig>): TelemetryService;
|
|
227
|
+
/**
|
|
228
|
+
* Initialize telemetry service
|
|
229
|
+
*/
|
|
230
|
+
declare function initTelemetry(identity: TelemetryIdentity, config?: Partial<TelemetryConfig>): Promise<TelemetryService>;
|
|
231
|
+
/**
|
|
232
|
+
* Create a new installation identity
|
|
233
|
+
*/
|
|
234
|
+
declare function createInstallationIdentity(projectName?: string): TelemetryIdentity;
|
|
235
|
+
|
|
236
|
+
export { CACHE_CONFIGS, type CacheConfig, CacheService, type GeneralSettings, type Setting, SettingsService, TelemetryService, createInstallationIdentity, getCacheService, getTelemetryService, initTelemetry };
|
package/dist/services.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { CACHE_CONFIGS, CacheService, Logger, SettingsService, getCacheService, getLogger, initLogger } from './chunk-
|
|
2
|
-
export { PluginBootstrapService, PluginService,
|
|
3
|
-
export { MigrationService } from './chunk-
|
|
4
|
-
import './chunk-
|
|
1
|
+
export { CACHE_CONFIGS, CacheService, Logger, SettingsService, TelemetryService, createInstallationIdentity, getCacheService, getLogger, getTelemetryService, initLogger, initTelemetry } from './chunk-Q52ZQFMB.js';
|
|
2
|
+
export { PluginBootstrapService, PluginService, cleanupRemovedCollections, fullCollectionSync, getAvailableCollectionNames, getManagedCollections, isCollectionManaged, loadCollectionConfig, loadCollectionConfigs, registerCollections, syncCollection, syncCollections, validateCollectionConfig } from './chunk-7CXL5K7N.js';
|
|
3
|
+
export { MigrationService } from './chunk-CAMM3MJV.js';
|
|
4
|
+
import './chunk-RRKXFGIO.js';
|
|
5
5
|
import './chunk-V4OQ3NZ2.js';
|
|
6
6
|
//# sourceMappingURL=services.js.map
|
|
7
7
|
//# sourceMappingURL=services.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telemetry Types
|
|
3
|
+
*
|
|
4
|
+
* Privacy-first telemetry types for SonicJS
|
|
5
|
+
* No PII (Personally Identifiable Information) is collected
|
|
6
|
+
*/
|
|
7
|
+
type TelemetryEvent = 'installation_started' | 'installation_completed' | 'installation_failed' | 'setup_wizard_started' | 'setup_wizard_completed' | 'first_dev_server_start' | 'dev_server_started' | 'dev_server_stopped' | 'admin_login' | 'plugin_activated' | 'plugin_deactivated' | 'collection_created' | 'content_created' | 'page_viewed' | 'feature_used' | 'error_occurred' | 'migration_run' | 'deployment_triggered';
|
|
8
|
+
interface TelemetryProperties {
|
|
9
|
+
os?: 'darwin' | 'linux' | 'win32' | string;
|
|
10
|
+
nodeVersion?: string;
|
|
11
|
+
packageManager?: 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
12
|
+
installationDuration?: number;
|
|
13
|
+
success?: boolean;
|
|
14
|
+
errorType?: string;
|
|
15
|
+
sessionDuration?: number;
|
|
16
|
+
pluginsCount?: number;
|
|
17
|
+
collectionsCount?: number;
|
|
18
|
+
contentItemsCount?: number;
|
|
19
|
+
route?: string;
|
|
20
|
+
feature?: string;
|
|
21
|
+
migrationType?: 'initial' | 'update' | 'rollback';
|
|
22
|
+
migrationSuccess?: boolean;
|
|
23
|
+
[key: string]: string | number | boolean | undefined;
|
|
24
|
+
}
|
|
25
|
+
interface TelemetryConfig {
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
apiKey?: string;
|
|
28
|
+
host?: string;
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface TelemetryIdentity {
|
|
32
|
+
installationId: string;
|
|
33
|
+
projectId?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type { TelemetryEvent as T, TelemetryProperties as a, TelemetryConfig as b, TelemetryIdentity as c };
|