@datawheel/bespoke 0.9.3 → 1.0.0-beta.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.
@@ -0,0 +1,109 @@
1
+ import { Session, NextAuthOptions, AuthOptions } from 'next-auth';
2
+ import * as next from 'next';
3
+ import { NextApiRequest, NextApiResponse, NextApiHandler, GetServerSidePropsContext, GetStaticPathsResult, GetStaticPaths, GetStaticProps, GetServerSideProps } from 'next';
4
+ import { e as BespokeAuthOptions } from './auth-D3PWImeZ.mjs';
5
+ import { h as AppStore } from './store-D5N14riO.mjs';
6
+ export { i as dbApiFactory, u as useDatabaseApi } from './store-D5N14riO.mjs';
7
+ import * as querystring from 'querystring';
8
+ export { v as ReportsDB } from './types-WI9fSG9b.mjs';
9
+ import 'next-auth/react';
10
+ import 'next/app';
11
+ import 'next-redux-wrapper';
12
+ import '@reduxjs/toolkit';
13
+ import 'immer';
14
+ import 'sequelize';
15
+
16
+ /**
17
+ * Returns the instance connection to the DB.
18
+ * This connection is shared through all items in the running server.
19
+ * The function must run synchronously, so async startup operations are set to
20
+ * run without `await`ing or monitoring the result.
21
+ */
22
+ declare const getDB: () => Promise<any>;
23
+
24
+ type BespokeSession = Session & {
25
+ source: string;
26
+ };
27
+ declare function getBespokeServerSession(req: NextApiRequest, res: NextApiResponse, authOptions?: BespokeAuthOptions): Promise<BespokeSession>;
28
+
29
+ declare const handleAuth: (authOptions?: {
30
+ providers: any[];
31
+ }) => any;
32
+
33
+ /**
34
+ *
35
+ * @param req Next req
36
+ * @param res Next res
37
+ * @param settings
38
+ * @returns
39
+ */
40
+ declare const updateCurrentUserAppMetadata: (req: NextApiRequest, res: NextApiResponse, authOptions: BespokeAuthOptions, newMetadata: {
41
+ [key: string]: string;
42
+ }) => Promise<{
43
+ [key: string]: string;
44
+ }>;
45
+
46
+ /**
47
+ *
48
+ * @param req Next req
49
+ * @param res Next res
50
+ * @param settings
51
+ * @returns
52
+ */
53
+ declare const updateCurrentUserMetadata: (req: NextApiRequest, res: NextApiResponse, authOptions: BespokeAuthOptions, newMetadata: {
54
+ [key: string]: string;
55
+ }) => Promise<{
56
+ [key: string]: string;
57
+ }>;
58
+
59
+ declare const withApiRoleAuthRequired: (apiRoute: NextApiHandler, allowedRoles: string[], authOptions: NextAuthOptions) => NextApiHandler<any>;
60
+
61
+ declare const searchUsersByMetadata: (authOptions: BespokeAuthOptions, key: string, value: string) => Promise<any>;
62
+
63
+ declare function endpointKey(method: string, path: string): string;
64
+ declare function endpointNextJsHandlerFactory(authOptions: NextAuthOptions): (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
65
+
66
+ declare const reportsCrosswalkEntrypointFn: (crosswalk: any) => (_req: NextApiRequest, res: NextApiResponse) => Promise<void>;
67
+
68
+ declare function BespokeManagerServerSideProps(options?: {
69
+ preResolve?: (store: AppStore, ctx: GetServerSidePropsContext) => Promise<any>;
70
+ postResolve?: (store: AppStore, ctx: GetServerSidePropsContext) => Promise<any>;
71
+ /**
72
+ * The variable name set in the current filename for Dynamic Routes.
73
+ * @see {@link https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes}
74
+ */
75
+ pathSegmentsKey?: string;
76
+ authOptions: AuthOptions;
77
+ }): next.GetServerSideProps<any, querystring.ParsedUrlQuery, next.PreviewData>;
78
+
79
+ declare function BespokeRendererStaticPaths(options?: {
80
+ /**
81
+ * Enable nextjs getStaticPaths fallback.
82
+ * Setting this to `false` will disable any other page not found at compile time.
83
+ * @see {@link https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-false}
84
+ * @default true
85
+ */
86
+ fallback?: GetStaticPathsResult["fallback"];
87
+ /**
88
+ * The max amount of high ranking pages to pre-render PER Variant
89
+ * @default 50
90
+ */
91
+ limit?: number;
92
+ }): GetStaticPaths;
93
+ declare function BespokeRendererStaticProps(options?: {
94
+ /**
95
+ * The variable name set in the current filename for Dynamic Routes.
96
+ * @see {@link https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes}
97
+ */
98
+ pathSegmentsKey?: string;
99
+ }): GetStaticProps;
100
+
101
+ declare function BespokeEmbedServerSideProps(options?: {
102
+ /**
103
+ * The variable name set in the current filename for Dynamic Routes.
104
+ * @see {@link https://nextjs.org/docs/routing/dynamic-routes#catch-all-routes}
105
+ */
106
+ pathSegmentsKey?: string;
107
+ }): GetServerSideProps;
108
+
109
+ export { BespokeEmbedServerSideProps, endpointNextJsHandlerFactory as BespokeEndpointNextJsHandlerFactory, getBespokeServerSession as BespokeGetSession, handleAuth as BespokeHandleAuth, BespokeManagerServerSideProps, BespokeRendererStaticPaths, BespokeRendererStaticProps, searchUsersByMetadata as BespokeSearchUsersByMetadata, updateCurrentUserAppMetadata as BespokeUpdateCurrentUserAppMetadata, updateCurrentUserMetadata as BespokeUpdateCurrentUserMetadata, withApiRoleAuthRequired as BespokeWithApiRoleAuthRequired, reportsCrosswalkEntrypointFn as ReportCrosswalkHandler, endpointKey, getDB };