@pikku/addon-postbin 0.0.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/README.md +12 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts +67 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.d.ts.map +1 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.js +78 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.js.map +1 -0
- package/dist/.pikku/addon/pikku-addon-types.gen.ts +106 -0
- package/dist/.pikku/addon/pikku-package.gen.d.ts +2 -0
- package/dist/.pikku/addon/pikku-package.gen.d.ts.map +1 -0
- package/dist/.pikku/addon/pikku-package.gen.js +10 -0
- package/dist/.pikku/addon/pikku-package.gen.js.map +1 -0
- package/dist/.pikku/addon/pikku-package.gen.ts +11 -0
- package/dist/.pikku/agent/pikku-agent-map.gen.d.ts +4 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +47 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts.map +1 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js +18 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.js.map +1 -0
- package/dist/.pikku/agent/pikku-agent-types.gen.ts +82 -0
- 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/console/pikku-node-types.gen.d.ts +7 -0
- package/dist/.pikku/console/pikku-node-types.gen.d.ts.map +1 -0
- package/dist/.pikku/console/pikku-node-types.gen.js +2 -0
- package/dist/.pikku/console/pikku-node-types.gen.js.map +1 -0
- package/dist/.pikku/console/pikku-node-types.gen.ts +8 -0
- package/dist/.pikku/credentials/pikku-credentials-meta.gen.json +10 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.d.ts +15 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.d.ts.map +1 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.js +13 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.js.map +1 -0
- package/dist/.pikku/credentials/pikku-credentials.gen.ts +23 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +490 -0
- package/dist/.pikku/function/pikku-function-types.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-function-types.gen.js +334 -0
- package/dist/.pikku/function/pikku-function-types.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-function-types.gen.ts +754 -0
- package/dist/.pikku/function/pikku-functions-meta-verbose.gen.json +174 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts +2 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js +7 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.json +114 -0
- package/dist/.pikku/function/pikku-functions-meta.gen.ts +7 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts +2 -0
- package/dist/.pikku/function/pikku-functions.gen.d.ts.map +1 -0
- package/dist/.pikku/function/pikku-functions.gen.js +18 -0
- package/dist/.pikku/function/pikku-functions.gen.js.map +1 -0
- package/dist/.pikku/function/pikku-functions.gen.ts +18 -0
- 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 +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-bootstrap.gen.js +9 -0
- package/dist/.pikku/pikku-bootstrap.gen.js.map +1 -0
- package/dist/.pikku/pikku-bootstrap.gen.ts +8 -0
- 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 +35 -0
- package/dist/.pikku/pikku-services.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-services.gen.js +30 -0
- package/dist/.pikku/pikku-services.gen.js.map +1 -0
- package/dist/.pikku/pikku-services.gen.ts +42 -0
- package/dist/.pikku/pikku-types.gen.d.ts +12 -0
- package/dist/.pikku/pikku-types.gen.d.ts.map +1 -0
- package/dist/.pikku/pikku-types.gen.js +17 -0
- package/dist/.pikku/pikku-types.gen.js.map +1 -0
- package/dist/.pikku/pikku-types.gen.ts +21 -0
- 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 +142 -0
- package/dist/.pikku/rpc/pikku-rpc-wirings-map.internal.gen.d.ts +148 -0
- 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 +8 -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.d.ts +2 -0
- package/dist/.pikku/schemas/register.gen.d.ts.map +1 -0
- package/dist/.pikku/schemas/register.gen.js +31 -0
- package/dist/.pikku/schemas/register.gen.js.map +1 -0
- package/dist/.pikku/schemas/register.gen.ts +55 -0
- package/dist/.pikku/schemas/schemas/BinCreateOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BinDeleteInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BinDeleteOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BinGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/BinGetOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/CredentialSchema_postbin.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RequestGetInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RequestGetOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RequestSendInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RequestSendOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RequestShiftInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/RequestShiftOutput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/VariableSchema_POSTBIN_BASE_URL.schema.json +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts +6 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.d.ts.map +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.js +5 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.js.map +1 -0
- package/dist/.pikku/secrets/pikku-secret-types.gen.ts +5 -0
- package/dist/.pikku/secrets/pikku-secrets-meta.gen.json +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts +12 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.d.ts.map +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.js +11 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.js.map +1 -0
- package/dist/.pikku/secrets/pikku-secrets.gen.ts +21 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts +114 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.d.ts.map +1 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js +34 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.js.map +1 -0
- package/dist/.pikku/trigger/pikku-trigger-types.gen.ts +160 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts +6 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.d.ts.map +1 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.js +5 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.js.map +1 -0
- package/dist/.pikku/variables/pikku-variable-types.gen.ts +5 -0
- package/dist/.pikku/variables/pikku-variables-meta.gen.json +10 -0
- package/dist/.pikku/variables/pikku-variables.gen.d.ts +15 -0
- package/dist/.pikku/variables/pikku-variables.gen.d.ts.map +1 -0
- package/dist/.pikku/variables/pikku-variables.gen.js +13 -0
- package/dist/.pikku/variables/pikku-variables.gen.js.map +1 -0
- package/dist/.pikku/variables/pikku-variables.gen.ts +23 -0
- package/dist/.pikku/workflow/pikku-workflow-map.gen.d.ts +38 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +90 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +18 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-types.gen.ts +167 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts +2 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +7 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.ts +9 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts +5 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.d.ts.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js +5 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.js.map +1 -0
- package/dist/.pikku/workflow/pikku-workflow-wirings.gen.ts +3 -0
- package/dist/src/functions/binCreate.function.d.ts +20 -0
- package/dist/src/functions/binCreate.function.d.ts.map +1 -0
- package/dist/src/functions/binCreate.function.js +15 -0
- package/dist/src/functions/binCreate.function.js.map +1 -0
- package/dist/src/functions/binDelete.function.d.ts +21 -0
- package/dist/src/functions/binDelete.function.d.ts.map +1 -0
- package/dist/src/functions/binDelete.function.js +17 -0
- package/dist/src/functions/binDelete.function.js.map +1 -0
- package/dist/src/functions/binGet.function.d.ts +29 -0
- package/dist/src/functions/binGet.function.d.ts.map +1 -0
- package/dist/src/functions/binGet.function.js +19 -0
- package/dist/src/functions/binGet.function.js.map +1 -0
- package/dist/src/functions/requestGet.function.d.ts +33 -0
- package/dist/src/functions/requestGet.function.d.ts.map +1 -0
- package/dist/src/functions/requestGet.function.js +20 -0
- package/dist/src/functions/requestGet.function.js.map +1 -0
- package/dist/src/functions/requestSend.function.d.ts +25 -0
- package/dist/src/functions/requestSend.function.d.ts.map +1 -0
- package/dist/src/functions/requestSend.function.js +18 -0
- package/dist/src/functions/requestSend.function.js.map +1 -0
- package/dist/src/functions/requestShift.function.d.ts +29 -0
- package/dist/src/functions/requestShift.function.d.ts.map +1 -0
- package/dist/src/functions/requestShift.function.js +19 -0
- package/dist/src/functions/requestShift.function.js.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/postbin-api.service.d.ts +10 -0
- package/dist/src/postbin-api.service.d.ts.map +1 -0
- package/dist/src/postbin-api.service.js +116 -0
- package/dist/src/postbin-api.service.js.map +1 -0
- package/dist/src/postbin.credential.d.ts +5 -0
- package/dist/src/postbin.credential.d.ts.map +1 -0
- package/dist/src/postbin.credential.js +13 -0
- package/dist/src/postbin.credential.js.map +1 -0
- package/dist/src/postbin.types.d.ts +7 -0
- package/dist/src/postbin.types.d.ts.map +1 -0
- package/dist/src/postbin.types.js +8 -0
- package/dist/src/postbin.types.js.map +1 -0
- package/dist/src/postbin.variable.d.ts +5 -0
- package/dist/src/postbin.variable.d.ts.map +1 -0
- package/dist/src/postbin.variable.js +11 -0
- package/dist/src/postbin.variable.js.map +1 -0
- package/dist/src/services.d.ts +2 -0
- package/dist/src/services.d.ts.map +1 -0
- package/dist/src/services.js +14 -0
- package/dist/src/services.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.54
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Channel-specific type definitions for tree-shaking optimization
|
|
6
|
+
*/
|
|
7
|
+
import { wireChannel as wireChannelCore, defineChannelRoutes as defineChannelRoutesCore, addChannelMiddleware as addChannelMiddlewareCore } from '@pikku/core/channel';
|
|
8
|
+
/**
|
|
9
|
+
* Creates a function that handles WebSocket channel connections.
|
|
10
|
+
* Called when a client connects to a channel.
|
|
11
|
+
*
|
|
12
|
+
* @template Out - Output type for connection response
|
|
13
|
+
* @param func - Function definition, either direct function or configuration object
|
|
14
|
+
* @returns The normalized configuration object
|
|
15
|
+
*/
|
|
16
|
+
export const pikkuChannelConnectionFunc = (func) => {
|
|
17
|
+
return typeof func === 'function' ? { func } : func;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Creates a function that handles WebSocket channel disconnections.
|
|
21
|
+
* Called when a client disconnects from a channel.
|
|
22
|
+
*
|
|
23
|
+
* @param func - Function definition, either direct function or configuration object
|
|
24
|
+
* @returns The normalized configuration object
|
|
25
|
+
*/
|
|
26
|
+
export const pikkuChannelDisconnectionFunc = (func) => {
|
|
27
|
+
return typeof func === 'function' ? { func } : func;
|
|
28
|
+
};
|
|
29
|
+
export function pikkuChannelFunc(func) {
|
|
30
|
+
return typeof func === 'function' ? { func } : func;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Registers a WebSocket channel with the Pikku framework.
|
|
34
|
+
*
|
|
35
|
+
* @template ChannelData - Type of data associated with the channel
|
|
36
|
+
* @template Channel - String literal type for the channel name
|
|
37
|
+
* @param channel - Channel definition with connection, disconnection, and message handlers
|
|
38
|
+
*/
|
|
39
|
+
export const wireChannel = (channel) => {
|
|
40
|
+
wireChannelCore(channel);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Type-safe helper for defining channel message routes that can be composed.
|
|
44
|
+
* Returns the routes record as-is for use with wireChannel's onMessageWiring.
|
|
45
|
+
*
|
|
46
|
+
* @template T - Record of channel route handlers
|
|
47
|
+
* @param routes - The channel routes record
|
|
48
|
+
* @returns The same routes record (identity function for type safety)
|
|
49
|
+
*/
|
|
50
|
+
export function defineChannelRoutes(routes) {
|
|
51
|
+
return defineChannelRoutesCore(routes);
|
|
52
|
+
}
|
|
53
|
+
export const pikkuChannelMiddleware = (middleware) => {
|
|
54
|
+
return middleware;
|
|
55
|
+
};
|
|
56
|
+
export const pikkuChannelMiddlewareFactory = (factory) => {
|
|
57
|
+
return factory;
|
|
58
|
+
};
|
|
59
|
+
export const addChannelMiddleware = (tag, middleware) => addChannelMiddlewareCore(tag, middleware, '@pikku/addon-postbin');
|
|
60
|
+
//# sourceMappingURL=pikku-channel-types.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-channel-types.gen.js","sourceRoot":"","sources":["../../../.pikku/channel/pikku-channel-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;GAEG;AAEH,OAAO,EAA8E,WAAW,IAAI,eAAe,EAAE,mBAAmB,IAAI,uBAAuB,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AA6BlP;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,IAEiE,EACjE,EAAE;IACF,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,IAEkE,EAClE,EAAE;IACF,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC,CAAA;AAmED,MAAM,UAAU,gBAAgB,CAAC,IAAS;IACxC,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACrD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,OAA2F,EAC3F,EAAE;IACF,eAAe,CAAC,OAAc,CAAC,CAAA;AACjC,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAgC,MAAS;IAC1E,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAA;AACxC,CAAC;AAID,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,UAA2D,EACV,EAAE;IACnD,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,OAA8C,EACP,EAAE;IACzC,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,UAAoC,EAAE,EAAE,CACxF,wBAAwB,CAAC,GAAG,EAAE,UAAU,EAAE,sBAAsB,CAAC,CAAA"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.54
|
|
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-postbin')
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.54
|
|
3
|
+
*/
|
|
4
|
+
import type { FlattenedRPCMap } from '../rpc/pikku-rpc-wirings-map.internal.gen.js';
|
|
5
|
+
export type NodeCategory = never;
|
|
6
|
+
export type NodeRPCName = keyof FlattenedRPCMap;
|
|
7
|
+
//# sourceMappingURL=pikku-node-types.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-node-types.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/console/pikku-node-types.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAA;AAEnF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAA;AAEhC,MAAM,MAAM,WAAW,GAAG,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-node-types.gen.js","sourceRoot":"","sources":["../../../.pikku/console/pikku-node-types.gen.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"postbin": {
|
|
3
|
+
"name": "postbin",
|
|
4
|
+
"displayName": "PostBin",
|
|
5
|
+
"description": "Consume the PostBin API",
|
|
6
|
+
"type": "wire",
|
|
7
|
+
"schema": "CredentialSchema_postbin",
|
|
8
|
+
"sourceFile": "/home/runner/work/addons/addons/packages/data/postbin/src/postbin.credential.ts"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.54
|
|
3
|
+
*/
|
|
4
|
+
import { TypedCredentialService as CoreTypedCredentialService } from '@pikku/core/services';
|
|
5
|
+
import type { CredentialService } from '@pikku/core/services';
|
|
6
|
+
import type { z } from 'zod';
|
|
7
|
+
import { postbinCredentialSchema } from '../../src/postbin.credential.js';
|
|
8
|
+
export interface CredentialsMap {
|
|
9
|
+
'postbin': z.infer<typeof postbinCredentialSchema>;
|
|
10
|
+
}
|
|
11
|
+
export type CredentialName = keyof CredentialsMap;
|
|
12
|
+
export declare class TypedCredentialService extends CoreTypedCredentialService<CredentialsMap> {
|
|
13
|
+
constructor(credentials: CredentialService);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=pikku-credentials.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-credentials.gen.d.ts","sourceRoot":"","sources":["../../../.pikku/credentials/pikku-credentials.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,sBAAsB,IAAI,0BAA0B,EAA2B,MAAM,sBAAsB,CAAA;AACpH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAA;AAEzE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;CACnD;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,cAAc,CAAA;AAMjD,qBAAa,sBAAuB,SAAQ,0BAA0B,CAAC,cAAc,CAAC;gBACxE,WAAW,EAAE,iBAAiB;CAG3C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.54
|
|
3
|
+
*/
|
|
4
|
+
import { TypedCredentialService as CoreTypedCredentialService } from '@pikku/core/services';
|
|
5
|
+
const CREDENTIALS_META = {
|
|
6
|
+
'postbin': { name: 'postbin', displayName: 'PostBin', type: 'wire' }
|
|
7
|
+
};
|
|
8
|
+
export class TypedCredentialService extends CoreTypedCredentialService {
|
|
9
|
+
constructor(credentials) {
|
|
10
|
+
super(credentials, CREDENTIALS_META);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=pikku-credentials.gen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pikku-credentials.gen.js","sourceRoot":"","sources":["../../../.pikku/credentials/pikku-credentials.gen.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,sBAAsB,IAAI,0BAA0B,EAA2B,MAAM,sBAAsB,CAAA;AAWpH,MAAM,gBAAgB,GAAuC;IAC3D,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;CACrE,CAAA;AAED,MAAM,OAAO,sBAAuB,SAAQ,0BAA0C;IACpF,YAAY,WAA8B;QACxC,KAAK,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAA;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.54
|
|
3
|
+
*/
|
|
4
|
+
import { TypedCredentialService as CoreTypedCredentialService, type CredentialMetaInfo } from '@pikku/core/services'
|
|
5
|
+
import type { CredentialService } from '@pikku/core/services'
|
|
6
|
+
import type { z } from 'zod'
|
|
7
|
+
import { postbinCredentialSchema } from '../../src/postbin.credential.js'
|
|
8
|
+
|
|
9
|
+
export interface CredentialsMap {
|
|
10
|
+
'postbin': z.infer<typeof postbinCredentialSchema>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type CredentialName = keyof CredentialsMap
|
|
14
|
+
|
|
15
|
+
const CREDENTIALS_META: Record<string, CredentialMetaInfo> = {
|
|
16
|
+
'postbin': { name: 'postbin', displayName: 'PostBin', type: 'wire' }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class TypedCredentialService extends CoreTypedCredentialService<CredentialsMap> {
|
|
20
|
+
constructor(credentials: CredentialService) {
|
|
21
|
+
super(credentials, CREDENTIALS_META)
|
|
22
|
+
}
|
|
23
|
+
}
|