Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
b582331
[TIPPI-1198] Add deployment script
botlin Jan 8, 2026
52ffdd0
[TIPPI-1198] Add TealiumAPI and tests
botlin Jan 8, 2026
88d5db8
[TIPPI-1198] Add config file for environment variables
botlin Jan 8, 2026
5b3a938
[TIPPI-1198] Add axios as dependency
botlin Jan 8, 2026
b417495
[TIPPI-1198] Add Payload creation to TealiumAPI and tests
botlin Jan 9, 2026
6904482
[TIPPI-1198] Add src/ to tsconfig.json
botlin Jan 9, 2026
f3dc2ee
[TIPPI-1198] Add GetProfile to TealiumAPI
botlin Jan 12, 2026
fdb2406
[TIPPI-1198] Refactoring tests
botlin Jan 12, 2026
2d59f59
[TIPPI-1198] Add TealiumExtensionDiff logic and tests
botlin Jan 15, 2026
f7659ec
[TIPPI-1198] Smaler type changes
botlin Jan 15, 2026
a04cd02
[TIPPI-1198] Add TealiumDeploymentPipeline and tests
botlin Jan 15, 2026
49393a9
[TIPPI-1198] Add notes and filepath to extension, including tests
botlin Jan 15, 2026
6492776
[TIPPI-1198] Add Status, Occurance and Scope as another update state
botlin Jan 15, 2026
610d4db
[TIPPI-1198] Finished deployment, add code minification
botlin Jan 16, 2026
f29e8c5
[TIPPI-1198] Add Hash to Extension to detect changes. Add Logs
botlin Jan 16, 2026
2059043
[TIPPI-1198] Add Github Workflow
botlin Jan 19, 2026
ef4f1f5
[TIPPI-1198] Fix unit test
botlin Jan 19, 2026
9e37cf7
[TIPPI-1198] Fix unit tests
botlin Jan 19, 2026
60376b8
Update src/tealiumdeployment/TealiumExtensionDiff.ts
botlin Jan 19, 2026
7760c7b
Update src/tealiumdeployment/deployment.ts
botlin Jan 19, 2026
8956d35
Update src/tealiumdeployment/TealiumDeploymentPipeline.ts
botlin Jan 19, 2026
c3dea0e
[TIPPI-1198] Fix tealium_deploymenr.yml
botlin Jan 19, 2026
9782fb5
[TIPPI-1198] Add tests for Extension::getHash
botlin Jan 19, 2026
65f092a
[TIPPI-1198] Fix typos
botlin Jan 19, 2026
43d35ec
[TIPPI-1198] Fix test
botlin Jan 19, 2026
c32edc0
Update src/tealiumdeployment/TealiumDeploymentPipeline.ts
botlin Jan 19, 2026
dca2fa3
[TIPPI-1198] Exclude all remote extensions not supported by type or s…
botlin Jan 19, 2026
585c427
[TIPPI-1198] Last fixes
botlin Jan 19, 2026
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
26 changes: 26 additions & 0 deletions .github/workflows/tealium_deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Mutation Test

on:
workflow_dispatch:

jobs:
mutation-testing:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '24'

- name: Install dependencies
run: yarn install

