@ludeo/cloud-common 1.2.0 → 1.2.2

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.
Files changed (66) hide show
  1. package/dist/tsconfig.tsbuildinfo +1 -1
  2. package/dist/v3/types/cloud.d.ts +1 -0
  3. package/dist/v3/types/cloud.js +5 -0
  4. package/dist/v3/types/cloud.js.map +1 -1
  5. package/dist/v4/contexts/cloud-resource-context.d.ts +2 -0
  6. package/dist/v4/contexts/cloud-resource-context.js +10 -0
  7. package/dist/v4/contexts/cloud-resource-context.js.map +1 -1
  8. package/dist/v4/contexts/cloud-session-context.d.ts +2 -0
  9. package/dist/v4/contexts/cloud-session-context.js +10 -0
  10. package/dist/v4/contexts/cloud-session-context.js.map +1 -1
  11. package/dist/v4/events/allocate-game-request.d.ts +5 -5
  12. package/dist/v4/events/allocate-game-request.js +9 -6
  13. package/dist/v4/events/allocate-game-request.js.map +1 -1
  14. package/dist/v4/events/allocate-ludeo-request.d.ts +13 -0
  15. package/dist/v4/events/allocate-ludeo-request.js +46 -0
  16. package/dist/v4/events/allocate-ludeo-request.js.map +1 -0
  17. package/dist/v4/events/allocate-ludeo-resource-request.d.ts +13 -7
  18. package/dist/v4/events/allocate-ludeo-resource-request.js +35 -14
  19. package/dist/v4/events/allocate-ludeo-resource-request.js.map +1 -1
  20. package/dist/v4/events/game-allocated-response.d.ts +10 -5
  21. package/dist/v4/events/game-allocated-response.js +25 -4
  22. package/dist/v4/events/game-allocated-response.js.map +1 -1
  23. package/dist/v4/events/game-allocation-failed-response.d.ts +6 -5
  24. package/dist/v4/events/game-allocation-failed-response.js +13 -6
  25. package/dist/v4/events/game-allocation-failed-response.js.map +1 -1
  26. package/dist/v4/events/index.d.ts +5 -1
  27. package/dist/v4/events/index.js +5 -1
  28. package/dist/v4/events/index.js.map +1 -1
  29. package/dist/v4/events/ludeo-allocated-response.d.ts +5 -4
  30. package/dist/v4/events/ludeo-allocated-response.js +6 -6
  31. package/dist/v4/events/ludeo-allocated-response.js.map +1 -1
  32. package/dist/v4/events/ludeo-allocation-failed.d.ts +6 -4
  33. package/dist/v4/events/ludeo-allocation-failed.js +10 -5
  34. package/dist/v4/events/ludeo-allocation-failed.js.map +1 -1
  35. package/dist/v4/events/ludeo-resource-allocated-response.d.ts +7 -3
  36. package/dist/v4/events/ludeo-resource-allocated-response.js +15 -2
  37. package/dist/v4/events/ludeo-resource-allocated-response.js.map +1 -1
  38. package/dist/v4/events/ludeo-resource-allocation-failed.d.ts +4 -0
  39. package/dist/v4/events/ludeo-resource-allocation-failed.js +13 -0
  40. package/dist/v4/events/ludeo-resource-allocation-failed.js.map +1 -1
  41. package/dist/v4/events/ludeo-resource-allocation-timeout-task.d.ts +11 -0
  42. package/dist/v4/events/ludeo-resource-allocation-timeout-task.js +39 -0
  43. package/dist/v4/events/ludeo-resource-allocation-timeout-task.js.map +1 -0
  44. package/dist/v4/events/ludeo-status-updated.d.ts +14 -0
  45. package/dist/v4/events/ludeo-status-updated.js +50 -0
  46. package/dist/v4/events/ludeo-status-updated.js.map +1 -0
  47. package/dist/v4/events/terminate-ludeos-request.d.ts +12 -0
  48. package/dist/v4/events/terminate-ludeos-request.js +45 -0
  49. package/dist/v4/events/terminate-ludeos-request.js.map +1 -0
  50. package/package.json +1 -1
  51. package/src/v3/types/cloud.ts +4 -0
  52. package/src/v4/contexts/cloud-resource-context.ts +8 -0
  53. package/src/v4/contexts/cloud-session-context.ts +8 -0
  54. package/src/v4/events/allocate-game-request.ts +10 -8
  55. package/src/v4/events/allocate-ludeo-request.ts +32 -0
  56. package/src/v4/events/allocate-ludeo-resource-request.ts +35 -12
  57. package/src/v4/events/game-allocated-response.ts +27 -7
  58. package/src/v4/events/game-allocation-failed-response.ts +13 -8
  59. package/src/v4/events/index.ts +5 -1
  60. package/src/v4/events/ludeo-allocated-response.ts +7 -7
  61. package/src/v4/events/ludeo-allocation-failed.ts +11 -7
  62. package/src/v4/events/ludeo-resource-allocated-response.ts +18 -4
  63. package/src/v4/events/ludeo-resource-allocation-failed.ts +11 -1
  64. package/src/v4/events/ludeo-resource-allocation-timeout-task.ts +26 -0
  65. package/src/v4/events/ludeo-status-updated.ts +35 -0
  66. package/src/v4/events/terminate-ludeos-request.ts +32 -0
