oc-server 0.0.2-beta.0 → 0.0.2-beta.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/dist/Server.js CHANGED
@@ -16,7 +16,8 @@ class Server {
16
16
  let res;
17
17
  try {
18
18
  if (actionName && this.actions[actionName]) {
19
- res = await this.actions[actionName](params, context);
19
+ const data = params?.data ?? params;
20
+ res = await this.actions[actionName](data, context);
20
21
  }
21
22
  else {
22
23
  res = await this.initial(params, context);
@@ -18,21 +18,12 @@ function getAction(options) {
18
18
  });
19
19
  });
20
20
  }
21
- console.log('HELLO');
22
21
  exports.serverClient = new Proxy({}, {
23
22
  get(_target, prop) {
24
23
  return (data) => {
25
- const componentName = '';
26
- const componentVersion = '';
27
- let url = document
28
- .querySelector(`oc-component[data-name="${componentName}"][data-version="${componentVersion}"]`)
29
- ?.getAttribute('href');
30
- if (!url?.startsWith('http')) {
31
- url = `${window.location.protocol}${url}`;
32
- }
33
- const base = new URL(url);
34
- const baseUrl = base.origin +
35
- base.pathname.replace(new RegExp(`/${componentName}/[\\dx]\.[\\dx]\.[\\dx].*`), '');
24
+ const componentName = 'COMPONENT_NAME';
25
+ const componentVersion = 'COMPONENT_VERSION';
26
+ const baseUrl = window.oc?.renderedComponents?.[componentName]?.baseUrl ?? '/';
36
27
  return getAction({
37
28
  action: prop,
38
29
  baseUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-server",
3
- "version": "0.0.2-beta.0",
3
+ "version": "0.0.2-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",