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

virtual-card-processing #568

Open
wants to merge 2 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
7 changes: 5 additions & 2 deletions maas-schemas-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "maas-schemas-ts",
"version": "14.11.6",
"name": "@maasglobal/maas-schemas-ts",
"publishConfig": {
"registry": "https://npm.deployment.maas.global/repository/npm-maas/"
},
"version": "14.12.0-rc7",
"description": "TypeScript types and io-ts validators for maas-schemas",
"main": "index.js",
"files": [
Expand Down
202 changes: 202 additions & 0 deletions maas-schemas-ts/src/aws/s3/event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
/*

undefined
AWS S3 Event JSON Payload

!!! 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 const schemaId = 'http://maasglobal.com/aws/s3/event.json';

// S3Event
// The default export. More information at the top.
export type S3Event = t.Branded<
{
eventVersion?: number;
eventSource?: string & 'aws:s3';
awsRegion?: string;
eventTime?: Units_.IsoDateTime;
eventName?: unknown;
userIdentity?: {
principalId?: string;
};
requestParameters?: {
sourceIPAddress?: string;
};
responseElements?: {
'x-amz-request-id'?: string;
'x-amz-id-2'?: string;
};
s3?: {
s3SchemaVersion?: number;
configurationId?: string;
bucket?: {
name?: string;
ownerIdentity?: {
principalId?: string;
};
arn?: Units_.Arn;
};
object?: {
key?: string;
size?: number;
eTag?: string;
versionId?: string;
sequencer?: string;
};
};
glacierEventData?: {
restoreEventData?: {
lifecycleRestorationExpiryTime?: Units_.IsoDateTime;
lifecycleRestoreStorageClass?: string;
};
};
},
S3EventBrand
>;
export type S3EventC = t.BrandC<
t.PartialC<{
eventVersion: t.NumberC;
eventSource: t.IntersectionC<[t.StringC, t.LiteralC<'aws:s3'>]>;
awsRegion: t.StringC;
eventTime: typeof Units_.IsoDateTime;
eventName: t.UnknownC;
userIdentity: t.PartialC<{
principalId: t.StringC;
}>;
requestParameters: t.PartialC<{
sourceIPAddress: t.StringC;
}>;
responseElements: t.PartialC<{
'x-amz-request-id': t.StringC;
'x-amz-id-2': t.StringC;
}>;
s3: t.PartialC<{
s3SchemaVersion: t.NumberC;
configurationId: t.StringC;
bucket: t.PartialC<{
name: t.StringC;
ownerIdentity: t.PartialC<{
principalId: t.StringC;
}>;
arn: typeof Units_.Arn;
}>;
object: t.PartialC<{
key: t.StringC;
size: t.NumberC;
eTag: t.StringC;
versionId: t.StringC;
sequencer: t.StringC;
}>;
}>;
glacierEventData: t.PartialC<{
restoreEventData: t.PartialC<{
lifecycleRestorationExpiryTime: typeof Units_.IsoDateTime;
lifecycleRestoreStorageClass: t.StringC;
}>;
}>;
}>,
S3EventBrand
>;
export const S3Event: S3EventC = t.brand(
t.partial({
eventVersion: t.number,
eventSource: t.intersection([t.string, t.literal('aws:s3')]),
awsRegion: t.string,
eventTime: Units_.IsoDateTime,
eventName: t.unknown,
userIdentity: t.partial({
principalId: t.string,
}),
requestParameters: t.partial({
sourceIPAddress: t.string,
}),
responseElements: t.partial({
'x-amz-request-id': t.string,
'x-amz-id-2': t.string,
}),
s3: t.partial({
s3SchemaVersion: t.number,
configurationId: t.string,
bucket: t.partial({
name: t.string,
ownerIdentity: t.partial({
principalId: t.string,
}),
arn: Units_.Arn,
}),
object: t.partial({
key: t.string,
size: t.number,
eTag: t.string,
versionId: t.string,
sequencer: t.string,
}),
}),
glacierEventData: t.partial({
restoreEventData: t.partial({
lifecycleRestorationExpiryTime: Units_.IsoDateTime,
lifecycleRestoreStorageClass: t.string,
}),
}),
}),
(
x,
): x is t.Branded<
{
eventVersion?: number;
eventSource?: string & 'aws:s3';
awsRegion?: string;
eventTime?: Units_.IsoDateTime;
eventName?: unknown;
userIdentity?: {
principalId?: string;
};
requestParameters?: {
sourceIPAddress?: string;
};
responseElements?: {
'x-amz-request-id'?: string;
'x-amz-id-2'?: string;
};
s3?: {
s3SchemaVersion?: number;
configurationId?: string;
bucket?: {
name?: string;
ownerIdentity?: {
principalId?: string;
};
arn?: Units_.Arn;
};
object?: {
key?: string;
size?: number;
eTag?: string;
versionId?: string;
sequencer?: string;
};
};
glacierEventData?: {
restoreEventData?: {
lifecycleRestorationExpiryTime?: Units_.IsoDateTime;
lifecycleRestoreStorageClass?: string;
};
};
},
S3EventBrand
> => true,
'S3Event',
);
export interface S3EventBrand {
readonly S3Event: unique symbol;
}

export default S3Event;

// Success
86 changes: 86 additions & 0 deletions maas-schemas-ts/src/aws/sns/notification.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*

undefined
AWS SNS Notification JSON Payload

!!! 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 const schemaId = 'http://maasglobal.com/aws/sns/notification.json';

// SnsNotification
// The default export. More information at the top.
export type SnsNotification = t.Branded<
{
Type?: string & 'Notification';
MessageId?: Units_.Uuid;
TopicArn?: Units_.Arn;
Subject?: string;
Message?: string;
Timestamp?: Units_.IsoDateTime;
SignatureVersion?: number;
Signature?: string;
SigningCertURL?: Units_.Url;
UnsubscribeURL?: Units_.Url;
},
SnsNotificationBrand
>;
export type SnsNotificationC = t.BrandC<
t.PartialC<{
Type: t.IntersectionC<[t.StringC, t.LiteralC<'Notification'>]>;
MessageId: typeof Units_.Uuid;
TopicArn: typeof Units_.Arn;
Subject: t.StringC;
Message: t.StringC;
Timestamp: typeof Units_.IsoDateTime;
SignatureVersion: t.NumberC;
Signature: t.StringC;
SigningCertURL: typeof Units_.Url;
UnsubscribeURL: typeof Units_.Url;
}>,
SnsNotificationBrand
>;
export const SnsNotification: SnsNotificationC = t.brand(
t.partial({
Type: t.intersection([t.string, t.literal('Notification')]),
MessageId: Units_.Uuid,
TopicArn: Units_.Arn,
Subject: t.string,
Message: t.string,
Timestamp: Units_.IsoDateTime,
SignatureVersion: t.number,
Signature: t.string,
SigningCertURL: Units_.Url,
UnsubscribeURL: Units_.Url,
}),
(
x,
): x is t.Branded<
{
Type?: string & 'Notification';
MessageId?: Units_.Uuid;
TopicArn?: Units_.Arn;
Subject?: string;
Message?: string;
Timestamp?: Units_.IsoDateTime;
SignatureVersion?: number;
Signature?: string;
SigningCertURL?: Units_.Url;
UnsubscribeURL?: Units_.Url;
},
SnsNotificationBrand
> => true,
'SnsNotification',
);
export interface SnsNotificationBrand {
readonly SnsNotification: unique symbol;
}

export default SnsNotification;

// Success
15 changes: 15 additions & 0 deletions maas-schemas-ts/src/core/components/units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,21 @@ export interface IsoDateBrand {
readonly IsoDate: unique symbol;
}

// IsoDateTime
// A date in the form YYYY-MM-DDTHH:MM:SS.mmmZ
export type IsoDateTime = t.Branded<string, IsoDateTimeBrand>;
export type IsoDateTimeC = t.BrandC<t.StringC, IsoDateTimeBrand>;
export const IsoDateTime: IsoDateTimeC = t.brand(
t.string,
(x): x is t.Branded<string, IsoDateTimeBrand> =>
typeof x !== 'string' ||
x.match(RegExp('^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z')) !== null,
'IsoDateTime',
);
export interface IsoDateTimeBrand {
readonly IsoDateTime: unique symbol;
}

// Units
// The default export. More information at the top.
export type Units = t.Branded<unknown, UnitsBrand>;
Expand Down
Loading