@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.
Files changed (138) hide show
  1. package/README.md +180 -0
  2. package/dist/core/index.d.ts +30 -0
  3. package/dist/core/index.js +360 -0
  4. package/dist/effects/index.d.ts +17 -0
  5. package/dist/effects/index.js +162 -0
  6. package/dist/index.d.ts +11 -0
  7. package/dist/index.js +17 -0
  8. package/dist/modules/Account/index.d.ts +21 -0
  9. package/dist/modules/Account/index.js +212 -0
  10. package/dist/modules/Account/types.d.ts +41 -0
  11. package/dist/modules/Account/types.js +19 -0
  12. package/dist/modules/BaseModule.d.ts +11 -0
  13. package/dist/modules/BaseModule.js +27 -0
  14. package/dist/modules/Cart/index.d.ts +33 -0
  15. package/dist/modules/Cart/index.js +242 -0
  16. package/dist/modules/Cart/types.d.ts +35 -0
  17. package/dist/modules/Cart/types.js +19 -0
  18. package/dist/modules/Date/index.d.ts +17 -0
  19. package/dist/modules/Date/index.js +133 -0
  20. package/dist/modules/Date/types.d.ts +32 -0
  21. package/dist/modules/Date/types.js +17 -0
  22. package/dist/modules/Guests/index.d.ts +17 -0
  23. package/dist/modules/Guests/index.js +259 -0
  24. package/dist/modules/Guests/types.d.ts +43 -0
  25. package/dist/modules/Guests/types.js +23 -0
  26. package/dist/modules/Order/index.d.ts +17 -0
  27. package/dist/modules/Order/index.js +228 -0
  28. package/dist/modules/Order/types.d.ts +57 -0
  29. package/dist/modules/Order/types.js +29 -0
  30. package/dist/modules/Payment/index.d.ts +18 -0
  31. package/dist/modules/Payment/index.js +243 -0
  32. package/dist/modules/Payment/types.d.ts +49 -0
  33. package/dist/modules/Payment/types.js +31 -0
  34. package/dist/modules/Product/index.d.ts +39 -0
  35. package/dist/modules/Product/index.js +118 -0
  36. package/dist/modules/Product/types.d.ts +387 -0
  37. package/dist/modules/Product/types.js +1 -0
  38. package/dist/modules/ProductList/index.d.ts +16 -0
  39. package/dist/modules/ProductList/index.js +158 -0
  40. package/dist/modules/ProductList/types.d.ts +9 -0
  41. package/dist/modules/ProductList/types.js +5 -0
  42. package/dist/modules/Resource/index.d.ts +15 -0
  43. package/dist/modules/Resource/index.js +219 -0
  44. package/dist/modules/Resource/types.d.ts +44 -0
  45. package/dist/modules/Resource/types.js +22 -0
  46. package/dist/modules/index.d.ts +3 -0
  47. package/dist/modules/index.js +3 -0
  48. package/dist/plugins/index.d.ts +2 -0
  49. package/dist/plugins/index.js +2 -0
  50. package/dist/plugins/request.d.ts +127 -0
  51. package/dist/plugins/request.js +592 -0
  52. package/dist/plugins/window.d.ts +115 -0
  53. package/dist/plugins/window.js +328 -0
  54. package/dist/solution/BookingByStep/index.d.ts +12 -0
  55. package/dist/solution/BookingByStep/index.js +77 -0
  56. package/dist/solution/BookingByStep/types.d.ts +27 -0
  57. package/dist/solution/BookingByStep/types.js +10 -0
  58. package/dist/solution/BuyTickets/index.d.ts +26 -0
  59. package/dist/solution/BuyTickets/index.js +339 -0
  60. package/dist/solution/BuyTickets/types.d.ts +24 -0
  61. package/dist/solution/BuyTickets/types.js +19 -0
  62. package/dist/solution/PlaceOrder/index.d.ts +0 -0
  63. package/dist/solution/PlaceOrder/index.js +54 -0
  64. package/dist/solution/index.d.ts +1 -0
  65. package/dist/solution/index.js +1 -0
  66. package/dist/store/createStore.d.ts +3 -0
  67. package/dist/store/createStore.js +43 -0
  68. package/dist/types/index.d.ts +85 -0
  69. package/dist/types/index.js +1 -0
  70. package/lib/core/index.d.ts +30 -0
  71. package/lib/core/index.js +212 -0
  72. package/lib/effects/index.d.ts +17 -0
  73. package/lib/effects/index.js +78 -0
  74. package/lib/index.d.ts +11 -0
  75. package/lib/index.js +51 -0
  76. package/lib/modules/Account/index.d.ts +21 -0
  77. package/lib/modules/Account/index.js +93 -0
  78. package/lib/modules/Account/types.d.ts +41 -0
  79. package/lib/modules/Account/types.js +35 -0
  80. package/lib/modules/BaseModule.d.ts +11 -0
  81. package/lib/modules/BaseModule.js +40 -0
  82. package/lib/modules/Cart/index.d.ts +33 -0
  83. package/lib/modules/Cart/index.js +104 -0
  84. package/lib/modules/Cart/types.d.ts +35 -0
  85. package/lib/modules/Cart/types.js +35 -0
  86. package/lib/modules/Date/index.d.ts +17 -0
  87. package/lib/modules/Date/index.js +75 -0
  88. package/lib/modules/Date/types.d.ts +32 -0
  89. package/lib/modules/Date/types.js +33 -0
  90. package/lib/modules/Guests/index.d.ts +17 -0
  91. package/lib/modules/Guests/index.js +95 -0
  92. package/lib/modules/Guests/types.d.ts +43 -0
  93. package/lib/modules/Guests/types.js +35 -0
  94. package/lib/modules/Order/index.d.ts +17 -0
  95. package/lib/modules/Order/index.js +95 -0
  96. package/lib/modules/Order/types.d.ts +57 -0
  97. package/lib/modules/Order/types.js +35 -0
  98. package/lib/modules/Payment/index.d.ts +18 -0
  99. package/lib/modules/Payment/index.js +103 -0
  100. package/lib/modules/Payment/types.d.ts +49 -0
  101. package/lib/modules/Payment/types.js +35 -0
  102. package/lib/modules/Product/index.d.ts +39 -0
  103. package/lib/modules/Product/index.js +87 -0
  104. package/lib/modules/Product/types.d.ts +387 -0
  105. package/lib/modules/Product/types.js +17 -0
  106. package/lib/modules/ProductList/index.d.ts +16 -0
  107. package/lib/modules/ProductList/index.js +71 -0
  108. package/lib/modules/ProductList/types.d.ts +9 -0
  109. package/lib/modules/ProductList/types.js +33 -0
  110. package/lib/modules/Resource/index.d.ts +15 -0
  111. package/lib/modules/Resource/index.js +91 -0
  112. package/lib/modules/Resource/types.d.ts +44 -0
  113. package/lib/modules/Resource/types.js +34 -0
  114. package/lib/modules/index.d.ts +3 -0
  115. package/lib/modules/index.js +27 -0
  116. package/lib/plugins/index.d.ts +2 -0
  117. package/lib/plugins/index.js +25 -0
  118. package/lib/plugins/request.d.ts +127 -0
  119. package/lib/plugins/request.js +297 -0
  120. package/lib/plugins/window.d.ts +115 -0
  121. package/lib/plugins/window.js +252 -0
  122. package/lib/solution/BookingByStep/index.d.ts +12 -0
  123. package/lib/solution/BookingByStep/index.js +53 -0
  124. package/lib/solution/BookingByStep/types.d.ts +27 -0
  125. package/lib/solution/BookingByStep/types.js +38 -0
  126. package/lib/solution/BuyTickets/index.d.ts +26 -0
  127. package/lib/solution/BuyTickets/index.js +122 -0
  128. package/lib/solution/BuyTickets/types.d.ts +24 -0
  129. package/lib/solution/BuyTickets/types.js +40 -0
  130. package/lib/solution/PlaceOrder/index.d.ts +0 -0
  131. package/lib/solution/PlaceOrder/index.js +0 -0
  132. package/lib/solution/index.d.ts +1 -0
  133. package/lib/solution/index.js +23 -0
  134. package/lib/store/createStore.d.ts +3 -0
  135. package/lib/store/createStore.js +46 -0
  136. package/lib/types/index.d.ts +85 -0
  137. package/lib/types/index.js +17 -0
  138. 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
+ }