@cyberskill/shared 1.92.0 → 1.94.0

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.
Files changed (55) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +89 -0
  2. package/dist/_tsup-dts-rollup.d.ts +89 -0
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.cts +10 -0
  5. package/dist/index.d.ts +10 -0
  6. package/dist/index.js +1 -1
  7. package/dist/nodejs/apollo-server/apollo-server.type.cjs +1 -0
  8. package/dist/nodejs/apollo-server/apollo-server.type.d.cts +1 -0
  9. package/dist/nodejs/apollo-server/apollo-server.type.d.ts +1 -0
  10. package/dist/nodejs/apollo-server/apollo-server.type.js +0 -0
  11. package/dist/nodejs/apollo-server/apollo-server.util.cjs +1 -0
  12. package/dist/nodejs/apollo-server/apollo-server.util.d.cts +1 -0
  13. package/dist/nodejs/apollo-server/apollo-server.util.d.ts +1 -0
  14. package/dist/nodejs/apollo-server/apollo-server.util.js +1 -0
  15. package/dist/nodejs/apollo-server/index.cjs +1 -0
  16. package/dist/nodejs/apollo-server/index.d.cts +2 -0
  17. package/dist/nodejs/apollo-server/index.d.ts +2 -0
  18. package/dist/nodejs/apollo-server/index.js +1 -0
  19. package/dist/nodejs/cli/cli.util.cjs +1 -1
  20. package/dist/nodejs/cli/cli.util.js +1 -1
  21. package/dist/nodejs/cli/index.cjs +1 -1
  22. package/dist/nodejs/cli/index.js +1 -1
  23. package/dist/nodejs/express/express.d.cjs +1 -0
  24. package/dist/nodejs/express/express.d.d.cts +1 -0
  25. package/dist/nodejs/express/express.d.d.ts +1 -0
  26. package/dist/nodejs/express/express.d.js +0 -0
  27. package/dist/nodejs/express/express.type.cjs +1 -0
  28. package/dist/nodejs/express/express.type.d.cts +2 -0
  29. package/dist/nodejs/express/express.type.d.ts +2 -0
  30. package/dist/nodejs/express/express.type.js +0 -0
  31. package/dist/nodejs/express/express.util.cjs +1 -0
  32. package/dist/nodejs/express/express.util.d.cts +2 -0
  33. package/dist/nodejs/express/express.util.d.ts +2 -0
  34. package/dist/nodejs/express/express.util.js +1 -0
  35. package/dist/nodejs/express/index.cjs +1 -0
  36. package/dist/nodejs/express/index.d.cts +4 -0
  37. package/dist/nodejs/express/index.d.ts +4 -0
  38. package/dist/nodejs/express/index.js +1 -0
  39. package/dist/nodejs/index.cjs +1 -1
  40. package/dist/nodejs/index.d.cts +10 -0
  41. package/dist/nodejs/index.d.ts +10 -0
  42. package/dist/nodejs/index.js +1 -1
  43. package/dist/nodejs/ws/index.cjs +1 -0
  44. package/dist/nodejs/ws/index.d.cts +4 -0
  45. package/dist/nodejs/ws/index.d.ts +4 -0
  46. package/dist/nodejs/ws/index.js +1 -0
  47. package/dist/nodejs/ws/ts.util.cjs +1 -0
  48. package/dist/nodejs/ws/ts.util.d.cts +2 -0
  49. package/dist/nodejs/ws/ts.util.d.ts +2 -0
  50. package/dist/nodejs/ws/ts.util.js +1 -0
  51. package/dist/nodejs/ws/ws.type.cjs +1 -0
  52. package/dist/nodejs/ws/ws.type.d.cts +2 -0
  53. package/dist/nodejs/ws/ws.type.d.ts +2 -0
  54. package/dist/nodejs/ws/ws.type.js +0 -0
  55. package/package.json +35 -8
@@ -7,19 +7,24 @@ import { ApolloClient } from '@apollo/client';
7
7
  import { ApolloClientOptions } from '@apollo/client';
8
8
  import type { ApolloError as ApolloError_2 } from '@apollo/client';
