@pikku/cli 0.12.9 → 0.12.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.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.js +1 -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 +3 -0
- 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 +67 -67
- package/dist/.pikku/function/pikku-functions.gen.js +1 -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 +1 -1
- 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 +5 -5
- 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 +3 -3
- 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/new-addon.d.ts +3 -0
- package/dist/src/functions/commands/new-addon.js +129 -10
- package/dist/src/functions/wirings/credentials/pikku-command-credentials.js +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +1 -1
- package/package.json +4 -4
|
@@ -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.11
|
|
3
3
|
*/
|
|
4
4
|
import { CoreAIAgent, PikkuAIMiddlewareHooks } from '@pikku/core/ai-agent';
|
|
5
5
|
import type { PikkuPermission, PikkuMiddleware, Services, PikkuFunctionConfig } from '../function/pikku-function-types.gen.js';
|
|
@@ -277,6 +277,9 @@
|
|
|
277
277
|
"description": "Include OAuth2 credential wiring and OAuth2Client-based API service",
|
|
278
278
|
"default": false
|
|
279
279
|
},
|
|
280
|
+
"credential": {
|
|
281
|
+
"description": "Include per-user credential wiring (apikey, bearer, or oauth2)"
|
|
282
|
+
},
|
|
280
283
|
"test": {
|
|
281
284
|
"description": "Include test harness (default: true)",
|
|
282
285
|
"default": true
|
|
@@ -400,8 +400,8 @@
|
|
|
400
400
|
"PikkuNewAddonInput"
|
|
401
401
|
],
|
|
402
402
|
"outputs": [],
|
|
403
|
-
"contractHash": "
|
|
404
|
-
"inputHash": "
|
|
403
|
+
"contractHash": "9e8ad44aee9190aa",
|
|
404
|
+
"inputHash": "14d80879",
|
|
405
405
|
"outputHash": "77e837d4"
|
|
406
406
|
},
|
|
407
407
|
"enableRpc": {
|
|
@@ -541,71 +541,6 @@
|
|
|
541
541
|
"inputHash": "c0a04edb",
|
|
542
542
|
"outputHash": "aca3832e"
|
|
543
543
|
},
|
|
544
|
-
"pikkuChannels": {
|
|
545
|
-
"pikkuFuncId": "pikkuChannels",
|
|
546
|
-
"functionType": "user",
|
|
547
|
-
"funcWrapper": "pikkuSessionlessFunc",
|
|
548
|
-
"sessionless": true,
|
|
549
|
-
"name": "pikkuChannels",
|
|
550
|
-
"inputSchemaName": null,
|
|
551
|
-
"outputSchemaName": "PikkuChannelsOutput",
|
|
552
|
-
"inputs": [],
|
|
553
|
-
"outputs": [
|
|
554
|
-
"PikkuChannelsOutput"
|
|
555
|
-
],
|
|
556
|
-
"middleware": [
|
|
557
|
-
{
|
|
558
|
-
"type": "wire",
|
|
559
|
-
"name": "logCommandInfoAndTime",
|
|
560
|
-
"inline": false
|
|
561
|
-
}
|
|
562
|
-
],
|
|
563
|
-
"contractHash": "122168631511180b",
|
|
564
|
-
"inputHash": "adc31f8a",
|
|
565
|
-
"outputHash": "910d220a"
|
|
566
|
-
},
|
|
567
|
-
"pikkuChannelTypes": {
|
|
568
|
-
"pikkuFuncId": "pikkuChannelTypes",
|
|
569
|
-
"functionType": "user",
|
|
570
|
-
"funcWrapper": "pikkuSessionlessFunc",
|
|
571
|
-
"sessionless": true,
|
|
572
|
-
"name": "pikkuChannelTypes",
|
|
573
|
-
"inputSchemaName": null,
|
|
574
|
-
"outputSchemaName": null,
|
|
575
|
-
"inputs": [],
|
|
576
|
-
"outputs": [],
|
|
577
|
-
"middleware": [
|
|
578
|
-
{
|
|
579
|
-
"type": "wire",
|
|
580
|
-
"name": "logCommandInfoAndTime",
|
|
581
|
-
"inline": false
|
|
582
|
-
}
|
|
583
|
-
],
|
|
584
|
-
"contractHash": "2b2bc06bcbe06e22",
|
|
585
|
-
"inputHash": "161b06fb",
|
|
586
|
-
"outputHash": "bc44e48a"
|
|
587
|
-
},
|
|
588
|
-
"pikkuChannelsMap": {
|
|
589
|
-
"pikkuFuncId": "pikkuChannelsMap",
|
|
590
|
-
"functionType": "user",
|
|
591
|
-
"funcWrapper": "pikkuSessionlessFunc",
|
|
592
|
-
"sessionless": true,
|
|
593
|
-
"name": "pikkuChannelsMap",
|
|
594
|
-
"inputSchemaName": null,
|
|
595
|
-
"outputSchemaName": null,
|
|
596
|
-
"inputs": [],
|
|
597
|
-
"outputs": [],
|
|
598
|
-
"middleware": [
|
|
599
|
-
{
|
|
600
|
-
"type": "wire",
|
|
601
|
-
"name": "logCommandInfoAndTime",
|
|
602
|
-
"inline": false
|
|
603
|
-
}
|
|
604
|
-
],
|
|
605
|
-
"contractHash": "b6068160a2079ff6",
|
|
606
|
-
"inputHash": "b3525fa4",
|
|
607
|
-
"outputHash": "283f1aa2"
|
|
608
|
-
},
|
|
609
544
|
"pikkuCLIEntry": {
|
|
610
545
|
"pikkuFuncId": "pikkuCLIEntry",
|
|
611
546
|
"functionType": "user",
|
|
@@ -738,6 +673,71 @@
|
|
|
738
673
|
"inputHash": "4be7b8bd",
|
|
739
674
|
"outputHash": "fca2b5eb"
|
|
740
675
|
},
|
|
676
|
+
"pikkuChannels": {
|
|
677
|
+
"pikkuFuncId": "pikkuChannels",
|
|
678
|
+
"functionType": "user",
|
|
679
|
+
"funcWrapper": "pikkuSessionlessFunc",
|
|
680
|
+
"sessionless": true,
|
|
681
|
+
"name": "pikkuChannels",
|
|
682
|
+
"inputSchemaName": null,
|
|
683
|
+
"outputSchemaName": "PikkuChannelsOutput",
|
|
684
|
+
"inputs": [],
|
|
685
|
+
"outputs": [
|
|
686
|
+
"PikkuChannelsOutput"
|
|
687
|
+
],
|
|
688
|
+
"middleware": [
|
|
689
|
+
{
|
|
690
|
+
"type": "wire",
|
|
691
|
+
"name": "logCommandInfoAndTime",
|
|
692
|
+
"inline": false
|
|
693
|
+
}
|
|
694
|
+
],
|
|
695
|
+
"contractHash": "122168631511180b",
|
|
696
|
+
"inputHash": "adc31f8a",
|
|
697
|
+
"outputHash": "910d220a"
|
|
698
|
+
},
|
|
699
|
+
"pikkuChannelTypes": {
|
|
700
|
+
"pikkuFuncId": "pikkuChannelTypes",
|
|
701
|
+
"functionType": "user",
|
|
702
|
+
"funcWrapper": "pikkuSessionlessFunc",
|
|
703
|
+
"sessionless": true,
|
|
704
|
+
"name": "pikkuChannelTypes",
|
|
705
|
+
"inputSchemaName": null,
|
|
706
|
+
"outputSchemaName": null,
|
|
707
|
+
"inputs": [],
|
|
708
|
+
"outputs": [],
|
|
709
|
+
"middleware": [
|
|
710
|
+
{
|
|
711
|
+
"type": "wire",
|
|
712
|
+
"name": "logCommandInfoAndTime",
|
|
713
|
+
"inline": false
|
|
714
|
+
}
|
|
715
|
+
],
|
|
716
|
+
"contractHash": "2b2bc06bcbe06e22",
|
|
717
|
+
"inputHash": "161b06fb",
|
|
718
|
+
"outputHash": "bc44e48a"
|
|
719
|
+
},
|
|
720
|
+
"pikkuChannelsMap": {
|
|
721
|
+
"pikkuFuncId": "pikkuChannelsMap",
|
|
722
|
+
"functionType": "user",
|
|
723
|
+
"funcWrapper": "pikkuSessionlessFunc",
|
|
724
|
+
"sessionless": true,
|
|
725
|
+
"name": "pikkuChannelsMap",
|
|
726
|
+
"inputSchemaName": null,
|
|
727
|
+
"outputSchemaName": null,
|
|
728
|
+
"inputs": [],
|
|
729
|
+
"outputs": [],
|
|
730
|
+
"middleware": [
|
|
731
|
+
{
|
|
732
|
+
"type": "wire",
|
|
733
|
+
"name": "logCommandInfoAndTime",
|
|
734
|
+
"inline": false
|
|
735
|
+
}
|
|
736
|
+
],
|
|
737
|
+
"contractHash": "b6068160a2079ff6",
|
|
738
|
+
"inputHash": "b3525fa4",
|
|
739
|
+
"outputHash": "283f1aa2"
|
|
740
|
+
},
|
|
741
741
|
"pikkuCredentials": {
|
|
742
742
|
"pikkuFuncId": "pikkuCredentials",
|
|
743
743
|
"functionType": "user",
|
|
@@ -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.11
|
|
3
3
|
*/
|
|
4
4
|
import { CorePikkuWebsocket, CorePikkuRouteHandler } from '@pikku/websocket';
|
|
5
5
|
import { ChannelDefaultHandlerOf, ChannelWiringHandlerOf, ChannelsMap } from './channel/pikku-channels-map.gen.d.js';
|
|
@@ -41,22 +41,22 @@
|
|
|
41
41
|
"pikkuNodeTypes": "pikkuNodeTypes",
|
|
42
42
|
"pikkuNodesMeta": "pikkuNodesMeta",
|
|
43
43
|
"pikkuCredentials": "pikkuCredentials",
|
|
44
|
+
"pikkuGateway": "pikkuGateway",
|
|
45
|
+
"pikkuHTTPMap": "pikkuHTTPMap",
|
|
46
|
+
"pikkuHTTP": "pikkuHTTP",
|
|
47
|
+
"pikkuHTTPTypes": "pikkuHTTPTypes",
|
|
44
48
|
"pikkuAddonTypes": "pikkuAddonTypes",
|
|
45
49
|
"pikkuFunctionTypesSplit": "pikkuFunctionTypesSplit",
|
|
46
50
|
"pikkuFunctionTypes": "pikkuFunctionTypes",
|
|
47
51
|
"pikkuFunctions": "pikkuFunctions",
|
|
48
52
|
"pikkuServices": "pikkuServices",
|
|
49
|
-
"pikkuGateway": "pikkuGateway",
|
|
50
|
-
"pikkuHTTPMap": "pikkuHTTPMap",
|
|
51
|
-
"pikkuHTTP": "pikkuHTTP",
|
|
52
|
-
"pikkuHTTPTypes": "pikkuHTTPTypes",
|
|
53
53
|
"pikkuMCPJSON": "pikkuMCPJSON",
|
|
54
54
|
"pikkuMCPTypes": "pikkuMCPTypes",
|
|
55
55
|
"pikkuMCP": "pikkuMCP",
|
|
56
|
-
"pikkuMiddleware": "pikkuMiddleware",
|
|
57
56
|
"pikkuSecretDefinitionTypes": "pikkuSecretDefinitionTypes",
|
|
58
57
|
"pikkuVariableDefinitionTypes": "pikkuVariableDefinitionTypes",
|
|
59
58
|
"pikkuPackage": "pikkuPackage",
|
|
59
|
+
"pikkuMiddleware": "pikkuMiddleware",
|
|
60
60
|
"pikkuPermissions": "pikkuPermissions",
|
|
61
61
|
"pikkuQueueMap": "pikkuQueueMap",
|
|
62
62
|
"pikkuQueueTypes": "pikkuQueueTypes",
|
|
@@ -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.11
|
|
3
3
|
*/
|
|
4
4
|
import { addSchema } from '@pikku/core/schema';
|
|
5
5
|
import * as PikkuSchemasOutput from './schemas/PikkuSchemasOutput.schema.json' with { type: 'json' };
|
|
@@ -26,14 +26,14 @@ import * as PikkuAIAgentOutput from './schemas/PikkuAIAgentOutput.schema.json' w
|
|
|
26
26
|
addSchema('PikkuAIAgentOutput', PikkuAIAgentOutput);
|
|
27
27
|
import * as PikkuPublicAgentOutput from './schemas/PikkuPublicAgentOutput.schema.json' with { type: 'json' };
|
|
28
28
|
addSchema('PikkuPublicAgentOutput', PikkuPublicAgentOutput);
|
|
29
|
-
import * as PikkuChannelsOutput from './schemas/PikkuChannelsOutput.schema.json' with { type: 'json' };
|
|
30
|
-
addSchema('PikkuChannelsOutput', PikkuChannelsOutput);
|
|
31
29
|
import * as PikkuCLIOutput from './schemas/PikkuCLIOutput.schema.json' with { type: 'json' };
|
|
32
30
|
addSchema('PikkuCLIOutput', PikkuCLIOutput);
|
|
33
31
|
import * as PikkuConsoleFunctionsOutput from './schemas/PikkuConsoleFunctionsOutput.schema.json' with { type: 'json' };
|
|
34
32
|
addSchema('PikkuConsoleFunctionsOutput', PikkuConsoleFunctionsOutput);
|
|
35
33
|
import * as PikkuNodesMetaOutput from './schemas/PikkuNodesMetaOutput.schema.json' with { type: 'json' };
|
|
36
34
|
addSchema('PikkuNodesMetaOutput', PikkuNodesMetaOutput);
|
|
35
|
+
import * as PikkuChannelsOutput from './schemas/PikkuChannelsOutput.schema.json' with { type: 'json' };
|
|
36
|
+
addSchema('PikkuChannelsOutput', PikkuChannelsOutput);
|
|
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' };
|
|
@@ -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.11
|
|
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.11
|
|
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,
|
|
@@ -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 ({ variables }, 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, variables)
|
|
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,8 +424,42 @@ 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.
|
|
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') {
|
|
354
463
|
files[`src/${name}.credential.ts`] = `import { z } from 'zod'
|
|
355
464
|
import { wireCredential } from '@pikku/core/credential'
|
|
356
465
|
import { wireSecret } from '@pikku/core/secret'
|
|
@@ -592,7 +701,7 @@ async function writeFiles(baseDir, files) {
|
|
|
592
701
|
return written;
|
|
593
702
|
}
|
|
594
703
|
export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
595
|
-
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, }) => {
|
|
596
705
|
if (!/^[a-z][a-z0-9_-]*$/.test(name)) {
|
|
597
706
|
logger.error(`Invalid addon name "${name}": must start with a lowercase letter and contain only lowercase alphanumerics, hyphens, and underscores`);
|
|
598
707
|
process.exit(1);
|
|
@@ -616,18 +725,28 @@ export const pikkuNewAddon = pikkuSessionlessFunc({
|
|
|
616
725
|
description: resolvedDescription,
|
|
617
726
|
category,
|
|
618
727
|
};
|
|
619
|
-
//
|
|
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';
|
|
620
737
|
const addonFiles = getAddonFiles(vars, {
|
|
621
|
-
secret: secret ||
|
|
738
|
+
secret: (secret || effectiveOAuth) && !credentialType,
|
|
622
739
|
variable,
|
|
623
|
-
oauth,
|
|
740
|
+
oauth: effectiveOAuth,
|
|
741
|
+
credential: credentialType,
|
|
624
742
|
});
|
|
625
743
|
// If openapi spec provided, generate typed files and merge over scaffold
|
|
626
744
|
if (openapi) {
|
|
627
745
|
const spec = await parseOpenAPISpec(openapi);
|
|
628
746
|
const openapiFiles = generateAddonFromOpenAPI(spec, vars, {
|
|
629
|
-
oauth,
|
|
630
|
-
secret: secret ||
|
|
747
|
+
oauth: effectiveOAuth,
|
|
748
|
+
secret: (secret || effectiveOAuth) && !credentialType,
|
|
749
|
+
credential: credentialType,
|
|
631
750
|
mcp,
|
|
632
751
|
});
|
|
633
752
|
Object.assign(addonFiles, openapiFiles);
|
|
@@ -10,7 +10,7 @@ export const pikkuCredentials = pikkuSessionlessFunc({
|
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const state = await getInspectorState();
|
|
13
|
-
if (state.credentials.definitions.length === 0) {
|
|
13
|
+
if (!state.credentials || state.credentials.definitions.length === 0) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
const content = serializeCredentialsTypes({
|
|
@@ -21,7 +21,7 @@ export const pikkuAddonTypes = pikkuSessionlessFunc({
|
|
|
21
21
|
const configTypeImport = pikkuConfigType
|
|
22
22
|
? `import type { ${pikkuConfigType.type} } from '${getFileImportRelativePath(addonTypesFile, pikkuConfigType.typePath, packageMappings)}'`
|
|
23
23
|
: '// Config type not found, will use fallback';
|
|
24
|
-
const content = serializeAddonTypes(`import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(addonTypesFile, singletonServicesType.typePath, packageMappings)}'`, singletonServicesType.type, configTypeImport, `import type { RequiredSingletonServices } from '${getFileImportRelativePath(addonTypesFile, servicesFile, packageMappings)}'`, `import { TypedSecretService } from '${getFileImportRelativePath(addonTypesFile, secretsFile, packageMappings)}'`, `import { TypedVariablesService } from '${getFileImportRelativePath(addonTypesFile, variablesFile, packageMappings)}'`, visitState.credentials
|
|
24
|
+
const content = serializeAddonTypes(`import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(addonTypesFile, singletonServicesType.typePath, packageMappings)}'`, singletonServicesType.type, configTypeImport, `import type { RequiredSingletonServices } from '${getFileImportRelativePath(addonTypesFile, servicesFile, packageMappings)}'`, `import { TypedSecretService } from '${getFileImportRelativePath(addonTypesFile, secretsFile, packageMappings)}'`, `import { TypedVariablesService } from '${getFileImportRelativePath(addonTypesFile, variablesFile, packageMappings)}'`, visitState.credentials?.definitions?.length > 0
|
|
25
25
|
? `import { TypedCredentialService } from '${getFileImportRelativePath(addonTypesFile, credentialsFile, packageMappings)}'`
|
|
26
26
|
: null);
|
|
27
27
|
await writeFileInDir(logger, addonTypesFile, content);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.11",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"imports": {
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@openapi-contrib/json-schema-to-openapi-schema": "^4.3.1",
|
|
29
|
-
"@pikku/core": "^0.12.
|
|
30
|
-
"@pikku/inspector": "^0.12.
|
|
31
|
-
"@pikku/openapi-parser": "^0.12.
|
|
29
|
+
"@pikku/core": "^0.12.12",
|
|
30
|
+
"@pikku/inspector": "^0.12.6",
|
|
31
|
+
"@pikku/openapi-parser": "^0.12.8",
|
|
32
32
|
"@types/cookie": "^1.0.0",
|
|
33
33
|
"@types/json-schema": "^7.0.15",
|
|
34
34
|
"chalk": "^5.6.2",
|