@adobe/exc-app 0.2.39 → 0.2.42
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 +257 -0
- package/RuntimeConfiguration.js +3 -0
- package/RuntimeConfiguration.js.map +1 -0
- package/RuntimeConfiguration.ts +260 -0
- 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/index.d.ts +1 -0
- package/index.js.map +1 -1
- package/index.ts +1 -1
- package/network.d.ts +105 -0
- package/network.js +34 -44
- package/network.js.map +1 -1
- package/network.ts +71 -0
- package/package.json +21 -17
- package/page.d.ts +42 -0
- package/page.js +3 -0
- package/page.js.map +1 -1
- package/page.ts +47 -0
- package/docs/interfaces/reflection-936.reflection-270.modules.md +0 -161
- package/docs/interfaces/reflection-936.reflection-270.runtime.md +0 -102
- package/docs/modules/reflection-936.md +0 -11
- package/docs/modules/reflection-936.reflection-270.md +0 -74
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
var addSorting = (function() {
|
|
3
|
+
'use strict';
|
|
4
|
+
var cols,
|
|
5
|
+
currentSort = {
|
|
6
|
+
index: 0,
|
|
7
|
+
desc: false
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// returns the summary table element
|
|
11
|
+
function getTable() {
|
|
12
|
+
return document.querySelector('.coverage-summary');
|
|
13
|
+
}
|
|
14
|
+
// returns the thead element of the summary table
|
|
15
|
+
function getTableHeader() {
|
|
16
|
+
return getTable().querySelector('thead tr');
|
|
17
|
+
}
|
|
18
|
+
// returns the tbody element of the summary table
|
|
19
|
+
function getTableBody() {
|
|
20
|
+
return getTable().querySelector('tbody');
|
|
21
|
+
}
|
|
22
|
+
// returns the th element for nth column
|
|
23
|
+
function getNthColumn(n) {
|
|
24
|
+
return getTableHeader().querySelectorAll('th')[n];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// loads all columns
|
|
28
|
+
function loadColumns() {
|
|
29
|
+
var colNodes = getTableHeader().querySelectorAll('th'),
|
|
30
|
+
colNode,
|
|
31
|
+
cols = [],
|
|
32
|
+
col,
|
|
33
|
+
i;
|
|
34
|
+
|
|
35
|
+
for (i = 0; i < colNodes.length; i += 1) {
|
|
36
|
+
colNode = colNodes[i];
|
|
37
|
+
col = {
|
|
38
|
+
key: colNode.getAttribute('data-col'),
|
|
39
|
+
sortable: !colNode.getAttribute('data-nosort'),
|
|
40
|
+
type: colNode.getAttribute('data-type') || 'string'
|
|
41
|
+
};
|
|
42
|
+
cols.push(col);
|
|
43
|
+
if (col.sortable) {
|
|
44
|
+
col.defaultDescSort = col.type === 'number';
|
|
45
|
+
colNode.innerHTML =
|
|
46
|
+
colNode.innerHTML + '<span class="sorter"></span>';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return cols;
|
|
50
|
+
}
|
|
51
|
+
// attaches a data attribute to every tr element with an object
|
|
52
|
+
// of data values keyed by column name
|
|
53
|
+
function loadRowData(tableRow) {
|
|
54
|
+
var tableCols = tableRow.querySelectorAll('td'),
|
|
55
|
+
colNode,
|
|
56
|
+
col,
|
|
57
|
+
data = {},
|
|
58
|
+
i,
|
|
59
|
+
val;
|
|
60
|
+
for (i = 0; i < tableCols.length; i += 1) {
|
|
61
|
+
colNode = tableCols[i];
|
|
62
|
+
col = cols[i];
|
|
63
|
+
val = colNode.getAttribute('data-value');
|
|
64
|
+
if (col.type === 'number') {
|
|
65
|
+
val = Number(val);
|
|
66
|
+
}
|
|
67
|
+
data[col.key] = val;
|
|
68
|
+
}
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
// loads all row data
|
|
72
|
+
function loadData() {
|
|
73
|
+
var rows = getTableBody().querySelectorAll('tr'),
|
|
74
|
+
i;
|
|
75
|
+
|
|
76
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
77
|
+
rows[i].data = loadRowData(rows[i]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// sorts the table using the data for the ith column
|
|
81
|
+
function sortByIndex(index, desc) {
|
|
82
|
+
var key = cols[index].key,
|
|
83
|
+
sorter = function(a, b) {
|
|
84
|
+
a = a.data[key];
|
|
85
|
+
b = b.data[key];
|
|
86
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
87
|
+
},
|
|
88
|
+
finalSorter = sorter,
|
|
89
|
+
tableBody = document.querySelector('.coverage-summary tbody'),
|
|
90
|
+
rowNodes = tableBody.querySelectorAll('tr'),
|
|
91
|
+
rows = [],
|
|
92
|
+
i;
|
|
93
|
+
|
|
94
|
+
if (desc) {
|
|
95
|
+
finalSorter = function(a, b) {
|
|
96
|
+
return -1 * sorter(a, b);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
for (i = 0; i < rowNodes.length; i += 1) {
|
|
101
|
+
rows.push(rowNodes[i]);
|
|
102
|
+
tableBody.removeChild(rowNodes[i]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
rows.sort(finalSorter);
|
|
106
|
+
|
|
107
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
108
|
+
tableBody.appendChild(rows[i]);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// removes sort indicators for current column being sorted
|
|
112
|
+
function removeSortIndicators() {
|
|
113
|
+
var col = getNthColumn(currentSort.index),
|
|
114
|
+
cls = col.className;
|
|
115
|
+
|
|
116
|
+
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
|
117
|
+
col.className = cls;
|
|
118
|
+
}
|
|
119
|
+
// adds sort indicators for current column being sorted
|
|
120
|
+
function addSortIndicators() {
|
|
121
|
+
getNthColumn(currentSort.index).className += currentSort.desc
|
|
122
|
+
? ' sorted-desc'
|
|
123
|
+
: ' sorted';
|
|
124
|
+
}
|
|
125
|
+
// adds event listeners for all sorter widgets
|
|
126
|
+
function enableUI() {
|
|
127
|
+
var i,
|
|
128
|
+
el,
|
|
129
|
+
ithSorter = function ithSorter(i) {
|
|
130
|
+
var col = cols[i];
|
|
131
|
+
|
|
132
|
+
return function() {
|
|
133
|
+
var desc = col.defaultDescSort;
|
|
134
|
+
|
|
135
|
+
if (currentSort.index === i) {
|
|
136
|
+
desc = !currentSort.desc;
|
|
137
|
+
}
|
|
138
|
+
sortByIndex(i, desc);
|
|
139
|
+
removeSortIndicators();
|
|
140
|
+
currentSort.index = i;
|
|
141
|
+
currentSort.desc = desc;
|
|
142
|
+
addSortIndicators();
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
for (i = 0; i < cols.length; i += 1) {
|
|
146
|
+
if (cols[i].sortable) {
|
|
147
|
+
// add the click event handler on the th so users
|
|
148
|
+
// dont have to click on those tiny arrows
|
|
149
|
+
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
|
150
|
+
if (el.addEventListener) {
|
|
151
|
+
el.addEventListener('click', ithSorter(i));
|
|
152
|
+
} else {
|
|
153
|
+
el.attachEvent('onclick', ithSorter(i));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// adds sorting functionality to the UI
|
|
159
|
+
return function() {
|
|
160
|
+
if (!getTable()) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
cols = loadColumns();
|
|
164
|
+
loadData();
|
|
165
|
+
addSortIndicators();
|
|
166
|
+
enableUI();
|
|
167
|
+
};
|
|
168
|
+
})();
|
|
169
|
+
|
|
170
|
+
window.addEventListener('load', addSorting);
|
package/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* written permission of Adobe.
|
|
10
10
|
**************************************************************************/
|
|
11
11
|
import Runtime from './src/Runtime';
|
|
12
|
+
export type { RuntimeConfiguration } from './RuntimeConfiguration';
|
|
12
13
|
/**
|
|
13
14
|
* Get the runtime object which contains all unified-shell APIs.
|
|
14
15
|
*
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;;;;;;;;;;;;;;;;;;;;AAE5E;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;;;;;;;;;;;;;;;;;;;;AAE5E;;;;;GAKG;AACH,uDAA6C;AAI7C;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAwB,OAAO;IAC7B,0DAA0D;IAC1D,OAAO,gBAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;AACpF,CAAC;AAHD,0BAGC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,IAAI,CAAC,SAAqC;IACxD,MAAM,QAAQ,GAAG,GAAS,EAAE;QAC1B,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IACvB,CAAC,CAAC;IACF,IAAI,gBAAM,CAAC,oBAAoB,CAAC,EAAE;QAChC,QAAQ,EAAE,CAAC;KACZ;SAAM;QACL,gBAAM,CAAC,YAAY,GAAG,QAAQ,CAAC;KAChC;AACH,CAAC;AATD,oBASC"}
|
package/index.ts
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* @packageDocumentation
|
|
16
16
|
* @preferred
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
18
|
import Global, {getImpl} from './src/Global';
|
|
20
19
|
import Runtime from './src/Runtime';
|
|
20
|
+
export type {RuntimeConfiguration} from './RuntimeConfiguration';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Get the runtime object which contains all unified-shell APIs.
|
package/network.d.ts
CHANGED
|
@@ -8,6 +8,51 @@
|
|
|
8
8
|
* then your use, modification, or distribution of it requires the prior
|
|
9
9
|
* written permission of Adobe.
|
|
10
10
|
**************************************************************************/
|
|
11
|
+
/**
|
|
12
|
+
* APIs that simplify code to make authenticated network requests for resources, execute GraphQL
|
|
13
|
+
* queries, etc..
|
|
14
|
+
*
|
|
15
|
+
* ***Import:***
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import {fetch, query} from '@adobe/exc-app/network';
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* ***Default export:***
|
|
22
|
+
*
|
|
23
|
+
* [NetworkApi](../interfaces/network.networkapi.md)
|
|
24
|
+
*
|
|
25
|
+
* ***Usage:***
|
|
26
|
+
*
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import {fetch, query} from '@adobe/exc-app/network';
|
|
29
|
+
*
|
|
30
|
+
* // Performs a window.fetch call with Authorization and x-api-key headers set
|
|
31
|
+
* const fetchResponse = await fetch('https://localhost', {auth: 'Header', method: 'GET'});
|
|
32
|
+
*
|
|
33
|
+
* // Executes a query for resources to the ExC GraphQL service
|
|
34
|
+
* const queryResponse = await query({
|
|
35
|
+
* data: {
|
|
36
|
+
* query: `
|
|
37
|
+
* query userBehanceQuery($userId: String!, $apiKey: String!) {
|
|
38
|
+
* userBehance(userId: $userId, apiKey: $apiKey) {
|
|
39
|
+
* images
|
|
40
|
+
* }
|
|
41
|
+
* }`,
|
|
42
|
+
* variables: {
|
|
43
|
+
* apiKey: 'test-app',
|
|
44
|
+
* userId: '123@AdobeID'
|
|
45
|
+
* }
|
|
46
|
+
* },
|
|
47
|
+
* operationName: 'BehanceAvatar'
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* ```
|
|
51
|
+
* @packageDocumentation
|
|
52
|
+
* @module network
|
|
53
|
+
*/
|
|
54
|
+
import type { ApolloClient, ApolloLink, InMemoryCache, InMemoryCacheConfig } from '@apollo/client';
|
|
55
|
+
import type { gql } from 'graphql-tag';
|
|
11
56
|
/**
|
|
12
57
|
* Default status codes which imply a transient error and can be retried.
|
|
13
58
|
*/
|
|
@@ -299,6 +344,11 @@ export declare enum FetchScope {
|
|
|
299
344
|
* `{method: 'GET'}`
|
|
300
345
|
*/
|
|
301
346
|
export declare type FetchInit = RequestInit & FetchOptions;
|
|
347
|
+
export interface ApolloClientOptions {
|
|
348
|
+
connectToDevTools?: boolean;
|
|
349
|
+
inputApolloLink?: ApolloLink;
|
|
350
|
+
cacheOptions?: InMemoryCacheConfig;
|
|
351
|
+
}
|
|
302
352
|
export interface NetworkApi {
|
|
303
353
|
/**
|
|
304
354
|
* @deprecated
|
|
@@ -365,6 +415,31 @@ export interface NetworkApi {
|
|
|
365
415
|
* @returns The promise for the response to the query operation.
|
|
366
416
|
*/
|
|
367
417
|
query(request: QueryRequest): Promise<Response>;
|
|
418
|
+
/**
|
|
419
|
+
* Provides an interface for querying resources via GraphqQL using ApolloClient
|
|
420
|
+
* ***Example***
|
|
421
|
+
* ```typescript
|
|
422
|
+
* const apolloClientModule = await getApolloClient();
|
|
423
|
+
* const apolloClient = apolloClientModule.apolloClient;
|
|
424
|
+
* const gql = apolloClientModule.gql;
|
|
425
|
+
* const result = await apolloClient.query({
|
|
426
|
+
* query: gql`query user {
|
|
427
|
+
* id
|
|
428
|
+
* name
|
|
429
|
+
* }`,
|
|
430
|
+
* variables : {}
|
|
431
|
+
* });
|
|
432
|
+
* console.log(result.data);
|
|
433
|
+
* ```
|
|
434
|
+
* @param options Configuration to create ApolloClient instance
|
|
435
|
+
*
|
|
436
|
+
* @returns GraphQL query response
|
|
437
|
+
*
|
|
438
|
+
*/
|
|
439
|
+
getApolloClient(options?: ApolloClientOptions): Promise<{
|
|
440
|
+
apolloClient: ApolloClient<InMemoryCache>;
|
|
441
|
+
gql: typeof gql;
|
|
442
|
+
}>;
|
|
368
443
|
}
|
|
369
444
|
/**
|
|
370
445
|
* Provides an interface for fetching resources powered by the global 'fetch' API.
|
|
@@ -425,4 +500,34 @@ export declare function fetch(input: RequestInfo, init?: FetchInit): Promise<Res
|
|
|
425
500
|
* @returns The promise for the response to the query operation.
|
|
426
501
|
*/
|
|
427
502
|
export declare function query(input: QueryRequest): Promise<Response>;
|
|
503
|
+
/**
|
|
504
|
+
* Provides an interface for querying resources via GraphqQL using ApolloClient
|
|
505
|
+
* ***Example***
|
|
506
|
+
* ```typescript
|
|
507
|
+
* const apolloClientModule = await getApolloClient();
|
|
508
|
+
* const apolloClient = apolloClientModule.apolloClient;
|
|
509
|
+
* const gql = apolloClientModule.gql;
|
|
510
|
+
* const result = await apolloClient.query({
|
|
511
|
+
* query: gql`query user {
|
|
512
|
+
* id
|
|
513
|
+
* name
|
|
514
|
+
* }`,
|
|
515
|
+
* variables : {}
|
|
516
|
+
* });
|
|
517
|
+
* console.log(result.data);
|
|
518
|
+
* ```
|
|
519
|
+
* @param options Configuration to create ApolloClient instance
|
|
520
|
+
* @returns GraphQL query response
|
|
521
|
+
*
|
|
522
|
+
*/
|
|
523
|
+
export declare function getApolloClient(options?: ApolloClientOptions): Promise<{
|
|
524
|
+
apolloClient: ApolloClient<InMemoryCache>;
|
|
525
|
+
gql: typeof gql;
|
|
526
|
+
}>;
|
|
527
|
+
/**
|
|
528
|
+
* @ignore
|
|
529
|
+
*/
|
|
530
|
+
export declare class Internal {
|
|
531
|
+
static configure(config: Configuration): void;
|
|
532
|
+
}
|
|
428
533
|
export {};
|
package/network.js
CHANGED
|
@@ -10,50 +10,7 @@
|
|
|
10
10
|
* written permission of Adobe.
|
|
11
11
|
**************************************************************************/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.query = exports.fetch = exports.FetchScope = exports.ROUTING = exports.DEFAULT_STATUS_CODES_TO_RETRY = void 0;
|
|
14
|
-
/**
|
|
15
|
-
* APIs that simplify code to make authenticated network requests for resources, execute GraphQL
|
|
16
|
-
* queries, etc..
|
|
17
|
-
*
|
|
18
|
-
* ***Import:***
|
|
19
|
-
*
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import {fetch, query} from '@adobe/exc-app/network';
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* ***Default export:***
|
|
25
|
-
*
|
|
26
|
-
* [NetworkApi](../interfaces/network.networkapi.md)
|
|
27
|
-
*
|
|
28
|
-
* ***Usage:***
|
|
29
|
-
*
|
|
30
|
-
* ```typescript
|
|
31
|
-
* import {fetch, query} from '@adobe/exc-app/network';
|
|
32
|
-
*
|
|
33
|
-
* // Performs a window.fetch call with Authorization and x-api-key headers set
|
|
34
|
-
* const fetchResponse = await fetch('https://localhost', {auth: 'Header', method: 'GET'});
|
|
35
|
-
*
|
|
36
|
-
* // Executes a query for resources to the ExC GraphQL service
|
|
37
|
-
* const queryResponse = await query({
|
|
38
|
-
* data: {
|
|
39
|
-
* query: `
|
|
40
|
-
* query userBehanceQuery($userId: String!, $apiKey: String!) {
|
|
41
|
-
* userBehance(userId: $userId, apiKey: $apiKey) {
|
|
42
|
-
* images
|
|
43
|
-
* }
|
|
44
|
-
* }`,
|
|
45
|
-
* variables: {
|
|
46
|
-
* apiKey: 'test-app',
|
|
47
|
-
* userId: '123@AdobeID'
|
|
48
|
-
* }
|
|
49
|
-
* },
|
|
50
|
-
* operationName: 'BehanceAvatar'
|
|
51
|
-
* });
|
|
52
|
-
*
|
|
53
|
-
* ```
|
|
54
|
-
* @packageDocumentation
|
|
55
|
-
* @module network
|
|
56
|
-
*/
|
|
13
|
+
exports.Internal = exports.getApolloClient = exports.query = exports.fetch = exports.FetchScope = exports.ROUTING = exports.DEFAULT_STATUS_CODES_TO_RETRY = void 0;
|
|
57
14
|
const Global_1 = require("./src/Global");
|
|
58
15
|
/**
|
|
59
16
|
* Default status codes which imply a transient error and can be retried.
|
|
@@ -170,4 +127,37 @@ function query(input) {
|
|
|
170
127
|
return Global_1.getImpl('network').query(input);
|
|
171
128
|
}
|
|
172
129
|
exports.query = query;
|
|
130
|
+
/**
|
|
131
|
+
* Provides an interface for querying resources via GraphqQL using ApolloClient
|
|
132
|
+
* ***Example***
|
|
133
|
+
* ```typescript
|
|
134
|
+
* const apolloClientModule = await getApolloClient();
|
|
135
|
+
* const apolloClient = apolloClientModule.apolloClient;
|
|
136
|
+
* const gql = apolloClientModule.gql;
|
|
137
|
+
* const result = await apolloClient.query({
|
|
138
|
+
* query: gql`query user {
|
|
139
|
+
* id
|
|
140
|
+
* name
|
|
141
|
+
* }`,
|
|
142
|
+
* variables : {}
|
|
143
|
+
* });
|
|
144
|
+
* console.log(result.data);
|
|
145
|
+
* ```
|
|
146
|
+
* @param options Configuration to create ApolloClient instance
|
|
147
|
+
* @returns GraphQL query response
|
|
148
|
+
*
|
|
149
|
+
*/
|
|
150
|
+
function getApolloClient(options) {
|
|
151
|
+
return Global_1.getImpl('network').getApolloClient(options);
|
|
152
|
+
}
|
|
153
|
+
exports.getApolloClient = getApolloClient;
|
|
154
|
+
/**
|
|
155
|
+
* @ignore
|
|
156
|
+
*/
|
|
157
|
+
class Internal {
|
|
158
|
+
static configure(config) {
|
|
159
|
+
return Global_1.getImpl('network').configure(config);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exports.Internal = Internal;
|
|
173
163
|
//# sourceMappingURL=network.js.map
|
package/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["network.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;;
|
|
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;AAsKlE,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,+DAAiB,CAAA;AACnB,CAAC,EAFW,OAAO,GAAP,eAAO,KAAP,eAAO,QAElB;AA0ED;;GAEG;AACH,IAAY,UAqCX;AArCD,WAAY,UAAU;IACpB;;;OAGG;IACH,2BAAW,CAAA;IACX;;;;OAIG;IACH,2BAAW,CAAA;IACX;;;;;OAKG;IACH,yBAAS,CAAA;IACT;;;;;;OAMG;IACH,iCAAiB,CAAA;IACjB;;;;;;;;OAQG;IACH,2CAA2B,CAAA;AAC7B,CAAC,EArCW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAqCrB;AAmHD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,KAAK,CAAC,KAAkB,EAAE,IAAgB;IACxD,OAAO,gBAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAFD,sBAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,KAAK,CAAC,KAAmB;IACvC,OAAO,gBAAO,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;AAED;;GAEG;AACH,MAAa,QAAQ;IACZ,MAAM,CAAC,SAAS,CAAC,MAAqB;QAC3C,OAAO,gBAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;CACF;AAJD,4BAIC"}
|
package/network.ts
CHANGED
|
@@ -53,7 +53,9 @@
|
|
|
53
53
|
* @module network
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
|
+
import type {ApolloClient, ApolloLink, InMemoryCache, InMemoryCacheConfig} from '@apollo/client';
|
|
56
57
|
import {getImpl} from './src/Global';
|
|
58
|
+
import type {gql} from 'graphql-tag';
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
61
|
* Default status codes which imply a transient error and can be retried.
|
|
@@ -354,6 +356,12 @@ export enum FetchScope {
|
|
|
354
356
|
*/
|
|
355
357
|
export type FetchInit = RequestInit & FetchOptions;
|
|
356
358
|
|
|
359
|
+
export interface ApolloClientOptions {
|
|
360
|
+
connectToDevTools?: boolean;
|
|
361
|
+
inputApolloLink?: ApolloLink;
|
|
362
|
+
cacheOptions?: InMemoryCacheConfig;
|
|
363
|
+
}
|
|
364
|
+
|
|
357
365
|
export interface NetworkApi {
|
|
358
366
|
/**
|
|
359
367
|
* @deprecated
|
|
@@ -422,6 +430,31 @@ export interface NetworkApi {
|
|
|
422
430
|
*/
|
|
423
431
|
query(request: QueryRequest): Promise<Response>;
|
|
424
432
|
|
|
433
|
+
/**
|
|
434
|
+
* Provides an interface for querying resources via GraphqQL using ApolloClient
|
|
435
|
+
* ***Example***
|
|
436
|
+
* ```typescript
|
|
437
|
+
* const apolloClientModule = await getApolloClient();
|
|
438
|
+
* const apolloClient = apolloClientModule.apolloClient;
|
|
439
|
+
* const gql = apolloClientModule.gql;
|
|
440
|
+
* const result = await apolloClient.query({
|
|
441
|
+
* query: gql`query user {
|
|
442
|
+
* id
|
|
443
|
+
* name
|
|
444
|
+
* }`,
|
|
445
|
+
* variables : {}
|
|
446
|
+
* });
|
|
447
|
+
* console.log(result.data);
|
|
448
|
+
* ```
|
|
449
|
+
* @param options Configuration to create ApolloClient instance
|
|
450
|
+
*
|
|
451
|
+
* @returns GraphQL query response
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
getApolloClient(options?:ApolloClientOptions): Promise<{
|
|
455
|
+
apolloClient: ApolloClient<InMemoryCache>;
|
|
456
|
+
gql: typeof gql;
|
|
457
|
+
}>;
|
|
425
458
|
}
|
|
426
459
|
|
|
427
460
|
/**
|
|
@@ -488,3 +521,41 @@ export function fetch(input: RequestInfo, init?: FetchInit): Promise<Response> {
|
|
|
488
521
|
export function query(input: QueryRequest): Promise<Response> {
|
|
489
522
|
return getImpl('network').query(input);
|
|
490
523
|
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Provides an interface for querying resources via GraphqQL using ApolloClient
|
|
527
|
+
* ***Example***
|
|
528
|
+
* ```typescript
|
|
529
|
+
* const apolloClientModule = await getApolloClient();
|
|
530
|
+
* const apolloClient = apolloClientModule.apolloClient;
|
|
531
|
+
* const gql = apolloClientModule.gql;
|
|
532
|
+
* const result = await apolloClient.query({
|
|
533
|
+
* query: gql`query user {
|
|
534
|
+
* id
|
|
535
|
+
* name
|
|
536
|
+
* }`,
|
|
537
|
+
* variables : {}
|
|
538
|
+
* });
|
|
539
|
+
* console.log(result.data);
|
|
540
|
+
* ```
|
|
541
|
+
* @param options Configuration to create ApolloClient instance
|
|
542
|
+
* @returns GraphQL query response
|
|
543
|
+
*
|
|
544
|
+
*/
|
|
545
|
+
export function getApolloClient(
|
|
546
|
+
options?: ApolloClientOptions
|
|
547
|
+
): Promise<{
|
|
548
|
+
apolloClient: ApolloClient<InMemoryCache>;
|
|
549
|
+
gql: typeof gql;
|
|
550
|
+
}> {
|
|
551
|
+
return getImpl('network').getApolloClient(options);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* @ignore
|
|
556
|
+
*/
|
|
557
|
+
export class Internal {
|
|
558
|
+
public static configure(config: Configuration): void {
|
|
559
|
+
return getImpl('network').configure(config);
|
|
560
|
+
}
|
|
561
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/exc-app",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.42",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"source": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -25,22 +25,26 @@
|
|
|
25
25
|
"publishConfig": {
|
|
26
26
|
"registry": "https://registry.npmjs.com/"
|
|
27
27
|
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@apollo/client": "3.4.11",
|
|
30
|
+
"graphql-tag": "2.12.5"
|
|
31
|
+
},
|
|
28
32
|
"devDependencies": {
|
|
29
|
-
"cross-env": "
|
|
30
|
-
"enzyme": "
|
|
31
|
-
"eslint": "
|
|
32
|
-
"eslint-plugin-header": "
|
|
33
|
-
"eslint-plugin-jsdoc": "
|
|
34
|
-
"eslint-plugin-prettier": "
|
|
35
|
-
"eslint-plugin-rulesdir": "
|
|
36
|
-
"glob": "
|
|
37
|
-
"jest": "
|
|
38
|
-
"jest-dev-server": "
|
|
39
|
-
"jest-localstorage-mock": "
|
|
40
|
-
"jest-when": "
|
|
41
|
-
"ts-jest": "
|
|
42
|
-
"typedoc": "
|
|
43
|
-
"typedoc-plugin-external-module-name": "
|
|
44
|
-
"typedoc-plugin-markdown": "
|
|
33
|
+
"cross-env": "7.0.3",
|
|
34
|
+
"enzyme": "3.11.0",
|
|
35
|
+
"eslint": "7.19.0",
|
|
36
|
+
"eslint-plugin-header": "3.1.1",
|
|
37
|
+
"eslint-plugin-jsdoc": "30.7.13",
|
|
38
|
+
"eslint-plugin-prettier": "3.4.1",
|
|
39
|
+
"eslint-plugin-rulesdir": "0.1.0",
|
|
40
|
+
"glob": "7.1.7",
|
|
41
|
+
"jest": "26.6.3",
|
|
42
|
+
"jest-dev-server": "4.4.0",
|
|
43
|
+
"jest-localstorage-mock": "2.4.17",
|
|
44
|
+
"jest-when": "3.3.1",
|
|
45
|
+
"ts-jest": "26.5.6",
|
|
46
|
+
"typedoc": "0.19.2",
|
|
47
|
+
"typedoc-plugin-external-module-name": "4.0.6",
|
|
48
|
+
"typedoc-plugin-markdown": "3.10.4"
|
|
45
49
|
}
|
|
46
50
|
}
|
package/page.d.ts
CHANGED
|
@@ -193,10 +193,37 @@ export interface PageApiProperties {
|
|
|
193
193
|
*/
|
|
194
194
|
unloadPromptMessage: string;
|
|
195
195
|
}
|
|
196
|
+
export interface Callback {
|
|
197
|
+
(value?: any): void;
|
|
198
|
+
}
|
|
196
199
|
/**
|
|
197
200
|
* Defines page-level APIs available to solutions.
|
|
198
201
|
*/
|
|
199
202
|
export interface PageApi extends PageApiProperties {
|
|
203
|
+
/**
|
|
204
|
+
* A function that listens and handles the afterPrint event.
|
|
205
|
+
*
|
|
206
|
+
* ```typescript
|
|
207
|
+
* ***Example:***
|
|
208
|
+
* page.afterPrintHandler = function () {
|
|
209
|
+
* // Revert temporary CSS changes
|
|
210
|
+
* };
|
|
211
|
+
* ````
|
|
212
|
+
* @param callback The function that results in printing.
|
|
213
|
+
*/
|
|
214
|
+
afterPrintHandler(callback: Callback): void;
|
|
215
|
+
/**
|
|
216
|
+
* A function that listens and handles the beforePrint event.
|
|
217
|
+
*
|
|
218
|
+
* ```typescript
|
|
219
|
+
* ***Example:***
|
|
220
|
+
* page.beforePrintHandler = function () {
|
|
221
|
+
* // Temporary CSS changes, like unsetting height
|
|
222
|
+
* };
|
|
223
|
+
* ````
|
|
224
|
+
* @param callback The function that results in printing.
|
|
225
|
+
*/
|
|
226
|
+
beforePrintHandler(callback: Callback): void;
|
|
200
227
|
/**
|
|
201
228
|
* Sometimes applications will need to block navigation away from the current page. The most common use case
|
|
202
229
|
* for this is when a user has unsaved changes that would be lost on navigation.
|
|
@@ -329,6 +356,21 @@ export interface PageApi extends PageApiProperties {
|
|
|
329
356
|
* or pathname resolutions specific to the current app.
|
|
330
357
|
*/
|
|
331
358
|
openInNewTab(path: string, newApp?: boolean): void;
|
|
359
|
+
/**
|
|
360
|
+
* A function to control printing. The callback function should call `window.print()`
|
|
361
|
+
* at some point. It's important that the callback not be an arrow function if you
|
|
362
|
+
* want the `window` object to be the iframe contents. Feel free to adjust your
|
|
363
|
+
* CSS or UI before `window.print()` and reverse those changes afterwards.
|
|
364
|
+
*
|
|
365
|
+
* ```typescript
|
|
366
|
+
* ***Example:***
|
|
367
|
+
* page.print = function () {
|
|
368
|
+
* window.print();
|
|
369
|
+
* };
|
|
370
|
+
* ````
|
|
371
|
+
* @param callback The function that results in printing.
|
|
372
|
+
*/
|
|
373
|
+
print(callback: Callback): void;
|
|
332
374
|
/**
|
|
333
375
|
* Set the list of selectors presently being used by modalAutoDetect. If set to an empty
|
|
334
376
|
* array, the default selectors used by runtime will be used instead. To stop observing changes
|
package/page.js
CHANGED
|
@@ -50,7 +50,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
50
50
|
*/
|
|
51
51
|
const Global_1 = require("./src/Global");
|
|
52
52
|
const page = Global_1.connect('page', [
|
|
53
|
+
['afterPrintHandler'],
|
|
53
54
|
['appContainer'],
|
|
55
|
+
['beforePrintHandler'],
|
|
54
56
|
['blockNavigation', true],
|
|
55
57
|
['clipboardWrite', true],
|
|
56
58
|
['done', true],
|
|
@@ -63,6 +65,7 @@ const page = Global_1.connect('page', [
|
|
|
63
65
|
['notFound', true],
|
|
64
66
|
['openInNewTab', true],
|
|
65
67
|
['preventDefaultCombos'],
|
|
68
|
+
['print', true],
|
|
66
69
|
['shellRedirect', true],
|
|
67
70
|
['setModalQuerySelectors'],
|
|
68
71
|
['spinner'],
|
package/page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.js","sourceRoot":"","sources":["page.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,yCAAqC;
|
|
1
|
+
{"version":3,"file":"page.js","sourceRoot":"","sources":["page.ts"],"names":[],"mappings":";AAAA;;;;;;;;;4EAS4E;;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,yCAAqC;AAoarC,MAAM,IAAI,GAAG,gBAAO,CAAC,MAAM,EAAE;IAC3B,CAAC,mBAAmB,CAAC;IACrB,CAAC,cAAc,CAAC;IAChB,CAAC,oBAAoB,CAAC;IACtB,CAAC,iBAAiB,EAAE,IAAI,CAAC;IACzB,CAAC,gBAAgB,EAAE,IAAI,CAAC;IACxB,CAAC,MAAM,EAAE,IAAI,CAAC;IACd,CAAC,kBAAkB,EAAE,IAAI,CAAC;IAC1B,CAAC,wBAAwB,CAAC;IAC1B,CAAC,SAAS,CAAC;IACX,CAAC,cAAc,EAAE,IAAI,CAAC;IACtB,CAAC,OAAO,CAAC;IACT,CAAC,iBAAiB,CAAC;IACnB,CAAC,UAAU,EAAE,IAAI,CAAC;IAClB,CAAC,cAAc,EAAE,IAAI,CAAC;IACtB,CAAC,sBAAsB,CAAC;IACxB,CAAC,OAAO,EAAE,IAAI,CAAC;IACf,CAAC,eAAe,EAAE,IAAI,CAAC;IACvB,CAAC,wBAAwB,CAAC;IAC1B,CAAC,SAAS,CAAC;IACX,CAAC,OAAO,CAAC;IACT,CAAC,qBAAqB,CAAC;CACxB,CAAC,CAAC;AAEH,kBAAe,IAAI,CAAC"}
|