9
9
  import type { ApolloLink } from '@apollo/client';
10
+ import { ApolloServer } from '@apollo/server';
11
+ import type { Application } from 'express';
10
12
  import type { ClientSession } from 'mongoose';
11
13
  import type { CodegenConfig } from '@graphql-codegen/cli';
12
14
  import { Collection } from 'mongodb';
13
15
  import type { ComponentType } from 'react';
14
16
  import type consola from 'consola';
15
17
  import { Context } from 'react';
18
+ import cors from 'cors';
16
19
  import { Db } from 'mongodb';
17
20
  import type { DeleteResult } from 'mongodb';
21
+ import { Disposable as Disposable_2 } from 'graphql-ws';
18
22
  import { Document as Document_2 } from 'mongoose';
19
23
  import type { ErrorHandlingMiddlewareFunction } from 'mongoose';
20
24
  import type { ErrorHandlingMiddlewareWithOption } from 'mongoose';
21
25
  import type { Filter } from 'mongodb';
22
26
  import type { FilterQuery } from 'mongoose';
27
+ import type { GraphQLSchema } from 'graphql';
23
28
  import { I_ApolloErrorContext as I_ApolloErrorContext_2 } from './apollo-error.type.js';
24
29
  import { I_Command as I_Command_2 } from './command.type.js';
25
30
  import { I_LoadingContext as I_LoadingContext_2 } from './loading.type.js';
@@ -53,6 +58,8 @@ import type { ReactElement } from 'react';
53
58
  import type { ReactNode } from 'react';
54
59
  import type { Schema } from 'mongoose';
55
60
  import type { SchemaDefinition } from 'mongoose';
61
+ import type { Server } from 'node:http';
62
+ import type { SessionOptions } from 'express-session';
56
63
  import { TFunction } from 'i18next';
57
64
  import type { Timezone } from 'next-intl';
58
65
  import { toast } from 'react-hot-toast';
@@ -63,6 +70,7 @@ import type { UriFunction } from '@apollo/client';
63
70
  import type { UserConfig } from 'vite';
64
71
  import { useTranslation } from 'react-i18next';
65
72
  import { useTranslations } from 'next-intl';
73
+ import { WebSocketServer } from 'ws';
66
74
  import type { WithId } from 'mongodb';
67
75
 
68
76
  export { aggregatePaginate }
@@ -208,12 +216,40 @@ export { COMMIT_LINT_PACKAGE_NAME as COMMIT_LINT_PACKAGE_NAME_alias_1 }
208
216
  export { COMMIT_LINT_PACKAGE_NAME as COMMIT_LINT_PACKAGE_NAME_alias_2 }
209
217
  export { COMMIT_LINT_PACKAGE_NAME as COMMIT_LINT_PACKAGE_NAME_alias_3 }
210
218
 
219
+ declare function createApolloServer(options: I_ApolloServerOptions): ApolloServer;
220
+ export { createApolloServer }
221
+ export { createApolloServer as createApolloServer_alias_1 }
222
+ export { createApolloServer as createApolloServer_alias_2 }
223
+ export { createApolloServer as createApolloServer_alias_3 }
224
+
225
+ declare function createCors(options: I_CorsOptions): (req: cors.CorsRequest, res: {
226
+ statusCode?: number | undefined;
227
+ setHeader(key: string, value: string): any;
228
+ end(): any;
229
+ }, next: (err?: any) => any) => void;
230
+ export { createCors }
231
+ export { createCors as createCors_alias_1 }
232
+ export { createCors as createCors_alias_2 }
233
+ export { createCors as createCors_alias_3 }
234
+
235
+ declare function createExpress(options: I_ExpressOptions): Application;
236
+ export { createExpress }
237
+ export { createExpress as createExpress_alias_1 }
238
+ export { createExpress as createExpress_alias_2 }
239
+ export { createExpress as createExpress_alias_3 }
240
+
211
241
  declare function createGraphqlCodegenConfig({ uri, from, to, target, }: I_GraphqlCodegenConfig): CodegenConfig;
