Commit 455de00f authored by nanahira's avatar nanahira

move to plugin factory

parent 22c9700c
import { Schema } from 'koishi';
import { Awaitable, Context } from 'koishi';
import { DefinePlugin, RegisterSchema, SchemaProperty } from 'koishi-thirdeye';
import {
DefineMultiSourcePlugin,
PicResult,
PicSourceConfig,
PicSourcePlugin,
} from '../src';
DefinePlugin,
MultiInstancePlugin,
RegisterSchema,
SchemaProperty,
} from 'koishi-thirdeye';
import { PicResult, PicSourceConfig, PicSourcePlugin } from '../src';
@RegisterSchema()
class Config extends PicSourceConfig {
@SchemaProperty({ default: 'zh-CN' })
name: string;
@SchemaProperty({ default: 'https://cdn02.moecube.com:444' })
endpoint: string;
}
@DefinePlugin({ name: 'test-source', schema: Config })
class TestPicSourcePlugin extends PicSourcePlugin<Config> {
@DefinePlugin()
class TestPicSourcePlugin extends PicSourcePlugin(Config) {
randomPic(picTags: string[]): Awaitable<PicResult> {
return {
url: `${this.config.endpoint}/images/ygopro-images-${this.name}/${
......@@ -26,23 +28,23 @@ class TestPicSourcePlugin extends PicSourcePlugin<Config> {
}
}
export class TestMultiPicSourcePlugin extends DefineMultiSourcePlugin(
@DefinePlugin()
export class TestMultiPicSourcePlugin extends MultiInstancePlugin(
TestPicSourcePlugin,
Config,
) {}
console.log((TestMultiPicSourcePlugin['Config'] as Schema).dict.instances.type);
export default class ExtrasInDev {
constructor(ctx: Context) {
ctx.plugin(TestMultiPicSourcePlugin, {
instances: [
{
name: 'zh-CN',
// name: 'zh-CN',
isDefault: true,
endpoint: 'https://cdn02.moecube.com:444',
},
{ name: 'en-US' },
{
name: 'en-US',
},
],
});
}
......
......@@ -9,7 +9,7 @@
"version": "9.0.3",
"license": "MIT",
"dependencies": {
"koishi-thirdeye": "^10.0.5",
"koishi-thirdeye": "^10.0.20",
"lodash": "^4.17.21"
},
"devDependencies": {
......@@ -31,13 +31,13 @@
"ts-jest": "^27.1.3",
"ts-loader": "^9.2.6",
"ts-node": "^10.5.0",
"typescript": "^4.4.4",
"typescript": "^4.6.4",
"webpack": "^5.59.1",
"webpack-cli": "^4.9.1",
"ws": "^8.3.0"
},
"peerDependencies": {
"koishi": "^4.6.1"
"koishi": "^4.6.2"
}
},
"node_modules/@ampproject/remapping": {
......@@ -1070,13 +1070,13 @@
}
},
"node_modules/@koishijs/core": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.6.1.tgz",
"integrity": "sha512-2HzdUi76YSLFZYpPXcmEwwVyHQLPF8BL0GJR6PuCYdOYfHykzwA5NmqOGx29EyeuYzs8sS6yr25IQktxMYqsdg==",
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.6.2.tgz",
"integrity": "sha512-GM0497Bd5BDPXuzJMppJik+Zb55bbLTX14aJmkFgPW9maU9oz3ZZRW+EeMpFK449fPG83P2UsIulJHNbD5L/hQ==",
"peer": true,
"dependencies": {
"@koishijs/utils": "^5.4.1",
"cosmotype": "^1.0.6",
"@koishijs/utils": "^5.4.2",
"cosmotype": "^1.0.9",
"fastest-levenshtein": "^1.0.12",
"ns-require": "^1.1.2"
},
......@@ -1139,9 +1139,9 @@
"peer": true
},
"node_modules/@koishijs/utils": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.1.tgz",
"integrity": "sha512-M3L9KqtdTyCzQK1LxTtp7QCucc75IA2vRwnYJA1gXMAxPC3SoEjUVmsk/oNFBSknmfADdViI5mFJtUXMCpJW1g==",
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.2.tgz",
"integrity": "sha512-cUwrqVQqTM/F2DZO9APEDlfz2mrUe5L7b2pYmhaTi8Pggk9kT78hvBx4fnLWrHiFV3BPuikghqZSfkladFcugw==",
"peer": true,
"dependencies": {
"@koishijs/segment": "^1.1.1",
......@@ -5220,14 +5220,14 @@
}
},
"node_modules/koishi": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.6.1.tgz",
"integrity": "sha512-9NtcXrIKLN8AG9zEf3GzweSiHQubew0AWfjaci0grIxy760T77D8iLVsDbVhzmGSnc26WOR2q3CMFdRmE2igVA==",
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.6.2.tgz",
"integrity": "sha512-vgjKxSJxAOsFwBnO097d8Oo8AC0jTvdfrsAHgu8u1d3DDJkHzUr8vQEjcJjvAp411Ev5VIvswFeSpeTVWDv6VA==",
"peer": true,
"dependencies": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.6.1",
"@koishijs/utils": "^5.4.1",
"@koishijs/core": "^4.6.2",
"@koishijs/utils": "^5.4.2",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
......@@ -5245,9 +5245,9 @@
}
},
"node_modules/koishi-decorators": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.0.0.tgz",
"integrity": "sha512-YAbjOLdBxJU0DnBM7vqH+UNfSqMrejlcTEc+m++ZvuMbkUA4tHZ5iciwJFV2iPZUKSZy7GbmImNbXDmmjowF5w==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.0.1.tgz",
"integrity": "sha512-dDrBS4Su1NtmrkIeCdcCKsC6uaBYTRTspDdeeoPLOMuSJf6fqqXwxa2qEosvG5475MXs9SaNQDaKjh0gq/NY6A==",
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
......@@ -5260,21 +5260,21 @@
}
},
"node_modules/koishi-thirdeye": {
"version": "10.0.5",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-10.0.5.tgz",
"integrity": "sha512-GzPNyJCnUNklHefi0vc0nArV+dEh1QuTddom9MQ6Sawa6nbjbnZNWKFY08eQxNR6CR87tYK93WtO+URwcBbEew==",
"version": "10.0.20",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-10.0.20.tgz",
"integrity": "sha512-aYBiQ6R4A8VcZ7xw0qfECIJvWsuEoW3MWdBH+SuWi0dcrwhvfF3naEtkC0ZGEnWOkauyW1YyOzTK/Fieikmv4w==",
"dependencies": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"cosmotype-decorators": "^2.0.5",
"koishi-decorators": "^2.0.0",
"koishi-decorators": "^2.0.1",
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
"schemastery-gen": "^3.1.4",
"schemastery-gen": "^3.1.10",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"koishi": "^4.6.0",
"koishi": "^4.6.2",
"schemastery": "^3.1.0"
}
},
......@@ -6444,16 +6444,16 @@
}
},
"node_modules/schemastery-gen": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.4.tgz",
"integrity": "sha512-zhM5A2p/SdPKe8ouObCYSOA3k5I1CpbOfSvv8DWp7kCbVnSgfOMSBCB4Yue3/D81+MAE2re93nSt7k/Tolz3mQ==",
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.10.tgz",
"integrity": "sha512-hwCLOICGEodCcQt+eLoEEvNhm7iSEwJB37JQ+27cHbggTry/Rq07ivXVsPw63Et74EobEaOGDVOTzJ4kIQa01w==",
"dependencies": {
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
"typed-reflector": "^1.0.10"
},
"peerDependencies": {
"schemastery": "^3.3.2"
"schemastery": "^3.3.3"
}
},
"node_modules/semver": {
......@@ -7243,9 +7243,9 @@
}
},
"node_modules/typescript": {
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz",
"integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==",
"version": "4.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
"integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
......@@ -8558,13 +8558,13 @@
}
},
"@koishijs/core": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.6.1.tgz",
"integrity": "sha512-2HzdUi76YSLFZYpPXcmEwwVyHQLPF8BL0GJR6PuCYdOYfHykzwA5NmqOGx29EyeuYzs8sS6yr25IQktxMYqsdg==",
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/@koishijs/core/-/core-4.6.2.tgz",
"integrity": "sha512-GM0497Bd5BDPXuzJMppJik+Zb55bbLTX14aJmkFgPW9maU9oz3ZZRW+EeMpFK449fPG83P2UsIulJHNbD5L/hQ==",
"peer": true,
"requires": {
"@koishijs/utils": "^5.4.1",
"cosmotype": "^1.0.6",
"@koishijs/utils": "^5.4.2",
"cosmotype": "^1.0.9",
"fastest-levenshtein": "^1.0.12",
"ns-require": "^1.1.2"
}
......@@ -8612,9 +8612,9 @@
"peer": true
},
"@koishijs/utils": {
"version": "5.4.1",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.1.tgz",
"integrity": "sha512-M3L9KqtdTyCzQK1LxTtp7QCucc75IA2vRwnYJA1gXMAxPC3SoEjUVmsk/oNFBSknmfADdViI5mFJtUXMCpJW1g==",
"version": "5.4.2",
"resolved": "https://registry.npmjs.org/@koishijs/utils/-/utils-5.4.2.tgz",
"integrity": "sha512-cUwrqVQqTM/F2DZO9APEDlfz2mrUe5L7b2pYmhaTi8Pggk9kT78hvBx4fnLWrHiFV3BPuikghqZSfkladFcugw==",
"peer": true,
"requires": {
"@koishijs/segment": "^1.1.1",
......@@ -11783,14 +11783,14 @@
}
},
"koishi": {
"version": "4.6.1",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.6.1.tgz",
"integrity": "sha512-9NtcXrIKLN8AG9zEf3GzweSiHQubew0AWfjaci0grIxy760T77D8iLVsDbVhzmGSnc26WOR2q3CMFdRmE2igVA==",
"version": "4.6.2",
"resolved": "https://registry.npmjs.org/koishi/-/koishi-4.6.2.tgz",
"integrity": "sha512-vgjKxSJxAOsFwBnO097d8Oo8AC0jTvdfrsAHgu8u1d3DDJkHzUr8vQEjcJjvAp411Ev5VIvswFeSpeTVWDv6VA==",
"peer": true,
"requires": {
"@koa/router": "^10.1.1",
"@koishijs/core": "^4.6.1",
"@koishijs/utils": "^5.4.1",
"@koishijs/core": "^4.6.2",
"@koishijs/utils": "^5.4.2",
"@types/koa": "*",
"@types/koa__router": "*",
"@types/ws": "^8.5.3",
......@@ -11805,9 +11805,9 @@
}
},
"koishi-decorators": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.0.0.tgz",
"integrity": "sha512-YAbjOLdBxJU0DnBM7vqH+UNfSqMrejlcTEc+m++ZvuMbkUA4tHZ5iciwJFV2iPZUKSZy7GbmImNbXDmmjowF5w==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/koishi-decorators/-/koishi-decorators-2.0.1.tgz",
"integrity": "sha512-dDrBS4Su1NtmrkIeCdcCKsC6uaBYTRTspDdeeoPLOMuSJf6fqqXwxa2qEosvG5475MXs9SaNQDaKjh0gq/NY6A==",
"requires": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
......@@ -11817,17 +11817,17 @@
}
},
"koishi-thirdeye": {
"version": "10.0.5",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-10.0.5.tgz",
"integrity": "sha512-GzPNyJCnUNklHefi0vc0nArV+dEh1QuTddom9MQ6Sawa6nbjbnZNWKFY08eQxNR6CR87tYK93WtO+URwcBbEew==",
"version": "10.0.20",
"resolved": "https://registry.npmjs.org/koishi-thirdeye/-/koishi-thirdeye-10.0.20.tgz",
"integrity": "sha512-aYBiQ6R4A8VcZ7xw0qfECIJvWsuEoW3MWdBH+SuWi0dcrwhvfF3naEtkC0ZGEnWOkauyW1YyOzTK/Fieikmv4w==",
"requires": {
"@types/koa": "^2.13.4",
"@types/koa__router": "^8.0.11",
"cosmotype-decorators": "^2.0.5",
"koishi-decorators": "^2.0.0",
"koishi-decorators": "^2.0.1",
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
"schemastery-gen": "^3.1.4",
"schemastery-gen": "^3.1.10",
"typed-reflector": "^1.0.10"
}
},
......@@ -12699,9 +12699,9 @@
}
},
"schemastery-gen": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.4.tgz",
"integrity": "sha512-zhM5A2p/SdPKe8ouObCYSOA3k5I1CpbOfSvv8DWp7kCbVnSgfOMSBCB4Yue3/D81+MAE2re93nSt7k/Tolz3mQ==",
"version": "3.1.10",
"resolved": "https://registry.npmjs.org/schemastery-gen/-/schemastery-gen-3.1.10.tgz",
"integrity": "sha512-hwCLOICGEodCcQt+eLoEEvNhm7iSEwJB37JQ+27cHbggTry/Rq07ivXVsPw63Et74EobEaOGDVOTzJ4kIQa01w==",
"requires": {
"lodash": "^4.17.21",
"reflect-metadata": "^0.1.13",
......@@ -13261,9 +13261,9 @@
}
},
"typescript": {
"version": "4.4.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz",
"integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==",
"version": "4.6.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
"integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==",
"dev": true
},
"universalify": {
......
......@@ -29,7 +29,7 @@
},
"homepage": "https://github.com/koishijs/koishi-plugin-pics",
"dependencies": {
"koishi-thirdeye": "^10.0.5",
"koishi-thirdeye": "^10.0.20",
"lodash": "^4.17.21"
},
"devDependencies": {
......@@ -51,13 +51,13 @@
"ts-jest": "^27.1.3",
"ts-loader": "^9.2.6",
"ts-node": "^10.5.0",
"typescript": "^4.4.4",
"typescript": "^4.6.4",
"webpack": "^5.59.1",
"webpack-cli": "^4.9.1",
"ws": "^8.3.0"
},
"peerDependencies": {
"koishi": "^4.6.1"
"koishi": "^4.6.2"
},
"jest": {
"moduleFileExtensions": [
......
......@@ -27,13 +27,11 @@ export type PicsPluginConfigLike = Partial<PicsPluginConfig>;
// For convenience of plugins
export class PicSourceConfig implements PicSourceInfo {
constructor(config: Partial<PicSourceInfo>) {}
@SchemaProperty({ type: 'string', default: [], description: '图源标签' })
tags: string[];
@SchemaProperty({ default: 1, description: '图源权重' })
weight: number;
@SchemaProperty({ default: 1, description: '图源名称', required: true })
@SchemaProperty({ description: '图源名称', required: true })
name: string;
@SchemaProperty({ description: '图源描述' })
description?: string;
......
import { Awaitable } from 'koishi';
import { ClassType, SchemaClass, SchemaProperty } from 'koishi-thirdeye';
import { Context } from 'vm';
export interface PicSourceInfo {
tags?: string[];
......@@ -25,49 +23,3 @@ export interface PicMiddlewareInfo {
name?: string;
prepend?: boolean;
}
export interface Instances<T> {
instances: T[];
}
export function ToInstancesConfig<T>(
instanceConfig: ClassType<T>,
): new () => Instances<T> {
const instanceConfigClass = class InstancesConfig {
instances: T[];
};
SchemaProperty({
type: SchemaClass(instanceConfig),
default: [],
array: true,
})(instanceConfigClass.prototype, 'instances');
return instanceConfigClass;
}
export function ClonePlugin<P extends { new (...args: any[]): any }>(
target: P,
name: string,
): P {
const pluginName = target.name;
const clonedPlugin = class extends target {};
for (const property of ['Config', 'schema', 'using']) {
Object.defineProperty(clonedPlugin, property, {
enumerable: true,
configurable: true,
writable: true,
value: target[property],
});
}
Object.defineProperty(clonedPlugin, 'name', {
enumerable: true,
configurable: true,
writable: true,
value: pluginName,
});
return clonedPlugin;
}
export type TypeFromClass<T> = T extends { new (...args: any[]): infer U }
? U
: never;
......@@ -2,6 +2,7 @@ import { Awaitable, Logger } from 'koishi';
import { PicMiddlewareConfig } from './config';
import {
BasePlugin,
CreatePluginFactory,
Inject,
InjectLogger,
LifecycleEvents,
......@@ -9,10 +10,8 @@ import {
import PicsContainer from './index';
import { PicMiddleware, PicNext } from './def';
export class PicMiddlewareBase<
C extends PicMiddlewareConfig = PicMiddlewareConfig,
>
extends BasePlugin<C>
export class BasePicMiddlewarePlugin
extends BasePlugin<PicMiddlewareConfig>
implements PicMiddleware, LifecycleEvents
{
@Inject(true)
......@@ -30,3 +29,8 @@ export class PicMiddlewareBase<
return next(url);
}
}
export const PicMiddlewarePlugin = CreatePluginFactory(
BasePicMiddlewarePlugin,
PicMiddlewareConfig,
);
import { DefinePlugin, Inject } from 'koishi-thirdeye';
import { Assets } from 'koishi';
import { PicMiddlewareBase } from '../middleware';
import { PicMiddlewareConfig } from '../config';
import { PicNext } from '../def';
import { PicMiddlewarePlugin } from '../middleware';
@DefinePlugin({ schema: PicMiddlewareConfig })
export class PicAssetsTransformMiddleware extends PicMiddlewareBase {
@DefinePlugin()
export class PicAssetsTransformMiddleware extends PicMiddlewarePlugin() {
@Inject()
private assets: Assets;
......
import { DefinePlugin } from 'koishi-thirdeye';
import { PicMiddlewareBase } from '../middleware';
import { PicMiddlewareConfig } from '../config';
import { PicMiddlewarePlugin } from '../middleware';
import { PicNext } from '../def';
@DefinePlugin({ schema: PicMiddlewareConfig })
export class PicDownloaderMiddleware extends PicMiddlewareBase {
@DefinePlugin()
export class PicDownloaderMiddleware extends PicMiddlewarePlugin() {
override async use(url: string, next: PicNext) {
const downloadedUrl = await this.pics.download(url);
return next(downloadedUrl);
......
import { Context, Awaitable, Logger, Plugin } from 'koishi';
import { Context, Awaitable, Logger } from 'koishi';
import {
PartialDeep,
InjectConfig,
Inject,
InjectLogger,
BasePlugin,
ClassType,
DefinePlugin,
LifecycleEvents,
CreatePluginFactory,
} from 'koishi-thirdeye';
import PicsContainer from '.';
import { PicSourceConfig } from './config';
import {
PicSourceInfo,
PicResult,
Instances,
ToInstancesConfig,
ClonePlugin,
TypeFromClass,
} from './def';
import { PicSourceInfo, PicResult } from './def';
export class PicSource implements PicSourceInfo {
constructor(protected ctx: Context) {}
constructor(public ctx: Context) {}
tags: string[] = [];
weight = 1;
name = 'default';
......@@ -50,19 +40,19 @@ export class PicSource implements PicSourceInfo {
}
}
export class PicSourcePlugin<C extends PicSourceConfig> extends PicSource {
constructor(ctx: Context, config: PartialDeep<C>) {
export class BasePicSourcePlugin extends PicSource {
constructor(ctx: Context, config: PartialDeep<PicSourceConfig>) {
super(ctx);
}
@InjectConfig()
protected config: C;
config: PicSourceConfig;
@Inject(true)
protected pics: PicsContainer;
pics: PicsContainer;
@InjectLogger()
protected logger: Logger;
logger: Logger;
onApply() {
this.config.applyTo(this);
......@@ -70,56 +60,7 @@ export class PicSourcePlugin<C extends PicSourceConfig> extends PicSource {
}
}
export class MultiPicSourcePlugin<C extends PicSourceConfig>
extends BasePlugin<Instances<C>>
implements LifecycleEvents
{
@Inject(true)
protected pics: PicsContainer;
@InjectLogger()
protected logger: Logger;
getSourcePlugin(): new (ctx: Context, config: any) => PicSourcePlugin<C> {
throw new Error(`Not implemented`);
}
registerSourceInstances() {
const sourcePlugin = this.getSourcePlugin();
for (const instanceConfig of this.config.instances) {
const clonedSourcePlugin = ClonePlugin(
sourcePlugin,
`${instanceConfig.name}-${instanceConfig.name}`,
);
this.ctx.plugin(clonedSourcePlugin, instanceConfig);
}
}
onApply() {
this.registerSourceInstances();
}
}
export function DefineMultiSourcePlugin<C extends ClassType<PicSourceConfig>>(
SourcePlugin: new (ctx: Context, config: TypeFromClass<C>) => PicSourcePlugin<
TypeFromClass<C>
>,
SourceConfig: C,
name = SourcePlugin.name,
): new (
context: Context,
config: Instances<PartialDeep<TypeFromClass<C>>>,
) => MultiPicSourcePlugin<TypeFromClass<C>> {
const pluginClass = class SpecificMultiPicSourcePlugin extends MultiPicSourcePlugin<
TypeFromClass<C>
> {
getSourcePlugin() {
return SourcePlugin;
}
};
return DefinePlugin({
name,
schema: ToInstancesConfig(SourceConfig),
})(pluginClass);
}
export const PicSourcePlugin = CreatePluginFactory(
BasePicSourcePlugin,
PicSourceConfig,
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment