@armoury/fivem-framework-client 1.0.37 → 1.0.38

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.
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.CLIENT_PROVIDERS = void 0;
18
+ exports.CLIENT_EAGER_PROVIDERS = exports.CLIENT_PROVIDERS = void 0;
19
19
  exports.bootstrap = bootstrap;
20
20
  require("reflect-metadata");
21
21
  const services_1 = require("./services");
@@ -33,8 +33,11 @@ exports.CLIENT_PROVIDERS = [
33
33
  services_1.ClientUIService,
34
34
  services_1.ClientWaypointsService,
35
35
  ];
36
+ exports.CLIENT_EAGER_PROVIDERS = [
37
+ services_1.UI
38
+ ];
36
39
  async function bootstrap(_class, options = {}) {
37
- return (0, fivem_framework_common_1.bootstrapWithProviders)(_class, exports.CLIENT_PROVIDERS, options, fivem_framework_common_1.DecorationType.CLIENT, (key, index) => Cfx.Client.GetResourceMetadata(Cfx.Client.GetCurrentResourceName(), key, index), (resourceName) => Cfx.exports[resourceName]);
40
+ return (0, fivem_framework_common_1.bootstrapWithProviders)(_class, exports.CLIENT_PROVIDERS, options, fivem_framework_common_1.DecorationType.CLIENT, (key, index) => Cfx.Client.GetResourceMetadata(Cfx.Client.GetCurrentResourceName(), key, index), (resourceName) => Cfx.exports[resourceName], exports.CLIENT_EAGER_PROVIDERS);
38
41
  }
39
42
  __exportStar(require("./services"), exports);
40
43
  __exportStar(require("@armoury/fivem-framework-common"), exports);
@@ -26,3 +26,4 @@ __exportStar(require("./client-translate.service"), exports);
26
26
  __exportStar(require("./client-vehicles.service"), exports);
27
27
  __exportStar(require("./client-ui.service"), exports);
28
28
  __exportStar(require("./client-waypoints.service"), exports);
