@appbuildersph/shared 0.0.1

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/dist/index.cjs ADDED
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('crypto');
4
+
5
+ // src/utils.ts
6
+ function generateUuid() {
7
+ return crypto.randomUUID();
8
+ }
9
+ function nowIso() {
10
+ return (/* @__PURE__ */ new Date()).toISOString();
11
+ }
12
+ function resolveEnvironment() {
13
+ const env = process.env.NODE_ENV;
14
+ if (env === "production" || env === "test" || env === "staging") return env;
15
+ return "development";
16
+ }
17
+
18
+ exports.generateUuid = generateUuid;
19
+ exports.nowIso = nowIso;
20
+ exports.resolveEnvironment = resolveEnvironment;
21
+ //# sourceMappingURL=index.cjs.map
22
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"names":["randomUUID"],"mappings":";;;;;AAEO,SAAS,YAAA,GAAuB;AACrC,EAAA,OAAOA,iBAAA,EAAW;AACpB;AAEO,SAAS,MAAA,GAAiB;AAC/B,EAAA,OAAA,iBAAO,IAAI,IAAA,EAAK,EAAE,WAAA,EAAY;AAChC;AAEO,SAAS,kBAAA,GAAwE;AACtF,EAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,CAAI,QAAA;AACxB,EAAA,IAAI,QAAQ,YAAA,IAAgB,GAAA,KAAQ,MAAA,IAAU,GAAA,KAAQ,WAAW,OAAO,GAAA;AACxE,EAAA,OAAO,aAAA;AACT","file":"index.cjs","sourcesContent":["import { randomUUID } from \"node:crypto\";\n\nexport function generateUuid(): string {\n return randomUUID();\n}\n\nexport function nowIso(): string {\n return new Date().toISOString();\n}\n\nexport function resolveEnvironment(): \"development\" | \"staging\" | \"production\" | \"test\" {\n const env = process.env.NODE_ENV;\n if (env === \"production\" || env === \"test\" || env === \"staging\") return env;\n return \"development\";\n}\n"]}
@@ -0,0 +1,74 @@
1
+ type Environment = "development" | "staging" | "production" | "test";
2
+ type Theme = "dark" | "light" | "system";
3
+ type BadgePosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
4
+ interface BadgeConfig {
5
+ enabled?: boolean;
6
+ theme?: Theme;
7
+ position?: BadgePosition;
8
+ animation?: boolean;
9
+ expandable?: boolean;
10
+ }
11
+ interface AppBuildersConfig {
12
+ appName: string;
13
+ organization?: string;
14
+ developer?: string;
15
+ environment?: Environment;
16
+ badge?: boolean | BadgeConfig;
17
+ identity?: boolean;
18
+ watcher?: boolean;
19
+ logger?: boolean;
20
+ notifications?: boolean;
21
+ security?: boolean;
22
+ dashboard?: boolean;
23
+ ai?: boolean;
24
+ plugins?: AppBuildersPlugin[];
25
+ theme?: Theme;
26
+ }
27
+ interface AppBuildersPlugin {
28
+ name: string;
29
+ setup: (ctx: PluginContext) => void | Promise<void>;
30
+ }
31
+ interface PluginContext {
32
+ config: AppBuildersConfig;
33
+ registerHook: (event: string, handler: (...args: unknown[]) => void) => void;
34
+ }
35
+ interface IdentitySnapshot {
36
+ appUuid: string;
37
+ projectUuid: string;
38
+ developerId?: string;
39
+ organizationId?: string;
40
+ hostname?: string;
41
+ domain?: string;
42
+ environment: Environment;
43
+ gitCommit?: string;
44
+ gitBranch?: string;
45
+ buildNumber?: string;
46
+ packageVersion?: string;
47
+ deploymentProvider?: string;
48
+ timestamp: string;
49
+ verificationHash: string;
50
+ }
51
+ interface HealthReport {
52
+ healthScore: number;
53
+ performanceScore: number;
54
+ uptimeSeconds: number;
55
+ lastSync: string;
56
+ }
57
+ interface SecurityReport {
58
+ securityScore: number;
59
+ threatLevel: "none" | "low" | "medium" | "high" | "critical";
60
+ recommendations: string[];
61
+ }
62
+ type LogLevel = "info" | "debug" | "warning" | "error" | "critical" | "audit" | "security";
63
+ interface LogEntry {
64
+ level: LogLevel;
65
+ message: string;
66
+ timestamp: string;
67
+ context?: Record<string, unknown>;
68
+ }
69
+
70
+ declare function generateUuid(): string;
71
+ declare function nowIso(): string;
72
+ declare function resolveEnvironment(): "development" | "staging" | "production" | "test";
73
+
74
+ export { type AppBuildersConfig, type AppBuildersPlugin, type BadgeConfig, type BadgePosition, type Environment, type HealthReport, type IdentitySnapshot, type LogEntry, type LogLevel, type PluginContext, type SecurityReport, type Theme, generateUuid, nowIso, resolveEnvironment };
@@ -0,0 +1,74 @@
1
+ type Environment = "development" | "staging" | "production" | "test";
2
+ type Theme = "dark" | "light" | "system";
3
+ type BadgePosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
4
+ interface BadgeConfig {
5
+ enabled?: boolean;
6
+ theme?: Theme;
7
+ position?: BadgePosition;
8
+ animation?: boolean;
9
+ expandable?: boolean;
10
+ }
11
+ interface AppBuildersConfig {
12
+ appName: string;
13
+ organization?: string;
14
+ developer?: string;
15
+ environment?: Environment;
16
+ badge?: boolean | BadgeConfig;
17
+ identity?: boolean;
18
+ watcher?: boolean;
19
+ logger?: boolean;
20
+ notifications?: boolean;
21
+ security?: boolean;
22
+ dashboard?: boolean;
23
+ ai?: boolean;
24
+ plugins?: AppBuildersPlugin[];
25
+ theme?: Theme;
26
+ }
27
+ interface AppBuildersPlugin {
28
+ name: string;
29
+ setup: (ctx: PluginContext) => void | Promise<void>;
30
+ }
31
+ interface PluginContext {
32
+ config: AppBuildersConfig;
33
+ registerHook: (event: string, handler: (...args: unknown[]) => void) => void;
34
+ }
35
+ interface IdentitySnapshot {
36
+ appUuid: string;
37
+ projectUuid: string;
38
+ developerId?: string;
39
+ organizationId?: string;
40
+ hostname?: string;
41
+ domain?: string;
42
+ environment: Environment;
43
+ gitCommit?: string;
44
+ gitBranch?: string;
45
+ buildNumber?: string;
46
+ packageVersion?: string;
47
+ deploymentProvider?: string;
48
+ timestamp: string;
49
+ verificationHash: string;
50
+ }
51
+ interface HealthReport {
52
+ healthScore: number;
53
+ performanceScore: number;
54
+ uptimeSeconds: number;
55
+ lastSync: string;
56
+ }
57
+ interface SecurityReport {
58
+ securityScore: number;
59
+ threatLevel: "none" | "low" | "medium" | "high" | "critical";
60
+ recommendations: string[];
61
+ }
62
+ type LogLevel = "info" | "debug" | "warning" | "error" | "critical" | "audit" | "security";
63
+ interface LogEntry {
64
+ level: LogLevel;
65
+ message: string;
66
+ timestamp: string;
67
+ context?: Record<string, unknown>;
68
+ }
69
+
70
+ declare function generateUuid(): string;
71
+ declare function nowIso(): string;
72
+ declare function resolveEnvironment(): "development" | "staging" | "production" | "test";
73
+
74
+ export { type AppBuildersConfig, type AppBuildersPlugin, type BadgeConfig, type BadgePosition, type Environment, type HealthReport, type IdentitySnapshot, type LogEntry, type LogLevel, type PluginContext, type SecurityReport, type Theme, generateUuid, nowIso, resolveEnvironment };
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { randomUUID } from 'crypto';
2
+
3
+ // src/utils.ts
4
+ function generateUuid() {
5
+ return randomUUID();
6
+ }
7
+ function nowIso() {
8
+ return (/* @__PURE__ */ new Date()).toISOString();
9
+ }
10
+ function resolveEnvironment() {
11
+ const env = process.env.NODE_ENV;
12
+ if (env === "production" || env === "test" || env === "staging") return env;
13
+ return "development";
14
+ }
15
+
16
+ export { generateUuid, nowIso, resolveEnvironment };
17
+ //# sourceMappingURL=index.js.map
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils.ts"],"names":[],"mappings":";;;AAEO,SAAS,YAAA,GAAuB;AACrC,EAAA,OAAO,UAAA,EAAW;AACpB;AAEO,SAAS,MAAA,GAAiB;AAC/B,EAAA,OAAA,iBAAO,IAAI,IAAA,EAAK,EAAE,WAAA,EAAY;AAChC;AAEO,SAAS,kBAAA,GAAwE;AACtF,EAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,CAAI,QAAA;AACxB,EAAA,IAAI,QAAQ,YAAA,IAAgB,GAAA,KAAQ,MAAA,IAAU,GAAA,KAAQ,WAAW,OAAO,GAAA;AACxE,EAAA,OAAO,aAAA;AACT","file":"index.js","sourcesContent":["import { randomUUID } from \"node:crypto\";\n\nexport function generateUuid(): string {\n return randomUUID();\n}\n\nexport function nowIso(): string {\n return new Date().toISOString();\n}\n\nexport function resolveEnvironment(): \"development\" | \"staging\" | \"production\" | \"test\" {\n const env = process.env.NODE_ENV;\n if (env === \"production\" || env === \"test\" || env === \"staging\") return env;\n return \"development\";\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@appbuildersph/shared",
3
+ "version": "0.0.1",
4
+ "description": "Shared types and utilities used across the App Builders PH SDK packages.",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "devDependencies": {
20
+ "tsup": "^8.3.5",
21
+ "typescript": "^5.6.3"
22
+ },
23
+ "scripts": {
24
+ "build": "tsup",
25
+ "dev": "tsup --watch",
26
+ "typecheck": "tsc --noEmit"
27
+ }
28
+ }