@vikukumar/propvault-pdk 0.1.4 → 0.1.5
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 +7 -1
- package/package.json +21 -1
- package/bin/build.js +0 -46
- package/src/index.ts +0 -59
- package/tsconfig.json +0 -15
package/README.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
# PropVault CMS — Plugin Development Kit (PDK)
|
|
1
|
+
# <img src="https://vikukumar.github.io/propvault/assets/icon.png" width="42" height="42" align="center" style="vertical-align: middle;" /> PropVault CMS — Plugin Development Kit (PDK)
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://vikukumar.github.io/propvault/assets/logo.png" alt="PropVault Logo" width="320" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
---
|
|
2
8
|
|
|
3
9
|
Extend the functionality of the PropVault Real Estate CMS and Page Builder platform with dynamic plugins. Custom plugins can register Action hooks to trigger custom logic on events (e.g. sending CRM leads) and Filter hooks to intercept and mutate variables/configs before operations complete.
|
|
4
10
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vikukumar/propvault-pdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Plugin Development Kit (PDK) for the PropVault CMS Platform",
|
|
5
|
+
"author": "PropVault Team <support@propvault.io>",
|
|
6
|
+
"homepage": "https://propvault.io",
|
|
7
|
+
"bugs": {
|
|
8
|
+
"url": "https://propvault.io/support",
|
|
9
|
+
"email": "support@propvault.io"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"propvault",
|
|
13
|
+
"pdk",
|
|
14
|
+
"cms",
|
|
15
|
+
"realestate",
|
|
16
|
+
"plugin",
|
|
17
|
+
"hooks",
|
|
18
|
+
"filters"
|
|
19
|
+
],
|
|
5
20
|
"type": "module",
|
|
6
21
|
"main": "./dist/index.js",
|
|
7
22
|
"types": "./dist/index.d.ts",
|
|
@@ -22,6 +37,11 @@
|
|
|
22
37
|
"engines": {
|
|
23
38
|
"node": ">=18.0.0"
|
|
24
39
|
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"bin/pdk-cli.js",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
25
45
|
"publishConfig": {
|
|
26
46
|
"access": "public"
|
|
27
47
|
}
|
package/bin/build.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { build } from "esbuild";
|
|
2
|
-
import { execSync } from "child_process";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
const rootDir = path.join(__dirname, "..");
|
|
10
|
-
|
|
11
|
-
async function run() {
|
|
12
|
-
console.log("Building PropVault PDK package...");
|
|
13
|
-
|
|
14
|
-
// Clean dist
|
|
15
|
-
const distDir = path.join(rootDir, "dist");
|
|
16
|
-
if (fs.existsSync(distDir)) {
|
|
17
|
-
fs.rmSync(distDir, { recursive: true, force: true });
|
|
18
|
-
}
|
|
19
|
-
fs.mkdirSync(distDir, { recursive: true });
|
|
20
|
-
|
|
21
|
-
// 1. Compile TS with esbuild
|
|
22
|
-
await build({
|
|
23
|
-
entryPoints: [path.join(rootDir, "src", "index.ts")],
|
|
24
|
-
bundle: true,
|
|
25
|
-
platform: "node",
|
|
26
|
-
format: "esm",
|
|
27
|
-
outfile: path.join(distDir, "index.js"),
|
|
28
|
-
minify: false,
|
|
29
|
-
sourcemap: true,
|
|
30
|
-
external: []
|
|
31
|
-
});
|
|
32
|
-
console.log("✔ Compiled PDK ES modules successfully.");
|
|
33
|
-
|
|
34
|
-
// 2. Generate typings (.d.ts) using TypeScript compiler
|
|
35
|
-
try {
|
|
36
|
-
console.log("Generating typings (.d.ts)...");
|
|
37
|
-
execSync("npx tsc", { cwd: rootDir, stdio: "inherit" });
|
|
38
|
-
console.log("✔ Generated types successfully.");
|
|
39
|
-
} catch (err) {
|
|
40
|
-
console.warn("⚠ Warning: Failed to generate typings with tsc compiler:", err);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
console.log("✔ PDK Build complete!");
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
run();
|
package/src/index.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PropVault CMS — Plugin Development Kit (PDK) Core API
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export interface HookAction {
|
|
6
|
-
slug: string;
|
|
7
|
-
handler: (...args: any[]) => void | Promise<void>;
|
|
8
|
-
priority?: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface HookFilter {
|
|
12
|
-
slug: string;
|
|
13
|
-
handler: (value: any, ...args: any[]) => any | Promise<any>;
|
|
14
|
-
priority?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface PluginManifest {
|
|
18
|
-
name: string;
|
|
19
|
-
slug: string;
|
|
20
|
-
version: string;
|
|
21
|
-
description: string;
|
|
22
|
-
author: string;
|
|
23
|
-
entry: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Registers an action hook handler. Action hooks trigger code at specific system events.
|
|
28
|
-
*/
|
|
29
|
-
export function addAction(slug: string, handler: (...args: any[]) => void | Promise<void>, priority = 10): void {
|
|
30
|
-
if (typeof window !== "undefined") return;
|
|
31
|
-
|
|
32
|
-
// Register dynamic handler into global hooks registry
|
|
33
|
-
const globalHooks = (globalThis as any).__propvault_hooks || { actions: {}, filters: {} };
|
|
34
|
-
if (!globalHooks.actions[slug]) {
|
|
35
|
-
globalHooks.actions[slug] = [];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
globalHooks.actions[slug].push({ handler, priority });
|
|
39
|
-
globalHooks.actions[slug].sort((a: any, b: any) => a.priority - b.priority);
|
|
40
|
-
|
|
41
|
-
(globalThis as any).__propvault_hooks = globalHooks;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Registers a filter hook handler. Filter hooks allow modifying variables/inputs before they are stored/saved.
|
|
46
|
-
*/
|
|
47
|
-
export function addFilter(slug: string, handler: (value: any, ...args: any[]) => any | Promise<any>, priority = 10): void {
|
|
48
|
-
if (typeof window !== "undefined") return;
|
|
49
|
-
|
|
50
|
-
const globalHooks = (globalThis as any).__propvault_hooks || { actions: {}, filters: {} };
|
|
51
|
-
if (!globalHooks.filters[slug]) {
|
|
52
|
-
globalHooks.filters[slug] = [];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
globalHooks.filters[slug].push({ handler, priority });
|
|
56
|
-
globalHooks.filters[slug].sort((a: any, b: any) => a.priority - b.priority);
|
|
57
|
-
|
|
58
|
-
(globalThis as any).__propvault_hooks = globalHooks;
|
|
59
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "NodeNext",
|
|
5
|
-
"moduleResolution": "NodeNext",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"rootDir": "./src",
|
|
9
|
-
"strict": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src/**/*"]
|
|
15
|
-
}
|