Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add travel pass schemas #620

Open
wants to merge 4 commits into
base: develop_debrecated
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion maas-schemas-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maas-schemas-ts",
"version": "14.21.0",
"version": "14.22.0",
"description": "TypeScript types and io-ts validators for maas-schemas",
"main": "index.js",
"files": [
Expand Down
97 changes: 97 additions & 0 deletions maas-schemas-ts/src/maas-backend/core/travel-pass-log.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*

undefined
Travel pass log component

!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!!
See https://www.npmjs.com/package/io-ts-from-json-schema

*/

import * as t from 'io-ts';
import * as Units_ from '../../core/components/units';

export type Defined = {} | null;
export class DefinedType extends t.Type<Defined> {
readonly _tag: 'DefinedType' = 'DefinedType';
constructor() {
super(
'defined',
(u): u is Defined => typeof u !== 'undefined',
(u, c) => (this.is(u) ? t.success(u) : t.failure(u, c)),
t.identity,
);
}
}
export interface DefinedC extends DefinedType {}
export const Defined: DefinedC = new DefinedType();

export const schemaId = 'http://maasglobal.com/maas-backend/core/travel-pass-log.json';

// TravelPassLog
// The default export. More information at the top.
export type TravelPassLog = t.Branded<
{
id?: Units_.Uuid;
passId?: Units_.Uuid;
detail?: Record<string, unknown>;
created?: Units_.Time;
} & {
id: Defined;
passId: Defined;
},
TravelPassLogBrand
>;
export type TravelPassLogC = t.BrandC<
t.IntersectionC<
[
t.PartialC<{
id: typeof Units_.Uuid;
passId: typeof Units_.Uuid;
detail: t.UnknownRecordC;
created: typeof Units_.Time;
}>,
t.TypeC<{
id: typeof Defined;
passId: typeof Defined;
}>,
]
>,
TravelPassLogBrand
>;
export const TravelPassLog: TravelPassLogC = t.brand(
t.intersection([
t.partial({
id: Units_.Uuid,
passId: Units_.Uuid,
detail: t.UnknownRecord,
created: Units_.Time,
}),
t.type({
id: Defined,
passId: Defined,
}),
]),
(
x,
): x is t.Branded<
{
id?: Units_.Uuid;
passId?: Units_.Uuid;
detail?: Record<string, unknown>;
created?: Units_.Time;
} & {
id: Defined;
passId: Defined;
},
TravelPassLogBrand
> => true,
'TravelPassLog',
);
export interface TravelPassLogBrand {
readonly TravelPassLog: unique symbol;
}

export default TravelPassLog;

// Success
113 changes: 113 additions & 0 deletions maas-schemas-ts/src/maas-backend/core/travel-pass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*

undefined
Travel pass component

!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!!
See https://www.npmjs.com/package/io-ts-from-json-schema

*/

import * as t from 'io-ts';
import * as Units_ from '../../core/components/units';

export type Defined = {} | null;
export class DefinedType extends t.Type<Defined> {
readonly _tag: 'DefinedType' = 'DefinedType';
constructor() {
super(
'defined',
(u): u is Defined => typeof u !== 'undefined',
(u, c) => (this.is(u) ? t.success(u) : t.failure(u, c)),
t.identity,
);
}
}
export interface DefinedC extends DefinedType {}
export const Defined: DefinedC = new DefinedType();

export const schemaId = 'http://maasglobal.com/maas-backend/core/travel-pass.json';

// TravelPass
// The default export. More information at the top.
export type TravelPass = t.Branded<
{
id?: Units_.Uuid;
identityId?: Units_.IdentityId;
type?: string;
number?: string;
created?: Units_.Time;
modified?: Units_.Time;
} & {
id: Defined;
identityId: Defined;
type: Defined;
number: Defined;
},
TravelPassBrand
>;
export type TravelPassC = t.BrandC<
t.IntersectionC<
[
t.PartialC<{
id: typeof Units_.Uuid;
identityId: typeof Units_.IdentityId;
type: t.StringC;
number: t.StringC;
created: typeof Units_.Time;
modified: typeof Units_.Time;
}>,
t.TypeC<{
id: typeof Defined;
identityId: typeof Defined;
type: typeof Defined;
number: typeof Defined;
}>,
]
>,
TravelPassBrand
>;
export const TravelPass: TravelPassC = t.brand(
t.intersection([
t.partial({
id: Units_.Uuid,
identityId: Units_.IdentityId,
type: t.string,
number: t.string,
created: Units_.Time,
modified: Units_.Time,
}),
t.type({
id: Defined,
identityId: Defined,
type: Defined,
number: Defined,
}),
]),
(
x,
): x is t.Branded<
{
id?: Units_.Uuid;
identityId?: Units_.IdentityId;
type?: string;
number?: string;
created?: Units_.Time;
modified?: Units_.Time;
} & {
id: Defined;
identityId: Defined;
type: Defined;
number: Defined;
},
TravelPassBrand
> => true,
'TravelPass',
);
export interface TravelPassBrand {
readonly TravelPass: unique symbol;
}

export default TravelPass;

// Success
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*

undefined
Insert a new travel pass

!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!!
See https://www.npmjs.com/package/io-ts-from-json-schema

*/

import * as t from 'io-ts';
import * as Units_ from '../../../../core/components/units';
import * as ApiCommon_ from '../../../../core/components/api-common';

export type Defined = {} | null;
export class DefinedType extends t.Type<Defined> {
readonly _tag: 'DefinedType' = 'DefinedType';
constructor() {
super(
'defined',
(u): u is Defined => typeof u !== 'undefined',
(u, c) => (this.is(u) ? t.success(u) : t.failure(u, c)),
t.identity,
);
}
}
export interface DefinedC extends DefinedType {}
export const Defined: DefinedC = new DefinedType();

export const schemaId =
'http://maasglobal.com/maas-backend/customers/travel-pass/create/request.json';

// Request
// The default export. More information at the top.
export type Request = t.Branded<
{
identityId?: Units_.IdentityId;
customerId?: Units_.IdentityId;
payload?: {
type?: string;
number?: string;
};
headers?: ApiCommon_.Headers;
} & {
identityId: Defined;
customerId: Defined;
payload: Defined;
headers: Defined;
},
RequestBrand
>;
export type RequestC = t.BrandC<
t.IntersectionC<
[
t.PartialC<{
identityId: typeof Units_.IdentityId;
customerId: typeof Units_.IdentityId;
payload: t.PartialC<{
type: t.StringC;
number: t.StringC;
}>;
headers: typeof ApiCommon_.Headers;
}>,
t.TypeC<{
identityId: typeof Defined;
customerId: typeof Defined;
payload: typeof Defined;
headers: typeof Defined;
}>,
]
>,
RequestBrand
>;
export const Request: RequestC = t.brand(
t.intersection([
t.partial({
identityId: Units_.IdentityId,
customerId: Units_.IdentityId,
payload: t.partial({
type: t.string,
number: t.string,
}),
headers: ApiCommon_.Headers,
}),
t.type({
identityId: Defined,
customerId: Defined,
payload: Defined,
headers: Defined,
}),
]),
(
x,
): x is t.Branded<
{
identityId?: Units_.IdentityId;
customerId?: Units_.IdentityId;
payload?: {
type?: string;
number?: string;
};
headers?: ApiCommon_.Headers;
} & {
identityId: Defined;
customerId: Defined;
payload: Defined;
headers: Defined;
},
RequestBrand
> => true,
'Request',
);
export interface RequestBrand {
readonly Request: unique symbol;
}

export default Request;

// Success
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*

undefined
Insert travel pass response

!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!!
See https://www.npmjs.com/package/io-ts-from-json-schema

*/

import * as t from 'io-ts';
import * as TravelPass_ from '../../../core/travel-pass';

export const schemaId =
'http://maasglobal.com/maas-backend/customers/travel-pass/create/response.json';

// Response
// The default export. More information at the top.
export type Response = t.Branded<
{
travelPass?: TravelPass_.TravelPass;
},
ResponseBrand
>;
export type ResponseC = t.BrandC<
t.PartialC<{
travelPass: typeof TravelPass_.TravelPass;
}>,
ResponseBrand
>;
export const Response: ResponseC = t.brand(
t.partial({
travelPass: TravelPass_.TravelPass,
}),
(
x,
): x is t.Branded<
{
travelPass?: TravelPass_.TravelPass;
},
ResponseBrand
> => true,
'Response',
);
export interface ResponseBrand {
readonly Response: unique symbol;
}

export default Response;

// Success
Loading