@adaptabletools/adaptable-plugin-ipushpull 22.0.1-canary.3 → 22.0.2
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/package.json +1 -3
- package/src/IPushPullApiImpl.d.ts +4 -3
- package/src/IPushPullApiImpl.js +1 -1
- package/src/IPushPullPluginOptions.d.ts +59 -0
- package/src/Module/PushPullModule.js +47 -49
- package/src/Utilities/Services/IPushPullService.d.ts +39 -0
- package/src/Utilities/Services/IPushPullService.js +202 -0
- package/src/Utilities/Services/Interface/{IPushPullService.d.ts → IIPushPullService.d.ts} +2 -2
- package/src/Utilities/Services/Interface/IIPushPullService.js +1 -0
- package/src/View/IPushPullAddPagePopup.js +11 -14
- package/src/View/IPushPullLoginPopup.js +10 -13
- package/src/View/IPushPullViewPanel.js +1 -1
- package/src/index.d.ts +4 -3
- package/src/index.js +25 -35
- package/src/ipushpull-client/IPushPullClient.d.ts +27 -0
- package/src/ipushpull-client/IPushPullClient.js +197 -0
- package/src/ipushpull-client/index.d.ts +4 -0
- package/src/ipushpull-client/index.js +2 -0
- package/src/ipushpull-client/themes.d.ts +8 -0
- package/src/ipushpull-client/themes.js +159 -0
- package/src/ipushpull-client/types.d.ts +67 -0
- package/src/ipushpull-client/types.js +1 -0
- package/src/Utilities/Services/PushPullService.d.ts +0 -26
- package/src/Utilities/Services/PushPullService.js +0 -300
- /package/src/{Utilities/Services/Interface/IPushPullService.js → IPushPullPluginOptions.js} +0 -0
package/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdaptablePlugin } from '@adaptabletools/adaptable';
|
|
1
|
+
import { AdaptablePlugin } from '@adaptabletools/adaptable/types';
|
|
2
2
|
import env from './env';
|
|
3
3
|
import packageJson from '../package.json';
|
|
4
4
|
import adaptableCorePackageJson from '@adaptabletools/adaptable/package.json';
|
|
@@ -8,8 +8,8 @@ import * as PopupRedux from '@adaptabletools/adaptable/src/Redux/ActionsReducers
|
|
|
8
8
|
import { AdaptableViewFactory, AdaptableViewPanelFactory, } from '@adaptabletools/adaptable/src/View/AdaptableViewFactory';
|
|
9
9
|
import { PushPullModule } from './Module/PushPullModule';
|
|
10
10
|
import { IPushPullApiImpl } from './IPushPullApiImpl';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
11
|
+
import { IPushPullService } from './Utilities/Services/IPushPullService';
|
|
12
|
+
import { IPushPullClient } from './ipushpull-client';
|
|
13
13
|
import { iPushPullInitialState, IPushPullReducer, IPushPullSetCurrentAvailablePages, IPushPullSetCurrentPage, } from './Redux/ActionReducers/IPushPullRedux';
|
|
14
14
|
import { IPushPullLoginPopup } from './View/IPushPullLoginPopup';
|
|
15
15
|
import { IPushPullAddPagePopup } from './View/IPushPullAddPagePopup';
|
|
@@ -22,25 +22,18 @@ const suffix = name.endsWith('-cjs') ? '-cjs' : '';
|
|
|
22
22
|
if (version !== coreVersion) {
|
|
23
23
|
console.warn(`Version mismatch: "@adaptabletools/adaptable-plugin-ipushpull${suffix}" (v${version}) and "@adaptabletools/adaptable${suffix}" (v${coreVersion}) have different versions. They should be the exact same version.`);
|
|
24
24
|
}
|
|
25
|
+
const DEFAULT_API_URL = 'https://test.ipushpull.com/api/1.0';
|
|
25
26
|
const getApiKey = () => {
|
|
26
|
-
|
|
27
|
-
return key;
|
|
27
|
+
return env.IPUSHPULL_API_KEY || '';
|
|
28
28
|
};
|
|
29
29
|
const getApiSecret = () => {
|
|
30
|
-
|
|
31
|
-
return secret;
|
|
30
|
+
return env.IPUSHPULL_API_SECRET || '';
|
|
32
31
|
};
|
|
33
32
|
const defaultOptions = {
|
|
34
33
|
ippConfig: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
api_url:
|
|
38
|
-
ws_url: 'https://www.ipushpull.com',
|
|
39
|
-
web_url: 'https://www.ipushpull.com',
|
|
40
|
-
docs_url: 'https://docs.ipushpull.com',
|
|
41
|
-
storage_prefix: 'ipp_local',
|
|
42
|
-
transport: 'polling',
|
|
43
|
-
hsts: false, // strict cors policy
|
|
34
|
+
api_key: getApiKey(),
|
|
35
|
+
api_secret: getApiSecret(),
|
|
36
|
+
api_url: DEFAULT_API_URL,
|
|
44
37
|
},
|
|
45
38
|
autoLogin: false,
|
|
46
39
|
throttleTime: 2000,
|
|
@@ -52,40 +45,37 @@ class IPushPullPlugin extends AdaptablePlugin {
|
|
|
52
45
|
PushPullService;
|
|
53
46
|
constructor(options) {
|
|
54
47
|
super(options);
|
|
48
|
+
const defaults = defaultOptions.ippConfig;
|
|
49
|
+
const userConfig = options?.ippConfig;
|
|
55
50
|
const ippConfig = {
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
api_url: userConfig?.api_url ?? defaults.api_url ?? DEFAULT_API_URL,
|
|
52
|
+
api_key: userConfig?.api_key || defaults.api_key,
|
|
53
|
+
api_secret: userConfig?.api_secret || defaults.api_secret,
|
|
58
54
|
};
|
|
59
|
-
if (!ippConfig.api_key) {
|
|
60
|
-
ippConfig.api_key = defaultOptions.ippConfig.api_key;
|
|
61
|
-
}
|
|
62
|
-
if (!ippConfig.api_secret) {
|
|
63
|
-
ippConfig.api_secret = defaultOptions.ippConfig.api_secret;
|
|
64
|
-
}
|
|
65
55
|
this.options = {
|
|
66
56
|
...defaultOptions,
|
|
67
57
|
...options,
|
|
68
58
|
ippConfig,
|
|
69
59
|
};
|
|
70
|
-
/**
|
|
71
|
-
* Contains the objects required to export (snapshot or live) data to ipushpull from AdapTable.
|
|
72
|
-
*
|
|
73
|
-
* Includes ipushpull config and objects and, optionally, any ipushpull Reports (including schedules).
|
|
74
|
-
*/
|
|
75
|
-
// IPushPull?: IPushPullState;
|
|
76
|
-
ipushpull.config.set(this.options.ippConfig);
|
|
77
60
|
}
|
|
78
61
|
afterInitApi(adaptable) {
|
|
62
|
+
const config = this.options.ippConfig;
|
|
63
|
+
const client = new IPushPullClient({
|
|
64
|
+
api_url: config.api_url ?? DEFAULT_API_URL,
|
|
65
|
+
api_key: config.api_key,
|
|
66
|
+
api_secret: config.api_secret,
|
|
67
|
+
});
|
|
79
68
|
this.iPushPullApi = new IPushPullApiImpl(adaptable, this.options);
|
|
80
|
-
this.PushPullService = new
|
|
81
|
-
this.iPushPullApi.setIPushPullInstance(
|
|
69
|
+
this.PushPullService = new IPushPullService(adaptable, this.options.cellStyles);
|
|
70
|
+
this.iPushPullApi.setIPushPullInstance(client);
|
|
82
71
|
this.registerProperty('api', () => this.iPushPullApi);
|
|
83
72
|
this.registerProperty('service', () => this.PushPullService);
|
|
84
73
|
}
|
|
74
|
+
// FIXME AFL improve typing
|
|
85
75
|
rootReducer = (rootReducer) => {
|
|
86
76
|
return {
|
|
87
|
-
|
|
88
|
-
let augmentedState = rootReducer.
|
|
77
|
+
Internal: (state, action) => {
|
|
78
|
+
let augmentedState = rootReducer.Internal(state, action);
|
|
89
79
|
if (!state) {
|
|
90
80
|
// required for store initialization
|
|
91
81
|
// (idiomatic way of default parameter value in reducer is not feasible because the passed argument is already initialized by the System reducer)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IPushPullClientConfig, IPushPullTokens, IPushPullDomainAccessInfo, IPushPullPageContentPayload, IPushPullPageContentResponse, IPushPullCellStyle } from './types';
|
|
2
|
+
export declare class IPushPullClient {
|
|
3
|
+
private config;
|
|
4
|
+
private tokens;
|
|
5
|
+
private refreshPromise;
|
|
6
|
+
constructor(config: IPushPullClientConfig);
|
|
7
|
+
private buildOAuthBody;
|
|
8
|
+
login(username: string, password: string): Promise<IPushPullTokens>;
|
|
9
|
+
refreshToken(): Promise<IPushPullTokens>;
|
|
10
|
+
private doRefreshToken;
|
|
11
|
+
logout(): Promise<void>;
|
|
12
|
+
getDomainsAndPages(): Promise<IPushPullDomainAccessInfo[]>;
|
|
13
|
+
getPageContent(folderId: number, pageId: number): Promise<any>;
|
|
14
|
+
updatePageContent(folderId: number, pageId: number, payload: IPushPullPageContentPayload): Promise<IPushPullPageContentResponse>;
|
|
15
|
+
createPage(folderId: number, pageName: string, description?: string): Promise<any>;
|
|
16
|
+
isAuthenticated(): boolean;
|
|
17
|
+
private fetchWithAuth;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Converts per-cell data (array of rows, each cell being { value, formatted_value, style })
|
|
21
|
+
* into the official ipushpull page content format with deduplicated styles.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildPageContentPayload(cellData: Array<Array<{
|
|
24
|
+
value: any;
|
|
25
|
+
formatted_value: any;
|
|
26
|
+
style: IPushPullCellStyle;
|
|
27
|
+
}>>): IPushPullPageContentPayload;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
export class IPushPullClient {
|
|
2
|
+
config;
|
|
3
|
+
tokens = null;
|
|
4
|
+
refreshPromise = null;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
}
|
|
8
|
+
buildOAuthBody(params) {
|
|
9
|
+
const allParams = {
|
|
10
|
+
...params,
|
|
11
|
+
client_id: this.config.api_key,
|
|
12
|
+
client_secret: this.config.api_secret,
|
|
13
|
+
};
|
|
14
|
+
return Object.entries(allParams)
|
|
15
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
|
16
|
+
.join('&');
|
|
17
|
+
}
|
|
18
|
+
async login(username, password) {
|
|
19
|
+
const url = `${this.config.api_url}/oauth/token/`;
|
|
20
|
+
const body = this.buildOAuthBody({
|
|
21
|
+
grant_type: 'password',
|
|
22
|
+
username,
|
|
23
|
+
password,
|
|
24
|
+
});
|
|
25
|
+
const response = await fetch(url, {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: {
|
|
28
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
29
|
+
},
|
|
30
|
+
body,
|
|
31
|
+
});
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
const errorData = await response.json().catch(() => ({}));
|
|
34
|
+
const message = errorData.error_description || errorData.error || response.statusText;
|
|
35
|
+
const err = new Error(message);
|
|
36
|
+
err.data = errorData;
|
|
37
|
+
throw err;
|
|
38
|
+
}
|
|
39
|
+
this.tokens = await response.json();
|
|
40
|
+
return this.tokens;
|
|
41
|
+
}
|
|
42
|
+
async refreshToken() {
|
|
43
|
+
if (!this.tokens?.refresh_token) {
|
|
44
|
+
throw new Error('No refresh token available. Please login first.');
|
|
45
|
+
}
|
|
46
|
+
// Deduplicate concurrent refresh attempts
|
|
47
|
+
if (this.refreshPromise) {
|
|
48
|
+
return this.refreshPromise;
|
|
49
|
+
}
|
|
50
|
+
this.refreshPromise = this.doRefreshToken();
|
|
51
|
+
try {
|
|
52
|
+
const result = await this.refreshPromise;
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
this.refreshPromise = null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async doRefreshToken() {
|
|
60
|
+
const url = `${this.config.api_url}/oauth/token/`;
|
|
61
|
+
const body = this.buildOAuthBody({
|
|
62
|
+
grant_type: 'refresh_token',
|
|
63
|
+
refresh_token: this.tokens.refresh_token,
|
|
64
|
+
});
|
|
65
|
+
const response = await fetch(url, {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: {
|
|
68
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
69
|
+
},
|
|
70
|
+
body,
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
this.tokens = null;
|
|
74
|
+
const errorData = await response.json().catch(() => ({}));
|
|
75
|
+
throw new Error(errorData.error_description || errorData.error || 'Token refresh failed');
|
|
76
|
+
}
|
|
77
|
+
this.tokens = await response.json();
|
|
78
|
+
return this.tokens;
|
|
79
|
+
}
|
|
80
|
+
async logout() {
|
|
81
|
+
if (!this.tokens?.access_token) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const url = `${this.config.api_url}/oauth/logout/`;
|
|
85
|
+
await fetch(url, {
|
|
86
|
+
method: 'POST',
|
|
87
|
+
headers: {
|
|
88
|
+
Authorization: `Bearer ${this.tokens.access_token}`,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
this.tokens = null;
|
|
92
|
+
}
|
|
93
|
+
async getDomainsAndPages() {
|
|
94
|
+
const url = `${this.config.api_url}/domain_page_access`;
|
|
95
|
+
const response = await this.fetchWithAuth(url);
|
|
96
|
+
const data = await response.json();
|
|
97
|
+
return (data.domains ?? data).map((domain) => ({
|
|
98
|
+
id: domain.id,
|
|
99
|
+
name: domain.name,
|
|
100
|
+
pages: (domain.current_user_domain_page_access?.pages ?? domain.pages ?? []).map((page) => ({
|
|
101
|
+
id: page.id,
|
|
102
|
+
name: page.name,
|
|
103
|
+
special_page_type: page.special_page_type ?? 0,
|
|
104
|
+
write_access: page.write_access ?? false,
|
|
105
|
+
})),
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
async getPageContent(folderId, pageId) {
|
|
109
|
+
const baseUrl = this.config.api_url.replace(/\/api\/1\.0\/?$/, '');
|
|
110
|
+
const url = `${baseUrl}/api/2.0/domains/id/${folderId}/page_content/id/${pageId}/`;
|
|
111
|
+
const response = await this.fetchWithAuth(url);
|
|
112
|
+
return response.json();
|
|
113
|
+
}
|
|
114
|
+
async updatePageContent(folderId, pageId, payload) {
|
|
115
|
+
const baseUrl = this.config.api_url.replace(/\/api\/1\.0\/?$/, '');
|
|
116
|
+
const url = `${baseUrl}/api/2.0/domains/id/${folderId}/page_content/id/${pageId}/`;
|
|
117
|
+
const response = await this.fetchWithAuth(url, {
|
|
118
|
+
method: 'PUT',
|
|
119
|
+
headers: { 'Content-Type': 'application/json' },
|
|
120
|
+
body: JSON.stringify(payload),
|
|
121
|
+
});
|
|
122
|
+
return response.json();
|
|
123
|
+
}
|
|
124
|
+
async createPage(folderId, pageName, description) {
|
|
125
|
+
const url = `${this.config.api_url}/domains/${folderId}/pages/`;
|
|
126
|
+
const response = await this.fetchWithAuth(url, {
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers: { 'Content-Type': 'application/json' },
|
|
129
|
+
body: JSON.stringify({
|
|
130
|
+
name: pageName,
|
|
131
|
+
description: description ?? '',
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
return response.json();
|
|
135
|
+
}
|
|
136
|
+
isAuthenticated() {
|
|
137
|
+
return this.tokens != null;
|
|
138
|
+
}
|
|
139
|
+
async fetchWithAuth(url, options = {}) {
|
|
140
|
+
if (!this.tokens?.access_token) {
|
|
141
|
+
throw new Error('Not authenticated. Please login first.');
|
|
142
|
+
}
|
|
143
|
+
const headers = new Headers(options.headers);
|
|
144
|
+
headers.set('Authorization', `Bearer ${this.tokens.access_token}`);
|
|
145
|
+
let response = await fetch(url, { ...options, headers });
|
|
146
|
+
if (response.status === 401) {
|
|
147
|
+
await this.refreshToken();
|
|
148
|
+
headers.set('Authorization', `Bearer ${this.tokens.access_token}`);
|
|
149
|
+
response = await fetch(url, { ...options, headers });
|
|
150
|
+
}
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
const errorData = await response.json().catch(() => ({}));
|
|
153
|
+
const message = errorData.detail || errorData.error || response.statusText;
|
|
154
|
+
throw new Error(message);
|
|
155
|
+
}
|
|
156
|
+
return response;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Converts per-cell data (array of rows, each cell being { value, formatted_value, style })
|
|
161
|
+
* into the official ipushpull page content format with deduplicated styles.
|
|
162
|
+
*/
|
|
163
|
+
export function buildPageContentPayload(cellData) {
|
|
164
|
+
const values = [];
|
|
165
|
+
const formattedValues = [];
|
|
166
|
+
const uniqueStyles = [];
|
|
167
|
+
const cellStyles = [];
|
|
168
|
+
const styleIndex = new Map();
|
|
169
|
+
for (const row of cellData) {
|
|
170
|
+
const rowValues = [];
|
|
171
|
+
const rowFormattedValues = [];
|
|
172
|
+
const rowStyleIndices = [];
|
|
173
|
+
for (const cell of row) {
|
|
174
|
+
rowValues.push(cell.value);
|
|
175
|
+
rowFormattedValues.push(cell.formatted_value);
|
|
176
|
+
const styleKey = JSON.stringify(cell.style);
|
|
177
|
+
let idx = styleIndex.get(styleKey);
|
|
178
|
+
if (idx === undefined) {
|
|
179
|
+
idx = uniqueStyles.length;
|
|
180
|
+
uniqueStyles.push(cell.style);
|
|
181
|
+
styleIndex.set(styleKey, idx);
|
|
182
|
+
}
|
|
183
|
+
rowStyleIndices.push(idx);
|
|
184
|
+
}
|
|
185
|
+
values.push(rowValues);
|
|
186
|
+
formattedValues.push(rowFormattedValues);
|
|
187
|
+
cellStyles.push(rowStyleIndices);
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
content: {
|
|
191
|
+
values,
|
|
192
|
+
formatted_values: formattedValues,
|
|
193
|
+
unique_styles: uniqueStyles,
|
|
194
|
+
cell_styles: cellStyles,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { IPushPullClient, buildPageContentPayload } from './IPushPullClient';
|
|
2
|
+
export { getThemeStyles } from './themes';
|
|
3
|
+
export type { IPushPullTheme, IPushPullThemeStyles } from './themes';
|
|
4
|
+
export type { IPushPullClientConfig, IPushPullTokens, IPushPullPageAccessInfo, IPushPullDomainAccessInfo, IPushPullCellStyle, IPushPullPageContentPayload, IPushPullPageContentResponse, } from './types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IPushPullCellStyle } from './types';
|
|
2
|
+
export type IPushPullTheme = 'lightTheme' | 'darkTheme';
|
|
3
|
+
export interface IPushPullThemeStyles {
|
|
4
|
+
headerStyle: IPushPullCellStyle;
|
|
5
|
+
rowStyle: IPushPullCellStyle;
|
|
6
|
+
altRowStyle: IPushPullCellStyle;
|
|
7
|
+
}
|
|
8
|
+
export declare function getThemeStyles(theme: IPushPullTheme): IPushPullThemeStyles;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
const lightTheme = {
|
|
2
|
+
headerStyle: {
|
|
3
|
+
'background-color': '4a86c8',
|
|
4
|
+
color: 'FFFFFF',
|
|
5
|
+
'font-family': 'Calibri',
|
|
6
|
+
'font-size': '12pt',
|
|
7
|
+
'font-style': 'normal',
|
|
8
|
+
'font-weight': 'bold',
|
|
9
|
+
'text-align': 'center',
|
|
10
|
+
'vertical-align': 'middle',
|
|
11
|
+
'text-wrap': 'normal',
|
|
12
|
+
'white-space': 'nowrap',
|
|
13
|
+
'word-wrap': 'normal',
|
|
14
|
+
height: '24px',
|
|
15
|
+
bbc: 'dae1e7',
|
|
16
|
+
bbs: 'solid',
|
|
17
|
+
bbw: 'thin',
|
|
18
|
+
lbc: 'dae1e7',
|
|
19
|
+
lbs: 'solid',
|
|
20
|
+
lbw: 'thin',
|
|
21
|
+
rbc: 'dae1e7',
|
|
22
|
+
rbs: 'solid',
|
|
23
|
+
rbw: 'thin',
|
|
24
|
+
tbc: 'dae1e7',
|
|
25
|
+
tbs: 'solid',
|
|
26
|
+
tbw: 'thin',
|
|
27
|
+
},
|
|
28
|
+
rowStyle: {
|
|
29
|
+
'background-color': 'FFFFFF',
|
|
30
|
+
color: '000000',
|
|
31
|
+
'font-family': 'Calibri',
|
|
32
|
+
'font-size': '11pt',
|
|
33
|
+
'font-style': 'normal',
|
|
34
|
+
'font-weight': 'normal',
|
|
35
|
+
'text-align': 'left',
|
|
36
|
+
'vertical-align': 'middle',
|
|
37
|
+
'text-wrap': 'normal',
|
|
38
|
+
height: '20px',
|
|
39
|
+
bbc: 'dae1e7',
|
|
40
|
+
bbs: 'solid',
|
|
41
|
+
bbw: 'thin',
|
|
42
|
+
lbc: 'dae1e7',
|
|
43
|
+
lbs: 'solid',
|
|
44
|
+
lbw: 'thin',
|
|
45
|
+
rbc: 'dae1e7',
|
|
46
|
+
rbs: 'solid',
|
|
47
|
+
rbw: 'thin',
|
|
48
|
+
tbc: 'dae1e7',
|
|
49
|
+
tbs: 'solid',
|
|
50
|
+
tbw: 'thin',
|
|
51
|
+
},
|
|
52
|
+
altRowStyle: {
|
|
53
|
+
'background-color': 'f5f7f7',
|
|
54
|
+
color: '000000',
|
|
55
|
+
'font-family': 'Calibri',
|
|
56
|
+
'font-size': '11pt',
|
|
57
|
+
'font-style': 'normal',
|
|
58
|
+
'font-weight': 'normal',
|
|
59
|
+
'text-align': 'left',
|
|
60
|
+
'vertical-align': 'middle',
|
|
61
|
+
'text-wrap': 'normal',
|
|
62
|
+
height: '20px',
|
|
63
|
+
bbc: 'dae1e7',
|
|
64
|
+
bbs: 'solid',
|
|
65
|
+
bbw: 'thin',
|
|
66
|
+
lbc: 'dae1e7',
|
|
67
|
+
lbs: 'solid',
|
|
68
|
+
lbw: 'thin',
|
|
69
|
+
rbc: 'dae1e7',
|
|
70
|
+
rbs: 'solid',
|
|
71
|
+
rbw: 'thin',
|
|
72
|
+
tbc: 'dae1e7',
|
|
73
|
+
tbs: 'solid',
|
|
74
|
+
tbw: 'thin',
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
const darkTheme = {
|
|
78
|
+
headerStyle: {
|
|
79
|
+
'background-color': '2d3748',
|
|
80
|
+
color: 'FFFFFF',
|
|
81
|
+
'font-family': 'Calibri',
|
|
82
|
+
'font-size': '12pt',
|
|
83
|
+
'font-style': 'normal',
|
|
84
|
+
'font-weight': 'bold',
|
|
85
|
+
'text-align': 'center',
|
|
86
|
+
'vertical-align': 'middle',
|
|
87
|
+
'text-wrap': 'normal',
|
|
88
|
+
'white-space': 'nowrap',
|
|
89
|
+
'word-wrap': 'normal',
|
|
90
|
+
height: '24px',
|
|
91
|
+
bbc: '4a5568',
|
|
92
|
+
bbs: 'solid',
|
|
93
|
+
bbw: 'thin',
|
|
94
|
+
lbc: '4a5568',
|
|
95
|
+
lbs: 'solid',
|
|
96
|
+
lbw: 'thin',
|
|
97
|
+
rbc: '4a5568',
|
|
98
|
+
rbs: 'solid',
|
|
99
|
+
rbw: 'thin',
|
|
100
|
+
tbc: '4a5568',
|
|
101
|
+
tbs: 'solid',
|
|
102
|
+
tbw: 'thin',
|
|
103
|
+
},
|
|
104
|
+
rowStyle: {
|
|
105
|
+
'background-color': '1a202c',
|
|
106
|
+
color: 'e2e8f0',
|
|
107
|
+
'font-family': 'Calibri',
|
|
108
|
+
'font-size': '11pt',
|
|
109
|
+
'font-style': 'normal',
|
|
110
|
+
'font-weight': 'normal',
|
|
111
|
+
'text-align': 'left',
|
|
112
|
+
'vertical-align': 'middle',
|
|
113
|
+
'text-wrap': 'normal',
|
|
114
|
+
height: '20px',
|
|
115
|
+
bbc: '4a5568',
|
|
116
|
+
bbs: 'solid',
|
|
117
|
+
bbw: 'thin',
|
|
118
|
+
lbc: '4a5568',
|
|
119
|
+
lbs: 'solid',
|
|
120
|
+
lbw: 'thin',
|
|
121
|
+
rbc: '4a5568',
|
|
122
|
+
rbs: 'solid',
|
|
123
|
+
rbw: 'thin',
|
|
124
|
+
tbc: '4a5568',
|
|
125
|
+
tbs: 'solid',
|
|
126
|
+
tbw: 'thin',
|
|
127
|
+
},
|
|
128
|
+
altRowStyle: {
|
|
129
|
+
'background-color': '2d3748',
|
|
130
|
+
color: 'e2e8f0',
|
|
131
|
+
'font-family': 'Calibri',
|
|
132
|
+
'font-size': '11pt',
|
|
133
|
+
'font-style': 'normal',
|
|
134
|
+
'font-weight': 'normal',
|
|
135
|
+
'text-align': 'left',
|
|
136
|
+
'vertical-align': 'middle',
|
|
137
|
+
'text-wrap': 'normal',
|
|
138
|
+
height: '20px',
|
|
139
|
+
bbc: '4a5568',
|
|
140
|
+
bbs: 'solid',
|
|
141
|
+
bbw: 'thin',
|
|
142
|
+
lbc: '4a5568',
|
|
143
|
+
lbs: 'solid',
|
|
144
|
+
lbw: 'thin',
|
|
145
|
+
rbc: '4a5568',
|
|
146
|
+
rbs: 'solid',
|
|
147
|
+
rbw: 'thin',
|
|
148
|
+
tbc: '4a5568',
|
|
149
|
+
tbs: 'solid',
|
|
150
|
+
tbw: 'thin',
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
const themes = {
|
|
154
|
+
lightTheme,
|
|
155
|
+
darkTheme,
|
|
156
|
+
};
|
|
157
|
+
export function getThemeStyles(theme) {
|
|
158
|
+
return themes[theme];
|
|
159
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface IPushPullClientConfig {
|
|
2
|
+
api_url: string;
|
|
3
|
+
api_key: string;
|
|
4
|
+
api_secret: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IPushPullTokens {
|
|
7
|
+
access_token: string;
|
|
8
|
+
refresh_token: string;
|
|
9
|
+
expires_in: number;
|
|
10
|
+
token_type: string;
|
|
11
|
+
scope: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IPushPullPageAccessInfo {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
special_page_type: number;
|
|
17
|
+
write_access: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface IPushPullDomainAccessInfo {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
pages: IPushPullPageAccessInfo[];
|
|
23
|
+
}
|
|
24
|
+
export interface IPushPullCellStyle {
|
|
25
|
+
'background-color'?: string;
|
|
26
|
+
color?: string;
|
|
27
|
+
'font-family'?: string;
|
|
28
|
+
'font-size'?: string;
|
|
29
|
+
'font-style'?: string;
|
|
30
|
+
'font-weight'?: string;
|
|
31
|
+
'text-align'?: string;
|
|
32
|
+
'vertical-align'?: string;
|
|
33
|
+
'white-space'?: string;
|
|
34
|
+
'text-wrap'?: string;
|
|
35
|
+
'word-wrap'?: string;
|
|
36
|
+
'number-format'?: string;
|
|
37
|
+
height?: string;
|
|
38
|
+
width?: string;
|
|
39
|
+
bbc?: string;
|
|
40
|
+
bbs?: string;
|
|
41
|
+
bbw?: string;
|
|
42
|
+
lbc?: string;
|
|
43
|
+
lbs?: string;
|
|
44
|
+
lbw?: string;
|
|
45
|
+
rbc?: string;
|
|
46
|
+
rbs?: string;
|
|
47
|
+
rbw?: string;
|
|
48
|
+
tbc?: string;
|
|
49
|
+
tbs?: string;
|
|
50
|
+
tbw?: string;
|
|
51
|
+
[key: string]: string | undefined;
|
|
52
|
+
}
|
|
53
|
+
export interface IPushPullPageContentPayload {
|
|
54
|
+
content: {
|
|
55
|
+
values: any[][];
|
|
56
|
+
formatted_values: any[][];
|
|
57
|
+
unique_styles: IPushPullCellStyle[];
|
|
58
|
+
cell_styles: number[][];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface IPushPullPageContentResponse {
|
|
62
|
+
push_interval?: number;
|
|
63
|
+
pull_interval?: number;
|
|
64
|
+
encryption_type_to_use?: number;
|
|
65
|
+
encryption_key_to_use?: string;
|
|
66
|
+
seq_no?: number;
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IAdaptable } from '@adaptabletools/adaptable/src/AdaptableInterfaces/IAdaptable';
|
|
2
|
-
import { IPPStyle } from '@adaptabletools/adaptable/src/Utilities/Interface/IPPStyle';
|
|
3
|
-
import { IPushPullService } from './Interface/IPushPullService';
|
|
4
|
-
import { IPushPullDomain } from '@adaptabletools/adaptable/src/AdaptableState/InternalState';
|
|
5
|
-
export declare enum ServiceStatus {
|
|
6
|
-
Unknown = "Unknown",
|
|
7
|
-
Disconnected = "Disconnected",
|
|
8
|
-
Connected = "Connected",
|
|
9
|
-
Error = "Error"
|
|
10
|
-
}
|
|
11
|
-
export declare class PushPullService implements IPushPullService {
|
|
12
|
-
adaptable: IAdaptable;
|
|
13
|
-
private ppInstance;
|
|
14
|
-
private pages;
|
|
15
|
-
constructor(adaptable: IAdaptable);
|
|
16
|
-
getIPushPullStatus(): ServiceStatus;
|
|
17
|
-
private getIPPApi;
|
|
18
|
-
login(login: string, password: string): Promise<any>;
|
|
19
|
-
getDomainPages(): Promise<IPushPullDomain[]>;
|
|
20
|
-
loadPage(folderIPP: string, pageIPP: string): Promise<void>;
|
|
21
|
-
unloadPage(page: string): void;
|
|
22
|
-
addNewPage(folderId: number, page: string): Promise<any>;
|
|
23
|
-
pushData(page: string, data: any[]): Promise<void>;
|
|
24
|
-
getCurrentIPPStyle(): IPPStyle;
|
|
25
|
-
getDefaultIPPStyle(): IPPStyle;
|
|
26
|
-
}
|