@pikku/addon-graph 0.0.3 → 0.12.0
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/.pikku/addon/pikku-addon-types.gen.ts +105 -0
- package/.pikku/addon/pikku-package.gen.ts +11 -0
- package/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
- package/.pikku/agent/pikku-agent-types.gen.ts +82 -0
- package/.pikku/channel/pikku-channel-types.gen.ts +177 -0
- package/.pikku/cli/pikku-cli-types.gen.ts +105 -0
- package/.pikku/console/pikku-addon-meta.gen.json +281 -0
- package/.pikku/console/pikku-node-types.gen.ts +8 -0
- package/.pikku/function/pikku-function-types.gen.ts +684 -0
- package/.pikku/function/pikku-functions-meta-verbose.gen.json +660 -0
- package/.pikku/function/pikku-functions-meta.gen.json +450 -0
- package/.pikku/function/pikku-functions-meta.gen.ts +7 -0
- package/.pikku/function/pikku-functions.gen.ts +56 -0
- package/.pikku/http/pikku-http-types.gen.ts +147 -0
- package/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
- package/.pikku/pikku-bootstrap.gen.ts +8 -0
- package/.pikku/pikku-meta-service.gen.ts +10 -0
- package/.pikku/pikku-services.gen.ts +39 -0
- package/.pikku/pikku-types.gen.ts +21 -0
- package/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +488 -0
- package/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +513 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +27 -0
- package/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
- package/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/.pikku/schemas/register.gen.ts +199 -0
- package/.pikku/schemas/schemas/AggregateInput.schema.json +1 -0
- package/.pikku/schemas/schemas/AggregateOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/ChunkInput.schema.json +1 -0
- package/.pikku/schemas/schemas/ChunkOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/CoalesceInput.schema.json +1 -0
- package/.pikku/schemas/schemas/CoalesceOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/CryptoInput.schema.json +1 -0
- package/.pikku/schemas/schemas/CryptoOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/DateTimeInput.schema.json +1 -0
- package/.pikku/schemas/schemas/DateTimeOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/EditFieldsInput.schema.json +1 -0
- package/.pikku/schemas/schemas/EditFieldsOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/FindInput.schema.json +1 -0
- package/.pikku/schemas/schemas/FindOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/GroupByInput.schema.json +1 -0
- package/.pikku/schemas/schemas/GroupByOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/JwtDecodeInput.schema.json +1 -0
- package/.pikku/schemas/schemas/JwtDecodeOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/JwtSignInput.schema.json +1 -0
- package/.pikku/schemas/schemas/JwtSignOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/LimitInput.schema.json +1 -0
- package/.pikku/schemas/schemas/LimitOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/MathInput.schema.json +1 -0
- package/.pikku/schemas/schemas/MathOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/MergeInput.schema.json +1 -0
- package/.pikku/schemas/schemas/MergeOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/OmitInput.schema.json +1 -0
- package/.pikku/schemas/schemas/OmitOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/PickInput.schema.json +1 -0
- package/.pikku/schemas/schemas/PickOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/RemoveDuplicatesInput.schema.json +1 -0
- package/.pikku/schemas/schemas/RemoveDuplicatesOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/RenameKeysInput.schema.json +1 -0
- package/.pikku/schemas/schemas/RenameKeysOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/ReverseInput.schema.json +1 -0
- package/.pikku/schemas/schemas/ReverseOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/SleepInput.schema.json +1 -0
- package/.pikku/schemas/schemas/SortInput.schema.json +1 -0
- package/.pikku/schemas/schemas/SortOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/SplitOutInput.schema.json +1 -0
- package/.pikku/schemas/schemas/SplitOutOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/StringTransformInput.schema.json +1 -0
- package/.pikku/schemas/schemas/StringTransformOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/SummarizeInput.schema.json +1 -0
- package/.pikku/schemas/schemas/SummarizeOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/TypeConvertInput.schema.json +1 -0
- package/.pikku/schemas/schemas/TypeConvertOutput.schema.json +1 -0
- package/.pikku/schemas/schemas/UniqueInput.schema.json +1 -0
- package/.pikku/schemas/schemas/UniqueOutput.schema.json +1 -0
- package/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
- package/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
- package/.pikku/secrets/pikku-secrets.gen.ts +21 -0
- package/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
- package/.pikku/variables/pikku-variable-types.gen.ts +5 -0
- package/.pikku/variables/pikku-variables-meta.gen.json +1 -0
- package/.pikku/variables/pikku-variables.gen.ts +21 -0
- package/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
- package/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
- package/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
- package/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +3 -3
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.js +6 -2
- package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -1
- package/dist/.pikku/addon/pikku-addon-types.gen.ts +10 -5
- package/dist/.pikku/addon/pikku-package.gen.js +2 -1
- package/dist/.pikku/addon/pikku-package.gen.js.map +1 -1
- package/dist/.pikku/addon/pikku-package.gen.ts +3 -1
- package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +2 -14
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +112 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts.map +1 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js +60 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.js.map +1 -0
- package/dist/.pikku/channel/pikku-channel-types.gen.ts +177 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +78 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts.map +1 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.js +61 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.js.map +1 -0
- package/dist/.pikku/cli/pikku-cli-types.gen.ts +105 -0
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/console/pikku-node-types.gen.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +16 -19
- package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.js +15 -19
- package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.ts +18 -20
- package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +50 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.ts +1 -1
- package/dist/.pikku/function/pikku-functions.gen.js +2 -2
- package/dist/.pikku/function/pikku-functions.gen.js.map +1 -1
- package/dist/.pikku/function/pikku-functions.gen.ts +2 -2
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +120 -0
- package/dist/.pikku/http/pikku-http-types.gen.d.ts.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.js +72 -0
- package/dist/.pikku/http/pikku-http-types.gen.js.map +1 -0
- package/dist/.pikku/http/pikku-http-types.gen.ts +147 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +131 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts.map +1 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +38 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js.map +1 -0
- package/dist/.pikku/mcp/pikku-mcp-types.gen.ts +183 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts +4 -2
- package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +2 -10
- package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.ts +2 -9
- package/dist/.pikku/pikku-meta-service.gen.d.ts +8 -0
- package/dist/.pikku/pikku-meta-service.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-meta-service.gen.js +10 -0
- package/dist/.pikku/pikku-meta-service.gen.js.map +1 -0
- package/dist/.pikku/pikku-meta-service.gen.ts +10 -0
- package/dist/.pikku/pikku-services.gen.d.ts +6 -3
- package/dist/.pikku/pikku-services.gen.d.ts.map +1 -1
- package/dist/.pikku/pikku-services.gen.js +5 -1
- package/dist/.pikku/pikku-services.gen.js.map +1 -1
- package/dist/.pikku/pikku-services.gen.ts +8 -3
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/pikku-types.gen.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +24 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts.map +1 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js +17 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.js.map +1 -0
- package/dist/.pikku/queue/pikku-queue-types.gen.ts +27 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.gen.d.ts +421 -57
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +421 -57
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts +2 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.d.ts.map +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +7 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js.map +1 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +27 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.ts +6 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +22 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts.map +1 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +17 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js.map +1 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.ts +25 -0
- package/dist/.pikku/schemas/register.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secret-types.gen.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +1 -1
- package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variable-types.gen.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +9 -5
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +3 -24
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -14
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +5 -52
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +1 -1
- package/dist/src/functions/data/jwt.function.d.ts.map +1 -1
- package/dist/src/functions/data/jwt.function.js +3 -2
- package/dist/src/functions/data/jwt.function.js.map +1 -1
- package/package.json +7 -9
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts +0 -2
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.d.ts.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +0 -7
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.json +0 -3
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.ts +0 -7
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +0 -5
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js +0 -5
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js.map +0 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.ts +0 -3
- package/dist/.pikku/schema-cache.json +0 -1
- package/dist/.pikku/schemas/pikku.cache.json +0 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.19
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Channel-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { CoreChannel, CorePikkuChannelMiddleware, CorePikkuChannelMiddlewareFactory, wireChannel as wireChannelCore, defineChannelRoutes as defineChannelRoutesCore, addChannelMiddleware as addChannelMiddlewareCore } from '@pikku/core/channel'
|
|
9
|
+
import { AssertHTTPWiringParams } from '@pikku/core/http'
|
|
10
|
+
import type { PikkuFunctionConfig, PikkuFunctionSessionless, PikkuPermission, PikkuMiddleware, Services } from '../function/pikku-function-types.gen.js'
|
|
11
|
+
import type { CorePermissionGroup } from '@pikku/core'
|
|
12
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Helper type to infer the output type from a Standard Schema
|
|
16
|
+
*/
|
|
17
|
+
type InferSchemaOutput<T> = T extends StandardSchemaV1<any, infer Output> ? Output : never
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Type definition for WebSocket channels with typed data exchange.
|
|
21
|
+
* Supports connection, disconnection, and message handling.
|
|
22
|
+
* Accepts both session-based (PikkuFunction) and sessionless (PikkuFunctionSessionless) functions.
|
|
23
|
+
*
|
|
24
|
+
* @template ChannelData - Type of data exchanged through the channel
|
|
25
|
+
* @template Channel - String literal type for the channel name
|
|
26
|
+
*/
|
|
27
|
+
type ChannelWiring<ChannelData, Channel extends string> = CoreChannel<
|
|
28
|
+
ChannelData,
|
|
29
|
+
Channel,
|
|
30
|
+
PikkuFunctionConfig<void, any, 'channel' | 'session' | 'rpc'>,
|
|
31
|
+
PikkuFunctionConfig<void, void, 'channel' | 'session' | 'rpc'>,
|
|
32
|
+
PikkuFunctionConfig<any, any, 'channel' | 'session' | 'rpc'>,
|
|
33
|
+
PikkuPermission,
|
|
34
|
+
PikkuMiddleware
|
|
35
|
+
>
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Creates a function that handles WebSocket channel connections.
|
|
39
|
+
* Called when a client connects to a channel.
|
|
40
|
+
*
|
|
41
|
+
* @template Out - Output type for connection response
|
|
42
|
+
* @param func - Function definition, either direct function or configuration object
|
|
43
|
+
* @returns The normalized configuration object
|
|
44
|
+
*/
|
|
45
|
+
export const pikkuChannelConnectionFunc = <Out = unknown>(
|
|
46
|
+
func:
|
|
47
|
+
| PikkuFunctionSessionless<void, Out, 'channel' | 'session' | 'rpc'>
|
|
48
|
+
| PikkuFunctionConfig<void, Out, 'channel' | 'session' | 'rpc'>
|
|
49
|
+
) => {
|
|
50
|
+
return typeof func === 'function' ? { func } : func
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Creates a function that handles WebSocket channel disconnections.
|
|
55
|
+
* Called when a client disconnects from a channel.
|
|
56
|
+
*
|
|
57
|
+
* @param func - Function definition, either direct function or configuration object
|
|
58
|
+
* @returns The normalized configuration object
|
|
59
|
+
*/
|
|
60
|
+
export const pikkuChannelDisconnectionFunc = (
|
|
61
|
+
func:
|
|
62
|
+
| PikkuFunctionSessionless<void, void, 'channel'>
|
|
63
|
+
| PikkuFunctionConfig<void, void, 'channel' | 'session' | 'rpc'>
|
|
64
|
+
) => {
|
|
65
|
+
return typeof func === 'function' ? { func } : func
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Configuration object for channel functions with Zod schema validation.
|
|
70
|
+
*/
|
|
71
|
+
type PikkuChannelFuncConfigWithSchema<
|
|
72
|
+
InputSchema extends StandardSchemaV1,
|
|
73
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
74
|
+
> = {
|
|
75
|
+
name?: string
|
|
76
|
+
tags?: string[]
|
|
77
|
+
expose?: boolean
|
|
78
|
+
remote?: boolean
|
|
79
|
+
func: PikkuFunctionSessionless<
|
|
80
|
+
InferSchemaOutput<InputSchema>,
|
|
81
|
+
OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown,
|
|
82
|
+
'channel' | 'session' | 'rpc'
|
|
83
|
+
>
|
|
84
|
+
auth?: boolean
|
|
85
|
+
permissions?: CorePermissionGroup<PikkuPermission<InferSchemaOutput<InputSchema>>>
|
|
86
|
+
middleware?: PikkuMiddleware[]
|
|
87
|
+
input: InputSchema
|
|
88
|
+
output?: OutputSchema
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Creates a function that handles WebSocket channel messages.
|
|
93
|
+
* Called when a message is received on a channel.
|
|
94
|
+
*
|
|
95
|
+
* Supports two patterns:
|
|
96
|
+
* 1. Generic types: `pikkuChannelFunc<Input, Output>({ func: ... })`
|
|
97
|
+
* 2. Zod schemas: `pikkuChannelFunc({ input: z.object(...), func: ... })`
|
|
98
|
+
*
|
|
99
|
+
* @template In - Input type for channel messages (inferred from schema if provided)
|
|
100
|
+
* @template Out - Output type for channel responses (inferred from schema if provided)
|
|
101
|
+
* @param func - Function definition, either direct function or configuration object
|
|
102
|
+
* @returns The normalized configuration object
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* // Pattern 1: Using generic types
|
|
107
|
+
* const handleMessage = pikkuChannelFunc<{text: string}, {received: boolean}>({
|
|
108
|
+
* func: async (_services, { text }) => ({ received: true })
|
|
109
|
+
* })
|
|
110
|
+
*
|
|
111
|
+
* // Pattern 2: Using Zod schemas
|
|
112
|
+
* const messageInput = z.object({ text: z.string() })
|
|
113
|
+
* const messageOutput = z.object({ received: z.boolean() })
|
|
114
|
+
*
|
|
115
|
+
* const handleMessage = pikkuChannelFunc({
|
|
116
|
+
* input: messageInput,
|
|
117
|
+
* output: messageOutput,
|
|
118
|
+
* func: async (_services, { text }) => ({ received: true })
|
|
119
|
+
* })
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export function pikkuChannelFunc<
|
|
123
|
+
InputSchema extends StandardSchemaV1,
|
|
124
|
+
OutputSchema extends StandardSchemaV1 | undefined = undefined
|
|
125
|
+
>(
|
|
126
|
+
config: PikkuChannelFuncConfigWithSchema<InputSchema, OutputSchema>
|
|
127
|
+
): PikkuFunctionConfig<InferSchemaOutput<InputSchema>, OutputSchema extends StandardSchemaV1 ? InferSchemaOutput<OutputSchema> : unknown, 'channel' | 'session' | 'rpc'>
|
|
128
|
+
export function pikkuChannelFunc<In, Out = unknown>(
|
|
129
|
+
func:
|
|
130
|
+
| PikkuFunctionSessionless<In, Out, 'channel' | 'session' | 'rpc'>
|
|
131
|
+
| PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>
|
|
132
|
+
): PikkuFunctionConfig<In, Out, 'channel' | 'session' | 'rpc'>
|
|
133
|
+
export function pikkuChannelFunc(func: any) {
|
|
134
|
+
return typeof func === 'function' ? { func } : func
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Registers a WebSocket channel with the Pikku framework.
|
|
139
|
+
*
|
|
140
|
+
* @template ChannelData - Type of data associated with the channel
|
|
141
|
+
* @template Channel - String literal type for the channel name
|
|
142
|
+
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
143
|
+
*/
|
|
144
|
+
export const wireChannel = <ChannelData, Channel extends string>(
|
|
145
|
+
channel: ChannelWiring<ChannelData, Channel> & AssertHTTPWiringParams<ChannelData, Channel>
|
|
146
|
+
) => {
|
|
147
|
+
wireChannelCore(channel as any)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Type-safe helper for defining channel message routes that can be composed.
|
|
152
|
+
* Returns the routes record as-is for use with wireChannel's onMessageWiring.
|
|
153
|
+
*
|
|
154
|
+
* @template T - Record of channel route handlers
|
|
155
|
+
* @param routes - The channel routes record
|
|
156
|
+
* @returns The same routes record (identity function for type safety)
|
|
157
|
+
*/
|
|
158
|
+
export function defineChannelRoutes<T extends Record<string, any>>(routes: T): T {
|
|
159
|
+
return defineChannelRoutesCore(routes)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export type PikkuChannelMiddleware<RequiredServices extends Services = Services, Event = unknown> = CorePikkuChannelMiddleware<RequiredServices, Event>
|
|
163
|
+
|
|
164
|
+
export const pikkuChannelMiddleware = <RequiredServices extends Services = Services, Event = unknown>(
|
|
165
|
+
middleware: PikkuChannelMiddleware<RequiredServices, Event>
|
|
166
|
+
): PikkuChannelMiddleware<RequiredServices, Event> => {
|
|
167
|
+
return middleware
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const pikkuChannelMiddlewareFactory = <In = any>(
|
|
171
|
+
factory: CorePikkuChannelMiddlewareFactory<In>
|
|
172
|
+
): CorePikkuChannelMiddlewareFactory<In> => {
|
|
173
|
+
return factory
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const addChannelMiddleware = (tag: string, middleware: PikkuChannelMiddleware[]) =>
|
|
177
|
+
addChannelMiddlewareCore(tag, middleware, '@pikku/addon-graph')
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.19
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
|
|
6
|
+
* CLI-specific type definitions for tree-shaking optimization
|
|
7
|
+
*/
|
|
8
|
+
import { CoreCLI, CorePikkuCLIRender, CoreCLICommandConfig } from '@pikku/core/cli';
|
|
9
|
+
import type { PikkuFunctionConfig, PikkuMiddleware } from '../function/pikku-function-types.gen.js';
|
|
10
|
+
import type { UserSession } from '../../types/application-types.d.js';
|
|
11
|
+
import type { SingletonServices } from '../../types/application-types.d.js';
|
|
12
|
+
type Session = UserSession;
|
|
13
|
+
/**
|
|
14
|
+
* Type-safe CLI renderer definition that can access your application's services.
|
|
15
|
+
* Use this to define custom renderers for CLI command output.
|
|
16
|
+
*
|
|
17
|
+
* @template Data - The output data type from the CLI command
|
|
18
|
+
* @template RequiredServices - The services required for this renderer
|
|
19
|
+
*/
|
|
20
|
+
type PikkuCLIRender<Data, RequiredServices extends SingletonServices = SingletonServices> = CorePikkuCLIRender<Data, RequiredServices, Session>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a type-safe CLI renderer with access to your application's singleton services.
|
|
23
|
+
* The renderer receives the full singleton services and output data to format and display results.
|
|
24
|
+
*
|
|
25
|
+
* @template Data - The output data type from the CLI command
|
|
26
|
+
* @template RequiredServices - The minimum services required for type checking (defaults to SingletonServices)
|
|
27
|
+
* @param render - Function that receives singleton services and data to render output
|
|
28
|
+
* @returns A CLI renderer configuration
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const myRenderer = pikkuCLIRender<MyData>(({ logger }, data) => {
|
|
33
|
+
* logger.info(data.message)
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const pikkuCLIRender: <Data, RequiredServices extends SingletonServices = SingletonServices>(render: (services: SingletonServices, data: Data) => void | Promise<void>) => PikkuCLIRender<Data, RequiredServices>;
|
|
38
|
+
/**
|
|
39
|
+
* CLI command configuration with project-specific types.
|
|
40
|
+
* Uses CoreCLICommandConfig from @pikku/core with local middleware and render types.
|
|
41
|
+
*/
|
|
42
|
+
type CLICommandConfig<Func extends PikkuFunctionConfig<In, Out, 'cli' | 'rpc' | 'session'>, In = any, Out = any, Params extends string = string> = CoreCLICommandConfig<Func, PikkuMiddleware, PikkuCLIRender<any>, Params>;
|
|
43
|
+
/**
|
|
44
|
+
* Type definition for CLI applications with commands and global options.
|
|
45
|
+
*
|
|
46
|
+
* @template Commands - Type describing the command structure
|
|
47
|
+
* @template GlobalOptions - Type for global CLI options
|
|
48
|
+
*/
|
|
49
|
+
type CLIWiring<Commands extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>, GlobalOptions> = CoreCLI<Commands, GlobalOptions, PikkuMiddleware, PikkuCLIRender<any>>;
|
|
50
|
+
/**
|
|
51
|
+
* Registers a CLI application with the Pikku framework.
|
|
52
|
+
* Creates command-line interfaces with type-safe commands and options.
|
|
53
|
+
*
|
|
54
|
+
* @template Commands - Type describing the command structure
|
|
55
|
+
* @template GlobalOptions - Type for global CLI options
|
|
56
|
+
* @param cli - CLI definition with program name, commands, and global options
|
|
57
|
+
*/
|
|
58
|
+
export declare const wireCLI: <Commands extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>, GlobalOptions>(cli: CLIWiring<Commands, GlobalOptions>) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Creates a CLI command definition with automatic option inference from the function's input type.
|
|
61
|
+
* This allows TypeScript to automatically derive CLI options from the function signature.
|
|
62
|
+
*
|
|
63
|
+
* @template FuncConfig - The Pikku function config type
|
|
64
|
+
* @template Params - The parameters string literal type
|
|
65
|
+
* @param config - CLI command configuration
|
|
66
|
+
* @returns CLI command configuration with inferred types
|
|
67
|
+
*/
|
|
68
|
+
export declare const pikkuCLICommand: <FuncConfig extends PikkuFunctionConfig<any, any, "cli" | "rpc" | "session">, Params extends string>(config: CLICommandConfig<FuncConfig, any, any, Params>) => CoreCLICommandConfig<FuncConfig, PikkuMiddleware, PikkuCLIRender<any>, string>;
|
|
69
|
+
/**
|
|
70
|
+
* Type-safe helper for defining CLI commands that can be composed and spread into wireCLI.
|
|
71
|
+
*
|
|
72
|
+
* @template T - Record of CLI command configurations
|
|
73
|
+
* @param commands - The CLI commands record
|
|
74
|
+
* @returns The same commands record (identity function for type safety)
|
|
75
|
+
*/
|
|
76
|
+
export declare const defineCLICommands: <T extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>>(commands: T) => T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ree-shaking optimization
|
|
7
|
+
*/
|
|
8
|
+
import { wireCLI as wireCLICore, defineCLICommands as defineCLICommandsCore } from '@pikku/core/cli';
|
|
9
|
+
/**
|
|
10
|
+
* Creates a type-safe CLI renderer with access to your application's singleton services.
|
|
11
|
+
* The renderer receives the full singleton services and output data to format and display results.
|
|
12
|
+
*
|
|
13
|
+
* @template Data - The output data type from the CLI command
|
|
14
|
+
* @template RequiredServices - The minimum services required for type checking (defaults to SingletonServices)
|
|
15
|
+
* @param render - Function that receives singleton services and data to render output
|
|
16
|
+
* @returns A CLI renderer configuration
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const myRenderer = pikkuCLIRender<MyData>(({ logger }, data) => {
|
|
21
|
+
* logger.info(data.message)
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export const pikkuCLIRender = (render) => {
|
|
26
|
+
return render;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Registers a CLI application with the Pikku framework.
|
|
30
|
+
* Creates command-line interfaces with type-safe commands and options.
|
|
31
|
+
*
|
|
32
|
+
* @template Commands - Type describing the command structure
|
|
33
|
+
* @template GlobalOptions - Type for global CLI options
|
|
34
|
+
* @param cli - CLI definition with program name, commands, and global options
|
|
35
|
+
*/
|
|
36
|
+
export const wireCLI = (cli) => {
|
|
37
|
+
wireCLICore(cli);
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Creates a CLI command definition with automatic option inference from the function's input type.
|
|
41
|
+
* This allows TypeScript to automatically derive CLI options from the function signature.
|
|
42
|
+
*
|
|
43
|
+
* @template FuncConfig - The Pikku function config type
|
|
44
|
+
* @template Params - The parameters string literal type
|
|
45
|
+
* @param config - CLI command configuration
|
|
46
|
+
* @returns CLI command configuration with inferred types
|
|
47
|
+
*/
|
|
48
|
+
export const pikkuCLICommand = (config) => {
|
|
49
|
+
return config;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Type-safe helper for defining CLI commands that can be composed and spread into wireCLI.
|
|
53
|
+
*
|
|
54
|
+
* @template T - Record of CLI command configurations
|
|
55
|
+
* @param commands - The CLI commands record
|
|
56
|
+
* @returns The same commands record (identity function for type safety)
|
|
57
|
+
*/
|
|
58
|
+
export const defineCLICommands = (commands) => {
|
|
59
|
+
return defineCLICommandsCore(commands);
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=pikku-cli-types.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-cli-types.gen.js","sourceRoot":"","sources":["../../../.pikku/cli/pikku-cli-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;GAGG;AAEH,OAAO,EAAW,OAAO,IAAI,WAAW,EAA4C,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAiBvJ;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,MAAyE,EACjC,EAAE;IAC1C,OAAO,MAAa,CAAA;AACtB,CAAC,CAAA;AAgBD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,GAAuC,EACvC,EAAE;IACF,WAAW,CAAC,GAAU,CAAC,CAAA;AACzB,CAAC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAI7B,MAAsD,EAC0B,EAAE;IAClF,OAAO,MAAa,CAAA;AACtB,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,QAAW,EACR,EAAE;IACL,OAAO,qBAAqB,CAAC,QAAe,CAAM,CAAA;AACpD,CAAC,CAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.19
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
|
|
6
|
+
* CLI-specific type definitions for tree-shaking optimization
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { CoreCLI, wireCLI as wireCLICore, CorePikkuCLIRender, CoreCLICommandConfig, defineCLICommands as defineCLICommandsCore } from '@pikku/core/cli'
|
|
10
|
+
import type { PikkuFunctionConfig, PikkuMiddleware } from '../function/pikku-function-types.gen.js'
|
|
11
|
+
import type { UserSession } from '../../types/application-types.d.js'
|
|
12
|
+
import type { SingletonServices } from '../../types/application-types.d.js'
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
type Session = UserSession
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Type-safe CLI renderer definition that can access your application's services.
|
|
19
|
+
* Use this to define custom renderers for CLI command output.
|
|
20
|
+
*
|
|
21
|
+
* @template Data - The output data type from the CLI command
|
|
22
|
+
* @template RequiredServices - The services required for this renderer
|
|
23
|
+
*/
|
|
24
|
+
type PikkuCLIRender<Data, RequiredServices extends SingletonServices = SingletonServices> = CorePikkuCLIRender<Data, RequiredServices, Session>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a type-safe CLI renderer with access to your application's singleton services.
|
|
28
|
+
* The renderer receives the full singleton services and output data to format and display results.
|
|
29
|
+
*
|
|
30
|
+
* @template Data - The output data type from the CLI command
|
|
31
|
+
* @template RequiredServices - The minimum services required for type checking (defaults to SingletonServices)
|
|
32
|
+
* @param render - Function that receives singleton services and data to render output
|
|
33
|
+
* @returns A CLI renderer configuration
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const myRenderer = pikkuCLIRender<MyData>(({ logger }, data) => {
|
|
38
|
+
* logger.info(data.message)
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export const pikkuCLIRender = <Data, RequiredServices extends SingletonServices = SingletonServices>(
|
|
43
|
+
render: (services: SingletonServices, data: Data) => void | Promise<void>
|
|
44
|
+
): PikkuCLIRender<Data, RequiredServices> => {
|
|
45
|
+
return render as any
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* CLI command configuration with project-specific types.
|
|
50
|
+
* Uses CoreCLICommandConfig from @pikku/core with local middleware and render types.
|
|
51
|
+
*/
|
|
52
|
+
type CLICommandConfig<Func extends PikkuFunctionConfig<In, Out, 'cli' | 'rpc' | 'session'>, In = any, Out = any, Params extends string = string> = CoreCLICommandConfig<Func, PikkuMiddleware, PikkuCLIRender<any>, Params>
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Type definition for CLI applications with commands and global options.
|
|
56
|
+
*
|
|
57
|
+
* @template Commands - Type describing the command structure
|
|
58
|
+
* @template GlobalOptions - Type for global CLI options
|
|
59
|
+
*/
|
|
60
|
+
type CLIWiring<Commands extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>, GlobalOptions> = CoreCLI<Commands, GlobalOptions, PikkuMiddleware, PikkuCLIRender<any>>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Registers a CLI application with the Pikku framework.
|
|
64
|
+
* Creates command-line interfaces with type-safe commands and options.
|
|
65
|
+
*
|
|
66
|
+
* @template Commands - Type describing the command structure
|
|
67
|
+
* @template GlobalOptions - Type for global CLI options
|
|
68
|
+
* @param cli - CLI definition with program name, commands, and global options
|
|
69
|
+
*/
|
|
70
|
+
export const wireCLI = <Commands extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>, GlobalOptions>(
|
|
71
|
+
cli: CLIWiring<Commands, GlobalOptions>
|
|
72
|
+
) => {
|
|
73
|
+
wireCLICore(cli as any)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Creates a CLI command definition with automatic option inference from the function's input type.
|
|
78
|
+
* This allows TypeScript to automatically derive CLI options from the function signature.
|
|
79
|
+
*
|
|
80
|
+
* @template FuncConfig - The Pikku function config type
|
|
81
|
+
* @template Params - The parameters string literal type
|
|
82
|
+
* @param config - CLI command configuration
|
|
83
|
+
* @returns CLI command configuration with inferred types
|
|
84
|
+
*/
|
|
85
|
+
export const pikkuCLICommand = <
|
|
86
|
+
FuncConfig extends PikkuFunctionConfig<any, any, 'cli' | 'rpc' | 'session'>,
|
|
87
|
+
Params extends string
|
|
88
|
+
>(
|
|
89
|
+
config: CLICommandConfig<FuncConfig, any, any, Params>
|
|
90
|
+
): CoreCLICommandConfig<FuncConfig, PikkuMiddleware, PikkuCLIRender<any>, string> => {
|
|
91
|
+
return config as any
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Type-safe helper for defining CLI commands that can be composed and spread into wireCLI.
|
|
96
|
+
*
|
|
97
|
+
* @template T - Record of CLI command configurations
|
|
98
|
+
* @param commands - The CLI commands record
|
|
99
|
+
* @returns The same commands record (identity function for type safety)
|
|
100
|
+
*/
|
|
101
|
+
export const defineCLICommands = <T extends Record<string, CoreCLICommandConfig<any, PikkuMiddleware, PikkuCLIRender<any>, any>>>(
|
|
102
|
+
commands: T
|
|
103
|
+
): T => {
|
|
104
|
+
return defineCLICommandsCore(commands as any) as T
|
|
105
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.19
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Core function, middleware, and permission types for all wirings
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import type { CorePikkuMiddleware, CorePermissionGroup, PikkuWire, PickRequired } from '@pikku/core';
|
|
8
|
+
import type { CorePikkuFunctionConfig, CorePikkuAuth, CorePikkuAuthConfig, CorePikkuPermission } from '@pikku/core/function';
|
|
8
9
|
import { CreateWireServices } from '@pikku/core/internal';
|
|
9
10
|
import { PikkuError } from '@pikku/core/errors';
|
|
10
11
|
import type { NodeType } from '@pikku/core/node';
|
|
@@ -377,27 +378,23 @@ export declare function pikkuSessionlessFunc<In, Out = unknown>(func: PikkuFunct
|
|
|
377
378
|
*/
|
|
378
379
|
export declare const pikkuVoidFunc: (func: PikkuFunctionSessionless<void, void, "session" | "rpc"> | PikkuFunctionConfig<void, void, "session" | "rpc">) => PikkuFunctionConfig<void, void, "rpc" | "session", PikkuFunctionSessionless<void, void, "rpc" | "session", Services> | PikkuFunction<void, void, "rpc" | "session", Services>, undefined, undefined>;
|
|
379
380
|
/**
|
|
380
|
-
*
|
|
381
|
-
*
|
|
382
|
-
* without type compatibility issues.
|
|
381
|
+
* References a registered function by name for use in any wiring.
|
|
382
|
+
* Works for both local and addon functions — resolves via RPC at runtime.
|
|
383
383
|
*
|
|
384
|
-
* @template Name - The
|
|
385
|
-
* @param rpcName - The name of the
|
|
386
|
-
* @returns A Pikku function that proxies calls
|
|
384
|
+
* @template Name - The function name (must be a key in FlattenedRPCMap)
|
|
385
|
+
* @param rpcName - The name of the function to reference
|
|
386
|
+
* @returns A Pikku function config that proxies calls via RPC
|
|
387
387
|
*
|
|
388
388
|
* @example
|
|
389
389
|
* ```typescript
|
|
390
|
-
* //
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
* func: addon('ext:hello'),
|
|
396
|
-
* tags: ['addon'],
|
|
397
|
-
* })
|
|
390
|
+
* // Use in agent tools
|
|
391
|
+
* tools: [ref('todos:listTodos'), ref('myLocalFunc')]
|
|
392
|
+
*
|
|
393
|
+
* // Use in HTTP wiring
|
|
394
|
+
* wireHTTP({ route: '/greet', method: 'post', func: ref('greet') })
|
|
398
395
|
* ```
|
|
399
396
|
*/
|
|
400
|
-
export declare const
|
|
397
|
+
export declare const ref: <Name extends keyof FlattenedRPCMap>(rpcName: Name) => PikkuFunctionConfig<FlattenedRPCMap[Name]["input"], FlattenedRPCMap[Name]["output"], "session" | "rpc">;
|
|
401
398
|
/**
|
|
402
399
|
* Creates a Pikku config factory.
|
|
403
400
|
* Use this to define your application's configuration factory.
|
|
@@ -501,6 +498,6 @@ export declare const addMiddleware: (tag: string, middleware: PikkuMiddleware[])
|
|
|
501
498
|
* ```
|
|
502
499
|
*/
|
|
503
500
|
export declare const addPermission: <In = unknown>(tag: string, permissions: CorePermissionGroup<PikkuPermission<In>> | PikkuPermission<In>[]) => void;
|
|
504
|
-
export { wireAddon } from '@pikku/core';
|
|
505
|
-
export type { WireAddonConfig } from '@pikku/core';
|
|
501
|
+
export { wireAddon } from '@pikku/core/rpc';
|
|
502
|
+
export type { WireAddonConfig } from '@pikku/core/rpc';
|
|
506
503
|
//# sourceMappingURL=pikku-function-types.gen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pikku-function-types.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/function/pikku-function-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pikku-function-types.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/function/pikku-function-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACpG,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG5H,OAAO,EAA8B,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAA;AAEtF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,C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I,EAAE,GAAG,KACN,OAAO,CAAC,oBAAoB,CAAC,KACjC,kBAIF,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,YAAY,eAAe,EAAE,SAEvE,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa,GAAI,EAAE,GAAG,OAAO,EAAE,KAAK,MAAM,EAAE,aAAa,mBAAmB,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,EAAE,CAAC,EAAE,SAErI,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.19
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Core function, middleware, and permission types for all wirings
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { pikkuAuth as pikkuAuthCore } from '@pikku/core/function';
|
|
8
|
+
import { addMiddleware as addMiddlewareCore, addPermission as addPermissionCore } from '@pikku/core/middleware';
|
|
8
9
|
import { pikkuState as __pikkuState } from '@pikku/core/internal';
|
|
9
|
-
import { pikkuAuth as pikkuAuthCore } from '@pikku/core';
|
|
10
10
|
/**
|
|
11
11
|
* Factory function for creating permissions with tree-shaking support.
|
|
12
12
|
* Supports both direct function and configuration object syntax.
|
|
@@ -166,27 +166,23 @@ export const pikkuVoidFunc = (func) => {
|
|
|
166
166
|
return typeof func === 'function' ? { func } : func;
|
|
167
167
|
};
|
|
168
168
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* without type compatibility issues.
|
|
169
|
+
* References a registered function by name for use in any wiring.
|
|
170
|
+
* Works for both local and addon functions — resolves via RPC at runtime.
|
|
172
171
|
*
|
|
173
|
-
* @template Name - The
|
|
174
|
-
* @param rpcName - The name of the
|
|
175
|
-
* @returns A Pikku function that proxies calls
|
|
172
|
+
* @template Name - The function name (must be a key in FlattenedRPCMap)
|
|
173
|
+
* @param rpcName - The name of the function to reference
|
|
174
|
+
* @returns A Pikku function config that proxies calls via RPC
|
|
176
175
|
*
|
|
177
176
|
* @example
|
|
178
177
|
* ```typescript
|
|
179
|
-
* //
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* func: addon('ext:hello'),
|
|
185
|
-
* tags: ['addon'],
|
|
186
|
-
* })
|
|
178
|
+
* // Use in agent tools
|
|
179
|
+
* tools: [ref('todos:listTodos'), ref('myLocalFunc')]
|
|
180
|
+
*
|
|
181
|
+
* // Use in HTTP wiring
|
|
182
|
+
* wireHTTP({ route: '/greet', method: 'post', func: ref('greet') })
|
|
187
183
|
* ```
|
|
188
184
|
*/
|
|
189
|
-
export const
|
|
185
|
+
export const ref = (rpcName) => {
|
|
190
186
|
return {
|
|
191
187
|
func: async (_services, data, { rpc }) => {
|
|
192
188
|
return rpc.invoke(rpcName, data);
|
|
@@ -310,5 +306,5 @@ export const addMiddleware = (tag, middleware) => {
|
|
|
310
306
|
export const addPermission = (tag, permissions) => {
|
|
311
307
|
addPermissionCore(tag, permissions, '@pikku/addon-graph');
|
|
312
308
|
};
|
|
313
|
-
export { wireAddon } from '@pikku/core';
|
|
309
|
+
export { wireAddon } from '@pikku/core/rpc';
|
|
314
310
|
//# sourceMappingURL=pikku-function-types.gen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pikku-function-types.gen.js","sourceRoot":"","sources":["../../../.pikku/function/pikku-function-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;
|
|
1
|
+
{"version":3,"file":"pikku-function-types.gen.js","sourceRoot":"","sources":["../../../.pikku/function/pikku-function-types.gen.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