-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
902 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
186 changes: 186 additions & 0 deletions
186
maas-schemas-ts/src/maas-backend/subscriptions/subscription-intent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
/* | ||
undefined | ||
MaaS subscription intent schema | ||
!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import * as State_ from 'maas-schemas-ts/core/components/state'; | ||
import * as Units_ from 'maas-schemas-ts/core/components/units'; | ||
import * as StateLog_ from 'maas-schemas-ts/core/components/state-log'; | ||
|
||
type Defined = | ||
| Record<string, unknown> | ||
| Array<unknown> | ||
| string | ||
| boolean | ||
| number | ||
| null; | ||
const Defined = t.union([ | ||
t.UnknownRecord, | ||
t.UnknownArray, | ||
t.string, | ||
t.boolean, | ||
t.number, | ||
t.null, | ||
]); | ||
|
||
export const schemaId = | ||
'http://maasglobal.com/maas-backend/subscriptions/subscription-intent.json'; | ||
|
||
// ItemId | ||
// The purpose of this remains a mystery | ||
export type ItemId = t.Branded<string, ItemIdBrand>; | ||
export const ItemId = t.brand( | ||
t.string, | ||
(x): x is t.Branded<string, ItemIdBrand> => | ||
(typeof x !== 'string' || x.length >= 1) && | ||
(typeof x !== 'string' || x.length <= 255), | ||
'ItemId', | ||
); | ||
export interface ItemIdBrand { | ||
readonly ItemId: unique symbol; | ||
} | ||
|
||
// SubscriptionIntentCreate | ||
// The purpose of this remains a mystery | ||
export type SubscriptionIntentCreate = t.Branded< | ||
{ | ||
planId?: ItemId; | ||
planAddons?: Array<ItemId>; | ||
state?: State_.SubscriptionIntentState; | ||
startTime?: Units_.Time; | ||
} & { | ||
planId: Defined; | ||
planAddons: Defined; | ||
}, | ||
SubscriptionIntentCreateBrand | ||
>; | ||
export const SubscriptionIntentCreate = t.brand( | ||
t.intersection([ | ||
t.partial({ | ||
planId: ItemId, | ||
planAddons: t.array(ItemId), | ||
state: State_.SubscriptionIntentState, | ||
startTime: Units_.Time, | ||
}), | ||
t.type({ | ||
planId: Defined, | ||
planAddons: Defined, | ||
}), | ||
]), | ||
( | ||
x, | ||
): x is t.Branded< | ||
{ | ||
planId?: ItemId; | ||
planAddons?: Array<ItemId>; | ||
state?: State_.SubscriptionIntentState; | ||
startTime?: Units_.Time; | ||
} & { | ||
planId: Defined; | ||
planAddons: Defined; | ||
}, | ||
SubscriptionIntentCreateBrand | ||
> => true, | ||
'SubscriptionIntentCreate', | ||
); | ||
export interface SubscriptionIntentCreateBrand { | ||
readonly SubscriptionIntentCreate: unique symbol; | ||
} | ||
|
||
// SubscriptionIntentBase | ||
// The purpose of this remains a mystery | ||
export type SubscriptionIntentBase = t.Branded< | ||
{ | ||
id?: Units_.Uuid; | ||
identityId?: Units_.IdentityId; | ||
subscriptionId?: Units_.IdentityId; | ||
nextPlanId?: ItemId; | ||
nextPlanAddons?: Array<ItemId>; | ||
prevPlanId?: ItemId; | ||
prevPlanAddons?: Array<ItemId>; | ||
startTime?: Units_.Time; | ||
state?: State_.SubscriptionIntentState; | ||
stateLog?: StateLog_.StateLog; | ||
created?: Units_.Time; | ||
modified?: Units_.Time; | ||
} & { | ||
identityId: Defined; | ||
subscriptionId: Defined; | ||
nextPlanId: Defined; | ||
nextPlanAddons: Defined; | ||
}, | ||
SubscriptionIntentBaseBrand | ||
>; | ||
export const SubscriptionIntentBase = t.brand( | ||
t.intersection([ | ||
t.partial({ | ||
id: Units_.Uuid, | ||
identityId: Units_.IdentityId, | ||
subscriptionId: Units_.IdentityId, | ||
nextPlanId: ItemId, | ||
nextPlanAddons: t.array(ItemId), | ||
prevPlanId: ItemId, | ||
prevPlanAddons: t.array(ItemId), | ||
startTime: Units_.Time, | ||
state: State_.SubscriptionIntentState, | ||
stateLog: StateLog_.StateLog, | ||
created: Units_.Time, | ||
modified: Units_.Time, | ||
}), | ||
t.type({ | ||
identityId: Defined, | ||
subscriptionId: Defined, | ||
nextPlanId: Defined, | ||
nextPlanAddons: Defined, | ||
}), | ||
]), | ||
( | ||
x, | ||
): x is t.Branded< | ||
{ | ||
id?: Units_.Uuid; | ||
identityId?: Units_.IdentityId; | ||
subscriptionId?: Units_.IdentityId; | ||
nextPlanId?: ItemId; | ||
nextPlanAddons?: Array<ItemId>; | ||
prevPlanId?: ItemId; | ||
prevPlanAddons?: Array<ItemId>; | ||
startTime?: Units_.Time; | ||
state?: State_.SubscriptionIntentState; | ||
stateLog?: StateLog_.StateLog; | ||
created?: Units_.Time; | ||
modified?: Units_.Time; | ||
} & { | ||
identityId: Defined; | ||
subscriptionId: Defined; | ||
nextPlanId: Defined; | ||
nextPlanAddons: Defined; | ||
}, | ||
SubscriptionIntentBaseBrand | ||
> => true, | ||
'SubscriptionIntentBase', | ||
); | ||
export interface SubscriptionIntentBaseBrand { | ||
readonly SubscriptionIntentBase: unique symbol; | ||
} | ||
|
||
// SubscriptionIntent | ||
// The default export. More information at the top. | ||
export type SubscriptionIntent = t.Branded<unknown, SubscriptionIntentBrand>; | ||
export const SubscriptionIntent = t.brand( | ||
t.unknown, | ||
(x): x is t.Branded<unknown, SubscriptionIntentBrand> => true, | ||
'SubscriptionIntent', | ||
); | ||
export interface SubscriptionIntentBrand { | ||
readonly SubscriptionIntent: unique symbol; | ||
} | ||
|
||
export default SubscriptionIntent; | ||
|
||
// Success |
86 changes: 86 additions & 0 deletions
86
maas-schemas-ts/src/maas-backend/subscriptions/subscriptions-intents-create/request.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
undefined | ||
Request schema for subscriptions-intents-create | ||
!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!! | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import * as Units_ from 'maas-schemas-ts/core/components/units'; | ||
import * as SubscriptionIntent_ from 'maas-schemas-ts/maas-backend/subscriptions/subscription-intent'; | ||
import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common'; | ||
|
||
type Defined = | ||
| Record<string, unknown> | ||
| Array<unknown> | ||
| string | ||
| boolean | ||
| number | ||
| null; | ||
const Defined = t.union([ | ||
t.UnknownRecord, | ||
t.UnknownArray, | ||
t.string, | ||
t.boolean, | ||
t.number, | ||
t.null, | ||
]); | ||
|
||
export const schemaId = | ||
'http://maasglobal.com/maas-backend/subscriptions/subscriptions-intents-create/request.json'; | ||
|
||
// Request | ||
// The default export. More information at the top. | ||
export type Request = t.Branded< | ||
{ | ||
customerId?: Units_.IdentityId; | ||
userId?: Units_.IdentityId; | ||
payload?: SubscriptionIntent_.SubscriptionIntentCreate; | ||
headers?: ApiCommon_.Headers; | ||
} & { | ||
customerId: Defined; | ||
userId: Defined; | ||
payload: Defined; | ||
}, | ||
RequestBrand | ||
>; | ||
export const Request = t.brand( | ||
t.intersection([ | ||
t.partial({ | ||
customerId: Units_.IdentityId, | ||
userId: Units_.IdentityId, | ||
payload: SubscriptionIntent_.SubscriptionIntentCreate, | ||
headers: ApiCommon_.Headers, | ||
}), | ||
t.type({ | ||
customerId: Defined, | ||
userId: Defined, | ||
payload: Defined, | ||
}), | ||
]), | ||
( | ||
x, | ||
): x is t.Branded< | ||
{ | ||
customerId?: Units_.IdentityId; | ||
userId?: Units_.IdentityId; | ||
payload?: SubscriptionIntent_.SubscriptionIntentCreate; | ||
headers?: ApiCommon_.Headers; | ||
} & { | ||
customerId: Defined; | ||
userId: Defined; | ||
payload: Defined; | ||
}, | ||
RequestBrand | ||
> => true, | ||
'Request', | ||
); | ||
export interface RequestBrand { | ||
readonly Request: unique symbol; | ||
} | ||
|
||
export default Request; | ||
|
||
// Success |
Oops, something went wrong.