polyapi 0.1.64 → 0.1.66
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.
|
@@ -21,7 +21,7 @@ const getVariableHandlers = (clientID, getSocket) => {
|
|
|
21
21
|
set(variableHandlers, path, {
|
|
22
22
|
get: () => {
|
|
23
23
|
if (secret) {
|
|
24
|
-
throw new Error('Cannot access secret variable from client. Use .
|
|
24
|
+
throw new Error('Cannot access secret variable from client. Use .inject() instead within Poly function.');
|
|
25
25
|
} else {
|
|
26
26
|
return axios.get(
|
|
27
27
|
`/variables/${id}/value`
|
|
@@ -68,7 +68,7 @@ const getVariableHandlers = (clientID, getSocket) => {
|
|
|
68
68
|
|
|
69
69
|
return unregisterEventHandler;
|
|
70
70
|
},
|
|
71
|
-
|
|
71
|
+
inject: (path) => ({
|
|
72
72
|
type: 'PolyVariable',
|
|
73
73
|
id,
|
|
74
74
|
path
|
|
@@ -38,11 +38,11 @@ declare module vari {
|
|
|
38
38
|
* Gets variable data.
|
|
39
39
|
* This is intended to be used in Poly functions, so the variable values are resolved on the server
|
|
40
40
|
* without fetching them from the client.
|
|
41
|
-
* @param path The JSON path to the property within the value, e.g. `vari.products.shop.
|
|
41
|
+
* @param path The JSON path to the property within the value, e.g. `vari.products.shop.inject('id')`
|
|
42
42
|
* @example
|
|
43
|
-
* await poly.products.addItem(vari.products.shopId.
|
|
43
|
+
* await poly.products.addItem(vari.products.shopId.inject(), 'Toy car', 1)
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
inject: (path?: string) => {{#if isObjectType}}any{{else}}{{{type}}}{{/if}};
|
|
46
46
|
}
|
|
47
47
|
{{/each}}
|
|
48
48
|
get: () => Promise<{{interfaceName}}Values>;
|