@pisell/pisellos 0.0.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 +180 -0
- package/dist/core/index.d.ts +30 -0
- package/dist/core/index.js +360 -0
- package/dist/effects/index.d.ts +17 -0
- package/dist/effects/index.js +162 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +17 -0
- package/dist/modules/Account/index.d.ts +21 -0
- package/dist/modules/Account/index.js +212 -0
- package/dist/modules/Account/types.d.ts +41 -0
- package/dist/modules/Account/types.js +19 -0
- package/dist/modules/BaseModule.d.ts +11 -0
- package/dist/modules/BaseModule.js +27 -0
- package/dist/modules/Cart/index.d.ts +33 -0
- package/dist/modules/Cart/index.js +242 -0
- package/dist/modules/Cart/types.d.ts +35 -0
- package/dist/modules/Cart/types.js +19 -0
- package/dist/modules/Date/index.d.ts +17 -0
- package/dist/modules/Date/index.js +133 -0
- package/dist/modules/Date/types.d.ts +32 -0
- package/dist/modules/Date/types.js +17 -0
- package/dist/modules/Guests/index.d.ts +17 -0
- package/dist/modules/Guests/index.js +259 -0
- package/dist/modules/Guests/types.d.ts +43 -0
- package/dist/modules/Guests/types.js +23 -0
- package/dist/modules/Order/index.d.ts +17 -0
- package/dist/modules/Order/index.js +228 -0
- package/dist/modules/Order/types.d.ts +57 -0
- package/dist/modules/Order/types.js +29 -0
- package/dist/modules/Payment/index.d.ts +18 -0
- package/dist/modules/Payment/index.js +243 -0
- package/dist/modules/Payment/types.d.ts +49 -0
- package/dist/modules/Payment/types.js +31 -0
- package/dist/modules/Product/index.d.ts +39 -0
- package/dist/modules/Product/index.js +118 -0
- package/dist/modules/Product/types.d.ts +387 -0
- package/dist/modules/Product/types.js +1 -0
- package/dist/modules/ProductList/index.d.ts +16 -0
- package/dist/modules/ProductList/index.js +158 -0
- package/dist/modules/ProductList/types.d.ts +9 -0
- package/dist/modules/ProductList/types.js +5 -0
- package/dist/modules/Resource/index.d.ts +15 -0
- package/dist/modules/Resource/index.js +219 -0
- package/dist/modules/Resource/types.d.ts +44 -0
- package/dist/modules/Resource/types.js +22 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +3 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/request.d.ts +127 -0
- package/dist/plugins/request.js +592 -0
- package/dist/plugins/window.d.ts +115 -0
- package/dist/plugins/window.js +328 -0
- package/dist/solution/BookingByStep/index.d.ts +12 -0
- package/dist/solution/BookingByStep/index.js +77 -0
- package/dist/solution/BookingByStep/types.d.ts +27 -0
- package/dist/solution/BookingByStep/types.js +10 -0
- package/dist/solution/BuyTickets/index.d.ts +26 -0
- package/dist/solution/BuyTickets/index.js +339 -0
- package/dist/solution/BuyTickets/types.d.ts +24 -0
- package/dist/solution/BuyTickets/types.js +19 -0
- package/dist/solution/PlaceOrder/index.d.ts +0 -0
- package/dist/solution/PlaceOrder/index.js +54 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +1 -0
- package/dist/store/createStore.d.ts +3 -0
- package/dist/store/createStore.js +43 -0
- package/dist/types/index.d.ts +85 -0
- package/dist/types/index.js +1 -0
- package/lib/core/index.d.ts +30 -0
- package/lib/core/index.js +212 -0
- package/lib/effects/index.d.ts +17 -0
- package/lib/effects/index.js +78 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +51 -0
- package/lib/modules/Account/index.d.ts +21 -0
- package/lib/modules/Account/index.js +93 -0
- package/lib/modules/Account/types.d.ts +41 -0
- package/lib/modules/Account/types.js +35 -0
- package/lib/modules/BaseModule.d.ts +11 -0
- package/lib/modules/BaseModule.js +40 -0
- package/lib/modules/Cart/index.d.ts +33 -0
- package/lib/modules/Cart/index.js +104 -0
- package/lib/modules/Cart/types.d.ts +35 -0
- package/lib/modules/Cart/types.js +35 -0
- package/lib/modules/Date/index.d.ts +17 -0
- package/lib/modules/Date/index.js +75 -0
- package/lib/modules/Date/types.d.ts +32 -0
- package/lib/modules/Date/types.js +33 -0
- package/lib/modules/Guests/index.d.ts +17 -0
- package/lib/modules/Guests/index.js +95 -0
- package/lib/modules/Guests/types.d.ts +43 -0
- package/lib/modules/Guests/types.js +35 -0
- package/lib/modules/Order/index.d.ts +17 -0
- package/lib/modules/Order/index.js +95 -0
- package/lib/modules/Order/types.d.ts +57 -0
- package/lib/modules/Order/types.js +35 -0
- package/lib/modules/Payment/index.d.ts +18 -0
- package/lib/modules/Payment/index.js +103 -0
- package/lib/modules/Payment/types.d.ts +49 -0
- package/lib/modules/Payment/types.js +35 -0
- package/lib/modules/Product/index.d.ts +39 -0
- package/lib/modules/Product/index.js +87 -0
- package/lib/modules/Product/types.d.ts +387 -0
- package/lib/modules/Product/types.js +17 -0
- package/lib/modules/ProductList/index.d.ts +16 -0
- package/lib/modules/ProductList/index.js +71 -0
- package/lib/modules/ProductList/types.d.ts +9 -0
- package/lib/modules/ProductList/types.js +33 -0
- package/lib/modules/Resource/index.d.ts +15 -0
- package/lib/modules/Resource/index.js +91 -0
- package/lib/modules/Resource/types.d.ts +44 -0
- package/lib/modules/Resource/types.js +34 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +27 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.js +25 -0
- package/lib/plugins/request.d.ts +127 -0
- package/lib/plugins/request.js +297 -0
- package/lib/plugins/window.d.ts +115 -0
- package/lib/plugins/window.js +252 -0
- package/lib/solution/BookingByStep/index.d.ts +12 -0
- package/lib/solution/BookingByStep/index.js +53 -0
- package/lib/solution/BookingByStep/types.d.ts +27 -0
- package/lib/solution/BookingByStep/types.js +38 -0
- package/lib/solution/BuyTickets/index.d.ts +26 -0
- package/lib/solution/BuyTickets/index.js +122 -0
- package/lib/solution/BuyTickets/types.d.ts +24 -0
- package/lib/solution/BuyTickets/types.js +40 -0
- package/lib/solution/PlaceOrder/index.d.ts +0 -0
- package/lib/solution/PlaceOrder/index.js +0 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +23 -0
- package/lib/store/createStore.d.ts +3 -0
- package/lib/store/createStore.js +46 -0
- package/lib/types/index.d.ts +85 -0
- package/lib/types/index.js +17 -0
- package/package.json +65 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pisell OS 核心类型定义
|
|
3
|
+
*/
|
|
4
|
+
export interface Plugin {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
initialize: () => Promise<void> | void;
|
|
8
|
+
destroy?: () => Promise<void> | void;
|
|
9
|
+
}
|
|
10
|
+
export interface PluginOptions {
|
|
11
|
+
dependencies?: string[];
|
|
12
|
+
}
|
|
13
|
+
export interface Module {
|
|
14
|
+
name: string;
|
|
15
|
+
version: string;
|
|
16
|
+
initialize: (core: PisellCore, options: ModuleOptions) => Promise<void> | void;
|
|
17
|
+
destroy?: () => Promise<void> | void;
|
|
18
|
+
exports?: Record<string, any>;
|
|
19
|
+
isSolution?: boolean;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
export interface ModuleOptions {
|
|
23
|
+
dependencies?: string[];
|
|
24
|
+
plugins?: string[];
|
|
25
|
+
hooks?: any;
|
|
26
|
+
store?: Record<string, any>;
|
|
27
|
+
initialState?: Record<string, any>;
|
|
28
|
+
otherParams?: Record<string, any>;
|
|
29
|
+
}
|
|
30
|
+
export type EventHandler = (data?: any) => void;
|
|
31
|
+
export interface PisellCore {
|
|
32
|
+
registerPlugin: (plugin: Plugin, options?: PluginOptions) => void;
|
|
33
|
+
getPlugin: <T extends Plugin>(name: string) => T | null;
|
|
34
|
+
hasPlugin: (name: string) => boolean;
|
|
35
|
+
registerModule: (module: Module, options?: ModuleOptions) => void;
|
|
36
|
+
getModule: <T extends Module>(name: string) => T | null;
|
|
37
|
+
getModuleExports: <T = any>(name: string) => T | null;
|
|
38
|
+
hasModule: (name: string) => boolean;
|
|
39
|
+
effects: {
|
|
40
|
+
on: (event: string, callback: (payload: any) => void) => void;
|
|
41
|
+
emit: (event: string, payload: any) => Promise<{
|
|
42
|
+
status: boolean;
|
|
43
|
+
data: any;
|
|
44
|
+
}>;
|
|
45
|
+
offByModuleDestroy: (module: string) => void;
|
|
46
|
+
};
|
|
47
|
+
context: BusinessContext;
|
|
48
|
+
validateContext: (config: ModuleContextConfig) => boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 业务上下文接口
|
|
52
|
+
*/
|
|
53
|
+
export interface BusinessContext {
|
|
54
|
+
userId?: string;
|
|
55
|
+
companyId?: string;
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 上下文验证规则
|
|
60
|
+
*/
|
|
61
|
+
export interface ContextValidationRule {
|
|
62
|
+
name: string;
|
|
63
|
+
required: boolean;
|
|
64
|
+
validate?: (value: any) => boolean;
|
|
65
|
+
message?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 模块上下文配置
|
|
69
|
+
*/
|
|
70
|
+
export interface ModuleContextConfig {
|
|
71
|
+
name: string;
|
|
72
|
+
validations: ContextValidationRule[];
|
|
73
|
+
}
|
|
74
|
+
export interface PisellOSOptions {
|
|
75
|
+
debug?: boolean;
|
|
76
|
+
plugins?: Array<{
|
|
77
|
+
plugin: Plugin;
|
|
78
|
+
options?: PluginOptions;
|
|
79
|
+
}>;
|
|
80
|
+
modules?: Array<{
|
|
81
|
+
module: Module;
|
|
82
|
+
options?: ModuleOptions;
|
|
83
|
+
}>;
|
|
84
|
+
context?: BusinessContext;
|
|
85
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/types/index.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": false,
|
|
3
|
+
"name": "@pisell/pisellos",
|
|
4
|
+
"version": "0.0.5",
|
|
5
|
+
"description": "一个可扩展的前端模块化SDK框架,支持插件系统",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"lib"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "father build",
|
|
15
|
+
"dev": "father dev",
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"lint": "eslint src --ext .ts",
|
|
18
|
+
"changeset": "changeset",
|
|
19
|
+
"version": "changeset version",
|
|
20
|
+
"release": "changeset publish --registry=https://registry.npmjs.com/ && npm run sync && git push",
|
|
21
|
+
"example": "npx ts-node examples/basic-usage.ts",
|
|
22
|
+
"docs": "typedoc --out docs src/index.ts",
|
|
23
|
+
"sync": "node sync.js",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/username/pisell-os.git"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"frontend",
|
|
32
|
+
"sdk",
|
|
33
|
+
"framework",
|
|
34
|
+
"modular",
|
|
35
|
+
"plugin-system"
|
|
36
|
+
],
|
|
37
|
+
"author": "Your Name",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/username/pisell-os/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/username/pisell-os#readme",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@changesets/cli": "^2.26.1"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/node": "^18.15.11",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
49
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
50
|
+
"eslint": "^8.37.0",
|
|
51
|
+
"ts-node": "^10.9.1",
|
|
52
|
+
"typedoc": "^0.28.2",
|
|
53
|
+
"typescript": "^5.0.3",
|
|
54
|
+
"vitest": "^3.1.1",
|
|
55
|
+
"father": "^4.1.0",
|
|
56
|
+
"axios": "1.7.2"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=18.0.0"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {}
|
|
65
|
+
}
|