Skip to content

Commit

Permalink
feat(esm): moving apollo utils to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
bassrock committed Jan 3, 2025
1 parent 4f8780b commit 51e34e7
Show file tree
Hide file tree
Showing 57 changed files with 131 additions and 150 deletions.
1 change: 1 addition & 0 deletions packages/apollo-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"type": "module",
"files": [
"dist",
"package.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-utils/src/cache/DataloaderKeyValueCache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ErrorsAreMissesCache } from '@apollo/utils.keyvaluecache';
import { DataLoaderCacheInterface } from './interface';
import { DataLoaderCacheInterface } from './interface.ts';
import md5 from 'md5';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-utils/src/context/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './pocketContextManager';
export * from './pocketContextManager.ts';
4 changes: 2 additions & 2 deletions packages/apollo-utils/src/dataloader.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
DataLoaderCacheInterface,
KeyValueCacheSetOptions,
} from './cache/interface';
import * as dataloader from './dataloader';
} from './cache/interface.ts';
import * as dataloader from './dataloader.ts';

class FakeCache implements DataLoaderCacheInterface {
get(key: string): Promise<string | undefined> {
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-utils/src/dataloader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DataLoaderCacheInterface } from './cache/interface';
import { DataLoaderCacheInterface } from './cache/interface.ts';

export type BatchFnProps<T, U> = {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/apollo-utils/src/errorHandler/errorHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { gql } from 'graphql-tag';
import { buildSubgraphSchema } from '@apollo/subgraph';
import { ApolloServerErrorCode } from '@apollo/server/errors';
import assert from 'assert';
import { sentryPlugin, defaultLogger } from '../sentry/apolloSentryPlugin';
import { errorHandler, NotFoundError } from './errorHandler';
import { sentryPlugin, defaultLogger } from '../sentry/apolloSentryPlugin.ts';
import { errorHandler, NotFoundError } from './errorHandler.ts';
import * as Sentry from '@sentry/node';
import { ApolloServerPluginUsageReportingDisabled } from '@apollo/server/plugin/disabled';
import { GraphQLError } from 'graphql';
Expand Down
22 changes: 11 additions & 11 deletions packages/apollo-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// this is the entry point for the npm package
// anything we want consumable (module, type, class, etc) should be exported here
export * from './cache/DataloaderKeyValueCache';
export * from './cache/interface';
export * from './dataloader';
export * from './errorHandler/errorHandler';
export * from './scalars';
export * from './pagination/';
export * from './plugins/defaultPlugin';
export * from './sentry/expressSentryMiddleware';
export * from './utils';
export * from './context';
export * from './cache/DataloaderKeyValueCache.ts';
export * from './cache/interface.ts';
export * from './dataloader.ts';
export * from './errorHandler/errorHandler.ts';
export * from './scalars/index.ts';
export * from './pagination/index.ts';
export * from './plugins/defaultPlugin.ts';
export * from './sentry/expressSentryMiddleware.ts';
export * from './utils.ts';
export * from './context/index.ts';

// export a generic object with all Pocket Custom Scalars
import { GraphQLValidUrl, isoStringScalar } from './scalars';
import { GraphQLValidUrl, isoStringScalar } from './scalars/index.ts';

export const PocketDefaultScalars = {
ISOString: isoStringScalar,
Expand Down
4 changes: 2 additions & 2 deletions packages/apollo-utils/src/pagination/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { PaginationInput, ValidatedPagination } from './types';
export { validatePagination } from './validatePagination';
export { PaginationInput, ValidatedPagination } from './types.ts';
export { validatePagination } from './validatePagination.ts';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { validatePagination } from './validatePagination';
import { validatePagination } from './validatePagination.ts';

describe('pagination validation', () => {
const defaultPageSize = 30;
Expand Down
4 changes: 2 additions & 2 deletions packages/apollo-utils/src/pagination/validatePagination.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { UserInputError } from '../errorHandler/errorHandler';
import { PaginationInput, ValidatedPagination } from './types';
import { UserInputError } from '../errorHandler/errorHandler.ts';
import { PaginationInput, ValidatedPagination } from './types.ts';

export function validatePagination(
pagination: PaginationInput | null | undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-utils/src/plugins/defaultPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApolloServerPluginUsageReportingDisabled } from '@apollo/server/plugin/
import { ApolloServerPluginInlineTrace } from '@apollo/server/plugin/inlineTrace';
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default';
import { sentryPlugin } from '../sentry/apolloSentryPlugin';
import { sentryPlugin } from '../sentry/apolloSentryPlugin.ts';
import { Server } from 'http';
import { ApolloServerPlugin, BaseContext } from '@apollo/server';

Expand Down
4 changes: 2 additions & 2 deletions packages/apollo-utils/src/scalars/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { GraphQLValidUrl } from './ValidUrlScalar';
export { isoStringScalar } from './isoStringScalar';
export { GraphQLValidUrl } from './ValidUrlScalar.ts';
export { isoStringScalar } from './isoStringScalar.ts';
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ApolloServer } from '@apollo/server';
import { ApolloServerPluginUsageReportingDisabled } from '@apollo/server/plugin/disabled';
import { buildSubgraphSchema } from '@apollo/subgraph';
import { gql } from 'graphql-tag';
import { errorHandler } from '../errorHandler/errorHandler';
import { isoStringScalar } from './isoStringScalar';
import { errorHandler } from '../errorHandler/errorHandler.ts';
import { isoStringScalar } from './isoStringScalar.ts';

const isoUTCDateStr = '2023-02-11T18:39:48.000Z';
const isoUTCDateObj = new Date(isoUTCDateStr);
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-utils/src/scalars/isoStringScalar.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DateTime } from 'luxon';
import { Kind } from 'graphql';
import { isoStringScalar } from './isoStringScalar';
import { isoStringScalar } from './isoStringScalar.ts';

const isoESTDateStr = '2023-02-11T13:39:48.000-05:00';
const isoESTDateObj = new Date(isoESTDateStr);
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-utils/src/scalars/isoStringScalar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DateTime, Settings } from 'luxon';
import {
InternalServerError,
UserInputError,
} from '../errorHandler/errorHandler';
} from '../errorHandler/errorHandler.ts';

export const isoStringScalar = new GraphQLScalarType({
name: 'ISOString',
Expand Down
2 changes: 1 addition & 1 deletion packages/apollo-utils/src/sentry/apolloSentryPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
GraphQLRequestListener,
} from '@apollo/server';
import { ApolloServerErrorCode } from '@apollo/server/errors';
import { InternalErrorCode } from '../errorHandler/errorHandler';
import { InternalErrorCode } from '../errorHandler/errorHandler.ts';
import { setLogger, Logger } from '@pocket-tools/ts-logger';

export const defaultLogger: Logger = setLogger();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { TestResource } from '../testHelpers.js';
import { TestResource } from '../testHelpers.ts';
import {
ApplicationAutoscaling,
ApplicationAutoscalingProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { ApplicationBackup } from './ApplicationBackups.js';
import { ApplicationBackup } from './ApplicationBackups.ts';

describe('ApplicationBackup', () => {
it('renders vault with plans without tags', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Testing } from 'cdktf';
import { TestResource } from '../testHelpers.js';
import { ApplicationBaseDNS } from './ApplicationBaseDNS.js';
import { TestResource } from '../testHelpers.ts';
import { ApplicationBaseDNS } from './ApplicationBaseDNS.ts';

describe('ApplicationBaseDNS', () => {
const tags = {
Expand Down
2 changes: 1 addition & 1 deletion packages/terraform-modules/src/base/ApplicationBaseDNS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@cdktf/provider-aws';
import { TerraformMetaArguments, TerraformProvider } from 'cdktf';
import { Construct } from 'constructs';
import { getRootDomain } from '../utilities.js';
import { getRootDomain } from '../utilities.ts';

export interface RootDNSProps extends TerraformMetaArguments {
domain: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Testing, TerraformStack } from 'cdktf';
import { TestResource } from '../testHelpers.js';
import { ApplicationCertificate } from './ApplicationCertificate.js';
import { TestResource } from '../testHelpers.ts';
import { ApplicationCertificate } from './ApplicationCertificate.ts';

describe('ApplicationCertificate', () => {
const tags = {
Expand Down
2 changes: 1 addition & 1 deletion packages/terraform-modules/src/base/ApplicationECR.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { ApplicationECR } from './ApplicationECR.js';
import { ApplicationECR } from './ApplicationECR.ts';

describe('ApplicationECR', () => {
it('renders an ECR without tags', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { ApplicationECSAlbCodeDeploy } from './ApplicationECSAlbCodeDeploy.js';
import { ApplicationECSAlbCodeDeploy } from './ApplicationECSAlbCodeDeploy.ts';

describe('ApplicationECSAlbCodeDeploy', () => {
it('renders a CodeDeploy without a sns', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { ApplicationECSCluster } from './ApplicationECSCluster.js';
import { ApplicationECSCluster } from './ApplicationECSCluster.ts';

describe('ApplicationECSCluster', () => {
it('renders an ECS cluster without tags', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Testing } from 'cdktf';
import {
ApplicationECSIAM,
ApplicationECSIAMProps,
} from './ApplicationECSIAM.js';
} from './ApplicationECSIAM.ts';

const BASE_CONFIG: ApplicationECSIAMProps = {
prefix: 'abides-dev',
Expand Down
12 changes: 6 additions & 6 deletions packages/terraform-modules/src/base/ApplicationECSService.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { Resource } from '@cdktf/provider-null/lib/resource';
import { Sleep } from '@cdktf/provider-time/lib/sleep';
import { Construct } from 'constructs';
import { ApplicationECR, ECRProps } from './ApplicationECR.js';
import { ApplicationECR, ECRProps } from './ApplicationECR.ts';
import {
ApplicationECSIAM,
ApplicationECSIAMProps,
} from './ApplicationECSIAM.js';
} from './ApplicationECSIAM.ts';
import {
ApplicationECSContainerDefinitionProps,
buildDefinitionJSON,
} from './ApplicationECSContainerDefinition.js';
import { ApplicationTargetGroup } from './ApplicationTargetGroup.js';
import { ApplicationECSAlbCodeDeploy } from './ApplicationECSAlbCodeDeploy.js';
} from './ApplicationECSContainerDefinition.ts';
import { ApplicationTargetGroup } from './ApplicationTargetGroup.ts';
import { ApplicationECSAlbCodeDeploy } from './ApplicationECSAlbCodeDeploy.ts';
import {
TerraformResource,
TerraformIterator,
TerraformMetaArguments,
Fn,
TerraformOutput,
} from 'cdktf';
import { truncateString } from '../utilities.js';
import { truncateString } from '../utilities.ts';
import { File } from '@cdktf/provider-local/lib/file';
import {
ecrRepository,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dataAwsLambdaFunction } from '@cdktf/provider-aws';
import { Testing } from 'cdktf';
import { ApplicationLambdaSnsTopicSubscription } from './ApplicationLambdaSnsTopicSubscription.js';
import { ApplicationLambdaSnsTopicSubscription } from './ApplicationLambdaSnsTopicSubscription.ts';

describe('ApplicationSqsSnsTopicSubscription', () => {
const getConfig = (stack) => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { ApplicationLoadBalancer } from './ApplicationLoadBalancer.js';
import { ApplicationLoadBalancer } from './ApplicationLoadBalancer.ts';

describe('ApplicationLoadBalancer', () => {
it('renders an ALB without tags', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Testing } from 'cdktf';
import { ApplicationElasticacheClusterProps } from './ApplicationElasticacheCluster.js';
import { ApplicationElasticacheClusterProps } from './ApplicationElasticacheCluster.ts';

import { ApplicationMemcache } from './ApplicationMemcache.js';
import { ApplicationMemcache } from './ApplicationMemcache.ts';

const BASE_CONFIG: ApplicationElasticacheClusterProps = {
allowedIngressSecurityGroupIds: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/terraform-modules/src/base/ApplicationMemcache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ApplicationElasticacheCluster,
ApplicationElasticacheClusterProps,
ApplicationElasticacheEngine,
} from './ApplicationElasticacheCluster.js';
} from './ApplicationElasticacheCluster.ts';
import { Construct } from 'constructs';
import { dataAwsVpc, elasticacheCluster } from '@cdktf/provider-aws';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { ApplicationRDSCluster } from './ApplicationRDSCluster.js';
import { ApplicationRDSCluster } from './ApplicationRDSCluster.ts';

describe('ApplicationRDSCluster', () => {
it('renders a RDS cluster', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/terraform-modules/src/base/ApplicationRedis.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Testing } from 'cdktf';
import { ApplicationElasticacheClusterProps } from './ApplicationElasticacheCluster.js';
import { ApplicationElasticacheClusterProps } from './ApplicationElasticacheCluster.ts';

import { ApplicationRedis } from './ApplicationRedis.js';
import { ApplicationRedis } from './ApplicationRedis.ts';

const BASE_CONFIG: ApplicationElasticacheClusterProps = {
allowedIngressSecurityGroupIds: [],
Expand Down
2 changes: 1 addition & 1 deletion packages/terraform-modules/src/base/ApplicationRedis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ApplicationElasticacheCluster,
ApplicationElasticacheClusterProps,
ApplicationElasticacheEngine,
} from './ApplicationElasticacheCluster.js';
} from './ApplicationElasticacheCluster.ts';
import { Construct } from 'constructs';
import { dataAwsVpc, elasticacheReplicationGroup } from '@cdktf/provider-aws';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
ApplicationElasticacheCluster,
ApplicationElasticacheClusterProps,
ApplicationElasticacheEngine,
} from './ApplicationElasticacheCluster.js';
} from './ApplicationElasticacheCluster.ts';
import { Construct } from 'constructs';
import { Fn } from 'cdktf';
import { dataAwsVpc, elasticacheServerlessCache } from '@cdktf/provider-aws';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sqsQueue } from '@cdktf/provider-aws';
import { Testing } from 'cdktf';
import { ApplicationSqsSnsTopicSubscription } from './ApplicationSqsSnsTopicSubscription.js';
import { ApplicationSqsSnsTopicSubscription } from './ApplicationSqsSnsTopicSubscription.ts';

describe('ApplicationSqsSnsTopicSubscription', () => {
const getConfig = (stack) => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Testing } from 'cdktf';
import { ApplicationTargetGroup } from './ApplicationTargetGroup.js';
import { ApplicationTargetGroup } from './ApplicationTargetGroup.ts';

describe('ApplicationTargetGroup', () => {
it('renders a Target Group without tags', () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/terraform-modules/src/example.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Construct } from 'constructs';
import { App, TerraformStack } from 'cdktf';
import { provider as awsProvider, wafv2WebAcl } from '@cdktf/provider-aws';
import { PocketALBApplication } from './pocket/PocketALBApplication.js';
import { ApplicationECSContainerDefinitionProps } from './base/ApplicationECSContainerDefinition.js';
import { PocketALBApplication } from './pocket/PocketALBApplication.ts';
import { ApplicationECSContainerDefinitionProps } from './base/ApplicationECSContainerDefinition.ts';
import { provider as localProvider } from '@cdktf/provider-local';
import { provider as nullProvider } from '@cdktf/provider-null';
import { provider as timeProvider } from '@cdktf/provider-time';
import { PocketAwsSyntheticChecks } from './pocket/PocketCloudwatchSynthetics.js';
import { PocketVPC } from './pocket/PocketVPC.js';
import { PocketAwsSyntheticChecks } from './pocket/PocketCloudwatchSynthetics.ts';
import { PocketVPC } from './pocket/PocketVPC.ts';

class Example extends TerraformStack {
constructor(scope: Construct, name: string) {
Expand Down
Loading

0 comments on commit 51e34e7

Please sign in to comment.