Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
satori-decorators
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
satori-decorators
Commits
a64ea7b0
Commit
a64ea7b0
authored
Jan 01, 2023
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nothing large changes
parent
c4724ab2
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
423 additions
and
195 deletions
+423
-195
package-lock.json
package-lock.json
+410
-182
package.json
package.json
+1
-1
src/registrar.ts
src/registrar.ts
+2
-2
tests/map-plugin.spec.ts
tests/map-plugin.spec.ts
+4
-4
tests/multi-instance.spec.ts
tests/multi-instance.spec.ts
+3
-3
tests/scope.spec.ts
tests/scope.spec.ts
+3
-3
No files found.
package-lock.json
View file @
a64ea7b0
This diff is collapsed.
Click to expand it.
package.json
View file @
a64ea7b0
...
...
@@ -62,6 +62,6 @@
"
lodash
"
:
"
^4.17.21
"
},
"peerDependencies"
:
{
"koishi"
:
"^4.
9.7
"
"koishi"
:
"^4.
11.0
"
}
}
src/registrar.ts
View file @
a64ea7b0
import
{
Context
}
from
'
koishi
'
;
import
{
App
,
Context
}
from
'
koishi
'
;
import
{
Registrar
}
from
'
cordis-decorators
'
;
import
WebSocket
from
'
ws
'
;
...
...
@@ -89,4 +89,4 @@ export class SatoriRegistrar<Ctx extends Context> extends Registrar<Ctx> {
}
}
export
const
defaultRegistrarS
=
new
SatoriRegistrar
(
Context
);
export
const
defaultRegistrarS
=
new
SatoriRegistrar
(
App
);
tests/map-plugin.spec.ts
View file @
a64ea7b0
import
{
Context
}
from
'
koishi
'
;
import
{
App
}
from
'
koishi
'
;
import
{
MapPlugin
,
MergePlugin
}
from
'
../src/plugin-operators
'
;
import
{
SchemaProperty
}
from
'
cordis-decorators
'
;
import
{
DefinePlugin
,
StarterPlugin
,
UseEvent
}
from
'
./utility/decorators
'
;
...
...
@@ -66,7 +66,7 @@ class MergedWearingPlugin extends MergePlugin(
describe
(
'
register map plugin instance
'
,
()
=>
{
it
(
'
should work on each level
'
,
async
()
=>
{
const
app
=
new
Context
();
const
app
=
new
App
();
app
.
plugin
(
WearingPlugin
,
{
dress
:
{
color
:
'
red
'
},
skirt
:
{
size
:
'
XL
'
},
...
...
@@ -78,7 +78,7 @@ describe('register map plugin instance', () => {
expect
(
app
.
bail
(
'
wearingStrip
'
)).
toBe
(
'
pink
'
);
});
it
(
'
should partial register
'
,
async
()
=>
{
const
app
=
new
Context
();
const
app
=
new
App
();
app
.
plugin
(
WearingPlugin
,
{
dress
:
{
color
:
'
red
'
},
strip
:
'
pink
'
,
...
...
@@ -89,7 +89,7 @@ describe('register map plugin instance', () => {
expect
(
app
.
bail
(
'
skirtSize
'
)).
toBe
(
'
S
'
);
});
it
(
'
should work on merge plugin
'
,
async
()
=>
{
const
app
=
new
Context
();
const
app
=
new
App
();
app
.
plugin
(
MergedWearingPlugin
,
{
color
:
'
red
'
,
size
:
'
XL
'
,
...
...
tests/multi-instance.spec.ts
View file @
a64ea7b0
import
{
RegisterSchema
,
SchemaProperty
}
from
'
cordis-decorators
'
;
import
{
DefinePlugin
,
StarterPlugin
,
UseEvent
}
from
'
./utility/decorators
'
;
import
{
MultiInstancePlugin
}
from
'
../src/plugin-operators
'
;
import
{
Context
,
Schema
}
from
'
koishi
'
;
import
{
App
,
Schema
}
from
'
koishi
'
;
declare
module
'
cordis
'
{
interface
Events
<
C
>
{
...
...
@@ -70,7 +70,7 @@ class Outer2 extends MultiInstancePlugin(Inner2, OuterMessageConfig) {
describe
(
'
register multi plugin instance
'
,
()
=>
{
it
(
'
should work on schemastery-gen
'
,
async
()
=>
{
const
app
=
new
Context
();
const
app
=
new
App
();
app
.
plugin
(
Outer
,
{
msg
:
'
hello
'
,
instances
:
[{
msg
:
'
world
'
}]
});
await
app
.
start
();
expect
(
app
.
bail
(
'
message1
'
)).
toBe
(
'
world
'
);
...
...
@@ -79,7 +79,7 @@ describe('register multi plugin instance', () => {
});
it
(
'
should work on common schemastery
'
,
async
()
=>
{
const
app
=
new
Context
();
const
app
=
new
App
();
app
.
plugin
(
Outer2
,
{
msg
:
'
hello
'
,
instances
:
[{
msg
:
'
world
'
}]
});
await
app
.
start
();
expect
(
app
.
bail
(
'
message1
'
)).
toBe
(
'
world
'
);
...
...
tests/scope.spec.ts
View file @
a64ea7b0
import
{
OnGuild
,
OnPlatform
}
from
'
../src/decorators
'
;
import
{
Context
,
Session
}
from
'
koishi
'
;
import
{
App
,
Session
}
from
'
koishi
'
;
import
{
defaultRegistrarS
}
from
'
../src/registrar
'
;
@
OnPlatform
(
'
discord
'
)
...
...
@@ -9,10 +9,10 @@ class MyClass {
}
describe
(
'
Scope
'
,
()
=>
{
let
app
:
Context
;
let
app
:
App
;
beforeEach
(
async
()
=>
{
app
=
new
Context
();
app
=
new
App
();
await
app
.
start
();
});
...
...
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