212
242
  export { createGraphqlCodegenConfig }
213
243
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_1 }
214
244
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_2 }
215
245
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_3 }
216
246
 
247
+ declare function createWSServer(options: I_WSOptions): WebSocketServer;
248
+ export { createWSServer }
249
+ export { createWSServer as createWSServer_alias_1 }
250
+ export { createWSServer as createWSServer_alias_2 }
251
+ export { createWSServer as createWSServer_alias_3 }
252
+
217
253
  declare const CYBERSKILL_CLI = "cyberskill";
218
254
  export { CYBERSKILL_CLI }
219
255
  export { CYBERSKILL_CLI as CYBERSKILL_CLI_alias_1 }
@@ -1596,6 +1632,17 @@ export { I_ApolloProviderProps as I_ApolloProviderProps_alias_1 }
1596
1632
  export { I_ApolloProviderProps as I_ApolloProviderProps_alias_2 }
1597
1633
  export { I_ApolloProviderProps as I_ApolloProviderProps_alias_3 }
1598
1634
 
1635
+ declare interface I_ApolloServerOptions {
1636
+ server: Server;
1637
+ schema: GraphQLSchema;
1638
+ isDev?: boolean;
1639
+ drainServer?: () => Promise<void>;
1640
+ }
1641
+ export { I_ApolloServerOptions }
1642
+ export { I_ApolloServerOptions as I_ApolloServerOptions_alias_1 }
1643
+ export { I_ApolloServerOptions as I_ApolloServerOptions_alias_2 }
1644
+ export { I_ApolloServerOptions as I_ApolloServerOptions_alias_3 }
1645
+
1599
1646
  declare interface I_CheckPackage {
1600
1647
  isCurrentProject: boolean;
1601
1648
  installedPath: string;
@@ -1636,6 +1683,15 @@ export { I_CommandContext as I_CommandContext_alias_1 }
1636
1683
  export { I_CommandContext as I_CommandContext_alias_2 }
1637
1684
  export { I_CommandContext as I_CommandContext_alias_3 }
1638
1685
 
1686
+ declare interface I_CorsOptions {
1687
+ isDev?: boolean;
1688
+ corsWhitelist?: string[];
1689
+ }
1690
+ export { I_CorsOptions }
1691
+ export { I_CorsOptions as I_CorsOptions_alias_1 }
1692
+ export { I_CorsOptions as I_CorsOptions_alias_2 }
1693
+ export { I_CorsOptions as I_CorsOptions_alias_3 }
1694
+
1639
1695
  declare interface I_CreateModelOptions<T extends Partial<C_Document>> extends I_MongooseOptions<T> {
1640
1696
  schema: T_Input_MongooseSchema<T>;
1641
1697
  name: string;
@@ -1680,6 +1736,15 @@ export { I_EslintError as I_EslintError_alias_1 }
1680
1736
  export { I_EslintError as I_EslintError_alias_2 }
1681
1737
  export { I_EslintError as I_EslintError_alias_3 }
1682
1738
 
1739
+ declare interface I_ExpressOptions {
1740
+ staticFolder: string;
1741
+ sessionOptions?: SessionOptions;
1742
+ }
1743
+ export { I_ExpressOptions }
1744
+ export { I_ExpressOptions as I_ExpressOptions_alias_1 }
1745
+ export { I_ExpressOptions as I_ExpressOptions_alias_2 }
1746
+ export { I_ExpressOptions as I_ExpressOptions_alias_3 }
1747
+
1683
1748
  declare interface I_ExtendedModel<T extends Partial<C_Document>> extends Model<T>, PaginateModel<T>, AggregatePaginateModel<T> {
1684
1749
  }
1685
1750
  export { I_ExtendedModel }
@@ -1721,6 +1786,15 @@ export { I_GraphqlCodegenConfig as I_GraphqlCodegenConfig_alias_1 }
1721
1786
  export { I_GraphqlCodegenConfig as I_GraphqlCodegenConfig_alias_2 }
1722
1787
  export { I_GraphqlCodegenConfig as I_GraphqlCodegenConfig_alias_3 }
1723
1788
 
1789
+ declare interface I_GraphqlWSOptions {
1790
+ schema: GraphQLSchema;
1791
+ server: WebSocketServer;
1792
+ }
1793
+ export { I_GraphqlWSOptions }
1794
+ export { I_GraphqlWSOptions as I_GraphqlWSOptions_alias_1 }
1795
+ export { I_GraphqlWSOptions as I_GraphqlWSOptions_alias_2 }
1796
+ export { I_GraphqlWSOptions as I_GraphqlWSOptions_alias_3 }
1797
+
1724
1798
  declare interface I_Input_CreateMany<T> {
1725
1799
  docs: T[];
1726
1800
  }
@@ -2027,6 +2101,21 @@ declare interface I_VirtualOptions {
2027
2101
  options?: I_VirtualNestedOptions;
2028
2102
  }
2029
2103
 
2104
+ declare interface I_WSOptions {
2105
+ server: Server;
2106
+ path: string;
2107
+ }
2108
+ export { I_WSOptions }
2109
+ export { I_WSOptions as I_WSOptions_alias_1 }
2110
+ export { I_WSOptions as I_WSOptions_alias_2 }
2111
+ export { I_WSOptions as I_WSOptions_alias_3 }
2112
+
2113
+ declare function initGraphQLWS(options: I_GraphqlWSOptions): Disposable_2;
2114
+ export { initGraphQLWS }
2115
+ export { initGraphQLWS as initGraphQLWS_alias_1 }
2116
+ export { initGraphQLWS as initGraphQLWS_alias_2 }
2117
+ export { initGraphQLWS as initGraphQLWS_alias_3 }
2118
+
2030
2119
  declare function initI18next(options: InitOptions): Promise<TFunction<"translation", undefined>>;
2031
2120
  export { initI18next }
2032
2121
  export { initI18next as initI18next_alias_1 }
@@ -7,19 +7,24 @@ import { ApolloClient } from '@apollo/client';
7
7
  import { ApolloClientOptions } from '@apollo/client';
8
8
  import type { ApolloError as ApolloError_2 } from '@apollo/client';
9
9
  import type { ApolloLink } from '@apollo/client';
10
+ import { ApolloServer } from '@apollo/server';
11
+ import type { Application } from 'express';
10
12
  import type { ClientSession } from 'mongoose';
11
13
  import type { CodegenConfig } from '@graphql-codegen/cli';
12
14
  import { Collection } from 'mongodb';
13
15
  import type { ComponentType } from 'react';
14
16
  import type consola from 'consola';
15
17
  import { Context } from 'react';
18
+ import cors from 'cors';
16
19
  import { Db } from 'mongodb';
17
20
  import type { DeleteResult } from 'mongodb';
21
+ import { Disposable as Disposable_2 } from 'graphql-ws';
18
22
  import { Document as Document_2 } from 'mongoose';
19
23
  import type { ErrorHandlingMiddlewareFunction } from 'mongoose';
20
24
  import type { ErrorHandlingMiddlewareWithOption } from 'mongoose';
21
25
  import type { Filter } from 'mongodb';
22
26
  import type { FilterQuery } from 'mongoose';
27
+ import type { GraphQLSchema } from 'graphql';
23
28
  import { I_ApolloErrorContext as I_ApolloErrorContext_2 } from './apollo-error.type.js';
24
29
  import { I_Command as I_Command_2 } from './command.type.js';
25
30
  import { I_LoadingContext as I_LoadingContext_2 } from './loading.type.js';
@@ -53,6 +58,8 @@ import type { ReactElement } from 'react';
53
58
  import type { ReactNode } from 'react';
54
59
  import type { Schema } from 'mongoose';
55
60
  import type { SchemaDefinition } from 'mongoose';
61
+ import type { Server } from 'node:http';
62
+ import type { SessionOptions } from 'express-session';
56
63
  import { TFunction } from 'i18next';
57
64
  import type { Timezone } from 'next-intl';
58
65
  import { toast } from 'react-hot-toast';
@@ -63,6 +70,7 @@ import type { UriFunction } from '@apollo/client';
63
70
  import type { UserConfig } from 'vite';
64
71
  import { useTranslation } from 'react-i18next';
65
72
  import { useTranslations } from 'next-intl';
73
+ import { WebSocketServer } from 'ws';
66
74
  import type { WithId } from 'mongodb';
67
75
 
68
76
  export { aggregatePaginate }
@@ -208,12 +216,40 @@ export { COMMIT_LINT_PACKAGE_NAME as COMMIT_LINT_PACKAGE_NAME_alias_1 }
208
216
  export { COMMIT_LINT_PACKAGE_NAME as COMMIT_LINT_PACKAGE_NAME_alias_2 }
209
217
  export { COMMIT_LINT_PACKAGE_NAME as COMMIT_LINT_PACKAGE_NAME_alias_3 }
210
218
 
219
+ declare function createApolloServer(options: I_ApolloServerOptions): ApolloServer;
220
+ export { createApolloServer }
221
+ export { createApolloServer as createApolloServer_alias_1 }
222
+ export { createApolloServer as createApolloServer_alias_2 }
223
+ export { createApolloServer as createApolloServer_alias_3 }
224
+
225
+ declare function createCors(options: I_CorsOptions): (req: cors.CorsRequest, res: {
226
+ statusCode?: number | undefined;
227
+ setHeader(key: string, value: string): any;
228
+ end(): any;
229
+ }, next: (err?: any) => any) => void;
230
+ export { createCors }
231
+ export { createCors as createCors_alias_1 }
232
+ export { createCors as createCors_alias_2 }
233
+ export { createCors as createCors_alias_3 }
234
+
235
+ declare function createExpress(options: I_ExpressOptions): Application;
236
+ export { createExpress }
237
+ export { createExpress as createExpress_alias_1 }
238
+ export { createExpress as createExpress_alias_2 }
239
+ export { createExpress as createExpress_alias_3 }
240
+
211
241
  declare function createGraphqlCodegenConfig({ uri, from, to, target, }: I_GraphqlCodegenConfig): CodegenConfig;
212
242
  export { createGraphqlCodegenConfig }
213
243
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_1 }
214
244
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_2 }
215
245
  export { createGraphqlCodegenConfig as createGraphqlCodegenConfig_alias_3 }
