naystack 1.2.24 → 1.2.25

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.
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
 
21
31
  // src/auth/email/client.tsx
@@ -28,7 +38,7 @@ __export(client_exports, {
28
38
  useToken: () => useToken
29
39
  });
30
40
  module.exports = __toCommonJS(client_exports);
31
- var import_react = require("react");
41
+ var import_react = __toESM(require("react"));
32
42
  var TokenContext = (0, import_react.createContext)({
33
43
  token: null,
34
44
  setToken: () => null
@@ -40,7 +50,7 @@ var getAuthWrapper = (endpoint) => ({ children }) => {
40
50
  credentials: "include"
41
51
  }).then((res) => res.json()).then((data) => setToken(data.accessToken));
42
52
  }, []);
43
- return /* @__PURE__ */ React.createElement(TokenContext.Provider, { value: { token, setToken } }, children);
53
+ return /* @__PURE__ */ import_react.default.createElement(TokenContext.Provider, { value: { token, setToken } }, children);
44
54
  };
45
55
  function useToken() {
46
56
  const { token } = (0, import_react.useContext)(TokenContext);
@@ -1,15 +1,14 @@
1
- import * as react from 'react';
2
- import { Dispatch, SetStateAction } from 'react';
1
+ import React__default, { Dispatch, SetStateAction } from 'react';
3
2
 
4
- declare const TokenContext: react.Context<{
3
+ declare const TokenContext: React__default.Context<{
5
4
  token: string | null;
6
5
  setToken: Dispatch<SetStateAction<string | null>>;
7
6
  }>;
8
7
  declare const getAuthWrapper: (endpoint: string) => ({ children }: {
9
- children: React.ReactNode;
10
- }) => react.JSX.Element;
8
+ children: React__default.ReactNode;
9
+ }) => React__default.JSX.Element;
11
10
  declare function useToken(): string | null;
12
- declare function useSetToken(): Dispatch<SetStateAction<string | null>>;
11
+ declare function useSetToken(): React__default.Dispatch<React__default.SetStateAction<string | null>>;
13
12
  declare function getEmailAuthUtils(endpoint: string): {
14
13
  useSignUp: () => (data: object) => Promise<string | null>;
15
14
  useLogin: () => (data: object) => Promise<string | null>;
@@ -1,15 +1,14 @@
1
- import * as react from 'react';
2
- import { Dispatch, SetStateAction } from 'react';
1
+ import React__default, { Dispatch, SetStateAction } from 'react';
3
2
 
4
- declare const TokenContext: react.Context<{
3
+ declare const TokenContext: React__default.Context<{
5
4
  token: string | null;
6
5
  setToken: Dispatch<SetStateAction<string | null>>;
7
6
  }>;
8
7
  declare const getAuthWrapper: (endpoint: string) => ({ children }: {
9
- children: React.ReactNode;
10
- }) => react.JSX.Element;
8
+ children: React__default.ReactNode;
9
+ }) => React__default.JSX.Element;
11
10
  declare function useToken(): string | null;
