@hikarix/core
Advanced tools
Comparing version 0.4.5-2 to 0.4.5-3
import { DynamicModule } from '@nestjs/common'; | ||
import { IPlatformResourceProvider } from "../proto/platform-resource"; | ||
import { HiKariCoreHostConfig } from "../proto/config"; | ||
import { RepoServiceOpsModule } from "../proto/rsi"; | ||
export declare type HiKariAppModulePlatResOptType = IPlatformResourceProvider[] | ((cfg: HiKariCoreHostConfig) => (IPlatformResourceProvider[])); | ||
export interface HiKariAppModuleConfig { | ||
repoItemControllers?: any[]; | ||
repoOpsProvidedModules?: any[]; | ||
repoOpsModules?: RepoServiceOpsModule[]; | ||
platformResources?: HiKariAppModulePlatResOptType; | ||
@@ -8,0 +11,0 @@ } |
@@ -20,2 +20,3 @@ "use strict"; | ||
const config_1 = require("../proto/config"); | ||
const rsi_1 = require("../proto/rsi"); | ||
let HiKariAppModule = HiKariAppModule_1 = class HiKariAppModule { | ||
@@ -28,3 +29,3 @@ static forRoot(appModuleConfig) { | ||
app_platform_resource_module_1.HiKariAppPlatformResourcesModule.forModuleConfig(appModuleConfig), | ||
app_repo_ops_module_1.HiKariAppRepoOpsModule, | ||
app_repo_ops_module_1.HiKariAppRepoOpsModule.forModuleConfig(appModuleConfig), | ||
repo_module_1.HiKariRepoModule.forModuleConfig(appModuleConfig) | ||
@@ -31,0 +32,0 @@ ], |
@@ -0,4 +1,8 @@ | ||
import { DynamicModule } from '@nestjs/common'; | ||
import { HiKariRepoServiceOpsManager } from "../repo/index"; | ||
import { HiKariAppModuleConfig } from "./app.module"; | ||
export declare class HiKariAppRepoOpsModule { | ||
constructor(opsManager: HiKariRepoServiceOpsManager); | ||
static forModuleConfig(appModuleConfig: HiKariAppModuleConfig): DynamicModule; | ||
onModuleInit(): any; | ||
} |
@@ -11,2 +11,3 @@ "use strict"; | ||
}; | ||
var HiKariAppRepoOpsModule_1; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -16,12 +17,40 @@ exports.HiKariAppRepoOpsModule = void 0; | ||
const repo_1 = require("../repo"); | ||
let HiKariAppRepoOpsModule = class HiKariAppRepoOpsModule { | ||
const core_1 = require("@nestjs/core"); | ||
const app_module_1 = require("./app.module"); | ||
const app_config_module_1 = require("./app.config.module"); | ||
const config_1 = require("../proto/config"); | ||
let HiKariAppRepoOpsModule = HiKariAppRepoOpsModule_1 = class HiKariAppRepoOpsModule { | ||
constructor(opsManager) { | ||
opsManager.registerRepoModules(); | ||
} | ||
static forModuleConfig(appModuleConfig) { | ||
return { | ||
module: HiKariAppRepoOpsModule_1, | ||
imports: [app_config_module_1.HiKariAppHostConfigModule, ...(appModuleConfig.repoOpsProvidedModules || [])], | ||
providers: [ | ||
{ | ||
provide: repo_1.HiKariRepoServiceOpsManager, | ||
useFactory(hostConfig, moduleRef) { | ||
return new repo_1.HiKariRepoServiceOpsManager(appModuleConfig.repoOpsModules || [], { | ||
hostConfig, | ||
resolve: (token) => { | ||
const got = moduleRef.get(token, { strict: false }); | ||
if (!got) { | ||
throw Object.assign(Object.assign({}, new Error('could not get token')), { token }); | ||
} | ||
return got; | ||
} | ||
}); | ||
}, | ||
inject: ['host-config', core_1.ModuleRef], | ||
}, | ||
], | ||
exports: [repo_1.HiKariRepoServiceOpsManager] | ||
}; | ||
} | ||
onModuleInit() { | ||
} | ||
}; | ||
HiKariAppRepoOpsModule = __decorate([ | ||
common_1.Module({ | ||
providers: [repo_1.HiKariRepoServiceOpsManager], | ||
exports: [repo_1.HiKariRepoServiceOpsManager] | ||
}), | ||
HiKariAppRepoOpsModule = HiKariAppRepoOpsModule_1 = __decorate([ | ||
common_1.Module({}), | ||
__metadata("design:paramtypes", [repo_1.HiKariRepoServiceOpsManager]) | ||
@@ -28,0 +57,0 @@ ], HiKariAppRepoOpsModule); |
@@ -28,3 +28,3 @@ "use strict"; | ||
app_platform_resource_module_1.HiKariAppPlatformResourcesModule.forModuleConfig(appModuleConfig), | ||
app_repo_ops_module_1.HiKariAppRepoOpsModule | ||
app_repo_ops_module_1.HiKariAppRepoOpsModule.forModuleConfig(appModuleConfig) | ||
], | ||
@@ -31,0 +31,0 @@ controllers: [ |
{ | ||
"name": "@hikarix/core", | ||
"version": "0.4.5-2", | ||
"version": "0.4.5-3", | ||
"description": "hikari-core is the backend of HiKari", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/Myriad-Dreamin/hikari-core", |
@@ -6,2 +6,3 @@ import { EnumRepoEntitiesKey, EnumRepoEntitiesMeta, EnumRepoEntityLoadMethodKey, EnumRepoEntityLoadMethodsMeta } from "./repo-item"; | ||
import { IPlatformResourceManager } from "./platform-resource"; | ||
import { HiKariTypeMetaManager } from "./meta"; | ||
interface Closer { | ||
@@ -121,5 +122,7 @@ close(promiseReporter: (err: Error) => never): void; | ||
export interface RepoServiceOpsFacContext { | ||
opts: HiKariCoreHostConfig; | ||
hostConfig: HiKariCoreHostConfig; | ||
resolve<T>(token: any): T; | ||
} | ||
export interface RepoServiceOpsFactory<T> { | ||
readonly managingEntity: EnumRepoEntitiesKey | string; | ||
readonly description: string; | ||
@@ -131,2 +134,6 @@ readonly protocolPrefixedUUID: string; | ||
} | ||
export interface RepoServiceOpsModule { | ||
register(metaManager: HiKariTypeMetaManager): void; | ||
remove(metaManager: HiKariTypeMetaManager): void; | ||
} | ||
export {}; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const config_1 = require("./config"); | ||
const meta_1 = require("./meta"); | ||
class HiKariSourceManagerCreateItemFromIIdApis { | ||
@@ -10,0 +11,0 @@ createItemFromI(k, i) { |
@@ -1,2 +0,2 @@ | ||
import { RepoServiceOps } from "../proto/rsi"; | ||
import { RepoServiceOps, RepoServiceOpsFacContext, RepoServiceOpsModule } from "../proto/rsi"; | ||
import { Mutable } from "../lib/semantic"; | ||
@@ -9,2 +9,4 @@ import { EnumRepoEntitiesKey } from "../proto/repo-item"; | ||
export declare class HiKariRepoServiceOpsManager { | ||
private intrinsicRepoModules; | ||
private facContext; | ||
initialized: boolean; | ||
@@ -15,3 +17,3 @@ private memoryKeyIndex; | ||
private memoryFacUUIDIndex; | ||
constructor(); | ||
constructor(intrinsicRepoModules: RepoServiceOpsModule[], facContext: RepoServiceOpsFacContext); | ||
registerRepoModules(): void; | ||
@@ -18,0 +20,0 @@ rebuildRepoModules(): void; |
@@ -9,3 +9,2 @@ "use strict"; | ||
const repo_item_1 = require("../proto/repo-item"); | ||
const intrinsicRepoModules = []; | ||
class UniqueOverrideIndex extends Map { | ||
@@ -42,3 +41,5 @@ constructor() { | ||
class HiKariRepoServiceOpsManager { | ||
constructor() { | ||
constructor(intrinsicRepoModules, facContext) { | ||
this.intrinsicRepoModules = intrinsicRepoModules; | ||
this.facContext = facContext; | ||
this.memoryKeyIndex = new UniqueOverrideIndex(); | ||
@@ -55,3 +56,3 @@ this.memoryFacKeyIndex = new UniqueOverrideIndex(); | ||
this.initialized = true; | ||
intrinsicRepoModules.forEach(m => m.register(this)); | ||
this.intrinsicRepoModules.forEach(m => m.register(meta_1.metaManager)); | ||
this.init(); | ||
@@ -93,3 +94,3 @@ } | ||
if (this.memoryFacKeyIndex.has(key)) { | ||
const ops = this.memoryFacKeyIndex.get(key).create(undefined); | ||
const ops = this.memoryFacKeyIndex.get(key).create(this.facContext); | ||
this.initOps(ops); | ||
@@ -106,3 +107,3 @@ this.insertOpsInstance(ops); | ||
if (this.memoryFacUUIDIndex.has(uuid)) { | ||
const ops = this.memoryFacUUIDIndex.get(uuid).create(undefined); | ||
const ops = this.memoryFacUUIDIndex.get(uuid).create(this.facContext); | ||
this.initOps(ops); | ||
@@ -109,0 +110,0 @@ this.insertOpsInstance(ops); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172356
3609