Skip to content

Commit

Permalink
Changed to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
lankalana committed Oct 7, 2024
1 parent da38ef8 commit 0629f7c
Show file tree
Hide file tree
Showing 230 changed files with 1,946 additions and 1,807 deletions.
2 changes: 1 addition & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default [
"@typescript-eslint/camelcase": "off",
},

ignores: ["eslint.config.mjs", ".babelrc.js", "**/jest.config.js"],
ignores: ["eslint.config.mjs", "**/jest.config.cjs"],
},
{
files: ["**/*.test.ts"],
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/addCustomAttributes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { USER_POOL_AWS_DEFAULTS } from "../../src/services/cognitoService";
import { withCognitoSdk } from "./setup";
import { USER_POOL_AWS_DEFAULTS } from "../../src/services/cognitoService.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.addCustomAttributes",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/adminConfirmSignUp.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.adminConfirmSignUp",
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/aws-sdk/adminCreateUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { UUID } from "../../src/__tests__/patterns";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { UUID } from "../../src/__tests__/patterns.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/aws-sdk/adminDeleteUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { UserNotFoundError } from "../../src/errors";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { UserNotFoundError } from "../../src/errors.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/adminDeleteUserAttributes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UUID } from "../../src/__tests__/patterns";
import { withCognitoSdk } from "./setup";
import { UUID } from "../../src/__tests__/patterns.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.adminDeleteUserAttributes",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/adminDisableUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.adminDisableUser",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/adminEnableUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.adminEnableUser",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/adminGetUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/aws-sdk/adminInitiateAuth.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import jwt from "jsonwebtoken";
import { UUID } from "../../src/__tests__/patterns";
import { attributeValue } from "../../src/services/userPoolService";
import { withCognitoSdk } from "./setup";
import { UserNotConfirmedException } from "../../src/errors";
import * as jwt from "jsonwebtoken";
import { UUID } from "../../src/__tests__/patterns.js";
import { attributeValue } from "../../src/services/userPoolService.js";
import { withCognitoSdk } from "./setup.js";
import { UserNotConfirmedException } from "../../src/errors.js";

describe(
"CognitoIdentityServiceProvider.adminInitiateAuth",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/adminListGroupsForUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const originalDate = new Date();
const roundedDate = new Date(originalDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/adminRemoveUserFromGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const originalDate = new Date();
const roundedDate = new Date(originalDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/adminSetUserPassword.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/adminUpdateUserAttributes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UUID } from "../../src/__tests__/patterns";
import { withCognitoSdk } from "./setup";
import { UUID } from "../../src/__tests__/patterns.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.adminUpdateUserAttributes",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/changePassword.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.changePassword",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/createGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/createIdentityProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/aws-sdk/createUserPool.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { USER_POOL_AWS_DEFAULTS } from "../../src/services/cognitoService";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { USER_POOL_AWS_DEFAULTS } from "../../src/services/cognitoService.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/createUserPoolClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.createUserPoolClient",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/deleteGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GroupNotFoundError } from "../../src/errors";
import { withCognitoSdk } from "./setup";
import { GroupNotFoundError } from "../../src/errors.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.deleteGroup",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/deleteIdentityProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/deleteUser.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UserNotFoundError } from "../../src/errors";
import { withCognitoSdk } from "./setup";
import { UserNotFoundError } from "../../src/errors.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.deleteUser",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/deleteUserAttributes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UUID } from "../../src/__tests__/patterns";
import { withCognitoSdk } from "./setup";
import { UUID } from "../../src/__tests__/patterns.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.deleteUserAttributes",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/deleteUserPool.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.deleteUserPool",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/deleteUserPoolClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ResourceNotFoundError } from "../../src/errors";
import { withCognitoSdk } from "./setup";
import { ResourceNotFoundError } from "../../src/errors.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.deleteUserPoolClient",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/describeIdentityProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/getGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TestContext } from "../../src/__tests__/testContext";
import { withCognitoSdk } from "./setup";
import { User } from "../../src/services/userPoolService";
import { TestContext } from "../../src/__tests__/testContext.js";
import { withCognitoSdk } from "./setup.js";
import { User } from "../../src/services/userPoolService.js";

