@oktis-works/plugin-sdk 0.5.6 → 0.5.8
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/types.d.ts +42 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +34 -0
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
import type { PluginManifest as CanonicalPluginManifest, PluginDependency as CanonicalPluginDependency } from '@oktis-works/types';
|
|
2
|
+
/**
|
|
3
|
+
* Plugin lifecycle hook types.
|
|
4
|
+
* These map to internal action names fired by the core:
|
|
5
|
+
*
|
|
6
|
+
* | HookType | Internal Action | Description |
|
|
7
|
+
* |----------|----------------|-------------|
|
|
8
|
+
* | BEFORE_CONTENT_CREATE | okcms.content.before-create | Fired before content is created |
|
|
9
|
+
* | AFTER_CONTENT_CREATE | okcms.content.after-create | Fired after content is created |
|
|
10
|
+
* | BEFORE_CONTENT_UPDATE | okcms.content.before-update | Fired before content is updated |
|
|
11
|
+
* | AFTER_CONTENT_UPDATE | okcms.content.after-update | Fired after content is updated |
|
|
12
|
+
* | BEFORE_CONTENT_DELETE | okcms.content.before-delete | Fired before content is deleted |
|
|
13
|
+
* | AFTER_CONTENT_DELETE | okcms.content.after-delete | Fired after content is deleted |
|
|
14
|
+
* | ON_CONTENT_PUBLISH | okcms.content.published | Fired when content is published |
|
|
15
|
+
* | ON_CONTENT_UNPUBLISH | okcms.content.unpublished | Fired when content is unpublished |
|
|
16
|
+
* | ON_INSTALL | plugin.install | Fired when plugin is installed |
|
|
17
|
+
* | ON_ACTIVATE | plugin.activate | Fired when plugin is activated for a tenant |
|
|
18
|
+
* | ON_DEACTIVATE | plugin.deactivate | Fired when plugin is deactivated for a tenant |
|
|
19
|
+
* | ON_UNINSTALL | plugin.uninstall | Fired when plugin is uninstalled |
|
|
20
|
+
* | ON_SETTINGS_PAGE | plugin.settings_page | Fired when plugin settings page is rendered |
|
|
21
|
+
* | ON_ADMIN_MENU | okcms.admin.menu | Fired when admin menu is built |
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import { HookType, createPluginHooksApi } from '@oktis-works/plugin-sdk';
|
|
25
|
+
*
|
|
26
|
+
* const api = createPluginHooksApi('my-plugin', registry);
|
|
27
|
+
* api.addAction(HookType.ON_INSTALL, async (context, payload) => {
|
|
28
|
+
* // Handle plugin installation
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Or use registerHook on the full PluginAPI:
|
|
32
|
+
* api.registerHook('onInstall', async (context, payload) => {
|
|
33
|
+
* // Same as above
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
1
36
|
export declare enum HookType {
|
|
2
37
|
BEFORE_CONTENT_CREATE = "beforeContentCreate",
|
|
3
38
|
AFTER_CONTENT_CREATE = "afterContentCreate",
|
|
@@ -14,20 +49,15 @@ export declare enum HookType {
|
|
|
14
49
|
ON_SETTINGS_PAGE = "onSettingsPage",
|
|
15
50
|
ON_ADMIN_MENU = "onAdminMenu"
|
|
16
51
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Manifesto canônico (fonte única em `@oktis-works/types`) + o que o runtime
|
|
54
|
+
* exige: `main` obrigatório e o bloco opcional `hooks` (lifecycle declarado).
|
|
55
|
+
*/
|
|
56
|
+
export type PluginManifest = CanonicalPluginManifest & {
|
|
21
57
|
main: string;
|
|
22
58
|
hooks?: PluginHook[];
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
export interface PluginDependency {
|
|
27
|
-
name: string;
|
|
28
|
-
version: string;
|
|
29
|
-
required?: boolean;
|
|
30
|
-
}
|
|
59
|
+
};
|
|
60
|
+
export type PluginDependency = CanonicalPluginDependency;
|
|
31
61
|
export interface PluginHook {
|
|
32
62
|
type: HookType;
|
|
33
63
|
handler: PluginHookHandler;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,qBAAqB,wBAAwB;IAC7C,oBAAoB,uBAAuB;IAC3C,qBAAqB,wBAAwB;IAC7C,oBAAoB,uBAAuB;IAC3C,qBAAqB,wBAAwB;IAC7C,oBAAoB,uBAAuB;IAC3C,kBAAkB,qBAAqB;IACvC,oBAAoB,uBAAuB;IAC3C,UAAU,cAAc;IACxB,WAAW,eAAe;IAC1B,aAAa,iBAAiB;IAC9B,YAAY,gBAAgB;IAC5B,gBAAgB,mBAAmB;IACnC,aAAa,gBAAgB;CAC9B;AAED
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,IAAI,uBAAuB,EACzC,gBAAgB,IAAI,yBAAyB,EAC9C,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,oBAAY,QAAQ;IAClB,qBAAqB,wBAAwB;IAC7C,oBAAoB,uBAAuB;IAC3C,qBAAqB,wBAAwB;IAC7C,oBAAoB,uBAAuB;IAC3C,qBAAqB,wBAAwB;IAC7C,oBAAoB,uBAAuB;IAC3C,kBAAkB,qBAAqB;IACvC,oBAAoB,uBAAuB;IAC3C,UAAU,cAAc;IACxB,WAAW,eAAe;IAC1B,aAAa,iBAAiB;IAC9B,YAAY,gBAAgB;IAC5B,gBAAgB,mBAAmB;IACnC,aAAa,gBAAgB;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,uBAAuB,GAAG;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAEzD,MAAM,WAAW,U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O,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACzE;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/dist/types.js
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin lifecycle hook types.
|
|
3
|
+
* These map to internal action names fired by the core:
|
|
4
|
+
*
|
|
5
|
+
* | HookType | Internal Action | Description |
|
|
6
|
+
* |----------|----------------|-------------|
|
|
7
|
+
* | BEFORE_CONTENT_CREATE | okcms.content.before-create | Fired before content is created |
|
|
8
|
+
* | AFTER_CONTENT_CREATE | okcms.content.after-create | Fired after content is created |
|
|
9
|
+
* | BEFORE_CONTENT_UPDATE | okcms.content.before-update | Fired before content is updated |
|
|
10
|
+
* | AFTER_CONTENT_UPDATE | okcms.content.after-update | Fired after content is updated |
|
|
11
|
+
* | BEFORE_CONTENT_DELETE | okcms.content.before-delete | Fired before content is deleted |
|
|
12
|
+
* | AFTER_CONTENT_DELETE | okcms.content.after-delete | Fired after content is deleted |
|
|
13
|
+
* | ON_CONTENT_PUBLISH | okcms.content.published | Fired when content is published |
|
|
14
|
+
* | ON_CONTENT_UNPUBLISH | okcms.content.unpublished | Fired when content is unpublished |
|
|
15
|
+
* | ON_INSTALL | plugin.install | Fired when plugin is installed |
|
|
16
|
+
* | ON_ACTIVATE | plugin.activate | Fired when plugin is activated for a tenant |
|
|
17
|
+
* | ON_DEACTIVATE | plugin.deactivate | Fired when plugin is deactivated for a tenant |
|
|
18
|
+
* | ON_UNINSTALL | plugin.uninstall | Fired when plugin is uninstalled |
|
|
19
|
+
* | ON_SETTINGS_PAGE | plugin.settings_page | Fired when plugin settings page is rendered |
|
|
20
|
+
* | ON_ADMIN_MENU | okcms.admin.menu | Fired when admin menu is built |
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* import { HookType, createPluginHooksApi } from '@oktis-works/plugin-sdk';
|
|
24
|
+
*
|
|
25
|
+
* const api = createPluginHooksApi('my-plugin', registry);
|
|
26
|
+
* api.addAction(HookType.ON_INSTALL, async (context, payload) => {
|
|
27
|
+
* // Handle plugin installation
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Or use registerHook on the full PluginAPI:
|
|
31
|
+
* api.registerHook('onInstall', async (context, payload) => {
|
|
32
|
+
* // Same as above
|
|
33
|
+
* });
|
|
34
|
+
*/
|
|
1
35
|
export var HookType;
|
|
2
36
|
(function (HookType) {
|
|
3
37
|
HookType["BEFORE_CONTENT_CREATE"] = "beforeContentCreate";
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAN,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB,yDAA6C,CAAA;IAC7C,uDAA2C,CAAA;IAC3C,yDAA6C,CAAA;IAC7C,uDAA2C,CAAA;IAC3C,yDAA6C,CAAA;IAC7C,uDAA2C,CAAA;IAC3C,mDAAuC,CAAA;IACvC,uDAA2C,CAAA;IAC3C,oCAAwB,CAAA;IACxB,sCAA0B,CAAA;IAC1B,0CAA8B,CAAA;IAC9B,wCAA4B,CAAA;IAC5B,+CAAmC,CAAA;IACnC,yCAA6B,CAAA;AAC/B,CAAC,EAfW,QAAQ,KAAR,QAAQ,QAenB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oktis-works/plugin-sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@oktis-works/types": "^0.
|
|
19
|
+
"@oktis-works/types": "^0.7.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"typescript": "5.7.3",
|
|
23
|
-
"@oktis-works/plugin-runtime": "^0.5.
|
|
23
|
+
"@oktis-works/plugin-runtime": "^0.5.10"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"dist"
|