miqro 6.3.0 → 7.0.2
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 +9 -17
- package/build/editor.bundle.js +11601 -10129
- package/build/esm/editor/common/log-socket.js +1 -0
- package/build/esm/editor/common/templates.js +90 -90
- package/build/esm/editor/components/api-preview.js +2 -0
- package/build/esm/editor/components/editor.js +2 -0
- package/build/esm/editor/components/file-browser.js +1 -0
- package/build/esm/editor/components/file-editor-toolbar.js +2 -0
- package/build/esm/editor/components/file-editor.js +2 -0
- package/build/esm/editor/components/filter-query.js +1 -0
- package/build/esm/editor/components/highlight-text-area.js +2 -0
- package/build/esm/editor/components/log-viewer.js +2 -0
- package/build/esm/editor/components/new-file.js +2 -0
- package/build/esm/editor/components/scroll-query.js +1 -0
- package/build/esm/editor/components/start-page.js +2 -0
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/write.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/server/restart.api.js +2 -1
- package/build/esm/editor/http/admin/editor/editor.js +2 -1
- package/build/esm/editor/http/admin/editor/index.api.js +1 -0
- package/build/esm/src/bin/types.js +10 -5
- package/build/esm/src/cluster.js +1 -1
- package/build/esm/src/common/arguments.d.ts +1 -1
- package/build/esm/src/common/arguments.js +28 -14
- package/build/esm/src/common/assets.d.ts +1 -1
- package/build/esm/src/common/assets.js +34 -13
- package/build/esm/src/common/esbuild.d.ts +4 -1
- package/build/esm/src/common/esbuild.js +31 -26
- package/build/esm/src/common/exit.js +4 -4
- package/build/esm/src/common/help.d.ts +1 -1
- package/build/esm/src/common/help.js +0 -1
- package/build/esm/src/common/jsx.d.ts +2 -3
- package/build/esm/src/common/jsx.js +70 -75
- package/build/esm/src/common/paths.d.ts +0 -1
- package/build/esm/src/common/paths.js +3 -3
- package/build/esm/src/common/watch.d.ts +0 -1
- package/build/esm/src/common/watch.js +1 -1
- package/build/esm/src/inflate/inflate-sea.js +35 -24
- package/build/esm/src/inflate/inflate.js +4 -4
- package/build/esm/src/inflate/setup-auth.js +1 -1
- package/build/esm/src/inflate/setup-cors.js +1 -1
- package/build/esm/src/inflate/setup-db.js +2 -2
- package/build/esm/src/inflate/setup-error.js +1 -1
- package/build/esm/src/inflate/setup-http.js +16 -16
- package/build/esm/src/inflate/setup-log.js +1 -1
- package/build/esm/src/inflate/setup-middleware.js +1 -1
- package/build/esm/src/inflate/setup-server-config.js +1 -1
- package/build/esm/src/inflate/setup-ws.js +1 -1
- package/build/esm/src/inflate/setup.doc.d.ts +2 -2
- package/build/esm/src/inflate/setup.doc.js +23 -2
- package/build/esm/src/inflate/utils/sea-utils.js +2 -2
- package/build/esm/src/lib.d.ts +10 -1
- package/build/esm/src/lib.js +16 -1
- package/build/esm/src/main.js +1 -1
- package/build/esm/src/services/app.js +3 -4
- package/build/esm/src/services/migrations.js +2 -2
- package/build/esm/src/services/utils/jwt.d.ts +2 -0
- package/build/esm/src/services/utils/jwt.js +23 -0
- package/build/esm/src/services/utils/middleware.d.ts +9 -0
- package/build/esm/src/services/utils/middleware.js +9 -0
- package/build/esm/src/services/utils/server-interface.js +33 -4
- package/build/esm/src/types.d.ts +50 -83
- package/build/lib.cjs +15684 -15612
- package/editor/common/log-socket.tsx +2 -0
- package/editor/common/templates.ts +12 -12
- package/editor/components/api-preview.tsx +2 -0
- package/editor/components/editor.tsx +2 -0
- package/editor/components/file-browser.tsx +3 -0
- package/editor/components/file-editor-toolbar.tsx +3 -0
- package/editor/components/file-editor.tsx +3 -0
- package/editor/components/filter-query.tsx +4 -0
- package/editor/components/highlight-text-area.tsx +3 -0
- package/editor/components/log-viewer.tsx +3 -0
- package/editor/components/new-file.tsx +3 -0
- package/editor/components/scroll-query.tsx +3 -0
- package/editor/components/start-page.tsx +3 -0
- package/editor/http/admin/editor/api/fs/delete.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/read.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/rename.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/scan.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/write.api.tsx +2 -2
- package/editor/http/admin/editor/api/server/restart.api.tsx +2 -2
- package/editor/http/admin/editor/editor.tsx +3 -1
- package/editor/http/admin/editor/index.api.tsx +3 -0
- package/package.json +6 -8
- package/sea/basic-compile.base64.sh +1 -1
- package/sea/basic-compile.sh +1 -1
- package/sea/install-nodejs.sh +1 -1
- package/sea/node.version.tag +1 -1
- package/src/bin/types.ts +7 -2
- package/src/cluster.ts +1 -1
- package/src/common/arguments.ts +27 -10
- package/src/common/assets.ts +32 -12
- package/src/common/esbuild.ts +11 -3
- package/src/common/exit.ts +3 -3
- package/src/common/help.ts +0 -1
- package/src/common/jsx.ts +50 -35
- package/src/common/paths.ts +2 -2
- package/src/common/watch.ts +1 -1
- package/src/inflate/inflate-sea.ts +35 -24
- package/src/inflate/inflate.ts +4 -4
- package/src/inflate/setup-auth.ts +1 -1
- package/src/inflate/setup-cors.ts +1 -1
- package/src/inflate/setup-db.ts +2 -2
- package/src/inflate/setup-error.ts +1 -1
- package/src/inflate/setup-http.ts +16 -16
- package/src/inflate/setup-log.ts +1 -1
- package/src/inflate/setup-middleware.ts +1 -1
- package/src/inflate/setup-server-config.ts +1 -1
- package/src/inflate/setup-ws.ts +1 -1
- package/src/inflate/setup.doc.ts +27 -3
- package/src/inflate/utils/sea-utils.ts +2 -2
- package/src/lib.ts +17 -2
- package/src/main.ts +1 -1
- package/src/services/app.ts +4 -4
- package/src/services/migrations.ts +2 -2
- package/src/services/utils/jwt.ts +25 -0
- package/src/services/utils/middleware.ts +10 -0
- package/src/services/utils/server-interface.ts +37 -7
- package/src/types.ts +56 -53
- package/.eslintrc +0 -15
- package/build/esm/src/services/globals.d.ts +0 -3
- package/build/esm/src/services/globals.js +0 -182
- package/build/jsx.dom.js +0 -1587
- package/build/postject.base64.cjs +0 -1
- package/sea/types.json +0 -1
- package/src/types/@esbuild.d.ts +0 -1
- package/src/types/@miqro/core.d.ts +0 -2
- package/src/types/@miqro/jsx.d.ts +0 -2
- package/src/types/@miqro/parser.d.ts +0 -2
- package/src/types/@miqro/query.d.ts +0 -2
- package/src/types/@miqro/request.d.ts +0 -2
- package/src/types/@miqro/test.d.ts +0 -2
- package/src/types/@miqro.d.ts +0 -1
- package/src/types/@types.d.ts +0 -1
- package/src/types/browser.globals.d.ts +0 -1
- package/src/types/cookie.d.ts +0 -2
- package/src/types/globals.d.ts +0 -2
- package/src/types/jose.d.ts +0 -2
- package/src/types/jsx.globals.d.ts +0 -38
- package/src/types/miqro.d.ts +0 -228
- package/src/types/postject.d.ts +0 -1
- package/src/types/server.globals.d.ts +0 -47
- package/tsconfig.json +0 -35
- /package/src/services/{globals.ts → globals.ts.ignore} +0 -0
package/build/esm/src/types.d.ts
CHANGED
|
@@ -3,8 +3,6 @@ import { WebSocketServerOptions, SessionHandlerOptions, Logger, WebSocketServer,
|
|
|
3
3
|
import { request } from "@miqro/request";
|
|
4
4
|
import { Parser, ParserInterface } from "@miqro/parser";
|
|
5
5
|
import { RuntimeHTMLElement, Runtime, RuntimeContainer, RuntimeURL, RuntimeOptions, RuntimeShadowRootInit } from "@miqro/jsx";
|
|
6
|
-
import { RuntimeElementDefinitionOptions, Component, createElement, Fragment, enableDebugLog } from "@miqro/jsx";
|
|
7
|
-
import * as jsxLib from "@miqro/jsx";
|
|
8
6
|
import { EncryptOptions, JWTDecryptOptions, JWTDecryptResult, JWTPayload, JWTVerifyOptions, JWTVerifyResult, ProtectedHeaderParameters, SignOptions } from "jose";
|
|
9
7
|
import { KeyObject } from "node:crypto";
|
|
10
8
|
export interface EncryptJWTOptions {
|
|
@@ -24,32 +22,57 @@ export interface JWTSignOptions {
|
|
|
24
22
|
exp?: number | string | Date;
|
|
25
23
|
options?: SignOptions;
|
|
26
24
|
}
|
|
27
|
-
declare global {
|
|
28
|
-
var JSX: {
|
|
29
|
-
createElement: typeof createElement;
|
|
30
|
-
Fragment: typeof Fragment;
|
|
31
|
-
enableDebugLog: typeof enableDebugLog;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
declare global {
|
|
35
|
-
var jsx: {
|
|
36
|
-
define: (tagName: string, component: Component, options?: RuntimeElementDefinitionOptions) => void;
|
|
37
|
-
useRuntime: typeof jsxLib.useRuntime;
|
|
38
|
-
usePathname: typeof jsxLib.usePathname;
|
|
39
|
-
Link: typeof jsxLib.Link;
|
|
40
|
-
Router: typeof jsxLib.Router;
|
|
41
|
-
createContext: typeof jsxLib.createContext;
|
|
42
|
-
useContext: typeof jsxLib.useContext;
|
|
43
|
-
useState: typeof jsxLib.useState;
|
|
44
|
-
useEffect: typeof jsxLib.useEffect;
|
|
45
|
-
useQuery: typeof jsxLib.useQuery;
|
|
46
|
-
useRef: typeof jsxLib.useRef;
|
|
47
|
-
useElement: typeof jsxLib.useElement;
|
|
48
|
-
useRefresh: typeof jsxLib.useRefresh;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
25
|
export { APIRoute } from "@miqro/core";
|
|
52
26
|
export { Migration } from "@miqro/query";
|
|
27
|
+
export interface JWTInterface {
|
|
28
|
+
createSecretKey: (key: string, encoding: BufferEncoding) => KeyObject;
|
|
29
|
+
/**
|
|
30
|
+
* creates a JWT encrypted token with jose
|
|
31
|
+
*
|
|
32
|
+
* @param payload the payload to encrypt
|
|
33
|
+
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
34
|
+
* @param options options like expiratation date, issuer and audience
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
encrypt: (payload: JWTPayload, secret: KeyObject, options?: Partial<EncryptJWTOptions>) => Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* decrypts a JWT token with jose
|
|
40
|
+
* @param jwt the JWT token
|
|
41
|
+
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
42
|
+
* @param options options like issuer and audience
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
decrypt: <PayloadType = JWTPayload>(jwt: string, secret: KeyObject, options?: Partial<JWTDecryptOptions>) => Promise<JWTDecryptResult<PayloadType>>;
|
|
46
|
+
/**
|
|
47
|
+
* verify a JWT token with jose
|
|
48
|
+
* @param jwt the JWT token
|
|
49
|
+
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
50
|
+
* @param options options like issuer and audience
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
verify: <PayloadType = JWTPayload>(jwt: string, secret: KeyObject, options?: Partial<JWTVerifyOptions>) => Promise<JWTVerifyResult<PayloadType>>;
|
|
54
|
+
/**
|
|
55
|
+
* creates a signed JWT with jose
|
|
56
|
+
*
|
|
57
|
+
* @param payload the payload to encrypt
|
|
58
|
+
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
59
|
+
* @param options options like expiratation date, issuer and audience
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
sign: (payload: JWTPayload, secret: KeyObject, options?: Partial<JWTSignOptions>) => Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* decodes a protected header with jose
|
|
65
|
+
* @param token
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
decodeProtectedHeader: (token: string | object) => ProtectedHeaderParameters;
|
|
69
|
+
/**
|
|
70
|
+
* decodes a jwt token
|
|
71
|
+
* @param jwt
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
decode: <PayloadType = JWTPayload>(jwt: string) => PayloadType & JWTPayload;
|
|
75
|
+
}
|
|
53
76
|
export interface ServerGlobal {
|
|
54
77
|
encodeHTML: (str: string) => string;
|
|
55
78
|
inflateMDtoHTML: (str: string) => string;
|
|
@@ -64,58 +87,10 @@ export interface ServerGlobal {
|
|
|
64
87
|
newParser(): Parser;
|
|
65
88
|
newClusterCache: (name: string, logger?: Logger) => CacheInterface;
|
|
66
89
|
newLocalCache: (name: string, logger?: Logger) => CacheInterface;
|
|
67
|
-
createSecretKey: (key: string, encoding: BufferEncoding) => KeyObject;
|
|
68
90
|
getWorkerCount: () => number;
|
|
69
91
|
getWorkerNumber: () => number;
|
|
70
92
|
isPrimaryWorker: () => boolean;
|
|
71
|
-
jwt:
|
|
72
|
-
/**
|
|
73
|
-
* creates a JWT encrypted token with jose
|
|
74
|
-
*
|
|
75
|
-
* @param payload the payload to encrypt
|
|
76
|
-
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
77
|
-
* @param options options like expiratation date, issuer and audience
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
encrypt: (payload: JWTPayload, secret: KeyObject, options?: Partial<EncryptJWTOptions>) => Promise<string>;
|
|
81
|
-
/**
|
|
82
|
-
* decrypts a JWT token with jose
|
|
83
|
-
* @param jwt the JWT token
|
|
84
|
-
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
85
|
-
* @param options options like issuer and audience
|
|
86
|
-
* @returns
|
|
87
|
-
*/
|
|
88
|
-
decrypt: <PayloadType = JWTPayload>(jwt: string, secret: KeyObject, options?: Partial<JWTDecryptOptions>) => Promise<JWTDecryptResult<PayloadType>>;
|
|
89
|
-
/**
|
|
90
|
-
* verify a JWT token with jose
|
|
91
|
-
* @param jwt the JWT token
|
|
92
|
-
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
93
|
-
* @param options options like issuer and audience
|
|
94
|
-
* @returns
|
|
95
|
-
*/
|
|
96
|
-
verify: <PayloadType = JWTPayload>(jwt: string, secret: KeyObject, options?: Partial<JWTVerifyOptions>) => Promise<JWTVerifyResult<PayloadType>>;
|
|
97
|
-
/**
|
|
98
|
-
* creates a signed JWT with jose
|
|
99
|
-
*
|
|
100
|
-
* @param payload the payload to encrypt
|
|
101
|
-
* @param secret the secret example. const secret = createSecretKey(process.env.JWT_SECRET, 'utf-8');
|
|
102
|
-
* @param options options like expiratation date, issuer and audience
|
|
103
|
-
* @returns
|
|
104
|
-
*/
|
|
105
|
-
sign: (payload: JWTPayload, secret: KeyObject, options?: Partial<JWTSignOptions>) => Promise<string>;
|
|
106
|
-
/**
|
|
107
|
-
* decodes a protected header with jose
|
|
108
|
-
* @param token
|
|
109
|
-
* @returns
|
|
110
|
-
*/
|
|
111
|
-
decodeProtectedHeader: (token: string | object) => ProtectedHeaderParameters;
|
|
112
|
-
/**
|
|
113
|
-
* decodes a jwt token
|
|
114
|
-
* @param jwt
|
|
115
|
-
* @returns
|
|
116
|
-
*/
|
|
117
|
-
decode: <PayloadType = JWTPayload>(jwt: string) => PayloadType & JWTPayload;
|
|
118
|
-
};
|
|
93
|
+
jwt: JWTInterface;
|
|
119
94
|
}
|
|
120
95
|
export interface CacheInterface {
|
|
121
96
|
get<T = any>(key: string): T | undefined;
|
|
@@ -210,14 +185,6 @@ export interface TestHelperGlobal {
|
|
|
210
185
|
}) => () => Promise<void>;
|
|
211
186
|
};
|
|
212
187
|
}
|
|
213
|
-
declare global {
|
|
214
|
-
var server: ServerGlobal;
|
|
215
|
-
var test: TestHelperGlobal;
|
|
216
|
-
var it: Function;
|
|
217
|
-
var describe: Function;
|
|
218
|
-
var before: Function;
|
|
219
|
-
var after: Function;
|
|
220
|
-
}
|
|
221
188
|
export interface AuthConfig extends SessionHandlerOptions {
|
|
222
189
|
}
|
|
223
190
|
export interface MiddlewareConfig {
|