12
- declare function useSetToken(): Dispatch<SetStateAction<string | null>>;
11
+ declare function useSetToken(): React__default.Dispatch<React__default.SetStateAction<string | null>>;
13
12
  declare function getEmailAuthUtils(endpoint: string): {
14
13
  useSignUp: () => (data: object) => Promise<string | null>;
15
14
  useLogin: () => (data: object) => Promise<string | null>;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/auth/email/client.tsx
4
- import {
4
+ import React, {
5
5
  createContext,
6
6
  useCallback,
7
7
  useContext,
@@ -1,6 +1,6 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
 
3
- declare function useVisibility(onVisible?: () => void): react.RefObject<null>;
3
+ declare function useVisibility(onVisible?: () => void): React.RefObject<null>;
4
4
  declare function useBreakpoint(query: string): boolean | null;
5
5
 
6
6
  export { useBreakpoint, useVisibility };
@@ -1,6 +1,6 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
 
3
- declare function useVisibility(onVisible?: () => void): react.RefObject<null>;
3
+ declare function useVisibility(onVisible?: () => void): React.RefObject<null>;
4
4
  declare function useBreakpoint(query: string): boolean | null;
5
5
 
6
6
  export { useBreakpoint, useVisibility };
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
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
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
 
21
31
  // src/graphql/client.tsx
@@ -30,7 +40,7 @@ module.exports = __toCommonJS(client_exports);
30
40
  var import_client = require("@apollo/client");
31
41
  var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
32
42
  var import_client2 = require("naystack/auth/email/client");
33
- var import_react = require("react");
43
+ var import_react = __toESM(require("react"));
34
44
  var getApolloWrapper = (endpoint, options) => {
35
45
  function makeClient() {
36
46
  return new import_client_integration_nextjs.ApolloClient({
@@ -41,7 +51,7 @@ var getApolloWrapper = (endpoint, options) => {
41
51
  });
42
52
  }
43
53
  return ({ children }) => {
44
- return /* @__PURE__ */ React.createElement(import_client_integration_nextjs.ApolloNextAppProvider, { makeClient }, children);
54
+ return /* @__PURE__ */ import_react.default.createElement(import_client_integration_nextjs.ApolloNextAppProvider, { makeClient }, children);
45
55
  };
46
56
  };
47
57
  var tokenContext = (token) => {
@@ -1,12 +1,11 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
2
  import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@apollo/client';
3
- import * as react from 'react';
4
- import { PropsWithChildren } from 'react';
5
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
+ import React__default, { PropsWithChildren } from 'react';
6
5
 
7
6
  declare const getApolloWrapper: (endpoint: string, options?: {
8
7
  cacheConfig?: InMemoryCacheConfig;
9
- }) => ({ children }: PropsWithChildren) => react.JSX.Element;
8
+ }) => ({ children }: PropsWithChildren) => React__default.JSX.Element;
10
9
  declare const tokenContext: (token?: string | null) => {
11
10
  headers: {
12
11
  authorization: string;
@@ -1,12 +1,11 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
2
  import { InMemoryCacheConfig, OperationVariables, MutationHookOptions } from '@apollo/client';
3
- import * as react from 'react';
4
- import { PropsWithChildren } from 'react';
5
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
+ import React__default, { PropsWithChildren } from 'react';
6
5
 
7
6
  declare const getApolloWrapper: (endpoint: string, options?: {
8
7
  cacheConfig?: InMemoryCacheConfig;
9
- }) => ({ children }: PropsWithChildren) => react.JSX.Element;
8
+ }) => ({ children }: PropsWithChildren) => React__default.JSX.Element;
10
9
  declare const tokenContext: (token?: string | null) => {
11
10
  headers: {
12
11
  authorization: string;
@@ -12,7 +12,11 @@ import {
12
12
  InMemoryCache
13
13
  } from "@apollo/client-integration-nextjs";
14
14
  import { useToken } from "naystack/auth/email/client";
15
- import { useCallback, useEffect, useState } from "react";
15
+ import React, {
16
+ useCallback,
17
+ useEffect,
18
+ useState
19
+ } from "react";
16
20
  var getApolloWrapper = (endpoint, options) => {
17
21
  function makeClient() {
18
22
  return new ApolloClient({
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import { FC } from 'react';
3
3
  import { OperationVariables } from '@apollo/client';
4
4
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
@@ -15,7 +15,7 @@ declare function Injector<T, Y>({ fetch, Component, props, }: {
15
15
  data?: T;
16
16
  loading: boolean;
17
17
  } & Y>;
18
- } & ComponentProps<Y>): react.JSX.Element;
18
+ } & ComponentProps<Y>): React.JSX.Element;
19
19
  declare const getGraphQLQuery: ({ uri }: {
20
20
  uri: string;
21
21
  }) => <T, V extends OperationVariables>(_query: TypedDocumentNode<T, V>, options?: {
@@ -1,4 +1,4 @@
1
- import * as react from 'react';
1
+ import * as React from 'react';
2
2
  import { FC } from 'react';
3
3
  import { OperationVariables } from '@apollo/client';
4
4
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
@@ -15,7 +15,7 @@ declare function Injector<T, Y>({ fetch, Component, props, }: {
15
15
  data?: T;
16
16
  loading: boolean;
17
17
  } & Y>;
18
- } & ComponentProps<Y>): react.JSX.Element;
18
+ } & ComponentProps<Y>): React.JSX.Element;
19
19
  declare const getGraphQLQuery: ({ uri }: {
20
20
  uri: string;
21
21
  }) => <T, V extends OperationVariables>(_query: TypedDocumentNode<T, V>, options?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.2.24",
3
+ "version": "1.2.25",
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",