29
+ __exportStar(require("./ui"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ui"), exports);
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var UI_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.UI = void 0;
17
+ const fivem_framework_common_1 = require("@armoury/fivem-framework-common");
18
+ const injection_js_1 = require("injection-js");
19
+ let UI = UI_1 = class UI {
20
+ constructor(armouryRef) {
21
+ UI_1.armouryRef = armouryRef;
22
+ }
23
+ static sendMessage(message) {
24
+ if (!isUIMessage(message)) {
25
+ console.error('Couldn\'t send UI message: Message doesn\'t respect a valid format.', 'Message:', message);
26
+ return;
27
+ }
28
+ this.armouryRef.instance.sendUIMessage(message);
29
+ }
30
+ };
31
+ exports.UI = UI;
32
+ exports.UI = UI = UI_1 = __decorate([
33
+ (0, injection_js_1.Injectable)(),
34
+ __param(0, (0, fivem_framework_common_1.Resource)('armoury')),
35
+ __metadata("design:paramtypes", [fivem_framework_common_1.ResourceRef])
36
+ ], UI);
37
+ function isUIMessage(value) {
38
+ return (typeof value === "object" &&
39
+ value !== null &&
40
+ !Array.isArray(value) &&
41
+ "type" in value &&
42
+ typeof value.type === "string");
43
+ }
@@ -1,6 +1,6 @@
1
1
  /// <reference path = "../ambient.declarations.d.ts" />
2
2
  import 'reflect-metadata';
3
- import { ClientActionPointsService, ClientBlipsService, ClientCheckpointsService, ClientMarkersService, ClientPedsService, ClientSessionService, ClientTicksService, ClientUIService, ClientVehiclesService, ClientWaypointsService, ClientHudService } from './services';
3
+ import { ClientActionPointsService, ClientBlipsService, ClientCheckpointsService, ClientMarkersService, ClientPedsService, ClientSessionService, ClientTicksService, ClientUIService, ClientVehiclesService, ClientWaypointsService, ClientHudService, UI } from './services';
4
4
  import { bootstrapWithProviders, DecorationType } from '@armoury/fivem-framework-common';
5
5
  export const CLIENT_PROVIDERS = [
6
6
  ClientActionPointsService,
@@ -15,8 +15,11 @@ export const CLIENT_PROVIDERS = [
15
15
  ClientUIService,
16
16
  ClientWaypointsService,
17
17
  ];
18
+ export const CLIENT_EAGER_PROVIDERS = [
19
+ UI
20
+ ];
18
21
  export async function bootstrap(_class, options = {}) {
19
- return bootstrapWithProviders(_class, CLIENT_PROVIDERS, options, DecorationType.CLIENT, (key, index) => Cfx.Client.GetResourceMetadata(Cfx.Client.GetCurrentResourceName(), key, index), (resourceName) => Cfx.exports[resourceName]);
22
+ return bootstrapWithProviders(_class, CLIENT_PROVIDERS, options, DecorationType.CLIENT, (key, index) => Cfx.Client.GetResourceMetadata(Cfx.Client.GetCurrentResourceName(), key, index), (resourceName) => Cfx.exports[resourceName], CLIENT_EAGER_PROVIDERS);
20
23
  }
21
24
  export * from './services';
22
25
  export * from '@armoury/fivem-framework-common';
@@ -10,3 +10,4 @@ export * from './client-translate.service';
10
10
  export * from './client-vehicles.service';
11
11
  export * from './client-ui.service';
12
12
  export * from './client-waypoints.service';
13
+ export * from './ui';
@@ -0,0 +1 @@
1
+ export * from './ui';
@@ -0,0 +1,40 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ var UI_1;
14
+ import { Resource, ResourceRef } from '@armoury/fivem-framework-common';
15
+ import { Injectable } from 'injection-js';
16
+ let UI = UI_1 = class UI {
17
+ constructor(armouryRef) {
18
+ UI_1.armouryRef = armouryRef;
19
+ }
20
+ static sendMessage(message) {
21
+ if (!isUIMessage(message)) {
22
+ console.error('Couldn\'t send UI message: Message doesn\'t respect a valid format.', 'Message:', message);
23
+ return;
24
+ }
25
+ this.armouryRef.instance.sendUIMessage(message);
26
+ }
27
+ };
28
+ UI = UI_1 = __decorate([
29
+ Injectable(),
30
+ __param(0, Resource('armoury')),
31
+ __metadata("design:paramtypes", [ResourceRef])
32
+ ], UI);
33
+ export { UI };
34
+ function isUIMessage(value) {
35
+ return (typeof value === "object" &&
36
+ value !== null &&
37
+ !Array.isArray(value) &&
38
+ "type" in value &&
39
+ typeof value.type === "string");
40
+ }
@@ -1,9 +1,10 @@
1
1
  /// <reference path="../ambient.declarations.d.ts" />
2
2
  import 'reflect-metadata';
3
3
  import { Provider } from 'injection-js';
4
- import { ClientActionPointsService, ClientBlipsService, ClientCheckpointsService, ClientMarkersService, ClientPedsService, ClientSessionService, ClientTicksService, ClientUIService, ClientVehiclesService, ClientWaypointsService, ClientHudService } from './services';
4
+ import { ClientActionPointsService, ClientBlipsService, ClientCheckpointsService, ClientMarkersService, ClientPedsService, ClientSessionService, ClientTicksService, ClientUIService, ClientVehiclesService, ClientWaypointsService, ClientHudService, UI } from './services';
5
5
  import { BootstrapOptions } from '@armoury/fivem-framework-common';
6
6
  export declare const CLIENT_PROVIDERS: (typeof ClientTicksService | typeof ClientActionPointsService | typeof ClientBlipsService | typeof ClientCheckpointsService | typeof ClientHudService | typeof ClientMarkersService | typeof ClientPedsService | typeof ClientSessionService | typeof ClientVehiclesService | typeof ClientUIService | typeof ClientWaypointsService)[];
7
+ export declare const CLIENT_EAGER_PROVIDERS: (typeof UI)[];
7
8
  export declare function bootstrap<T extends {
8
9
  new (...args: any[]): any;
9
10
  } & Provider>(_class: T, options?: BootstrapOptions): Promise<InstanceType<T>>;
@@ -10,3 +10,4 @@ export * from './client-translate.service';
10
10
  export * from './client-vehicles.service';
11
11
  export * from './client-ui.service';
12
12
  export * from './client-waypoints.service';
13
+ export * from './ui';
@@ -0,0 +1 @@
1
+ export * from './ui';
@@ -0,0 +1,11 @@
1
+ import { ResourceRef } from '@armoury/fivem-framework-common';
2
+ export declare class UI {
3
+ private static armouryRef;
4
+ constructor(armouryRef: ResourceRef);
5
+ static sendMessage(message: UIMessage): void;
6
+ }
7
+ type UIMessage = {
8
+ type: string;
9
+ [key: string]: unknown;
10
+ };
11
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armoury/fivem-framework-client",
3
- "version": "1.0.37",
3
+ "version": "1.0.38",
4
4
  "description": "Client APIs for the Armoury FiveM framework",
5
5
  "main": "dist/cjs/client/index.js",
6
6
  "module": "dist/esm/client/index.js",
@@ -25,7 +25,7 @@
25
25
  "rxjs": "^7.8.1"
26
26
  },
27
27
  "peerDependencies": {
28
- "@armoury/fivem-framework-common": "1.0.37"
28
+ "@armoury/fivem-framework-common": "1.0.38"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"