Skip to content

Commit 5e9ea75

Browse files
committed
feat: add DRuntime service and view for managing runtime data
1 parent ace3bde commit 5e9ea75

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {ReactiveArrayService, ReactiveArrayStore} from "../../utils/reactiveArrayService";
2+
import {DRuntimeView} from "./DRuntime.view";
3+
import {
4+
RuntimesCreateInput,
5+
RuntimesDeleteInput,
6+
RuntimesRotateTokenInput,
7+
RuntimesUpdateInput,
8+
Scalars
9+
} from "@code0-tech/sagittarius-graphql-types";
10+
11+
export abstract class DRuntimeService extends ReactiveArrayService<DRuntimeView> {
12+
constructor(payload: ReactiveArrayStore<DRuntimeView>) {
13+
super(payload);
14+
}
15+
16+
abstract findById(id: Scalars['RuntimeID']['output']): DRuntimeView | undefined
17+
18+
abstract runtimeCreate(payload: RuntimesCreateInput): DRuntimeView | undefined
19+
20+
abstract runtimeDelete(payload: RuntimesDeleteInput): DRuntimeView | undefined
21+
22+
abstract runtimeRotateToken(payload: RuntimesRotateTokenInput): DRuntimeView | undefined
23+
24+
abstract runtimeUpdate(payload: RuntimesUpdateInput): DRuntimeView | undefined
25+
26+
}
27+
28+
export abstract class DRuntimeReactiveService extends DRuntimeService {
29+
30+
findById(id: Scalars["RuntimeID"]["output"]): DRuntimeView | undefined {
31+
return this.values().find(runtime => runtime.id === id);
32+
}
33+
34+
abstract override runtimeCreate(payload: RuntimesCreateInput): DRuntimeView | undefined
35+
36+
abstract override runtimeDelete(payload: RuntimesDeleteInput): DRuntimeView | undefined
37+
38+
abstract override runtimeRotateToken(payload: RuntimesRotateTokenInput): DRuntimeView | undefined
39+
40+
abstract override runtimeUpdate(payload: RuntimesUpdateInput): DRuntimeView | undefined
41+
42+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import {
2+
DataTypeConnection,
3+
FlowTypeConnection,
4+
Maybe,
5+
Namespace,
6+
NamespaceProjectConnection,
7+
Runtime,
8+
RuntimeStatusType,
9+
Scalars
10+
} from "@code0-tech/sagittarius-graphql-types";
11+
12+
export class DRuntimeView {
13+
14+
/** Time when this Runtime was created */
15+
private readonly _createdAt?: Maybe<Scalars['Time']['output']>;
16+
/** DataTypes of the runtime */
17+
private readonly _dataTypes?: Maybe<DataTypeConnection>;
18+
/** The description for the runtime if present */
19+
private readonly _description?: Maybe<Scalars['String']['output']>;
20+
/** FlowTypes of the runtime */
21+
private readonly _flowTypes?: Maybe<FlowTypeConnection>;
22+
/** Global ID of this Runtime */
23+
private readonly _id?: Maybe<Scalars['RuntimeID']['output']>;
24+
/** The name for the runtime */
25+
private readonly _name?: Maybe<Scalars['String']['output']>;
26+
/** The parent namespace for the runtime */
27+
private readonly _namespace?: Maybe<Namespace>;
28+
/** Projects associated with the runtime */
29+
private readonly _projects?: Maybe<NamespaceProjectConnection>;
30+
/** The status of the runtime */
31+
private readonly _status?: Maybe<RuntimeStatusType>;
32+
/** Token belonging to the runtime, only present on creation */
33+
private readonly _token?: Maybe<Scalars['String']['output']>;
34+
/** Time when this Runtime was last updated */
35+
private readonly _updatedAt?: Maybe<Scalars['Time']['output']>;
36+
37+
constructor(payload: Runtime) {
38+
this._createdAt = payload.createdAt;
39+
this._dataTypes = payload.dataTypes;
40+
this._description = payload.description;
41+
this._flowTypes = payload.flowTypes;
42+
this._id = payload.id;
43+
this._name = payload.name;
44+
this._namespace = payload.namespace;
45+
this._projects = payload.projects;
46+
this._status = payload.status;
47+
this._token = payload.token;
48+
this._updatedAt = payload.updatedAt;
49+
}
50+
51+
get createdAt(): Maybe<Scalars["Time"]["output"]> | undefined {
52+
return this._createdAt;
53+
}
54+
55+
get dataTypes(): Maybe<DataTypeConnection> | undefined {
56+
return this._dataTypes;
57+
}
58+
59+
get description(): Maybe<Scalars["String"]["output"]> | undefined {
60+
return this._description;
61+
}
62+
63+
get flowTypes(): Maybe<FlowTypeConnection> | undefined {
64+
return this._flowTypes;
65+
}
66+
67+
get id(): Maybe<Scalars["RuntimeID"]["output"]> | undefined {
68+
return this._id;
69+
}
70+
71+
get name(): Maybe<Scalars["String"]["output"]> | undefined {
72+
return this._name;
73+
}
74+
75+
get namespace(): Maybe<Namespace> | undefined {
76+
return this._namespace;
77+
}
78+
79+
get projects(): Maybe<NamespaceProjectConnection> | undefined {
80+
return this._projects;
81+
}
82+
83+
get status(): Maybe<RuntimeStatusType> | undefined {
84+
return this._status;
85+
}
86+
87+
get token(): Maybe<Scalars["String"]["output"]> | undefined {
88+
return this._token;
89+
}
90+
91+
get updatedAt(): Maybe<Scalars["Time"]["output"]> | undefined {
92+
return this._updatedAt;
93+
}
94+
}

0 commit comments

Comments
 (0)