@learncard/core 9.0.3 → 9.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ export declare type CacheStrategy = 'cache-only' | 'cache-first' | 'skip-cache';
7
7
  export declare type PlaneOptions = {
8
8
  cache?: CacheStrategy;
9
9
  };
10
- export declare type ControlPlane = 'read' | 'store' | 'index' | 'cache' | 'id';
10
+ export declare type ControlPlane = 'read' | 'store' | 'index' | 'cache' | 'id' | 'context';
11
11
  export declare type FilterForPlane<Plugins extends Plugin[], Plane extends ControlPlane> = [
12
12
  Plugins
13
13
  ] extends [1 & Plugins] ? any : {
@@ -106,3 +106,13 @@ export declare type PluginIdPlane = IdPlane;
106
106
  export declare type LearnCardIdPlane<Plugins extends Plugin[]> = IdPlane & {
107
107
  providers: GetPlaneProviders<Plugins, 'id'>;
108
108
  };
109
+ export declare type ContextPlane = {
110
+ resolveDocument: (uri: string, allowRemote?: boolean) => Promise<Record<string, any> | undefined>;
111
+ };
112
+ export declare type PluginContextPlane = {
113
+ resolveStaticDocument: (uri: string) => Promise<Record<string, any> | undefined>;
114
+ resolveRemoteDocument?: (uri: string) => Promise<Record<string, any> | undefined>;
115
+ };
116
+ export declare type LearnCardContextPlane<Plugins extends Plugin[]> = ContextPlane & {
117
+ providers: GetPlaneProviders<Plugins, 'context'>;
118
+ };
@@ -1,4 +1,4 @@
1
- import { ControlPlane, GetPlanesForPlugins, PluginReadPlane, PluginStorePlane, PluginIndexPlane, PluginCachePlane, PluginIdPlane, LearnCardReadPlane, LearnCardStorePlane, LearnCardIndexPlane, LearnCardCachePlane, LearnCardIdPlane } from './planes';
1
+ import { ControlPlane, GetPlanesForPlugins, PluginReadPlane, PluginStorePlane, PluginIndexPlane, PluginCachePlane, PluginIdPlane, PluginContextPlane, LearnCardReadPlane, LearnCardStorePlane, LearnCardIndexPlane, LearnCardCachePlane, LearnCardIdPlane, LearnCardContextPlane } from './planes';
2
2
  import { UnionToIntersection, MergeObjects } from './utilities';
3
3
  export declare type GenerateLearnCard<NewControlPlanes extends ControlPlane = never, NewMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, ControlPlanes extends ControlPlane = never, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>> = LearnCard<any, [
4
4
  ControlPlanes
@@ -22,6 +22,7 @@ export declare type Plugin<Name extends string = string, ControlPlanes extends C
22
22
  index?: {};
23
23
  cache?: {};
24
24
  id?: {};
25
+ context?: {};
25
26
  } & ([ControlPlanes] extends [1 & ControlPlanes] ? {} : ('read' extends ControlPlanes ? {
26
27
  read: AddImplicitLearnCardArgument<PluginReadPlane, ControlPlanes, Methods, DependentControlPlanes, DependentMethods>;
27
28
  } : {}) & ('store' extends ControlPlanes ? {
@@ -32,6 +33,8 @@ export declare type Plugin<Name extends string = string, ControlPlanes extends C
32
33
  cache: AddImplicitLearnCardArgument<PluginCachePlane, ControlPlanes, Methods, DependentControlPlanes, DependentMethods>;
33
34
  } : {}) & ('id' extends ControlPlanes ? {
34
35
  id: AddImplicitLearnCardArgument<PluginIdPlane, ControlPlanes, Methods, DependentControlPlanes, DependentMethods>;
36
+ } : {}) & ('context' extends ControlPlanes ? {
37
+ context: AddImplicitLearnCardArgument<PluginContextPlane, ControlPlanes, Methods, DependentControlPlanes, DependentMethods>;
35
38
  } : {}));
36
39
  /** @group Universal Wallets */
37
40
  export declare type LearnCard<Plugins extends Plugin[] = [], ControlPlanes extends ControlPlane = GetPlanesForPlugins<Plugins>, PluginMethods = GetPluginMethods<Plugins>> = {
@@ -49,4 +52,6 @@ export declare type LearnCard<Plugins extends Plugin[] = [], ControlPlanes exten
49
52
  cache: LearnCardCachePlane<Plugins>;
50
53
  } : {}) & ('id' extends ControlPlanes ? {
51
54
  id: LearnCardIdPlane<Plugins>;
55
+ } : {}) & ('context' extends ControlPlanes ? {
56
+ context: LearnCardContextPlane<Plugins>;
52
57
  } : {}));
@@ -12,4 +12,5 @@ export declare const generateLearnCard: <Plugins extends {
12
12
  index?: {} | undefined;
13
13
  cache?: {} | undefined;
14
14
  id?: {} | undefined;
15
+ context?: {} | undefined;
15
16
  }[] = [], ControlPlanes extends GetPlanesForPlugins<Plugins> = GetPlanesForPlugins<Plugins>, PluginMethods extends GetPluginMethods<Plugins> = GetPluginMethods<Plugins>>(_learnCard?: Partial<LearnCard<Plugins, ControlPlanes, PluginMethods>>) => Promise<LearnCard<Plugins, ControlPlanes, PluginMethods>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/core",
3
- "version": "9.0.3",
3
+ "version": "9.1.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/core.esm.js",