polyapi 0.7.1 → 0.7.6

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.
@@ -91,7 +91,7 @@ const getVariableHandlers = (clientID, getSocket, getApiKey) => {
91
91
  },
92
92
  inject: (path) => {
93
93
 
94
- if (typeof path !== 'undefined' || secret) {
94
+ if (typeof path !== 'undefined') {
95
95
  return {
96
96
  type: 'PolyVariable',
97
97
  id,
@@ -99,9 +99,13 @@ const getVariableHandlers = (clientID, getSocket, getApiKey) => {
99
99
  };
100
100
  }
101
101
 
102
- return new Proxy({}, {
102
+ return new Proxy({
103
+ [parts]: [],
104
+ [pathState]: getStringPath([[]])[0]
105
+ }, {
103
106
  get(target, prop) {
104
- const pathParts = target[parts] || [];
107
+
108
+ const pathParts = target[parts] ? [...target[parts]] : [];
105
109
 
106
110
  if (prop === 'toJSON') {
107
111
  return () => ({
@@ -140,8 +144,10 @@ const getVariableHandlers = (clientID, getSocket, getApiKey) => {
140
144
  }
141
145
 
142
146
  if (prop.match(/\d+/)) {
143
-
144
- if (paths.find(currentPath => {
147
+
148
+ if (secret) {
149
+ pathParts.push(Number(prop));
150
+ } else if (paths.find(currentPath => {
145
151
  const arrContextPath = contextPath.split('.');
146
152
  arrContextPath.pop();
147
153