naystack 1.5.27 → 1.5.28

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.
@@ -32,14 +32,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  var client_exports = {};
33
33
  __export(client_exports, {
34
34
  ApolloWrapper: () => ApolloWrapper,
35
- ApolloWrapperNext: () => ApolloWrapperNext,
36
35
  tokenContext: () => tokenContext,
37
36
  useAuthMutation: () => useAuthMutation,
38
37
  useAuthQuery: () => useAuthQuery
39
38
  });
40
39
  module.exports = __toCommonJS(client_exports);
41
40
  var import_client = require("@apollo/client");
42
- var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
43
41
  var import_client2 = require("naystack/auth/email/client");
44
42
  var import_react = __toESM(require("react"));
45
43
 
@@ -94,20 +92,6 @@ function getEnv(key, skipCheck) {
94
92
 
95
93
  // src/graphql/client.tsx
96
94
  function makeClient(cacheConfig) {
97
- return new import_client_integration_nextjs.ApolloClient({
98
- cache: new import_client_integration_nextjs.InMemoryCache(cacheConfig),
99
- link: new import_client.HttpLink({
100
- uri: getEnv("NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */)
101
- })
102
- });
103
- }
104
- var ApolloWrapperNext = ({
105
- children,
106
- cacheConfig
107
- }) => {
108
- return /* @__PURE__ */ import_react.default.createElement(import_client_integration_nextjs.ApolloNextAppProvider, { makeClient: () => makeClient(cacheConfig) }, children);
109
- };
110
- function makeClientBasic(cacheConfig) {
111
95
  return new import_client.ApolloClient({
112
96
  cache: new import_client.InMemoryCache(cacheConfig),
113
97
  link: new import_client.HttpLink({
@@ -119,7 +103,7 @@ var ApolloWrapper = ({
119
103
  children,
120
104
  cacheConfig
121
105
  }) => {
122
- return /* @__PURE__ */ import_react.default.createElement(import_client.ApolloProvider, { client: makeClientBasic(cacheConfig) }, children);
106
+ return /* @__PURE__ */ import_react.default.createElement(import_client.ApolloProvider, { client: makeClient(cacheConfig) }, children);
123
107
  };
124
108
  var tokenContext = (token) => {
125
109
  if (!token) return void 0;
@@ -172,7 +156,6 @@ function useAuthMutation(mutation, options) {
172
156
  // Annotate the CommonJS export names for ESM import in node:
173
157
  0 && (module.exports = {
174
158
  ApolloWrapper,
175
- ApolloWrapperNext,
176
159
  tokenContext,
177
160
  useAuthMutation,
178
161
  useAuthQuery
@@ -3,9 +3,6 @@ import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@a
3
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
4
  import React__default, { PropsWithChildren } from 'react';
5
5
 
6
- declare const ApolloWrapperNext: ({ children, cacheConfig, }: PropsWithChildren<{
7
- cacheConfig?: InMemoryCacheConfig;
8
- }>) => React__default.JSX.Element;
9
6
  declare const ApolloWrapper: ({ children, cacheConfig, }: PropsWithChildren<{
10
7
  cacheConfig?: InMemoryCacheConfig;
11
8
  }>) => React__default.JSX.Element;
@@ -99,4 +96,4 @@ declare function useAuthQuery<T, V extends OperationVariables>(query: TypedDocum
99
96
  */
100
97
  declare function useAuthMutation<T, V extends OperationVariables>(mutation: TypedDocumentNode<T, V>, options?: MutationHookOptions<T, V>): readonly [(input?: V["input"]) => Promise<_apollo_client.FetchResult<T>>, _apollo_client.MutationResult<T>];
101
98
 
102
- export { ApolloWrapper, ApolloWrapperNext, tokenContext, useAuthMutation, useAuthQuery };
99
+ export { ApolloWrapper, tokenContext, useAuthMutation, useAuthQuery };
@@ -3,9 +3,6 @@ import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@a
3
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
4
  import React__default, { PropsWithChildren } from 'react';
5
5
 
6
- declare const ApolloWrapperNext: ({ children, cacheConfig, }: PropsWithChildren<{
7
- cacheConfig?: InMemoryCacheConfig;
8
- }>) => React__default.JSX.Element;
9
6
  declare const ApolloWrapper: ({ children, cacheConfig, }: PropsWithChildren<{
10
7
  cacheConfig?: InMemoryCacheConfig;
11
8
  }>) => React__default.JSX.Element;
@@ -99,4 +96,4 @@ declare function useAuthQuery<T, V extends OperationVariables>(query: TypedDocum
99
96
  */
100
97
  declare function useAuthMutation<T, V extends OperationVariables>(mutation: TypedDocumentNode<T, V>, options?: MutationHookOptions<T, V>): readonly [(input?: V["input"]) => Promise<_apollo_client.FetchResult<T>>, _apollo_client.MutationResult<T>];
101
98
 
102
- export { ApolloWrapper, ApolloWrapperNext, tokenContext, useAuthMutation, useAuthQuery };
99
+ export { ApolloWrapper, tokenContext, useAuthMutation, useAuthQuery };
@@ -2,18 +2,13 @@
2
2
 
3
3
  // src/graphql/client.tsx
4
4
  import {
5
- ApolloClient as ApolloClientBasic,
5
+ ApolloClient,
6
6
  ApolloProvider,
7
7
  HttpLink,
8
- InMemoryCache as InMemoryCacheBasic,
8
+ InMemoryCache,
9
9
  useLazyQuery,
10
10
  useMutation
11
11
  } from "@apollo/client";
12
- import {
13
- ApolloClient,
14
- ApolloNextAppProvider,
15
- InMemoryCache
16
- } from "@apollo/client-integration-nextjs";
17
12
  import { useToken } from "naystack/auth/email/client";
18
13
  import React, {
19
14
  useCallback,
@@ -79,25 +74,11 @@ function makeClient(cacheConfig) {
79
74
  })
80
75
  });
81
76
  }
82
- var ApolloWrapperNext = ({
83
- children,
84
- cacheConfig
85
- }) => {
86
- return /* @__PURE__ */ React.createElement(ApolloNextAppProvider, { makeClient: () => makeClient(cacheConfig) }, children);
87
- };
88
- function makeClientBasic(cacheConfig) {
89
- return new ApolloClientBasic({
90
- cache: new InMemoryCacheBasic(cacheConfig),
91
- link: new HttpLink({
92
- uri: getEnv("NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */)
93
- })
94
- });
95
- }
96
77
  var ApolloWrapper = ({
97
78
  children,
98
79
  cacheConfig
99
80
  }) => {
100
- return /* @__PURE__ */ React.createElement(ApolloProvider, { client: makeClientBasic(cacheConfig) }, children);
81
+ return /* @__PURE__ */ React.createElement(ApolloProvider, { client: makeClient(cacheConfig) }, children);
101
82
  };
102
83
  var tokenContext = (token) => {
103
84
  if (!token) return void 0;
@@ -149,7 +130,6 @@ function useAuthMutation(mutation, options) {
149
130
  }
150
131
  export {
151
132
  ApolloWrapper,
152
- ApolloWrapperNext,
153
133
  tokenContext,
154
134
  useAuthMutation,
155
135
  useAuthQuery
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ "use client";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/graphql/next.tsx
32
+ var next_exports = {};
33
+ __export(next_exports, {
34
+ ApolloWrapper: () => ApolloWrapper
35
+ });
36
+ module.exports = __toCommonJS(next_exports);
37
+ var import_client = require("@apollo/client");
38
+ var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
39
+ var import_react = __toESM(require("react"));
40
+
41
+ // src/env.ts
42
+ var getEnvValue = (key) => {
43
+ switch (key) {
44
+ case "NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */:
45
+ return process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || process.env.EXPO_PUBLIC_GRAPHQL_ENDPOINT;
46
+ case "NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */:
47
+ return process.env.NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT || process.env.EXPO_PUBLIC_EMAIL_AUTH_ENDPOINT;
48
+ case "NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT" /* NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT */:
49
+ return process.env.NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT || process.env.EXPO_PUBLIC_GOOGLE_AUTH_ENDPOINT;
50
+ case "NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */:
51
+ return process.env.NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT || process.env.EXPO_PUBLIC_INSTAGRAM_AUTH_ENDPOINT;
52
+ case "NEXT_PUBLIC_FILE_ENDPOINT" /* NEXT_PUBLIC_FILE_ENDPOINT */:
53
+ return process.env.NEXT_PUBLIC_FILE_ENDPOINT || process.env.EXPO_PUBLIC_FILE_ENDPOINT;
54
+ case "NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */:
55
+ return process.env.NEXT_PUBLIC_BASE_URL || process.env.EXPO_PUBLIC_BASE_URL;
56
+ case "REFRESH_KEY" /* REFRESH_KEY */:
57
+ return process.env.REFRESH_KEY;
58
+ case "SIGNING_KEY" /* SIGNING_KEY */:
59
+ return process.env.SIGNING_KEY;
60
+ case "INSTAGRAM_CLIENT_SECRET" /* INSTAGRAM_CLIENT_SECRET */:
61
+ return process.env.INSTAGRAM_CLIENT_SECRET;
62
+ case "INSTAGRAM_CLIENT_ID" /* INSTAGRAM_CLIENT_ID */:
63
+ return process.env.INSTAGRAM_CLIENT_ID;
64
+ case "GOOGLE_CLIENT_SECRET" /* GOOGLE_CLIENT_SECRET */:
65
+ return process.env.GOOGLE_CLIENT_SECRET;
66
+ case "GOOGLE_CLIENT_ID" /* GOOGLE_CLIENT_ID */:
67
+ return process.env.GOOGLE_CLIENT_ID;
68
+ case "TURNSTILE_KEY" /* TURNSTILE_KEY */:
69
+ return process.env.TURNSTILE_KEY;
70
+ case "AWS_ACCESS_KEY_ID" /* AWS_ACCESS_KEY_ID */:
71
+ return process.env.AWS_ACCESS_KEY_ID;
72
+ case "AWS_ACCESS_KEY_SECRET" /* AWS_ACCESS_KEY_SECRET */:
73
+ return process.env.AWS_ACCESS_KEY_SECRET;
74
+ case "AWS_REGION" /* AWS_REGION */:
75
+ return process.env.AWS_REGION;
76
+ case "AWS_BUCKET" /* AWS_BUCKET */:
77
+ return process.env.AWS_BUCKET;
78
+ case "NODE_ENV" /* NODE_ENV */:
79
+ return process.env.NODE_ENV;
80
+ default:
81
+ return process.env[key];
82
+ }
83
+ };
84
+ function getEnv(key, skipCheck) {
85
+ const value = getEnvValue(key);
86
+ if (!skipCheck && !value) throw new Error(`${key} is not defined`);
87
+ return value;
88
+ }
89
+
90
+ // src/graphql/next.tsx
91
+ function makeClient(cacheConfig) {
92
+ return new import_client_integration_nextjs.ApolloClient({
93
+ cache: new import_client_integration_nextjs.InMemoryCache(cacheConfig),
94
+ link: new import_client.HttpLink({
95
+ uri: getEnv("NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */)
96
+ })
97
+ });
98
+ }
99
+ var ApolloWrapper = ({
100
+ children,
101
+ cacheConfig
102
+ }) => {
103
+ return /* @__PURE__ */ import_react.default.createElement(import_client_integration_nextjs.ApolloNextAppProvider, { makeClient: () => makeClient(cacheConfig) }, children);
104
+ };
105
+ // Annotate the CommonJS export names for ESM import in node:
106
+ 0 && (module.exports = {
107
+ ApolloWrapper
108
+ });
@@ -0,0 +1,8 @@
1
+ import { InMemoryCacheConfig } from '@apollo/client';
2
+ import React__default, { PropsWithChildren } from 'react';
3
+
4
+ declare const ApolloWrapper: ({ children, cacheConfig, }: PropsWithChildren<{
5
+ cacheConfig?: InMemoryCacheConfig;
6
+ }>) => React__default.JSX.Element;
7
+
8
+ export { ApolloWrapper };
@@ -0,0 +1,8 @@
1
+ import { InMemoryCacheConfig } from '@apollo/client';
2
+ import React__default, { PropsWithChildren } from 'react';
3
+
4
+ declare const ApolloWrapper: ({ children, cacheConfig, }: PropsWithChildren<{
5
+ cacheConfig?: InMemoryCacheConfig;
6
+ }>) => React__default.JSX.Element;
7
+
8
+ export { ApolloWrapper };
@@ -0,0 +1,78 @@
1
+ "use client";
2
+
3
+ // src/graphql/next.tsx
4
+ import { HttpLink } from "@apollo/client";
5
+ import {
6
+ ApolloClient,
7
+ ApolloNextAppProvider,
8
+ InMemoryCache
9
+ } from "@apollo/client-integration-nextjs";
10
+ import React from "react";
11
+
12
+ // src/env.ts
13
+ var getEnvValue = (key) => {
14
+ switch (key) {
15
+ case "NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */:
16
+ return process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || process.env.EXPO_PUBLIC_GRAPHQL_ENDPOINT;
17
+ case "NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */:
18
+ return process.env.NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT || process.env.EXPO_PUBLIC_EMAIL_AUTH_ENDPOINT;
19
+ case "NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT" /* NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT */:
20
+ return process.env.NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT || process.env.EXPO_PUBLIC_GOOGLE_AUTH_ENDPOINT;
21
+ case "NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */:
22
+ return process.env.NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT || process.env.EXPO_PUBLIC_INSTAGRAM_AUTH_ENDPOINT;
23
+ case "NEXT_PUBLIC_FILE_ENDPOINT" /* NEXT_PUBLIC_FILE_ENDPOINT */:
24
+ return process.env.NEXT_PUBLIC_FILE_ENDPOINT || process.env.EXPO_PUBLIC_FILE_ENDPOINT;
25
+ case "NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */:
26
+ return process.env.NEXT_PUBLIC_BASE_URL || process.env.EXPO_PUBLIC_BASE_URL;
27
+ case "REFRESH_KEY" /* REFRESH_KEY */:
28
+ return process.env.REFRESH_KEY;
29
+ case "SIGNING_KEY" /* SIGNING_KEY */:
30
+ return process.env.SIGNING_KEY;
31
+ case "INSTAGRAM_CLIENT_SECRET" /* INSTAGRAM_CLIENT_SECRET */:
32
+ return process.env.INSTAGRAM_CLIENT_SECRET;
33
+ case "INSTAGRAM_CLIENT_ID" /* INSTAGRAM_CLIENT_ID */:
34
+ return process.env.INSTAGRAM_CLIENT_ID;
35
+ case "GOOGLE_CLIENT_SECRET" /* GOOGLE_CLIENT_SECRET */:
36
+ return process.env.GOOGLE_CLIENT_SECRET;
37
+ case "GOOGLE_CLIENT_ID" /* GOOGLE_CLIENT_ID */:
38
+ return process.env.GOOGLE_CLIENT_ID;
39
+ case "TURNSTILE_KEY" /* TURNSTILE_KEY */:
40
+ return process.env.TURNSTILE_KEY;
41
+ case "AWS_ACCESS_KEY_ID" /* AWS_ACCESS_KEY_ID */:
42
+ return process.env.AWS_ACCESS_KEY_ID;
43
+ case "AWS_ACCESS_KEY_SECRET" /* AWS_ACCESS_KEY_SECRET */:
44
+ return process.env.AWS_ACCESS_KEY_SECRET;
45
+ case "AWS_REGION" /* AWS_REGION */:
46
+ return process.env.AWS_REGION;
47
+ case "AWS_BUCKET" /* AWS_BUCKET */:
48
+ return process.env.AWS_BUCKET;
49
+ case "NODE_ENV" /* NODE_ENV */:
50
+ return process.env.NODE_ENV;
51
+ default:
52
+ return process.env[key];
53
+ }
54
+ };
55
+ function getEnv(key, skipCheck) {
56
+ const value = getEnvValue(key);
57
+ if (!skipCheck && !value) throw new Error(`${key} is not defined`);
58
+ return value;
59
+ }
60
+
61
+ // src/graphql/next.tsx
62
+ function makeClient(cacheConfig) {
63
+ return new ApolloClient({
64
+ cache: new InMemoryCache(cacheConfig),
65
+ link: new HttpLink({
66
+ uri: getEnv("NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */)
67
+ })
68
+ });
69
+ }
70
+ var ApolloWrapper = ({
71
+ children,
72
+ cacheConfig
73
+ }) => {
74
+ return /* @__PURE__ */ React.createElement(ApolloNextAppProvider, { makeClient: () => makeClient(cacheConfig) }, children);
75
+ };
76
+ export {
77
+ ApolloWrapper
78
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.5.27",
3
+ "version": "1.5.28",
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",
@@ -33,6 +33,11 @@
33
33
  "import": "./dist/graphql/client.esm.js",
34
34
  "require": "./dist/graphql/client.cjs.js"
35
35
  },
36
+ "./graphql/next": {
37
+ "types": "./dist/graphql/next.d.ts",
38
+ "import": "./dist/graphql/next.esm.js",
39
+ "require": "./dist/graphql/next.cjs.js"
40
+ },
36
41
  "./auth/email/client": {
37
42
  "types": "./dist/auth/email/client.d.ts",
38
43
  "import": "./dist/auth/email/client.esm.js",