Skip to content

Commit

Permalink
fix: Assignment should use relative imports (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyiuhc authored Aug 14, 2023
1 parent f470fdf commit bdb9703
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
7 changes: 4 additions & 3 deletions packages/node/src/assignment/assignment-filter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Assignment, AssignmentFilter } from 'src/assignment/assignment';
import { DAY_MILLIS } from 'src/assignment/assignment-service';
import { Cache } from 'src/util/cache';
import { Cache } from '../util/cache';

import { Assignment, AssignmentFilter } from './assignment';
import { DAY_MILLIS } from './assignment-service';

export class InMemoryAssignmentFilter implements AssignmentFilter {
private readonly cache: Cache<number>;
Expand Down
10 changes: 4 additions & 6 deletions packages/node/src/assignment/assignment-service.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { BaseEvent } from '@amplitude/analytics-types';
import { CoreClient } from '@amplitude/analytics-types';
import {
Assignment,
AssignmentFilter,
AssignmentService,
} from 'src/assignment/assignment';
import { hashCode } from 'src/util/hash';

import { hashCode } from '../util/hash';

import { Assignment, AssignmentFilter, AssignmentService } from './assignment';

export const DAY_MILLIS = 24 * 60 * 60 * 1000;
export const FLAG_TYPE_MUTUAL_EXCLUSION_GROUP = 'mutual-exclusion-group';
Expand Down
4 changes: 2 additions & 2 deletions packages/node/src/assignment/assignment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExperimentUser } from 'src/types/user';
import { Results } from 'src/types/variant';
import { ExperimentUser } from '../types/user';
import { Results } from '../types/variant';

export interface AssignmentService {
track(assignment: Assignment): Promise<void>;
Expand Down
8 changes: 4 additions & 4 deletions packages/node/src/local/client.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as amplitude from '@amplitude/analytics-node';
import evaluation from '@amplitude/evaluation-js';
import { Assignment, AssignmentService } from 'src/assignment/assignment';
import { InMemoryAssignmentFilter } from 'src/assignment/assignment-filter';

import { Assignment, AssignmentService } from '../assignment/assignment';
import { InMemoryAssignmentFilter } from '../assignment/assignment-filter';
import {
AmplitudeAssignmentService,
FLAG_TYPE_HOLDOUT_GROUP,
FLAG_TYPE_MUTUAL_EXCLUSION_GROUP,
} from 'src/assignment/assignment-service';

} from '../assignment/assignment-service';
import { FetchHttpClient } from '../transport/http';
import {
AssignmentConfig,
Expand Down
8 changes: 4 additions & 4 deletions packages/node/test/local/assignment/assignment-filter.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Assignment } from 'src/assignment/assignment';
import { InMemoryAssignmentFilter } from 'src/assignment/assignment-filter';
import { ExperimentUser } from 'src/types/user';
import { sleep } from 'src/util/time';
import { Assignment } from '../../../../node/src/assignment/assignment';
import { InMemoryAssignmentFilter } from '../../../../node/src/assignment/assignment-filter';
import { ExperimentUser } from '../../../../node/src/types/user';
import { sleep } from '../../../../node/src/util/time';

test('filter - single assignment', async () => {
const user: ExperimentUser = { user_id: 'user' };
Expand Down
12 changes: 8 additions & 4 deletions packages/node/test/local/assignment/assignment-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import * as amplitude from '@amplitude/analytics-node';
import { Assignment, AssignmentFilter } from 'src/assignment/assignment';

import {
Assignment,
AssignmentFilter,
} from '../../../../node/src/assignment/assignment';
import {
AmplitudeAssignmentService,
DAY_MILLIS,
} from 'src/assignment/assignment-service';
import { ExperimentUser } from 'src/types/user';
import { hashCode } from 'src/util/hash';
} from '../../../../node/src/assignment/assignment-service';
import { ExperimentUser } from '../../../../node/src/types/user';
import { hashCode } from '../../../../node/src/util/hash';

const testFilter: AssignmentFilter = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down

0 comments on commit bdb9703

Please sign in to comment.