@stryke/trpc-next 0.5.35 → 0.5.37

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 (207) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{chunk-Bmb41Sf3.cjs → _virtual/rolldown_runtime.cjs} +1 -1
  3. package/dist/action-handler.cjs +1 -1
  4. package/dist/action-handler.d.cts +25 -2
  5. package/dist/action-handler.d.cts.map +1 -0
  6. package/dist/action-handler.d.mts +25 -2
  7. package/dist/action-handler.d.mts.map +1 -0
  8. package/dist/action-handler.mjs +2 -1
  9. package/dist/action-handler.mjs.map +1 -0
  10. package/dist/client.cjs +1 -1
  11. package/dist/client.d.cts +23 -2
  12. package/dist/client.d.cts.map +1 -0
  13. package/dist/client.d.mts +23 -2
  14. package/dist/client.d.mts.map +1 -0
  15. package/dist/client.mjs +2 -1
  16. package/dist/client.mjs.map +1 -0
  17. package/dist/env/src/ci-checks.cjs +1 -0
  18. package/dist/env/src/ci-checks.mjs +2 -0
  19. package/dist/env/src/ci-checks.mjs.map +1 -0
  20. package/dist/env/src/environment-checks.cjs +1 -0
  21. package/dist/env/src/environment-checks.mjs +2 -0
  22. package/dist/env/src/environment-checks.mjs.map +1 -0
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +7 -7
  25. package/dist/index.d.mts +7 -7
  26. package/dist/index.mjs +1 -1
  27. package/dist/path/src/is-type.cjs +1 -0
  28. package/dist/path/src/is-type.mjs +2 -0
  29. package/dist/path/src/is-type.mjs.map +1 -0
  30. package/dist/path/src/join-paths.cjs +1 -0
  31. package/dist/path/src/join-paths.mjs +2 -0
  32. package/dist/path/src/join-paths.mjs.map +1 -0
  33. package/dist/path/src/regex.cjs +1 -0
  34. package/dist/path/src/regex.mjs +2 -0
  35. package/dist/path/src/regex.mjs.map +1 -0
  36. package/dist/path/src/slash.cjs +1 -0
  37. package/dist/path/src/slash.mjs +2 -0
  38. package/dist/path/src/slash.mjs.map +1 -0
  39. package/dist/server.cjs +1 -1
  40. package/dist/server.d.cts +40 -2
  41. package/dist/server.d.cts.map +1 -0
  42. package/dist/server.d.mts +40 -2
  43. package/dist/server.d.mts.map +1 -0
  44. package/dist/server.mjs +2 -1
  45. package/dist/server.mjs.map +1 -0
  46. package/dist/shared.cjs +1 -1
  47. package/dist/shared.d.cts +17 -2
  48. package/dist/shared.d.cts.map +1 -0
  49. package/dist/shared.d.mts +17 -2
  50. package/dist/shared.d.mts.map +1 -0
  51. package/dist/shared.mjs +2 -1
  52. package/dist/shared.mjs.map +1 -0
  53. package/dist/shield/constructors.cjs +1 -1
  54. package/dist/shield/constructors.d.cts +60 -2
  55. package/dist/shield/constructors.d.cts.map +1 -0
  56. package/dist/shield/constructors.d.mts +60 -2
  57. package/dist/shield/constructors.d.mts.map +1 -0
  58. package/dist/shield/constructors.mjs +2 -1
  59. package/dist/shield/constructors.mjs.map +1 -0
  60. package/dist/shield/generator.cjs +1 -1
  61. package/dist/shield/generator.d.cts +1 -1
  62. package/dist/shield/generator.d.mts +1 -1
  63. package/dist/shield/generator.mjs +2 -1
  64. package/dist/shield/generator.mjs.map +1 -0
  65. package/dist/shield/index.cjs +1 -1
  66. package/dist/shield/index.d.cts +3 -3
  67. package/dist/shield/index.d.mts +3 -3
  68. package/dist/shield/index.mjs +1 -1
  69. package/dist/shield/rules.cjs +1 -1
  70. package/dist/shield/rules.d.cts +126 -2
  71. package/dist/shield/rules.d.cts.map +1 -0
  72. package/dist/shield/rules.d.mts +126 -2
  73. package/dist/shield/rules.d.mts.map +1 -0
  74. package/dist/shield/rules.mjs +2 -1
  75. package/dist/shield/rules.mjs.map +1 -0
  76. package/dist/shield/shield.cjs +1 -1
  77. package/dist/shield/shield.d.cts +12 -2
  78. package/dist/shield/shield.d.cts.map +1 -0
  79. package/dist/shield/shield.d.mts +12 -2
  80. package/dist/shield/shield.d.mts.map +1 -0
  81. package/dist/shield/shield.mjs +2 -1
  82. package/dist/shield/shield.mjs.map +1 -0
  83. package/dist/shield/types.d.cts +54 -2
  84. package/dist/shield/types.d.cts.map +1 -0
  85. package/dist/shield/types.d.mts +54 -2
  86. package/dist/shield/types.d.mts.map +1 -0
  87. package/dist/shield/utils.cjs +1 -1
  88. package/dist/shield/utils.d.cts +1 -1
  89. package/dist/shield/utils.d.mts +1 -1
  90. package/dist/shield/utils.mjs +2 -1
  91. package/dist/shield/utils.mjs.map +1 -0
  92. package/dist/shield/validation.cjs +1 -1
  93. package/dist/shield/validation.d.cts +1 -1
  94. package/dist/shield/validation.d.mts +1 -1
  95. package/dist/shield/validation.mjs +2 -1
  96. package/dist/shield/validation.mjs.map +1 -0
  97. package/dist/tanstack-query/client.cjs +1 -1
  98. package/dist/tanstack-query/client.d.cts +24 -2
  99. package/dist/tanstack-query/client.d.cts.map +1 -0
  100. package/dist/tanstack-query/client.d.mts +24 -2
  101. package/dist/tanstack-query/client.d.mts.map +1 -0
  102. package/dist/tanstack-query/client.mjs +2 -1
  103. package/dist/tanstack-query/client.mjs.map +1 -0
  104. package/dist/tanstack-query/server.cjs +1 -1
  105. package/dist/tanstack-query/server.d.cts +29 -2
  106. package/dist/tanstack-query/server.d.cts.map +1 -0
  107. package/dist/tanstack-query/server.d.mts +30 -2
  108. package/dist/tanstack-query/server.d.mts.map +1 -0
  109. package/dist/tanstack-query/server.mjs +2 -1
  110. package/dist/tanstack-query/server.mjs.map +1 -0
  111. package/dist/{base-CqjEnYV3.d.mts → types/src/base.d.cts} +2 -2
  112. package/dist/types/src/base.d.cts.map +1 -0
  113. package/dist/{base-DPgDjFaD.d.cts → types/src/base.d.mts} +2 -2
  114. package/dist/types/src/base.d.mts.map +1 -0
  115. package/dist/types.d.cts +24 -2
  116. package/dist/types.d.cts.map +1 -0
  117. package/dist/types.d.mts +24 -2
  118. package/dist/types.d.mts.map +1 -0
  119. package/dist/{types-Cw1lFrh8.d.mts → url/src/types.d.cts} +2 -2
  120. package/dist/url/src/types.d.cts.map +1 -0
  121. package/dist/{types-DAOF6mF0.d.cts → url/src/types.d.mts} +2 -2
  122. package/dist/url/src/types.d.mts.map +1 -0
  123. package/package.json +9 -9
  124. package/dist/action-handler-BZllk1iG.d.cts +0 -25
  125. package/dist/action-handler-BZllk1iG.d.cts.map +0 -1
  126. package/dist/action-handler-CVqV5Q9h.mjs +0 -2
  127. package/dist/action-handler-CVqV5Q9h.mjs.map +0 -1
  128. package/dist/action-handler-Dbtdj5f6.cjs +0 -1
  129. package/dist/action-handler-pGD2y48d.d.mts +0 -25
  130. package/dist/action-handler-pGD2y48d.d.mts.map +0 -1
  131. package/dist/base-CqjEnYV3.d.mts.map +0 -1
  132. package/dist/base-DPgDjFaD.d.cts.map +0 -1
  133. package/dist/client-BGUjlQRG.d.mts +0 -24
  134. package/dist/client-BGUjlQRG.d.mts.map +0 -1
  135. package/dist/client-Bc3EmLXQ.cjs +0 -1
  136. package/dist/client-C6P7IzrW.d.cts +0 -23
  137. package/dist/client-C6P7IzrW.d.cts.map +0 -1
  138. package/dist/client-DipC5G1s.d.cts +0 -24
  139. package/dist/client-DipC5G1s.d.cts.map +0 -1
  140. package/dist/client-Dx_Z33kd.mjs +0 -2
  141. package/dist/client-Dx_Z33kd.mjs.map +0 -1
  142. package/dist/client-Smqp-czo.mjs +0 -2
  143. package/dist/client-Smqp-czo.mjs.map +0 -1
  144. package/dist/client-UQMUpxKX.cjs +0 -1
  145. package/dist/client-og56kPLb.d.mts +0 -23
  146. package/dist/client-og56kPLb.d.mts.map +0 -1
  147. package/dist/constructors-CZJirtLD.d.mts +0 -60
  148. package/dist/constructors-CZJirtLD.d.mts.map +0 -1
  149. package/dist/constructors-Ci0KIdpT.cjs +0 -1
  150. package/dist/constructors-D8jm55QX.d.cts +0 -60
  151. package/dist/constructors-D8jm55QX.d.cts.map +0 -1
  152. package/dist/constructors-DS4_VfMY.mjs +0 -2
  153. package/dist/constructors-DS4_VfMY.mjs.map +0 -1
  154. package/dist/generator-BMjBxqwW.cjs +0 -1
  155. package/dist/generator-BUKT1462.mjs +0 -2
  156. package/dist/generator-BUKT1462.mjs.map +0 -1
  157. package/dist/rules-BQG_li3s.d.mts +0 -126
  158. package/dist/rules-BQG_li3s.d.mts.map +0 -1
  159. package/dist/rules-Dezfml9a.d.cts +0 -126
  160. package/dist/rules-Dezfml9a.d.cts.map +0 -1
  161. package/dist/rules-Pim5ay7H.mjs +0 -2
  162. package/dist/rules-Pim5ay7H.mjs.map +0 -1
  163. package/dist/rules-X9N_B4Ng.cjs +0 -1
  164. package/dist/server-BRyvuuag.d.mts +0 -30
  165. package/dist/server-BRyvuuag.d.mts.map +0 -1
  166. package/dist/server-ByfRZWsB.mjs +0 -2
  167. package/dist/server-ByfRZWsB.mjs.map +0 -1
  168. package/dist/server-C9MWPumf.d.mts +0 -40
  169. package/dist/server-C9MWPumf.d.mts.map +0 -1
  170. package/dist/server-CURNRsUM.cjs +0 -1
  171. package/dist/server-CtRC7R6W.mjs +0 -2
  172. package/dist/server-CtRC7R6W.mjs.map +0 -1
  173. package/dist/server-DX1_jjPM.cjs +0 -1
  174. package/dist/server-D_Zne9Uo.d.cts +0 -40
  175. package/dist/server-D_Zne9Uo.d.cts.map +0 -1
  176. package/dist/server-eqo44H34.d.cts +0 -29
  177. package/dist/server-eqo44H34.d.cts.map +0 -1
  178. package/dist/shared-B2-fZV5o.cjs +0 -1
  179. package/dist/shared-BF016VSl.d.mts +0 -17
  180. package/dist/shared-BF016VSl.d.mts.map +0 -1
  181. package/dist/shared-C056xtsk.d.cts +0 -17
  182. package/dist/shared-C056xtsk.d.cts.map +0 -1
  183. package/dist/shared-onIZBajF.mjs +0 -2
  184. package/dist/shared-onIZBajF.mjs.map +0 -1
  185. package/dist/shield-C9tsUPil.d.cts +0 -12
  186. package/dist/shield-C9tsUPil.d.cts.map +0 -1
  187. package/dist/shield-Ccremha0.d.mts +0 -12
  188. package/dist/shield-Ccremha0.d.mts.map +0 -1
  189. package/dist/shield-H5KXWVOc.cjs +0 -1
  190. package/dist/shield-WlPQDud3.mjs +0 -2
  191. package/dist/shield-WlPQDud3.mjs.map +0 -1
  192. package/dist/types-BtaQZStA.d.cts +0 -54
  193. package/dist/types-BtaQZStA.d.cts.map +0 -1
  194. package/dist/types-C91Z3eq9.d.cts +0 -24
  195. package/dist/types-C91Z3eq9.d.cts.map +0 -1
  196. package/dist/types-CE6okwNh.d.mts +0 -54
  197. package/dist/types-CE6okwNh.d.mts.map +0 -1
  198. package/dist/types-Cw1lFrh8.d.mts.map +0 -1
  199. package/dist/types-DAOF6mF0.d.cts.map +0 -1
  200. package/dist/types-Dph-RPXu.d.mts +0 -24
  201. package/dist/types-Dph-RPXu.d.mts.map +0 -1
  202. package/dist/utils-EREuzpW1.mjs +0 -2
  203. package/dist/utils-EREuzpW1.mjs.map +0 -1
  204. package/dist/utils-ftoOfuuV.cjs +0 -1
  205. package/dist/validation-B_im4gA8.mjs +0 -2
  206. package/dist/validation-B_im4gA8.mjs.map +0 -1
  207. package/dist/validation-D-G5c6i-.cjs +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/trpc-next",
