naystack 1.4.28 → 1.4.29

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.
@@ -664,6 +664,7 @@ async function initGraphQLServer({
664
664
 
665
665
  // src/graphql/utils.ts
666
666
  var import_headers2 = require("next/headers");
667
+ var import_react = require("react");
667
668
  var import_type_graphql2 = require("type-graphql");
668
669
 
669
670
  // src/auth/constants.ts
@@ -703,40 +704,48 @@ var getUserId = async () => {
703
704
  return refresh ? getUserIdFromRefreshToken(refresh) : null;
704
705
  };
705
706
  function getAuthCaller(fn) {
706
- return async (data) => {
707
- const ctx = {
708
- userId: await getUserId(),
709
- isRefreshID: true
710
- };
711
- return await fn(ctx, data);
712
- };
707
+ return (0, import_react.cache)(
708
+ async (data) => {
709
+ const ctx = {
710
+ userId: await getUserId(),
711
+ isRefreshID: true
712
+ };
713
+ return await fn(ctx, data);
714
+ }
715
+ );
713
716
  }
714
717
  function getCaller(fn) {
715
- return async (data) => {
716
- const ctx = {
717
- userId: null,
718
- isRefreshID: true
719
- };
720
- return await fn(ctx, data);
721
- };
718
+ return (0, import_react.cache)(
719
+ async (data) => {
720
+ const ctx = {
721
+ userId: null,
722
+ isRefreshID: true
723
+ };
724
+ return await fn(ctx, data);
725
+ }
726
+ );
722
727
  }
723
728
  function getFieldAuthCaller(fn) {
724
- return async (root, data) => {
725
- const ctx = {
726
- userId: await getUserId(),
727
- isRefreshID: true
728
- };
729
- return await fn(root, ctx, data);
730
- };
729
+ return (0, import_react.cache)(
730
+ async (root, data) => {
731
+ const ctx = {
732
+ userId: await getUserId(),
733
+ isRefreshID: true
734
+ };
735
+ return await fn(root, ctx, data);
736
+ }
737
+ );
731
738
  }
732
739
  function getFieldCaller(fn) {
733
- return async (root, data) => {
734
- const ctx = {
735
- userId: null,
736
- isRefreshID: true
737
- };
738
- return await fn(root, ctx, data);
739
- };
740
+ return (0, import_react.cache)(
741
+ async (root, data) => {
742
+ const ctx = {
743
+ userId: null,
744
+ isRefreshID: true
745
+ };
746
+ return await fn(root, ctx, data);
747
+ }
748
+ );
740
749
  }
741
750
  function field(fn, options) {
742
751
  return {
@@ -651,6 +651,7 @@ async function initGraphQLServer({
651
651
 
652
652
  // src/graphql/utils.ts
653
653
  import { cookies as cookies2 } from "next/headers";
654
+ import { cache } from "react";
654
655
  import {
655
656
  Arg,
656
657
  Authorized,
@@ -699,40 +700,48 @@ var getUserId = async () => {
699
700
  return refresh ? getUserIdFromRefreshToken(refresh) : null;
700
701
  };
701
702
  function getAuthCaller(fn) {
702
- return async (data) => {
703
- const ctx = {
704
- userId: await getUserId(),
705
- isRefreshID: true
706
- };
707
- return await fn(ctx, data);
708
- };
703
+ return cache(
704
+ async (data) => {
705
+ const ctx = {
706
+ userId: await getUserId(),
707
+ isRefreshID: true
708
+ };
709
+ return await fn(ctx, data);
710
+ }
711
+ );
709
712
  }
710
713
  function getCaller(fn) {
711
- return async (data) => {
712
- const ctx = {
713
- userId: null,
714
- isRefreshID: true
715
- };
716
- return await fn(ctx, data);
717
- };
714
+ return cache(
715
+ async (data) => {
716
+ const ctx = {
717
+ userId: null,
718
+ isRefreshID: true
719
+ };
720
+ return await fn(ctx, data);
721
+ }
722
+ );
718
723
  }
719
724
  function getFieldAuthCaller(fn) {
720
- return async (root, data) => {
721
- const ctx = {
722
- userId: await getUserId(),
723
- isRefreshID: true
724
- };
725
- return await fn(root, ctx, data);
726
- };
725
+ return cache(
726
+ async (root, data) => {
727
+ const ctx = {
728
+ userId: await getUserId(),
729
+ isRefreshID: true
730
+ };
731
+ return await fn(root, ctx, data);
732
+ }
733
+ );
727
734
  }
728
735
  function getFieldCaller(fn) {
729
- return async (root, data) => {
730
- const ctx = {
731
- userId: null,
732
- isRefreshID: true
733
- };
734
- return await fn(root, ctx, data);
735
- };
736
+ return cache(
737
+ async (root, data) => {
738
+ const ctx = {
739
+ userId: null,
740
+ isRefreshID: true
741
+ };
742
+ return await fn(root, ctx, data);
743
+ }
744
+ );
736
745
  }
737
746
  function field(fn, options) {
738
747
  return {
@@ -35,6 +35,7 @@ __export(utils_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(utils_exports);
37
37
  var import_headers2 = require("next/headers");
38
+ var import_react = require("react");
38
39
  var import_type_graphql = require("type-graphql");
39
40
 
40
41
  // src/auth/constants.ts
@@ -125,40 +126,48 @@ var getUserId = async () => {
125
126
  return refresh ? getUserIdFromRefreshToken(refresh) : null;
126
127
  };
127
128
  function getAuthCaller(fn) {
128
- return async (data) => {
129
- const ctx = {
130
- userId: await getUserId(),
131
- isRefreshID: true
132
- };
133
- return await fn(ctx, data);
134
- };
129
+ return (0, import_react.cache)(
130
+ async (data) => {
131
+ const ctx = {
132
+ userId: await getUserId(),
133
+ isRefreshID: true
134
+ };
135
+ return await fn(ctx, data);
136
+ }
137
+ );
135
138
  }
136
139
  function getCaller(fn) {
137
- return async (data) => {
138
- const ctx = {
139
- userId: null,
140
- isRefreshID: true
141
- };
142
- return await fn(ctx, data);
143
- };
140
+ return (0, import_react.cache)(
141
+ async (data) => {
142
+ const ctx = {
143
+ userId: null,
144
+ isRefreshID: true
145
+ };
146
+ return await fn(ctx, data);
147
+ }
148
+ );
144
149
  }
145
150
  function getFieldAuthCaller(fn) {
146
- return async (root, data) => {
147
- const ctx = {
148
- userId: await getUserId(),
149
- isRefreshID: true
150
- };
151
- return await fn(root, ctx, data);
152
- };
151
+ return (0, import_react.cache)(
152
+ async (root, data) => {
153
+ const ctx = {
154
+ userId: await getUserId(),
155
+ isRefreshID: true
156
+ };
157
+ return await fn(root, ctx, data);
158
+ }
159
+ );
153
160
  }
154
161
  function getFieldCaller(fn) {
155
- return async (root, data) => {
156
- const ctx = {
157
- userId: null,
158
- isRefreshID: true
159
- };
160
- return await fn(root, ctx, data);
161
- };
162
+ return (0, import_react.cache)(
163
+ async (root, data) => {
164
+ const ctx = {
165
+ userId: null,
166
+ isRefreshID: true
167
+ };
168
+ return await fn(root, ctx, data);
169
+ }
170
+ );
162
171
  }
163
172
  function field(fn, options) {
164
173
  return {
@@ -11,6 +11,7 @@ var __decorateClass = (decorators, target, key, kind) => {
11
11
 
12
12
  // src/graphql/utils.ts
13
13
  import { cookies as cookies2 } from "next/headers";
14
+ import { cache } from "react";
14
15
  import {
15
16
  Arg,
16
17
  Authorized,
@@ -110,40 +111,48 @@ var getUserId = async () => {
110
111
  return refresh ? getUserIdFromRefreshToken(refresh) : null;
111
112
  };
112
113
  function getAuthCaller(fn) {
113
- return async (data) => {
114
- const ctx = {
115
- userId: await getUserId(),
116
- isRefreshID: true
117
- };
118
- return await fn(ctx, data);
119
- };
114
+ return cache(
115
+ async (data) => {
116
+ const ctx = {
117
+ userId: await getUserId(),
118
+ isRefreshID: true
119
+ };
120
+ return await fn(ctx, data);
121
+ }
122
+ );
120
123
  }
121
124
  function getCaller(fn) {
122
- return async (data) => {
123
- const ctx = {
124
- userId: null,
125
- isRefreshID: true
126
- };
127
- return await fn(ctx, data);
128
- };
125
+ return cache(
126
+ async (data) => {
127
+ const ctx = {
128
+ userId: null,
129
+ isRefreshID: true
130
+ };
131
+ return await fn(ctx, data);
132
+ }
133
+ );
129
134
  }
130
135
  function getFieldAuthCaller(fn) {
131
- return async (root, data) => {
132
- const ctx = {
133
- userId: await getUserId(),
134
- isRefreshID: true
135
- };
136
- return await fn(root, ctx, data);
137
- };
136
+ return cache(
137
+ async (root, data) => {
138
+ const ctx = {
139
+ userId: await getUserId(),
140
+ isRefreshID: true
141
+ };
142
+ return await fn(root, ctx, data);
143
+ }
144
+ );
138
145
  }
139
146
  function getFieldCaller(fn) {
140
- return async (root, data) => {
141
- const ctx = {
142
- userId: null,
143
- isRefreshID: true
144
- };
145
- return await fn(root, ctx, data);
146
- };
147
+ return cache(
148
+ async (root, data) => {
149
+ const ctx = {
150
+ userId: null,
151
+ isRefreshID: true
152
+ };
153
+ return await fn(root, ctx, data);
154
+ }
155
+ );
147
156
  }
148
157
  function field(fn, options) {
149
158
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.4.28",
3
+ "version": "1.4.29",
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",