@pikku/cli 0.12.8 → 0.12.10
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/cli.schema.json +1 -1
- package/console-app/assets/{index-DOk9fqHB.js → index-DgyIKxt6.js} +109 -109
- package/console-app/index.html +1 -2
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.d.ts +1 -1
- package/dist/.pikku/agent/pikku-agent-wirings.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channels-meta.gen.js +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channels.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-channel.d.ts +19 -0
- package/dist/.pikku/cli/pikku-cli-channel.js +16 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-client.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-types.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +5 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-wirings.gen.js +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli.gen.js +1 -1
- package/dist/.pikku/console/pikku-node-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.d.ts +1 -1
- package/dist/.pikku/function/pikku-function-types.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +157 -136
- package/dist/.pikku/function/pikku-functions.gen.js +3 -1
- package/dist/.pikku/http/pikku-http-types.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-types.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings-meta.gen.js +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.d.ts +1 -1
- package/dist/.pikku/http/pikku-http-wirings.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-types.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings-meta.gen.js +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.d.ts +1 -1
- package/dist/.pikku/mcp/pikku-mcp-wirings.gen.js +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-services.gen.d.ts +2 -1
- package/dist/.pikku/pikku-services.gen.js +1 -0
- package/dist/.pikku/pikku-types.gen.d.ts +1 -1
- package/dist/.pikku/pikku-types.gen.js +1 -1
- package/dist/.pikku/pikku-websocket.gen.d.ts +1 -1
- package/dist/.pikku/pikku-websocket.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-types.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/queue/pikku-queue-workers-wirings.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-remote-rpc-workers.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.js +1 -1
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +1 -0
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-scheduler-types.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings-meta.gen.js +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.d.ts +1 -1
- package/dist/.pikku/scheduler/pikku-schedulers-wirings.gen.js +1 -1
- package/dist/.pikku/schemas/register.gen.js +7 -7
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuNewAddonInput.schema.json +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-secrets.gen.d.ts +1 -1
- package/dist/.pikku/secrets/pikku-secrets.gen.js +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/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-variables.gen.d.ts +1 -1
- package/dist/.pikku/variables/pikku-variables.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.d.ts +1 -1
- package/dist/.pikku/workflow/pikku-workflow-types.gen.js +1 -1
- package/dist/.pikku/workflow/pikku-workflow-wirings-meta.gen.js +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/src/cli.wiring.js +3 -0
- package/dist/src/functions/commands/all.js +1 -0
- package/dist/src/functions/commands/new-addon.d.ts +3 -0
- package/dist/src/functions/commands/new-addon.js +158 -22
- package/dist/src/functions/wirings/cli/serialize-channel-cli.js +16 -0
- package/dist/src/functions/wirings/credentials/pikku-command-credentials.d.ts +1 -0
- package/dist/src/functions/wirings/credentials/pikku-command-credentials.js +34 -0
- package/dist/src/functions/wirings/credentials/serialize-credentials-types.d.ts +9 -0
- package/dist/src/functions/wirings/credentials/serialize-credentials-types.js +61 -0
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +4 -2
- package/dist/src/functions/wirings/functions/serialize-addon-types.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-addon-types.js +3 -2
- package/dist/src/utils/pikku-cli-config.js +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.10
|
|
3
3
|
*/
|
|
4
4
|
import { addSchema } from '@pikku/core/schema';
|
|
5
5
|
import * as PikkuSchemasOutput from './schemas/PikkuSchemasOutput.schema.json' with { type: 'json' };
|
|
@@ -26,20 +26,22 @@ import * as PikkuChannelsOutput from './schemas/PikkuChannelsOutput.schema.json'
|
|
|
26
26
|
addSchema('PikkuChannelsOutput', PikkuChannelsOutput);
|
|
27
27
|
import * as PikkuCLIOutput from './schemas/PikkuCLIOutput.schema.json' with { type: 'json' };
|
|
28
28
|
addSchema('PikkuCLIOutput', PikkuCLIOutput);
|
|
29
|
-
import * as PikkuConsoleFunctionsOutput from './schemas/PikkuConsoleFunctionsOutput.schema.json' with { type: 'json' };
|
|
30
|
-
addSchema('PikkuConsoleFunctionsOutput', PikkuConsoleFunctionsOutput);
|
|
31
|
-
import * as PikkuNodesMetaOutput from './schemas/PikkuNodesMetaOutput.schema.json' with { type: 'json' };
|
|
32
|
-
addSchema('PikkuNodesMetaOutput', PikkuNodesMetaOutput);
|
|
33
29
|
import * as PikkuAIAgentOutput from './schemas/PikkuAIAgentOutput.schema.json' with { type: 'json' };
|
|
34
30
|
addSchema('PikkuAIAgentOutput', PikkuAIAgentOutput);
|
|
35
31
|
import * as PikkuPublicAgentOutput from './schemas/PikkuPublicAgentOutput.schema.json' with { type: 'json' };
|
|
36
32
|
addSchema('PikkuPublicAgentOutput', PikkuPublicAgentOutput);
|
|
33
|
+
import * as PikkuConsoleFunctionsOutput from './schemas/PikkuConsoleFunctionsOutput.schema.json' with { type: 'json' };
|
|
34
|
+
addSchema('PikkuConsoleFunctionsOutput', PikkuConsoleFunctionsOutput);
|
|
35
|
+
import * as PikkuNodesMetaOutput from './schemas/PikkuNodesMetaOutput.schema.json' with { type: 'json' };
|
|
36
|
+
addSchema('PikkuNodesMetaOutput', PikkuNodesMetaOutput);
|
|
37
37
|
import * as PikkuFunctionsOutput from './schemas/PikkuFunctionsOutput.schema.json' with { type: 'json' };
|
|
38
38
|
addSchema('PikkuFunctionsOutput', PikkuFunctionsOutput);
|
|
39
39
|
import * as PikkuGatewayOutput from './schemas/PikkuGatewayOutput.schema.json' with { type: 'json' };
|
|
40
40
|
addSchema('PikkuGatewayOutput', PikkuGatewayOutput);
|
|
41
41
|
import * as PikkuHTTPOutput from './schemas/PikkuHTTPOutput.schema.json' with { type: 'json' };
|
|
42
42
|
addSchema('PikkuHTTPOutput', PikkuHTTPOutput);
|
|
43
|
+
import * as PikkuMCPOutput from './schemas/PikkuMCPOutput.schema.json' with { type: 'json' };
|
|
44
|
+
addSchema('PikkuMCPOutput', PikkuMCPOutput);
|
|
43
45
|
import * as PikkuMiddlewareOutput from './schemas/PikkuMiddlewareOutput.schema.json' with { type: 'json' };
|
|
44
46
|
addSchema('PikkuMiddlewareOutput', PikkuMiddlewareOutput);
|
|
45
47
|
import * as PikkuPackageOutput from './schemas/PikkuPackageOutput.schema.json' with { type: 'json' };
|
|
@@ -60,7 +62,5 @@ import * as PikkuTriggerOutput from './schemas/PikkuTriggerOutput.schema.json' w
|
|
|
60
62
|
addSchema('PikkuTriggerOutput', PikkuTriggerOutput);
|
|
61
63
|
import * as PikkuWorkflowOutput from './schemas/PikkuWorkflowOutput.schema.json' with { type: 'json' };
|
|
62
64
|
addSchema('PikkuWorkflowOutput', PikkuWorkflowOutput);
|
|
63
|
-
import * as PikkuMCPOutput from './schemas/PikkuMCPOutput.schema.json' with { type: 'json' };
|
|
64
|
-
addSchema('PikkuMCPOutput', PikkuMCPOutput);
|
|
65
65
|
import * as PikkuCLIConfig from './schemas/PikkuCLIConfig.schema.json' with { type: 'json' };
|
|
66
66
|
addSchema('PikkuCLIConfig', PikkuCLIConfig);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "outDir": { "type": "string" }, "schemaDirectory": { "type": "string" }, "typesDeclarationFile": { "type": "string" }, "functionsFile": { "type": "string" }, "functionsMetaFile": { "type": "string" }, "functionsMetaJsonFile": { "type": "string" }, "functionTypesFile": { "type": "string" }, "httpWiringsFile": { "type": "string" }, "httpWiringMetaFile": { "type": "string" }, "httpWiringMetaJsonFile": { "type": "string" }, "httpMapDeclarationFile": { "type": "string" }, "httpTypesFile": { "type": "string" }, "gatewaysWiringFile": { "type": "string" }, "channelsWiringFile": { "type": "string" }, "channelsWiringMetaFile": { "type": "string" }, "channelsWiringMetaJsonFile": { "type": "string" }, "channelsMapDeclarationFile": { "type": "string" }, "channelsTypesFile": { "type": "string" }, "rpcInternalWiringMetaFile": { "type": "string" }, "rpcInternalWiringMetaJsonFile": { "type": "string" }, "rpcInternalMapDeclarationFile": { "type": "string" }, "rpcMapDeclarationFile": { "type": "string" }, "remoteRpcWorkersFile": { "type": "string" }, "publicRpcFile": { "type": "string" }, "publicAgentFile": { "type": "string" }, "consoleFunctionsFile": { "type": "string" }, "workflowWorkersFile": { "type": "string" }, "triggersTypesFile": { "type": "string" }, "triggersWiringFile": { "type": "string" }, "triggersWiringMetaFile": { "type": "string" }, "triggersWiringMetaJsonFile": { "type": "string" }, "triggerSourcesMetaFile": { "type": "string" }, "triggerSourcesMetaJsonFile": { "type": "string" }, "schedulersWiringFile": { "type": "string" }, "schedulersWiringMetaFile": { "type": "string" }, "schedulersWiringMetaJsonFile": { "type": "string" }, "schedulersTypesFile": { "type": "string" }, "queueWorkersWiringFile": { "type": "string" }, "queueWorkersWiringMetaFile": { "type": "string" }, "queueWorkersWiringMetaJsonFile": { "type": "string" }, "queueMapDeclarationFile": { "type": "string" }, "queueTypesFile": { "type": "string" }, "workflowsWiringFile": { "type": "string" }, "workflowsWiringMetaFile": { "type": "string" }, "workflowsWorkersFile": { "type": "string" }, "workflowMapDeclarationFile": { "type": "string" }, "workflowTypesFile": { "type": "string" }, "workflowMetaDir": { "type": "string" }, "mcpWiringsFile": { "type": "string" }, "mcpWiringsMetaFile": { "type": "string" }, "mcpWiringsMetaJsonFile": { "type": "string" }, "mcpTypesFile": { "type": "string" }, "agentWiringsFile": { "type": "string" }, "agentWiringMetaFile": { "type": "string" }, "agentWiringMetaJsonFile": { "type": "string" }, "agentTypesFile": { "type": "string" }, "agentMapDeclarationFile": { "type": "string" }, "cliWiringsFile": { "type": "string" }, "cliWiringMetaFile": { "type": "string" }, "cliWiringMetaJsonFile": { "type": "string" }, "cliBootstrapFile": { "type": "string" }, "cliTypesFile": { "type": "string" }, "servicesFile": { "type": "string" }, "middlewareFile": { "type": "string" }, "middlewareGroupsMetaJsonFile": { "type": "string" }, "permissionsFile": { "type": "string" }, "permissionsGroupsMetaJsonFile": { "type": "string" }, "bootstrapFile": { "type": "string" }, "packageFile": { "type": "string" }, "addonTypesFile": { "type": "string" }, "nodeTypesFile": { "type": "string" }, "secretTypesFile": { "type": "string" }, "secretsFile": { "type": "string" }, "secretsMetaJsonFile": { "type": "string" }, "variableTypesFile": { "type": "string" }, "variablesFile": { "type": "string" }, "variablesMetaJsonFile": { "type": "string" }, "$schema": { "type": "string" }, "extends": { "type": "string" }, "rootDir": { "type": "string" }, "srcDirectories": { "type": "array", "items": { "type": "string" } }, "ignoreFiles": { "type": "array", "items": { "type": "string" } }, "packageMappings": { "type": "object", "additionalProperties": { "type": "string" } }, "addon": { "anyOf": [{ "type": "boolean" }, { "type": "object", "properties": { "categories": { "type": "array", "items": { "type": "string" } }, "icon": { "type": "string" }, "displayName": { "type": "string" }, "description": { "type": "string" }, "openapi": { "type": "object", "properties": { "version": { "type": "string" }, "hash": { "type": "string" } }, "required": ["version", "hash"], "additionalProperties": false } }, "additionalProperties": false }] }, "addonName": { "type": "string" }, "models": { "type": "object", "additionalProperties": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "model": { "type": "string" }, "temperature": { "type": "number" }, "maxSteps": { "type": "number" } }, "required": ["model"], "additionalProperties": false }] } }, "agentDefaults": { "type": "object", "properties": { "temperature": { "type": "number" }, "maxSteps": { "type": "number" } }, "additionalProperties": false }, "agentOverrides": { "type": "object", "additionalProperties": { "type": "object", "properties": { "model": { "type": "string" }, "temperature": { "type": "number" }, "maxSteps": { "type": "number" } }, "additionalProperties": false } }, "configFile": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "userSessionType": { "type": "string" }, "singletonServicesFactoryType": { "type": "string" }, "wireServicesFactoryType": { "type": "string" }, "configDir": { "type": "string" }, "tsconfig": { "type": "string" }, "clientFiles": { "type": "object", "properties": { "fetchFile": { "type": "string" }, "websocketFile": { "type": "string" }, "rpcWiringsFile": { "type": "string" }, "queueWiringsFile": { "type": "string" }, "mcpJsonFile": { "type": "string" }, "nextBackendFile": { "type": "string" }, "nextHTTPFile": { "type": "string" } }, "additionalProperties": false }, "openAPI": { "type": "object", "properties": { "outputFile": { "type": "string" }, "additionalInfo": { "$ref": "#/definitions/OpenAPISpecInfo" } }, "required": ["outputFile", "additionalInfo"], "additionalProperties": false }, "schema": { "type": "object", "properties": { "additionalProperties": { "type": "boolean" }, "supportsImportAttributes": { "type": "boolean" } }, "additionalProperties": false }, "cli": { "type": "object", "properties": { "entrypoints": { "type": "object", "additionalProperties": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }, { "type": "array", "items": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }] } }] } } }, "additionalProperties": false }, "workflows": { "type": "object", "properties": { "orchestratorQueue": { "type": "string" }, "workerQueue": { "type": "string" } }, "additionalProperties": false }, "scaffold": { "type": "object", "properties": { "addonDir": { "type": "string" }, "functionDir": { "type": "string" }, "wiringDir": { "type": "string" }, "middlewareDir": { "type": "string" }, "permissionDir": { "type": "string" }, "pikkuDir": { "type": "string" }, "rpc": { "$ref": "#/definitions/PikkuScaffoldFeature" }, "console": { "$ref": "#/definitions/PikkuScaffoldFeature" }, "agent": { "$ref": "#/definitions/PikkuScaffoldFeature" }, "workflow": { "$ref": "#/definitions/PikkuScaffoldFeature" } }, "additionalProperties": false }, "forceRequiredServices": { "type": "array", "items": { "type": "string" } }, "schemasFromTypes": { "type": "array", "items": { "type": "string" } }, "stateOutput": { "type": "string" }, "stateInput": { "type": "string" }, "verboseMeta": { "type": "boolean" }, "lint": { "type": "object", "properties": { "servicesNotDestructured": { "type": "string", "enum": ["off", "warn", "error"] }, "wiresNotDestructured": { "type": "string", "enum": ["off", "warn", "error"] } }, "additionalProperties": false }, "addonMetaJsonFile": { "type": "string" }, "globalHTTPPrefix": { "type": "string" }, "filters": { "$ref": "#/definitions/InspectorFilters" } }, "required": ["addonTypesFile", "agentMapDeclarationFile", "agentTypesFile", "agentWiringMetaFile", "agentWiringMetaJsonFile", "agentWiringsFile", "bootstrapFile", "channelsMapDeclarationFile", "channelsTypesFile", "channelsWiringFile", "channelsWiringMetaFile", "channelsWiringMetaJsonFile", "cliBootstrapFile", "cliTypesFile", "cliWiringMetaFile", "cliWiringMetaJsonFile", "cliWiringsFile", "configDir", "consoleFunctionsFile", "filters", "functionTypesFile", "functionsFile", "functionsMetaFile", "functionsMetaJsonFile", "gatewaysWiringFile", "httpMapDeclarationFile", "httpTypesFile", "httpWiringMetaFile", "httpWiringMetaJsonFile", "httpWiringsFile", "mcpTypesFile", "mcpWiringsFile", "mcpWiringsMetaFile", "mcpWiringsMetaJsonFile", "middlewareFile", "middlewareGroupsMetaJsonFile", "nodeTypesFile", "outDir", "packageFile", "packageMappings", "permissionsFile", "permissionsGroupsMetaJsonFile", "publicAgentFile", "publicRpcFile", "queueMapDeclarationFile", "queueTypesFile", "queueWorkersWiringFile", "queueWorkersWiringMetaFile", "queueWorkersWiringMetaJsonFile", "remoteRpcWorkersFile", "rootDir", "rpcInternalMapDeclarationFile", "rpcInternalWiringMetaFile", "rpcInternalWiringMetaJsonFile", "rpcMapDeclarationFile", "schedulersTypesFile", "schedulersWiringFile", "schedulersWiringMetaFile", "schedulersWiringMetaJsonFile", "schemaDirectory", "secretTypesFile", "secretsFile", "secretsMetaJsonFile", "servicesFile", "srcDirectories", "triggerSourcesMetaFile", "triggerSourcesMetaJsonFile", "triggersTypesFile", "triggersWiringFile", "triggersWiringMetaFile", "triggersWiringMetaJsonFile", "tsconfig", "typesDeclarationFile", "variableTypesFile", "variablesFile", "variablesMetaJsonFile", "workflowMapDeclarationFile", "workflowMetaDir", "workflowTypesFile", "workflowWorkersFile", "workflowsWiringFile", "workflowsWiringMetaFile", "workflowsWorkersFile"], "definitions": { "OpenAPISpecInfo": { "type": "object", "properties": { "info": { "type": "object", "properties": { "title": { "type": "string" }, "version": { "type": "string" }, "description": { "type": "string" }, "termsOfService": { "type": "string" }, "contact": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" }, "email": { "type": "string" } }, "additionalProperties": false }, "license": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "required": ["title", "version", "description"], "additionalProperties": false }, "servers": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "description": { "type": "string" } }, "required": ["url"], "additionalProperties": false } }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "externalDocs": { "type": "object", "properties": { "description": { "type": "string" }, "url": { "type": "string" } }, "required": ["url"], "additionalProperties": false }, "securitySchemes": { "type": "object" }, "security": { "type": "array", "items": { "type": "object", "additionalProperties": { "type": "array", "items": {} } } } }, "required": ["info", "servers"], "additionalProperties": false }, "PikkuScaffoldFeature": { "type": ["string", "boolean"], "enum": ["auth", "no-auth", false] }, "InspectorFilters": { "type": "object", "properties": { "names": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "directories": { "type": "array", "items": { "type": "string" } }, "httpRoutes": { "type": "array", "items": { "type": "string" } }, "httpMethods": { "type": "array", "items": { "type": "string" } } }, "additionalProperties": false } } }
|
|
1
|
+
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "outDir": { "type": "string" }, "schemaDirectory": { "type": "string" }, "typesDeclarationFile": { "type": "string" }, "functionsFile": { "type": "string" }, "functionsMetaFile": { "type": "string" }, "functionsMetaJsonFile": { "type": "string" }, "functionTypesFile": { "type": "string" }, "httpWiringsFile": { "type": "string" }, "httpWiringMetaFile": { "type": "string" }, "httpWiringMetaJsonFile": { "type": "string" }, "httpMapDeclarationFile": { "type": "string" }, "httpTypesFile": { "type": "string" }, "gatewaysWiringFile": { "type": "string" }, "channelsWiringFile": { "type": "string" }, "channelsWiringMetaFile": { "type": "string" }, "channelsWiringMetaJsonFile": { "type": "string" }, "channelsMapDeclarationFile": { "type": "string" }, "channelsTypesFile": { "type": "string" }, "rpcInternalWiringMetaFile": { "type": "string" }, "rpcInternalWiringMetaJsonFile": { "type": "string" }, "rpcInternalMapDeclarationFile": { "type": "string" }, "rpcMapDeclarationFile": { "type": "string" }, "remoteRpcWorkersFile": { "type": "string" }, "publicRpcFile": { "type": "string" }, "publicAgentFile": { "type": "string" }, "consoleFunctionsFile": { "type": "string" }, "workflowWorkersFile": { "type": "string" }, "triggersTypesFile": { "type": "string" }, "triggersWiringFile": { "type": "string" }, "triggersWiringMetaFile": { "type": "string" }, "triggersWiringMetaJsonFile": { "type": "string" }, "triggerSourcesMetaFile": { "type": "string" }, "triggerSourcesMetaJsonFile": { "type": "string" }, "schedulersWiringFile": { "type": "string" }, "schedulersWiringMetaFile": { "type": "string" }, "schedulersWiringMetaJsonFile": { "type": "string" }, "schedulersTypesFile": { "type": "string" }, "queueWorkersWiringFile": { "type": "string" }, "queueWorkersWiringMetaFile": { "type": "string" }, "queueWorkersWiringMetaJsonFile": { "type": "string" }, "queueMapDeclarationFile": { "type": "string" }, "queueTypesFile": { "type": "string" }, "workflowsWiringFile": { "type": "string" }, "workflowsWiringMetaFile": { "type": "string" }, "workflowsWorkersFile": { "type": "string" }, "workflowMapDeclarationFile": { "type": "string" }, "workflowTypesFile": { "type": "string" }, "workflowMetaDir": { "type": "string" }, "mcpWiringsFile": { "type": "string" }, "mcpWiringsMetaFile": { "type": "string" }, "mcpWiringsMetaJsonFile": { "type": "string" }, "mcpTypesFile": { "type": "string" }, "agentWiringsFile": { "type": "string" }, "agentWiringMetaFile": { "type": "string" }, "agentWiringMetaJsonFile": { "type": "string" }, "agentTypesFile": { "type": "string" }, "agentMapDeclarationFile": { "type": "string" }, "cliWiringsFile": { "type": "string" }, "cliWiringMetaFile": { "type": "string" }, "cliWiringMetaJsonFile": { "type": "string" }, "cliBootstrapFile": { "type": "string" }, "cliTypesFile": { "type": "string" }, "servicesFile": { "type": "string" }, "middlewareFile": { "type": "string" }, "middlewareGroupsMetaJsonFile": { "type": "string" }, "permissionsFile": { "type": "string" }, "permissionsGroupsMetaJsonFile": { "type": "string" }, "bootstrapFile": { "type": "string" }, "packageFile": { "type": "string" }, "addonTypesFile": { "type": "string" }, "nodeTypesFile": { "type": "string" }, "secretTypesFile": { "type": "string" }, "secretsFile": { "type": "string" }, "secretsMetaJsonFile": { "type": "string" }, "credentialsFile": { "type": "string" }, "credentialsMetaJsonFile": { "type": "string" }, "variableTypesFile": { "type": "string" }, "variablesFile": { "type": "string" }, "variablesMetaJsonFile": { "type": "string" }, "$schema": { "type": "string" }, "extends": { "type": "string" }, "rootDir": { "type": "string" }, "srcDirectories": { "type": "array", "items": { "type": "string" } }, "ignoreFiles": { "type": "array", "items": { "type": "string" } }, "packageMappings": { "type": "object", "additionalProperties": { "type": "string" } }, "addon": { "anyOf": [{ "type": "boolean" }, { "type": "object", "properties": { "categories": { "type": "array", "items": { "type": "string" } }, "icon": { "type": "string" }, "displayName": { "type": "string" }, "description": { "type": "string" }, "openapi": { "type": "object", "properties": { "version": { "type": "string" }, "hash": { "type": "string" } }, "required": ["version", "hash"], "additionalProperties": false } }, "additionalProperties": false }] }, "addonName": { "type": "string" }, "models": { "type": "object", "additionalProperties": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "model": { "type": "string" }, "temperature": { "type": "number" }, "maxSteps": { "type": "number" } }, "required": ["model"], "additionalProperties": false }] } }, "agentDefaults": { "type": "object", "properties": { "temperature": { "type": "number" }, "maxSteps": { "type": "number" } }, "additionalProperties": false }, "agentOverrides": { "type": "object", "additionalProperties": { "type": "object", "properties": { "model": { "type": "string" }, "temperature": { "type": "number" }, "maxSteps": { "type": "number" } }, "additionalProperties": false } }, "configFile": { "type": "string" }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "userSessionType": { "type": "string" }, "singletonServicesFactoryType": { "type": "string" }, "wireServicesFactoryType": { "type": "string" }, "configDir": { "type": "string" }, "tsconfig": { "type": "string" }, "clientFiles": { "type": "object", "properties": { "fetchFile": { "type": "string" }, "websocketFile": { "type": "string" }, "rpcWiringsFile": { "type": "string" }, "queueWiringsFile": { "type": "string" }, "mcpJsonFile": { "type": "string" }, "nextBackendFile": { "type": "string" }, "nextHTTPFile": { "type": "string" } }, "additionalProperties": false }, "openAPI": { "type": "object", "properties": { "outputFile": { "type": "string" }, "additionalInfo": { "$ref": "#/definitions/OpenAPISpecInfo" } }, "required": ["outputFile", "additionalInfo"], "additionalProperties": false }, "schema": { "type": "object", "properties": { "additionalProperties": { "type": "boolean" }, "supportsImportAttributes": { "type": "boolean" } }, "additionalProperties": false }, "cli": { "type": "object", "properties": { "entrypoints": { "type": "object", "additionalProperties": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }, { "type": "array", "items": { "anyOf": [{ "type": "string" }, { "type": "object", "properties": { "type": { "type": "string", "const": "local" }, "path": { "type": "string" } }, "required": ["type", "path"], "additionalProperties": false }, { "type": "object", "properties": { "type": { "type": "string", "const": "channel" }, "name": { "type": "string" }, "route": { "type": "string" }, "wirePath": { "type": "string" }, "path": { "type": "string" } }, "required": ["type", "wirePath"], "additionalProperties": false }] } }] } } }, "additionalProperties": false }, "workflows": { "type": "object", "properties": { "orchestratorQueue": { "type": "string" }, "workerQueue": { "type": "string" } }, "additionalProperties": false }, "scaffold": { "type": "object", "properties": { "addonDir": { "type": "string" }, "functionDir": { "type": "string" }, "wiringDir": { "type": "string" }, "middlewareDir": { "type": "string" }, "permissionDir": { "type": "string" }, "pikkuDir": { "type": "string" }, "rpc": { "$ref": "#/definitions/PikkuScaffoldFeature" }, "console": { "$ref": "#/definitions/PikkuScaffoldFeature" }, "agent": { "$ref": "#/definitions/PikkuScaffoldFeature" }, "workflow": { "$ref": "#/definitions/PikkuScaffoldFeature" } }, "additionalProperties": false }, "forceRequiredServices": { "type": "array", "items": { "type": "string" } }, "schemasFromTypes": { "type": "array", "items": { "type": "string" } }, "stateOutput": { "type": "string" }, "stateInput": { "type": "string" }, "verboseMeta": { "type": "boolean" }, "lint": { "type": "object", "properties": { "servicesNotDestructured": { "type": "string", "enum": ["off", "warn", "error"] }, "wiresNotDestructured": { "type": "string", "enum": ["off", "warn", "error"] } }, "additionalProperties": false }, "addonMetaJsonFile": { "type": "string" }, "globalHTTPPrefix": { "type": "string" }, "filters": { "$ref": "#/definitions/InspectorFilters" } }, "required": ["addonTypesFile", "agentMapDeclarationFile", "agentTypesFile", "agentWiringMetaFile", "agentWiringMetaJsonFile", "agentWiringsFile", "bootstrapFile", "channelsMapDeclarationFile", "channelsTypesFile", "channelsWiringFile", "channelsWiringMetaFile", "channelsWiringMetaJsonFile", "cliBootstrapFile", "cliTypesFile", "cliWiringMetaFile", "cliWiringMetaJsonFile", "cliWiringsFile", "configDir", "consoleFunctionsFile", "credentialsFile", "credentialsMetaJsonFile", "filters", "functionTypesFile", "functionsFile", "functionsMetaFile", "functionsMetaJsonFile", "gatewaysWiringFile", "httpMapDeclarationFile", "httpTypesFile", "httpWiringMetaFile", "httpWiringMetaJsonFile", "httpWiringsFile", "mcpTypesFile", "mcpWiringsFile", "mcpWiringsMetaFile", "mcpWiringsMetaJsonFile", "middlewareFile", "middlewareGroupsMetaJsonFile", "nodeTypesFile", "outDir", "packageFile", "packageMappings", "permissionsFile", "permissionsGroupsMetaJsonFile", "publicAgentFile", "publicRpcFile", "queueMapDeclarationFile", "queueTypesFile", "queueWorkersWiringFile", "queueWorkersWiringMetaFile", "queueWorkersWiringMetaJsonFile", "remoteRpcWorkersFile", "rootDir", "rpcInternalMapDeclarationFile", "rpcInternalWiringMetaFile", "rpcInternalWiringMetaJsonFile", "rpcMapDeclarationFile", "schedulersTypesFile", "schedulersWiringFile", "schedulersWiringMetaFile", "schedulersWiringMetaJsonFile", "schemaDirectory", "secretTypesFile", "secretsFile", "secretsMetaJsonFile", "servicesFile", "srcDirectories", "triggerSourcesMetaFile", "triggerSourcesMetaJsonFile", "triggersTypesFile", "triggersWiringFile", "triggersWiringMetaFile", "triggersWiringMetaJsonFile", "tsconfig", "typesDeclarationFile", "variableTypesFile", "variablesFile", "variablesMetaJsonFile", "workflowMapDeclarationFile", "workflowMetaDir", "workflowTypesFile", "workflowWorkersFile", "workflowsWiringFile", "workflowsWiringMetaFile", "workflowsWorkersFile"], "definitions": { "OpenAPISpecInfo": { "type": "object", "properties": { "info": { "type": "object", "properties": { "title": { "type": "string" }, "version": { "type": "string" }, "description": { "type": "string" }, "termsOfService": { "type": "string" }, "contact": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" }, "email": { "type": "string" } }, "additionalProperties": false }, "license": { "type": "object", "properties": { "name": { "type": "string" }, "url": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "required": ["title", "version", "description"], "additionalProperties": false }, "servers": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" }, "description": { "type": "string" } }, "required": ["url"], "additionalProperties": false } }, "tags": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "description": { "type": "string" } }, "required": ["name"], "additionalProperties": false } }, "externalDocs": { "type": "object", "properties": { "description": { "type": "string" }, "url": { "type": "string" } }, "required": ["url"], "additionalProperties": false }, "securitySchemes": { "type": "object" }, "security": { "type": "array", "items": { "type": "object", "additionalProperties": { "type": "array", "items": {} } } } }, "required": ["info", "servers"], "additionalProperties": false }, "PikkuScaffoldFeature": { "type": ["string", "boolean"], "enum": ["auth", "no-auth", false] }, "InspectorFilters": { "type": "object", "properties": { "names": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "string" } }, "types": { "type": "array", "items": { "type": "string" } }, "directories": { "type": "array", "items": { "type": "string" } }, "httpRoutes": { "type": "array", "items": { "type": "string" } }, "httpMethods": { "type": "array", "items": { "type": "string" } } }, "additionalProperties": false } } }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "name": { "type": "string" }, "displayName": { "type": "string" }, "description": { "type": "string" }, "category": { "type": "string" }, "dir": { "type": "string" }, "secret": { "type": "boolean" }, "variable": { "type": "boolean" }, "oauth": { "type": "boolean" }, "test": { "type": "boolean" }, "openapi": { "type": "string" }, "mcp": { "type": "boolean" } }, "required": ["name"], "additionalProperties": false, "definitions": {} }
|
|
1
|
+
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "properties": { "name": { "type": "string" }, "displayName": { "type": "string" }, "description": { "type": "string" }, "category": { "type": "string" }, "dir": { "type": "string" }, "secret": { "type": "boolean" }, "variable": { "type": "boolean" }, "oauth": { "type": "boolean" }, "credential": { "type": "string" }, "test": { "type": "boolean" }, "openapi": { "type": "string" }, "mcp": { "type": "boolean" } }, "required": ["name"], "additionalProperties": false, "definitions": {} }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.10
|
|
3
3
|
*/
|
|
4
4
|
export { wireVariable } from '@pikku/core/variable';
|
|
5
5
|
export type { CoreVariable, VariableDefinitionMeta, VariableDefinitionsMeta } from '@pikku/core/variable';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This file was generated by @pikku/cli@0.12.
|
|
2
|
+
* This file was generated by @pikku/cli@0.12.10
|
|
3
3
|
*/
|
|
4
4
|
import { WorkflowCancelledException } from '@pikku/core/workflow';
|
|
5
5
|
import { workflow as coreWorkflow, workflowStart as coreWorkflowStart, workflowStatus as coreWorkflowStatus, graphStart as coreGraphStart, } from '@pikku/core/workflow';
|
package/dist/src/cli.wiring.js
CHANGED
|
@@ -269,6 +269,9 @@ wireCLI({
|
|
|
269
269
|
description: 'Include OAuth2 credential wiring and OAuth2Client-based API service',
|
|
270
270
|
default: false,
|
|
271
271
|
},
|
|
272
|
+
credential: {
|
|
273
|
+
description: 'Include per-user credential wiring (apikey, bearer, or oauth2)',
|
|
274
|
+
},
|
|
272
275
|
test: {
|
|
273
276
|
description: 'Include test harness (default: true)',
|
|
274
277
|
default: true,
|
|
@@ -88,6 +88,7 @@ export const all = pikkuVoidFunc({
|
|
|
88
88
|
await rpc.invoke('pikkuNodeTypes', null);
|
|
89
89
|
await rpc.invoke('pikkuSecretDefinitionTypes', null);
|
|
90
90
|
await rpc.invoke('pikkuSecrets', null);
|
|
91
|
+
await rpc.invoke('pikkuCredentials', null);
|
|
91
92
|
await rpc.invoke('pikkuVariableDefinitionTypes', null);
|
|
92
93
|
await rpc.invoke('pikkuVariables', null);
|
|
93
94
|
await rpc.invoke('pikkuAddonTypes', null);
|
|
@@ -7,6 +7,7 @@ export declare const pikkuNewAddon: import("#pikku").PikkuFunctionConfig<{
|
|
|
7
7
|
secret?: boolean;
|
|
8
8
|
variable?: boolean;
|
|
9
9
|
oauth?: boolean;
|
|
10
|
+
credential?: string;
|
|
10
11
|
test?: boolean;
|
|
11
12
|
openapi?: string;
|
|
12
13
|
mcp?: boolean;
|
|
@@ -19,6 +20,7 @@ export declare const pikkuNewAddon: import("#pikku").PikkuFunctionConfig<{
|
|
|
19
20
|
secret?: boolean;
|
|
20
21
|
variable?: boolean;
|
|
21
22
|
oauth?: boolean;
|
|
23
|
+
credential?: string;
|
|
22
24
|
test?: boolean;
|
|
23
25
|
openapi?: string;
|
|
24
26
|
mcp?: boolean;
|
|
@@ -31,6 +33,7 @@ export declare const pikkuNewAddon: import("#pikku").PikkuFunctionConfig<{
|
|
|
31
33
|
secret?: boolean;
|
|
32
34
|
variable?: boolean;
|
|
33
35
|
oauth?: boolean;
|
|
36
|
+
credential?: string;
|
|
34
37
|
test?: boolean;
|
|
35
38
|
openapi?: string;
|
|
36
39
|
mcp?: boolean;
|
|
@@ -111,7 +111,28 @@ ${description}
|
|
|
111
111
|
// export { ${camelName}Operation } from './functions/operation.function.js'
|
|
112
112
|
`;
|
|
113
113
|
// src/services.ts
|
|
114
|
-
if (flags.
|
|
114
|
+
if (flags.credential && flags.credential !== 'oauth2') {
|
|
115
|
+
// Per-user credential: use createWireServices with wire.getCredentials()
|
|
116
|
+
const credField = flags.credential === 'bearer' ? 'token' : 'apiKey';
|
|
117
|
+
files['src/services.ts'] =
|
|
118
|
+
`import { ${pascalName}Service } from './${name}-api.service.js'
|
|
119
|
+
import { pikkuAddonWireServices } from '#pikku'
|
|
120
|
+
|
|
121
|
+
export const createWireServices = pikkuAddonWireServices(
|
|
122
|
+
async (_services, wire) => {
|
|
123
|
+
const credentials = wire.getCredentials()
|
|
124
|
+
const cred = credentials['${camelName}'] as { ${credField}: string } | undefined
|
|
125
|
+
if (!cred?.${credField}) {
|
|
126
|
+
throw new Error('Missing ${camelName} credential')
|
|
127
|
+
}
|
|
128
|
+
const ${camelName} = new ${pascalName}Service(cred)
|
|
129
|
+
|
|
130
|
+
return { ${camelName} }
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
else if (flags.oauth || flags.credential === 'oauth2') {
|
|
115
136
|
files['src/services.ts'] =
|
|
116
137
|
`import { ${pascalName}Service } from './${name}-api.service.js'
|
|
117
138
|
import { pikkuAddonServices } from '#pikku'
|
|
@@ -159,7 +180,61 @@ export const createSingletonServices = pikkuAddonServices(async (
|
|
|
159
180
|
`;
|
|
160
181
|
}
|
|
161
182
|
// src/{name}-api.service.ts
|
|
162
|
-
if (flags.
|
|
183
|
+
if (flags.credential && flags.credential !== 'oauth2') {
|
|
184
|
+
const credField = flags.credential === 'bearer' ? 'token' : 'apiKey';
|
|
185
|
+
const credType = `{ ${credField}: string }`;
|
|
186
|
+
const authHeader = flags.credential === 'bearer'
|
|
187
|
+
? `\`Bearer \${this.creds.token}\``
|
|
188
|
+
: `this.creds.apiKey`;
|
|
189
|
+
const authLine = flags.credential === 'bearer'
|
|
190
|
+
? `'Authorization': ${authHeader},`
|
|
191
|
+
: `'Authorization': \`Bearer \${this.creds.apiKey}\`,`;
|
|
192
|
+
files[`src/${name}-api.service.ts`] =
|
|
193
|
+
`const BASE_URL = 'https://api.example.com/v1'
|
|
194
|
+
|
|
195
|
+
export interface RequestOptions {
|
|
196
|
+
body?: unknown
|
|
197
|
+
qs?: Record<string, string | number | boolean | undefined>
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export class ${pascalName}Service {
|
|
201
|
+
constructor(private creds: ${credType}) {}
|
|
202
|
+
|
|
203
|
+
async request<T>(
|
|
204
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',
|
|
205
|
+
endpoint: string,
|
|
206
|
+
options?: RequestOptions
|
|
207
|
+
): Promise<T> {
|
|
208
|
+
const url = new URL(endpoint, BASE_URL)
|
|
209
|
+
|
|
210
|
+
if (options?.qs) {
|
|
211
|
+
for (const [key, value] of Object.entries(options.qs)) {
|
|
212
|
+
if (value !== undefined) {
|
|
213
|
+
url.searchParams.set(key, String(value))
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const response = await fetch(url.toString(), {
|
|
219
|
+
method,
|
|
220
|
+
headers: {
|
|
221
|
+
'Content-Type': 'application/json',
|
|
222
|
+
${authLine}
|
|
223
|
+
},
|
|
224
|
+
body: options?.body ? JSON.stringify(options.body) : undefined,
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
if (!response.ok) {
|
|
228
|
+
const errorText = await response.text()
|
|
229
|
+
throw new Error(\`${displayName} API error (\${response.status}): \${errorText}\`)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return response.json() as Promise<T>
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
237
|
+
else if (flags.oauth) {
|
|
163
238
|
files[`src/${name}-api.service.ts`] =
|
|
164
239
|
`import { OAuth2Client } from '@pikku/core/oauth2'
|
|
165
240
|
import type { TypedSecretService } from '#pikku/secrets/pikku-secrets.gen.js'
|
|
@@ -349,20 +424,71 @@ export interface SingletonServices extends CoreSingletonServices<Config> {
|
|
|
349
424
|
|
|
350
425
|
export interface Services extends CoreServices<SingletonServices> {}
|
|
351
426
|
`;
|
|
352
|
-
// Conditional: secret file
|
|
353
|
-
if (flags.
|
|
354
|
-
files[`src/${name}.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
427
|
+
// Conditional: credential / secret file
|
|
428
|
+
if (flags.credential === 'apikey') {
|
|
429
|
+
files[`src/${name}.credential.ts`] = `import { z } from 'zod'
|
|
430
|
+
import { wireCredential } from '@pikku/core/credential'
|
|
431
|
+
|
|
432
|
+
export const ${camelName}CredentialSchema = z.object({
|
|
433
|
+
apiKey: z.string().describe('${displayName} API key'),
|
|
434
|
+
})
|
|
435
|
+
|
|
436
|
+
wireCredential({
|
|
437
|
+
name: '${camelName}',
|
|
438
|
+
displayName: '${displayName}',
|
|
439
|
+
description: '${description}',
|
|
440
|
+
type: 'wire',
|
|
441
|
+
schema: ${camelName}CredentialSchema,
|
|
442
|
+
})
|
|
443
|
+
`;
|
|
444
|
+
}
|
|
445
|
+
else if (flags.credential === 'bearer') {
|
|
446
|
+
files[`src/${name}.credential.ts`] = `import { z } from 'zod'
|
|
447
|
+
import { wireCredential } from '@pikku/core/credential'
|
|
448
|
+
|
|
449
|
+
export const ${camelName}CredentialSchema = z.object({
|
|
450
|
+
token: z.string().describe('${displayName} bearer token'),
|
|
451
|
+
})
|
|
452
|
+
|
|
453
|
+
wireCredential({
|
|
454
|
+
name: '${camelName}',
|
|
455
|
+
displayName: '${displayName}',
|
|
456
|
+
description: '${description}',
|
|
457
|
+
type: 'wire',
|
|
458
|
+
schema: ${camelName}CredentialSchema,
|
|
459
|
+
})
|
|
460
|
+
`;
|
|
461
|
+
}
|
|
462
|
+
else if (flags.oauth || flags.credential === 'oauth2') {
|
|
463
|
+
files[`src/${name}.credential.ts`] = `import { z } from 'zod'
|
|
464
|
+
import { wireCredential } from '@pikku/core/credential'
|
|
465
|
+
import { wireSecret } from '@pikku/core/secret'
|
|
466
|
+
|
|
467
|
+
export const ${camelName}TokenSchema = z.object({
|
|
468
|
+
accessToken: z.string(),
|
|
469
|
+
refreshToken: z.string().optional(),
|
|
470
|
+
})
|
|
471
|
+
|
|
472
|
+
wireCredential({
|
|
473
|
+
name: '${camelName}',
|
|
474
|
+
displayName: '${displayName}',
|
|
475
|
+
description: '${description}',
|
|
476
|
+
type: 'wire',
|
|
477
|
+
schema: ${camelName}TokenSchema,
|
|
478
|
+
oauth2: {
|
|
479
|
+
appCredentialSecretId: '${screamingName}_OAUTH_APP',
|
|
480
|
+
tokenSecretId: '${screamingName}_OAUTH_TOKENS',
|
|
481
|
+
authorizationUrl: 'https://example.com/oauth2/authorize',
|
|
482
|
+
tokenUrl: 'https://example.com/oauth2/token',
|
|
483
|
+
scopes: ['read', 'write'],
|
|
484
|
+
},
|
|
485
|
+
})
|
|
486
|
+
|
|
487
|
+
wireSecret({
|
|
488
|
+
name: '${camelName}OAuthApp',
|
|
489
|
+
displayName: '${displayName} OAuth App',
|
|
490
|
+
description: 'OAuth2 app credentials for ${displayName}',
|
|
491
|
+
secretId: '${screamingName}_OAUTH_APP',
|
|
366
492
|
})
|
|
367
493
|
`;
|
|
368
494
|
}
|
|
@@ -575,7 +701,7 @@ async function writeFiles(baseDir, files) {
|
|
|
575
701
|
return written;
|
|
576
702
|
}
|
|
577
703
|
export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
578
|
-
func: async ({ logger, config }, { name, displayName, description, category = 'General', dir, secret = false, variable = false, oauth = false, test = true, openapi, mcp = false, }) => {
|
|
704
|
+
func: async ({ logger, config }, { name, displayName, description, category = 'General', dir, secret = false, variable = false, oauth = false, credential, test = true, openapi, mcp = false, }) => {
|
|
579
705
|
if (!/^[a-z][a-z0-9_-]*$/.test(name)) {
|
|
580
706
|
logger.error(`Invalid addon name "${name}": must start with a lowercase letter and contain only lowercase alphanumerics, hyphens, and underscores`);
|
|
581
707
|
process.exit(1);
|
|
@@ -599,18 +725,28 @@ export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
|
599
725
|
description: resolvedDescription,
|
|
600
726
|
category,
|
|
601
727
|
};
|
|
602
|
-
//
|
|
728
|
+
// Validate credential type if provided
|
|
729
|
+
const credentialType = credential;
|
|
730
|
+
if (credentialType &&
|
|
731
|
+
!['apikey', 'bearer', 'oauth2'].includes(credentialType)) {
|
|
732
|
+
logger.error(`Invalid credential type "${credential}": must be one of apikey, bearer, oauth2`);
|
|
733
|
+
process.exit(1);
|
|
734
|
+
}
|
|
735
|
+
// oauth implies secret (unless credential flag is used); credential oauth2 implies oauth
|
|
736
|
+
const effectiveOAuth = oauth || credentialType === 'oauth2';
|
|
603
737
|
const addonFiles = getAddonFiles(vars, {
|
|
604
|
-
secret: secret ||
|
|
738
|
+
secret: (secret || effectiveOAuth) && !credentialType,
|
|
605
739
|
variable,
|
|
606
|
-
oauth,
|
|
740
|
+
oauth: effectiveOAuth,
|
|
741
|
+
credential: credentialType,
|
|
607
742
|
});
|
|
608
743
|
// If openapi spec provided, generate typed files and merge over scaffold
|
|
609
744
|
if (openapi) {
|
|
610
745
|
const spec = await parseOpenAPISpec(openapi);
|
|
611
746
|
const openapiFiles = generateAddonFromOpenAPI(spec, vars, {
|
|
612
|
-
oauth,
|
|
613
|
-
secret: secret ||
|
|
747
|
+
oauth: effectiveOAuth,
|
|
748
|
+
secret: (secret || effectiveOAuth) && !credentialType,
|
|
749
|
+
credential: credentialType,
|
|
614
750
|
mcp,
|
|
615
751
|
});
|
|
616
752
|
Object.assign(addonFiles, openapiFiles);
|
|
@@ -50,6 +50,7 @@ export function serializeChannelCLI(programName, programMeta, channelFile, funct
|
|
|
50
50
|
import { wireChannel } from '${channelTypesPath}'
|
|
51
51
|
import { pikkuMiddleware${hasAddonFuncs ? ', addon' : ''}, pikkuSessionlessFunc } from '${functionTypesPath}'
|
|
52
52
|
import { generateCommandHelp } from '@pikku/core/cli'
|
|
53
|
+
import { handleRawCLI } from '@pikku/core/cli/channel'
|
|
53
54
|
import { pikkuState } from '@pikku/core/internal'
|
|
54
55
|
${imports}
|
|
55
56
|
|
|
@@ -86,6 +87,17 @@ export const cliHelp = pikkuSessionlessFunc<{ args?: string[] }, { help: string
|
|
|
86
87
|
},
|
|
87
88
|
})
|
|
88
89
|
|
|
90
|
+
export const cliRaw = pikkuSessionlessFunc<{ args: string[] }, { help?: string; result?: unknown; error?: string }>({
|
|
91
|
+
auth: false,
|
|
92
|
+
func: async (services, data: { args: string[] }) => {
|
|
93
|
+
return handleRawCLI({
|
|
94
|
+
programName: '${programName}',
|
|
95
|
+
args: data.args,
|
|
96
|
+
singletonServices: services as any,
|
|
97
|
+
})
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
|
|
89
101
|
wireChannel({
|
|
90
102
|
name: '${finalChannelName}',
|
|
91
103
|
route: '${finalChannelRoute}',
|
|
@@ -96,6 +108,10 @@ wireChannel({
|
|
|
96
108
|
func: cliHelp,
|
|
97
109
|
middleware: [cliCloseOnComplete],
|
|
98
110
|
},
|
|
111
|
+
'__raw': {
|
|
112
|
+
func: cliRaw,
|
|
113
|
+
middleware: [cliCloseOnComplete],
|
|
114
|
+
},
|
|
99
115
|
${Object.entries(commandMap)
|
|
100
116
|
.map(([commandKey, { pikkuFuncId, isAddon }]) => {
|
|
101
117
|
const funcRef = isAddon
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pikkuCredentials: import("#pikku").PikkuFunctionConfig<void, void, "session" | "rpc", import("#pikku").PikkuFunctionSessionless<void, void, "session" | "rpc", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "session" | "rpc", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { pikkuSessionlessFunc } from '#pikku';
|
|
2
|
+
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
3
|
+
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
4
|
+
import { serializeCredentialsTypes } from './serialize-credentials-types.js';
|
|
5
|
+
import { validateAndBuildCredentialDefinitionsMeta } from '@pikku/core/credential';
|
|
6
|
+
export const pikkuCredentials = pikkuSessionlessFunc({
|
|
7
|
+
func: async ({ logger, config, getInspectorState }) => {
|
|
8
|
+
const { credentialsFile, credentialsMetaJsonFile, packageMappings } = config;
|
|
9
|
+
if (!credentialsFile) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const state = await getInspectorState();
|
|
13
|
+
if (!state.credentials || state.credentials.definitions.length === 0) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const content = serializeCredentialsTypes({
|
|
17
|
+
definitions: state.credentials.definitions,
|
|
18
|
+
schemaLookup: state.schemaLookup,
|
|
19
|
+
credentialsFile,
|
|
20
|
+
packageMappings,
|
|
21
|
+
});
|
|
22
|
+
await writeFileInDir(logger, credentialsFile, content);
|
|
23
|
+
if (credentialsMetaJsonFile) {
|
|
24
|
+
const meta = validateAndBuildCredentialDefinitionsMeta(state.credentials.definitions, state.schemaLookup);
|
|
25
|
+
await writeFileInDir(logger, credentialsMetaJsonFile, JSON.stringify(meta, null, 2));
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
middleware: [
|
|
29
|
+
logCommandInfoAndTime({
|
|
30
|
+
commandStart: 'Creating PikkuCredentials types',
|
|
31
|
+
commandEnd: 'Created PikkuCredentials types',
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
});
|