stellate 2.4.0 → 2.5.0

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.
package/dist/envelop.d.ts CHANGED
@@ -6,8 +6,8 @@ interface Options {
6
6
  fetch: typeof fetch;
7
7
  sendVariablesAsHash?: boolean;
8
8
  }
9
-
10
9
  declare function createBlake3Hash(str: string): number;
10
+
11
11
  declare const createStellateLoggerPlugin: (opts: Options) => Plugin<{
12
12
  request: Request;
13
13
  }>;
package/dist/envelop.js CHANGED
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var n in e)o(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!b.call(t,r)&&r!==n&&o(t,r,{get:()=>e[r],enumerable:!(s=h(e,r))||s.enumerable});return t};var v=t=>S(o({},"__esModule",{value:!0}),t);var x={};y(x,{createBlake3Hash:()=>i,createStellateLoggerPlugin:()=>w});module.exports=v(x);var d=require("graphql"),g=require("@envelop/core");function i(t){let e=0,n=t.length;if(n===0)return e;for(let s=0;s<n;++s){let r=t.charCodeAt(s);e=(e<<5)-e+r,e&=e}return e>>>0}var w=t=>({onExecute(e){let n=t.sendVariablesAsHash!=null?t.sendVariablesAsHash:!1,s=Date.now();return{async onExecuteDone({result:r}){if((0,g.isAsyncIterable)(r)){console.warn("Stellate does not currently support logging incremental results.");return}let{headers:a,method:c}=e.args.contextValue.request;if(a.has("gcdn-request-id"))return;let l=a.get("x-forwarded-for"),f=l?l.split(","):[],u=e.args.variableValues,p={operation:(0,d.print)(e.args.document),operationName:e.args.operationName||void 0,variables:n?void 0:u,variableHash:n?i(JSON.stringify(u||{})):void 0,method:c,elapsed:Date.now()-s,ip:f[0]||a.get("true-client-ip")||a.get("x-real-ip")||void 0,referer:a.get("referer")||void 0,userAgent:a.get("user-agent")||void 0,statusCode:200,errors:r.errors,responseSize:JSON.stringify(r).length,responseHash:i(JSON.stringify(r))};if(typeof t.fetch!="function"){console.warn("Stellate logger plugin requires a fetch function to be provided as an option.");return}await t.fetch(`https://${t.serviceName}.stellate.sh/log`,{method:"POST",body:JSON.stringify(p),headers:{"Content-Type":"application/json","Stellate-Logging-Token":t.token}})}}}});0&&(module.exports={createBlake3Hash,createStellateLoggerPlugin});
1
+ "use strict";var c=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},k=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of S(t))!x.call(e,n)&&n!==r&&c(e,n,{get:()=>t[n],enumerable:!(o=N(t,n))||o.enumerable});return e};var P=e=>k(c({},"__esModule",{value:!0}),e);var A={};v(A,{createBlake3Hash:()=>l,createStellateLoggerPlugin:()=>H});module.exports=P(A);var h=require("graphql"),m=require("@envelop/core");function l(e){let t=0,r=e.length;if(r===0)return t;for(let o=0;o<r;++o){let n=e.charCodeAt(o);t=(t<<5)-t+n,t&=t}return t>>>0}function p({headers:e,operation:t,method:r,start:o,operationName:n,errors:a,response:s,variables:i,sendVariablesAsHash:g,hasSetCookie:y}){let u=e.get("x-forwarded-for"),b=u?u.split(","):[];return{operation:t,operationName:n,variables:g?void 0:i,variableHash:g?l(JSON.stringify(i||{})):void 0,method:r,elapsed:Date.now()-o,ip:b[0]||e.get("true-client-ip")||e.get("x-real-ip")||void 0,hasSetCookie:y,referer:e.get("referer")||void 0,userAgent:e.get("user-agent")||void 0,statusCode:200,errors:a,responseSize:JSON.stringify(s).length,responseHash:l(JSON.stringify(s))}}function d(e){if(typeof e!="function"){console.warn("Stellate logger plugin requires a fetch function to be provided as an option.");return}}var w=process.env.STELLATE_ENDPOINT==="local"||process.env.STELLATE_ENDPOINT==="staging"?"stellate.dev":"stellate.sh";async function f({fetch:e,payload:t,token:r,serviceName:o}){return e(`https://${o}.${w}/log`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","Stellate-Logging-Token":r}})}var H=e=>({onExecute(t){let r=e.sendVariablesAsHash!=null?e.sendVariablesAsHash:!1,o=Date.now();return{async onExecuteDone({result:n}){if((0,m.isAsyncIterable)(n)){console.warn("Stellate does not currently support logging incremental results.");return}let{headers:a,method:s}=t.args.contextValue.request;if(a.has("gcdn-request-id"))return;let i=p({headers:a,operation:(0,h.print)(t.args.document),method:s,sendVariablesAsHash:r,start:o,operationName:t.args.operationName,errors:n.errors,response:n});d(e.fetch),await f({fetch:e.fetch,payload:i,token:e.token,serviceName:e.serviceName})}}}});0&&(module.exports={createBlake3Hash,createStellateLoggerPlugin});
package/dist/envelop.mjs CHANGED
@@ -4,6 +4,8 @@ const require = createRequire(import.meta.url);
4
4
  // src/envelop.ts
5
5
  import { print } from "graphql";
6
6
  import { isAsyncIterable } from "@envelop/core";
7
+
8
+ // src/server-plugins-shared.ts
7
9
  function createBlake3Hash(str) {
8
10
  let val = 0;
9
11
  const strlen = str.length;
@@ -17,6 +19,63 @@ function createBlake3Hash(str) {
17
19
  }
18
20
  return val >>> 0;
19
21
  }
22
+ function extractStellatePayload({
23
+ headers,
24
+ operation,
25
+ method,
26
+ start,
27
+ operationName,
28
+ errors,
29
+ response,
30
+ variables,
31
+ sendVariablesAsHash,
32
+ hasSetCookie
33
+ }) {
34
+ const forwardedFor = headers.get("x-forwarded-for");
35
+ const ips = forwardedFor ? forwardedFor.split(",") : [];
36
+ return {
37
+ operation,
38
+ operationName,
39
+ variables: sendVariablesAsHash ? void 0 : variables,
40
+ variableHash: sendVariablesAsHash ? createBlake3Hash(JSON.stringify(variables || {})) : void 0,
41
+ method,
42
+ elapsed: Date.now() - start,
43
+ ip: ips[0] || headers.get("true-client-ip") || headers.get("x-real-ip") || void 0,
44
+ hasSetCookie,
45
+ referer: headers.get("referer") || void 0,
46
+ userAgent: headers.get("user-agent") || void 0,
47
+ statusCode: 200,
48
+ errors,
49
+ responseSize: JSON.stringify(response).length,
50
+ responseHash: createBlake3Hash(JSON.stringify(response))
51
+ };
52
+ }
53
+ function warnFetch(fetch) {
54
+ if (typeof fetch !== "function") {
55
+ console.warn(
56
+ `Stellate logger plugin requires a fetch function to be provided as an option.`
57
+ );
58
+ return;
59
+ }
60
+ }
61
+ var hostname = process.env.STELLATE_ENDPOINT === "local" || process.env.STELLATE_ENDPOINT === "staging" ? "stellate.dev" : "stellate.sh";
62
+ async function logRequest({
63
+ fetch: fetchFn,
64
+ payload,
65
+ token,
66
+ serviceName
67
+ }) {
68
+ return fetchFn(`https://${serviceName}.${hostname}/log`, {
69
+ method: "POST",
70
+ body: JSON.stringify(payload),
71
+ headers: {
72
+ "Content-Type": "application/json",
73
+ "Stellate-Logging-Token": token
74
+ }
75
+ });
76
+ }
77
+
78
+ // src/envelop.ts
20
79
  var createStellateLoggerPlugin = (options) => ({
21
80
  onExecute(payload) {
22
81
  const sendVariablesAsHash = options.sendVariablesAsHash != null ? options.sendVariablesAsHash : false;
@@ -29,40 +88,25 @@ var createStellateLoggerPlugin = (options) => ({
29
88
  );
30
89
  return;
31
90
  }
32
- const { headers: requestHeaders, method } = payload.args.contextValue.request;
33
- if (requestHeaders.has("gcdn-request-id"))
91
+ const { headers, method } = payload.args.contextValue.request;
92
+ if (headers.has("gcdn-request-id"))
34
93
  return;
35
- const forwardedFor = requestHeaders.get("x-forwarded-for");
36
- const ips = forwardedFor ? forwardedFor.split(",") : [];
37
- const variables = payload.args.variableValues;
38
- const stellatePayload = {
94
+ const stellatePayload = extractStellatePayload({
95
+ headers,
39
96
  operation: print(payload.args.document),
40
- operationName: payload.args.operationName || void 0,
41
- variables: sendVariablesAsHash ? void 0 : variables,
42
- variableHash: sendVariablesAsHash ? createBlake3Hash(JSON.stringify(variables || {})) : void 0,
43
97
  method,
44
- elapsed: Date.now() - start,
45
- ip: ips[0] || requestHeaders.get("true-client-ip") || requestHeaders.get("x-real-ip") || void 0,
46
- referer: requestHeaders.get("referer") || void 0,
47
- userAgent: requestHeaders.get("user-agent") || void 0,
48
- statusCode: 200,
98
+ sendVariablesAsHash,
99
+ start,
100
+ operationName: payload.args.operationName,
49
101
  errors: result.errors,
50
- responseSize: JSON.stringify(result).length,
51
- responseHash: createBlake3Hash(JSON.stringify(result))
52
- };
53
- if (typeof options.fetch !== "function") {
54
- console.warn(
55
- `Stellate logger plugin requires a fetch function to be provided as an option.`
56
- );
57
- return;
58
- }
59
- await options.fetch(`https://${options.serviceName}.stellate.sh/log`, {
60
- method: "POST",
61
- body: JSON.stringify(stellatePayload),
62
- headers: {
63
- "Content-Type": "application/json",
64
- "Stellate-Logging-Token": options.token
65
- }
102
+ response: result
103
+ });
104
+ warnFetch(options.fetch);
105
+ await logRequest({
106
+ fetch: options.fetch,
107
+ payload: stellatePayload,
108
+ token: options.token,
109
+ serviceName: options.serviceName
66
110
  });
67
111
  }
68
112
  };
@@ -6,8 +6,8 @@ interface Options {
6
6
  fetch: typeof fetch;
7
7
  sendVariablesAsHash?: boolean;
8
8
  }
9
-
10
9
  declare function createBlake3Hash(str: string): number;
10
+
11
11
  declare const createStellateLoggerPlugin: (opts: Options) => Plugin;
12
12
 
13
13
  export { createBlake3Hash, createStellateLoggerPlugin };
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var y=(t,e)=>{for(var n in e)o(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of m(e))!b.call(t,r)&&r!==n&&o(t,r,{get:()=>e[r],enumerable:!(s=h(e,r))||s.enumerable});return t};var v=t=>S(o({},"__esModule",{value:!0}),t);var x={};y(x,{createBlake3Hash:()=>i,createStellateLoggerPlugin:()=>w});module.exports=v(x);var g=require("graphql"),u=require("graphql-yoga");function i(t){let e=0,n=t.length;if(n===0)return e;for(let s=0;s<n;++s){let r=t.charCodeAt(s);e=(e<<5)-e+r,e&=e}return e>>>0}var w=t=>({onExecute(e){let n=t.sendVariablesAsHash!=null?t.sendVariablesAsHash:!1,s=Date.now();return{async onExecuteDone({result:r}){if((0,u.isAsyncIterable)(r)){console.warn("Stellate does not currently support logging incremental results.");return}let{headers:a,method:c}=e.args.contextValue.request;if(a.has("gcdn-request-id"))return;let l=a.get("x-forwarded-for"),f=l?l.split(","):[],d=e.args.variableValues,p={operation:(0,g.print)(e.args.document),operationName:e.args.operationName||void 0,variables:n?void 0:d,variableHash:n?i(JSON.stringify(d||{})):void 0,method:c,elapsed:Date.now()-s,ip:f[0]||a.get("true-client-ip")||a.get("x-real-ip")||void 0,referer:a.get("referer")||void 0,userAgent:a.get("user-agent")||void 0,statusCode:200,errors:r.errors,responseSize:JSON.stringify(r).length,responseHash:i(JSON.stringify(r))};if(typeof t.fetch!="function"){console.warn("Stellate logger plugin requires a fetch function to be provided as an option.");return}await t.fetch(`https://${t.serviceName}.stellate.sh/log`,{method:"POST",body:JSON.stringify(p),headers:{"Content-Type":"application/json","Stellate-Logging-Token":t.token}})}}}});0&&(module.exports={createBlake3Hash,createStellateLoggerPlugin});
1
+ "use strict";var c=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},k=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of S(t))!x.call(e,n)&&n!==r&&c(e,n,{get:()=>t[n],enumerable:!(o=N(t,n))||o.enumerable});return e};var P=e=>k(c({},"__esModule",{value:!0}),e);var A={};v(A,{createBlake3Hash:()=>i,createStellateLoggerPlugin:()=>H});module.exports=P(A);var h=require("graphql"),m=require("graphql-yoga");function i(e){let t=0,r=e.length;if(r===0)return t;for(let o=0;o<r;++o){let n=e.charCodeAt(o);t=(t<<5)-t+n,t&=t}return t>>>0}function u({headers:e,operation:t,method:r,start:o,operationName:n,errors:l,response:a,variables:s,sendVariablesAsHash:g,hasSetCookie:y}){let p=e.get("x-forwarded-for"),b=p?p.split(","):[];return{operation:t,operationName:n,variables:g?void 0:s,variableHash:g?i(JSON.stringify(s||{})):void 0,method:r,elapsed:Date.now()-o,ip:b[0]||e.get("true-client-ip")||e.get("x-real-ip")||void 0,hasSetCookie:y,referer:e.get("referer")||void 0,userAgent:e.get("user-agent")||void 0,statusCode:200,errors:l,responseSize:JSON.stringify(a).length,responseHash:i(JSON.stringify(a))}}function d(e){if(typeof e!="function"){console.warn("Stellate logger plugin requires a fetch function to be provided as an option.");return}}var w=process.env.STELLATE_ENDPOINT==="local"||process.env.STELLATE_ENDPOINT==="staging"?"stellate.dev":"stellate.sh";async function f({fetch:e,payload:t,token:r,serviceName:o}){return e(`https://${o}.${w}/log`,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json","Stellate-Logging-Token":r}})}var H=e=>({onExecute(t){let r=e.sendVariablesAsHash!=null?e.sendVariablesAsHash:!1,o=Date.now();return{async onExecuteDone({result:n}){if((0,m.isAsyncIterable)(n)){console.warn("Stellate does not currently support logging incremental results.");return}let{headers:l,method:a}=t.args.contextValue.request,s=u({headers:l,operation:(0,h.print)(t.args.document),method:a,sendVariablesAsHash:r,start:o,operationName:t.args.operationName,errors:n.errors,response:n});d(e.fetch),await f({fetch:e.fetch,payload:s,token:e.token,serviceName:e.serviceName})}}}});0&&(module.exports={createBlake3Hash,createStellateLoggerPlugin});
@@ -4,6 +4,8 @@ const require = createRequire(import.meta.url);
4
4
  // src/graphql-yoga.ts
5
5
  import { print } from "graphql";
6
6
  import { isAsyncIterable } from "graphql-yoga";
7
+
8
+ // src/server-plugins-shared.ts
7
9
  function createBlake3Hash(str) {
8
10
  let val = 0;
9
11
  const strlen = str.length;
@@ -17,6 +19,63 @@ function createBlake3Hash(str) {
17
19
  }
18
20
  return val >>> 0;
19
21
  }
22
+ function extractStellatePayload({
23
+ headers,
24
+ operation,
25
+ method,
26
+ start,
27
+ operationName,
28
+ errors,
29
+ response,
30
+ variables,
31
+ sendVariablesAsHash,
32
+ hasSetCookie
33
+ }) {
34
+ const forwardedFor = headers.get("x-forwarded-for");
35
+ const ips = forwardedFor ? forwardedFor.split(",") : [];
36
+ return {
37
+ operation,
38
+ operationName,
39
+ variables: sendVariablesAsHash ? void 0 : variables,
40
+ variableHash: sendVariablesAsHash ? createBlake3Hash(JSON.stringify(variables || {})) : void 0,
41
+ method,
42
+ elapsed: Date.now() - start,
43
+ ip: ips[0] || headers.get("true-client-ip") || headers.get("x-real-ip") || void 0,
44
+ hasSetCookie,
45
+ referer: headers.get("referer") || void 0,
46
+ userAgent: headers.get("user-agent") || void 0,
47
+ statusCode: 200,
48
+ errors,
49
+ responseSize: JSON.stringify(response).length,
50
+ responseHash: createBlake3Hash(JSON.stringify(response))
51
+ };
52
+ }
53
+ function warnFetch(fetch) {
54
+ if (typeof fetch !== "function") {
55
+ console.warn(
56
+ `Stellate logger plugin requires a fetch function to be provided as an option.`
57
+ );
58
+ return;
59
+ }
60
+ }
61
+ var hostname = process.env.STELLATE_ENDPOINT === "local" || process.env.STELLATE_ENDPOINT === "staging" ? "stellate.dev" : "stellate.sh";
62
+ async function logRequest({
63
+ fetch: fetchFn,
64
+ payload,
65
+ token,
66
+ serviceName
67
+ }) {
68
+ return fetchFn(`https://${serviceName}.${hostname}/log`, {
69
+ method: "POST",
70
+ body: JSON.stringify(payload),
71
+ headers: {
72
+ "Content-Type": "application/json",
73
+ "Stellate-Logging-Token": token
74
+ }
75
+ });
76
+ }
77
+
78
+ // src/graphql-yoga.ts
20
79
  var createStellateLoggerPlugin = (options) => ({
21
80
  onExecute(payload) {
22
81
  const sendVariablesAsHash = options.sendVariablesAsHash != null ? options.sendVariablesAsHash : false;
@@ -29,40 +88,23 @@ var createStellateLoggerPlugin = (options) => ({
29
88
  );
30
89
  return;
31
90
  }
32
- const { headers: requestHeaders, method } = payload.args.contextValue.request;
33
- if (requestHeaders.has("gcdn-request-id"))
34
- return;
35
- const forwardedFor = requestHeaders.get("x-forwarded-for");
36
- const ips = forwardedFor ? forwardedFor.split(",") : [];
37
- const variables = payload.args.variableValues;
38
- const stellatePayload = {
91
+ const { headers, method } = payload.args.contextValue.request;
92
+ const stellatePayload = extractStellatePayload({
93
+ headers,
39
94
  operation: print(payload.args.document),
40
- operationName: payload.args.operationName || void 0,
41
- variables: sendVariablesAsHash ? void 0 : variables,
42
- variableHash: sendVariablesAsHash ? createBlake3Hash(JSON.stringify(variables || {})) : void 0,
43
95
  method,
44
- elapsed: Date.now() - start,
45
- ip: ips[0] || requestHeaders.get("true-client-ip") || requestHeaders.get("x-real-ip") || void 0,
46
- referer: requestHeaders.get("referer") || void 0,
47
- userAgent: requestHeaders.get("user-agent") || void 0,
48
- statusCode: 200,
96
+ sendVariablesAsHash,
97
+ start,
98
+ operationName: payload.args.operationName,
49
99
  errors: result.errors,
50
- responseSize: JSON.stringify(result).length,
51
- responseHash: createBlake3Hash(JSON.stringify(result))
52
- };
53
- if (typeof options.fetch !== "function") {
54
- console.warn(
55
- `Stellate logger plugin requires a fetch function to be provided as an option.`
56
- );
57
- return;
58
- }
59
- await options.fetch(`https://${options.serviceName}.stellate.sh/log`, {
60
- method: "POST",
61
- body: JSON.stringify(stellatePayload),
62
- headers: {
63
- "Content-Type": "application/json",
64
- "Stellate-Logging-Token": options.token
65
- }
100
+ response: result
101
+ });
102
+ warnFetch(options.fetch);
103
+ await logRequest({
104
+ fetch: options.fetch,
105
+ payload: stellatePayload,
106
+ token: options.token,
107
+ serviceName: options.serviceName
66
108
  });
67
109
  }
68
110
  };
package/dist/index.d.ts CHANGED
@@ -76,6 +76,18 @@ interface ComplexityConfig {
76
76
  maxComplexity?: number;
77
77
  }
78
78
 
79
+ /** This is the configuration format is kept internally in our application.
80
+ * It's slightly different from what's in `./input.ts`, which is the exact
81
+ * format of user-provided configuration inputs, which are converted to
82
+ * the format as defined here.
83
+ */
84
+
85
+ interface ScopeContext {
86
+ headers: Record<string, string | string[]>;
87
+ cookies: Record<string, string>;
88
+ }
89
+ type ScopeFunctionDefinition = ConfigFunction<(ctx: ScopeContext) => string | null | undefined>;
90
+
79
91
  declare const inputSchema: z.ZodObject<{
80
92
  app: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
81
93
  name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
@@ -159,8 +171,8 @@ declare const inputSchema: z.ZodObject<{
159
171
  */
160
172
  enablePlayground: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
161
173
  headers: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
162
- scopes: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodObject<{
163
- definition: z.ZodNullable<z.ZodOptional<z.ZodString>>;
174
+ scopes: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>]>, z.ZodObject<{
175
+ definition: z.ZodNullable<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>]>>>;
164
176
  jwt: z.ZodNullable<z.ZodOptional<z.ZodObject<{
165
177
  claim: z.ZodNullable<z.ZodOptional<z.ZodString>>;
166
178
  algorithm: z.ZodNullable<z.ZodOptional<z.ZodEnum<["HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "ES256", "ES384", "ES256k", "EdDSA", "PS256", "PS384", "PS512"]>>>;
@@ -175,14 +187,14 @@ declare const inputSchema: z.ZodObject<{
175
187
  secret?: string | null | undefined;
176
188
  }>>>;
177
189
  }, "strip", z.ZodTypeAny, {
178
- definition?: string | null | undefined;
190
+ definition?: string | ((...args: unknown[]) => unknown) | null | undefined;
179
191
  jwt?: {
180
192
  claim?: string | null | undefined;
181
193
  algorithm?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES256k" | "EdDSA" | "PS256" | "PS384" | "PS512" | null | undefined;
182
194
  secret?: string | null | undefined;
183
195
  } | null | undefined;
184
196
  }, {
185
- definition?: string | null | undefined;
197
+ definition?: string | ((...args: unknown[]) => unknown) | null | undefined;
186
198
  jwt?: {
187
199
  claim?: string | null | undefined;
188
200
  algorithm?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES256k" | "EdDSA" | "PS256" | "PS384" | "PS512" | null | undefined;
@@ -765,8 +777,8 @@ declare const inputSchema: z.ZodObject<{
765
777
  }[] | null | undefined;
766
778
  enablePlayground?: boolean | null | undefined;
767
779
  headers?: Record<string, string> | null | undefined;
768
- scopes?: Record<string, string | {
769
- definition?: string | null | undefined;
780
+ scopes?: Record<string, string | ((...args: unknown[]) => unknown) | {
781
+ definition?: string | ((...args: unknown[]) => unknown) | null | undefined;
770
782
  jwt?: {
771
783
  claim?: string | null | undefined;
772
784
  algorithm?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES256k" | "EdDSA" | "PS256" | "PS384" | "PS512" | null | undefined;
@@ -940,8 +952,8 @@ declare const inputSchema: z.ZodObject<{
940
952
  }[] | null | undefined;
941
953
  enablePlayground?: boolean | null | undefined;
942
954
  headers?: Record<string, string> | null | undefined;
943
- scopes?: Record<string, string | {
944
- definition?: string | null | undefined;
955
+ scopes?: Record<string, string | ((...args: unknown[]) => unknown) | {
956
+ definition?: string | ((...args: unknown[]) => unknown) | null | undefined;
945
957
  jwt?: {
946
958
  claim?: string | null | undefined;
947
959
  algorithm?: "HS256" | "HS384" | "HS512" | "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES256k" | "EdDSA" | "PS256" | "PS384" | "PS512" | null | undefined;
@@ -1712,4 +1724,4 @@ type Config = {
1712
1724
  };
1713
1725
  declare const createConfig: (input: Partial<Input>) => Input;
1714
1726
 
1715
- export { ComplexityConfig, ComplexityLimit, Config, ConfigFunction, EdgeRequest, Input, RateLimitConfig, RateLimitRule, RequestLimit, TimeWindow, createConfig as default };
1727
+ export { ComplexityConfig, ComplexityLimit, Config, ConfigFunction, EdgeRequest, Input, RateLimitConfig, RateLimitRule, RequestLimit, ScopeContext, ScopeFunctionDefinition, TimeWindow, createConfig as default };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var a=(i,t)=>{for(var e in t)o(i,e,{get:t[e],enumerable:!0})},f=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!p.call(i,n)&&n!==e&&o(i,n,{get:()=>t[n],enumerable:!(r=g(t,n))||r.enumerable});return i};var u=i=>f(o({},"__esModule",{value:!0}),i);var l={};a(l,{default:()=>c});module.exports=u(l);var s=i=>i,c=s;0&&(module.exports={});
1
+ "use strict";var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var f=(i,t)=>{for(var e in t)o(i,e,{get:t[e],enumerable:!0})},a=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of g(t))!m.call(i,n)&&n!==e&&o(i,n,{get:()=>t[n],enumerable:!(r=p(t,n))||r.enumerable});return i};var u=i=>a(o({},"__esModule",{value:!0}),i);var C={};f(C,{default:()=>s});module.exports=u(C);var c=i=>i,s=c;0&&(module.exports={});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellate",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "engines": {
5
5
  "node": ">=16"
6
6
  },
@@ -44,7 +44,7 @@
44
44
  "vitest": "^0.29.7",
45
45
  "ws": "8.11.0",
46
46
  "yaml": "^1.10.2",
47
- "@gcdn/configuration": "1.26.0"
47
+ "@gcdn/configuration": "1.27.0"
48
48
  },
49
49
  "bin": {
50
50
  "stellate": "dist/bin.js",