@ludeo/cloud-common 1.0.5 → 1.0.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludeo/cloud-common",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Yahil Didi",
@@ -1,7 +1,7 @@
1
1
  import { LudeoEvent } from "../../infra/ludeo-event";
2
2
  import { PoolContext } from "../contexts/pool-context";
3
3
  import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
4
- import { CloudPool } from "../models/cloud-pool";
4
+ import { CloudPool } from "../types/pools";
5
5
 
6
6
  export class PoolCreatedEvent extends LudeoEvent {
7
7
  static readonly EVENT_NAME = "cloud-pools.pool-created";
@@ -1,7 +1,12 @@
1
1
  import { CloudSessionContext } from "../contexts/cloud-session-context";
2
2
  import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
3
3
  import { LudeoEvent } from "../../infra/ludeo-event";
4
- import { PoolItemAllocatedPayload } from "../types";
4
+ import { AwsAllocationData, CloudProviderAllocationData } from "../types/cloud";
5
+
6
+ export class PoolItemAllocatedPayload {
7
+ @ValidateNestedType(() => AwsAllocationData)
8
+ allocationData?: CloudProviderAllocationData;
9
+ }
5
10
 
6
11
  export class PoolItemAllocatedEvent extends LudeoEvent {
7
12
  static readonly EVENT_NAME = "cloud-pools.pool-item-allocated";
@@ -1,7 +1,7 @@
1
1
  import { LudeoEvent } from "../../infra/ludeo-event";
2
2
  import { PoolContext } from "../contexts/pool-context";
3
- import { CloudPool } from "../models/cloud-pool";
4
3
  import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
4
+ import { CloudPool } from "../types/pools";
5
5
 
6
6
  export class PoolUpdatedEvent extends LudeoEvent {
7
7
  static readonly EVENT_NAME = "cloud-pools.pool-updated";
package/src/v2/index.ts CHANGED
@@ -1,4 +1,3 @@
1
+ export * as Types from "./types";
1
2
  export * as Contexts from "./contexts";
2
- export * as Models from "./models";
3
3
  export * as Events from "./events";
4
- export * as Types from "./types";
@@ -0,0 +1,89 @@
1
+ import { GameCast } from "@ludeo/aws-gamecast-sdk";
2
+ import {
3
+ IsDefined,
4
+ IsNotEmpty,
5
+ IsOptional,
6
+ IsString,
7
+ IsUUID,
8
+ } from "class-validator";
9
+ import { ValidateNestedType } from "../../decorators";
10
+
11
+ export class AWSRequestData {
12
+ @IsString()
13
+ @IsNotEmpty()
14
+ signalRequest: string;
15
+ }
16
+
17
+ export type CloudProviderRequest = AWSRequestData;
18
+
19
+ export class CloudProviderRequestData {
20
+ @IsUUID()
21
+ authToken: string;
22
+
23
+ @IsUUID()
24
+ appToken: string;
25
+
26
+ @IsDefined()
27
+ @ValidateNestedType(() => AWSRequestData)
28
+ cloudProviderRequest: CloudProviderRequest;
29
+ }
30
+
31
+ export enum CloudProvider {
32
+ AWS = "aws",
33
+ }
34
+
35
+ export class AWSResourceCreationConfig {
36
+ streamGroupId: string;
37
+ identifier: GameCast.Identifier;
38
+ additionalEnvironmentVariables?: GameCast.EnvironmentVariables;
39
+ protocol?: GameCast.Protocol;
40
+ connectionTimeoutSeconds?: GameCast.ConnectionTimeoutSeconds;
41
+ sessionLengthSeconds?: GameCast.SessionLengthSeconds;
42
+ applicationIdentifier?: GameCast.Identifier;
43
+ region?: string;
44
+ }
45
+
46
+ export type CloudResourceCreationConfig = AWSResourceCreationConfig;
47
+
48
+ export class AwsAllocationData {
49
+ @IsString()
50
+ streamGroupId: string;
51
+
52
+ @IsString()
53
+ streamSessionId: string;
54
+
55
+ @IsString()
56
+ signalResponse: string;
57
+ }
58
+
59
+ export type CloudProviderAllocationData = AwsAllocationData;
60
+
61
+ export class AWSResourceProviderSettings {
62
+ @IsString()
63
+ streamSessionId: string;
64
+
65
+ @IsString()
66
+ streamGroupId: string;
67
+ }
68
+
69
+ export class AWSCreationResponse {
70
+ @IsOptional()
71
+ signalResponse?: GameCast.SignalResponse;
72
+
73
+ @IsString()
74
+ @IsNotEmpty()
75
+ streamSessionId: string;
76
+ }
77
+
78
+ export type CreationResponse = AWSCreationResponse;
79
+
80
+ export class AllocationRequestData {
81
+ @IsString()
82
+ authToken: string;
83
+
84
+ @IsString()
85
+ appToken: string;
86
+
87
+ @ValidateNestedType(() => CloudProviderRequestData)
88
+ cloudProviderRequest: CloudProviderRequest;
89
+ }
@@ -1,139 +1,2 @@
1
- import {
2
- IsDefined,
3
- IsUUID,
4
- IsString,
5
- IsNotEmpty,
6
- IsOptional,
7
- IsNumber,
8
- IsEnum,
9
- } from "class-validator";
10
- import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
11
- import { GameCast } from "@ludeo/aws-gamecast-sdk";
12
-
13
- export class AWSRequestData {
14
- @IsString()
15
- @IsNotEmpty()
16
- signalRequest: string;
17
- }
18
-
19
- export type CloudProviderRequest = AWSRequestData;
20
-
21
- export class CloudProviderRequestData {
22
- @IsUUID()
23
- authToken: string;
24
-
25
- @IsUUID()
26
- appToken: string;
27
-
28
- @IsDefined()
29
- @ValidateNestedType(() => AWSRequestData)
30
- cloudProviderRequest: CloudProviderRequest;
31
- }
32
-
33
- export enum CloudProvider {
34
- AWS = "aws",
35
- }
36
-
37
- export class AWSResourceCreationConfig {
38
- streamGroupId: string;
39
- identifier: GameCast.Identifier;
40
- additionalEnvironmentVariables?: GameCast.EnvironmentVariables;
41
- protocol?: GameCast.Protocol;
42
- connectionTimeoutSeconds?: GameCast.ConnectionTimeoutSeconds;
43
- sessionLengthSeconds?: GameCast.SessionLengthSeconds;
44
- applicationIdentifier?: GameCast.Identifier;
45
- region?: string;
46
- }
47
-
48
- export type CloudResourceCreationConfig = AWSResourceCreationConfig;
49
-
50
- export enum CloudResourceStatus {
51
- Allocated = "allocated",
52
- Available = "available",
53
- Creating = "creating",
54
- Allocating = "allocating",
55
- Error = "error",
56
- Terminated = "terminated",
57
- Terminating = "terminating",
58
- }
59
-
60
- export class AllocateCloudResourceRequestData {
61
- providerSettings: CloudResourceCreationConfig;
62
- requestData: CloudProviderRequestData;
63
- }
64
-
65
- export class AwsAllocationData {
66
- @IsString()
67
- streamGroupId: string;
68
-
69
- @IsString()
70
- streamSessionId: string;
71
-
72
- @IsString()
73
- signalResponse: string;
74
- }
75
-
76
- export type CloudProviderAllocationData = AwsAllocationData;
77
-
78
- export class AWSResourceProviderSettings {
79
- @IsString()
80
- streamSessionId: string;
81
-
82
- @IsString()
83
- streamGroupId: string;
84
- }
85
-
86
- export class AWSCreationResponse {
87
- @IsOptional()
88
- signalResponse?: GameCast.SignalResponse;
89
-
90
- @IsString()
91
- @IsNotEmpty()
92
- streamSessionId: string;
93
- }
94
-
95
- export type CreationResponse = AWSCreationResponse;
96
-
97
- export enum CloudPoolStatus {
98
- Active = "active",
99
- Scaling = "scaling",
100
- Terminated = "terminated",
101
- }
102
-
103
- export class CloudPoolConfiguration {
104
- providerSettings?: CloudResourceCreationConfig;
105
-
106
- @IsEnum(CloudProvider)
107
- cloudProvider: CloudProvider;
108
-
109
- @IsUUID()
110
- poolId: string;
111
-
112
- @ValidateNestedType(() => PoolScaleConfiguration)
113
- poolScaleConfiguration: PoolScaleConfiguration;
114
- }
115
-
116
- export type CloudResourcesMap = Record<string, { status: CloudResourceStatus }>;
117
-
118
- export class PoolScaleConfiguration {
119
- @IsNumber()
120
- size: number;
121
- }
122
-
123
- export class PoolItemAllocatedPayload {
124
- @ValidateNestedType(() => AwsAllocationData)
125
- allocationData?: CloudProviderAllocationData;
126
- }
127
-
128
- export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
129
-
130
- export class AllocationRequestData {
131
- @IsString()
132
- authToken: string;
133
-
134
- @IsString()
135
- appToken: string;
136
-
137
- @ValidateNestedType(() => CloudProviderRequestData)
138
- cloudProviderRequest: CloudProviderRequest;
139
- }
1
+ export * from "./cloud";
2
+ export * from "./pools";
@@ -0,0 +1,50 @@
1
+ import { IsEnum, IsNumber, IsUUID } from "class-validator";
2
+ import { CloudProvider, CloudResourceCreationConfig } from "./cloud";
3
+ import { ValidateNestedType } from "../../decorators";
4
+
5
+ export enum CloudResourceStatus {
6
+ Allocated = "allocated",
7
+ Available = "available",
8
+ Creating = "creating",
9
+ Allocating = "allocating",
10
+ Error = "error",
11
+ Terminated = "terminated",
12
+ Terminating = "terminating",
13
+ }
14
+
15
+ export enum CloudPoolStatus {
16
+ Active = "active",
17
+ Scaling = "scaling",
18
+ Terminated = "terminated",
19
+ }
20
+
21
+ export class PoolScaleConfiguration {
22
+ @IsNumber()
23
+ size: number;
24
+ }
25
+
26
+ export class CloudPoolConfiguration {
27
+ providerSettings?: CloudResourceCreationConfig;
28
+
29
+ @IsEnum(CloudProvider)
30
+ cloudProvider: CloudProvider;
31
+
32
+ @IsUUID()
33
+ poolId: string;
34
+
35
+ @ValidateNestedType(() => PoolScaleConfiguration)
36
+ poolScaleConfiguration: PoolScaleConfiguration;
37
+ }
38
+
39
+ export type CloudResourcesMap = Record<string, { status: CloudResourceStatus }>;
40
+
41
+ export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
42
+
43
+ export class CloudPool {
44
+ id: string;
45
+ status: CloudPoolStatus;
46
+ createdAt: number;
47
+ updatedAt?: number;
48
+ config: CloudPoolConfiguration;
49
+ resources?: CloudResourcesMap;
50
+ }
@@ -1,14 +0,0 @@
1
- import {
2
- CloudPoolConfiguration,
3
- CloudPoolStatus,
4
- CloudResourcesMap,
5
- } from "../types";
6
-
7
- export class CloudPool {
8
- id: string;
9
- status: CloudPoolStatus;
10
- createdAt: number;
11
- updatedAt?: number;
12
- config: CloudPoolConfiguration;
13
- resources?: CloudResourcesMap;
14
- }
@@ -1 +0,0 @@
1
- export * from "./cloud-pool";