naystack 1.7.1 → 1.7.4

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 (46) hide show
  1. package/README.md +6 -6
  2. package/dist/auth/client.cjs.js +230 -0
  3. package/dist/auth/client.d.mts +3 -0
  4. package/dist/auth/client.d.ts +3 -0
  5. package/dist/auth/client.esm.js +190 -0
  6. package/dist/auth/email/client.cjs.js +6 -2
  7. package/dist/auth/email/client.d.mts +17 -12
  8. package/dist/auth/email/client.d.ts +17 -12
  9. package/dist/auth/email/client.esm.js +6 -2
  10. package/dist/auth/email/index.cjs.js +8 -3
  11. package/dist/auth/email/index.d.mts +2 -1
  12. package/dist/auth/email/index.d.ts +2 -1
  13. package/dist/auth/email/index.esm.js +7 -3
  14. package/dist/auth/email/{server.cjs.js → next.cjs.js} +16 -7
  15. package/dist/auth/email/next.d.mts +7 -0
  16. package/dist/auth/email/next.d.ts +7 -0
  17. package/dist/auth/email/{server.esm.js → next.esm.js} +8 -4
  18. package/dist/auth/index.cjs.js +13 -13
  19. package/dist/auth/index.d.mts +2 -1
  20. package/dist/auth/index.d.ts +2 -1
  21. package/dist/auth/index.esm.js +3 -3
  22. package/dist/file/client.cjs.js +1 -1
  23. package/dist/file/client.esm.js +1 -1
  24. package/dist/graphql/client.cjs.js +1 -1
  25. package/dist/graphql/client.esm.js +1 -1
  26. package/dist/graphql/index.cjs.js +53 -0
  27. package/dist/graphql/index.d.mts +4 -0
  28. package/dist/graphql/index.d.ts +4 -0
  29. package/dist/graphql/index.esm.js +55 -0
  30. package/dist/index.d.mts +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/{client → utils/client}/hooks.cjs.js +1 -1
  33. package/dist/{client → utils/client}/hooks.esm.js +1 -1
  34. package/dist/{client → utils/client}/index.cjs.js +3 -3
  35. package/dist/{client → utils/client}/index.esm.js +2 -2
  36. package/dist/{client → utils/client}/seo.cjs.js +2 -2
  37. package/dist/{client → utils/client}/seo.esm.js +1 -1
  38. package/package.json +17 -27
  39. package/dist/auth/email/server.d.mts +0 -5
  40. package/dist/auth/email/server.d.ts +0 -5
  41. /package/dist/{client → utils/client}/hooks.d.mts +0 -0
  42. /package/dist/{client → utils/client}/hooks.d.ts +0 -0
  43. /package/dist/{client → utils/client}/index.d.mts +0 -0
  44. /package/dist/{client → utils/client}/index.d.ts +0 -0
  45. /package/dist/{client → utils/client}/seo.d.mts +0 -0
  46. /package/dist/{client → utils/client}/seo.d.ts +0 -0
@@ -919,11 +919,66 @@ function FieldLibrary(type, queries) {
919
919
  }
920
920
  return GeneratedResolver;
921
921
  }