3
- "version": "0.5.35",
3
+ "version": "0.5.37",
4
4
  "type": "module",
5
5
  "description": "A package to help in using tRPC in modern NextJs applications.",
6
6
  "repository": {
@@ -74,8 +74,8 @@
74
74
  },
75
75
  "types": "./dist/index.d.cts",
76
76
  "peerDependencies": {
77
- "react": "^19.2.1",
78
- "react-dom": "^19.2.1",
77
+ "react": "^19.2.3",
78
+ "react-dom": "^19.2.3",
79
79
  "react-native": "^0.77.3"
80
80
  },
81
81
  "peerDependenciesMeta": {
@@ -86,10 +86,10 @@
86
86
  "dependencies": {
87
87
  "@js-temporal/polyfill": "^0.5.1",
88
88
  "@tanstack/react-query": "^5.90.12",
89
- "@trpc/client": "^11.7.2",
90
- "@trpc/next": "^11.7.2",
91
- "@trpc/server": "^11.7.2",
92
- "@trpc/tanstack-react-query": "^11.7.2",
89
+ "@trpc/client": "^11.8.0",
90
+ "@trpc/next": "^11.8.0",
91
+ "@trpc/server": "^11.8.0",
92
+ "@trpc/tanstack-react-query": "^11.8.0",
93
93
  "defu": "^6.1.4",
94
94
  "server-only": "^0.0.1",
95
95
  "superjson": "2.2.2"
@@ -98,8 +98,8 @@
98
98
  "@types/react": "^19.2.7",
99
99
  "@types/react-dom": "^19.2.3",
100
100
  "@types/react-native": "0.72.8",
101
- "tsdown": "^0.17.1"
101
+ "tsdown": "^0.17.2"
102
102
  },
103
103
  "publishConfig": { "access": "public" },
104
- "gitHead": "4fbdaeaa2b52b9665280e6c7cd5fee37031b9564"
104
+ "gitHead": "8f2e484743eb3ce54929e99096ca2ea188b4730e"
105
105
  }
