@adobe/exc-app 1.0.0 → 1.0.3
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/RuntimeConfiguration.d.ts +4 -0
- package/appapi.d.ts +1 -0
- package/appapi.js +1 -0
- package/appapi.js.map +1 -1
- package/cache.d.ts +128 -0
- package/cache.js +128 -0
- package/cache.js.map +1 -0
- package/capabilityapi.d.ts +4 -0
- package/capabilityapi.js +4 -0
- package/capabilityapi.js.map +1 -1
- package/docs/README.md +1 -0
- package/docs/enums/appapi.appids.md +7 -0
- package/docs/enums/capabilityapi.capabilityids.md +14 -0
- package/docs/enums/capabilityapi.capabilitynames.md +14 -0
- package/docs/enums/network.routing.md +21 -1
- package/docs/interfaces/cache.cacheapi.md +81 -0
- package/docs/interfaces/cache.cacheparameters.md +36 -0
- package/docs/interfaces/cache.cachesetparameters.md +65 -0
- package/docs/interfaces/network.apolloclientoptions.md +7 -0
- package/docs/interfaces/network.queryrequest.md +9 -0
- package/docs/interfaces/root.modules.md +7 -0
- package/docs/interfaces/root.runtimeconfiguration.md +9 -0
- package/docs/modules/cache.md +85 -0
- package/docs/modules/network.md +7 -0
- package/network.d.ts +18 -1
- package/network.js +11 -0
- package/network.js.map +1 -1
- package/package.json +4 -4
- package/settings.js +2 -6
- package/settings.js.map +1 -1
- package/src/Global.d.ts +2 -0
- package/src/Global.js.map +1 -1
- package/tests/cache.test.d.ts +1 -0
- package/tests/cache.test.js +66 -0
- package/tests/cache.test.js.map +1 -0
- package/tests/permissions.test.js +1 -5
- package/tests/permissions.test.js.map +1 -1
- package/tests/pulse.test.js +23 -11
- package/tests/pulse.test.js.map +1 -1
- package/tests/session.test.d.ts +1 -0
- package/tests/session.test.js +64 -0
- package/tests/session.test.js.map +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/coverage/lcov-report/block-navigation.js +0 -79
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sorter.js +0 -170
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
**[@adobe/exc-app](../README.md)**
|
|
2
|
+
|
|
3
|
+
> [Globals](../README.md) / [cache](../modules/cache.md) / CacheSetParameters
|
|
4
|
+
|
|
5
|
+
# Interface: CacheSetParameters<T\>
|
|
6
|
+
|
|
7
|
+
Input parameters for the Cache set API.
|
|
8
|
+
|
|
9
|
+
## Type parameters
|
|
10
|
+
|
|
11
|
+
Name |
|
|
12
|
+
------ |
|
|
13
|
+
`T` |
|
|
14
|
+
|
|
15
|
+
## Hierarchy
|
|
16
|
+
|
|
17
|
+
* [CacheParameters](cache.cacheparameters.md)
|
|
18
|
+
|
|
19
|
+
↳ **CacheSetParameters**
|
|
20
|
+
|
|
21
|
+
## Index
|
|
22
|
+
|
|
23
|
+
### Properties
|
|
24
|
+
|
|
25
|
+
* [expiry](cache.cachesetparameters.md#expiry)
|
|
26
|
+
* [key](cache.cachesetparameters.md#key)
|
|
27
|
+
* [scope](cache.cachesetparameters.md#scope)
|
|
28
|
+
* [value](cache.cachesetparameters.md#value)
|
|
29
|
+
|
|
30
|
+
## Properties
|
|
31
|
+
|
|
32
|
+
### expiry
|
|
33
|
+
|
|
34
|
+
• `Optional` **expiry**: [CacheExpiry](../modules/cache.md#cacheexpiry)
|
|
35
|
+
|
|
36
|
+
Cache expiry. Can be one of the set values defined by CacheTTL, or a numeric cache ttl (in seconds).
|
|
37
|
+
Optional - Defaults to one week.
|
|
38
|
+
|
|
39
|
+
___
|
|
40
|
+
|
|
41
|
+
### key
|
|
42
|
+
|
|
43
|
+
• **key**: string
|
|
44
|
+
|
|
45
|
+
*Inherited from [CacheParameters](cache.cacheparameters.md).[key](cache.cacheparameters.md#key)*
|
|
46
|
+
|
|
47
|
+
Cache key.
|
|
48
|
+
|
|
49
|
+
___
|
|
50
|
+
|
|
51
|
+
### scope
|
|
52
|
+
|
|
53
|
+
• `Optional` **scope**: CacheScope
|
|
54
|
+
|
|
55
|
+
*Inherited from [CacheParameters](cache.cacheparameters.md).[scope](cache.cacheparameters.md#scope)*
|
|
56
|
+
|
|
57
|
+
Cache scope (Optional - Defaults to user).
|
|
58
|
+
|
|
59
|
+
___
|
|
60
|
+
|
|
61
|
+
### value
|
|
62
|
+
|
|
63
|
+
• **value**: T
|
|
64
|
+
|
|
65
|
+
Data to cache. Data must be serializable (JSON).
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* [cacheOptions](network.apolloclientoptions.md#cacheoptions)
|
|
16
16
|
* [connectToDevTools](network.apolloclientoptions.md#connecttodevtools)
|
|
17
17
|
* [inputApolloLink](network.apolloclientoptions.md#inputapollolink)
|
|
18
|
+
* [xql](network.apolloclientoptions.md#xql)
|
|
18
19
|
|
|
19
20
|
## Properties
|
|
20
21
|
|
|
@@ -33,3 +34,9 @@ ___
|
|
|
33
34
|
### inputApolloLink
|
|
34
35
|
|
|
35
36
|
• `Optional` **inputApolloLink**: ApolloLink
|
|
37
|
+
|
|
38
|
+
___
|
|
39
|
+
|
|
40
|
+
### xql
|
|
41
|
+
|
|
42
|
+
• `Optional` **xql**: undefined \| false \| true
|
|
@@ -20,6 +20,7 @@ Query request interface.
|
|
|
20
20
|
* [maxRetries](network.queryrequest.md#maxretries)
|
|
21
21
|
* [metadata](network.queryrequest.md#metadata)
|
|
22
22
|
* [operationName](network.queryrequest.md#operationname)
|
|
23
|
+
* [preferredRegion](network.queryrequest.md#preferredregion)
|
|
23
24
|
* [regionEnabled](network.queryrequest.md#regionenabled)
|
|
24
25
|
* [routing](network.queryrequest.md#routing)
|
|
25
26
|
* [scope](network.queryrequest.md#scope)
|
|
@@ -102,6 +103,14 @@ Query ID- To analyze a query's metrics & performance.
|
|
|
102
103
|
|
|
103
104
|
___
|
|
104
105
|
|
|
106
|
+
### preferredRegion
|
|
107
|
+
|
|
108
|
+
• `Optional` **preferredRegion**: [GraphQLRegion](../modules/network.md#graphqlregion)
|
|
109
|
+
|
|
110
|
+
Preferred region to send the GraphQL request to
|
|
111
|
+
|
|
112
|
+
___
|
|
113
|
+
|
|
105
114
|
### regionEnabled
|
|
106
115
|
|
|
107
116
|
• `Optional` **regionEnabled**: undefined \| false \| true
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
### Properties
|
|
14
14
|
|
|
15
15
|
* [appApi](root.modules.md#appapi)
|
|
16
|
+
* [cache](root.modules.md#cache)
|
|
16
17
|
* [capabilityApi](root.modules.md#capabilityapi)
|
|
17
18
|
* [default](root.modules.md#default)
|
|
18
19
|
* [helpCenter](root.modules.md#helpcenter)
|
|
@@ -42,6 +43,12 @@
|
|
|
42
43
|
|
|
43
44
|
___
|
|
44
45
|
|
|
46
|
+
### cache
|
|
47
|
+
|
|
48
|
+
• `Readonly` **cache**: () => [CacheApi](cache.cacheapi.md)
|
|
49
|
+
|
|
50
|
+
___
|
|
51
|
+
|
|
45
52
|
### capabilityApi
|
|
46
53
|
|
|
47
54
|
• `Readonly` **capabilityApi**: () => [CapabilityApi](capabilityapi.capabilityapi-1.md)
|
|
@@ -19,6 +19,7 @@ External Runtime Configuration Interface
|
|
|
19
19
|
* [appContainer](root.runtimeconfiguration.md#appcontainer)
|
|
20
20
|
* [appId](root.runtimeconfiguration.md#appid)
|
|
21
21
|
* [baseFrameUrl](root.runtimeconfiguration.md#baseframeurl)
|
|
22
|
+
* [basePath](root.runtimeconfiguration.md#basepath)
|
|
22
23
|
* [baseUrl](root.runtimeconfiguration.md#baseurl)
|
|
23
24
|
* [changedProperties](root.runtimeconfiguration.md#changedproperties)
|
|
24
25
|
* [discovery](root.runtimeconfiguration.md#discovery)
|
|
@@ -100,6 +101,14 @@ Solution iframe src url
|
|
|
100
101
|
|
|
101
102
|
___
|
|
102
103
|
|
|
104
|
+
### basePath
|
|
105
|
+
|
|
106
|
+
• **basePath**: string
|
|
107
|
+
|
|
108
|
+
Base path of the baseUrl property, without tenant or URL context.
|
|
109
|
+
|
|
110
|
+
___
|
|
111
|
+
|
|
103
112
|
### baseUrl
|
|
104
113
|
|
|
105
114
|
• **baseUrl**: string
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
**[@adobe/exc-app](../README.md)**
|
|
2
|
+
|
|
3
|
+
> [Globals](../README.md) / cache
|
|
4
|
+
|
|
5
|
+
# Module: cache
|
|
6
|
+
|
|
7
|
+
APIs for managing a client side persisted cache.
|
|
8
|
+
Unified Shell will store the data against its own domain, which allows data caching
|
|
9
|
+
even when the actual app runs on a domain which is 3rd party to Unified Shell's.
|
|
10
|
+
|
|
11
|
+
For example, the API will work in Chrome incognito when Unified Shell runs on an adobe.com domain
|
|
12
|
+
and the embedded applications run on the adobe.net domain.
|
|
13
|
+
|
|
14
|
+
These APIs utilizes the [Browser Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) under the hood and are all run asynchronously.
|
|
15
|
+
|
|
16
|
+
If migrating from Local Storage to Cache API, make sure all the app logic is async first.
|
|
17
|
+
|
|
18
|
+
NOTE: This API should not be used to cache any PII data to comply with Adobe privacy policies.
|
|
19
|
+
|
|
20
|
+
To consume this API, add the following import to your code.
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import cache from '@adobe/exc-app/cache';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The default export is an object of type [CacheAPI](../interfaces/_cache_.cacheapi.md)
|
|
27
|
+
|
|
28
|
+
API reference: [scroll down](#index)
|
|
29
|
+
|
|
30
|
+
### Sample code
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import cache, {CacheTTL, CacheScope} from '@adobe/exc-app/cache';
|
|
34
|
+
|
|
35
|
+
// By default, cached data is tied to the user and cached for a week.
|
|
36
|
+
await cache.set<MyType>({key: 'some-cache-key', value: myTypeInstance});
|
|
37
|
+
|
|
38
|
+
// Both scope and expiry can be adjusted.
|
|
39
|
+
await cache.set<MyType>({key: 'some-cache-key', value: myTypeInstance, expiry: CacheTTL.DAY, scope: CacheScope.ORG});
|
|
40
|
+
|
|
41
|
+
// It is also possible to bind cache data to the current IMS session, it will expire when the user logs out.
|
|
42
|
+
await cache.set<MyType>({key: 'some-cache-key', value: myTypeInstance, expiry: CacheTTL.IMS_SESSION});
|
|
43
|
+
|
|
44
|
+
// Cache get
|
|
45
|
+
const myData: MyType = await cache.get<MyType>({key: 'some-cache-key'});
|
|
46
|
+
|
|
47
|
+
// Get scope must be identical to the scope used for set - Always use the same scope for both.
|
|
48
|
+
const myData2: MyType = await cache.get<MyType>({key: 'some-cache-key', scope: CacheScope.ORG});
|
|
49
|
+
|
|
50
|
+
// Cache delete.
|
|
51
|
+
await cache.delete({key: 'some-cache-key'});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Index
|
|
55
|
+
|
|
56
|
+
### Interfaces
|
|
57
|
+
|
|
58
|
+
* [CacheApi](../interfaces/cache.cacheapi.md)
|
|
59
|
+
* [CacheParameters](../interfaces/cache.cacheparameters.md)
|
|
60
|
+
* [CacheSetParameters](../interfaces/cache.cachesetparameters.md)
|
|
61
|
+
|
|
62
|
+
### Type aliases
|
|
63
|
+
|
|
64
|
+
* [CacheEntry](cache.md#cacheentry)
|
|
65
|
+
* [CacheExpiry](cache.md#cacheexpiry)
|
|
66
|
+
|
|
67
|
+
## Type aliases
|
|
68
|
+
|
|
69
|
+
### CacheEntry
|
|
70
|
+
|
|
71
|
+
Ƭ **CacheEntry**<T\>: { createdAt: number ; key: string ; value: T } & { expiresAt: number } \| { expireBySession: true }
|
|
72
|
+
|
|
73
|
+
Cache entry (Returned by the get API).
|
|
74
|
+
|
|
75
|
+
#### Type parameters:
|
|
76
|
+
|
|
77
|
+
Name |
|
|
78
|
+
------ |
|
|
79
|
+
`T` |
|
|
80
|
+
|
|
81
|
+
___
|
|
82
|
+
|
|
83
|
+
### CacheExpiry
|
|
84
|
+
|
|
85
|
+
Ƭ **CacheExpiry**: CacheTTL \| number
|
package/docs/modules/network.md
CHANGED
|
@@ -63,6 +63,7 @@ const queryResponse = await query({
|
|
|
63
63
|
### Type aliases
|
|
64
64
|
|
|
65
65
|
* [FetchInit](network.md#fetchinit)
|
|
66
|
+
* [GraphQLRegion](network.md#graphqlregion)
|
|
66
67
|
|
|
67
68
|
### Variables
|
|
68
69
|
|
|
@@ -89,6 +90,12 @@ also additionally specify the 'auth' parameter to automatically set the Authenti
|
|
|
89
90
|
`{auth: 'Header', method: 'GET'}` or
|
|
90
91
|
`{method: 'GET'}`
|
|
91
92
|
|
|
93
|
+
___
|
|
94
|
+
|
|
95
|
+
### GraphQLRegion
|
|
96
|
+
|
|
97
|
+
Ƭ **GraphQLRegion**: \"va7\" \| \"aus5\" \| \"nld2\"
|
|
98
|
+
|
|
92
99
|
## Variables
|
|
93
100
|
|
|
94
101
|
### DEFAULT\_STATUS\_CODES\_TO\_RETRY
|
package/network.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ import type { gql } from 'graphql-tag';
|
|
|
57
57
|
* Default status codes which imply a transient error and can be retried.
|
|
58
58
|
*/
|
|
59
59
|
export declare const DEFAULT_STATUS_CODES_TO_RETRY: number[];
|
|
60
|
+
export declare type GraphQLRegion = 'va7' | 'aus5' | 'nld2';
|
|
60
61
|
export interface FetchOptions {
|
|
61
62
|
/**
|
|
62
63
|
* A boolean value indicating whether to add Authentication token, API Key to the request.
|
|
@@ -219,7 +220,18 @@ export interface DefaultMetaData {
|
|
|
219
220
|
sandbox?: Record<string, any>;
|
|
220
221
|
}
|
|
221
222
|
export declare enum ROUTING {
|
|
222
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Route by the AEP region found in the user profile
|
|
225
|
+
*/
|
|
226
|
+
AEP_PROFILE_BASED = 0,
|
|
227
|
+
/**
|
|
228
|
+
* Default routing - Latency based.
|
|
229
|
+
*/
|
|
230
|
+
DEFAULT = 1,
|
|
231
|
+
/**
|
|
232
|
+
* Specify region in query (Client Side routing)
|
|
233
|
+
*/
|
|
234
|
+
REGION_BASED_PER_QUERY = 2
|
|
223
235
|
}
|
|
224
236
|
/**
|
|
225
237
|
* Query request interface.
|
|
@@ -298,6 +310,10 @@ export interface QueryRequest {
|
|
|
298
310
|
* requests before aborting.
|
|
299
311
|
*/
|
|
300
312
|
totalFetchTime?: number;
|
|
313
|
+
/**
|
|
314
|
+
* Preferred region to send the GraphQL request to
|
|
315
|
+
*/
|
|
316
|
+
preferredRegion?: GraphQLRegion;
|
|
301
317
|
}
|
|
302
318
|
/**
|
|
303
319
|
* This parameter will be used to specify what headers are automatically added to the API call.
|
|
@@ -355,6 +371,7 @@ export interface ApolloClientOptions {
|
|
|
355
371
|
connectToDevTools?: boolean;
|
|
356
372
|
inputApolloLink?: ApolloLink;
|
|
357
373
|
cacheOptions?: InMemoryCacheConfig;
|
|
374
|
+
xql?: boolean;
|
|
358
375
|
}
|
|
359
376
|
export interface NetworkApi {
|
|
360
377
|
/**
|
package/network.js
CHANGED
|
@@ -18,7 +18,18 @@ const Global_1 = require("./src/Global");
|
|
|
18
18
|
exports.DEFAULT_STATUS_CODES_TO_RETRY = [429, 502, 503, 504];
|
|
19
19
|
var ROUTING;
|
|
20
20
|
(function (ROUTING) {
|
|
21
|
+
/**
|
|
22
|
+
* Route by the AEP region found in the user profile
|
|
23
|
+
*/
|
|
21
24
|
ROUTING[ROUTING["AEP_PROFILE_BASED"] = 0] = "AEP_PROFILE_BASED";
|
|
25
|
+
/**
|
|
26
|
+
* Default routing - Latency based.
|
|
27
|
+
*/
|
|
28
|
+
ROUTING[ROUTING["DEFAULT"] = 1] = "DEFAULT";
|
|
29
|
+
/**
|
|
30
|
+
* Specify region in query (Client Side routing)
|
|
31
|
+
*/
|
|
32
|
+
ROUTING[ROUTING["REGION_BASED_PER_QUERY"] = 2] = "REGION_BASED_PER_QUERY";
|
|
22
33
|
})(ROUTING = exports.ROUTING || (exports.ROUTING = {}));
|
|
23
34
|
/**
|
|
24
35
|
* This parameter will be used to specify what headers are automatically added to the API call.
|
package/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["network.ts"],"names":[],"mappings":";AAAA;;;;;;;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B,eAAe,CAC7B,OAA6B;IAK7B,OAAO,gBAAO,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;AACrD,CAAC;AAPD,0CAOC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/exc-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"source": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"registry": "https://registry.npmjs.com/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@apollo/client": "3.
|
|
28
|
+
"@apollo/client": "3.5.7",
|
|
29
29
|
"graphql": "^15.0.0",
|
|
30
|
-
"graphql-tag": "2.12.
|
|
30
|
+
"graphql-tag": "2.12.6"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"cross-env": "7.0.3",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"eslint-plugin-header": "3.1.1",
|
|
37
37
|
"eslint-plugin-jsdoc": "31.6.1",
|
|
38
38
|
"eslint-plugin-prettier": "4.0.0",
|
|
39
|
-
"eslint-plugin-rulesdir": "0.2.
|
|
39
|
+
"eslint-plugin-rulesdir": "0.2.1",
|
|
40
40
|
"glob": "7.1.7",
|
|
41
41
|
"jest": "26.6.3",
|
|
42
42
|
"jest-dev-server": "4.4.0",
|
package/settings.js
CHANGED
|
@@ -76,12 +76,8 @@ const Global_1 = require("./src/Global");
|
|
|
76
76
|
const SettingsLevel_1 = require("./settings/SettingsLevel");
|
|
77
77
|
Object.defineProperty(exports, "SettingsLevel", { enumerable: true, get: function () { return SettingsLevel_1.SettingsLevel; } });
|
|
78
78
|
const settings = {
|
|
79
|
-
get: params =>
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
set: params => {
|
|
83
|
-
return Global_1.getImpl('settings')().set(params);
|
|
84
|
-
}
|
|
79
|
+
get: params => Global_1.getImpl('settings')().get(params),
|
|
80
|
+
set: params => Global_1.getImpl('settings')().set(params)
|
|
85
81
|
};
|
|
86
82
|
exports.default = settings;
|
|
87
83
|
//# sourceMappingURL=settings.js.map
|
package/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["settings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,yCAAqC;AACrC,4DAAuD;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["settings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,yCAAqC;AACrC,4DAAuD;AAmE/C,8FAnEA,6BAAa,OAmEA;AALrB,MAAM,QAAQ,GAAgB;IAC5B,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,gBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;IAChD,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,gBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC;CACjD,CAAC;AAGF,kBAAe,QAAQ,CAAC"}
|
package/src/Global.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @module "index"
|
|
14
14
|
*/
|
|
15
15
|
import { AppApi } from '../appapi';
|
|
16
|
+
import { CacheApi } from '../cache';
|
|
16
17
|
import { CapabilityApi } from '../capabilityapi';
|
|
17
18
|
import { HelpCenterApi } from '../helpcenter';
|
|
18
19
|
import { InternalApi } from '../internal';
|
|
@@ -34,6 +35,7 @@ import { UserApi } from '../user';
|
|
|
34
35
|
import { UserProfileApi } from '../userprofile';
|
|
35
36
|
export interface Modules {
|
|
36
37
|
readonly appApi: () => AppApi;
|
|
38
|
+
readonly cache: () => CacheApi;
|
|
37
39
|
readonly capabilityApi: () => CapabilityApi;
|
|
38
40
|
readonly default: (options?: any) => Runtime;
|
|
39
41
|
readonly helpCenter: HelpCenterApi;
|
package/src/Global.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Global.js","sourceRoot":"","sources":["Global.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;
|
|
1
|
+
{"version":3,"file":"Global.js","sourceRoot":"","sources":["Global.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;AA4D5E;;;;;GAKG;AACH,SAAgB,OAAO,CAA0B,UAAa;IAC5D,MAAM,GAAG,GAAI,MAAiB,CAAC,oBAAoB,CAAC,CAAC;IACrD,IAAI,CAAC,GAAG,EAAE;QACR,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACvD;IACD,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC;AACzB,CAAC;AAND,0BAMC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAA0B,OAAU,EAAE,UAA0C;IACrG,MAAM,GAAG,GAAG,EAAgB,CAAC;IAC7B,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;YACd,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE;gBACrC,OAAQ,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAS,CAAC,GAAG,IAAI,CAAC,CAAC;YACzD,CAAC,CAAQ,CAAC;SACX;aAAM;YACL,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE;gBACtC,GAAG,EAAE,GAAG,EAAE;oBACR,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;gBACvC,CAAC;gBACD,GAAG,EAAE,KAAK,CAAC,EAAE;oBACX,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;gBACxC,CAAC;aACF,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IACH,OAAO,GAAG,CAAC;AACb,CAAC;AApBD,0BAoBC;AAED,kBAAgB,MAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
/*************************************************************************
|
|
16
|
+
* Copyright 2022 Adobe
|
|
17
|
+
* All Rights Reserved.
|
|
18
|
+
*
|
|
19
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
20
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
21
|
+
* it. If you have received this file from a source other than Adobe,
|
|
22
|
+
* then your use, modification, or distribution of it requires the prior
|
|
23
|
+
* written permission of Adobe.
|
|
24
|
+
**************************************************************************/
|
|
25
|
+
const cache_1 = __importDefault(require("../cache"));
|
|
26
|
+
const Global_1 = __importDefault(require("../src/Global"));
|
|
27
|
+
describe('cache.ts', () => {
|
|
28
|
+
const getMock = jest.fn();
|
|
29
|
+
const setMock = jest.fn();
|
|
30
|
+
const deleteMock = jest.fn();
|
|
31
|
+
const cacheMock = {
|
|
32
|
+
delete: deleteMock,
|
|
33
|
+
get: getMock,
|
|
34
|
+
set: setMock
|
|
35
|
+
};
|
|
36
|
+
beforeAll(() => {
|
|
37
|
+
Global_1.default['exc-module-runtime'] = {
|
|
38
|
+
cache: () => cacheMock
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
afterEach(() => jest.clearAllMocks());
|
|
42
|
+
const cachedItem = {
|
|
43
|
+
createdAt: 1641861111243,
|
|
44
|
+
expiresAt: 1642465911243,
|
|
45
|
+
key: 'key',
|
|
46
|
+
value: { hello: 'world' }
|
|
47
|
+
};
|
|
48
|
+
test('get', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
getMock.mockResolvedValue(cachedItem);
|
|
50
|
+
const entry = yield cache_1.default.get({ key: 'key' });
|
|
51
|
+
expect(entry).toEqual(cachedItem);
|
|
52
|
+
expect(getMock).toHaveBeenCalledTimes(1);
|
|
53
|
+
expect(getMock).toHaveBeenCalledWith({ key: 'key' });
|
|
54
|
+
}));
|
|
55
|
+
test('delete', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
yield cache_1.default.delete({ key: 'key' });
|
|
57
|
+
expect(deleteMock).toHaveBeenCalledTimes(1);
|
|
58
|
+
expect(deleteMock).toHaveBeenCalledWith({ key: 'key' });
|
|
59
|
+
}));
|
|
60
|
+
test('set', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
+
yield cache_1.default.set({ key: 'key', value: { hello: 'world' } });
|
|
62
|
+
expect(setMock).toHaveBeenCalledTimes(1);
|
|
63
|
+
expect(setMock).toHaveBeenCalledWith({ key: 'key', value: { hello: 'world' } });
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=cache.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.test.js","sourceRoot":"","sources":["cache.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,qDAAwD;AACxD,2DAA8C;AAE9C,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAE7B,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,UAAU;QAClB,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,OAAO;KACD,CAAC;IAEd,SAAS,CAAC,GAAG,EAAE;QACZ,gBAAM,CAAC,oBAAoB,CAAa,GAAG;YAC1C,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;SACZ,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAEtC,MAAM,UAAU,GAAoB;QAClC,SAAS,EAAE,aAAa;QACxB,SAAS,EAAE,aAAa;QACxB,GAAG,EAAE,KAAK;QACV,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC;KACxB,CAAC;IAEF,IAAI,CAAC,KAAK,EAAE,GAAS,EAAE;QACrB,OAAO,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,MAAM,eAAQ,CAAC,GAAG,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAC;IACrD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,GAAS,EAAE;QACxB,MAAM,eAAQ,CAAC,MAAM,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAC;QACpC,MAAM,CAAC,UAAU,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC5C,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,CAAC,CAAC;IACxD,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,GAAS,EAAE;QACrB,MAAM,eAAQ,CAAC,GAAG,CAAC,EAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,EAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC;IAC9E,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -28,11 +28,7 @@ describe('permissions.ts', () => {
|
|
|
28
28
|
let getSpy;
|
|
29
29
|
beforeAll(() => {
|
|
30
30
|
const permissionsMock = { get: jest.fn() };
|
|
31
|
-
Global_1.default['exc-module-runtime'] = {
|
|
32
|
-
permissions: () => {
|
|
33
|
-
return permissionsMock;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
31
|
+
Global_1.default['exc-module-runtime'] = { permissions: () => permissionsMock };
|
|
36
32
|
getSpy = jest.spyOn(permissionsMock, 'get');
|
|
37
33
|
});
|
|
38
34
|
afterEach(() => jest.clearAllMocks());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.test.js","sourceRoot":"","sources":["permissions.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,2DAA8C;AAC9C,iEAKwB;AAExB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,MAAW,CAAC;IAEhB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,eAAe,GAAG,EAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAmB,CAAC;QAC1D,gBAAM,CAAC,oBAAoB,CAAa,GAAG
|
|
1
|
+
{"version":3,"file":"permissions.test.js","sourceRoot":"","sources":["permissions.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,2DAA8C;AAC9C,iEAKwB;AAExB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,MAAW,CAAC;IAEhB,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,eAAe,GAAG,EAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAmB,CAAC;QAC1D,gBAAM,CAAC,oBAAoB,CAAa,GAAG,EAAC,WAAW,EAAE,GAAG,EAAE,CAAC,eAAe,EAAY,CAAC;QAC5F,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAEtC,EAAE,CAAC,oDAAoD,EAAE,GAAS,EAAE;QAClE,MAAM,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAmC,EAAC,WAAW,EAAE;gBAClG,WAAW,EAAE,CAAC,GAAG,CAAC;gBAClB,WAAW,EAAE,C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 Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
const Global_1 = __importDefault(require("../src/Global"));
|
|
17
17
|
const pulse_1 = __importDefault(require("../pulse"));
|
|
18
18
|
describe('pulse.ts', () => {
|
|
19
|
+
// setup
|
|
20
|
+
const pulseMock = {
|
|
21
|
+
send: () => Promise.resolve({ notifications: { notification: [] } }),
|
|
22
|
+
setButton: () => { },
|
|
23
|
+
setCount: () => { }
|
|
24
|
+
};
|
|
25
|
+
Global_1.default['exc-module-runtime'] = {
|
|
26
|
+
pulse: () => {
|
|
27
|
+
return pulseMock;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
19
30
|
it('correctly sets up the connection with module-runtime', () => {
|
|
20
|
-
// setup
|
|
21
|
-
const pulseMock = {
|
|
22
|
-
send: () => Promise.resolve({ notifications: { notification: [] } }),
|
|
23
|
-
setButton: () => { },
|
|
24
|
-
setCount: () => { }
|
|
25
|
-
};
|
|
26
|
-
Global_1.default['exc-module-runtime'] = {
|
|
27
|
-
pulse: () => {
|
|
28
|
-
return pulseMock;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
31
|
const sendSpy = jest.spyOn(pulseMock, 'send');
|
|
32
32
|
const expected = [{}];
|
|
33
33
|
// action
|
|
@@ -36,5 +36,17 @@ describe('pulse.ts', () => {
|
|
|
36
36
|
expect(sendSpy).toBeCalledTimes(1);
|
|
37
37
|
expect(sendSpy).toBeCalledWith(expected);
|
|
38
38
|
});
|
|
39
|
+
it('set button', () => {
|
|
40
|
+
const setButtonSpy = jest.spyOn(pulseMock, 'setButton');
|
|
41
|
+
pulse_1.default.setButton({ label: 'label' });
|
|
42
|
+
expect(setButtonSpy).toHaveBeenCalledTimes(1);
|
|
43
|
+
expect(setButtonSpy).toHaveBeenCalledWith({ label: 'label' });
|
|
44
|
+
});
|
|
45
|
+
it('set count', () => {
|
|
46
|
+
const setCountSpy = jest.spyOn(pulseMock, 'setCount');
|
|
47
|
+
pulse_1.default.setCount(5);
|
|
48
|
+
expect(setCountSpy).toHaveBeenCalledTimes(1);
|
|
49
|
+
expect(setCountSpy).toHaveBeenCalledWith(5);
|
|
50
|
+
});
|
|
39
51
|
});
|
|
40
52
|
//# sourceMappingURL=pulse.test.js.map
|
package/tests/pulse.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulse.test.js","sourceRoot":"","sources":["pulse.test.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,2DAA8C;AAC9C,qDAA2E;AAE3E,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"pulse.test.js","sourceRoot":"","sources":["pulse.test.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,2DAA8C;AAC9C,qDAA2E;AAE3E,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IAExB,QAAQ;IACR,MAAM,SAAS,GAAG;QAChB,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAgB,EAAC,aAAa,EAAE,EAAC,YAAY,EAAE,EAAE,EAAC,EAAC,CAAC;QAC/E,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;QACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;KACP,CAAC;IACb,gBAAM,CAAC,oBAAoB,CAAa,GAAG;QAC1C,KAAK,EAAE,GAAG,EAAE;YACV,OAAO,SAAS,CAAC;QACnB,CAAC;KACS,CAAC;IAEb,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,CAAC,EAAuB,CAAC,CAAC;QAE3C,SAAS;QACT,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAErB,SAAS;QACT,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;QACpB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAExD,eAAK,CAAC,SAAS,CAAC,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC;QAElC,MAAM,CAAC,YAAY,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC9C,MAAM,CAAC,YAAY,CAAC,CAAC,oBAAoB,CAAC,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;QACnB,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAEtD,eAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAElB,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAC7C,MAAM,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
/*************************************************************************
|
|
16
|
+
* Copyright 2022 Adobe
|
|
17
|
+
* All Rights Reserved.
|
|
18
|
+
*
|
|
19
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
20
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
21
|
+
* it. If you have received this file from a source other than Adobe,
|
|
22
|
+
* then your use, modification, or distribution of it requires the prior
|
|
23
|
+
* written permission of Adobe.
|
|
24
|
+
**************************************************************************/
|
|
25
|
+
const Global_1 = __importDefault(require("../src/Global"));
|
|
26
|
+
const session_1 = __importDefault(require("../session"));
|
|
27
|
+
describe('session.ts', () => {
|
|
28
|
+
const getMock = jest.fn();
|
|
29
|
+
const setMock = jest.fn();
|
|
30
|
+
const invalidateMock = jest.fn();
|
|
31
|
+
const sessionMock = {
|
|
32
|
+
get: getMock,
|
|
33
|
+
invalidate: invalidateMock,
|
|
34
|
+
set: setMock
|
|
35
|
+
};
|
|
36
|
+
beforeAll(() => {
|
|
37
|
+
Global_1.default['exc-module-runtime'] = {
|
|
38
|
+
session: () => sessionMock
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
afterEach(() => jest.clearAllMocks());
|
|
42
|
+
const mockSession = {
|
|
43
|
+
expires: 100,
|
|
44
|
+
id: 'session'
|
|
45
|
+
};
|
|
46
|
+
test('get', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
|
+
getMock.mockResolvedValue(mockSession);
|
|
48
|
+
const session = yield session_1.default.get();
|
|
49
|
+
expect(session).toEqual(mockSession);
|
|
50
|
+
expect(getMock).toHaveBeenCalledTimes(1);
|
|
51
|
+
expect(getMock).toHaveBeenCalledWith();
|
|
52
|
+
}));
|
|
53
|
+
test('invalidate', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
+
yield session_1.default.invalidate(mockSession);
|
|
55
|
+
expect(invalidateMock).toHaveBeenCalledTimes(1);
|
|
56
|
+
expect(invalidateMock).toHaveBeenCalledWith(mockSession);
|
|
57
|
+
}));
|
|
58
|
+
test('set', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
yield session_1.default.set(mockSession);
|
|
60
|
+
expect(setMock).toHaveBeenCalledTimes(1);
|
|
61
|
+
expect(setMock).toHaveBeenCalledWith(mockSession);
|
|
62
|
+
}));
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=session.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.test.js","sourceRoot":"","sources":["session.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;4EAS4E;AAC5E,2DAA8C;AAC9C,yDAA2D;AAE3D,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAC1B,MAAM,cAAc,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAEjC,MAAM,WAAW,GAAG;QAClB,GAAG,EAAE,OAAO;QACZ,UAAU,EAAE,cAAc;QAC1B,GAAG,EAAE,OAAO;KACC,CAAC;IAEhB,SAAS,CAAC,GAAG,EAAE;QACZ,gBAAM,CAAC,oBAAoB,CAAa,GAAG;YAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW;SAChB,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAEtC,MAAM,WAAW,GAAY;QAC3B,OAAO,EAAE,GAAG;QACZ,EAAE,EAAE,SAAS;KACd,CAAC;IAEF,IAAI,CAAC,KAAK,EAAE,GAAS,EAAE;QACrB,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,MAAM,iBAAU,CAAC,GAAG,EAAE,CAAC;QACvC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,EAAE,CAAC;IACzC,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE,GAAS,EAAE;QAC5B,MAAM,iBAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QACzC,MAAM,CAAC,cAAc,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,cAAc,CAAC,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC3D,CAAC,CAAA,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,GAAS,EAAE;QACrB,MAAM,iBAAU,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAClC,MAAM,CAAC,OAAO,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/version.d.ts
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* then your use, modification, or distribution of it requires the prior
|
|
9
9
|
* written permission of Adobe.
|
|
10
10
|
**************************************************************************/
|
|
11
|
-
declare const EXC_APP_VERSION = "1.0.
|
|
11
|
+
declare const EXC_APP_VERSION = "1.0.3";
|
|
12
12
|
export default EXC_APP_VERSION;
|