922
+
923
+ // src/graphql/server.tsx
924
+ import {
925
+ ApolloClient,
926
+ HttpLink,
927
+ InMemoryCache
928
+ } from "@apollo/client";
929
+ import { registerApolloClient } from "@apollo/client-integration-nextjs";
930
+ import { cookies as cookies3 } from "next/headers";
931
+ import React from "react";
932
+ import { Suspense } from "react";
933
+ function Injector({
934
+ fetch: fetch2,
935
+ Component,
936
+ props
937
+ }) {
938
+ return /* @__PURE__ */ React.createElement(Suspense, { fallback: /* @__PURE__ */ React.createElement(Component, { ...props || {}, loading: true }) }, /* @__PURE__ */ React.createElement(InjectorSuspensed, { Component, fetch: fetch2, props }));
939
+ }
940
+ async function InjectorSuspensed({
941
+ fetch: fetch2,
942
+ Component,
943
+ props
944
+ }) {
945
+ const data = await fetch2();
946
+ return /* @__PURE__ */ React.createElement(Component, { loading: false, ...props || {}, data });
947
+ }
948
+ var { query: gqlQuery } = registerApolloClient(() => {
949
+ return new ApolloClient({
950
+ cache: new InMemoryCache(),
951
+ link: new HttpLink({
952
+ uri: getEnv("NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */)
953
+ })
954
+ });
955
+ });
956
+ var query = async (_query, options) => {
957
+ const res = await gqlQuery({
958
+ query: _query,
959
+ variables: options?.variables,
960
+ context: {
961
+ headers: {
962
+ Cookie: options?.noCookie ? void 0 : await cookies3()
963
+ },
964
+ fetchOptions: {
965
+ cache: options?.revalidate ? "force-cache" : void 0,
966
+ next: {
967
+ revalidate: options?.revalidate || 0,
968
+ tags: options?.tags
969
+ }
970
+ }
971
+ }
972
+ });
973
+ return res.data;
974
+ };
922
975
  export {
923
976
  FieldLibrary,
924
977
  GQLError,
978
+ Injector,
925
979
  QueryLibrary,
926
980
  field,
981
+ query,
927
982
  resolver,
928
983
  setupGraphQL
929
984
  };
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Use subpath imports for the specific module you need:
5
5
  * - `naystack/auth` — Email/Google/Instagram authentication
6
- * - `naystack/auth/email/client` — Client-side auth hooks (useLogin, useSignUp, etc.)
6
+ * - `naystack/auth/client` — Client-side auth hooks (useLogin, useSignUp, etc.)
7
7
  * - `naystack/graphql` — GraphQL server: resolver, field, QueryLibrary, FieldLibrary, setupGraphQL
8
8
  * - `naystack/graphql/client` — Client-side GraphQL hooks (useAuthQuery, useAuthMutation, ApolloWrapper)
9
9
  * - `naystack/graphql/server` — Server-side GraphQL utilities (Injector, query)
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Use subpath imports for the specific module you need:
5
5
  * - `naystack/auth` — Email/Google/Instagram authentication
6
- * - `naystack/auth/email/client` — Client-side auth hooks (useLogin, useSignUp, etc.)
6
+ * - `naystack/auth/client` — Client-side auth hooks (useLogin, useSignUp, etc.)
7
7
  * - `naystack/graphql` — GraphQL server: resolver, field, QueryLibrary, FieldLibrary, setupGraphQL
8
8
  * - `naystack/graphql/client` — Client-side GraphQL hooks (useAuthQuery, useAuthMutation, ApolloWrapper)
9
9
  * - `naystack/graphql/server` — Server-side GraphQL utilities (Injector, query)
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/client/hooks.ts
20
+ // src/utils/client/hooks.ts
21
21
  var hooks_exports = {};
22
22
  __export(hooks_exports, {
23
23
  useBreakpoint: () => useBreakpoint,
@@ -1,4 +1,4 @@
1
- // src/client/hooks.ts
1
+ // src/utils/client/hooks.ts
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  function useVisibility(onVisible) {
4
4
  const visibilityRef = useRef(null);
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/client/index.ts
20
+ // src/utils/client/index.ts
21
21
  var client_exports = {};
22
22
  __export(client_exports, {
23
23
  setupSEO: () => setupSEO,
@@ -26,7 +26,7 @@ __export(client_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(client_exports);
28
28
 
29
- // src/client/hooks.ts
29
+ // src/utils/client/hooks.ts
30
30
  var import_react = require("react");
31
31
  function useVisibility(onVisible) {
32
32
  const visibilityRef = (0, import_react.useRef)(null);
@@ -121,7 +121,7 @@ function getEnv(key, skipCheck) {
121
121
  return value;
122
122
  }
123
123
 
124
- // src/client/seo.ts
124
+ // src/utils/client/seo.ts
125
125
  var setupSEO = (SEO) => (title, description, image) => ({
126
126
  title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
127
127
  description: description || SEO.description,
@@ -1,4 +1,4 @@
1
- // src/client/hooks.ts
1
+ // src/utils/client/hooks.ts
2
2
  import { useEffect, useRef, useState } from "react";
3
3
  function useVisibility(onVisible) {
4
4
  const visibilityRef = useRef(null);
@@ -93,7 +93,7 @@ function getEnv(key, skipCheck) {
93
93
  return value;
94
94
  }
95
95
 
96
- // src/client/seo.ts
96
+ // src/utils/client/seo.ts
97
97
  var setupSEO = (SEO) => (title, description, image) => ({
98
98
  title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
99
99
  description: description || SEO.description,
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/client/seo.ts
20
+ // src/utils/client/seo.ts
21
21
  var seo_exports = {};
22
22
  __export(seo_exports, {
23
23
  setupSEO: () => setupSEO
@@ -74,7 +74,7 @@ function getEnv(key, skipCheck) {
74
74
  return value;
75
75
  }
76
76
 
77
- // src/client/seo.ts
77
+ // src/utils/client/seo.ts
78
78
  var setupSEO = (SEO) => (title, description, image) => ({
79
79
  title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
80
80
  description: description || SEO.description,
@@ -48,7 +48,7 @@ function getEnv(key, skipCheck) {
48
48
  return value;
49
49
  }
50
50
 
51
- // src/client/seo.ts
51
+ // src/utils/client/seo.ts
52
52
  var setupSEO = (SEO) => (title, description, image) => ({
53
53
  title: title ? `${title} \u2022 ${SEO.siteName}` : SEO.title,
54
54
  description: description || SEO.description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.7.1",
3
+ "version": "1.7.4",
4
4
  "description": "A stack built with Next + GraphQL + S3 + Auth",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -18,10 +18,10 @@
18
18
  "import": "./dist/auth/index.esm.js",
19
19
  "require": "./dist/auth/index.cjs.js"
20
20
  },
21
- "./socials": {
22
- "types": "./dist/socials/index.d.ts",
23
- "import": "./dist/socials/index.esm.js",
24
- "require": "./dist/socials/index.cjs.js"
21
+ "./auth/client": {
22
+ "types": "./dist/auth/client.d.ts",
23
+ "import": "./dist/auth/client.esm.js",
24
+ "require": "./dist/auth/client.cjs.js"
25
25
  },
26
26
  "./graphql": {
27
27
  "types": "./dist/graphql/index.d.ts",
@@ -38,35 +38,25 @@
38
38
  "import": "./dist/graphql/next.esm.js",
39
39
  "require": "./dist/graphql/next.cjs.js"
40
40
  },
41
- "./auth/email/client": {
42
- "types": "./dist/auth/email/client.d.ts",
43
- "import": "./dist/auth/email/client.esm.js",
44
- "require": "./dist/auth/email/client.cjs.js"
45
- },
46
- "./auth/instagram/client": {
47
- "types": "./dist/auth/instagram/client.d.ts",
48
- "import": "./dist/auth/instagram/client.esm.js",
49
- "require": "./dist/auth/instagram/client.cjs.js"
41
+ "./file": {
42
+ "types": "./dist/file/index.d.ts",
43
+ "import": "./dist/file/index.esm.js",
44
+ "require": "./dist/file/index.cjs.js"
50
45
  },
51
46
  "./file/client": {
52
47
  "types": "./dist/file/client.d.ts",
53
48
  "import": "./dist/file/client.esm.js",
54
49
  "require": "./dist/file/client.cjs.js"
55
50
  },
56
- "./graphql/server": {
57
- "types": "./dist/graphql/server.d.ts",
58
- "import": "./dist/graphql/server.esm.js",
59
- "require": "./dist/graphql/server.cjs.js"
60
- },
61
- "./client": {
62
- "types": "./dist/client/index.d.ts",
63
- "import": "./dist/client/index.esm.js",
64
- "require": "./dist/client/index.cjs.js"
51
+ "./socials": {
52
+ "types": "./dist/socials/index.d.ts",
53
+ "import": "./dist/socials/index.esm.js",
54
+ "require": "./dist/socials/index.cjs.js"
65
55
  },
66
- "./file": {
67
- "types": "./dist/file/index.d.ts",
68
- "import": "./dist/file/index.esm.js",
69
- "require": "./dist/file/index.cjs.js"
56
+ "./utils/client": {
57
+ "types": "./dist/utils/client/index.d.ts",
58
+ "import": "./dist/utils/client/index.esm.js",
59
+ "require": "./dist/utils/client/index.cjs.js"
70
60
  },
71
61
  "./env": {
72
62
  "types": "./dist/env.d.ts",
@@ -1,5 +0,0 @@
1
- import React__default from 'react';
2
-
3
- declare function AuthFetch(): React__default.JSX.Element;
4
-
5
- export { AuthFetch as default };
@@ -1,5 +0,0 @@
1
- import React__default from 'react';
2
-
3
- declare function AuthFetch(): React__default.JSX.Element;
4
-
5
- export { AuthFetch as default };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes