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

Measurementplan #258

Merged
merged 10 commits into from
Aug 7, 2023
Merged
19 changes: 18 additions & 1 deletion src/__tests__/elbwalker.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Elbwalker from '../elbwalker';
import { Hooks, IElbwalker, WebDestination, elb } from '../';
import { Data, Hooks, IElbwalker, WebDestination, elb } from '../';
import fs from 'fs';

describe('Elbwalker', () => {
Expand Down Expand Up @@ -443,4 +443,21 @@ describe('Elbwalker', () => {
}),
);
});

test('Contract', () => {
const contract: Data.Contract = {
version: '',
globals: {
pagegroup: {
type: 'string',
values: [2, '2', []],
},
pagetype: {},
},
context: {},
entities: {},
};

expect(contract).toBeDefined();
});
});
58 changes: 58 additions & 0 deletions src/types/data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Walker } from './walker';

export namespace Data {
export interface Contract {
version: string;
globals: Globals;
context: Contexts;
entities: Entities;
// @TODO data as ref
}

interface Globals {
[name: string]: Global;
}

interface Contexts {
[name: string]: Context;
}

interface Entities {
[name: string]: Entity;
}

interface Properties {
[name: string]: Property;
}

interface Global extends Property {}

interface Context extends Property {}

interface Entity {
data: Properties;
actions: Actions;
}

interface Actions {
[name: string]: Action;
}

interface Action {
trigger?: Trigger;
}

type Trigger = string; // @TODO change to Walker.Trigger once updated

interface Property {
type?: PropertyType; // @TODO support multiple
required?: boolean;
values?: PropertyValues;
}

type PropertyType = 'boolean' | 'string' | 'number';

type PropertyValues = Array<Walker.Property>;

interface PropertyValue {}
}
1 change: 1 addition & 0 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './data';
export * from './destinations';
export * from './elbwalker';
export * from './globals';
Expand Down