describe(
"CognitoIdentityServiceProvider.getUserAttributeVerificationCode",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/getUserPoolMfaConfig.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.getUserPoolMfaConfig",
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/aws-sdk/initiateAuth.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import jwt from "jsonwebtoken";
import { UUID } from "../../src/__tests__/patterns";
import { attributeValue } from "../../src/services/userPoolService";
import { withCognitoSdk } from "./setup";
import { UserNotConfirmedException } from "../../src/errors";
import * as jwt from "jsonwebtoken";
import { UUID } from "../../src/__tests__/patterns.js";
import { attributeValue } from "../../src/services/userPoolService.js";
import { withCognitoSdk } from "./setup.js";
import { UserNotConfirmedException } from "../../src/errors.js";

describe(
"CognitoIdentityServiceProvider.initiateAuth",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/listGroups.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const originalDate = new Date();
const roundedDate = new Date(originalDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/listIdentityProviders.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/listUserPoolClients.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.listUserPoolClients",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/listUserPools.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.listUserPools",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/listUsers.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.listUsers",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/listUsersInGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const originalDate = new Date();
const roundedDate = new Date(originalDate.getTime());
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/respondToAuthChallenge.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.respondToAuthChallenge",
Expand Down
32 changes: 14 additions & 18 deletions integration-tests/aws-sdk/setup.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
import fs from "fs";
import http from "http";
import { pino, type Logger } from "pino";
import { promisify } from "util";
import { createServer } from "../../src";
import { FakeMessageDeliveryService } from "../../src/__tests__/FakeMessageDeliveryService";
import { DefaultConfig } from "../../src/server/config";
import { createServer } from "../../src/index.js";
import { FakeMessageDeliveryService } from "../../src/__tests__/FakeMessageDeliveryService.js";
import { DefaultConfig } from "../../src/server/config.js";
import {
Clock,
DateClock,
MessagesService,
TriggersService,
} from "../../src/services";
import { CognitoServiceFactoryImpl } from "../../src/services/cognitoService";
import { NoOpCache } from "../../src/services/dataStore/cache";
import { DataStoreFactory } from "../../src/services/dataStore/factory";
import { StormDBDataStoreFactory } from "../../src/services/dataStore/stormDb";
import { otp } from "../../src/services/otp";
import { JwtTokenGenerator } from "../../src/services/tokenGenerator";
import { UserPoolServiceFactoryImpl } from "../../src/services/userPoolService";
import { Router } from "../../src/server/Router";
import { CryptoService } from "../../src/services/crypto";
} from "../../src/services/index.js";
import { CognitoServiceFactoryImpl } from "../../src/services/cognitoService.js";
import { NoOpCache } from "../../src/services/dataStore/cache.js";
import { DataStoreFactory } from "../../src/services/dataStore/factory.js";
import { StormDBDataStoreFactory } from "../../src/services/dataStore/stormDb.js";
import { otp } from "../../src/services/otp.js";
import { JwtTokenGenerator } from "../../src/services/tokenGenerator.js";
import { UserPoolServiceFactoryImpl } from "../../src/services/userPoolService.js";
import { Router } from "../../src/server/Router.js";
import { CryptoService } from "../../src/services/crypto.js";
import { CognitoIdentityProvider } from "@aws-sdk/client-cognito-identity-provider";
import { sink } from "pino-test";

const mkdtemp = promisify(fs.mkdtemp);
const rmdir = promisify(fs.rmdir);
import { mkdtemp, rmdir } from "fs/promises";

export const withCognitoSdk =
(
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/updateGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.updateGroup",
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/updateIdentityProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ClockFake } from "../../src/__tests__/clockFake";
import { withCognitoSdk } from "./setup";
import { ClockFake } from "../../src/__tests__/clockFake.js";
import { withCognitoSdk } from "./setup.js";

const currentDate = new Date();
const roundedDate = new Date(currentDate.getTime());
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/aws-sdk/updateUserAttributes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UUID } from "../../src/__tests__/patterns";
import { withCognitoSdk } from "./setup";
import { UUID } from "../../src/__tests__/patterns.js";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.updateUserAttributes",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/updateUserPool.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.updateUserPool",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/aws-sdk/updateUserPoolClient.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { withCognitoSdk } from "./setup";
import { withCognitoSdk } from "./setup.js";

describe(
"CognitoIdentityServiceProvider.updateUserPoolClient",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/aws-sdk/verifyUserAttribute.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { UUID } from "../../src/__tests__/patterns";
import { TestContext } from "../../src/__tests__/testContext";
import { withCognitoSdk } from "./setup";
import { User } from "../../src/services/userPoolService";
import { UUID } from "../../src/__tests__/patterns.js";
import { TestContext } from "../../src/__tests__/testContext.js";
import { withCognitoSdk } from "./setup.js";
import { User } from "../../src/services/userPoolService.js";

describe(
"CognitoIdentityServiceProvider.verifyUserAttribute",
Expand Down
Loading

0 comments on commit 0629f7c

Please sign in to comment.