@@ -1,25 +0,0 @@
1
- import { t as MaybePromise } from "./base-DPgDjFaD.cjs";
2
- import { t as BaseContext } from "./types-C91Z3eq9.cjs";
3
- import * as _trpc_server0 from "@trpc/server";
4
- import * as _trpc_next_app_dir_server0 from "@trpc/next/app-dir/server";
5
- import { AnyRootTypes, RootConfig } from "@trpc/server/unstable-core-do-not-import";
6
- import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies";
7
-
8
- //#region src/action-handler.d.ts
9
-
10
- /**
11
- * This client invokes procedures directly on the server without fetching over HTTP.
12
- *
13
- * @param t - The tRPC instance
14
- * @param createContext - An optional function to generate a context
15
- */
16
- declare function createTRPCServerActionHandler<TInstance extends {
17
- _config: RootConfig<AnyRootTypes>;
18
- }, TContext extends BaseContext = BaseContext>(cookies: () => Promise<ReadonlyRequestCookies>, t: TInstance, createContext?: () => MaybePromise<TContext>): <TProc extends _trpc_server0.AnyProcedure>(proc: TProc) => _trpc_next_app_dir_server0.TRPCActionHandler<{
19
- input: _trpc_server0.inferProcedureInput<TProc>;
20
- output: _trpc_server0.inferProcedureOutput<TProc>;
21
- errorShape: _trpc_server0.inferTRPCClientTypes<TInstance>["errorShape"];
22
- }>;
23
- //#endregion
24
- export { createTRPCServerActionHandler as t };
25
- //# sourceMappingURL=action-handler-BZllk1iG.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-handler-BZllk1iG.d.cts","names":[],"sources":["../src/action-handler.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AAoCA;;AAEa,iBAFG,6BAEH,CAAA,kBAAA;EAEM,OAAA,EAFN,UAEM,CAFK,YAEL,CAAA;CAAc,EAAA,iBAAd,WAAc,GAAA,WAAA,CAAA,CAAA,OAAA,EAAA,GAAA,GAEhB,OAFgB,CAER,sBAFQ,CAAA,EAAA,CAAA,EAG5B,SAH4B,EAAA,aAAA,CAAA,EAAA,GAAA,GAIV,YAJU,CAIG,QAJH,CAAA,CAAA,EAAA,CAAA,cAIE,aAAA,CAAyC,YAJ3C,CAAA,CAAA,IAAA,EAI2C,KAJ3C,EAAA,8BAI2C,iBAJ3C,CAAA;EAER,KAAA,mCAAA,MAAA,CAAA;EAAR,MAAA,oCAAA,MAAA,CAAA;EACZ,UAAA,oCAAA,UAAA,CAAA,CAAA,YAAA,CAAA;CAC+B,CAAA"}
@@ -1,2 +0,0 @@
1
- import{experimental_createServerActionHandler as e}from"@trpc/next/app-dir/server";import t from"defu";function n(n,r,i=async()=>({})){return e(r,{createContext:async()=>t(await Promise.resolve(i()),{headers:{cookies:(await n()).toString()??``}})})}export{n as t};
2
- //# sourceMappingURL=action-handler-CVqV5Q9h.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-handler-CVqV5Q9h.mjs","names":[],"sources":["../src/action-handler.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable camelcase */\n\nimport type { MaybePromise } from \"@stryke/types\";\nimport { experimental_createServerActionHandler } from \"@trpc/next/app-dir/server\";\nimport type {\n AnyRootTypes,\n RootConfig\n} from \"@trpc/server/unstable-core-do-not-import\";\nimport defu from \"defu\";\nimport type { ReadonlyRequestCookies } from \"next/dist/server/web/spec-extension/adapters/request-cookies\";\nimport type { BaseContext } from \"./types\";\n\n/**\n * This client invokes procedures directly on the server without fetching over HTTP.\n *\n * @param t - The tRPC instance\n * @param createContext - An optional function to generate a context\n */\nexport function createTRPCServerActionHandler<\n TInstance extends {\n _config: RootConfig<AnyRootTypes>;\n },\n TContext extends BaseContext = BaseContext\n>(\n cookies: () => Promise<ReadonlyRequestCookies>,\n t: TInstance,\n createContext: () => MaybePromise<TContext> = async () => ({}) as TContext\n) {\n return experimental_createServerActionHandler(t, {\n createContext: async () => {\n const context = await Promise.resolve(createContext());\n\n return defu(context, {\n headers: {\n // Pass the cookie header to the API\n cookies: (await cookies()).toString() ?? \"\"\n }\n });\n }\n });\n}\n"],"mappings":"uGAoCA,SAAgB,EAMd,EACA,EACA,EAA8C,UAAa,EAAE,EAC7D,CACA,OAAO,EAAuC,EAAG,CAC/C,cAAe,SAGN,EAFS,MAAM,QAAQ,QAAQ,GAAe,CAAC,CAEjC,CACnB,QAAS,CAEP,SAAU,MAAM,GAAS,EAAE,UAAU,EAAI,GAC1C,CACF,CAAC,CAEL,CAAC"}
@@ -1 +0,0 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`@trpc/next/app-dir/server`),n=require(`defu`);n=e.t(n);function r(e,r,i=async()=>({})){return(0,t.experimental_createServerActionHandler)(r,{createContext:async()=>(0,n.default)(await Promise.resolve(i()),{headers:{cookies:(await e()).toString()??``}})})}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return r}});
@@ -1,25 +0,0 @@
1
- import { t as MaybePromise } from "./base-CqjEnYV3.mjs";
2
- import { t as BaseContext } from "./types-Dph-RPXu.mjs";
3
- import * as _trpc_next_app_dir_server0 from "@trpc/next/app-dir/server";
4
- import * as _trpc_server0 from "@trpc/server";
5
- import { AnyRootTypes, RootConfig } from "@trpc/server/unstable-core-do-not-import";
6
- import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies";
7
-
8
- //#region src/action-handler.d.ts
9
-
10
- /**
11
- * This client invokes procedures directly on the server without fetching over HTTP.
12
- *
13
- * @param t - The tRPC instance
14
- * @param createContext - An optional function to generate a context
15
- */
16
- declare function createTRPCServerActionHandler<TInstance extends {
17
- _config: RootConfig<AnyRootTypes>;
18
- }, TContext extends BaseContext = BaseContext>(cookies: () => Promise<ReadonlyRequestCookies>, t: TInstance, createContext?: () => MaybePromise<TContext>): <TProc extends _trpc_server0.AnyProcedure>(proc: TProc) => _trpc_next_app_dir_server0.TRPCActionHandler<{
19
- input: _trpc_server0.inferProcedureInput<TProc>;
20
- output: _trpc_server0.inferProcedureOutput<TProc>;
21
- errorShape: _trpc_server0.inferTRPCClientTypes<TInstance>["errorShape"];
22
- }>;
23
- //#endregion
24
- export { createTRPCServerActionHandler as t };
25
- //# sourceMappingURL=action-handler-pGD2y48d.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"action-handler-pGD2y48d.d.mts","names":[],"sources":["../src/action-handler.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AAoCA;;AAEa,iBAFG,6BAEH,CAAA,kBAAA;EAEM,OAAA,EAFN,UAEM,CAFK,YAEL,CAAA;CAAc,EAAA,iBAAd,WAAc,GAAA,WAAA,CAAA,CAAA,OAAA,EAAA,GAAA,GAEhB,OAFgB,CAER,sBAFQ,CAAA,EAAA,CAAA,EAG5B,SAH4B,EAAA,aAAA,CAAA,EAAA,GAAA,GAIV,YAJU,CAIG,QAJH,CAAA,CAAA,EAAA,CAAA,cAIE,aAAA,CAAyC,YAJ3C,CAAA,CAAA,IAAA,EAI2C,KAJ3C,EAAA,8BAI2C,iBAJ3C,CAAA;EAER,KAAA,mCAAA,MAAA,CAAA;EAAR,MAAA,oCAAA,MAAA,CAAA;EACZ,UAAA,oCAAA,UAAA,CAAA,CAAA,YAAA,CAAA;CAC+B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-CqjEnYV3.d.mts","names":[],"sources":["../../types/src/base.ts"],"sourcesContent":[],"mappings":";;KA4KY,kBAAkB,IAAI,QAAQ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-DPgDjFaD.d.cts","names":[],"sources":["../../types/src/base.ts"],"sourcesContent":[],"mappings":";;KA4KY,kBAAkB,IAAI,QAAQ"}
@@ -1,24 +0,0 @@
1
- import { t as StormURLInterface } from "./types-Cw1lFrh8.mjs";
2
- import { QueryClient } from "@tanstack/react-query";
3
- import * as _trpc_tanstack_react_query0 from "@trpc/tanstack-react-query";
4
- import * as react0 from "react";
5
- import { AnyTRPCRouter } from "@trpc/server";
6
-
7
- //#region src/tanstack-query/client.d.ts
8
-
9
- /**
10
- * Create a TRPC Tanstack Query client.
11
- *
12
- * @returns The TRPC Tanstack Query client
13
- */
14
- declare function createTRPCTanstackQueryClient<TRouter extends AnyTRPCRouter>(baseUrl: string | StormURLInterface, queryClient: QueryClient): {
15
- useTRPCTanstackQuery: () => _trpc_tanstack_react_query0.TRPCOptionsProxy<TRouter, {
16
- keyPrefix: false;
17
- }>;
18
- TRPCTanstackQueryProvider: (props: {
19
- children: React.ReactNode;
20
- }) => react0.JSX.Element;
21
- };
22
- //#endregion
23
- export { createTRPCTanstackQueryClient as t };
24
- //# sourceMappingURL=client-BGUjlQRG.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-BGUjlQRG.d.mts","names":[],"sources":["../src/tanstack-query/client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;AAuCA;AAA8D,iBAA9C,6BAA8C,CAAA,gBAAA,aAAA,CAAA,CAAA,OAAA,EAAA,MAAA,GAC1C,iBAD0C,EAAA,WAAA,EAE/C,WAF+C,CAAA,EAAA;EAC1C,oBAAA,EAAA,GAAA,+CAAA,QAAA,EAAA;IACL,SAAA,EAAA,KAAA;;;IAM0C,QAAA,EAAN,KAAA,CAAM,SAAA;EAAW,CAAA,EAAA,GAAA,MAAA,CAAA,GAAA,CAAA,OAAA;CAAA"}
@@ -1 +0,0 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./shared-B2-fZV5o.cjs`);let n=require(`@trpc/client`),r=require(`@tanstack/react-query`),i=require(`@trpc/tanstack-react-query`),a=require(`react`),o=require(`react/jsx-runtime`);const s=(e=process.env)=>!!(e.STORM_CI||e.CI||e.CONTINUOUS_INTEGRATION||e.BUILD_NUMBER||e.RUN_ID||e.AGOLA_GIT_REF||e.AC_APPCIRCLE||e.APPVEYOR||e.CODEBUILD||e.TF_BUILD||e.bamboo_planKey||e.BITBUCKET_COMMIT||e.BITRISE_IO||e.BUDDY_WORKSPACE_ID||e.BUILDKITE||e.CIRCLECI||e.CIRRUS_CI||e.CF_BUILD_ID||e.CM_BUILD_ID||e.CI_NAME||e.DRONE||e.DSARI||e.EARTHLY_CI||e.EAS_BUILD||e.GERRIT_PROJECT||e.GITEA_ACTIONS||e.GITHUB_ACTIONS||e.GITLAB_CI||e.GOCD||e.BUILDER_OUTPUT||e.HARNESS_BUILD_ID||e.JENKINS_URL||e.BUILD_ID||e.LAYERCI||e.MAGNUM||e.NETLIFY||e.NEVERCODE||e.PROW_JOB_ID||e.RELEASE_BUILD_ID||e.RENDER||e.SAILCI||e.HUDSON||e.JENKINS_URL||e.BUILD_ID||e.SCREWDRIVER||e.SEMAPHORE||e.SOURCEHUT||e.STRIDER||e.TASK_ID||e.RUN_ID||e.TEAMCITY_VERSION||e.TRAVIS||e.VELA||e.NOW_BUILDER||e.APPCENTER_BUILD_ID||e.CI_XCODE_PROJECT||e.XCS),c=process?.platform||``,l=!!(process?.stdout&&process?.stdout.isTTY),u=!!process.env.DEBUG,d=process.env.STORM_MODE||process.env.NEXT_PUBLIC_VERCEL_ENV||process.env.NODE_ENV||`production`,f=[`stg`,`stage`,`staging`].includes(d?.toLowerCase());function p(e){return[`prd`,`prod`,`production`,`preprod`,`preproduction`,`uat`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const m=p(d);function h(e){return[`tst`,`test`,`testing`,`stg`,`stage`,`staging`,`qa`,`qualityassurance`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const g=h(d)||f||!!process.env.TEST;function _(e){return[`dev`,`development`,`int`,`integration`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const v=_(d)||u,y=!!process.env.MINIMAL||s()||g||!l,b=/^win/i.test(c),x=/^linux/i.test(c),S=/^darwin/i.test(c),C=!process.env.NO_COLOR&&(!!process.env.FORCE_COLOR||(l||b)&&process.env.TERM!==`dumb`||s()),w=(process?.versions?.node||``).replace(/^v/,``)||null,T=Number(w?.split(`.`)[0])||null;function E(e,s){let{TRPCProvider:c,useTRPC:l}=(0,i.createTRPCContext)();return{useTRPCTanstackQuery:l,TRPCTanstackQueryProvider:i=>{let{children:l}=i,[u]=(0,a.useState)(()=>(0,n.createTRPCClient)({links:[(0,n.loggerLink)({enabled:e=>v||e.direction===`down`&&e.result instanceof Error}),(0,n.httpBatchStreamLink)({transformer:t.r,url:t.n(e),headers:{"x-trpc-source":`react-query`}})]}));return(0,o.jsx)(c,{trpcClient:u,queryClient:s,children:(0,o.jsx)(r.QueryClientProvider,{client:s,children:l})})}}}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return E}});
@@ -1,23 +0,0 @@
1
- import { AnyTRPCRouter } from "@trpc/server";
2
- import { ActionHandlerDef, TRPCActionHandler } from "@trpc/next/app-dir/server";
3
- import * as _trpc_client0 from "@trpc/client";
4
- import { UseTRPCActionResult } from "@trpc/next/app-dir/client";
5
-
6
- //#region src/client.d.ts
7
-
8
- /**
9
- * Creates a tRPC client for the Next.js app directory.
10
- *
11
- * @param baseUrl - The base URL for the tRPC server. This is typically the URL of the Next.js app.
12
- * @returns A tRPC client that can be used to make requests to the server.
13
- */
14
- declare function createTRPCClient<TRouter extends AnyTRPCRouter>(baseUrl: string): _trpc_client0.TRPCClient<TRouter>;
15
- /**
16
- * Creates a tRPC action hook for the Next.js app directory.
17
- *
18
- * @returns A function that can be used to create a tRPC action hook.
19
- */
20
- declare function createUseAction<TRouter extends AnyTRPCRouter>(): <TDef extends ActionHandlerDef>(handler: TRPCActionHandler<TDef>, useActionOpts?: any) => UseTRPCActionResult<TDef>;
21
- //#endregion
22
- export { createUseAction as n, createTRPCClient as t };
23
- //# sourceMappingURL=client-C6P7IzrW.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-C6P7IzrW.d.cts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AA2CA;;;AACiB,iBADD,gBACC,CAAA,gBADgC,aAChC,CAAA,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,aAAA,CAAA,UAAA,CAAA,OAAA,CAAA;;AA8BjB;;;;AASa,iBATG,eASH,CAAA,gBATmC,aASnC,CAAA,CAAA,CAAA,EAAA,CAAA,aADiD,gBACjD,CAAA,CAAA,OAAA,EAAA,iBAAA,CAAkB,IAAlB,CAAA,EAAA,aAAA,CAAA,EAAA,GAAA,EAAA,GAEN,mBAFM,CAEc,IAFd,CAAA"}
@@ -1,24 +0,0 @@
1
- import { t as StormURLInterface } from "./types-DAOF6mF0.cjs";
2
- import { AnyTRPCRouter } from "@trpc/server";
3
- import * as _trpc_tanstack_react_query0 from "@trpc/tanstack-react-query";
4
- import { QueryClient } from "@tanstack/react-query";
5
- import * as react0 from "react";
6
-
7
- //#region src/tanstack-query/client.d.ts
8
-
9
- /**
10
- * Create a TRPC Tanstack Query client.
11
- *
12
- * @returns The TRPC Tanstack Query client
13
- */
14
- declare function createTRPCTanstackQueryClient<TRouter extends AnyTRPCRouter>(baseUrl: string | StormURLInterface, queryClient: QueryClient): {
15
- useTRPCTanstackQuery: () => _trpc_tanstack_react_query0.TRPCOptionsProxy<TRouter, {
16
- keyPrefix: false;
17
- }>;
18
- TRPCTanstackQueryProvider: (props: {
19
- children: React.ReactNode;
20
- }) => react0.JSX.Element;
21
- };
22
- //#endregion
23
- export { createTRPCTanstackQueryClient as t };
24
- //# sourceMappingURL=client-DipC5G1s.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-DipC5G1s.d.cts","names":[],"sources":["../src/tanstack-query/client.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;AAuCA;AAA8D,iBAA9C,6BAA8C,CAAA,gBAAA,aAAA,CAAA,CAAA,OAAA,EAAA,MAAA,GAC1C,iBAD0C,EAAA,WAAA,EAE/C,WAF+C,CAAA,EAAA;EAC1C,oBAAA,EAAA,GAAA,+CAAA,QAAA,EAAA;IACL,SAAA,EAAA,KAAA;;;IAM0C,QAAA,EAAN,KAAA,CAAM,SAAA;EAAW,CAAA,EAAA,GAAA,MAAA,CAAA,GAAA,CAAA,OAAA;CAAA"}
@@ -1,2 +0,0 @@
1
- import{n as e,r as t}from"./shared-onIZBajF.mjs";import{loggerLink as n}from"@trpc/client";import{experimental_createActionHook as r,experimental_createTRPCNextAppDirClient as i,experimental_serverActionLink as a}from"@trpc/next/app-dir/client";import{experimental_nextHttpLink as o}from"@trpc/next/app-dir/links/nextHttp";function s(r){return i({config(){return{links:[n({enabled:e=>!0}),o({transformer:t,batch:!0,url:e(r),headers(){return{"x-trpc-source":`client`}}})]}}})}function c(){return r({links:[n(),a({transformer:t})]})}export{c as n,s as t};
2
- //# sourceMappingURL=client-Dx_Z33kd.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-Dx_Z33kd.mjs","names":["createTRPCClient"],"sources":["../src/client.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n\"use client\";\n\n/* eslint-disable camelcase */\n\nimport { loggerLink } from \"@trpc/client\";\nimport type { UseTRPCActionResult } from \"@trpc/next/app-dir/client\";\nimport {\n experimental_createActionHook,\n experimental_createTRPCNextAppDirClient,\n experimental_serverActionLink\n} from \"@trpc/next/app-dir/client\";\nimport { experimental_nextHttpLink } from \"@trpc/next/app-dir/links/nextHttp\";\nimport type {\n ActionHandlerDef,\n TRPCActionHandler\n} from \"@trpc/next/app-dir/server\";\nimport type { AnyTRPCRouter } from \"@trpc/server\";\nimport { getTRPCServerUrl, transformer } from \"./shared\";\n\n/**\n * Creates a tRPC client for the Next.js app directory.\n *\n * @param baseUrl - The base URL for the tRPC server. This is typically the URL of the Next.js app.\n * @returns A tRPC client that can be used to make requests to the server.\n */\nexport function createTRPCClient<TRouter extends AnyTRPCRouter>(\n baseUrl: string\n) {\n return experimental_createTRPCNextAppDirClient<TRouter>({\n config() {\n return {\n links: [\n loggerLink({\n enabled: _op => true\n }),\n experimental_nextHttpLink({\n transformer,\n batch: true,\n url: getTRPCServerUrl(baseUrl),\n headers() {\n return {\n \"x-trpc-source\": \"client\"\n };\n }\n } as TRouter[\"_def\"][\"_config\"][\"$types\"])\n ]\n };\n }\n });\n}\n\n/**\n * Creates a tRPC action hook for the Next.js app directory.\n *\n * @returns A function that can be used to create a tRPC action hook.\n */\nexport function createUseAction<TRouter extends AnyTRPCRouter>() {\n return experimental_createActionHook<TRouter>({\n links: [\n loggerLink(),\n experimental_serverActionLink({\n transformer\n } as TRouter[\"_def\"][\"_config\"][\"$types\"])\n ]\n } as TRouter[\"_def\"][\"_config\"][\"$types\"]) as <TDef extends ActionHandlerDef>(\n handler: TRPCActionHandler<TDef>,\n useActionOpts?: any\n ) => UseTRPCActionResult<TDef>;\n}\n"],"mappings":"mUA2CA,SAAgBA,EACd,EACA,CACA,OAAO,EAAiD,CACtD,QAAS,CACP,MAAO,CACL,MAAO,CACL,EAAW,CACT,QAAS,GAAO,GACjB,CAAC,CACF,EAA0B,CACxB,cACA,MAAO,GACP,IAAK,EAAiB,EAAQ,CAC9B,SAAU,CACR,MAAO,CACL,gBAAiB,SAClB,EAEJ,CAAyC,CAC3C,CACF,EAEJ,CAAC,CAQJ,SAAgB,GAAiD,CAC/D,OAAO,EAAuC,CAC5C,MAAO,CACL,GAAY,CACZ,EAA8B,CAC5B,cACD,CAAyC,CAC3C,CACF,CAAyC"}
@@ -1,2 +0,0 @@
1
- import{n as e,r as t}from"./shared-onIZBajF.mjs";import{createTRPCClient as n,httpBatchStreamLink as r,loggerLink as i}from"@trpc/client";import{QueryClientProvider as a}from"@tanstack/react-query";import{createTRPCContext as o}from"@trpc/tanstack-react-query";import{useState as s}from"react";import{jsx as c}from"react/jsx-runtime";const l=(e=process.env)=>!!(e.STORM_CI||e.CI||e.CONTINUOUS_INTEGRATION||e.BUILD_NUMBER||e.RUN_ID||e.AGOLA_GIT_REF||e.AC_APPCIRCLE||e.APPVEYOR||e.CODEBUILD||e.TF_BUILD||e.bamboo_planKey||e.BITBUCKET_COMMIT||e.BITRISE_IO||e.BUDDY_WORKSPACE_ID||e.BUILDKITE||e.CIRCLECI||e.CIRRUS_CI||e.CF_BUILD_ID||e.CM_BUILD_ID||e.CI_NAME||e.DRONE||e.DSARI||e.EARTHLY_CI||e.EAS_BUILD||e.GERRIT_PROJECT||e.GITEA_ACTIONS||e.GITHUB_ACTIONS||e.GITLAB_CI||e.GOCD||e.BUILDER_OUTPUT||e.HARNESS_BUILD_ID||e.JENKINS_URL||e.BUILD_ID||e.LAYERCI||e.MAGNUM||e.NETLIFY||e.NEVERCODE||e.PROW_JOB_ID||e.RELEASE_BUILD_ID||e.RENDER||e.SAILCI||e.HUDSON||e.JENKINS_URL||e.BUILD_ID||e.SCREWDRIVER||e.SEMAPHORE||e.SOURCEHUT||e.STRIDER||e.TASK_ID||e.RUN_ID||e.TEAMCITY_VERSION||e.TRAVIS||e.VELA||e.NOW_BUILDER||e.APPCENTER_BUILD_ID||e.CI_XCODE_PROJECT||e.XCS),u=process?.platform||``,d=!!(process?.stdout&&process?.stdout.isTTY),f=!!process.env.DEBUG,p=process.env.STORM_MODE||process.env.NEXT_PUBLIC_VERCEL_ENV||process.env.NODE_ENV||`production`,m=[`stg`,`stage`,`staging`].includes(p?.toLowerCase());function h(e){return[`prd`,`prod`,`production`,`preprod`,`preproduction`,`uat`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}h(p);function g(e){return[`tst`,`test`,`testing`,`stg`,`stage`,`staging`,`qa`,`qualityassurance`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}g(p)||m||process.env.TEST;function _(e){return[`dev`,`development`,`int`,`integration`].includes(e?.toLowerCase()?.replace(/[\s\-_]/g,``))}const v=_(p)||f;process.env.MINIMAL||l();const y=/^win/i.test(u);/^linux/i.test(u),/^darwin/i.test(u),!process.env.NO_COLOR&&(process.env.FORCE_COLOR||(d||y)&&process.env.TERM!==`dumb`||l());const b=(process?.versions?.node||``).replace(/^v/,``)||null;Number(b?.split(`.`)[0]);function x(l,u){let{TRPCProvider:d,useTRPC:f}=o();return{useTRPCTanstackQuery:f,TRPCTanstackQueryProvider:o=>{let{children:f}=o,[p]=s(()=>n({links:[i({enabled:e=>v||e.direction===`down`&&e.result instanceof Error}),r({transformer:t,url:e(l),headers:{"x-trpc-source":`react-query`}})]}));return c(d,{trpcClient:p,queryClient:u,children:c(a,{client:u,children:f})})}}}export{x as t};
2
- //# sourceMappingURL=client-Smqp-czo.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-Smqp-czo.mjs","names":["mode"],"sources":["../../env/src/ci-checks.ts","../../env/src/environment-checks.ts","../src/tanstack-query/client.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Returns true if the current environment is a CI environment.\n *\n * @returns True if the current environment is a CI environment.\n */\nexport const isCI = (\n env: Record<string, string | undefined> = process.env\n): boolean => {\n // From https://github.com/watson/ci-info/blob/44e98cebcdf4403f162195fbcf90b1f69fc6e047/index.js#L54-L61\n // Evaluating at runtime makes it possible to change the values in our tests\n // This list is probably not exhaustive though `process.env.CI` should be enough\n // but since we were using this utility in the past, we want to keep the same behavior\n return Boolean(\n env.STORM_CI || // Custom CI\n env.CI || // Travis CI, CircleCI, Cirrus CI, GitLab CI, Appveyor, CodeShip, dsari\n env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI\n env.BUILD_NUMBER || // Jenkins, TeamCity\n env.RUN_ID || // TaskCluster, dsari\n // From `env` from v4.0.0 https://github.com/watson/ci-info/blob/3e1488e98680f1f776785fe8708a157b7f00e568/vendors.json\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.JENKINS_URL ||\n env.BUILD_ID ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n // See https://github.com/prisma/prisma/issues/22380 for why we commented it out\n // Users deploying on Vercel might have this env var set in the local dev env\n // env.VERCEL ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS ||\n false\n );\n};\n\n// Same logic as https://github.com/sindresorhus/is-interactive/blob/dc8037ae1a61d828cfb42761c345404055b1e036/index.js\n// But defaults to check `stdin` for our prompts\n// It checks that the stream is TTY, not a dumb terminal\n\n/**\n * Check if the current process is interactive\n *\n * @param stream - The stream to check\n * @returns True if the current process is interactive\n */\nexport const isInteractive = (stream = process.stdin): boolean => {\n return Boolean(stream?.isTTY && process.env.TERM !== \"dumb\");\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isCI } from \"./ci-checks\";\n\n/** Value of process.platform */\nexport const platform = process?.platform || \"\";\n\n/** Detect if stdout.TTY is available */\nexport const hasTTY = Boolean(process?.stdout && process?.stdout.isTTY);\n\n/** Detect if `DEBUG` environment variable is set */\nexport const isDebug = Boolean(process.env.DEBUG);\n\n/** Detect the `NODE_ENV` environment variable */\nconst mode =\n process.env.STORM_MODE ||\n process.env.NEXT_PUBLIC_VERCEL_ENV ||\n process.env.NODE_ENV ||\n \"production\";\n\n/** Detect if the application is running in a staging environment */\nexport const isStaging = [\"stg\", \"stage\", \"staging\"].includes(\n mode?.toLowerCase()\n);\n\n/**\n * Check if the current environment is production.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is production\n */\nexport function isProductionMode(mode: string) {\n return [\n \"prd\",\n \"prod\",\n \"production\",\n // eslint-disable-next-line @cspell/spellchecker\n \"preprod\",\n // eslint-disable-next-line @cspell/spellchecker\n \"preproduction\",\n \"uat\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `production` */\nexport const isProduction = isProductionMode(mode);\n\n/**\n * Check if the current environment is test.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is test\n */\nexport function isTestMode(mode: string) {\n return [\n \"tst\",\n \"test\",\n \"testing\",\n \"stg\",\n \"stage\",\n \"staging\",\n \"qa\",\n // eslint-disable-next-line @cspell/spellchecker\n \"qualityassurance\"\n ].includes(mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\"));\n}\n\n/** Detect if `NODE_ENV` environment variable is `test` */\nexport const isTest =\n isTestMode(mode) || isStaging || Boolean(process.env.TEST);\n\n/**\n * Check if the current environment is development.\n *\n * @param mode - The mode string to check.\n * @returns Whether the environment is development\n */\nexport function isDevelopmentMode(mode: string) {\n return [\"dev\", \"development\", \"int\", \"integration\"].includes(\n mode?.toLowerCase()?.replace(/[\\s\\-_]/g, \"\")\n );\n}\n\n/** Detect if `NODE_ENV` environment variable is `dev` or `development` */\nexport const isDevelopment = isDevelopmentMode(mode) || isDebug;\n\n/** Detect if MINIMAL environment variable is set, running in CI or test or TTY is unavailable */\nexport const isMinimal =\n Boolean(process.env.MINIMAL) || isCI() || isTest || !hasTTY;\n\n/** Detect if process.platform is Windows */\nexport const isWindows = /^win/i.test(platform);\n\n/** Detect if process.platform is Linux */\nexport const isLinux = /^linux/i.test(platform);\n\n/** Detect if process.platform is macOS (darwin kernel) */\nexport const isMacOS = /^darwin/i.test(platform);\n\n/** Color Support */\nexport const isColorSupported =\n !process.env.NO_COLOR &&\n (Boolean(process.env.FORCE_COLOR) ||\n ((hasTTY || isWindows) && process.env.TERM !== \"dumb\") ||\n isCI());\n\nfunction parseVersion(versionString = \"\") {\n if (/^\\d{3,4}$/.test(versionString)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(versionString) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versions = (versionString ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versions[0],\n minor: versions[1],\n patch: versions[2]\n };\n}\n\n/**\n * Check if the current environment supports hyperlinks in the terminal.\n *\n * @param stream - The stream to check for TTY support (default: process.stdout)\n * @returns Whether hyperlinks are supported\n */\nexport function isHyperlinkSupported(\n stream: NodeJS.WriteStream = process.stdout\n): boolean {\n if (process.env.FORCE_HYPERLINK) {\n return !(\n process.env.FORCE_HYPERLINK.length > 0 &&\n Number.parseInt(process.env.FORCE_HYPERLINK, 10) === 0\n );\n }\n\n // Netlify does not run a TTY, it does not need `supportsColor` check\n if (process.env.NETLIFY) {\n return true;\n } else if (!isColorSupported) {\n return false;\n } else if (stream && !stream.isTTY) {\n return false;\n } else if (\"WT_SESSION\" in process.env) {\n return true;\n } else if (process.platform === \"win32\") {\n return false;\n } else if (isCI()) {\n return false;\n } else if (process.env.TEAMCITY_VERSION) {\n return false;\n } else if (process.env.TERM_PROGRAM) {\n const version = parseVersion(process.env.TERM_PROGRAM_VERSION);\n\n switch (process.env.TERM_PROGRAM) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n case \"vscode\": {\n // Cursor forked VS Code and supports hyperlinks in 0.x.x\n if (process.env.CURSOR_TRACE_ID) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (process.env.VTE_VERSION) {\n // 0.50.0 was supposed to support hyperlinks, but throws a segfault\n if (process.env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(process.env.VTE_VERSION);\n\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (process.env.TERM === \"alacritty\") {\n return true;\n }\n\n return false;\n}\n\n/** Node.js versions */\nexport const nodeVersion =\n (process?.versions?.node || \"\").replace(/^v/, \"\") || null;\n\nexport const nodeMajorVersion = Number(nodeVersion?.split(\".\")[0]) || null;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n\"use client\";\n\nimport { isDevelopment } from \"@stryke/env/environment-checks\";\nimport type { StormURLInterface } from \"@stryke/url/types\";\nimport type { QueryClient } from \"@tanstack/react-query\";\nimport { QueryClientProvider } from \"@tanstack/react-query\";\nimport {\n createTRPCClient,\n httpBatchStreamLink,\n loggerLink\n} from \"@trpc/client\";\nimport type { AnyTRPCRouter } from \"@trpc/server\";\nimport { createTRPCContext } from \"@trpc/tanstack-react-query\";\nimport { useState } from \"react\";\nimport { getTRPCServerUrl, transformer } from \"../shared\";\n\n/**\n * Create a TRPC Tanstack Query client.\n *\n * @returns The TRPC Tanstack Query client\n */\nexport function createTRPCTanstackQueryClient<TRouter extends AnyTRPCRouter>(\n baseUrl: string | StormURLInterface,\n queryClient: QueryClient\n) {\n const { TRPCProvider, useTRPC } = createTRPCContext<TRouter>();\n\n return {\n useTRPCTanstackQuery: useTRPC,\n TRPCTanstackQueryProvider: (props: { children: React.ReactNode }) => {\n const { children } = props;\n\n const [trpcClient] = useState(() =>\n createTRPCClient<TRouter>({\n links: [\n loggerLink({\n enabled: op =>\n isDevelopment ||\n (op.direction === \"down\" && op.result instanceof Error)\n }),\n httpBatchStreamLink<TRouter>({\n transformer,\n url: getTRPCServerUrl(baseUrl),\n headers: { \"x-trpc-source\": \"react-query\" }\n } as TRouter[\"_def\"][\"_config\"][\"$types\"])\n ]\n })\n );\n\n return (\n <TRPCProvider trpcClient={trpcClient} queryClient={queryClient}>\n <QueryClientProvider client={queryClient}>\n {children}\n </QueryClientProvider>\n </TRPCProvider>\n );\n }\n };\n}\n"],"mappings":"8UAuBA,MAAa,GACX,EAA0C,QAAQ,MAM3C,GACL,EAAI,UACJ,EAAI,IACJ,EAAI,wBACJ,EAAI,cACJ,EAAI,QAEJ,EAAI,eACJ,EAAI,cACJ,EAAI,UACJ,EAAI,WACJ,EAAI,UACJ,EAAI,gBACJ,EAAI,kBACJ,EAAI,YACJ,EAAI,oBACJ,EAAI,WACJ,EAAI,UACJ,EAAI,WACJ,EAAI,aACJ,EAAI,aACJ,EAAI,SACJ,EAAI,OACJ,EAAI,OACJ,EAAI,YACJ,EAAI,WACJ,EAAI,gBACJ,EAAI,eACJ,EAAI,gBACJ,EAAI,WACJ,EAAI,MACJ,EAAI,gBACJ,EAAI,kBACJ,EAAI,aACJ,EAAI,UACJ,EAAI,SACJ,EAAI,QACJ,EAAI,SACJ,EAAI,WACJ,EAAI,aACJ,EAAI,kBACJ,EAAI,QACJ,EAAI,QACJ,EAAI,QACJ,EAAI,aACJ,EAAI,UACJ,EAAI,aACJ,EAAI,WACJ,EAAI,WACJ,EAAI,SACJ,EAAI,SACJ,EAAI,QACJ,EAAI,kBACJ,EAAI,QACJ,EAAI,MACJ,EAAI,aAIJ,EAAI,oBACJ,EAAI,kBACJ,EAAI,KCtEK,EAAW,SAAS,UAAY,GAGhC,EAAS,GAAQ,SAAS,QAAU,SAAS,OAAO,OAGpD,EAAU,EAAQ,QAAQ,IAAI,MAGrC,EACJ,QAAQ,IAAI,YACZ,QAAQ,IAAI,wBACZ,QAAQ,IAAI,UACZ,aAGW,EAAY,CAAC,MAAO,QAAS,UAAU,CAAC,SACnD,GAAM,aAAa,CACpB,CAQD,SAAgB,EAAiB,EAAc,CAC7C,MAAO,CACL,MACA,OACA,aAEA,UAEA,gBACA,MACD,CAAC,SAASA,GAAM,aAAa,EAAE,QAAQ,WAAY,GAAG,CAAC,CAI9B,EAAiB,EAAK,CAQlD,SAAgB,EAAW,EAAc,CACvC,MAAO,CACL,MACA,OACA,UACA,MACA,QACA,UACA,KAEA,mBACD,CAAC,SAASA,GAAM,aAAa,EAAE,QAAQ,WAAY,GAAG,CAAC,CAKxD,EAAW,EAAK,EAAI,GAAqB,QAAQ,IAAI,KAQvD,SAAgB,EAAkB,EAAc,CAC9C,MAAO,CAAC,MAAO,cAAe,MAAO,cAAc,CAAC,SAClDA,GAAM,aAAa,EAAE,QAAQ,WAAY,GAAG,CAC7C,CAIH,MAAa,EAAgB,EAAkB,EAAK,EAAI,EAI9C,QAAQ,IAAI,SAAY,GAAM,CAGxC,MAAa,EAAY,QAAQ,KAAK,EAAS,CAGxB,UAAU,KAAK,EAAS,CAGxB,WAAW,KAAK,EAAS,CAI9C,CAAC,QAAQ,IAAI,WACJ,QAAQ,IAAI,cACjB,GAAU,IAAc,QAAQ,IAAI,OAAS,QAC/C,GAAM,EA6GV,MAAa,GACV,SAAS,UAAU,MAAQ,IAAI,QAAQ,KAAM,GAAG,EAAI,KAEvB,OAAO,GAAa,MAAM,IAAI,CAAC,GAAG,CCjMlE,SAAgB,EACd,EACA,EACA,CACA,GAAM,CAAE,eAAc,WAAY,GAA4B,CAE9D,MAAO,CACL,qBAAsB,EACtB,0BAA4B,GAAyC,CACnE,GAAM,CAAE,YAAa,EAEf,CAAC,GAAc,MACnB,EAA0B,CACxB,MAAO,CACL,EAAW,CACT,QAAS,GACP,GACC,EAAG,YAAc,QAAU,EAAG,kBAAkB,MACpD,CAAC,CACF,EAA6B,CAC3B,cACA,IAAK,EAAiB,EAAQ,CAC9B,QAAS,CAAE,gBAAiB,cAAe,CAC5C,CAAyC,CAC3C,CACF,CAAC,CACH,CAED,OACE,EAAC,EAAA,CAAyB,aAAyB,uBACjD,EAAC,EAAA,CAAoB,OAAQ,EAC1B,YACmB,EACT,EAGpB"}
@@ -1 +0,0 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./shared-B2-fZV5o.cjs`);let n=require(`@trpc/client`),r=require(`@trpc/next/app-dir/client`),i=require(`@trpc/next/app-dir/links/nextHttp`);function a(e){return(0,r.experimental_createTRPCNextAppDirClient)({config(){return{links:[(0,n.loggerLink)({enabled:e=>!0}),(0,i.experimental_nextHttpLink)({transformer:t.r,batch:!0,url:t.n(e),headers(){return{"x-trpc-source":`client`}}})]}}})}function o(){return(0,r.experimental_createActionHook)({links:[(0,n.loggerLink)(),(0,r.experimental_serverActionLink)({transformer:t.r})]})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
@@ -1,23 +0,0 @@
1
- import { ActionHandlerDef, TRPCActionHandler } from "@trpc/next/app-dir/server";
2
- import * as _trpc_client0 from "@trpc/client";
3
- import { UseTRPCActionResult } from "@trpc/next/app-dir/client";
4
- import { AnyTRPCRouter } from "@trpc/server";
5
-
6
- //#region src/client.d.ts
7
-
8
- /**
9
- * Creates a tRPC client for the Next.js app directory.
10
- *
11
- * @param baseUrl - The base URL for the tRPC server. This is typically the URL of the Next.js app.
12
- * @returns A tRPC client that can be used to make requests to the server.
13
- */
14
- declare function createTRPCClient$1<TRouter extends AnyTRPCRouter>(baseUrl: string): _trpc_client0.TRPCClient<TRouter>;
15
- /**
16
- * Creates a tRPC action hook for the Next.js app directory.
17
- *
18
- * @returns A function that can be used to create a tRPC action hook.
19
- */
20
- declare function createUseAction<TRouter extends AnyTRPCRouter>(): <TDef extends ActionHandlerDef>(handler: TRPCActionHandler<TDef>, useActionOpts?: any) => UseTRPCActionResult<TDef>;
21
- //#endregion
22
- export { createUseAction as n, createTRPCClient$1 as t };
23
- //# sourceMappingURL=client-og56kPLb.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-og56kPLb.d.mts","names":[],"sources":["../src/client.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AA2CA;;;AACiB,iBADD,kBACC,CAAA,gBADgC,aAChC,CAAA,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,aAAA,CAAA,UAAA,CAAA,OAAA,CAAA;;AA8BjB;;;;AASa,iBATG,eASH,CAAA,gBATmC,aASnC,CAAA,CAAA,CAAA,EAAA,CAAA,aADiD,gBACjD,CAAA,CAAA,OAAA,EAAA,iBAAA,CAAkB,IAAlB,CAAA,EAAA,aAAA,CAAA,EAAA,GAAA,EAAA,GAEN,mBAFM,CAEc,IAFd,CAAA"}
@@ -1,60 +0,0 @@
1
- import { l as RuleFunctionInterface, m as ShieldRule, s as RuleConstructorOptionsInterface } from "./types-CE6okwNh.mjs";
2
- import { a as RuleFalse, c as RuleRace, i as RuleChain, l as RuleTrue, n as Rule, o as RuleNot, r as RuleAnd, s as RuleOr } from "./rules-BQG_li3s.mjs";
3
-
4
- //#region src/shield/constructors.d.ts
5
-
6
- /**
7
- * Wraps a function into a Rule class. This way we can identify rules
8
- * once we start generating middleware from our ruleTree.
9
- *
10
- * ```
11
- * // 1.
12
- * const auth = rule()(async (ctx, type, path, input, rawInput, options) => {
13
- * return true
14
- * })
15
- *
16
- * // 2.
17
- * const auth = rule('name')(async (ctx, type, path, input, rawInput, options) => {
18
- * return true
19
- * })
20
- *
21
- * // 3.
22
- * const auth = rule({
23
- * name: 'name',
24
- * })(async (ctx, type, path, input, rawInput, options) => {
25
- * return true
26
- * })
27
- * ```
28
- */
29
- declare const rule: <TContext extends Record<string, any>>(name?: string, options?: RuleConstructorOptionsInterface) => (func: RuleFunctionInterface<TContext>) => Rule<TContext>;
30
- /**
31
- * Logical operator and serves as a wrapper for and operation.
32
- */
33
- declare const and: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleAnd<TContext>;
34
- /**
35
- * Logical operator and serves as a wrapper for and operation.
36
- */
37
- declare const chain: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleChain<TContext>;
38
- /**
39
- * Logical operator and serves as a wrapper for and operation.
40
- */
41
- declare const race: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleRace<TContext>;
42
- /**
43
- * Logical operator or serves as a wrapper for or operation.
44
- */
45
- declare const or: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleOr<TContext>;
46
- /**
47
- * Logical operator not serves as a wrapper for not operation.
48
- */
49
- declare const not: <TContext extends Record<string, any>>(rule: ShieldRule<TContext>, error?: string | Error) => RuleNot<TContext>;
50
- /**
51
- * Allow queries.
52
- */
53
- declare const allow: RuleTrue<Record<string, any>>;
54
- /**
55
- * Deny queries.
56
- */
57
- declare const deny: RuleFalse<Record<string, any>>;
58
- //#endregion
59
- export { not as a, rule as c, deny as i, and as n, or as o, chain as r, race as s, allow as t };
60
- //# sourceMappingURL=constructors-CZJirtLD.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constructors-CZJirtLD.d.mts","names":[],"sources":["../src/shield/constructors.ts"],"sourcesContent":[],"mappings":";;;;;;;AAyDA;;;;;;;;AAuBA;;;;;;;AASA;;;;;;AAEY,cAlCC,IAkCD,EAAA,CAAA,iBAjCQ,MAiCR,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,IAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EA/BE,+BA+BF,EAAA,GAAA,CAAA,IAAA,EA7BH,qBA6BG,CA7BmB,QA6BnB,CAAA,EAAA,GA7B+B,IA6B/B,CA7BoC,QA6BpC,CAAA;AAOZ;;;AACY,cAnBC,GAmBD,EAAA,CAAA,iBAnByB,MAmBzB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EAlBA,UAkBA,CAlBW,QAkBX,CAAA,EAAA,EAAA,GAjBT,OAiBS,CAjBD,QAiBC,CAAA;;;;AAQC,cAlBA,KAsBZ,EAAA,CAAA,iBAtBsC,MAsBtC,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EArBW,UAqBX,CArBsB,QAqBtB,CAAA,EAAA,EAAA,GApBE,SAoBF,CApBY,QAoBZ,CAAA;;;;AAFS,cAXG,IAWH,EAAA,CAAA,iBAX4B,MAW5B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EAVE,UAUF,CAVa,QAUb,CAAA,EAAA,EAAA,GATP,QASO,CATE,QASF,CAAA;;;AAOV;AAAqC,cATxB,EASwB,EAAA,CAAA,iBATD,MASC,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EARzB,UAQyB,CARd,QAQc,CAAA,EAAA,EAAA,GAPlC,MAOkC,CAP3B,QAO2B,CAAA;;;;AAG1B,cAHE,GAGF,EAAA,CAAA,iBAH0B,MAG1B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,IAAA,EAFH,UAEG,CAFQ,QAER,CAAA,EAAA,KAAA,CAAA,EAAA,MAAA,GADQ,KACR,EAAA,GAAR,OAAQ,CAAA,QAAA,CAAA;;;AAQX;AAKa,cALA,KAKI,EALC,QAKD,CALC,MAKD,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA;;;;cAAJ,MAAI,UAAA"}
@@ -1 +0,0 @@
1
- const e=require(`./rules-X9N_B4Ng.cjs`),t=(t,n)=>r=>(typeof t==`object`?(n=t,t=Math.random().toString()):typeof t==`string`?n??={}:(t=Math.random().toString(),n={}),new e.n(t,r,{})),n=(...t)=>new e.r(t),r=(...t)=>new e.i(t),i=(...t)=>new e.c(t),a=(...t)=>new e.s(t),o=(t,n)=>typeof n==`string`?new e.o(t,Error(n)):new e.o(t,n),s=new e.l,c=new e.a;Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return s}});
@@ -1,60 +0,0 @@
1
- import { l as RuleFunctionInterface, m as ShieldRule, s as RuleConstructorOptionsInterface } from "./types-BtaQZStA.cjs";
2
- import { a as RuleFalse, c as RuleRace, i as RuleChain, l as RuleTrue, n as Rule, o as RuleNot, r as RuleAnd, s as RuleOr } from "./rules-Dezfml9a.cjs";
3
-
4
- //#region src/shield/constructors.d.ts
5
-
6
- /**
7
- * Wraps a function into a Rule class. This way we can identify rules
8
- * once we start generating middleware from our ruleTree.
9
- *
10
- * ```
11
- * // 1.
12
- * const auth = rule()(async (ctx, type, path, input, rawInput, options) => {
13
- * return true
14
- * })
15
- *
16
- * // 2.
17
- * const auth = rule('name')(async (ctx, type, path, input, rawInput, options) => {
18
- * return true
19
- * })
20
- *
21
- * // 3.
22
- * const auth = rule({
23
- * name: 'name',
24
- * })(async (ctx, type, path, input, rawInput, options) => {
25
- * return true
26
- * })
27
- * ```
28
- */
29
- declare const rule: <TContext extends Record<string, any>>(name?: string, options?: RuleConstructorOptionsInterface) => (func: RuleFunctionInterface<TContext>) => Rule<TContext>;
30
- /**
31
- * Logical operator and serves as a wrapper for and operation.
32
- */
33
- declare const and: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleAnd<TContext>;
34
- /**
35
- * Logical operator and serves as a wrapper for and operation.
36
- */
37
- declare const chain: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleChain<TContext>;
38
- /**
39
- * Logical operator and serves as a wrapper for and operation.
40
- */
41
- declare const race: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleRace<TContext>;
42
- /**
43
- * Logical operator or serves as a wrapper for or operation.
44
- */
45
- declare const or: <TContext extends Record<string, any>>(...rules: ShieldRule<TContext>[]) => RuleOr<TContext>;
46
- /**
47
- * Logical operator not serves as a wrapper for not operation.
48
- */
49
- declare const not: <TContext extends Record<string, any>>(rule: ShieldRule<TContext>, error?: string | Error) => RuleNot<TContext>;
50
- /**
51
- * Allow queries.
52
- */
53
- declare const allow: RuleTrue<Record<string, any>>;
54
- /**
55
- * Deny queries.
56
- */
57
- declare const deny: RuleFalse<Record<string, any>>;
58
- //#endregion
59
- export { not as a, rule as c, deny as i, and as n, or as o, chain as r, race as s, allow as t };
60
- //# sourceMappingURL=constructors-D8jm55QX.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constructors-D8jm55QX.d.cts","names":[],"sources":["../src/shield/constructors.ts"],"sourcesContent":[],"mappings":";;;;;;;AAyDA;;;;;;;;AAuBA;;;;;;;AASA;;;;;;AAEY,cAlCC,IAkCD,EAAA,CAAA,iBAjCQ,MAiCR,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,IAAA,CAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EA/BE,+BA+BF,EAAA,GAAA,CAAA,IAAA,EA7BH,qBA6BG,CA7BmB,QA6BnB,CAAA,EAAA,GA7B+B,IA6B/B,CA7BoC,QA6BpC,CAAA;AAOZ;;;AACY,cAnBC,GAmBD,EAAA,CAAA,iBAnByB,MAmBzB,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EAlBA,UAkBA,CAlBW,QAkBX,CAAA,EAAA,EAAA,GAjBT,OAiBS,CAjBD,QAiBC,CAAA;;;;AAQC,cAlBA,KAsBZ,EAAA,CAAA,iBAtBsC,MAsBtC,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EArBW,UAqBX,CArBsB,QAqBtB,CAAA,EAAA,EAAA,GApBE,SAoBF,CApBY,QAoBZ,CAAA;;;;AAFS,cAXG,IAWH,EAAA,CAAA,iBAX4B,MAW5B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EAVE,UAUF,CAVa,QAUb,CAAA,EAAA,EAAA,GATP,QASO,CATE,QASF,CAAA;;;AAOV;AAAqC,cATxB,EASwB,EAAA,CAAA,iBATD,MASC,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,GAAA,KAAA,EARzB,UAQyB,CARd,QAQc,CAAA,EAAA,EAAA,GAPlC,MAOkC,CAP3B,QAO2B,CAAA;;;;AAG1B,cAHE,GAGF,EAAA,CAAA,iBAH0B,MAG1B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA,IAAA,EAFH,UAEG,CAFQ,QAER,CAAA,EAAA,KAAA,CAAA,EAAA,MAAA,GADQ,KACR,EAAA,GAAR,OAAQ,CAAA,QAAA,CAAA;;;AAQX;AAKa,cALA,KAKI,EALC,QAKD,CALC,MAKD,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA;;;;cAAJ,MAAI,UAAA"}
@@ -1,2 +0,0 @@
1
- import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s}from"./rules-Pim5ay7H.mjs";const c=(e,t)=>n=>(typeof e==`object`?(t=e,e=Math.random().toString()):typeof e==`string`?t??={}:(e=Math.random().toString(),t={}),new i(e,n,{})),l=(...e)=>new o(e),u=(...e)=>new n(e),d=(...e)=>new t(e),f=(...e)=>new s(e),p=(e,t)=>typeof t==`string`?new a(e,Error(t)):new a(e,t),m=new r,h=new e;export{p as a,c,h as i,l as n,f as o,u as r,d as s,m as t};
2
- //# sourceMappingURL=constructors-DS4_VfMY.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constructors-DS4_VfMY.mjs","names":["rule"],"sources":["../src/shield/constructors.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Rule,\n RuleAnd,\n RuleChain,\n RuleFalse,\n RuleNot,\n RuleOr,\n RuleRace,\n RuleTrue\n} from \"./rules\";\nimport type {\n RuleConstructorOptionsInterface,\n RuleFunctionInterface,\n ShieldRule\n} from \"./types\";\n\n/**\n * Wraps a function into a Rule class. This way we can identify rules\n * once we start generating middleware from our ruleTree.\n *\n * ```\n * // 1.\n * const auth = rule()(async (ctx, type, path, input, rawInput, options) => {\n * return true\n * })\n *\n * // 2.\n * const auth = rule('name')(async (ctx, type, path, input, rawInput, options) => {\n * return true\n * })\n *\n * // 3.\n * const auth = rule({\n * name: 'name',\n * })(async (ctx, type, path, input, rawInput, options) => {\n * return true\n * })\n * ```\n */\nexport const rule =\n <TContext extends Record<string, any>>(\n name?: string,\n options?: RuleConstructorOptionsInterface\n ) =>\n (func: RuleFunctionInterface<TContext>): Rule<TContext> => {\n if (typeof name === \"object\") {\n options = name;\n name = Math.random().toString();\n } else if (typeof name === \"string\") {\n options = options ?? {};\n } else {\n name = Math.random().toString();\n options = {};\n }\n\n // @ts-ignore\n return new Rule(name, func, {});\n };\n\n/**\n * Logical operator and serves as a wrapper for and operation.\n */\nexport const and = <TContext extends Record<string, any>>(\n ...rules: ShieldRule<TContext>[]\n): RuleAnd<TContext> => {\n return new RuleAnd(rules);\n};\n\n/**\n * Logical operator and serves as a wrapper for and operation.\n */\nexport const chain = <TContext extends Record<string, any>>(\n ...rules: ShieldRule<TContext>[]\n): RuleChain<TContext> => {\n return new RuleChain(rules);\n};\n\n/**\n * Logical operator and serves as a wrapper for and operation.\n */\nexport const race = <TContext extends Record<string, any>>(\n ...rules: ShieldRule<TContext>[]\n): RuleRace<TContext> => {\n return new RuleRace(rules);\n};\n\n/**\n * Logical operator or serves as a wrapper for or operation.\n */\nexport const or = <TContext extends Record<string, any>>(\n ...rules: ShieldRule<TContext>[]\n): RuleOr<TContext> => {\n return new RuleOr(rules);\n};\n\n/**\n * Logical operator not serves as a wrapper for not operation.\n */\nexport const not = <TContext extends Record<string, any>>(\n rule: ShieldRule<TContext>,\n error?: string | Error\n): RuleNot<TContext> => {\n if (typeof error === \"string\") return new RuleNot(rule, new Error(error));\n return new RuleNot(rule, error);\n};\n\n/**\n * Allow queries.\n */\nexport const allow = new RuleTrue();\n\n/**\n * Deny queries.\n */\nexport const deny = new RuleFalse();\n"],"mappings":"qFAyDA,MAAa,GAET,EACA,IAED,IACK,OAAO,GAAS,UAClB,EAAU,EACV,EAAO,KAAK,QAAQ,CAAC,UAAU,EACtB,OAAO,GAAS,SACzB,IAAqB,EAAE,EAEvB,EAAO,KAAK,QAAQ,CAAC,UAAU,CAC/B,EAAU,EAAE,EAIP,IAAI,EAAK,EAAM,EAAM,EAAE,CAAC,EAMtB,GACX,GAAG,IAEI,IAAI,EAAQ,EAAM,CAMd,GACX,GAAG,IAEI,IAAI,EAAU,EAAM,CAMhB,GACX,GAAG,IAEI,IAAI,EAAS,EAAM,CAMf,GACX,GAAG,IAEI,IAAI,EAAO,EAAM,CAMb,GACX,EACA,IAEI,OAAO,GAAU,SAAiB,IAAI,EAAQA,EAAU,MAAM,EAAM,CAAC,CAClE,IAAI,EAAQA,EAAM,EAAM,CAMpB,EAAQ,IAAI,EAKZ,EAAO,IAAI"}
@@ -1 +0,0 @@
1
- function e(e,t){return async({next:n,ctx:r,type:i,path:a,input:o,rawInput:s})=>{let c=a.split(`.`),l=c[c.length-1],u=Object.keys(e),d;if(u.includes(`query`)||u.includes(`mutation`))d=e?.[i]?.[l];else{let t=e[c[0]];t?.[i]?.[l]&&(d=t?.[i]?.[l])}return d??=t.fallbackRule,d?d?.resolve(r,i,a,o,s,t).then(async e=>{if(e instanceof Error)throw e;if(!e)throw t.fallbackError;return n()}):n()}}Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
@@ -1,2 +0,0 @@
1
- function e(e,t){return async({next:n,ctx:r,type:i,path:a,input:o,rawInput:s})=>{let c=a.split(`.`),l=c[c.length-1],u=Object.keys(e),d;if(u.includes(`query`)||u.includes(`mutation`))d=e?.[i]?.[l];else{let t=e[c[0]];t?.[i]?.[l]&&(d=t?.[i]?.[l])}return d??=t.fallbackRule,d?d?.resolve(r,i,a,o,s,t).then(async e=>{if(e instanceof Error)throw e;if(!e)throw t.fallbackError;return n()}):n()}}export{e as t};
2
- //# sourceMappingURL=generator-BUKT1462.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator-BUKT1462.mjs","names":["opWithPath: Array<string>","opName: string","rule: ShieldRule<TContext> | undefined"],"sources":["../src/shield/generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { IRules, OptionsInterface, ShieldRule } from \"./types\";\n\n/**\n * Generates middleware from given rules.\n */\nexport function generateMiddlewareFromRuleTree<\n TContext extends Record<string, unknown>\n>(ruleTree: IRules<TContext>, options: OptionsInterface<TContext>) {\n return async ({\n next,\n ctx,\n type,\n path,\n input,\n rawInput\n }: {\n next: () => Promise<any>;\n ctx: TContext;\n type: string;\n path: string;\n input: { [name: string]: any };\n rawInput: unknown;\n }) => {\n const opWithPath: Array<string> = path.split(\".\");\n const opName: string = opWithPath[opWithPath.length - 1]!;\n const keys = Object.keys(ruleTree);\n let rule: ShieldRule<TContext> | undefined;\n if (keys.includes(\"query\") || keys.includes(\"mutation\")) {\n // @ts-ignore\n rule = ruleTree?.[type]?.[opName];\n } else {\n const namespace = opWithPath[0];\n\n const tree = (ruleTree as Record<string, any>)[namespace!];\n if (tree?.[type]?.[opName]) {\n rule = tree?.[type]?.[opName];\n }\n }\n rule = rule ?? options.fallbackRule;\n\n if (rule) {\n return rule\n ?.resolve(ctx, type, path, input, rawInput, options)\n .then(async result => {\n if (result instanceof Error) {\n throw result;\n }\n if (!result) {\n throw options.fallbackError;\n }\n\n return next();\n });\n }\n\n return next();\n };\n}\n"],"mappings":"AAuBA,SAAgB,EAEd,EAA4B,EAAqC,CACjE,OAAO,MAAO,CACZ,OACA,MACA,OACA,OACA,QACA,cAQI,CACJ,IAAMA,EAA4B,EAAK,MAAM,IAAI,CAC3CC,EAAiB,EAAW,EAAW,OAAS,GAChD,EAAO,OAAO,KAAK,EAAS,CAC9BC,EACJ,GAAI,EAAK,SAAS,QAAQ,EAAI,EAAK,SAAS,WAAW,CAErD,EAAO,IAAW,KAAQ,OACrB,CAGL,IAAM,EAAQ,EAFI,EAAW,IAGzB,IAAO,KAAQ,KACjB,EAAO,IAAO,KAAQ,IAoB1B,MAjBA,KAAe,EAAQ,aAEnB,EACK,GACH,QAAQ,EAAK,EAAM,EAAM,EAAO,EAAU,EAAQ,CACnD,KAAK,KAAM,IAAU,CACpB,GAAI,aAAkB,MACpB,MAAM,EAER,GAAI,CAAC,EACH,MAAM,EAAQ,cAGhB,OAAO,GAAM,EACb,CAGC,GAAM"}