@@ -64,7 +64,7 @@ export * from "./cloud-session-allocated";
64
64
  export * from "./terminate-stale-resources-task";
65
65
  export * from "./cloud-session-ended";
66
66
  export * from "./invalid-game-resource";
67
- export * from "./game-resource-allocation-timeout-task";
67
+ export * from "./ludeo-resource-allocation-timeout-task";
68
68
  export * from "./aws-poll-stream-session-task";
69
69
  export * from "./game-resource-ready-for-creation";
70
70
  export * from "./game-resource-ready-for-creation-failed";
@@ -82,3 +82,7 @@ export * from "./ludeo-resource-loaded";
82
82
  export * from "./ludeo-resource-loading-failed";
83
83
  export * from "./swap-to-default-user";
84
84
  export * from "./swap-to-default-user-completed";
85
+ export * from "./allocate-ludeo-request";
86
+ export * from "./allocate-ludeo-resource-request";
87
+ export * from "./terminate-ludeos-request";
88
+ export * from "./ludeo-status-updated";
@@ -1,11 +1,11 @@
1
- import { IsUUID } from "class-validator";
2
1
  import { LudeoEvent } from "../../infra/ludeo-event";
3
2
  import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
4
- import { CloudResourceContext } from "../contexts";
3
+ import { CloudSessionContext } from "../contexts";
4
+ import { AwsAllocationData, CloudProviderAllocationData } from "../types";
5
5
 
6
6
  export class LudeoAllocatedResponsePayload {
7
- @IsUUID()
8
- ludeoResourceId: string;
7
+ @ValidateNestedType(() => AwsAllocationData)
8
+ allocationData: CloudProviderAllocationData;
9
9
  }
10
10
 
