@e7w/easy-routes 0.0.9 → 0.1.0

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.
@@ -7,7 +7,7 @@ interface RouterSchema {
7
7
  }
8
8
  export declare const RouterSchema: z.ZodType<RouterSchema, RouterSchema>;
9
9
  export declare const system: {
10
- router: RouterSchema;
10
+ router?: RouterSchema;
11
11
  init(req: Ctx["req"], meta: Meta): Promise<void>;
12
12
  hasPermission(permission?: number): boolean;
13
13
  getCtx(req: Ctx["req"], permission?: number): Ctx;
@@ -91,11 +91,7 @@ export var system = provide((function () {
91
91
  enumerable: true,
92
92
  configurable: true,
93
93
  writable: true,
94
- value: (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _router_initializers, {
95
- init: function () { },
96
- permission: 0,
97
- defaultTitle: document.title,
98
- }))
94
+ value: (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _router_initializers, void 0))
99
95
  });
100
96
  __runInitializers(this, _router_extraInitializers);
101
97
  }
@@ -105,11 +101,12 @@ export var system = provide((function () {
105
101
  writable: true,
106
102
  value: function (req, meta) {
107
103
  return __awaiter(this, void 0, void 0, function () {
108
- return __generator(this, function (_b) {
109
- switch (_b.label) {
110
- case 0: return [4 /*yield*/, this.router.init(req, meta)];
104
+ var _b;
105
+ return __generator(this, function (_c) {
106
+ switch (_c.label) {
107
+ case 0: return [4 /*yield*/, ((_b = this.router) === null || _b === void 0 ? void 0 : _b.init(req, meta))];
111
108
  case 1:
112
- _b.sent();
109
+ _c.sent();
113
110
  return [2 /*return*/];
114
111
  }
115
112
  });
@@ -121,8 +118,9 @@ export var system = provide((function () {
121
118
  configurable: true,
122
119
  writable: true,
123
120
  value: function (permission) {
121
+ var _b;
124
122
  if (permission === void 0) { permission = 0; }
125
- return (this.router.permission & permission) === permission;
123
+ return ((((_b = this.router) === null || _b === void 0 ? void 0 : _b.permission) || 0) & permission) === permission;
126
124
  }
127
125
  });
128
126
  Object.defineProperty(System.prototype, "getCtx", {
@@ -130,9 +128,10 @@ export var system = provide((function () {
130
128
  configurable: true,
131
129
  writable: true,
132
130
  value: function (req, permission) {
131
+ var _b, _c;
133
132
  if (permission === void 0) { permission = 1; }
134
133
  return {
135
- title: this.router.defaultTitle || document.title,
134
+ title: (_c = (_b = this.router) === null || _b === void 0 ? void 0 : _b.defaultTitle) !== null && _c !== void 0 ? _c : document.title,
136
135
  signed: (permission & 1) === 0 || this.hasPermission(1),
137
136
  noPermission: !this.hasPermission(permission),
138
137
  req: req,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e7w/easy-routes",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -10,10 +10,6 @@
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
12
  },
13
- "scripts": {
14
- "build": "tsc --build && copyfiles -u 1 src/**/*.css dist/",
15
- "lint": "eslint ."
16
- },
17
13
  "dependencies": {
18
14
  "@e7w/easy-model": "^0.2.1",
19
15
  "nprogress": "^0.2.0",
@@ -44,5 +40,9 @@
44
40
  "README.md",
45
41
  "LICENSE.md"
46
42
  ],
47
- "license": "MIT"
43
+ "license": "MIT",
44
+ "scripts": {
45
+ "build": "tsc --build && copyfiles -u 1 src/**/*.css dist/",
46
+ "lint": "eslint ."
47
+ }
48
48
  }