wirejs-resources 0.1.5-alpha → 0.1.7-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { CookieJar } from "./cookie-jar.js";
2
2
 
3
- const contextWrappers = new Set();
3
+ const __requiresContext = new Symbol('__requiresContext');
4
4
 
5
5
  /**
6
6
  * @typedef {(...args: any) => any} ApiMethod
@@ -61,7 +61,7 @@ export function withContext(contextWrapper, path = []) {
61
61
  return withContext(contextWrapper, [...path, prop])
62
62
  }
63
63
  });
64
- contextWrappers.add(fnOrNs);
64
+ fnOrNs[__requiresContext] = true;
65
65
  return fnOrNs;
66
66
  }
67
67
 
@@ -71,7 +71,7 @@ export function withContext(contextWrapper, path = []) {
71
71
  * @returns {fnOrNS is (context: Context) => T}
72
72
  */
73
73
  export function requiresContext(fnOrNS) {
74
- return contextWrappers.has(fnOrNS);
74
+ return fnOrNS[__requiresContext] === true;
75
75
  }
76
76
 
77
77
  export class Context {
package/lib/types.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type {
2
2
  AuthenticationService as AuthenticationServiceBase,
3
3
  withContext as withContextBase,
4
+ requiresContext as requiresContextBase,
4
5
  FileService as FileServiceBase,
5
6
  Context as ContextBase,
6
7
  Resource as ResourceBase,
@@ -10,5 +11,6 @@ export declare class Resource extends ResourceBase {};
10
11
  export declare class Context extends ContextBase {};
11
12
  export declare class AuthenticationService extends AuthenticationServiceBase {};
12
13
  export declare class FileService extends FileServiceBase {};
13
- export declare function withContext(): typeof withContextBase;
14
+ export declare const withContext: typeof withContextBase;
15
+ export declare const requiresContext: typeof requiresContextBase;
14
16
  export declare const overrides: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-resources",
3
- "version": "0.1.5-alpha",
3
+ "version": "0.1.7-alpha",
4
4
  "description": "Basic services and server-side resources for wirejs apps",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",