@armoury/fivem-framework-server 1.0.11 → 1.0.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.
@@ -16,9 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.SERVER_PROVIDERS = void 0;
19
- exports.Server_Init = Server_Init;
19
+ exports.bootstrap = bootstrap;
20
20
  require("reflect-metadata");
21
- const injection_js_1 = require("injection-js");
22
21
  const default_entities_1 = require("./services/session/default-entities");
23
22
  const fivem_framework_common_1 = require("@armoury/fivem-framework-common");
24
23
  exports.SERVER_PROVIDERS = [
@@ -58,12 +57,8 @@ exports.SERVER_PROVIDERS = [
58
57
  multi: true,
59
58
  },
60
59
  ];
61
- async function Server_Init(_class, ...providers) {
62
- const mainInjector = injection_js_1.ReflectiveInjector.resolveAndCreate(exports.SERVER_PROVIDERS);
63
- const injector = injection_js_1.ReflectiveInjector.resolveAndCreate([...providers, _class], mainInjector);
64
- const instance = injector.get(_class);
65
- (0, fivem_framework_common_1.Decorate)(instance, _class.prototype, [...exports.SERVER_PROVIDERS, ...providers]);
66
- return instance;
60
+ async function bootstrap(_class, options = {}) {
61
+ return (0, fivem_framework_common_1.bootstrapWithProviders)(_class, exports.SERVER_PROVIDERS, options);
67
62
  }
68
63
  __exportStar(require("./services"), exports);
69
64
  __exportStar(require("./models"), exports);
@@ -1,8 +1,7 @@
1
1
  /// <reference path = "../ambient.declarations.d.ts" />
2
2
  import 'reflect-metadata';
3
- import { ReflectiveInjector } from 'injection-js';
4
3
  import { SessionAccountId, SessionCash, SessionHoursPlayed, SessionId, SessionLanguage, SessionLastLocation, SessionName } from './services/session/default-entities';
5
- import { Decorate } from '@armoury/fivem-framework-common';
4
+ import { bootstrapWithProviders } from '@armoury/fivem-framework-common';
6
5
  export const SERVER_PROVIDERS = [
7
6
  {
8
7
  provide: 'sessionItems',
@@ -40,12 +39,8 @@ export const SERVER_PROVIDERS = [
40
39
  multi: true,
41
40
  },
42
41
  ];
43
- export async function Server_Init(_class, ...providers) {
44
- const mainInjector = ReflectiveInjector.resolveAndCreate(SERVER_PROVIDERS);
45
- const injector = ReflectiveInjector.resolveAndCreate([...providers, _class], mainInjector);
46
- const instance = injector.get(_class);
47
- Decorate(instance, _class.prototype, [...SERVER_PROVIDERS, ...providers]);
48
- return instance;
42
+ export async function bootstrap(_class, options = {}) {
43
+ return bootstrapWithProviders(_class, SERVER_PROVIDERS, options);
49
44
  }
50
45
  export * from './services';
51
46
  export * from './models';
@@ -2,6 +2,7 @@
2
2
  import 'reflect-metadata';
3
3
  import { Provider } from 'injection-js';
4
4
  import { SessionId, SessionLastLocation, SessionName } from './services/session/default-entities';
5
+ import { BootstrapOptions } from '@armoury/fivem-framework-common';
5
6
  export declare const SERVER_PROVIDERS: ({
6
7
  provide: string;
7
8
  useValue: SessionId;
@@ -15,9 +16,9 @@ export declare const SERVER_PROVIDERS: ({
15
16
  useValue: SessionLastLocation;
16
17
  multi: boolean;
17
18
  })[];
18
- export declare function Server_Init<T extends {
19
+ export declare function bootstrap<T extends {
19
20
  new (...args: any[]): any;
20
- } & Provider>(_class: T, ...providers: Provider[]): Promise<T>;
21
+ } & Provider>(_class: T, options?: BootstrapOptions): Promise<InstanceType<T>>;
21
22
  export * from './services';
22
23
  export * from './models';
23
24
  export * from '@armoury/fivem-framework-common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armoury/fivem-framework-server",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Server APIs for the Armoury FiveM framework",
5
5
  "main": "dist/cjs/server/index.js",
6
6
  "module": "dist/esm/server/index.js",
@@ -27,7 +27,7 @@
27
27
  "rxjs": "^7.8.1"
28
28
  },
29
29
  "peerDependencies": {
30
- "@armoury/fivem-framework-common": "1.0.11",
30
+ "@armoury/fivem-framework-common": "1.0.12",
31
31
  "drizzle-orm": "^0.45.4",
32
32
  "mysql2": "^3.24.5"
33
33
  },