@common-stack/server-stack 8.2.5-alpha.8 → 8.3.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/MainStackServer.cjs +17 -10
- package/lib/MainStackServer.cjs.map +1 -1
- package/lib/MainStackServer.mjs +17 -10
- package/lib/MainStackServer.mjs.map +1 -1
- package/lib/StackServer.cjs +1 -1
- package/lib/StackServer.cjs.map +1 -1
- package/lib/StackServer.mjs +1 -1
- package/lib/StackServer.mjs.map +1 -1
- package/lib/config/env-config.cjs +6 -0
- package/lib/config/env-config.cjs.map +1 -1
- package/lib/config/env-config.mjs +6 -0
- package/lib/config/env-config.mjs.map +1 -1
- package/lib/infrastructure/container-module.cjs +2 -1
- package/lib/infrastructure/container-module.cjs.map +1 -1
- package/lib/infrastructure/container-module.mjs +2 -1
- package/lib/infrastructure/container-module.mjs.map +1 -1
- package/lib/infrastructure/inngest-factory.cjs +6 -2
- package/lib/infrastructure/inngest-factory.cjs.map +1 -1
- package/lib/infrastructure/inngest-factory.mjs +6 -2
- package/lib/infrastructure/inngest-factory.mjs.map +1 -1
- package/lib/servers/ExpressApp.cjs +3 -3
- package/lib/servers/ExpressApp.cjs.map +1 -1
- package/lib/servers/ExpressApp.mjs +1 -1
- package/lib/servers/ExpressApp.mjs.map +1 -1
- package/lib/servers/WebsocketMultipathUpdate.cjs +51 -9
- package/lib/servers/WebsocketMultipathUpdate.cjs.map +1 -1
- package/lib/servers/WebsocketMultipathUpdate.mjs +51 -9
- package/lib/servers/WebsocketMultipathUpdate.mjs.map +1 -1
- package/package.json +8 -8
- package/lib/MainStackServer.d.ts +0 -34
- package/lib/StackServer.d.ts +0 -29
- package/lib/api/remote-config.d.ts +0 -6
- package/lib/api/resolver.d.ts +0 -10
- package/lib/api/scalar.d.ts +0 -2
- package/lib/api/schema-builder.d.ts +0 -24
- package/lib/api/sub-graph-schema-builder.d.ts +0 -24
- package/lib/api/utils.d.ts +0 -4
- package/lib/config/env-config.d.ts +0 -28
- package/lib/config/index.d.ts +0 -1
- package/lib/config/moleculer.config.d.ts +0 -20
- package/lib/connectors/connection-broker.d.ts +0 -26
- package/lib/connectors/graphql-pubsub-connector.d.ts +0 -22
- package/lib/connectors/mongo-connector.d.ts +0 -21
- package/lib/connectors/nats-connector.d.ts +0 -20
- package/lib/connectors/redis-connector.d.ts +0 -30
- package/lib/examples/tenant-feature-example.d.ts +0 -13
- package/lib/examples/tenant-feature-integration.d.ts +0 -14
- package/lib/features/multi-module-example.d.ts +0 -17
- package/lib/index.d.ts +0 -4
- package/lib/infrastructure/container-module.d.ts +0 -3
- package/lib/infrastructure/example-workflows.d.ts +0 -16
- package/lib/infrastructure/index.d.ts +0 -5
- package/lib/infrastructure/infrastructure-factory.d.ts +0 -45
- package/lib/infrastructure/inngest-factory.d.ts +0 -8
- package/lib/infrastructure/types.d.ts +0 -28
- package/lib/infrastructure/usage-examples.d.ts +0 -9
- package/lib/infrastructure/workflow-orchestrator.d.ts +0 -10
- package/lib/inngest/client-id-generator.d.ts +0 -29
- package/lib/inngest/handler-factory.d.ts +0 -24
- package/lib/inngest/middleware/auto-resolve-invoke.middleware.d.ts +0 -111
- package/lib/inngest/middleware/function-reference-helper.d.ts +0 -211
- package/lib/inngest/middleware/index.d.ts +0 -31
- package/lib/inngest/middleware/types.d.ts +0 -162
- package/lib/inngest/multi-module-functions.d.ts +0 -133
- package/lib/inngest/setup.d.ts +0 -10
- package/lib/interfaces/dbMigration.d.ts +0 -8
- package/lib/interfaces/graphql-request-context.d.ts +0 -20
- package/lib/interfaces/index.d.ts +0 -4
- package/lib/interfaces/module-interface.d.ts +0 -13
- package/lib/interfaces/moleculer.d.ts +0 -7
- package/lib/middleware/cors.d.ts +0 -6
- package/lib/middleware/error.d.ts +0 -9
- package/lib/middleware/index.d.ts +0 -5
- package/lib/middleware/moleculer-inter-namespace.d.ts +0 -2
- package/lib/middleware/redis-client.d.ts +0 -16
- package/lib/middleware/sentry.d.ts +0 -2
- package/lib/middleware/services.d.ts +0 -2
- package/lib/plugins/index.d.ts +0 -2
- package/lib/plugins/invalidateCachePlugin.d.ts +0 -8
- package/lib/plugins/responseCachePlugin.d.ts +0 -12
- package/lib/servers/ExpressApp.d.ts +0 -3
- package/lib/servers/GraphqlServer.d.ts +0 -25
- package/lib/servers/GraphqlWs.d.ts +0 -14
- package/lib/servers/WebsocketMultipathUpdate.d.ts +0 -18
- package/lib/servers/mongodb-migration-update.d.ts +0 -12
- package/lib/servers/utils.d.ts +0 -14
- package/lib/servers/websocket-context.d.ts +0 -30
- package/lib/utils/add-shareable-directive-to-schema.d.ts +0 -1
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/migrations.d.ts +0 -8
- package/lib/utils/safe-model-factory.d.ts +0 -18
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Container } from 'inversify';
|
|
2
|
-
/**
|
|
3
|
-
* User management Inngest functions that depend on container services
|
|
4
|
-
*/
|
|
5
|
-
export declare const userInngestFunctions: ({ container, inngest, settings, }: {
|
|
6
|
-
container: Container;
|
|
7
|
-
inngest: any;
|
|
8
|
-
settings?: any;
|
|
9
|
-
}) => {
|
|
10
|
-
createUserFunction: {
|
|
11
|
-
id: string;
|
|
12
|
-
_type: string;
|
|
13
|
-
};
|
|
14
|
-
updateUserProfileFunction: {
|
|
15
|
-
id: string;
|
|
16
|
-
_type: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Email campaign Inngest functions that depend on container services
|
|
21
|
-
*/
|
|
22
|
-
export declare const emailCampaignInngestFunctions: ({ container, inngest, settings, }: {
|
|
23
|
-
container: Container;
|
|
24
|
-
inngest: any;
|
|
25
|
-
settings?: any;
|
|
26
|
-
}) => {
|
|
27
|
-
sendCampaignFunction: {
|
|
28
|
-
id: string;
|
|
29
|
-
_type: string;
|
|
30
|
-
};
|
|
31
|
-
trackEmailOpenFunction: {
|
|
32
|
-
id: string;
|
|
33
|
-
_type: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Analytics Inngest functions that depend on container services
|
|
38
|
-
*/
|
|
39
|
-
export declare const analyticsInngestFunctions: ({ container, inngest, settings, }: {
|
|
40
|
-
container: Container;
|
|
41
|
-
inngest: any;
|
|
42
|
-
settings?: any;
|
|
43
|
-
}) => {
|
|
44
|
-
generateReportFunction: {
|
|
45
|
-
id: string;
|
|
46
|
-
_type: string;
|
|
47
|
-
};
|
|
48
|
-
trackUserEventFunction: {
|
|
49
|
-
id: string;
|
|
50
|
-
_type: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* AI Page Creator functions that depend on container services
|
|
55
|
-
*/
|
|
56
|
-
export declare const aiPageCreatorInngestFunctions: ({ container, inngest, settings, }: {
|
|
57
|
-
container: Container;
|
|
58
|
-
inngest: any;
|
|
59
|
-
settings?: any;
|
|
60
|
-
}) => {
|
|
61
|
-
codeAgentFunction: {
|
|
62
|
-
id: string;
|
|
63
|
-
_type: string;
|
|
64
|
-
};
|
|
65
|
-
sendMessageFunction: {
|
|
66
|
-
id: string;
|
|
67
|
-
_type: string;
|
|
68
|
-
};
|
|
69
|
-
processPageFunction: {
|
|
70
|
-
id: string;
|
|
71
|
-
_type: string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Export array of all function factories for easy registration
|
|
76
|
-
*/
|
|
77
|
-
export declare const allInngestFunctionFactories: ((({ container, inngest, settings, }: {
|
|
78
|
-
container: Container;
|
|
79
|
-
inngest: any;
|
|
80
|
-
settings?: any;
|
|
81
|
-
}) => {
|
|
82
|
-
createUserFunction: {
|
|
83
|
-
id: string;
|
|
84
|
-
_type: string;
|
|
85
|
-
};
|
|
86
|
-
updateUserProfileFunction: {
|
|
87
|
-
id: string;
|
|
88
|
-
_type: string;
|
|
89
|
-
};
|
|
90
|
-
}) | (({ container, inngest, settings, }: {
|
|
91
|
-
container: Container;
|
|
92
|
-
inngest: any;
|
|
93
|
-
settings?: any;
|
|
94
|
-
}) => {
|
|
95
|
-
sendCampaignFunction: {
|
|
96
|
-
id: string;
|
|
97
|
-
_type: string;
|
|
98
|
-
};
|
|
99
|
-
trackEmailOpenFunction: {
|
|
100
|
-
id: string;
|
|
101
|
-
_type: string;
|
|
102
|
-
};
|
|
103
|
-
}) | (({ container, inngest, settings, }: {
|
|
104
|
-
container: Container;
|
|
105
|
-
inngest: any;
|
|
106
|
-
settings?: any;
|
|
107
|
-
}) => {
|
|
108
|
-
generateReportFunction: {
|
|
109
|
-
id: string;
|
|
110
|
-
_type: string;
|
|
111
|
-
};
|
|
112
|
-
trackUserEventFunction: {
|
|
113
|
-
id: string;
|
|
114
|
-
_type: string;
|
|
115
|
-
};
|
|
116
|
-
}) | (({ container, inngest, settings, }: {
|
|
117
|
-
container: Container;
|
|
118
|
-
inngest: any;
|
|
119
|
-
settings?: any;
|
|
120
|
-
}) => {
|
|
121
|
-
codeAgentFunction: {
|
|
122
|
-
id: string;
|
|
123
|
-
_type: string;
|
|
124
|
-
};
|
|
125
|
-
sendMessageFunction: {
|
|
126
|
-
id: string;
|
|
127
|
-
_type: string;
|
|
128
|
-
};
|
|
129
|
-
processPageFunction: {
|
|
130
|
-
id: string;
|
|
131
|
-
_type: string;
|
|
132
|
-
};
|
|
133
|
-
}))[];
|
package/lib/inngest/setup.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Express } from 'express';
|
|
2
|
-
import { Container } from 'inversify';
|
|
3
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
4
|
-
import { Feature } from '@common-stack/server-core';
|
|
5
|
-
type ILogger = CdmLogger.ILogger;
|
|
6
|
-
/**
|
|
7
|
-
* Sets up Inngest functions from the Feature system and registers the handler
|
|
8
|
-
*/
|
|
9
|
-
export declare function setupInngestFunctions(modules: Feature, app: Express, serviceContainer: Container, logger: ILogger): Promise<void>;
|
|
10
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ServiceBroker } from 'moleculer';
|
|
2
|
-
export type GraphqlRequestContext = {
|
|
3
|
-
overallCachePolicy: {
|
|
4
|
-
scope: string;
|
|
5
|
-
maxAge: number;
|
|
6
|
-
};
|
|
7
|
-
user: {
|
|
8
|
-
sub: string;
|
|
9
|
-
};
|
|
10
|
-
req: {
|
|
11
|
-
currentPageUriSegments: {
|
|
12
|
-
authority: string;
|
|
13
|
-
};
|
|
14
|
-
tenant?: string;
|
|
15
|
-
};
|
|
16
|
-
queriesToInvalidate: string[];
|
|
17
|
-
tenantId?: string;
|
|
18
|
-
accountId?: string;
|
|
19
|
-
moleculerBroker?: ServiceBroker;
|
|
20
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { GraphQLSchema } from 'graphql';
|
|
2
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
3
|
-
type ILogger = CdmLogger.ILogger;
|
|
4
|
-
export interface IModuleService {
|
|
5
|
-
serviceContainer: any;
|
|
6
|
-
serviceContext: any;
|
|
7
|
-
dataSource: any;
|
|
8
|
-
defaultPreferences: any;
|
|
9
|
-
createContext: any;
|
|
10
|
-
schema: GraphQLSchema;
|
|
11
|
-
logger: ILogger;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
package/lib/middleware/cors.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Middleware function that takes 4 arguments is classified as "error handling middleware"
|
|
3
|
-
* and will only get called if an error occurs.
|
|
4
|
-
* @param e
|
|
5
|
-
* @param req
|
|
6
|
-
* @param res
|
|
7
|
-
* @param next
|
|
8
|
-
*/
|
|
9
|
-
export declare const errorMiddleware: (e: any, req: any, res: any, next: any) => void;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { redisClientMiddleware } from './redis-client';
|
|
2
|
-
export { contextServicesMiddleware } from './services';
|
|
3
|
-
export { corsMiddleware } from './cors';
|
|
4
|
-
export { errorMiddleware } from './error';
|
|
5
|
-
export { sentryMiddleware, sentryErrorHandlerMiddleware } from './sentry';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redis Client Middleware
|
|
3
|
-
*
|
|
4
|
-
* This middleware attaches the Redis client to the request object,
|
|
5
|
-
* making it available for session storage and other Redis operations.
|
|
6
|
-
*/
|
|
7
|
-
import { Request, Response, NextFunction } from 'express';
|
|
8
|
-
export interface RedisClientRequest extends Request {
|
|
9
|
-
redisClient?: any;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Creates middleware that attaches Redis client to request object
|
|
13
|
-
* @param redisClient - The Redis client instance
|
|
14
|
-
* @returns Express middleware function
|
|
15
|
-
*/
|
|
16
|
-
export declare function redisClientMiddleware(redisClient: any): (req: RedisClientRequest, res: Response, next: NextFunction) => void;
|
package/lib/plugins/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Redis, Cluster } from 'ioredis';
|
|
2
|
-
import type { BaseContext, GraphQLRequestContextWillSendResponse } from '@apollo/server';
|
|
3
|
-
import { ApolloServerOptions, GraphQLRequestContext } from '@apollo/server';
|
|
4
|
-
export type InvalidationKeyGenerator = (requestContext: GraphQLRequestContext<unknown>, responseContext: GraphQLRequestContextWillSendResponse<unknown>, cacheKey?: string) => string;
|
|
5
|
-
export declare const invalidateCachePlugin: ({ cache: redisClient, invalidateCacheKeyGenerator, }: {
|
|
6
|
-
cache: Redis | Cluster;
|
|
7
|
-
invalidateCacheKeyGenerator: InvalidationKeyGenerator;
|
|
8
|
-
}) => ApolloServerOptions<BaseContext>["plugins"][0];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { GraphQLRequestContext } from '@apollo/server';
|
|
2
|
-
import { ILogger } from '@cdm-logger/core/lib/interface';
|
|
3
|
-
import { GraphqlRequestContext } from '../interfaces';
|
|
4
|
-
import { KeyGenerator } from '../servers/GraphqlServer';
|
|
5
|
-
type ApolloCachePluginOptions = {
|
|
6
|
-
logger: ILogger;
|
|
7
|
-
cacheKeyGenerator: KeyGenerator;
|
|
8
|
-
};
|
|
9
|
-
export declare const isCacheable: (requestContext: GraphQLRequestContext<GraphqlRequestContext>) => boolean;
|
|
10
|
-
export declare const generateCacheKey: ({ logger, cacheKeyGenerator }: ApolloCachePluginOptions) => (requestContext: GraphQLRequestContext<GraphqlRequestContext>) => string;
|
|
11
|
-
export declare const responseCachePlugin: ({ logger, cacheKeyGenerator }: ApolloCachePluginOptions) => any;
|
|
12
|
-
export {};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Feature } from '@common-stack/server-core';
|
|
2
|
-
import { IModuleService } from '../interfaces';
|
|
3
|
-
export declare function expressApp(modules: Feature, options: IModuleService, middlewares: any, http?: any, redisClient?: any): import("express-serve-static-core").Express;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { GraphQLRequestContext } from '@apollo/server';
|
|
2
|
-
import * as IORedis from 'ioredis';
|
|
3
|
-
import 'isomorphic-fetch';
|
|
4
|
-
import { Express } from 'express';
|
|
5
|
-
import * as http from 'http';
|
|
6
|
-
import { InvalidationKeyGenerator } from '../plugins';
|
|
7
|
-
import { IModuleService } from '../interfaces';
|
|
8
|
-
import type { ApolloServerPlugin } from '@apollo/server';
|
|
9
|
-
export type KeyGenerator = (context: GraphQLRequestContext<unknown>, cacheKey?: string) => string;
|
|
10
|
-
export declare class GraphqlServer {
|
|
11
|
-
private readonly app;
|
|
12
|
-
private readonly httpServer;
|
|
13
|
-
private readonly redisClient;
|
|
14
|
-
private readonly moduleService;
|
|
15
|
-
private readonly enableSubscription;
|
|
16
|
-
private readonly cacheKeyGenerator?;
|
|
17
|
-
private readonly invalidateCacheKeyGenerator?;
|
|
18
|
-
private readonly plugins?;
|
|
19
|
-
private logger;
|
|
20
|
-
private graphqlWsServer;
|
|
21
|
-
constructor(app: Express, httpServer: http.Server, redisClient: IORedis.Redis | IORedis.Cluster, moduleService: IModuleService, enableSubscription?: boolean, cacheKeyGenerator?: KeyGenerator, invalidateCacheKeyGenerator?: InvalidationKeyGenerator, plugins?: ApolloServerPlugin<any>[]);
|
|
22
|
-
initialize(): Promise<void>;
|
|
23
|
-
getUserIpAddress(req: any): any;
|
|
24
|
-
private configureApolloServer;
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as IORedis from 'ioredis';
|
|
2
|
-
import { Disposable } from 'graphql-ws';
|
|
3
|
-
import { WebSocketServer } from 'ws';
|
|
4
|
-
import { IModuleService } from '../interfaces';
|
|
5
|
-
export declare class GraphqlWs {
|
|
6
|
-
private wsServer;
|
|
7
|
-
private moduleService;
|
|
8
|
-
protected cache: IORedis.Redis | IORedis.Cluster;
|
|
9
|
-
private subscriptionServer;
|
|
10
|
-
private logger;
|
|
11
|
-
constructor(wsServer: WebSocketServer, moduleService: IModuleService, cache: IORedis.Redis | IORedis.Cluster);
|
|
12
|
-
create(): Disposable;
|
|
13
|
-
disconnect(): void;
|
|
14
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { WebSocketServer } from 'ws';
|
|
2
|
-
import { Server } from 'http';
|
|
3
|
-
import * as IORedis from 'ioredis';
|
|
4
|
-
import { IModuleService } from '../interfaces';
|
|
5
|
-
interface MultiWebsocketConfig {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
}
|
|
8
|
-
export declare class WebsocketMultiPathServer {
|
|
9
|
-
moduleService: IModuleService;
|
|
10
|
-
cache: IORedis.Redis | IORedis.Cluster;
|
|
11
|
-
private webSockets;
|
|
12
|
-
private _graphqlWs;
|
|
13
|
-
constructor(moduleService: IModuleService, cache: IORedis.Redis | IORedis.Cluster, multiplePathConfig?: MultiWebsocketConfig);
|
|
14
|
-
httpServerUpgrade(httpServer: Server): Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
15
|
-
get graphqlWs(): WebSocketServer;
|
|
16
|
-
close(): void;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Schema, Connection as DBConnection } from 'mongoose';
|
|
2
|
-
import { IModuleService } from '../interfaces';
|
|
3
|
-
export declare const MigrationSchema: Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
|
|
4
|
-
name: string;
|
|
5
|
-
migrated_at?: Date;
|
|
6
|
-
}>;
|
|
7
|
-
export declare class MongoDBMigrationUpgrade {
|
|
8
|
-
private moduleService;
|
|
9
|
-
private mongoDB;
|
|
10
|
-
constructor(moduleService: IModuleService, mongoDB: DBConnection);
|
|
11
|
-
migrate(): Promise<any>;
|
|
12
|
-
}
|
package/lib/servers/utils.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as IORedis from 'ioredis';
|
|
2
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
3
|
-
type ILogger = CdmLogger.ILogger;
|
|
4
|
-
/**
|
|
5
|
-
* It'll get messy below but there's an issue currently with the state of the protocols that can be used (subscriptions-transport-ws vs graphql-ws).
|
|
6
|
-
* Read more from: https://www.apollographql.com/docs/apollo-server/data/subscriptions/#the-graphql-ws-transport-library
|
|
7
|
-
*
|
|
8
|
-
* Bottomline is, if we use the newer and actively maintained `graphql-ws` lib, then the GraphQL Playground will not work because it uses the old protocol.
|
|
9
|
-
*
|
|
10
|
-
* The approach below tries to support both based on the template provided here but adjusted for our setup here.
|
|
11
|
-
* https://github.com/enisdenjo/graphql-ws#ws-backwards-compat
|
|
12
|
-
*/
|
|
13
|
-
export declare function createContextFromConnectionParams(context: any, datasources: any, cache: IORedis.Redis | IORedis.Cluster, logger: ILogger): Promise<any>;
|
|
14
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as IORedis from 'ioredis';
|
|
2
|
-
import { IModuleService } from '../interfaces';
|
|
3
|
-
/**
|
|
4
|
-
* Helper function to construct data sources for WebSocket subscriptions
|
|
5
|
-
*
|
|
6
|
-
* @workaround DataSources are an Apollo Server feature that only work with HTTP requests.
|
|
7
|
-
* When using graphql-ws for WebSocket subscriptions, we must manually initialize data sources
|
|
8
|
-
* because graphql-ws has a separate context pipeline from Apollo Server's HTTP pipeline.
|
|
9
|
-
*
|
|
10
|
-
* This is necessary as of:
|
|
11
|
-
* - Apollo Server v4.10.4
|
|
12
|
-
* - graphql-ws v5.11.2
|
|
13
|
-
*
|
|
14
|
-
* References:
|
|
15
|
-
* - Original issue: https://github.com/apollographql/apollo-server/issues/1526
|
|
16
|
-
* - Community solution: https://github.com/apollographql/apollo-server/issues/1526#issuecomment-502884432
|
|
17
|
-
* - graphql-ws context: https://github.com/enisdenjo/graphql-ws#context
|
|
18
|
-
*/
|
|
19
|
-
export declare const constructDataSourcesForSubscriptions: (context: any, cache: any, dataSources: any) => any;
|
|
20
|
-
/**
|
|
21
|
-
* Creates the WebSocket subscription context
|
|
22
|
-
* This function is shared between GraphqlWs and WebsocketMultiPathServer
|
|
23
|
-
* to ensure consistent context creation across all subscription endpoints.
|
|
24
|
-
*
|
|
25
|
-
* @param ctx - The graphql-ws context containing connectionParams
|
|
26
|
-
* @param moduleService - The module service for creating context
|
|
27
|
-
* @param cache - Redis cache instance
|
|
28
|
-
* @returns Promise<object> - The complete subscription context
|
|
29
|
-
*/
|
|
30
|
-
export declare function createWebSocketContext(ctx: any, moduleService: IModuleService, cache: IORedis.Redis | IORedis.Cluster): Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const addShareableDirectiveToSchema: (schemaString: string) => string;
|
package/lib/utils/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Schema, Connection } from 'mongoose';
|
|
2
|
-
import { Container } from 'inversify';
|
|
3
|
-
import { CdmLogger } from '@cdm-logger/core';
|
|
4
|
-
export declare const MigrationSchema: Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, {
|
|
5
|
-
name: string;
|
|
6
|
-
migrated_at?: Date;
|
|
7
|
-
}>;
|
|
8
|
-
export declare function migrate(db: Connection, container: Container, logger: CdmLogger.ILogger): Promise<void>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Connection, Model, Schema } from 'mongoose';
|
|
2
|
-
/**
|
|
3
|
-
* Safely creates or retrieves a Mongoose model, preventing "Cannot overwrite model once compiled" errors
|
|
4
|
-
*
|
|
5
|
-
* @param db - MongoDB connection
|
|
6
|
-
* @param modelName - Name of the model
|
|
7
|
-
* @param schema - Mongoose schema (only used if model doesn't exist)
|
|
8
|
-
* @returns The Mongoose model
|
|
9
|
-
*/
|
|
10
|
-
export declare function safeModelFactory<T = any>(db: Connection, modelName: string, schema?: Schema<T>): Model<T>;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a model factory function that uses safe model registration
|
|
13
|
-
*
|
|
14
|
-
* @param modelName - Name of the model
|
|
15
|
-
* @param schema - Mongoose schema
|
|
16
|
-
* @returns A factory function that safely creates/retrieves the model
|
|
17
|
-
*/
|
|
18
|
-
export declare function createSafeModelFactory<T = any>(modelName: string, schema: Schema<T>): (db: Connection) => Model<T>;
|