11
11
  export class LudeoAllocatedResponse extends LudeoEvent {
@@ -13,15 +13,15 @@ export class LudeoAllocatedResponse extends LudeoEvent {
13
13
 
14
14
  constructor(
15
15
  payload: LudeoAllocatedResponsePayload,
16
- context: CloudResourceContext
16
+ context: CloudSessionContext
17
17
  ) {
18
18
  super(LudeoAllocatedResponse.EVENT_NAME);
19
19
  this.payload = payload;
20
20
  this.context = context;
21
21
  }
22
22
 
23
- @ValidateNestedType(() => CloudResourceContext)
24
- context: CloudResourceContext;
23
+ @ValidateNestedType(() => CloudSessionContext)
24
+ context: CloudSessionContext;
25
25
 
26
26
  @ValidateNestedType(() => LudeoAllocatedResponsePayload)
27
27
  payload: LudeoAllocatedResponsePayload;
@@ -1,11 +1,15 @@
1
- import { IsUUID } from "class-validator";
2
1
  import { LudeoEvent } from "../../infra/ludeo-event";
3
2
  import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
4
- import { CloudResourceContext } from "../contexts";
3
+ import { CloudSessionContext } from "../contexts";
4
+ import { AllocationRequestData } from "../types";
5
+ import { IsString } from "class-validator";
5
6
 
6
7
  export class LudeoAllocationFailedPayload {
7
- @IsUUID()
8
- ludeoResourceId: string;
8
+ @ValidateNestedType(() => AllocationRequestData)
9
+ requestData: AllocationRequestData;
10
+
11
+ @IsString()
12
+ errorMessage: string;
9
13
  }
10
14
 
11
15
  export class LudeoAllocationFailed extends LudeoEvent {
@@ -13,15 +17,15 @@ export class LudeoAllocationFailed extends LudeoEvent {
13
17
 
14
18
  constructor(
15
19
  payload: LudeoAllocationFailedPayload,
16
- context: CloudResourceContext
20
+ context: CloudSessionContext
17
21
  ) {
18
22
  super(LudeoAllocationFailed.EVENT_NAME);
19
23
  this.payload = payload;
20
24
  this.context = context;
21
25
  }
22
26
 
23
- @ValidateNestedType(() => CloudResourceContext)
24
- context: CloudResourceContext;
27
+ @ValidateNestedType(() => CloudSessionContext)
28
+ context: CloudSessionContext;
25
29
 
26
30
  @ValidateNestedType(() => LudeoAllocationFailedPayload)
27
31
  payload: LudeoAllocationFailedPayload;
@@ -1,11 +1,25 @@
1
1
  import { IsUUID } from "class-validator";
2
2
  import { LudeoEvent } from "../../infra/ludeo-event";
3
3
  import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
4
- import { CloudResourceContext } from "../contexts";
4
+ import { CloudResourceContext, CloudSessionContext } from "../contexts";
5
+ import {
6
+ AllocationRequestData,
7
+ AwsAllocationData,
8
+ CloudProviderAllocationData,
9
+ } from "../types";
5
10
 
6
11
  export class LudeoResourceAllocatedResponsePayload {
7
12
  @IsUUID()
8
13
  ludeoResourceId: string;
14
+
15
+ @IsUUID()
16
+ ludeoPoolId: string;
17
+
18
+ @ValidateNestedType(() => AwsAllocationData)
19
+ allocationData: CloudProviderAllocationData;
20
+
21
+ @ValidateNestedType(() => AllocationRequestData)
22
+ requestData: AllocationRequestData;
9
23
  }
10
24
 
11
25
  export class LudeoResourceAllocatedResponse extends LudeoEvent {
@@ -14,15 +28,15 @@ export class LudeoResourceAllocatedResponse extends LudeoEvent {
14
28
 
15
29
  constructor(
16
30
  payload: LudeoResourceAllocatedResponsePayload,
17
- context: CloudResourceContext
31
+ context: CloudSessionContext
18
32
  ) {
19
33
  super(LudeoResourceAllocatedResponse.EVENT_NAME);
20
34
  this.payload = payload;
21
35
  this.context = context;
22
36
  }
23
37
 
24
- @ValidateNestedType(() => CloudResourceContext)
25
- context: CloudResourceContext;
38
+ @ValidateNestedType(() => CloudSessionContext)
39
+ context: CloudSessionContext;
26
40
 
27
41
  @ValidateNestedType(() => LudeoResourceAllocatedResponsePayload)
28
42
  payload: LudeoResourceAllocatedResponsePayload;
@@ -1,11 +1,21 @@
1
- import { IsUUID } from "class-validator";
1
+ import { IsString, IsUUID } from "class-validator";
2
2
  import { LudeoEvent } from "../../infra/ludeo-event";
3
3
  import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
4
4
  import { CloudResourceContext } from "../contexts";
5
+ import { AllocationRequestData } from "../types";
5
6
 
6
7
  export class LudeoResourceAllocationFailedPayload {
7
8
  @IsUUID()
8
9
  ludeoResourceId: string;
10
+
11
+ @IsUUID()
12
+ ludeoPoolId: string;
13
+
14
+ @IsString()
15
+ errorMessage: string;
16
+
17
+ @ValidateNestedType(() => AllocationRequestData)
18
+ requestData: AllocationRequestData;
9
19
  }
10
20
 
11
21
  export class LudeoResourceAllocationFailedResponse extends LudeoEvent {
@@ -0,0 +1,26 @@
1
+ import { IsUUID } from "class-validator";
2
+ import { LudeoEvent } from "../../infra/ludeo-event";
3
+ import { ValidateNestedType } from "../../decorators";
4
+
5
+ export class LudeoResourceAllocationTimeoutTaskPayload {
6
+ @IsUUID()
7
+ ludeoResourceId: string;
8
+
9
+ @IsUUID()
10
+ ludeoPoolId: string;
11
+ }
12
+
13
+ export class LudeoResourceAllocationTimeoutTask extends LudeoEvent {
14
+ static readonly EVENT_NAME =
15
+ "cloud-pools.ludeo-resource-allocation-timeout-task";
16
+
17
+ constructor(payload: LudeoResourceAllocationTimeoutTaskPayload) {
18
+ super(LudeoResourceAllocationTimeoutTask.EVENT_NAME);
19
+ this.payload = payload;
20
+ }
21
+
22
+ context: never;
23
+
24
+ @ValidateNestedType(() => LudeoResourceAllocationTimeoutTaskPayload)
25
+ payload: LudeoResourceAllocationTimeoutTaskPayload;
26
+ }
@@ -0,0 +1,35 @@
1
+ import { IsString, IsUUID } from "class-validator";
2
+ import { LudeoEvent } from "../../infra/ludeo-event";
3
+ import { CloudResourceContext } from "../contexts/cloud-resource-context";
4
+ import { CloudResourceStatus } from "../types";
5
+ import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
6
+
7
+ export class LudeoStatusUpdatedPayload {
8
+ @IsUUID()
9
+ ludeoResourceId: string;
10
+
11
+ @IsUUID()
12
+ ludeoPoolId: string;
13
+
14
+ @IsString()
15
+ status: CloudResourceStatus;
16
+ }
17
+
18
+ export class LudeoStatusUpdatedEvent extends LudeoEvent {
19
+ static readonly EVENT_NAME = "cloud-pools.game-resource-status-changed";
20
+
21
+ constructor(
22
+ payload: LudeoStatusUpdatedPayload,
23
+ context: CloudResourceContext
24
+ ) {
25
+ super(LudeoStatusUpdatedEvent.EVENT_NAME);
26
+ this.payload = payload;
27
+ this.context = context;
28
+ }
29
+
30
+ @ValidateNestedType(() => CloudResourceContext)
31
+ context: CloudResourceContext;
32
+
33
+ @ValidateNestedType(() => LudeoStatusUpdatedPayload)
34
+ payload: LudeoStatusUpdatedPayload;
35
+ }
@@ -0,0 +1,32 @@
1
+ import { IsNumber, IsUUID } from "class-validator";
2
+
3
+ import { CloudPoolContext } from "../contexts";
4
+ import { LudeoEvent } from "../../infra/ludeo-event";
5
+ import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
6
+
7
+ export class TerminateLudoesRequestPayload {
8
+ @IsUUID()
9
+ poolId: string;
10
+
11
+ @IsNumber()
12
+ quantity: number;
13
+ }
14
+
15
+ export class TerminateLudeosRequest extends LudeoEvent {
16
+ static readonly EVENT_NAME = "cloud-pools.terminate-ludeos-request";
17
+
18
+ constructor(
19
+ payload: TerminateLudoesRequestPayload,
20
+ context: CloudPoolContext
21
+ ) {
22
+ super(TerminateLudeosRequest.EVENT_NAME);
23
+ this.payload = payload;
24
+ this.context = context;
25
+ }
26
+
27
+ @ValidateNestedType(() => CloudPoolContext)
28
+ context: CloudPoolContext;
29
+
30
+ @ValidateNestedType(() => TerminateLudoesRequestPayload)
31
+ payload: TerminateLudoesRequestPayload;
32
+ }