bun_plugins 1.2.5 → 1.2.6
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 +3 -127
- package/dist/{src/PluginManager.d.ts → PluginManager.d.ts} +9 -20
- package/dist/PluginManager.d.ts.map +1 -0
- package/dist/{src/PluginManager.js → PluginManager.js} +189 -212
- package/dist/PluginManager.js.map +1 -0
- package/dist/{src/index.d.ts → index.d.ts} +1 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/{src/index.js → index.js} +0 -2
- package/dist/index.js.map +1 -0
- package/dist/{src/managers → managers}/ContextFactory.d.ts +1 -1
- package/dist/managers/ContextFactory.d.ts.map +1 -0
- package/dist/{src/managers → managers}/ContextFactory.js +26 -51
- package/dist/managers/ContextFactory.js.map +1 -0
- package/dist/managers/DependencyManager.d.ts.map +1 -0
- package/dist/{src/managers → managers}/DependencyManager.js +5 -7
- package/dist/managers/DependencyManager.js.map +1 -0
- package/dist/{src/managers → managers}/HooksManager.d.ts +1 -4
- package/dist/managers/HooksManager.d.ts.map +1 -0
- package/dist/{src/managers → managers}/HooksManager.js +8 -36
- package/dist/managers/HooksManager.js.map +1 -0
- package/dist/managers/ResourceManager.d.ts.map +1 -0
- package/dist/{src/managers → managers}/ResourceManager.js +3 -3
- package/dist/managers/ResourceManager.js.map +1 -0
- package/dist/{src/storage → storage}/JsonPluginStorage.d.ts +1 -2
- package/dist/storage/JsonPluginStorage.d.ts.map +1 -0
- package/dist/storage/JsonPluginStorage.js +63 -0
- package/dist/storage/JsonPluginStorage.js.map +1 -0
- package/dist/{src/types.d.ts → types.d.ts} +19 -60
- package/dist/types.d.ts.map +1 -0
- package/dist/{src/types.js → types.js} +0 -6
- package/dist/types.js.map +1 -0
- package/dist/utils/errorParser.d.ts.map +1 -0
- package/dist/{src/utils → utils}/errorParser.js +5 -2
- package/dist/utils/errorParser.js.map +1 -0
- package/dist/utils/pluginValidator.d.ts +93 -0
- package/dist/utils/pluginValidator.d.ts.map +1 -0
- package/dist/{src/utils → utils}/pluginValidator.js +14 -11
- package/dist/utils/pluginValidator.js.map +1 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/security.js.map +1 -0
- package/dist/worker/WorkerRunner.d.ts.map +1 -0
- package/dist/{src/worker → worker}/WorkerRunner.js +13 -38
- package/dist/worker/WorkerRunner.js.map +1 -0
- package/package.json +6 -9
- package/LICENSE +0 -9
- package/dist/examples/action-registry-declarative.d.ts +0 -14
- package/dist/examples/action-registry-declarative.d.ts.map +0 -1
- package/dist/examples/action-registry-declarative.js +0 -130
- package/dist/examples/action-registry-declarative.js.map +0 -1
- package/dist/examples/action-registry-example.d.ts +0 -31
- package/dist/examples/action-registry-example.d.ts.map +0 -1
- package/dist/examples/action-registry-example.js +0 -84
- package/dist/examples/action-registry-example.js.map +0 -1
- package/dist/examples/index-declarative.d.ts +0 -32
- package/dist/examples/index-declarative.d.ts.map +0 -1
- package/dist/examples/index-declarative.js +0 -206
- package/dist/examples/index-declarative.js.map +0 -1
- package/dist/examples/logger-declarative.d.ts +0 -109
- package/dist/examples/logger-declarative.d.ts.map +0 -1
- package/dist/examples/logger-declarative.js +0 -330
- package/dist/examples/logger-declarative.js.map +0 -1
- package/dist/examples/logger-simple.d.ts +0 -8
- package/dist/examples/logger-simple.d.ts.map +0 -1
- package/dist/examples/logger-simple.js +0 -165
- package/dist/examples/logger-simple.js.map +0 -1
- package/dist/examples/server-declarative.d.ts +0 -46
- package/dist/examples/server-declarative.d.ts.map +0 -1
- package/dist/examples/server-declarative.js +0 -205
- package/dist/examples/server-declarative.js.map +0 -1
- package/dist/examples/shared/action-registry.d.ts +0 -45
- package/dist/examples/shared/action-registry.d.ts.map +0 -1
- package/dist/examples/shared/action-registry.js +0 -65
- package/dist/examples/shared/action-registry.js.map +0 -1
- package/dist/examples/shared/plugin-builder.d.ts +0 -41
- package/dist/examples/shared/plugin-builder.d.ts.map +0 -1
- package/dist/examples/shared/plugin-builder.js +0 -85
- package/dist/examples/shared/plugin-builder.js.map +0 -1
- package/dist/examples/storage-declarative.d.ts +0 -13
- package/dist/examples/storage-declarative.d.ts.map +0 -1
- package/dist/examples/storage-declarative.js +0 -203
- package/dist/examples/storage-declarative.js.map +0 -1
- package/dist/plugins/ActionRegistryPlugin.d.ts +0 -14
- package/dist/plugins/ActionRegistryPlugin.d.ts.map +0 -1
- package/dist/plugins/ActionRegistryPlugin.js +0 -52
- package/dist/plugins/ActionRegistryPlugin.js.map +0 -1
- package/dist/plugins/DynamicJSActionsPlugin.d.ts +0 -21
- package/dist/plugins/DynamicJSActionsPlugin.d.ts.map +0 -1
- package/dist/plugins/DynamicJSActionsPlugin.js +0 -57
- package/dist/plugins/DynamicJSActionsPlugin.js.map +0 -1
- package/dist/plugins/DynamicMathActionsPlugin.d.ts +0 -22
- package/dist/plugins/DynamicMathActionsPlugin.d.ts.map +0 -1
- package/dist/plugins/DynamicMathActionsPlugin.js +0 -64
- package/dist/plugins/DynamicMathActionsPlugin.js.map +0 -1
- package/dist/plugins/DynamicTextActionsPlugin.d.ts +0 -22
- package/dist/plugins/DynamicTextActionsPlugin.d.ts.map +0 -1
- package/dist/plugins/DynamicTextActionsPlugin.js +0 -58
- package/dist/plugins/DynamicTextActionsPlugin.js.map +0 -1
- package/dist/plugins/DynamicUtilityActionsPlugin.d.ts +0 -22
- package/dist/plugins/DynamicUtilityActionsPlugin.d.ts.map +0 -1
- package/dist/plugins/DynamicUtilityActionsPlugin.js +0 -75
- package/dist/plugins/DynamicUtilityActionsPlugin.js.map +0 -1
- package/dist/plugins/ExamplePlugin.d.ts +0 -3
- package/dist/plugins/ExamplePlugin.d.ts.map +0 -1
- package/dist/plugins/ExamplePlugin.js +0 -24
- package/dist/plugins/ExamplePlugin.js.map +0 -1
- package/dist/plugins/LifecycleDemoPlugin.d.ts +0 -20
- package/dist/plugins/LifecycleDemoPlugin.d.ts.map +0 -1
- package/dist/plugins/LifecycleDemoPlugin.js +0 -34
- package/dist/plugins/LifecycleDemoPlugin.js.map +0 -1
- package/dist/plugins/MathPlugin.d.ts +0 -16
- package/dist/plugins/MathPlugin.d.ts.map +0 -1
- package/dist/plugins/MathPlugin.js +0 -30
- package/dist/plugins/MathPlugin.js.map +0 -1
- package/dist/plugins/MyJSPlugin.d.ts +0 -7
- package/dist/plugins/MyJSPlugin.d.ts.map +0 -1
- package/dist/plugins/MyJSPlugin.js +0 -12
- package/dist/plugins/MyJSPlugin.js.map +0 -1
- package/dist/plugins/TypedExamplePlugin.d.ts +0 -10
- package/dist/plugins/TypedExamplePlugin.d.ts.map +0 -1
- package/dist/plugins/TypedExamplePlugin.js +0 -61
- package/dist/plugins/TypedExamplePlugin.js.map +0 -1
- package/dist/plugins/arktype/index.d.ts +0 -8
- package/dist/plugins/arktype/index.d.ts.map +0 -1
- package/dist/plugins/arktype/index.js +0 -25
- package/dist/plugins/arktype/index.js.map +0 -1
- package/dist/src/Plugin.d.ts +0 -28
- package/dist/src/Plugin.d.ts.map +0 -1
- package/dist/src/Plugin.js +0 -36
- package/dist/src/Plugin.js.map +0 -1
- package/dist/src/PluginManager.d.ts.map +0 -1
- package/dist/src/PluginManager.js.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/logger/LoggerAdapter.d.ts +0 -77
- package/dist/src/logger/LoggerAdapter.d.ts.map +0 -1
- package/dist/src/logger/LoggerAdapter.js +0 -242
- package/dist/src/logger/LoggerAdapter.js.map +0 -1
- package/dist/src/logger/LoggerFactory.d.ts +0 -73
- package/dist/src/logger/LoggerFactory.d.ts.map +0 -1
- package/dist/src/logger/LoggerFactory.js +0 -99
- package/dist/src/logger/LoggerFactory.js.map +0 -1
- package/dist/src/logger/index.d.ts +0 -3
- package/dist/src/logger/index.d.ts.map +0 -1
- package/dist/src/logger/index.js +0 -3
- package/dist/src/logger/index.js.map +0 -1
- package/dist/src/managers/ContextFactory.d.ts.map +0 -1
- package/dist/src/managers/ContextFactory.js.map +0 -1
- package/dist/src/managers/DependencyManager.d.ts.map +0 -1
- package/dist/src/managers/DependencyManager.js.map +0 -1
- package/dist/src/managers/HooksManager.d.ts.map +0 -1
- package/dist/src/managers/HooksManager.js.map +0 -1
- package/dist/src/managers/ResourceManager.d.ts.map +0 -1
- package/dist/src/managers/ResourceManager.js.map +0 -1
- package/dist/src/storage/JsonPluginStorage.d.ts.map +0 -1
- package/dist/src/storage/JsonPluginStorage.js +0 -75
- package/dist/src/storage/JsonPluginStorage.js.map +0 -1
- package/dist/src/types/plugin-registry-base.d.ts +0 -80
- package/dist/src/types/plugin-registry-base.d.ts.map +0 -1
- package/dist/src/types/plugin-registry-base.js +0 -6
- package/dist/src/types/plugin-registry-base.js.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils/errorParser.d.ts.map +0 -1
- package/dist/src/utils/errorParser.js.map +0 -1
- package/dist/src/utils/pluginValidator.d.ts +0 -17
- package/dist/src/utils/pluginValidator.d.ts.map +0 -1
- package/dist/src/utils/pluginValidator.js.map +0 -1
- package/dist/src/utils/security.d.ts.map +0 -1
- package/dist/src/utils/security.js.map +0 -1
- package/dist/src/worker/WorkerRunner.d.ts.map +0 -1
- package/dist/src/worker/WorkerRunner.js.map +0 -1
- /package/dist/{src/managers → managers}/DependencyManager.d.ts +0 -0
- /package/dist/{src/managers → managers}/ResourceManager.d.ts +0 -0
- /package/dist/{src/utils → utils}/errorParser.d.ts +0 -0
- /package/dist/{src/utils → utils}/security.d.ts +0 -0
- /package/dist/{src/utils → utils}/security.js +0 -0
- /package/dist/{src/worker → worker}/WorkerRunner.d.ts +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative Action Registry Example
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates a clean, declarative approach to building
|
|
5
|
-
* plugins with action registries using shared utilities.
|
|
6
|
-
*/
|
|
7
|
-
import { PluginManager } from "../src/PluginManager";
|
|
8
|
-
import { mathActions, textActions, utilityActions, createActionRegistry } from "./shared/action-registry";
|
|
9
|
-
import { createPlugin, createActionPlugin, runDemo } from "./shared/plugin-builder";
|
|
10
|
-
// Central registry plugin - declarative definition
|
|
11
|
-
const createRegistryPlugin = () => createPlugin({
|
|
12
|
-
name: "action-registry",
|
|
13
|
-
version: "1.0.0",
|
|
14
|
-
description: "Central action registry for all plugins",
|
|
15
|
-
onLoad: async (context) => {
|
|
16
|
-
context.log.info("ActionRegistry initialized");
|
|
17
|
-
},
|
|
18
|
-
sharedApi: createActionRegistry()
|
|
19
|
-
});
|
|
20
|
-
// Action plugins - declarative definitions
|
|
21
|
-
const createMathPlugin = () => createActionPlugin({
|
|
22
|
-
name: "math-actions",
|
|
23
|
-
version: "1.0.0",
|
|
24
|
-
description: "Mathematical operations",
|
|
25
|
-
registryName: "action-registry",
|
|
26
|
-
actionCategories: [mathActions]
|
|
27
|
-
});
|
|
28
|
-
const createTextPlugin = () => createActionPlugin({
|
|
29
|
-
name: "text-actions",
|
|
30
|
-
version: "1.0.0",
|
|
31
|
-
description: "Text transformation operations",
|
|
32
|
-
registryName: "action-registry",
|
|
33
|
-
actionCategories: [textActions]
|
|
34
|
-
});
|
|
35
|
-
const createUtilityPlugin = () => createActionPlugin({
|
|
36
|
-
name: "utility-actions",
|
|
37
|
-
version: "1.0.0",
|
|
38
|
-
description: "Utility functions",
|
|
39
|
-
registryName: "action-registry",
|
|
40
|
-
actionCategories: [utilityActions]
|
|
41
|
-
});
|
|
42
|
-
// Demo runner with declarative test cases
|
|
43
|
-
const runActionTests = async (registry) => {
|
|
44
|
-
const testCases = [
|
|
45
|
-
{ category: "Math", tests: [
|
|
46
|
-
{ action: "sum", args: [5, 3], expected: 8 },
|
|
47
|
-
{ action: "multiply", args: [4, 7], expected: 28 },
|
|
48
|
-
{ action: "power", args: [2, 8], expected: 256 }
|
|
49
|
-
] },
|
|
50
|
-
{ category: "Text", tests: [
|
|
51
|
-
{ action: "uppercase", args: ["hello world"], expected: "HELLO WORLD" },
|
|
52
|
-
{ action: "reverse", args: ["javascript"], expected: "tpircsavaj" }
|
|
53
|
-
] },
|
|
54
|
-
{ category: "Utility", tests: [
|
|
55
|
-
{ action: "timestamp", args: [], validator: (result) => result > 0 }
|
|
56
|
-
] }
|
|
57
|
-
];
|
|
58
|
-
for (const { category, tests } of testCases) {
|
|
59
|
-
console.log(`\n${category} Operations:`);
|
|
60
|
-
for (const test of tests) {
|
|
61
|
-
try {
|
|
62
|
-
const result = registry.execute(test.action, ...test.args);
|
|
63
|
-
if ('expected' in test && test.expected !== undefined) {
|
|
64
|
-
console.log(` ${test.action}(${test.args.join(', ')}) = ${result}`);
|
|
65
|
-
}
|
|
66
|
-
else if ('validator' in test && test.validator) {
|
|
67
|
-
console.log(` ${test.action}() = ${test.validator(result) ? '✓' : '✗'}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
console.error(` ${test.action} failed:`, error);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
// Main demonstration
|
|
77
|
-
const demonstrateDeclarativeActionRegistry = async () => {
|
|
78
|
-
const manager = new PluginManager();
|
|
79
|
-
// Create plugin instances
|
|
80
|
-
const registryPlugin = createRegistryPlugin();
|
|
81
|
-
const mathPlugin = createMathPlugin();
|
|
82
|
-
const textPlugin = createTextPlugin();
|
|
83
|
-
const utilityPlugin = createUtilityPlugin();
|
|
84
|
-
// Register plugins in dependency order
|
|
85
|
-
await manager.register(registryPlugin);
|
|
86
|
-
await manager.register(mathPlugin);
|
|
87
|
-
await manager.register(textPlugin);
|
|
88
|
-
await manager.register(utilityPlugin);
|
|
89
|
-
// Get the registry
|
|
90
|
-
const registry = manager.getPluginApi("action-registry");
|
|
91
|
-
if (!registry) {
|
|
92
|
-
throw new Error("Registry plugin not found");
|
|
93
|
-
}
|
|
94
|
-
console.log("\nAvailable Actions:");
|
|
95
|
-
registry.list().forEach(action => console.log(` - ${action}`));
|
|
96
|
-
// Run tests
|
|
97
|
-
await runActionTests(registry);
|
|
98
|
-
// Error handling demo
|
|
99
|
-
console.log("\nError Handling:");
|
|
100
|
-
try {
|
|
101
|
-
registry.execute("non-existent-action");
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
console.log(` Caught error: ${error.message}`);
|
|
105
|
-
}
|
|
106
|
-
// Plugin info
|
|
107
|
-
console.log("\nPlugin Information:");
|
|
108
|
-
["math-actions", "text-actions", "utility-actions"].forEach(pluginName => {
|
|
109
|
-
const api = manager.getPluginApi(pluginName);
|
|
110
|
-
if (api?.actions) {
|
|
111
|
-
console.log(` ${pluginName}: ${api.actions.join(", ")}`);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
// Dynamic loading example
|
|
116
|
-
const demonstrateDynamicLoading = async () => {
|
|
117
|
-
const { join } = await import("node:path");
|
|
118
|
-
const manager = new PluginManager();
|
|
119
|
-
console.log("\nLoading plugins dynamically from directory...");
|
|
120
|
-
await manager.loadPluginsFromDirectory(join(process.cwd(), "plugins"));
|
|
121
|
-
const loaded = manager.listPlugins();
|
|
122
|
-
console.log(`Loaded ${loaded.length} plugins: ${loaded.join(", ")}`);
|
|
123
|
-
};
|
|
124
|
-
// Export for use
|
|
125
|
-
export { createRegistryPlugin, createMathPlugin, createTextPlugin, createUtilityPlugin, demonstrateDeclarativeActionRegistry, demonstrateDynamicLoading };
|
|
126
|
-
// Run if called directly
|
|
127
|
-
if (import.meta.main) {
|
|
128
|
-
runDemo("Declarative Action Registry Demo", demonstrateDeclarativeActionRegistry);
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=action-registry-declarative.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-registry-declarative.js","sourceRoot":"","sources":["../../examples/action-registry-declarative.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBA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AEpC,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAC/D,MAAM,OAAO,CAAC,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvE,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,MAAM,aAAa,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvE,CAAC,CAAC;AAEF,iBAAiB;AACjB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,oCAAoC,EACpC,yBAAyB,EAC1B,CAAC;AAEF,yBAAyB;AACzB,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACrB,OAAO,CAAC,kCAAkC,EAAE,oCAAoC,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Registry Example - Simple implementation for testing
|
|
3
|
-
*/
|
|
4
|
-
import type { IPlugin, PluginContext } from "../src/types";
|
|
5
|
-
export declare class ActionRegistryPlugin implements IPlugin {
|
|
6
|
-
name: string;
|
|
7
|
-
version: string;
|
|
8
|
-
private actionRegistry;
|
|
9
|
-
constructor();
|
|
10
|
-
onLoad(context: PluginContext): void;
|
|
11
|
-
onUnload(): void;
|
|
12
|
-
}
|
|
13
|
-
export declare class MathActionsPlugin implements IPlugin {
|
|
14
|
-
name: string;
|
|
15
|
-
version: string;
|
|
16
|
-
dependencies: {
|
|
17
|
-
"action-registry": string;
|
|
18
|
-
};
|
|
19
|
-
onLoad(context: PluginContext): Promise<void>;
|
|
20
|
-
onUnload(): void;
|
|
21
|
-
}
|
|
22
|
-
export declare class TextActionsPlugin implements IPlugin {
|
|
23
|
-
name: string;
|
|
24
|
-
version: string;
|
|
25
|
-
dependencies: {
|
|
26
|
-
"action-registry": string;
|
|
27
|
-
};
|
|
28
|
-
onLoad(context: PluginContext): Promise<void>;
|
|
29
|
-
onUnload(): void;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=action-registry-example.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-registry-example.d.ts","sourceRoot":"","sources":["../../examples/action-registry-example.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AA4B3D,qBAAa,oBAAqB,YAAW,OAAO;IAClD,IAAI,SAAqB;IACzB,OAAO,SAAW;IAClB,OAAO,CAAC,cAAc,CAAiB;;IAMvC,MAAM,CAAC,OAAO,EAAE,aAAa;IAa7B,QAAQ;CAGT;AAED,qBAAa,iBAAkB,YAAW,OAAO;IAC/C,IAAI,SAAkB;IACtB,OAAO,SAAW;IAClB,YAAY;;MAEV;IAEI,MAAM,CAAC,OAAO,EAAE,aAAa;IAWnC,QAAQ;CAGT;AAED,qBAAa,iBAAkB,YAAW,OAAO;IAC/C,IAAI,SAAkB;IACtB,OAAO,SAAW;IAClB,YAAY;;MAEV;IAEI,MAAM,CAAC,OAAO,EAAE,aAAa;IAYnC,QAAQ;CAGT"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action Registry Example - Simple implementation for testing
|
|
3
|
-
*/
|
|
4
|
-
class ActionRegistry {
|
|
5
|
-
actionHandlers = new Map();
|
|
6
|
-
registerAction(type, handler) {
|
|
7
|
-
this.actionHandlers.set(type, handler);
|
|
8
|
-
}
|
|
9
|
-
executeAction(type, ...args) {
|
|
10
|
-
const handler = this.actionHandlers.get(type);
|
|
11
|
-
if (!handler) {
|
|
12
|
-
throw new Error(`Acción no encontrada: ${type}`);
|
|
13
|
-
}
|
|
14
|
-
return handler(...args);
|
|
15
|
-
}
|
|
16
|
-
listActions() {
|
|
17
|
-
return Array.from(this.actionHandlers.keys());
|
|
18
|
-
}
|
|
19
|
-
hasAction(type) {
|
|
20
|
-
return this.actionHandlers.has(type);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export class ActionRegistryPlugin {
|
|
24
|
-
name = "action-registry";
|
|
25
|
-
version = "1.0.0";
|
|
26
|
-
actionRegistry;
|
|
27
|
-
constructor() {
|
|
28
|
-
this.actionRegistry = new ActionRegistry();
|
|
29
|
-
}
|
|
30
|
-
onLoad(context) {
|
|
31
|
-
context.log.info("ActionRegistry initialized");
|
|
32
|
-
// Register the API manually using the new system
|
|
33
|
-
context.registerApi({
|
|
34
|
-
registerAction: this.actionRegistry.registerAction.bind(this.actionRegistry),
|
|
35
|
-
executeAction: this.actionRegistry.executeAction.bind(this.actionRegistry),
|
|
36
|
-
listActions: this.actionRegistry.listActions.bind(this.actionRegistry),
|
|
37
|
-
hasAction: this.actionRegistry.hasAction.bind(this.actionRegistry),
|
|
38
|
-
actions: this.actionRegistry.listActions()
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
onUnload() {
|
|
42
|
-
// Cleanup is handled by the plugin manager
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export class MathActionsPlugin {
|
|
46
|
-
name = "math-actions";
|
|
47
|
-
version = "1.0.0";
|
|
48
|
-
dependencies = {
|
|
49
|
-
"action-registry": "1.0.0"
|
|
50
|
-
};
|
|
51
|
-
async onLoad(context) {
|
|
52
|
-
const actionRegistry = await context.getPlugin("action-registry");
|
|
53
|
-
if (actionRegistry) {
|
|
54
|
-
actionRegistry.registerAction("sum", (a, b) => a + b);
|
|
55
|
-
actionRegistry.registerAction("multiply", (a, b) => a * b);
|
|
56
|
-
actionRegistry.registerAction("power", (base, exp) => Math.pow(base, exp));
|
|
57
|
-
context.log.info("Math actions registered");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
onUnload() {
|
|
61
|
-
// Cleanup is handled by the plugin manager
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export class TextActionsPlugin {
|
|
65
|
-
name = "text-actions";
|
|
66
|
-
version = "1.0.0";
|
|
67
|
-
dependencies = {
|
|
68
|
-
"action-registry": "1.0.0"
|
|
69
|
-
};
|
|
70
|
-
async onLoad(context) {
|
|
71
|
-
const actionRegistry = await context.getPlugin("action-registry");
|
|
72
|
-
if (actionRegistry) {
|
|
73
|
-
actionRegistry.registerAction("uppercase", (text) => text.toUpperCase());
|
|
74
|
-
actionRegistry.registerAction("lowercase", (text) => text.toLowerCase());
|
|
75
|
-
actionRegistry.registerAction("reverse", (text) => text.split('').reverse().join(''));
|
|
76
|
-
actionRegistry.registerAction("wordCount", (text) => text.trim().split(/\s+/).filter(word => word.length > 0).length);
|
|
77
|
-
context.log.info("Text actions registered");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
onUnload() {
|
|
81
|
-
// Cleanup is handled by the plugin manager
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=action-registry-example.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-registry-example.js","sourceRoot":"","sources":["../../examples/action-registry-example.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,cAAc;IACR,cAAc,GAAqC,IAAI,GAAG,EAAE,CAAC;IAEvE,cAAc,CAAC,IAAY,EAAE,OAA4B;QACvD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,aAAa,CAAC,IAAY,EAAE,GAAG,IAAW;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED,WAAW;QACT,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C;YAC9F,cAAc,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC9H,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,QAAQ;QACN,2CAA2C;IAC7C,CAAC;CACF"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative Examples Index
|
|
3
|
-
*
|
|
4
|
-
* This file serves as the main entry point for all declarative examples,
|
|
5
|
-
* providing a clean overview and easy access to different use cases.
|
|
6
|
-
*/
|
|
7
|
-
import { demonstrateDeclarativeActionRegistry } from "./action-registry-declarative";
|
|
8
|
-
import { demonstrateDeclarativeStorage } from "./storage-declarative";
|
|
9
|
-
import { demonstrateDeclarativeLogging } from "./logger-declarative";
|
|
10
|
-
import { demonstrateDeclarativeServer } from "./server-declarative";
|
|
11
|
-
declare const exampleCatalog: ({
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
description: string;
|
|
15
|
-
file: string;
|
|
16
|
-
demo: () => Promise<void>;
|
|
17
|
-
features: string[];
|
|
18
|
-
} | {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
description: string;
|
|
22
|
-
file: string;
|
|
23
|
-
demo: () => Promise<Bun.Server<undefined>>;
|
|
24
|
-
features: string[];
|
|
25
|
-
})[];
|
|
26
|
-
declare const showMainMenu: () => void;
|
|
27
|
-
declare const runExample: (index: number) => Promise<void>;
|
|
28
|
-
declare const runAllExamples: () => Promise<void>;
|
|
29
|
-
declare const interactiveMenu: () => Promise<void>;
|
|
30
|
-
declare const quickRun: (exampleId: string) => Promise<void>;
|
|
31
|
-
export { exampleCatalog, showMainMenu, runExample, runAllExamples, interactiveMenu, quickRun, demonstrateDeclarativeActionRegistry, demonstrateDeclarativeStorage, demonstrateDeclarativeLogging, demonstrateDeclarativeServer };
|
|
32
|
-
//# sourceMappingURL=index-declarative.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-declarative.d.ts","sourceRoot":"","sources":["../../examples/index-declarative.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAGpE,QAAA,MAAM,cAAc;;;;;;;;;;;;;;IAyDnB,CAAC;AAGF,QAAA,MAAM,YAAY,YAejB,CAAC;AAGF,QAAA,MAAM,UAAU,GAAU,OAAO,MAAM,kBAkBtC,CAAC;AAGF,QAAA,MAAM,cAAc,qBAgBnB,CAAC;AAGF,QAAA,MAAM,eAAe,qBAwCpB,CAAC;AAGF,QAAA,MAAM,QAAQ,GAAU,WAAW,MAAM,kBAmBxC,CAAC;AAGF,OAAO,EACL,cAAc,EACd,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,QAAQ,EAER,oCAAoC,EACpC,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC7B,CAAC"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative Examples Index
|
|
3
|
-
*
|
|
4
|
-
* This file serves as the main entry point for all declarative examples,
|
|
5
|
-
* providing a clean overview and easy access to different use cases.
|
|
6
|
-
*/
|
|
7
|
-
import { runDemo } from "./shared/plugin-builder";
|
|
8
|
-
// Import all declarative examples
|
|
9
|
-
import { demonstrateDeclarativeActionRegistry } from "./action-registry-declarative";
|
|
10
|
-
import { demonstrateDeclarativeStorage } from "./storage-declarative";
|
|
11
|
-
import { demonstrateDeclarativeLogging } from "./logger-declarative";
|
|
12
|
-
import { demonstrateDeclarativeServer } from "./server-declarative";
|
|
13
|
-
// Example catalog with descriptions
|
|
14
|
-
const exampleCatalog = [
|
|
15
|
-
{
|
|
16
|
-
id: 'action-registry',
|
|
17
|
-
name: 'Action Registry',
|
|
18
|
-
description: 'Declarative plugin system with action registration and execution',
|
|
19
|
-
file: 'action-registry-declarative.ts',
|
|
20
|
-
demo: demonstrateDeclarativeActionRegistry,
|
|
21
|
-
features: [
|
|
22
|
-
'Declarative action definitions',
|
|
23
|
-
'Plugin-based architecture',
|
|
24
|
-
'Dynamic action registration',
|
|
25
|
-
'Error handling',
|
|
26
|
-
'Plugin discovery'
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 'storage',
|
|
31
|
-
name: 'Storage System',
|
|
32
|
-
description: 'Clean storage operations with declarative configuration',
|
|
33
|
-
file: 'storage-declarative.ts',
|
|
34
|
-
demo: demonstrateDeclarativeStorage,
|
|
35
|
-
features: [
|
|
36
|
-
'Declarative storage operations',
|
|
37
|
-
'CRUD operations',
|
|
38
|
-
'Configuration management',
|
|
39
|
-
'Data validation',
|
|
40
|
-
'Plugin isolation support'
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
id: 'logging',
|
|
45
|
-
name: 'Logging System',
|
|
46
|
-
description: 'Flexible logging with multiple adapters and configurations',
|
|
47
|
-
file: 'logger-declarative.ts',
|
|
48
|
-
demo: demonstrateDeclarativeLogging,
|
|
49
|
-
features: [
|
|
50
|
-
'Multiple logger adapters',
|
|
51
|
-
'Hierarchical logging',
|
|
52
|
-
'Structured logging',
|
|
53
|
-
'Performance monitoring',
|
|
54
|
-
'Plugin-specific loggers'
|
|
55
|
-
]
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: 'server',
|
|
59
|
-
name: 'HTTP Server',
|
|
60
|
-
description: 'Plugin-powered HTTP server with declarative routing',
|
|
61
|
-
file: 'server-declarative.ts',
|
|
62
|
-
demo: demonstrateDeclarativeServer,
|
|
63
|
-
features: [
|
|
64
|
-
'Declarative route definitions',
|
|
65
|
-
'Plugin-based handlers',
|
|
66
|
-
'Error handling',
|
|
67
|
-
'JSON API',
|
|
68
|
-
'Action execution'
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
];
|
|
72
|
-
// Main menu system
|
|
73
|
-
const showMainMenu = () => {
|
|
74
|
-
console.log("\n🎯 Declarative Plugin System Examples");
|
|
75
|
-
console.log("=====================================\n");
|
|
76
|
-
exampleCatalog.forEach((example, index) => {
|
|
77
|
-
console.log(`${index + 1}. ${example.name}`);
|
|
78
|
-
console.log(` ${example.description}`);
|
|
79
|
-
console.log(` File: ${example.file}`);
|
|
80
|
-
console.log(` Features: ${example.features.join(', ')}`);
|
|
81
|
-
console.log();
|
|
82
|
-
});
|
|
83
|
-
console.log("0. Run all examples");
|
|
84
|
-
console.log("q. Quit");
|
|
85
|
-
console.log();
|
|
86
|
-
};
|
|
87
|
-
// Run specific example
|
|
88
|
-
const runExample = async (index) => {
|
|
89
|
-
const example = exampleCatalog[index];
|
|
90
|
-
if (!example) {
|
|
91
|
-
console.log("❌ Invalid example number");
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
// Wrap server demo to return void
|
|
95
|
-
const wrappedDemo = async () => {
|
|
96
|
-
if (example.id === 'server') {
|
|
97
|
-
await example.demo();
|
|
98
|
-
console.log("\n🌐 Server is running. Press Ctrl+C to stop.");
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
await example.demo();
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
await runDemo(`${example.name} Example`, wrappedDemo);
|
|
105
|
-
};
|
|
106
|
-
// Run all examples (excluding server which blocks)
|
|
107
|
-
const runAllExamples = async () => {
|
|
108
|
-
console.log("\n🚀 Running all declarative examples...\n");
|
|
109
|
-
for (const example of exampleCatalog) {
|
|
110
|
-
if (example.id === 'server') {
|
|
111
|
-
console.log(`⏭️ Skipping ${example.name} (server blocks execution)`);
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
// Wrap demo to ensure it returns void
|
|
115
|
-
const wrappedDemo = async () => {
|
|
116
|
-
await example.demo();
|
|
117
|
-
};
|
|
118
|
-
await runDemo(example.name, wrappedDemo);
|
|
119
|
-
}
|
|
120
|
-
console.log("\n✅ All examples completed!");
|
|
121
|
-
};
|
|
122
|
-
// Interactive menu
|
|
123
|
-
const interactiveMenu = async () => {
|
|
124
|
-
const readline = await import('readline');
|
|
125
|
-
const rl = readline.createInterface({
|
|
126
|
-
input: process.stdin,
|
|
127
|
-
output: process.stdout
|
|
128
|
-
});
|
|
129
|
-
const askQuestion = (question) => {
|
|
130
|
-
return new Promise(resolve => {
|
|
131
|
-
rl.question(question, resolve);
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
while (true) {
|
|
135
|
-
showMainMenu();
|
|
136
|
-
const answer = await askQuestion("Select an example (number) or 'q' to quit: ");
|
|
137
|
-
if (answer.toLowerCase() === 'q') {
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
if (answer === '0') {
|
|
141
|
-
await runAllExamples();
|
|
142
|
-
continue;
|
|
143
|
-
}
|
|
144
|
-
const index = parseInt(answer) - 1;
|
|
145
|
-
if (!isNaN(index)) {
|
|
146
|
-
await runExample(index);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
console.log("❌ Invalid input");
|
|
150
|
-
}
|
|
151
|
-
const continueAnswer = await askQuestion("\nPress Enter to continue or 'q' to quit: ");
|
|
152
|
-
if (continueAnswer.toLowerCase() === 'q') {
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
rl.close();
|
|
157
|
-
};
|
|
158
|
-
// Quick run function
|
|
159
|
-
const quickRun = async (exampleId) => {
|
|
160
|
-
const example = exampleCatalog.find(e => e.id === exampleId);
|
|
161
|
-
if (!example) {
|
|
162
|
-
console.log(`❌ Example '${exampleId}' not found`);
|
|
163
|
-
console.log("Available examples:", exampleCatalog.map(e => e.id).join(', '));
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
// Wrap server demo to return void
|
|
167
|
-
const wrappedDemo = async () => {
|
|
168
|
-
if (example.id === 'server') {
|
|
169
|
-
await example.demo();
|
|
170
|
-
console.log("\n🌐 Server is running. Press Ctrl+C to stop.");
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
await example.demo();
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
await runDemo(example.name, wrappedDemo);
|
|
177
|
-
};
|
|
178
|
-
// Export everything
|
|
179
|
-
export { exampleCatalog, showMainMenu, runExample, runAllExamples, interactiveMenu, quickRun,
|
|
180
|
-
// Individual demos
|
|
181
|
-
demonstrateDeclarativeActionRegistry, demonstrateDeclarativeStorage, demonstrateDeclarativeLogging, demonstrateDeclarativeServer };
|
|
182
|
-
// Run if called directly
|
|
183
|
-
if (import.meta.main) {
|
|
184
|
-
const args = process.argv.slice(2);
|
|
185
|
-
if (args.length === 0) {
|
|
186
|
-
// Interactive mode
|
|
187
|
-
interactiveMenu().catch(console.error);
|
|
188
|
-
}
|
|
189
|
-
else if (args[0] === '--all') {
|
|
190
|
-
// Run all examples
|
|
191
|
-
runAllExamples().catch(console.error);
|
|
192
|
-
}
|
|
193
|
-
else if (args[0] === '--example' && args[1]) {
|
|
194
|
-
// Run specific example
|
|
195
|
-
quickRun(args[1]).catch(console.error);
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
console.log("\n🎯 Declarative Plugin System Examples");
|
|
199
|
-
console.log("Usage:");
|
|
200
|
-
console.log(" bun run examples/index-declarative.ts # Interactive menu");
|
|
201
|
-
console.log(" bun run examples/index-declarative.ts --all # Run all examples");
|
|
202
|
-
console.log(" bun run examples/index-declarative.ts --example <id> # Run specific example");
|
|
203
|
-
console.log("\nAvailable examples:", exampleCatalog.map(e => e.id).join(', '));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=index-declarative.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-declarative.js","sourceRoot":"","sources":["../../examples/index-declarative.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,kCAAkC;AAClC,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AAEpE,oCAAoC;AACpC,MAAM,cAAc,GAAG;IACrB;QACE,EAAE,EAAE,iBAAiB;QACrB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,kEAAkE;QAC/E,IAAI,EAAE,gCAAgC;QACtC,IAAI,EAAE,oCAAoC;QAC1C,QAAQ,EAAE;YACR,gCAAgC;YAChC,2BAA2B;YAC3B,6BAA6B;YAC7B,gBAAgB;YAChB,kBAAkB;SACnB;KACF;IACD;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,yDAAyD;QACtE,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,6BAA6B;QACnC,QAAQ,EAAE;YACR,gCAAgC;YAChC,iBAAiB;YACjB,0BAA0B;YAC1B,iBAAiB;YACjB,0BAA0B;SAC3B;KACF;IACD;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,4DAA4D;QACzE,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,6BAA6B;QACnC,QAAQ,EAAE;YACR,0BAA0B;YAC1B,sBAAsB;YACtB,oBAAoB;YACpB,wBA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CAAC,CAAC;IACxC,CAAC;SAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,WAAW,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,uBAAuB;QACvB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;QACnF,OAAO,CAAC,GAAG,CAAC,gFAAgF,CAAC,CAAC;QAC9F,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjF,CAAC;AACH,CAAC"}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative Logger Example
|
|
3
|
-
*
|
|
4
|
-
* This example demonstrates a clean, declarative approach to configuring
|
|
5
|
-
* and using different logging adapters.
|
|
6
|
-
*/
|
|
7
|
-
interface LoggerConfig {
|
|
8
|
-
type: 'console' | 'colorful' | 'pino' | 'noop';
|
|
9
|
-
context?: string;
|
|
10
|
-
level?: string;
|
|
11
|
-
format?: 'simple' | 'json' | 'colored';
|
|
12
|
-
useColors?: boolean;
|
|
13
|
-
timestampFormat?: 'none' | 'iso' | 'time';
|
|
14
|
-
showEmoji?: boolean;
|
|
15
|
-
levelColors?: Record<string, string>;
|
|
16
|
-
contextColor?: string;
|
|
17
|
-
}
|
|
18
|
-
declare const createLogger: (config: LoggerConfig) => import("bun_plugins").Logger;
|
|
19
|
-
declare const loggerScenarios: ({
|
|
20
|
-
name: string;
|
|
21
|
-
config: {
|
|
22
|
-
type: "console";
|
|
23
|
-
context: string;
|
|
24
|
-
timestampFormat?: undefined;
|
|
25
|
-
showEmoji?: undefined;
|
|
26
|
-
levelColors?: undefined;
|
|
27
|
-
contextColor?: undefined;
|
|
28
|
-
};
|
|
29
|
-
demo: (log: any) => void;
|
|
30
|
-
} | {
|
|
31
|
-
name: string;
|
|
32
|
-
config: {
|
|
33
|
-
type: "colorful";
|
|
34
|
-
context: string;
|
|
35
|
-
timestampFormat: "time";
|
|
36
|
-
showEmoji: boolean;
|
|
37
|
-
levelColors?: undefined;
|
|
38
|
-
contextColor?: undefined;
|
|
39
|
-
};
|
|
40
|
-
demo: (log: any) => void;
|
|
41
|
-
} | {
|
|
42
|
-
name: string;
|
|
43
|
-
config: {
|
|
44
|
-
type: "colorful";
|
|
45
|
-
levelColors: {
|
|
46
|
-
info: string;
|
|
47
|
-
warn: string;
|
|
48
|
-
error: string;
|
|
49
|
-
debug: string;
|
|
50
|
-
};
|
|
51
|
-
contextColor: string;
|
|
52
|
-
showEmoji: boolean;
|
|
53
|
-
context?: undefined;
|
|
54
|
-
timestampFormat?: undefined;
|
|
55
|
-
};
|
|
56
|
-
demo: (log: any) => void;
|
|
57
|
-
} | {
|
|
58
|
-
name: string;
|
|
59
|
-
config: {
|
|
60
|
-
type: "pino";
|
|
61
|
-
context?: undefined;
|
|
62
|
-
timestampFormat?: undefined;
|
|
63
|
-
showEmoji?: undefined;
|
|
64
|
-
levelColors?: undefined;
|
|
65
|
-
contextColor?: undefined;
|
|
66
|
-
};
|
|
67
|
-
demo: (log: any) => void;
|
|
68
|
-
} | {
|
|
69
|
-
name: string;
|
|
70
|
-
config: {
|
|
71
|
-
type: "noop";
|
|
72
|
-
context?: undefined;
|
|
73
|
-
timestampFormat?: undefined;
|
|
74
|
-
showEmoji?: undefined;
|
|
75
|
-
levelColors?: undefined;
|
|
76
|
-
contextColor?: undefined;
|
|
77
|
-
};
|
|
78
|
-
demo: (log: any) => void;
|
|
79
|
-
})[];
|
|
80
|
-
declare const pluginLoggerConfigs: {
|
|
81
|
-
'database-plugin': {
|
|
82
|
-
type: "colorful";
|
|
83
|
-
context: string;
|
|
84
|
-
timestampFormat: "time";
|
|
85
|
-
showEmoji: boolean;
|
|
86
|
-
levelColors: {
|
|
87
|
-
info: string;
|
|
88
|
-
warn: string;
|
|
89
|
-
error: string;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
'api-plugin': {
|
|
93
|
-
type: "colorful";
|
|
94
|
-
context: string;
|
|
95
|
-
showEmoji: boolean;
|
|
96
|
-
};
|
|
97
|
-
'cache-plugin': {
|
|
98
|
-
type: "noop";
|
|
99
|
-
};
|
|
100
|
-
'auth-plugin': {
|
|
101
|
-
type: "colorful";
|
|
102
|
-
context: string;
|
|
103
|
-
contextColor: string;
|
|
104
|
-
showEmoji: boolean;
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
declare const demonstrateDeclarativeLogging: () => Promise<void>;
|
|
108
|
-
export { createLogger, loggerScenarios, pluginLoggerConfigs, demonstrateDeclarativeLogging };
|
|
109
|
-
//# sourceMappingURL=logger-declarative.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger-declarative.d.ts","sourceRoot":"","sources":["../../examples/logger-declarative.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,UAAU,YAAY;IACpB,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,QAAA,MAAM,YAAY,GAAI,QAAQ,YAAY,iCAiDzC,CAAC;AAGF,QAAA,MAAM,eAAe;;;;;;;;;;gBAIL,GAAG;;;;;;;;;;;gBAcH,GAAG;;;;;;;;;;;;;;;;gBAoBH,GAAG;;;;;;;;;;;gBASH,GAAG;;;;;;;;;;;gBASH,GAAG;IAMlB,CAAC;AAGF,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBxB,CAAC;AA8KF,QAAA,MAAM,6BAA6B,qBAsClC,CAAC;AAGF,OAAO,EACL,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,6BAA6B,EAC9B,CAAC"}
|