epicenter-libs 3.33.0 → 3.34.1
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/CHANGELOG.md +17 -0
- package/dist/browser/epicenter.js +105 -2
- package/dist/browser/epicenter.js.map +1 -1
- package/dist/cjs/epicenter.js +105 -2
- package/dist/cjs/epicenter.js.map +1 -1
- package/dist/epicenter.js +105 -2
- package/dist/epicenter.js.map +1 -1
- package/dist/epicenter.min.js +1 -1
- package/dist/epicenter.min.js.map +1 -1
- package/dist/module/epicenter.js +105 -2
- package/dist/module/epicenter.js.map +1 -1
- package/dist/types/adapters/chat.d.ts +63 -0
- package/package.json +1 -1
- package/src/adapters/chat.ts +95 -0
- package/src/utils/identification.ts +4 -0
- package/dist/test/_virtual/runtime.js +0 -3
- package/dist/test/_virtual/runtime2.js +0 -3
- package/dist/test/adapters/account.js +0 -169
- package/dist/test/adapters/admin.js +0 -53
- package/dist/test/adapters/asset.js +0 -425
- package/dist/test/adapters/authentication.js +0 -349
- package/dist/test/adapters/channel.js +0 -201
- package/dist/test/adapters/chat.js +0 -199
- package/dist/test/adapters/cometd.js +0 -514
- package/dist/test/adapters/consensus.js +0 -484
- package/dist/test/adapters/daily.js +0 -244
- package/dist/test/adapters/email.js +0 -179
- package/dist/test/adapters/episode.js +0 -175
- package/dist/test/adapters/group.js +0 -655
- package/dist/test/adapters/leaderboard.js +0 -162
- package/dist/test/adapters/matchmaker.js +0 -159
- package/dist/test/adapters/presence.js +0 -85
- package/dist/test/adapters/project.js +0 -94
- package/dist/test/adapters/recaptcha.js +0 -24
- package/dist/test/adapters/run.js +0 -1008
- package/dist/test/adapters/somebody.js +0 -154
- package/dist/test/adapters/task.js +0 -192
- package/dist/test/adapters/time.js +0 -28
- package/dist/test/adapters/user.js +0 -105
- package/dist/test/adapters/vault.js +0 -403
- package/dist/test/adapters/video.js +0 -249
- package/dist/test/adapters/vonage.js +0 -130
- package/dist/test/adapters/wallet.js +0 -130
- package/dist/test/adapters/world.js +0 -507
- package/dist/test/apis/video.js +0 -294
- package/dist/test/apis/vonage.js +0 -121
- package/dist/test/epicenter.js +0 -121
- package/dist/test/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -12
- package/dist/test/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -14
- package/dist/test/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -9
- package/dist/test/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -11
- package/dist/test/node_modules/cometd/AckExtension.js +0 -91
- package/dist/test/node_modules/cometd/CallbackPollingTransport.js +0 -148
- package/dist/test/node_modules/cometd/Client.js +0 -2160
- package/dist/test/node_modules/cometd/Extension.js +0 -47
- package/dist/test/node_modules/cometd/LongPollingTransport.js +0 -135
- package/dist/test/node_modules/cometd/ReloadExtension.js +0 -214
- package/dist/test/node_modules/cometd/RequestTransport.js +0 -252
- package/dist/test/node_modules/cometd/Transport.js +0 -167
- package/dist/test/node_modules/cometd/TransportRegistry.js +0 -107
- package/dist/test/node_modules/cometd/WebSocketTransport.js +0 -384
- package/dist/test/node_modules/cometd/cometd.js +0 -9
- package/dist/test/node_modules/regenerator-runtime/runtime.js +0 -773
- package/dist/test/utilities.js +0 -17
- package/dist/test/utils/config.js +0 -189
- package/dist/test/utils/constants.js +0 -293
- package/dist/test/utils/cookies.js +0 -75
- package/dist/test/utils/error-manager.js +0 -57
- package/dist/test/utils/error.js +0 -12
- package/dist/test/utils/fault.js +0 -34
- package/dist/test/utils/filter-parser.js +0 -68
- package/dist/test/utils/helpers.js +0 -9
- package/dist/test/utils/identification.js +0 -161
- package/dist/test/utils/result.js +0 -20
- package/dist/test/utils/router.js +0 -551
- package/dist/test/utils/store.js +0 -79
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enhanced filter functionality for epicenter-libs
|
|
3
|
-
* Supports backwards-compatible string arrays, raw filter strings,
|
|
4
|
-
* and object-based filter groups with arbitrary nesting
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Recursively parses a FilterGroup object into a boolean filter string
|
|
9
|
-
* @param group - FilterGroup object to parse
|
|
10
|
-
* @returns Boolean filter string representation
|
|
11
|
-
*/
|
|
12
|
-
function parseFilterGroup(group) {
|
|
13
|
-
if (!group.filters || group.filters.length === 0) {
|
|
14
|
-
return '';
|
|
15
|
-
}
|
|
16
|
-
const parsedFilters = group.filters.map(filter => {
|
|
17
|
-
if (typeof filter === 'string') {
|
|
18
|
-
return filter;
|
|
19
|
-
}
|
|
20
|
-
return parseFilterGroup(filter);
|
|
21
|
-
}).filter(filter => filter.length > 0);
|
|
22
|
-
if (parsedFilters.length === 0) {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
if (!group.type || !['and', 'or', 'taxonomy'].includes(group.type)) {
|
|
26
|
-
throw new Error(`Invalid or missing filter group type: ${group.type || 'undefined'}`);
|
|
27
|
-
}
|
|
28
|
-
const joinedFilters = parsedFilters.join(';');
|
|
29
|
-
if (parsedFilters.length === 1) {
|
|
30
|
-
return joinedFilters;
|
|
31
|
-
}
|
|
32
|
-
switch (group.type) {
|
|
33
|
-
case 'and':
|
|
34
|
-
return `(${joinedFilters})`;
|
|
35
|
-
case 'or':
|
|
36
|
-
return `[${joinedFilters}]`;
|
|
37
|
-
case 'taxonomy':
|
|
38
|
-
return `{${joinedFilters}}`;
|
|
39
|
-
default:
|
|
40
|
-
throw new Error(`Unexpected filter group type: ${group.type}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Parses various filter input formats into the platform's expected filter string format
|
|
46
|
-
* @param filterInput - Array of strings, filter string, or FilterGroup object
|
|
47
|
-
* @returns Platform-compatible filter string or undefined if no filters
|
|
48
|
-
*/
|
|
49
|
-
function parseFilterInput(filterInput) {
|
|
50
|
-
if (!filterInput) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Handle string array (backwards compatibility)
|
|
55
|
-
if (Array.isArray(filterInput)) {
|
|
56
|
-
return filterInput.length > 0 ? filterInput.join(';') : undefined;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Handle raw string (pass through - allows advanced users to write boolean syntax directly)
|
|
60
|
-
if (typeof filterInput === 'string') {
|
|
61
|
-
return filterInput || undefined;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Handle FilterGroup object
|
|
65
|
-
return parseFilterGroup(filterInput) || undefined;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { parseFilterInput };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-new-func */
|
|
2
|
-
const isBrowser = new Function('try {return this===window;}catch(e){ return false;}');
|
|
3
|
-
const isNode = new Function('try {return (typeof process !== "undefined") && (typeof process.versions.node !== "undefined")}catch(e){return false;}');
|
|
4
|
-
const prefix = (pre, str) => str.startsWith(pre) ? str : `${pre}${str}`;
|
|
5
|
-
|
|
6
|
-
// Escape string for safe use in RegExp
|
|
7
|
-
const escapeRegExp = str => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
8
|
-
|
|
9
|
-
export { escapeRegExp, isBrowser, isNode, prefix };
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '../node_modules/@babel/runtime/helpers/esm/defineProperty.js';
|
|
2
|
-
import EpicenterError from './error.js';
|
|
3
|
-
import cookies from './cookies.js';
|
|
4
|
-
import { NodeStore, CookieStore, SessionStore } from './store.js';
|
|
5
|
-
import { BROWSER_STORAGE_TYPE } from './constants.js';
|
|
6
|
-
import { isNode } from './helpers.js';
|
|
7
|
-
import config from './config.js';
|
|
8
|
-
|
|
9
|
-
const {
|
|
10
|
-
COOKIE,
|
|
11
|
-
SESSION
|
|
12
|
-
} = BROWSER_STORAGE_TYPE;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* User session information returned from authentication endpoints.
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Field dependencies:
|
|
19
|
-
* - If `multipleGroups` is true, the user has access to multiple groups and
|
|
20
|
-
* `projectShortName`, `projectKey`, `groupKey`, `groupName`, and `groupRole` will be undefined
|
|
21
|
-
* - If `multipleGroups` is false or undefined, the user is scoped to a single group and
|
|
22
|
-
* `projectShortName`, `projectKey`, `groupKey`, `groupName`, and `groupRole` should be present
|
|
23
|
-
* - `groupKey` and `groupName` are present together (both or neither)
|
|
24
|
-
* - `projectShortName` and `projectKey` are present together (both or neither)
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Admin session information returned from authentication endpoints.
|
|
29
|
-
*
|
|
30
|
-
* Admin sessions can have either:
|
|
31
|
-
* - A global role (SYSTEM or MONITOR) for system-wide access
|
|
32
|
-
* - Team-specific roles (teamAccountRole and/or teamProjectRole) for account/project access
|
|
33
|
-
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* Field dependencies:
|
|
36
|
-
* - If `globalRole` is present, the admin has system-wide access
|
|
37
|
-
* - If `teamAccountRole` is present, `teamAccountShortName` should also be present
|
|
38
|
-
* - If `teamProjectRole` is present, `projectShortName` and `projectKey` should also be present
|
|
39
|
-
* - Personal accounts: admins always have OWNER role for their personal account
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
const SESSION_KEY = 'com.forio.epicenter.session';
|
|
43
|
-
const EPI_SSO_KEY = 'epicenter.v3.sso';
|
|
44
|
-
class Identification {
|
|
45
|
-
constructor(storeType) {
|
|
46
|
-
_defineProperty(this, "type", void 0);
|
|
47
|
-
if (storeType !== COOKIE && storeType !== SESSION) {
|
|
48
|
-
throw new EpicenterError(`Invalid Storage Type: "${String(storeType)}", please use "${String(COOKIE)}" or "${String(SESSION)}".`);
|
|
49
|
-
}
|
|
50
|
-
this.type = storeType;
|
|
51
|
-
this.consumeSSO();
|
|
52
|
-
}
|
|
53
|
-
get session() {
|
|
54
|
-
const Store = this.getStore();
|
|
55
|
-
return new Store().getItem(SESSION_KEY);
|
|
56
|
-
}
|
|
57
|
-
set session(session) {
|
|
58
|
-
const Store = this.getStore();
|
|
59
|
-
const options = this.getStoreOptions(session);
|
|
60
|
-
if (session) {
|
|
61
|
-
new Store(options).setItem(SESSION_KEY, session);
|
|
62
|
-
} else if (this.session) {
|
|
63
|
-
new Store(options).removeItem(SESSION_KEY);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
setSessionWithOptions(session, forcePathInclusion) {
|
|
67
|
-
const Store = this.getStore();
|
|
68
|
-
const options = this.getStoreOptions(session, forcePathInclusion);
|
|
69
|
-
if (session) {
|
|
70
|
-
new Store(options).setItem(SESSION_KEY, session);
|
|
71
|
-
} else if (this.session) {
|
|
72
|
-
new Store(options).removeItem(SESSION_KEY);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
getStore() {
|
|
76
|
-
if (isNode()) return NodeStore;
|
|
77
|
-
switch (this.type) {
|
|
78
|
-
case SESSION:
|
|
79
|
-
return SessionStore;
|
|
80
|
-
case COOKIE:
|
|
81
|
-
default:
|
|
82
|
-
return CookieStore;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/* Generates the appropriate path for storing your session (applicable only to cookies) */
|
|
87
|
-
getStoreOptions(session, forcePathInclusion) {
|
|
88
|
-
const mySession = session || this.session;
|
|
89
|
-
if (!mySession || isNode()) return '';
|
|
90
|
-
const {
|
|
91
|
-
objectType
|
|
92
|
-
} = mySession;
|
|
93
|
-
const isLocal = config.isLocal();
|
|
94
|
-
const base = {
|
|
95
|
-
samesite: isLocal ? 'lax' : 'none',
|
|
96
|
-
secure: !isLocal
|
|
97
|
-
};
|
|
98
|
-
const isCustomDomain = !isLocal && window.location.pathname.split('/')[1] !== 'app';
|
|
99
|
-
const isEpicenterDomain = !isLocal && !isCustomDomain;
|
|
100
|
-
|
|
101
|
-
/* forcePathInclusion can explicitly override behavior:
|
|
102
|
-
* - true: force scoped path (even on custom domains)
|
|
103
|
-
* - false: force root path (even for users/admins on Epicenter domain)
|
|
104
|
-
* - undefined: use defaults (scoped for users and admins on Epicenter domain, root for custom domains) */
|
|
105
|
-
if (forcePathInclusion === false) {
|
|
106
|
-
return {
|
|
107
|
-
...base,
|
|
108
|
-
path: '/'
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
if (forcePathInclusion === true || isEpicenterDomain && (objectType === 'user' || objectType === 'admin')) {
|
|
112
|
-
const {
|
|
113
|
-
accountShortName,
|
|
114
|
-
projectShortName
|
|
115
|
-
} = config;
|
|
116
|
-
const account = accountShortName ? `/${accountShortName}` : '';
|
|
117
|
-
const project = account && projectShortName ? `/${projectShortName}` : '';
|
|
118
|
-
return {
|
|
119
|
-
...base,
|
|
120
|
-
path: `/app${account}${project}`
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/* Custom domains (when forcePathInclusion is not true) get the root path */
|
|
125
|
-
return {
|
|
126
|
-
...base,
|
|
127
|
-
path: '/'
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
consumeSSO() {
|
|
131
|
-
if (isNode()) return;
|
|
132
|
-
|
|
133
|
-
// Occasionally, the backend might already wrap the cookie in quotes, have to handle
|
|
134
|
-
// both cases, where we get string serialized content w/ quotes and without
|
|
135
|
-
let cookieContent = cookies.getItem(EPI_SSO_KEY);
|
|
136
|
-
if (typeof cookieContent === 'string' && cookieContent.charAt(0) !== '"' && cookieContent.charAt(cookieContent.length - 1) !== '"') {
|
|
137
|
-
cookieContent = `"${cookieContent}"`;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/* Double parse here b/c the backend serializes it as a string; the first parse
|
|
141
|
-
* converts it into a json string, the second parse converts the json string into
|
|
142
|
-
* json. Yes, it's weird, no, we can't change it (unless we want to rewrite
|
|
143
|
-
* Interface Builder code to accommodate) */
|
|
144
|
-
const session = JSON.parse(JSON.parse(cookieContent !== null && cookieContent !== void 0 ? cookieContent : '"null"'));
|
|
145
|
-
if (session) {
|
|
146
|
-
const {
|
|
147
|
-
accountShortName,
|
|
148
|
-
projectShortName
|
|
149
|
-
} = session;
|
|
150
|
-
const account = accountShortName ? `/${accountShortName}` : '';
|
|
151
|
-
const project = account && projectShortName ? `/${projectShortName}` : '';
|
|
152
|
-
this.session = session;
|
|
153
|
-
cookies.removeItem(EPI_SSO_KEY, {
|
|
154
|
-
path: `/app${account}${project}`
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
const identification = new Identification(COOKIE);
|
|
160
|
-
|
|
161
|
-
export { identification as default };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import _defineProperty from '../node_modules/@babel/runtime/helpers/esm/defineProperty.js';
|
|
2
|
-
|
|
3
|
-
/* For network call responses */
|
|
4
|
-
class Result {
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
constructor(body, response) {
|
|
7
|
-
_defineProperty(this, "status", void 0);
|
|
8
|
-
_defineProperty(this, "headers", void 0);
|
|
9
|
-
_defineProperty(this, "body", void 0);
|
|
10
|
-
const {
|
|
11
|
-
status,
|
|
12
|
-
headers
|
|
13
|
-
} = response;
|
|
14
|
-
this.status = status;
|
|
15
|
-
this.headers = headers;
|
|
16
|
-
this.body = body;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { Result as default };
|