- name: Run tests
env:
TEALIUM_DEPLOY_ACCOUNT: ${{ secrets.TEALIUM_DEPLOY_ACCOUNT }}
TEALIUM_DEPLOY_USER: ${{ secrets.TEALIUM_DEPLOY_USER }}
TEALIUM_DEPLOY_API_KEY: ${{ secrets.TEALIUM_DEPLOY_API_KEY }}
run: yarn deploy -- "${{ github.sha }}: ${{ github.event.head_commit.message }}"
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"engines": {
"node": "24"
},
"type": "module",
"scripts": {
"prepare": "husky install",
"test": "jest",
Expand All @@ -13,9 +12,13 @@
"format:check": "prettier --check .",
"test:mutation": "stryker run",
"test:mutation:watch": "stryker run --watch",
"test:mutation:incremental": "stryker run --incremental"
"test:mutation:incremental": "stryker run --incremental",
"deploy": "ts-node src/tealiumdeployment/main.ts"
},
"dependencies": {
"axios": "^1.13.2",
"terser": "^5.44.1"
},
"dependencies": {},
"devDependencies": {
"@eslint/js": "^9.19.0",
"@stryker-mutator/core": "^9.4.0",
Expand All @@ -32,6 +35,7 @@
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.7.4",
"ts-jest": "^29.4.5",
"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.48.0"
},
Expand Down
8 changes: 8 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-disable no-process-env */
export const config = {
tealium: {
account: process.env.TEALIUM_DEPLOY_ACCOUNT || '',
user: process.env.TEALIUM_DEPLOY_USER || '',
apiKey: process.env.TEALIUM_DEPLOY_API_KEY || ''
}
};
48 changes: 48 additions & 0 deletions src/tealiumdeployment/Extension.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Extension } from './Extension';
import { TealiumExtension } from './TealiumAPI';

describe('Extension', () => {
it('can be created from remote', () => {
const tealiumResponse: TealiumExtension = {
id: 7,
name: 'test-extension',
extensionId: '123',
extenstionType: 'Javascript Code',
notes: 'A test note',
scope: 'After Load Rules',
configuration: {
code: 'console.log("Hello World");'
}
};
const extension = Extension.fromRemote(tealiumResponse);
expect(extension.name).toBe('test-extension');
expect(extension.id).toBe(7);
expect(extension.code).toBe('console.log("Hello World");');
expect(extension.getNotes()).toBe('A test note');
expect(extension.getFilepath()).toBe('');
});

it('can be created from local', () => {
const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");');

expect(extension.name).toBe('test-extension');
expect(extension.id).toBe(123);
expect(extension.code).toBe('console.log("test");');
expect(extension.getNotes()).toBe('');
});

it('can have a filepath set', () => {
const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");');
expect(extension.getFilepath()).toBe('');
extension.setFilePath('./extension/test.js');
expect(extension.getFilepath()).toBe('./extension/test.js');
});

it('can have notes set', () => {
const extension = Extension.fromLocal(123, 'test-extension', 'console.log("test");');

expect(extension.getNotes()).toBe('');
extension.setNotes('An example note');
expect(extension.getNotes()).toBe('An example note');
});
});
84 changes: 84 additions & 0 deletions src/tealiumdeployment/Extension.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { Occurrence, Status, TealiumExtension, Scope } from './TealiumAPI';
import crypto from 'node:crypto';

export class Extension {

static fromRemote(data: TealiumExtension): Extension {
const code = data.configuration.code;
const extension = new Extension(data.name, code, data.id);
extension.setNotes(data.notes);
return extension;
}

static fromLocal(id: number, name: string, code: string) {
return new Extension(name, code, id);
}

private filepath: string;
private notes: string;
private scope: Scope;
private occurrence: Occurrence;
private status: Status;

private constructor(
public readonly name: string,
public readonly code: string,
public readonly id?: number
) {
this.notes = '';
this.filepath = '';
this.scope = Scope.AfterLoadRules;
this.occurrence = Occurrence.RunAlways;
this.status = Status.Active;
}

setScope(scope: Scope) {
this.scope = scope;
}

getScope(): Scope {
return this.scope;
}

setNotes(notes: string) {
this.notes = notes;
}

getNotes(): string {
return this.notes;
}

getFilepath(): string {
return this.filepath;
}

setFilePath(filepath: string) {
this.filepath = filepath;
}

setOccurrence(occurrence: Occurrence) {
this.occurrence = occurrence;
}

getOccurrence() {
return this.occurrence;
}

setStatus(status: Status) {
this.status = status;
}

getStatus(): Status {
return this.status;
}

getHash() {
const content = {
code: this.code,
scope: this.scope,
status: this.status,
occurrence: this.status
};
return crypto.createHash('sha256').update(JSON.stringify(content)).digest('hex');
}
}
Loading
Loading