216
246
 
247
+ declare function createWSServer(options: I_WSOptions): WebSocketServer;
248
+ export { createWSServer }
249
+ export { createWSServer as createWSServer_alias_1 }
250
+ export { createWSServer as createWSServer_alias_2 }
251
+ export { createWSServer as createWSServer_alias_3 }
252
+
217
253
  declare const CYBERSKILL_CLI = "cyberskill";
218
254
  export { CYBERSKILL_CLI }
219
255
  export { CYBERSKILL_CLI as CYBERSKILL_CLI_alias_1 }
@@ -1596,6 +1632,17 @@ export { I_ApolloProviderProps as I_ApolloProviderProps_alias_1 }
1596
1632
  export { I_ApolloProviderProps as I_ApolloProviderProps_alias_2 }
1597
1633
  export { I_ApolloProviderProps as I_ApolloProviderProps_alias_3 }
1598
1634
 
1635
+ declare interface I_ApolloServerOptions {
1636
+ server: Server;
1637
+ schema: GraphQLSchema;
1638
+ isDev?: boolean;
1639
+ drainServer?: () => Promise<void>;
1640
+ }
1641
+ export { I_ApolloServerOptions }
1642
+ export { I_ApolloServerOptions as I_ApolloServerOptions_alias_1 }
1643
+ export { I_ApolloServerOptions as I_ApolloServerOptions_alias_2 }
1644
+ export { I_ApolloServerOptions as I_ApolloServerOptions_alias_3 }
1645
+
1599
1646
  declare interface I_CheckPackage {
1600
1647
  isCurrentProject: boolean;
1601
1648
  installedPath: string;
@@ -1636,6 +1683,15 @@ export { I_CommandContext as I_CommandContext_alias_1 }
1636
1683
  export { I_CommandContext as I_CommandContext_alias_2 }
1637
1684
  export { I_CommandContext as I_CommandContext_alias_3 }
1638
1685
 
1686
+ declare interface I_CorsOptions {
1687
+ isDev?: boolean;
1688
+ corsWhitelist?: string[];
1689
+ }
1690
+ export { I_CorsOptions }
1691
+ export { I_CorsOptions as I_CorsOptions_alias_1 }
1692
+ export { I_CorsOptions as I_CorsOptions_alias_2 }
1693
+ export { I_CorsOptions as I_CorsOptions_alias_3 }
1694
+
1639
1695
  declare interface I_CreateModelOptions<T extends Partial<C_Document>> extends I_MongooseOptions<T> {
1640
1696
  schema: T_Input_MongooseSchema<T>;
1641
1697
  name: string;
@@ -1680,6 +1736,15 @@ export { I_EslintError as I_EslintError_alias_1 }
1680
1736
  export { I_EslintError as I_EslintError_alias_2 }
1681
1737
  export { I_EslintError as I_EslintError_alias_3 }
1682
1738
 
1739
+ declare interface I_ExpressOptions {
1740
+ staticFolder: string;
1741
+ sessionOptions?: SessionOptions;
1742
+ }
1743
+ export { I_ExpressOptions }
1744
+ export { I_ExpressOptions as I_ExpressOptions_alias_1 }
1745
+ export { I_ExpressOptions as I_ExpressOptions_alias_2 }
1746
+ export { I_ExpressOptions as I_ExpressOptions_alias_3 }
1747
+
1683
1748
  declare interface I_ExtendedModel<T extends Partial<C_Document>> extends Model<T>, PaginateModel<T>, AggregatePaginateModel<T> {
1684
1749
  }
1685
1750
  export { I_ExtendedModel }
@@ -1721,6 +1786,15 @@ export { I_GraphqlCodegenConfig as I_GraphqlCodegenConfig_alias_1 }
1721
1786
  export { I_GraphqlCodegenConfig as I_GraphqlCodegenConfig_alias_2 }
1722
1787
  export { I_GraphqlCodegenConfig as I_GraphqlCodegenConfig_alias_3 }
1723
1788
 
1789
+ declare interface I_GraphqlWSOptions {
1790
+ schema: GraphQLSchema;
1791
+ server: WebSocketServer;
1792
+ }
1793
+ export { I_GraphqlWSOptions }
1794
+ export { I_GraphqlWSOptions as I_GraphqlWSOptions_alias_1 }
1795
+ export { I_GraphqlWSOptions as I_GraphqlWSOptions_alias_2 }
1796
+ export { I_GraphqlWSOptions as I_GraphqlWSOptions_alias_3 }
1797
+
1724
1798
  declare interface I_Input_CreateMany<T> {
1725
1799
  docs: T[];
1726
1800
  }
@@ -2027,6 +2101,21 @@ declare interface I_VirtualOptions {
2027
2101
  options?: I_VirtualNestedOptions;
2028
2102
  }
2029
2103
 
2104
+ declare interface I_WSOptions {
2105
+ server: Server;
2106
+ path: string;
2107
+ }
2108
+ export { I_WSOptions }
2109
+ export { I_WSOptions as I_WSOptions_alias_1 }
2110
+ export { I_WSOptions as I_WSOptions_alias_2 }
2111
+ export { I_WSOptions as I_WSOptions_alias_3 }
2112
+
2113
+ declare function initGraphQLWS(options: I_GraphqlWSOptions): Disposable_2;
2114
+ export { initGraphQLWS }
2115
+ export { initGraphQLWS as initGraphQLWS_alias_1 }
2116
+ export { initGraphQLWS as initGraphQLWS_alias_2 }
2117
+ export { initGraphQLWS as initGraphQLWS_alias_3 }
2118
+
2030
2119
  declare function initI18next(options: InitOptions): Promise<TFunction<"translation", undefined>>;
2031
2120
  export { initI18next }
2032
2121
  export { initI18next as initI18next_alias_1 }