Skip to content

Commit 6b3a907

Browse files
committed
subscriptions list fix
1 parent 282087d commit 6b3a907

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/maas/frontend/src/app/api/subscriptions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ const isMaaSSubscriptionRef = (v: unknown): v is ModelSubscriptionRef =>
1414
isRecord(v) &&
1515
typeof v.name === 'string' &&
1616
typeof v.namespace === 'string' &&
17-
Array.isArray(v.tokenRateLimits) &&
18-
v.tokenRateLimits.every(isTokenRateLimit) &&
17+
(v.tokenRateLimits === undefined ||
18+
(Array.isArray(v.tokenRateLimits) && v.tokenRateLimits.every(isTokenRateLimit))) &&
1919
(v.tokenRateLimitRef === undefined || typeof v.tokenRateLimitRef === 'string') &&
2020
(v.billingRate === undefined || typeof v.billingRate === 'object');
2121

2222
const isMaaSSubscription = (v: unknown): v is MaaSSubscription =>
2323
isRecord(v) &&
2424
typeof v.name === 'string' &&
2525
typeof v.namespace === 'string' &&
26-
typeof v.phase === 'string' &&
26+
(v.phase === undefined || typeof v.phase === 'string') &&
2727
(v.priority === undefined || typeof v.priority === 'number') &&
2828
typeof v.owner === 'object' &&
2929
Array.isArray(v.modelRefs) &&
3030
v.modelRefs.every(isMaaSSubscriptionRef) &&
3131
(v.tokenMetadata === undefined || typeof v.tokenMetadata === 'object') &&
32-
typeof v.creationTimestamp === 'string';
32+
(v.creationTimestamp === undefined || typeof v.creationTimestamp === 'string');
3333
const isTokenRateLimit = (v: unknown): v is TokenRateLimit =>
3434
isRecord(v) && typeof v.limit === 'number' && typeof v.window === 'string';
3535

packages/maas/frontend/src/app/types/subscriptions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
export type MaaSSubscription = {
22
name: string;
33
namespace: string;
4-
phase: string;
4+
phase?: string;
55
priority?: number;
66
owner: OwnerSpec;
77
modelRefs: ModelSubscriptionRef[];
88
tokenMetadata?: TokenMetadata;
9-
creationTimestamp: string;
9+
creationTimestamp?: string;
1010
};
1111

1212
export type ModelSubscriptionRef = {
1313
name: string;
1414
namespace: string;
15-
tokenRateLimits: TokenRateLimit[];
15+
tokenRateLimits?: TokenRateLimit[];
1616
tokenRateLimitRef?: string;
1717
billingRate?: BillingRate;
1818
};

0 commit comments

Comments
 (0)