Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
koishi-plugin-alertmanager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
koishi-plugin-alertmanager
Commits
229a5ced
Commit
229a5ced
authored
Jul 25, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bump to Koishi 4.8
parent
39b2bbf2
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1071 additions
and
436 deletions
+1071
-436
dev/index.ts
dev/index.ts
+5
-5
package-lock.json
package-lock.json
+1043
-415
package.json
package.json
+7
-7
src/config.ts
src/config.ts
+2
-2
src/index.ts
src/index.ts
+3
-4
tests/sample.spec.ts
tests/sample.spec.ts
+3
-3
webpack.config.js
webpack.config.js
+8
-0
No files found.
dev/index.ts
View file @
229a5ced
import
{
App
}
from
'
koishi
'
;
import
{
Context
}
from
'
koishi
'
;
import
TargetPlugin
from
'
../src
'
;
import
TargetPlugin
from
'
../src
'
;
import
ConsolePlugin
from
'
@koishijs/plugin-console
'
;
import
ConsolePlugin
from
'
@koishijs/plugin-console
'
;
import
SandboxPlugin
from
'
@koishijs/plugin-sandbox
'
;
import
SandboxPlugin
from
'
@koishijs/plugin-sandbox
'
;
import
*
as
DatabasePlugin
from
'
@koishijs/plugin-database-memory
'
;
import
DatabasePlugin
from
'
@koishijs/plugin-database-memory
'
;
import
CachePlugin
from
'
@koishijs/plugin-cache-lru
'
;
//
import CachePlugin from '@koishijs/plugin-cache-lru';
import
ExtrasInDev
from
'
./extras
'
;
import
ExtrasInDev
from
'
./extras
'
;
const
app
=
new
App
({
const
app
=
new
Context
({
port
:
14514
,
port
:
14514
,
host
:
'
0.0.0.0
'
,
host
:
'
0.0.0.0
'
,
prefix
:
'
.
'
,
prefix
:
'
.
'
,
...
@@ -19,7 +19,7 @@ app.plugin(ConsolePlugin, {
...
@@ -19,7 +19,7 @@ app.plugin(ConsolePlugin, {
});
});
// Some services
// Some services
app
.
plugin
(
CachePlugin
);
//
app.plugin(CachePlugin);
app
.
plugin
(
DatabasePlugin
);
app
.
plugin
(
DatabasePlugin
);
// Some extras
// Some extras
...
...
package-lock.json
View file @
229a5ced
This diff is collapsed.
Click to expand it.
package.json
View file @
229a5ced
...
@@ -44,23 +44,23 @@
...
@@ -44,23 +44,23 @@
"testEnvironment"
:
"node"
"testEnvironment"
:
"node"
},
},
"dependencies"
:
{
"dependencies"
:
{
"
koishi-target-def
"
:
"
^
1.1.1
"
,
"
koishi-target-def
"
:
"
^
2.0.0
"
,
"
koishi-thirdeye
"
:
"
^1
0.3.2
"
,
"
koishi-thirdeye
"
:
"
^1
1.0.6
"
,
"
lodash
"
:
"
^4.17.21
"
"
lodash
"
:
"
^4.17.21
"
},
},
"peerDependencies"
:
{
"peerDependencies"
:
{
"koishi"
:
"^4.
7.5
"
"koishi"
:
"^4.
8.2
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@koishijs/plugin-cache-lru
"
:
"
^1.0.0-rc.0
"
,
"
@koishijs/plugin-console
"
:
"
^4.1.1
"
,
"
@koishijs/plugin-console
"
:
"
^3.3.2
"
,
"
@koishijs/plugin-database-memory
"
:
"
^1.4.1
"
,
"
@koishijs/plugin-database-memory
"
:
"
^1.3.0
"
,
"
@koishijs/plugin-sandbox
"
:
"
^2.0.1
"
,
"
@koishijs/plugin-sandbox
"
:
"
^1.1.3
"
,
"
@types/jest
"
:
"
^27.4.1
"
,
"
@types/jest
"
:
"
^27.4.1
"
,
"
@types/lodash
"
:
"
^4.14.180
"
,
"
@types/lodash
"
:
"
^4.14.180
"
,
"
@types/node
"
:
"
^17.0.21
"
,
"
@types/node
"
:
"
^17.0.21
"
,
"
@typescript-eslint/eslint-plugin
"
:
"
^4.33.0
"
,
"
@typescript-eslint/eslint-plugin
"
:
"
^4.33.0
"
,
"
@typescript-eslint/parser
"
:
"
^4.33.0
"
,
"
@typescript-eslint/parser
"
:
"
^4.33.0
"
,
"
esbuild-loader
"
:
"
^2.19.0
"
,
"
eslint
"
:
"
^7.32.0
"
,
"
eslint
"
:
"
^7.32.0
"
,
"
eslint-config-prettier
"
:
"
^8.5.0
"
,
"
eslint-config-prettier
"
:
"
^8.5.0
"
,
"
eslint-plugin-prettier
"
:
"
^3.4.1
"
,
"
eslint-plugin-prettier
"
:
"
^3.4.1
"
,
...
...
src/config.ts
View file @
229a5ced
// import 'source-map-support/register';
// import 'source-map-support/register';
import
{
RegisterSchema
,
SchemaProperty
}
from
'
koishi-thirdeye
'
;
import
{
RegisterSchema
,
SchemaProperty
}
from
'
koishi-thirdeye
'
;
import
{
Adapter
,
segment
}
from
'
koishi
'
;
import
{
Bot
,
segment
}
from
'
koishi
'
;
import
_
from
'
lodash
'
;
import
_
from
'
lodash
'
;
import
{
AlertDto
}
from
'
./def
'
;
import
{
AlertDto
}
from
'
./def
'
;
import
{
SendTarget
}
from
'
koishi-target-def
'
;
import
{
SendTarget
}
from
'
koishi-target-def
'
;
...
@@ -61,7 +61,7 @@ export class InstanceConfig {
...
@@ -61,7 +61,7 @@ export class InstanceConfig {
})
})
targets
:
SendTarget
[];
targets
:
SendTarget
[];
async
send
(
bots
:
Adapter
.
BotList
,
content
:
string
)
{
async
send
(
bots
:
Bot
[]
,
content
:
string
)
{
return
_
.
flatten
(
return
_
.
flatten
(
await
Promise
.
all
(
await
Promise
.
all
(
this
.
targets
.
map
((
target
)
=>
target
.
send
(
bots
,
content
)),
this
.
targets
.
map
((
target
)
=>
target
.
send
(
bots
,
content
)),
...
...
src/index.ts
View file @
229a5ced
...
@@ -10,7 +10,7 @@ import {
...
@@ -10,7 +10,7 @@ import {
Post
,
Post
,
KoaContext
,
KoaContext
,
}
from
'
koishi-thirdeye
'
;
}
from
'
koishi-thirdeye
'
;
import
{
Adapter
,
Logger
,
Router
}
from
'
koishi
'
;
import
{
Bot
,
Logger
,
Router
}
from
'
koishi
'
;
import
_
from
'
lodash
'
;
import
_
from
'
lodash
'
;
import
{
AlertDto
}
from
'
./def
'
;
import
{
AlertDto
}
from
'
./def
'
;
export
*
from
'
./config
'
;
export
*
from
'
./config
'
;
...
@@ -18,7 +18,7 @@ export * from './config';
...
@@ -18,7 +18,7 @@ export * from './config';
@
DefinePlugin
()
@
DefinePlugin
()
export
class
Instance
extends
StarterPlugin
(
InstanceConfig
)
{
export
class
Instance
extends
StarterPlugin
(
InstanceConfig
)
{
@
Inject
()
@
Inject
()
private
bots
:
Adapter
.
BotList
;
private
bots
:
Bot
[]
;
private
async
send
(
content
:
string
)
{
private
async
send
(
content
:
string
)
{
return
_
.
flatten
(
return
_
.
flatten
(
...
@@ -41,10 +41,9 @@ export class Instance extends StarterPlugin(InstanceConfig) {
...
@@ -41,10 +41,9 @@ export class Instance extends StarterPlugin(InstanceConfig) {
@
DefinePlugin
()
@
DefinePlugin
()
export
default
class
AlertmanagerPlugin
export
default
class
AlertmanagerPlugin
extends
MultiInstancePlugin
(
Instance
,
AlertmanagerPluginConfig
)
extends
MultiInstancePlugin
(
Instance
,
AlertmanagerPluginConfig
)
implements
LifecycleEvents
{
{
@
Inject
(
true
)
@
Inject
(
true
)
private
bots
:
Adapter
.
BotList
;
private
bots
:
Bot
[]
;
@
Inject
(
true
)
@
Inject
(
true
)
private
router
:
Router
;
private
router
:
Router
;
...
...
tests/sample.spec.ts
View file @
229a5ced
import
{
App
}
from
'
koishi
'
;
import
{
Context
}
from
'
koishi
'
;
import
TargetPlugin
from
'
../src
'
;
import
TargetPlugin
from
'
../src
'
;
describe
(
'
Test of plugin.
'
,
()
=>
{
describe
(
'
Test of plugin.
'
,
()
=>
{
let
app
:
App
;
let
app
:
Context
;
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
app
=
new
App
();
app
=
new
Context
();
// app.plugin(TargetPlugin);
// app.plugin(TargetPlugin);
await
app
.
start
();
await
app
.
start
();
});
});
...
...
webpack.config.js
View file @
229a5ced
const
path
=
require
(
'
path
'
);
const
path
=
require
(
'
path
'
);
const
packgeInfo
=
require
(
'
./package.json
'
);
const
packgeInfo
=
require
(
'
./package.json
'
);
const
{
ESBuildMinifyPlugin
}
=
require
(
'
esbuild-loader
'
);
function
externalsFromDep
()
{
function
externalsFromDep
()
{
return
Object
.
fromEntries
(
return
Object
.
fromEntries
(
...
@@ -43,4 +44,11 @@ module.exports = {
...
@@ -43,4 +44,11 @@ module.exports = {
koishi
:
'
koishi
'
,
koishi
:
'
koishi
'
,
...(
packAll
?
{}
:
externalsFromDep
()),
...(
packAll
?
{}
:
externalsFromDep
()),
},
},
optimization
:
{
minimizer
:
[
new
ESBuildMinifyPlugin
({
keepNames
:
true
,
}),
],
},
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment