@ludeo/cloud-common 1.1.25 → 1.1.27

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.
@@ -1,4 +1,4 @@
1
1
  import { TypeHelpOptions } from "class-transformer";
2
2
  import { CloudPoolContext } from "./cloud-pool-context";
3
3
  import { CloudResourceContext } from "./cloud-resource-context";
4
- export declare const getCloudContextType: ({ object }: TypeHelpOptions) => typeof CloudResourceContext | typeof CloudPoolContext;
4
+ export declare const getCloudContextType: ({ object }: TypeHelpOptions) => typeof CloudPoolContext | typeof CloudResourceContext;
@@ -0,0 +1,14 @@
1
+ import { CloudResourceContext } from "../contexts";
2
+ import { LudeoEvent } from "../../infra/ludeo-event";
3
+ import { CloudProviderAllocationData } from "../types";
4
+ export declare class GameAllocatedResponsePayload {
5
+ gameResourceId: string;
6
+ gamePoolId: string;
7
+ allocationData: CloudProviderAllocationData;
8
+ }
9
+ export declare class GameAllocatedResponse extends LudeoEvent {
10
+ static readonly EVENT_NAME = "cloud-resources.game-allocated-response";
11
+ constructor(payload: GameAllocatedResponsePayload, context: CloudResourceContext);
12
+ context: CloudResourceContext;
13
+ payload: GameAllocatedResponsePayload;
14
+ }
@@ -0,0 +1,50 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GameAllocatedResponse = exports.GameAllocatedResponsePayload = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const contexts_1 = require("../contexts");
15
+ const ludeo_event_1 = require("../../infra/ludeo-event");
16
+ const validate_nested_type_decorator_1 = require("../../decorators/validate-nested-type.decorator");
17
+ const types_1 = require("../types");
18
+ class GameAllocatedResponsePayload {
19
+ }
20
+ exports.GameAllocatedResponsePayload = GameAllocatedResponsePayload;
21
+ __decorate([
22
+ (0, class_validator_1.IsUUID)(),
23
+ __metadata("design:type", String)
24
+ ], GameAllocatedResponsePayload.prototype, "gameResourceId", void 0);
25
+ __decorate([
26
+ (0, class_validator_1.IsUUID)(),
27
+ __metadata("design:type", String)
28
+ ], GameAllocatedResponsePayload.prototype, "gamePoolId", void 0);
29
+ __decorate([
30
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => types_1.AwsAllocationData),
31
+ __metadata("design:type", Object)
32
+ ], GameAllocatedResponsePayload.prototype, "allocationData", void 0);
33
+ class GameAllocatedResponse extends ludeo_event_1.LudeoEvent {
34
+ constructor(payload, context) {
35
+ super(GameAllocatedResponse.EVENT_NAME);
36
+ this.payload = payload;
37
+ this.context = context;
38
+ }
39
+ }
40
+ exports.GameAllocatedResponse = GameAllocatedResponse;
41
+ GameAllocatedResponse.EVENT_NAME = "cloud-resources.game-allocated-response";
42
+ __decorate([
43
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => contexts_1.CloudResourceContext),
44
+ __metadata("design:type", contexts_1.CloudResourceContext)
45
+ ], GameAllocatedResponse.prototype, "context", void 0);
46
+ __decorate([
47
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => GameAllocatedResponsePayload),
48
+ __metadata("design:type", GameAllocatedResponsePayload)
49
+ ], GameAllocatedResponse.prototype, "payload", void 0);
50
+ //# sourceMappingURL=game-allocated-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-allocated-response.js","sourceRoot":"","sources":["../../../src/v3/events/game-allocated-response.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyC;AAEzC,0CAAmD;AACnD,yDAAqD;AACrD,oGAAqF;AACrF,oCAA0E;AAE1E,MAAa,4BAA4B;CASxC;AATD,oEASC;AAPC;IADC,IAAA,wBAAM,GAAE;;oEACc;AAGvB;IADC,IAAA,wBAAM,GAAE;;gEACU;AAGnB;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,yBAAiB,CAAC;;oEACA;AAG9C,MAAa,qBAAsB,SAAQ,wBAAU;IAGnD,YACE,OAAqC,EACrC,OAA6B;QAE7B,KAAK,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;;AAVH,sDAiBC;AAhBiB,gCAAU,GAAG,yCAAyC,CAAC;AAYvE;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,+BAAoB,CAAC;8BACtC,+BAAoB;sDAAC;AAG9B;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC;8BAC9C,4BAA4B;sDAAC"}
@@ -0,0 +1,15 @@
1
+ import { CloudResourceContext } from "../contexts";
2
+ import { LudeoEvent } from "../../infra/ludeo-event";
3
+ import { CloudProviderSettings, CloudProvider } from "../types";
4
+ export declare class GameCreatedResponsePayload {
5
+ gameResourceId: string;
6
+ gamePoolId: string;
7
+ providerSettings: CloudProviderSettings;
8
+ cloudProvider: CloudProvider;
9
+ }
10
+ export declare class GameCreatedResponse extends LudeoEvent {
11
+ static readonly EVENT_NAME = "cloud-resources.game-created-response";
12
+ constructor(payload: GameCreatedResponsePayload, context: CloudResourceContext);
13
+ context: CloudResourceContext;
14
+ payload: GameCreatedResponsePayload;
15
+ }
@@ -0,0 +1,54 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GameCreatedResponse = exports.GameCreatedResponsePayload = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const contexts_1 = require("../contexts");
15
+ const ludeo_event_1 = require("../../infra/ludeo-event");
16
+ const validate_nested_type_decorator_1 = require("../../decorators/validate-nested-type.decorator");
17
+ const types_1 = require("../types");
18
+ class GameCreatedResponsePayload {
19
+ }
20
+ exports.GameCreatedResponsePayload = GameCreatedResponsePayload;
21
+ __decorate([
22
+ (0, class_validator_1.IsUUID)(),
23
+ __metadata("design:type", String)
24
+ ], GameCreatedResponsePayload.prototype, "gameResourceId", void 0);
25
+ __decorate([
26
+ (0, class_validator_1.IsUUID)(),
27
+ __metadata("design:type", String)
28
+ ], GameCreatedResponsePayload.prototype, "gamePoolId", void 0);
29
+ __decorate([
30
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => types_1.AWSProviderSettings),
31
+ __metadata("design:type", Object)
32
+ ], GameCreatedResponsePayload.prototype, "providerSettings", void 0);
33
+ __decorate([
34
+ (0, class_validator_1.IsEnum)(types_1.CloudProvider),
35
+ __metadata("design:type", String)
36
+ ], GameCreatedResponsePayload.prototype, "cloudProvider", void 0);
37
+ class GameCreatedResponse extends ludeo_event_1.LudeoEvent {
38
+ constructor(payload, context) {
39
+ super(GameCreatedResponse.EVENT_NAME);
40
+ this.payload = payload;
41
+ this.context = context;
42
+ }
43
+ }
44
+ exports.GameCreatedResponse = GameCreatedResponse;
45
+ GameCreatedResponse.EVENT_NAME = "cloud-resources.game-created-response";
46
+ __decorate([
47
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => contexts_1.CloudResourceContext),
48
+ __metadata("design:type", contexts_1.CloudResourceContext)
49
+ ], GameCreatedResponse.prototype, "context", void 0);
50
+ __decorate([
51
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => GameCreatedResponsePayload),
52
+ __metadata("design:type", GameCreatedResponsePayload)
53
+ ], GameCreatedResponse.prototype, "payload", void 0);
54
+ //# sourceMappingURL=game-created-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-created-response.js","sourceRoot":"","sources":["../../../src/v3/events/game-created-response.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAiD;AAEjD,0CAAmD;AACnD,yDAAqD;AACrD,oGAAqF;AACrF,oCAIkB;AAElB,MAAa,0BAA0B;CAYtC;AAZD,gEAYC;AAVC;IADC,IAAA,wBAAM,GAAE;;kEACc;AAGvB;IADC,IAAA,wBAAM,GAAE;;8DACU;AAGnB;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,2BAAmB,CAAC;;oEACN;AAGxC;IADC,IAAA,wBAAM,EAAC,qBAAa,CAAC;;iEACO;AAG/B,MAAa,mBAAoB,SAAQ,wBAAU;IAGjD,YACE,OAAmC,EACnC,OAA6B;QAE7B,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;;AAVH,kDAiBC;AAhBiB,8BAAU,GAAG,uCAAuC,CAAC;AAYrE;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,+BAAoB,CAAC;8BACtC,+BAAoB;oDAAC;AAG9B;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC;8BAC5C,0BAA0B;oDAAC"}
@@ -0,0 +1,12 @@
1
+ import { CloudResourceContext } from "../contexts";
2
+ import { LudeoEvent } from "../../infra/ludeo-event";
3
+ export declare class GameTerminatedResponsePayload {
4
+ gameResourceId: string;
5
+ gamePoolId: string;
6
+ }
7
+ export declare class GameTerminatedResponse extends LudeoEvent {
8
+ static readonly EVENT_NAME = "cloud-resources.game-terminated-response";
9
+ constructor(payload: GameTerminatedResponsePayload, context: CloudResourceContext);
10
+ context: CloudResourceContext;
11
+ payload: GameTerminatedResponsePayload;
12
+ }
@@ -0,0 +1,45 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GameTerminatedResponse = exports.GameTerminatedResponsePayload = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const contexts_1 = require("../contexts");
15
+ const ludeo_event_1 = require("../../infra/ludeo-event");
16
+ const validate_nested_type_decorator_1 = require("../../decorators/validate-nested-type.decorator");
17
+ class GameTerminatedResponsePayload {
18
+ }
19
+ exports.GameTerminatedResponsePayload = GameTerminatedResponsePayload;
20
+ __decorate([
21
+ (0, class_validator_1.IsUUID)(),
22
+ __metadata("design:type", String)
23
+ ], GameTerminatedResponsePayload.prototype, "gameResourceId", void 0);
24
+ __decorate([
25
+ (0, class_validator_1.IsUUID)(),
26
+ __metadata("design:type", String)
27
+ ], GameTerminatedResponsePayload.prototype, "gamePoolId", void 0);
28
+ class GameTerminatedResponse extends ludeo_event_1.LudeoEvent {
29
+ constructor(payload, context) {
30
+ super(GameTerminatedResponse.EVENT_NAME);
31
+ this.payload = payload;
32
+ this.context = context;
33
+ }
34
+ }
35
+ exports.GameTerminatedResponse = GameTerminatedResponse;
36
+ GameTerminatedResponse.EVENT_NAME = "cloud-resources.game-terminated-response";
37
+ __decorate([
38
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => contexts_1.CloudResourceContext),
39
+ __metadata("design:type", contexts_1.CloudResourceContext)
40
+ ], GameTerminatedResponse.prototype, "context", void 0);
41
+ __decorate([
42
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => GameTerminatedResponsePayload),
43
+ __metadata("design:type", GameTerminatedResponsePayload)
44
+ ], GameTerminatedResponse.prototype, "payload", void 0);
45
+ //# sourceMappingURL=game-terminated-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game-terminated-response.js","sourceRoot":"","sources":["../../../src/v3/events/game-terminated-response.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyC;AAEzC,0CAAmD;AACnD,yDAAqD;AACrD,oGAAqF;AAErF,MAAa,6BAA6B;CAMzC;AAND,sEAMC;AAJC;IADC,IAAA,wBAAM,GAAE;;qEACc;AAGvB;IADC,IAAA,wBAAM,GAAE;;iEACU;AAGrB,MAAa,sBAAuB,SAAQ,wBAAU;IAGpD,YACE,OAAsC,EACtC,OAA6B;QAE7B,KAAK,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;;AAVH,wDAiBC;AAhBiB,iCAAU,GAAG,0CAA0C,CAAC;AAYxE;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,+BAAoB,CAAC;8BACtC,+BAAoB;uDAAC;AAG9B;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;8BAC/C,6BAA6B;uDAAC"}
@@ -0,0 +1,12 @@
1
+ import { CloudResourceContext } from "../contexts";
2
+ import { LudeoEvent } from "../../infra/ludeo-event";
3
+ export declare class MachineCreatedResponsePayload {
4
+ machineResourceId: string;
5
+ machinePoolId: string;
6
+ }
7
+ export declare class MachineCreatedResponse extends LudeoEvent {
8
+ static readonly EVENT_NAME = "cloud-resources.machine-created-response";
9
+ constructor(payload: MachineCreatedResponsePayload, context: CloudResourceContext);
10
+ context: CloudResourceContext;
11
+ payload: MachineCreatedResponsePayload;
12
+ }
@@ -0,0 +1,45 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.MachineCreatedResponse = exports.MachineCreatedResponsePayload = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const contexts_1 = require("../contexts");
15
+ const ludeo_event_1 = require("../../infra/ludeo-event");
16
+ const validate_nested_type_decorator_1 = require("../../decorators/validate-nested-type.decorator");
17
+ class MachineCreatedResponsePayload {
18
+ }
19
+ exports.MachineCreatedResponsePayload = MachineCreatedResponsePayload;
20
+ __decorate([
21
+ (0, class_validator_1.IsUUID)(),
22
+ __metadata("design:type", String)
23
+ ], MachineCreatedResponsePayload.prototype, "machineResourceId", void 0);
24
+ __decorate([
25
+ (0, class_validator_1.IsUUID)(),
26
+ __metadata("design:type", String)
27
+ ], MachineCreatedResponsePayload.prototype, "machinePoolId", void 0);
28
+ class MachineCreatedResponse extends ludeo_event_1.LudeoEvent {
29
+ constructor(payload, context) {
30
+ super(MachineCreatedResponse.EVENT_NAME);
31
+ this.payload = payload;
32
+ this.context = context;
33
+ }
34
+ }
35
+ exports.MachineCreatedResponse = MachineCreatedResponse;
36
+ MachineCreatedResponse.EVENT_NAME = "cloud-resources.machine-created-response";
37
+ __decorate([
38
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => contexts_1.CloudResourceContext),
39
+ __metadata("design:type", contexts_1.CloudResourceContext)
40
+ ], MachineCreatedResponse.prototype, "context", void 0);
41
+ __decorate([
42
+ (0, validate_nested_type_decorator_1.ValidateNestedType)(() => MachineCreatedResponsePayload),
43
+ __metadata("design:type", MachineCreatedResponsePayload)
44
+ ], MachineCreatedResponse.prototype, "payload", void 0);
45
+ //# sourceMappingURL=machine-created-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"machine-created-response.js","sourceRoot":"","sources":["../../../src/v3/events/machine-created-response.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAyC;AAEzC,0CAAmD;AACnD,yDAAqD;AACrD,oGAAqF;AAErF,MAAa,6BAA6B;CAMzC;AAND,sEAMC;AAJC;IADC,IAAA,wBAAM,GAAE;;wEACiB;AAG1B;IADC,IAAA,wBAAM,GAAE;;oEACa;AAGxB,MAAa,sBAAuB,SAAQ,wBAAU;IAGpD,YACE,OAAsC,EACtC,OAA6B;QAE7B,KAAK,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;;AAVH,wDAiBC;AAhBiB,iCAAU,GAAG,0CAA0C,CAAC;AAYxE;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,+BAAoB,CAAC;8BACtC,+BAAoB;uDAAC;AAG9B;IADC,IAAA,mDAAkB,EAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;8BAC/C,6BAA6B;uDAAC"}
@@ -36,20 +36,27 @@ export declare class GamePoolConfiguration extends BaseCloudPoolConfiguration {
36
36
  export declare class MachinePoolConfiguration extends BaseCloudPoolConfiguration {
37
37
  type: CloudPoolType.MACHINE;
38
38
  }
39
- export type CloudResourcesMap = Record<string, CloudResource>;
40
- export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
41
- export declare class CloudPool<Config extends BaseCloudPoolConfiguration> {
39
+ export type CloudPoolConfigurationType<T extends CloudPoolType | undefined> = T extends CloudPoolType.GAME ? GamePoolConfiguration : T extends CloudPoolType.MACHINE ? MachinePoolConfiguration : BaseCloudPoolConfiguration;
40
+ export declare class BaseCloudResource {
42
41
  id: string;
43
- status: CloudPoolStatus;
42
+ status: CloudResourceStatus;
44
43
  createdAt: number;
45
44
  updatedAt?: number;
46
- config: Config;
47
- resources?: CloudResourcesMap;
45
+ settings?: AWSResourceProviderSettings;
46
+ }
47
+ export declare class MachineCloudResource extends BaseCloudResource {
48
48
  }
49
- export declare class CloudResource {
49
+ export declare class GameCloudResource extends BaseCloudResource {
50
+ machineResourceId?: string;
51
+ }
52
+ export type CloudResourceType<T extends CloudPoolType | undefined = undefined> = T extends CloudPoolType.GAME ? GameCloudResource : T extends CloudPoolType.MACHINE ? MachineCloudResource : BaseCloudResource;
53
+ export type CloudResourcesMap<T extends BaseCloudResource> = Record<string, T>;
54
+ export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
55
+ export declare class CloudPool<T extends CloudPoolType | undefined = undefined> {
50
56
  id: string;
51
- status: CloudResourceStatus;
57
+ status: CloudPoolStatus;
52
58
  createdAt: number;
53
59
  updatedAt?: number;
54
- settings?: AWSResourceProviderSettings;
60
+ config: CloudPoolConfigurationType<T>;
61
+ resources?: CloudResourcesMap<CloudResourceType<T>>;
55
62
  }
@@ -9,10 +9,10 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CloudResource = exports.CloudPool = exports.MachinePoolConfiguration = exports.GamePoolConfiguration = exports.BaseCloudPoolConfiguration = exports.CloudPoolType = exports.PoolScaleConfiguration = exports.CloudPoolStatus = exports.CloudResourceStatus = void 0;
12
+ exports.CloudPool = exports.GameCloudResource = exports.MachineCloudResource = exports.BaseCloudResource = exports.MachinePoolConfiguration = exports.GamePoolConfiguration = exports.BaseCloudPoolConfiguration = exports.CloudPoolType = exports.PoolScaleConfiguration = exports.CloudPoolStatus = exports.CloudResourceStatus = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
- const cloud_1 = require("./cloud");
15
14
  const decorators_1 = require("../../decorators");
15
+ const cloud_1 = require("./cloud");
16
16
  var CloudResourceStatus;
17
17
  (function (CloudResourceStatus) {
18
18
  CloudResourceStatus["Allocated"] = "allocated";
@@ -83,10 +83,42 @@ __decorate([
83
83
  (0, class_validator_1.IsEnum)(CloudPoolType),
84
84
  __metadata("design:type", String)
85
85
  ], MachinePoolConfiguration.prototype, "type", void 0);
86
+ class BaseCloudResource {
87
+ }
88
+ exports.BaseCloudResource = BaseCloudResource;
89
+ __decorate([
90
+ (0, class_validator_1.IsUUID)(),
91
+ __metadata("design:type", String)
92
+ ], BaseCloudResource.prototype, "id", void 0);
93
+ __decorate([
94
+ (0, class_validator_1.IsEnum)(CloudResourceStatus),
95
+ __metadata("design:type", String)
96
+ ], BaseCloudResource.prototype, "status", void 0);
97
+ __decorate([
98
+ (0, class_validator_1.IsNumber)(),
99
+ __metadata("design:type", Number)
100
+ ], BaseCloudResource.prototype, "createdAt", void 0);
101
+ __decorate([
102
+ (0, class_validator_1.IsNumber)(),
103
+ (0, class_validator_1.IsOptional)(),
104
+ __metadata("design:type", Number)
105
+ ], BaseCloudResource.prototype, "updatedAt", void 0);
106
+ __decorate([
107
+ (0, decorators_1.ValidateNestedType)(() => cloud_1.AWSResourceProviderSettings),
108
+ __metadata("design:type", cloud_1.AWSResourceProviderSettings)
109
+ ], BaseCloudResource.prototype, "settings", void 0);
110
+ class MachineCloudResource extends BaseCloudResource {
111
+ }
112
+ exports.MachineCloudResource = MachineCloudResource;
113
+ class GameCloudResource extends BaseCloudResource {
114
+ }
115
+ exports.GameCloudResource = GameCloudResource;
116
+ __decorate([
117
+ (0, class_validator_1.IsString)(),
118
+ (0, class_validator_1.IsOptional)(),
119
+ __metadata("design:type", String)
120
+ ], GameCloudResource.prototype, "machineResourceId", void 0);
86
121
  class CloudPool {
87
122
  }
88
123
  exports.CloudPool = CloudPool;
89
- class CloudResource {
90
- }
91
- exports.CloudResource = CloudResource;
92
124
  //# sourceMappingURL=pools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pools.js","sourceRoot":"","sources":["../../../src/v3/types/pools.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAA2D;AAC3D,mCAIiB;AACjB,iDAAsD;AAEtD,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,8CAAuB,CAAA;IACvB,8CAAuB,CAAA;IACvB,4CAAqB,CAAA;IACrB,0CAAmB,CAAA;IACnB,gDAAyB,CAAA;IACzB,sCAAe,CAAA;IACf,kDAA2B,CAAA;IAC3B,gDAAyB,CAAA;AAC3B,CAAC,EATW,mBAAmB,mCAAnB,mBAAmB,QAS9B;AAED,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,4CAAyB,CAAA;AAC3B,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAED,MAAa,sBAAsB;CAGlC;AAHD,wDAGC;AADC;IADC,IAAA,0BAAQ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JD,8CAIC;AADC;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;4DACc;AAc7B,MAAa,SAAS;CAOrB;AAPD,8BAOC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludeo/cloud-common",
3
- "version": "1.1.25",
3
+ "version": "1.1.27",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Yahil Didi",
@@ -1,10 +1,17 @@
1
- import { IsEnum, IsNumber, IsUUID } from "class-validator";
1
+ import {
2
+ IsEnum,
3
+ IsNumber,
4
+ IsOptional,
5
+ IsString,
6
+ IsUUID,
7
+ } from "class-validator";
8
+
9
+ import { ValidateNestedType } from "../../decorators";
2
10
  import {
3
11
  AWSResourceProviderSettings,
4
12
  CloudProvider,
5
13
  CloudProviderSettings,
6
14
  } from "./cloud";
7
- import { ValidateNestedType } from "../../decorators";
8
15
 
9
16
  export enum CloudResourceStatus {
10
17
  Allocated = "allocated",
@@ -65,23 +72,55 @@ export class MachinePoolConfiguration extends BaseCloudPoolConfiguration {
65
72
  type: CloudPoolType.MACHINE;
66
73
  }
67
74
 
68
- export type CloudResourcesMap = Record<string, CloudResource>;
75
+ export type CloudPoolConfigurationType<T extends CloudPoolType | undefined> =
76
+ T extends CloudPoolType.GAME
77
+ ? GamePoolConfiguration
78
+ : T extends CloudPoolType.MACHINE
79
+ ? MachinePoolConfiguration
80
+ : BaseCloudPoolConfiguration;
69
81
 
70
- export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
71
-
72
- export class CloudPool<Config extends BaseCloudPoolConfiguration> {
82
+ export class BaseCloudResource {
83
+ @IsUUID()
73
84
  id: string;
74
- status: CloudPoolStatus;
85
+
86
+ @IsEnum(CloudResourceStatus)
87
+ status: CloudResourceStatus;
88
+
89
+ @IsNumber()
75
90
  createdAt: number;
91
+
92
+ @IsNumber()
93
+ @IsOptional()
76
94
  updatedAt?: number;
77
- config: Config;
78
- resources?: CloudResourcesMap;
95
+
96
+ @ValidateNestedType(() => AWSResourceProviderSettings)
97
+ settings?: AWSResourceProviderSettings;
79
98
  }
80
99
 
81
- export class CloudResource {
100
+ export class MachineCloudResource extends BaseCloudResource {}
101
+
102
+ export class GameCloudResource extends BaseCloudResource {
103
+ @IsString()
104
+ @IsOptional()
105
+ machineResourceId?: string;
106
+ }
107
+
108
+ export type CloudResourceType<T extends CloudPoolType | undefined = undefined> =
109
+ T extends CloudPoolType.GAME
110
+ ? GameCloudResource
111
+ : T extends CloudPoolType.MACHINE
112
+ ? MachineCloudResource
113
+ : BaseCloudResource;
114
+
115
+ export type CloudResourcesMap<T extends BaseCloudResource> = Record<string, T>;
116
+
117
+ export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
118
+
119
+ export class CloudPool<T extends CloudPoolType | undefined = undefined> {
82
120
  id: string;
83
- status: CloudResourceStatus;
121
+ status: CloudPoolStatus;
84
122
  createdAt: number;
85
123
  updatedAt?: number;
86
- settings?: AWSResourceProviderSettings;
124
+ config: CloudPoolConfigurationType<T>;
125
+ resources?: CloudResourcesMap<CloudResourceType<T>>;
87
126
  }