node-karin 0.8.10 → 0.8.12
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/lib/adapter/index.d.ts +0 -2
- package/lib/adapter/index.js +0 -2
- package/lib/core/server.d.ts +1 -1
- package/lib/core/server.js +0 -3
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/utils/common.d.ts +1 -1
- package/lib/utils/common.js +5 -1
- package/lib/utils/config.js +3 -1
- package/lib/utils/init.js +1 -3
- package/package.json +7 -6
- package/lib/adapter/kritor/grpc.d.ts +0 -33
- package/lib/adapter/kritor/grpc.js +0 -997
- package/lib/adapter/kritor/index.d.ts +0 -411
- package/lib/adapter/kritor/index.js +0 -1188
- package/lib/modules/grpc-js.d.ts +0 -2
- package/lib/modules/grpc-js.js +0 -2
- package/lib/modules/kritor-proto.d.ts +0 -2
- package/lib/modules/kritor-proto.js +0 -2
- package/lib/modules/proto-loader.d.ts +0 -2
- package/lib/modules/proto-loader.js +0 -2
- package/modules.d.ts +0 -15
- package/modules.js +0 -15
package/lib/adapter/index.d.ts
CHANGED
package/lib/adapter/index.js
CHANGED
package/lib/core/server.d.ts
CHANGED
package/lib/core/server.js
CHANGED
|
@@ -4,7 +4,6 @@ import { WebSocketServer } from 'ws'
|
|
|
4
4
|
import { createServer } from 'http'
|
|
5
5
|
import { listener } from './listener.js'
|
|
6
6
|
import express from 'express'
|
|
7
|
-
import { KritorGrpc } from '../adapter/index.js'
|
|
8
7
|
import { exec, config, logger, common } from '../utils/index.js'
|
|
9
8
|
import { AdapterOneBot11 } from '../adapter/onebot/11/index.js'
|
|
10
9
|
import { render, HttpRenderer, Wormhole, RenderClient } from '../render/index.js'
|
|
@@ -31,8 +30,6 @@ export const server = new (class Server {
|
|
|
31
30
|
try {
|
|
32
31
|
/** 防止多进程端口冲突 启动失败 */
|
|
33
32
|
await Process.check()
|
|
34
|
-
/** 初始化gRPC服务器 */
|
|
35
|
-
new KritorGrpc().init()
|
|
36
33
|
this.WebSocketServer.on('connection', (socket, request) => {
|
|
37
34
|
const path = request.url
|
|
38
35
|
const headers = request.headers
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
package/lib/utils/common.d.ts
CHANGED
package/lib/utils/common.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import Yaml from 'yaml'
|
|
4
|
+
import axios from 'axios'
|
|
5
|
+
import lodash from 'lodash'
|
|
1
6
|
import { promisify } from 'util'
|
|
2
7
|
import { fileURLToPath } from 'url'
|
|
3
8
|
import { pipeline, Readable } from 'stream'
|
|
4
9
|
import { logger, segment, YamlEditor } from '../utils/index.js'
|
|
5
|
-
import { fs, path, axios, lodash, yaml as Yaml } from '../modules.js'
|
|
6
10
|
/**
|
|
7
11
|
* 常用方法
|
|
8
12
|
*/
|
package/lib/utils/config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import Yaml from 'yaml'
|
|
1
3
|
import path from 'path'
|
|
4
|
+
import chokidar from 'chokidar'
|
|
2
5
|
import { karinDir } from '../core/dir.js'
|
|
3
|
-
import { fs, yaml as Yaml, chokidar } from '../modules.js'
|
|
4
6
|
import { common } from './common.js'
|
|
5
7
|
/**
|
|
6
8
|
* 配置文件
|
package/lib/utils/init.js
CHANGED
|
@@ -9,9 +9,7 @@ export class KarinInit {
|
|
|
9
9
|
baseDir
|
|
10
10
|
constructor () {
|
|
11
11
|
this.baseDir = [
|
|
12
|
-
'./lib',
|
|
13
12
|
'./config/config',
|
|
14
|
-
'./config/defSet',
|
|
15
13
|
'./config/view',
|
|
16
14
|
'./config/plugin',
|
|
17
15
|
'./temp/input',
|
|
@@ -60,7 +58,7 @@ export class KarinInit {
|
|
|
60
58
|
*/
|
|
61
59
|
copyFile () {
|
|
62
60
|
/** 配置 */
|
|
63
|
-
const list = ['config/
|
|
61
|
+
const list = ['config/view']
|
|
64
62
|
list.forEach(dir => {
|
|
65
63
|
const pkgDir = path.join(karinDir, dir)
|
|
66
64
|
const projDir = path.join(process.cwd(), dir)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-karin",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "基于 Kritor 进行开发的nodejs机器人框架",
|
|
6
6
|
"homepage": "https://github.com/KarinJS/Karin",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"require": "./lib/index.js",
|
|
21
21
|
"types": "./lib/index.d.ts"
|
|
22
22
|
},
|
|
23
|
+
"./modules.js": {
|
|
24
|
+
"import": "./lib/modules.js",
|
|
25
|
+
"require": "./lib/modules.js",
|
|
26
|
+
"types": "./lib/modules.d.ts"
|
|
27
|
+
},
|
|
23
28
|
"./art-template": {
|
|
24
29
|
"import": "./lib/modules/art-template.js",
|
|
25
30
|
"require": "./lib/modules/art-template.js",
|
|
@@ -127,23 +132,19 @@
|
|
|
127
132
|
"plugins/**"
|
|
128
133
|
],
|
|
129
134
|
"scripts": {
|
|
130
|
-
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json && npm run
|
|
131
|
-
"cp": "cp ./lib/modules.d.ts ./modules.d.ts && cp ./lib/modules.js ./modules.js",
|
|
135
|
+
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json && npm run fix",
|
|
132
136
|
"fix": "eslint lib/**/*.js --fix",
|
|
133
137
|
"fix:all": "eslint lib/**/*.js --fix && eslint lib/**/*.d.ts --fix",
|
|
134
138
|
"pub": "npm publish --access public",
|
|
135
139
|
"sort": "npx sort-package-json && sort-json tsconfig.json"
|
|
136
140
|
},
|
|
137
141
|
"dependencies": {
|
|
138
|
-
"@grpc/grpc-js": "1.11.1",
|
|
139
|
-
"@grpc/proto-loader": "0.7.13",
|
|
140
142
|
"art-template": "4.13.2",
|
|
141
143
|
"axios": "1.7.2",
|
|
142
144
|
"chalk": "5.3.0",
|
|
143
145
|
"chokidar": "3.6.0",
|
|
144
146
|
"commander": "^12.1.0",
|
|
145
147
|
"express": "4.19.2",
|
|
146
|
-
"kritor-proto": "^1.0.2",
|
|
147
148
|
"level": "8.0.1",
|
|
148
149
|
"lodash": "4.17.21",
|
|
149
150
|
"log4js": "6.9.1",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { KarinElement } from '../../types/index.js';
|
|
2
|
-
import { kritor } from 'kritor-proto';
|
|
3
|
-
import { Role, Scene } from '../../types/index.js';
|
|
4
|
-
export declare class KritorGrpc {
|
|
5
|
-
#private;
|
|
6
|
-
/**
|
|
7
|
-
* - proto 文件路径
|
|
8
|
-
*/
|
|
9
|
-
dir: string;
|
|
10
|
-
BotMap: Map<string, any>;
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* 获取 proto 文件
|
|
14
|
-
* @param filename 文件名
|
|
15
|
-
*/
|
|
16
|
-
getProto(filename: string): any;
|
|
17
|
-
/**
|
|
18
|
-
* 初始化 gRPC 服务器
|
|
19
|
-
*/
|
|
20
|
-
init(): void;
|
|
21
|
-
/**
|
|
22
|
-
* scene contact转换器
|
|
23
|
-
*/
|
|
24
|
-
KarinSceneContact(contact: kritor.common.IContact, sender: kritor.common.ISender): {
|
|
25
|
-
scene: Scene;
|
|
26
|
-
role: Role;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* kritor 转 karin
|
|
30
|
-
* @param data 消息数据
|
|
31
|
-
*/
|
|
32
|
-
AdapterConvertKarin(data: Array<kritor.common.Element>): Array<KarinElement>;
|
|
33
|
-
}
|