retoolrpc 0.1.5 → 0.1.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.
- package/dist/cjs/example.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/rpc-81f0f4ff.js +542 -0
- package/dist/cjs/rpc-ee7491ce.js +542 -0
- package/dist/example.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/package.json +1 -1
- package/dist/rpc-515f6802.mjs +535 -0
- package/dist/rpc-833f9d48.mjs +535 -0
- package/dist/src/types.d.ts +15 -4
- package/dist/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/rpc.spec.ts +37 -3
- package/src/rpc.ts +5 -3
- package/src/types.ts +19 -5
- package/src/utils/polling.ts +2 -1
- package/src/version.ts +1 -1
- package/tsconfig.json +2 -1
package/src/types.ts
CHANGED
|
@@ -36,11 +36,17 @@ export type ArgumentType = 'string' | 'boolean' | 'number' | 'dict' | 'json'
|
|
|
36
36
|
export type Argument = {
|
|
37
37
|
/** The type of the argument. */
|
|
38
38
|
type: ArgumentType
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Specifies whether the argument is expected to be an array.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
40
43
|
array?: boolean
|
|
41
44
|
/** The description of the argument. */
|
|
42
45
|
description?: string
|
|
43
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Specifies whether the argument is required.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
44
50
|
required?: boolean
|
|
45
51
|
}
|
|
46
52
|
|
|
@@ -68,10 +74,18 @@ export type TransformedArgument<TArg extends Argument> = TArg['array'] extends t
|
|
|
68
74
|
? Array<ArgumentTypeMap<TArg>>
|
|
69
75
|
: ArgumentTypeMap<TArg>
|
|
70
76
|
|
|
77
|
+
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
|
|
78
|
+
type GetOptionalArgs<TArgs extends Arguments> = {
|
|
79
|
+
[TArg in keyof TArgs]: TArgs[TArg]['required'] extends true ? never : TArg
|
|
80
|
+
}[keyof TArgs]
|
|
81
|
+
|
|
71
82
|
/** Represents a map of argument names to argument types. */
|
|
72
|
-
export type TransformedArguments<TArgs extends Arguments> =
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
export type TransformedArguments<TArgs extends Arguments> = PartialBy<
|
|
84
|
+
{
|
|
85
|
+
[TArg in keyof TArgs]: TransformedArgument<TArgs[TArg]>
|
|
86
|
+
},
|
|
87
|
+
GetOptionalArgs<TArgs>
|
|
88
|
+
>
|
|
75
89
|
|
|
76
90
|
/** Represents the specification for registering a Retool function. */
|
|
77
91
|
export type RegisterFunctionSpec<TArgs extends Arguments, TReturn> = {
|
package/src/utils/polling.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const RetoolRPCVersion = '0.1.
|
|
1
|
+
export const RetoolRPCVersion = '0.1.6'
|
package/tsconfig.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"skipLibCheck": true,
|
|
13
13
|
"esModuleInterop": true,
|
|
14
14
|
"allowSyntheticDefaultImports": true,
|
|
15
|
+
"lib": ["ESNext"]
|
|
15
16
|
},
|
|
16
17
|
"ts-node": {
|
|
17
18
|
// these options are overrides used only by ts-node
|
|
@@ -19,5 +20,5 @@
|
|
|
19
20
|
"compilerOptions": {
|
|
20
21
|
"module": "commonjs"
|
|
21
22
|
}
|
|
22
|
-
}
|
|
23
|
+
}
|
|
23
24
|
}
|