@adobe/exc-app 1.0.1 → 1.0.4-beta
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 +8 -0
- package/appapi.d.ts +1 -0
- package/appapi.js +1 -0
- package/appapi.js.map +1 -1
- package/cache.d.ts +132 -0
- package/cache.js +132 -0
- package/cache.js.map +1 -0
- package/capabilityapi.d.ts +2 -0
- package/capabilityapi.js +2 -0
- package/capabilityapi.js.map +1 -1
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/docs/README.md +1 -0
- package/docs/enums/capabilityapi.capabilityids.md +7 -0
- package/docs/enums/capabilityapi.capabilitynames.md +7 -0
- 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/root.modules.md +7 -0
- package/docs/interfaces/root.runtimeconfiguration.md +9 -0
- package/docs/modules/cache.md +85 -0
- package/network/DataContract.d.ts +35 -0
- package/network/DataContract.js +3 -0
- package/network/DataContract.js.map +1 -0
- package/network.d.ts +8 -0
- package/network.js +5 -1
- package/network.js.map +1 -1
- package/package.json +2 -2
- package/settings.js +2 -6
- package/settings.js.map +1 -1
- package/shell.d.ts +2 -0
- package/shell.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/network.test.d.ts +1 -0
- package/tests/network.test.js +77 -0
- package/tests/network.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/version.js.map +1 -1
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
* [SETTINGS](capabilityapi.capabilityids.md#settings)
|
|
51
51
|
* [SOURCE](capabilityapi.capabilityids.md#source)
|
|
52
52
|
* [SUBSCRIPTIONS](capabilityapi.capabilityids.md#subscriptions)
|
|
53
|
+
* [UNIFIEDTAGS](capabilityapi.capabilityids.md#unifiedtags)
|
|
53
54
|
* [WORKFLOW](capabilityapi.capabilityids.md#workflow)
|
|
54
55
|
|
|
55
56
|
## Enumeration members
|
|
@@ -306,6 +307,12 @@ ___
|
|
|
306
307
|
|
|
307
308
|
___
|
|
308
309
|
|
|
310
|
+
### UNIFIEDTAGS
|
|
311
|
+
|
|
312
|
+
• **UNIFIEDTAGS**: = "unifiedTags"
|
|
313
|
+
|
|
314
|
+
___
|
|
315
|
+
|
|
309
316
|
### WORKFLOW
|
|
310
317
|
|
|
311
318
|
• **WORKFLOW**: = "workflow"
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
* [SETTINGS](capabilityapi.capabilitynames.md#settings)
|
|
51
51
|
* [SOURCE](capabilityapi.capabilitynames.md#source)
|
|
52
52
|
* [SUBSCRIPTIONS](capabilityapi.capabilitynames.md#subscriptions)
|
|
53
|
+
* [UNIFIEDTAGS](capabilityapi.capabilitynames.md#unifiedtags)
|
|
53
54
|
* [WORKFLOW](capabilityapi.capabilitynames.md#workflow)
|
|
54
55
|
|
|
55
56
|
## Enumeration members
|
|
@@ -306,6 +307,12 @@ ___
|
|
|
306
307
|
|
|
307
308
|
___
|
|
308
309
|
|
|
310
|
+
### UNIFIEDTAGS
|
|
311
|
+
|
|
312
|
+
• **UNIFIEDTAGS**: = "UnifiedTags"
|
|
313
|
+
|
|
314
|
+
___
|
|
315
|
+
|
|
309
316
|
### WORKFLOW
|
|
310
317
|
|
|
311
318
|
• **WORKFLOW**: = "Workflows"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
**[@adobe/exc-app](../README.md)**
|
|
2
|
+
|
|
3
|
+
> [Globals](../README.md) / [cache](../modules/cache.md) / CacheApi
|
|
4
|
+
|
|
5
|
+
# Interface: CacheApi
|
|
6
|
+
|
|
7
|
+
APIs for managing a client side persisted cache.
|
|
8
|
+
|
|
9
|
+
## Hierarchy
|
|
10
|
+
|
|
11
|
+
* **CacheApi**
|
|
12
|
+
|
|
13
|
+
## Index
|
|
14
|
+
|
|
15
|
+
### Methods
|
|
16
|
+
|
|
17
|
+
* [delete](cache.cacheapi.md#delete)
|
|
18
|
+
* [get](cache.cacheapi.md#get)
|
|
19
|
+
* [set](cache.cacheapi.md#set)
|
|
20
|
+
|
|
21
|
+
## Methods
|
|
22
|
+
|
|
23
|
+
### delete
|
|
24
|
+
|
|
25
|
+
▸ **delete**(`params`: [CacheParameters](cache.cacheparameters.md)): Promise<void\>
|
|
26
|
+
|
|
27
|
+
Deletes a value from the cache (If available).
|
|
28
|
+
|
|
29
|
+
#### Parameters:
|
|
30
|
+
|
|
31
|
+
Name | Type | Description |
|
|
32
|
+
------ | ------ | ------ |
|
|
33
|
+
`params` | [CacheParameters](cache.cacheparameters.md) | Parameters used to identify the cached item to delete. |
|
|
34
|
+
|
|
35
|
+
**Returns:** Promise<void\>
|
|
36
|
+
|
|
37
|
+
___
|
|
38
|
+
|
|
39
|
+
### get
|
|
40
|
+
|
|
41
|
+
▸ **get**<T\>(`params`: [CacheParameters](cache.cacheparameters.md)): Promise<[CacheEntry](../modules/cache.md#cacheentry)<T\> \| undefined\>
|
|
42
|
+
|
|
43
|
+
Gets a value from the cache if one is available.
|
|
44
|
+
|
|
45
|
+
#### Type parameters:
|
|
46
|
+
|
|
47
|
+
Name |
|
|
48
|
+
------ |
|
|
49
|
+
`T` |
|
|
50
|
+
|
|
51
|
+
#### Parameters:
|
|
52
|
+
|
|
53
|
+
Name | Type | Description |
|
|
54
|
+
------ | ------ | ------ |
|
|
55
|
+
`params` | [CacheParameters](cache.cacheparameters.md) | Parameters used to identify the cached item to retrieve. |
|
|
56
|
+
|
|
57
|
+
**Returns:** Promise<[CacheEntry](../modules/cache.md#cacheentry)<T\> \| undefined\>
|
|
58
|
+
|
|
59
|
+
A promise that resolves to the specified value, or undefined if none exist.
|
|
60
|
+
|
|
61
|
+
___
|
|
62
|
+
|
|
63
|
+
### set
|
|
64
|
+
|
|
65
|
+
▸ **set**<T\>(`params`: [CacheSetParameters](cache.cachesetparameters.md)<T\>): Promise<void\>
|
|
66
|
+
|
|
67
|
+
Stores a value in the cache.
|
|
68
|
+
|
|
69
|
+
#### Type parameters:
|
|
70
|
+
|
|
71
|
+
Name |
|
|
72
|
+
------ |
|
|
73
|
+
`T` |
|
|
74
|
+
|
|
75
|
+
#### Parameters:
|
|
76
|
+
|
|
77
|
+
Name | Type | Description |
|
|
78
|
+
------ | ------ | ------ |
|
|
79
|
+
`params` | [CacheSetParameters](cache.cachesetparameters.md)<T\> | Parameters used to identify the cached item to store and control its TTL. |
|
|
80
|
+
|
|
81
|
+
**Returns:** Promise<void\>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
**[@adobe/exc-app](../README.md)**
|
|
2
|
+
|
|
3
|
+
> [Globals](../README.md) / [cache](../modules/cache.md) / CacheParameters
|
|
4
|
+
|
|
5
|
+
# Interface: CacheParameters
|
|
6
|
+
|
|
7
|
+
Input parameters for the Cache get and delete APIs.
|
|
8
|
+
|
|
9
|
+
## Hierarchy
|
|
10
|
+
|
|
11
|
+
* **CacheParameters**
|
|
12
|
+
|
|
13
|
+
↳ [CacheSetParameters](cache.cachesetparameters.md)
|
|
14
|
+
|
|
15
|
+
## Index
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
* [key](cache.cacheparameters.md#key)
|
|
20
|
+
* [scope](cache.cacheparameters.md#scope)
|
|
21
|
+
|
|
22
|
+
## Properties
|
|
23
|
+
|
|
24
|
+
### key
|
|
25
|
+
|
|
26
|
+
• **key**: string
|
|
27
|
+
|
|
28
|
+
Cache key.
|
|
29
|
+
|
|
30
|
+
___
|
|
31
|
+
|
|
32
|
+
### scope
|
|
33
|
+
|
|
34
|
+
• `Optional` **scope**: CacheScope
|
|
35
|
+
|
|
36
|
+
Cache scope (Optional - Defaults to user).
|
|
@@ -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
|
|
@@ -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
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*************************************************************************
|
|
2
|
+
* Copyright 2022 Adobe
|
|
3
|
+
* All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* NOTICE: Adobe permits you to use, modify, and distribute this file in
|
|
6
|
+
* accordance with the terms of the Adobe license agreement accompanying
|
|
7
|
+
* it. If you have received this file from a source other than Adobe,
|
|
8
|
+
* then your use, modification, or distribution of it requires the prior
|
|
9
|
+
* written permission of Adobe.
|
|
10
|
+
**************************************************************************/
|
|
11
|
+
import { CacheExpiry, CacheScope } from '../cache';
|
|
12
|
+
import { FetchScope } from '../network';
|
|
13
|
+
export interface FetchCondition {
|
|
14
|
+
serviceCodes?: string | string[];
|
|
15
|
+
}
|
|
16
|
+
export interface QueryContract<V> {
|
|
17
|
+
fetchScope: FetchScope;
|
|
18
|
+
ignoreErrorsOnPaths?: string[];
|
|
19
|
+
query: string;
|
|
20
|
+
root?: string;
|
|
21
|
+
variables: V;
|
|
22
|
+
}
|
|
23
|
+
interface DataContract<T, V = undefined> {
|
|
24
|
+
defaultValue: T;
|
|
25
|
+
expiry: CacheExpiry;
|
|
26
|
+
fetchWhen?: FetchCondition;
|
|
27
|
+
gql?: QueryContract<V>;
|
|
28
|
+
isSensitive: boolean;
|
|
29
|
+
key: string;
|
|
30
|
+
revalidate: boolean;
|
|
31
|
+
revalidateAfterSec?: number;
|
|
32
|
+
scope: CacheScope;
|
|
33
|
+
shared: boolean;
|
|
34
|
+
}
|
|
35
|
+
export default DataContract;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataContract.js","sourceRoot":"","sources":["DataContract.ts"],"names":[],"mappings":""}
|
package/network.d.ts
CHANGED
|
@@ -371,6 +371,7 @@ export interface ApolloClientOptions {
|
|
|
371
371
|
connectToDevTools?: boolean;
|
|
372
372
|
inputApolloLink?: ApolloLink;
|
|
373
373
|
cacheOptions?: InMemoryCacheConfig;
|
|
374
|
+
xql?: boolean;
|
|
374
375
|
}
|
|
375
376
|
export interface NetworkApi {
|
|
376
377
|
/**
|
|
@@ -399,6 +400,12 @@ export interface NetworkApi {
|
|
|
399
400
|
* @returns The promise for the response to the fetch operation.
|
|
400
401
|
*/
|
|
401
402
|
fetch(input: RequestInfo, init?: FetchInit): Promise<Response>;
|
|
403
|
+
/**
|
|
404
|
+
*
|
|
405
|
+
* @template T
|
|
406
|
+
* @param {string} key
|
|
407
|
+
*/
|
|
408
|
+
fetchContract<T>(key: string): Promise<T>;
|
|
402
409
|
/**
|
|
403
410
|
* Provides an interface for querying resources via GraphqQL.
|
|
404
411
|
* In order to consume query, please make sure the respective query resolver is
|
|
@@ -485,6 +492,7 @@ export interface NetworkApi {
|
|
|
485
492
|
* @returns The promise for the response to the fetch operation.
|
|
486
493
|
*/
|
|
487
494
|
export declare function fetch(input: RequestInfo, init?: FetchInit): Promise<Response>;
|
|
495
|
+
export declare function fetchContract<T>(key: string): Promise<T>;
|
|
488
496
|
/**
|
|
489
497
|
* Provides an interface for querying resources via GraphqQL.
|
|
490
498
|
* In order to consume query, please make sure the respective query resolver is
|
package/network.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* written permission of Adobe.
|
|
11
11
|
**************************************************************************/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.getApolloClient = exports.query = exports.fetch = exports.FetchScope = exports.ROUTING = exports.DEFAULT_STATUS_CODES_TO_RETRY = void 0;
|
|
13
|
+
exports.getApolloClient = exports.query = exports.fetchContract = exports.fetch = exports.FetchScope = exports.ROUTING = exports.DEFAULT_STATUS_CODES_TO_RETRY = void 0;
|
|
14
14
|
const Global_1 = require("./src/Global");
|
|
15
15
|
/**
|
|
16
16
|
* Default status codes which imply a transient error and can be retried.
|
|
@@ -102,6 +102,10 @@ function fetch(input, init) {
|
|
|
102
102
|
return Global_1.getImpl('network').fetch(input, init);
|
|
103
103
|
}
|
|
104
104
|
exports.fetch = fetch;
|
|
105
|
+
function fetchContract(key) {
|
|
106
|
+
return Global_1.getImpl('network').fetchContract(key);
|
|
107
|
+
}
|
|
108
|
+
exports.fetchContract = fetchContract;
|
|
105
109
|
/**
|
|
106
110
|
* Provides an interface for querying resources via GraphqQL.
|
|
107
111
|
* In order to consume query, please make sure the respective query resolver is
|
package/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["network.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;AA+C5E,yCAAqC;AAGrC;;GAEG;AACU,QAAA,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAuKlE,IAAY,OAaX;AAbD,WAAY,OAAO;IACjB;;OAEG;IACH,+DAAiB,CAAA;IACjB;;OAEG;IACH,2CAAO,CAAA;IACP;;OAEG;IACH,yEAAsB,CAAA;AAC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CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAFD,sBAEC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,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.4-beta",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"source": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"registry": "https://registry.npmjs.com/"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@apollo/client": "3.5.
|
|
28
|
+
"@apollo/client": "3.5.7",
|
|
29
29
|
"graphql": "^15.0.0",
|
|
30
30
|
"graphql-tag": "2.12.6"
|
|
31
31
|
},
|
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/shell.d.ts
CHANGED
|
@@ -66,11 +66,13 @@
|
|
|
66
66
|
*/
|
|
67
67
|
import EventEmitter from './src/EventEmitter';
|
|
68
68
|
export interface ShellInfo {
|
|
69
|
+
cdn: string;
|
|
69
70
|
environment: string;
|
|
70
71
|
imsEnvironment: string;
|
|
71
72
|
shellInfo: Record<string, any>;
|
|
72
73
|
}
|
|
73
74
|
interface ShellInfoEvent {
|
|
75
|
+
'change:cdn': string;
|
|
74
76
|
'change:environment': string;
|
|
75
77
|
'change:imsEnvironment': string;
|
|
76
78
|
'change:shellInfo': Record<string, any>;
|
package/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["shell.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;AA4D5E,yCAAqC;
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["shell.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;AA4D5E,yCAAqC;AAwBrC,MAAM,KAAK,GAAG;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QAClB,OAAO,gBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IACD,GAAG,EAAE,MAAM,CAAC,EAAE;QACZ,OAAO,gBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IACD,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACrB,OAAO,gBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IACD,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;QACpB,OAAO,gBAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACU,CAAC;AAEd,kBAAe,KAAK,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":";;;;;;;;;;;;;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