@pikku/cli 0.12.0 → 0.12.1
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-DiYPTQU_.js +676 -0
- package/console-app/index.html +6 -1
- package/dist/.pikku/agent/pikku-agent-types.gen.d.ts +30 -3
- package/dist/.pikku/agent/pikku-agent-types.gen.js +13 -0
- package/dist/.pikku/agent/pikku-agent-wirings-meta.gen.js +2 -2
- 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 +2 -2
- 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 +57 -3
- 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 +2 -2
- package/dist/.pikku/cli/pikku-cli-wirings-meta.gen.json +228 -10
- 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 +14 -11
- package/dist/.pikku/function/pikku-function-types.gen.js +25 -13
- package/dist/.pikku/function/pikku-functions-meta.gen.js +2 -2
- package/dist/.pikku/function/pikku-functions-meta.gen.json +359 -105
- package/dist/.pikku/function/pikku-functions.gen.js +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/.pikku/rpc/pikku-rpc-wirings-meta.internal.gen.json +15 -6
- 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 +2 -2
- 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 +15 -5
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuNewAddonInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewFunctionInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewMiddlewareInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewPermissionInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuNewWiringInput.schema.json +1 -0
- 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 +2 -2
- 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 +190 -9
- package/dist/src/functions/commands/all.js +6 -6
- package/dist/src/functions/commands/info.d.ts +9 -0
- package/dist/src/functions/commands/info.js +283 -0
- package/dist/src/functions/commands/new-addon.d.ts +34 -0
- package/dist/src/functions/commands/new-addon.js +636 -0
- package/dist/src/functions/commands/new-function.d.ts +10 -0
- package/dist/src/functions/commands/new-function.js +79 -0
- package/dist/src/functions/commands/new-middleware.d.ts +10 -0
- package/dist/src/functions/commands/new-middleware.js +48 -0
- package/dist/src/functions/commands/new-permission.d.ts +10 -0
- package/dist/src/functions/commands/new-permission.js +45 -0
- package/dist/src/functions/commands/new-wiring.d.ts +10 -0
- package/dist/src/functions/commands/new-wiring.js +102 -0
- package/dist/src/functions/commands/pikku-command-bootstrap.js +11 -40
- package/dist/src/functions/commands/versions-check.js +85 -3
- package/dist/src/functions/commands/versions-update.js +1 -1
- package/dist/src/functions/runtimes/nextjs/serialize-nextjs-backend-wrapper.js +0 -4
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent-types.js +3 -2
- package/dist/src/functions/wirings/ai-agent/pikku-command-ai-agent.js +5 -5
- package/dist/src/functions/wirings/ai-agent/serialize-agent-map.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.d.ts +1 -1
- package/dist/src/functions/wirings/ai-agent/serialize-ai-agent-types.js +48 -3
- package/dist/src/functions/wirings/ai-agent/serialize-public-agent.js +30 -52
- package/dist/src/functions/wirings/channels/pikku-channels.js +1 -1
- package/dist/src/functions/wirings/channels/pikku-command-channel-types.js +2 -2
- package/dist/src/functions/wirings/channels/pikku-command-channels.js +1 -1
- package/dist/src/functions/wirings/channels/serialize-typed-channel-map.d.ts +4 -4
- package/dist/src/functions/wirings/cli/pikku-command-cli.js +1 -1
- package/dist/src/functions/wirings/cli/serialize-channel-cli-client.d.ts +2 -2
- package/dist/src/functions/wirings/cli/serialize-channel-cli.d.ts +1 -1
- package/dist/src/functions/wirings/cli/serialize-local-cli-bootstrap.d.ts +1 -1
- package/dist/src/functions/wirings/console/pikku-command-console-functions.js +2 -1
- package/dist/src/functions/wirings/console/pikku-command-nodes-meta.js +1 -1
- package/dist/src/functions/wirings/console/serialize-console-functions.d.ts +1 -1
- package/dist/src/functions/wirings/console/serialize-console-functions.js +18 -157
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/pikku-command-addon-types.js +33 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types-split.js +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +4 -4
- package/dist/src/functions/wirings/functions/pikku-command-functions.js +8 -14
- package/dist/src/functions/wirings/functions/schemas.js +1 -1
- package/dist/src/functions/wirings/functions/serialize-addon-types.d.ts +1 -0
- package/dist/src/functions/wirings/functions/{serialize-external-types.js → serialize-addon-types.js} +16 -15
- package/dist/src/functions/wirings/functions/serialize-function-imports.d.ts +3 -3
- package/dist/src/functions/wirings/functions/serialize-function-imports.js +3 -3
- package/dist/src/functions/wirings/functions/serialize-function-types.js +28 -14
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.d.ts +1 -1
- package/dist/src/functions/wirings/functions/serialize-pikku-types-hub.js +2 -2
- package/dist/src/functions/wirings/http/pikku-command-http-routes.js +1 -1
- package/dist/src/functions/wirings/http/pikku-http-routes.js +1 -1
- package/dist/src/functions/wirings/http/serialize-typed-http-map.d.ts +3 -3
- package/dist/src/functions/wirings/mcp/pikku-command-mcp.js +1 -1
- package/dist/src/functions/wirings/package/pikku-command-package.js +5 -5
- package/dist/src/functions/wirings/package/serialize-package.js +2 -2
- package/dist/src/functions/wirings/permissions/pikku-command-permissions.js +0 -5
- package/dist/src/functions/wirings/queue/serialize-queue-map.d.ts +2 -2
- package/dist/src/functions/wirings/queue/serialize-queue-meta.d.ts +1 -1
- package/dist/src/functions/wirings/rpc/pikku-command-rpc-map.js +6 -6
- package/dist/src/functions/wirings/rpc/pikku-command-rpc.js +2 -4
- package/dist/src/functions/wirings/rpc/serialize-public-rpc.js +25 -16
- package/dist/src/functions/wirings/rpc/serialize-rpc-wrapper.js +43 -7
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.d.ts +8 -3
- package/dist/src/functions/wirings/rpc/serialize-typed-rpc-map.js +41 -31
- package/dist/src/functions/wirings/scheduler/serialize-scheduler-meta.d.ts +1 -1
- package/dist/src/functions/wirings/secrets/serialize-secrets-types.d.ts +2 -2
- package/dist/src/functions/wirings/triggers/serialize-trigger-meta.d.ts +1 -1
- package/dist/src/functions/wirings/triggers/serialize-trigger-meta.js +2 -2
- package/dist/src/functions/wirings/variables/serialize-variables-types.d.ts +2 -2
- package/dist/src/functions/wirings/workflow/pikku-command-workflow.js +2 -2
- package/dist/src/functions/wirings/workflow/serialize-workflow-map.d.ts +2 -2
- package/dist/src/functions/wirings/workflow/serialize-workflow-meta.js +2 -2
- package/dist/src/services/cli-logger-forwarder.service.d.ts +4 -3
- package/dist/src/services/cli-logger.service.d.ts +3 -2
- package/dist/src/services.d.ts +4 -3
- package/dist/src/services.js +2 -3
- package/dist/src/utils/check-required-types.d.ts +1 -1
- package/dist/src/utils/contract-versions.d.ts +1 -1
- package/dist/src/utils/file-writer.d.ts +6 -1
- package/dist/src/utils/file-writer.js +14 -1
- package/dist/src/utils/generate-bootstrap-file.d.ts +2 -2
- package/dist/src/utils/openapi/codegen.d.ts +19 -0
- package/dist/src/utils/openapi/codegen.js +288 -0
- package/dist/src/utils/openapi/naming.d.ts +30 -0
- package/dist/src/utils/openapi/naming.js +167 -0
- package/dist/src/utils/openapi/parse-openapi.d.ts +36 -0
- package/dist/src/utils/openapi/parse-openapi.js +196 -0
- package/dist/src/utils/openapi/zod-codegen.d.ts +53 -0
- package/dist/src/utils/openapi/zod-codegen.js +251 -0
- package/dist/src/utils/pikku-cli-config.d.ts +2 -2
- package/dist/src/utils/pikku-cli-config.js +8 -14
- package/dist/src/utils/pikku-files-and-methods.d.ts +1 -1
- package/dist/src/utils/pikku-files-and-methods.js +1 -1
- package/dist/src/utils/serialize-import-map.d.ts +2 -2
- package/dist/src/utils/serialize-import-map.js +1 -1
- package/dist/src/utils/serialize-meta-ts.js +1 -1
- package/dist/src/utils/serialize-schemas.d.ts +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/console-app/assets/index-C19L3UJu.js +0 -637
- package/dist/src/functions/wirings/functions/pikku-command-external-types.d.ts +0 -1
- package/dist/src/functions/wirings/functions/pikku-command-external-types.js +0 -33
- package/dist/src/functions/wirings/functions/serialize-external-types.d.ts +0 -1
|
@@ -6,7 +6,7 @@ export const serializeTriggerMetaTS = (triggerMeta, jsonImportPath, supportsImpo
|
|
|
6
6
|
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
7
7
|
: `import metaData from '${jsonImportPath}'`;
|
|
8
8
|
const serializedOutput = [];
|
|
9
|
-
serializedOutput.push("import { pikkuState } from '@pikku/core'");
|
|
9
|
+
serializedOutput.push("import { pikkuState } from '@pikku/core/internal'");
|
|
10
10
|
serializedOutput.push("import { TriggerMeta } from '@pikku/core/trigger'");
|
|
11
11
|
serializedOutput.push(importStatement);
|
|
12
12
|
serializedOutput.push('');
|
|
@@ -26,7 +26,7 @@ export const serializeTriggerSourceMetaTS = (sourceMeta, jsonImportPath, support
|
|
|
26
26
|
? `import metaData from '${jsonImportPath}' with { type: 'json' }`
|
|
27
27
|
: `import metaData from '${jsonImportPath}'`;
|
|
28
28
|
const serializedOutput = [];
|
|
29
|
-
serializedOutput.push("import { pikkuState } from '@pikku/core'");
|
|
29
|
+
serializedOutput.push("import { pikkuState } from '@pikku/core/internal'");
|
|
30
30
|
serializedOutput.push("import { TriggerSourceMeta } from '@pikku/core/trigger'");
|
|
31
31
|
serializedOutput.push(importStatement);
|
|
32
32
|
serializedOutput.push('');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { VariableDefinitions } from '@pikku/core/variable';
|
|
2
|
-
import { SchemaRef } from '@pikku/inspector';
|
|
1
|
+
import type { VariableDefinitions } from '@pikku/core/variable';
|
|
2
|
+
import type { SchemaRef } from '@pikku/inspector';
|
|
3
3
|
export interface SerializeVariablesOptions {
|
|
4
4
|
definitions: VariableDefinitions;
|
|
5
5
|
schemaLookup: Map<string, SchemaRef>;
|
|
@@ -37,10 +37,10 @@ export const pikkuWorkflow = pikkuSessionlessFunc({
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
if (workflowsWiringMetaFile && workflowMetaDir) {
|
|
40
|
-
await writeFileInDir(logger, workflowsWiringMetaFile, serializeWorkflowMeta(workflowsWiringMetaFile, workflowMetaDir, allWorkflowNames, packageMappings, schema?.supportsImportAttributes ?? false, config.
|
|
40
|
+
await writeFileInDir(logger, workflowsWiringMetaFile, serializeWorkflowMeta(workflowsWiringMetaFile, workflowMetaDir, allWorkflowNames, packageMappings, schema?.supportsImportAttributes ?? false, config.addonName));
|
|
41
41
|
}
|
|
42
42
|
const metaImportPath = getFileImportRelativePath(workflowsWiringFile, workflowsWiringMetaFile, packageMappings);
|
|
43
|
-
await writeFileInDir(logger, workflowsWiringFile, serializeWorkflowRegistration(workflowsWiringFile, metaImportPath, allWorkflowNames, workflows.files, workflows.graphFiles, packageMappings, config.
|
|
43
|
+
await writeFileInDir(logger, workflowsWiringFile, serializeWorkflowRegistration(workflowsWiringFile, metaImportPath, allWorkflowNames, workflows.files, workflows.graphFiles, packageMappings, config.addonName));
|
|
44
44
|
const functionTypesImportPath = getFileImportRelativePath(workflowTypesFile, functionTypesFile, packageMappings);
|
|
45
45
|
const rpcMapImportPath = getFileImportRelativePath(workflowTypesFile, config.rpcInternalMapDeclarationFile, packageMappings);
|
|
46
46
|
const workflowMapImportPath = getFileImportRelativePath(workflowTypesFile, workflowMapDeclarationFile, packageMappings);
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
import type { WorkflowsMeta } from '@pikku/core/workflow';
|
|
5
5
|
import { type TypesMap } from '@pikku/inspector';
|
|
6
6
|
import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph';
|
|
7
|
-
import { FunctionsMeta } from '@pikku/core';
|
|
8
|
-
import { Logger } from '@pikku/core/services';
|
|
7
|
+
import type { FunctionsMeta } from '@pikku/core';
|
|
8
|
+
import type { Logger } from '@pikku/core/services';
|
|
9
9
|
export declare const serializeWorkflowMap: (logger: Logger, relativeToPath: string, packageMappings: Record<string, string>, typesMap: TypesMap, functionsMeta: FunctionsMeta, workflowsMeta: WorkflowsMeta, graphMeta: SerializedWorkflowGraphs) => string;
|
|
@@ -7,7 +7,7 @@ import { sanitizeTypeName } from '@pikku/inspector';
|
|
|
7
7
|
export const serializeWorkflowMeta = (outputPath, metaDir, workflowNames, packageMappings, supportsImportAttributes, packageName) => {
|
|
8
8
|
const pkg = packageName ? `'${packageName}'` : 'null';
|
|
9
9
|
if (workflowNames.length === 0) {
|
|
10
|
-
return `import { pikkuState } from '@pikku/core'
|
|
10
|
+
return `import { pikkuState } from '@pikku/core/internal'
|
|
11
11
|
import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'
|
|
12
12
|
|
|
13
13
|
const workflowsMeta: SerializedWorkflowGraphs = {}
|
|
@@ -31,7 +31,7 @@ pikkuState(${pkg}, 'workflows', 'meta', workflowsMeta)`;
|
|
|
31
31
|
return ` '${name}': ${sanitizedIdentifier}Meta,`;
|
|
32
32
|
})
|
|
33
33
|
.join('\n');
|
|
34
|
-
return `import { pikkuState } from '@pikku/core'
|
|
34
|
+
return `import { pikkuState } from '@pikku/core/internal'
|
|
35
35
|
import type { SerializedWorkflowGraphs } from '@pikku/inspector/workflow-graph'
|
|
36
36
|
|
|
37
37
|
${imports}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Logger
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { Logger } from '@pikku/core/services';
|
|
2
|
+
import { LogLevel } from '@pikku/core/services';
|
|
3
|
+
import type { PikkuChannel } from '@pikku/core/channel';
|
|
4
|
+
import type { ErrorCode } from '@pikku/inspector';
|
|
4
5
|
/**
|
|
5
6
|
* Log message structure sent through the channel
|
|
6
7
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Logger
|
|
2
|
-
import {
|
|
1
|
+
import type { Logger } from '@pikku/core/services';
|
|
2
|
+
import { LogLevel } from '@pikku/core/services';
|
|
3
|
+
import type { ErrorCode } from '@pikku/inspector';
|
|
3
4
|
export declare class CLILogger implements Logger {
|
|
4
5
|
private silent;
|
|
5
6
|
private level;
|
package/dist/src/services.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Config, Services, SingletonServices, UserSession } from '../types/application-types.js';
|
|
2
|
-
import { CreateConfig
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import type { CreateConfig } from '@pikku/core';
|
|
3
|
+
import type { CreateWireServices, CreateSingletonServices } from '@pikku/core/internal';
|
|
4
|
+
import type { PikkuCLIConfig } from '../types/config.js';
|
|
5
|
+
import type { ForwardedLogMessage } from './services/cli-logger-forwarder.service.js';
|
|
5
6
|
/**
|
|
6
7
|
* Default CLI renderer that logs output using the logger
|
|
7
8
|
*/
|
package/dist/src/services.js
CHANGED
|
@@ -5,7 +5,7 @@ import { getPikkuCLIConfig } from './utils/pikku-cli-config.js';
|
|
|
5
5
|
import { inspect, serializeInspectorState, deserializeInspectorState, filterInspectorState, getInitialInspectorState, ErrorCode, } from '@pikku/inspector';
|
|
6
6
|
import { glob } from 'tinyglobby';
|
|
7
7
|
import path from 'path';
|
|
8
|
-
import { CLILoggerForwarder
|
|
8
|
+
import { CLILoggerForwarder } from './services/cli-logger-forwarder.service.js';
|
|
9
9
|
import { readFile, writeFile } from 'fs/promises';
|
|
10
10
|
import { loadManifest } from './utils/contract-versions.js';
|
|
11
11
|
import { join } from 'path';
|
|
@@ -209,7 +209,7 @@ export const createSingletonServices = async (config) => {
|
|
|
209
209
|
unfilteredState = await inspect(logger, wiringFiles, {
|
|
210
210
|
setupOnly,
|
|
211
211
|
rootDir,
|
|
212
|
-
|
|
212
|
+
isAddon: config.addon,
|
|
213
213
|
types: {
|
|
214
214
|
configFileType: config.configFile,
|
|
215
215
|
userSessionType: config.userSessionType,
|
|
@@ -217,7 +217,6 @@ export const createSingletonServices = async (config) => {
|
|
|
217
217
|
wireServicesFactoryType: config.wireServicesFactoryType,
|
|
218
218
|
},
|
|
219
219
|
tags: config.tags,
|
|
220
|
-
externalPackages: config.externalPackages,
|
|
221
220
|
schemaConfig: !setupOnly
|
|
222
221
|
? {
|
|
223
222
|
tsconfig: config.tsconfig,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { VersionManifest } from '@pikku/inspector';
|
|
2
2
|
import { createEmptyManifest } from '@pikku/inspector';
|
|
3
3
|
export { createEmptyManifest };
|
|
4
|
-
export type { ContractEntry, VersionValidateError, VersionManifest, VersionManifestEntry, } from '@pikku/inspector';
|
|
4
|
+
export type { ContractEntry, VersionHashEntry, VersionValidateError, VersionManifest, VersionManifestEntry, } from '@pikku/inspector';
|
|
5
5
|
export declare function loadManifest(manifestPath: string): Promise<VersionManifest | null>;
|
|
6
6
|
export declare function saveManifest(manifestPath: string, manifest: VersionManifest): Promise<void>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { CLILogger } from '../services/cli-logger.service.js';
|
|
1
|
+
import type { CLILogger } from '../services/cli-logger.service.js';
|
|
2
2
|
export declare const DO_NOT_MODIFY_COMMENT: string;
|
|
3
3
|
export declare const writeFileInDir: (logger: CLILogger, path: string, content: string, { ignoreModifyComment, logWrite, }?: {
|
|
4
4
|
ignoreModifyComment?: boolean;
|
|
5
5
|
logWrite?: boolean;
|
|
6
6
|
}) => Promise<void>;
|
|
7
|
+
export declare function kebabCase(str: string): string;
|
|
8
|
+
export declare function scaffoldFilePath(config: {
|
|
9
|
+
rootDir: string;
|
|
10
|
+
srcDirectories: string[];
|
|
11
|
+
}, subdir: string, name: string, suffix: string, overrideDir?: string): string;
|
|
7
12
|
export declare const removeFileInDir: (logger: CLILogger, path: string, { logRemove }?: {
|
|
8
13
|
logRemove?: boolean;
|
|
9
14
|
}) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dirname } from 'path';
|
|
1
|
+
import { dirname, join } from 'path';
|
|
2
2
|
import { mkdir, readFile, writeFile, rm } from 'fs/promises';
|
|
3
3
|
import { existsSync } from 'fs';
|
|
4
4
|
import { getCLIVersion } from './get-cli-version.js';
|
|
@@ -39,6 +39,19 @@ export const writeFileInDir = async (logger, path, content, { ignoreModifyCommen
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
+
export function kebabCase(str) {
|
|
43
|
+
return str
|
|
44
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
45
|
+
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
|
|
46
|
+
.toLowerCase();
|
|
47
|
+
}
|
|
48
|
+
export function scaffoldFilePath(config, subdir, name, suffix, overrideDir) {
|
|
49
|
+
const fileName = kebabCase(name);
|
|
50
|
+
if (overrideDir) {
|
|
51
|
+
return join(overrideDir, subdir, `${fileName}${suffix}`);
|
|
52
|
+
}
|
|
53
|
+
return join(config.rootDir, config.srcDirectories[0], subdir, `${fileName}${suffix}`);
|
|
54
|
+
}
|
|
42
55
|
export const removeFileInDir = async (logger, path, { logRemove = true } = {}) => {
|
|
43
56
|
// Check if file exists before attempting removal
|
|
44
57
|
if (existsSync(path)) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Config } from '../../types/application-types.js';
|
|
2
|
-
import { CLILogger } from '../services/cli-logger.service.js';
|
|
1
|
+
import type { Config } from '../../types/application-types.js';
|
|
2
|
+
import type { CLILogger } from '../services/cli-logger.service.js';
|
|
3
3
|
export declare const generateBootstrapFile: (logger: CLILogger, config: Config, bootstrapFile: string, specificImports: string[], schemas?: boolean, hasMiddleware?: boolean) => Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates addon files from a parsed OpenAPI spec.
|
|
3
|
+
* Returns Record<string, string> compatible with getAddonFiles output.
|
|
4
|
+
*/
|
|
5
|
+
import type { ParsedSpec } from './parse-openapi.js';
|
|
6
|
+
interface AddonVars {
|
|
7
|
+
name: string;
|
|
8
|
+
camelName: string;
|
|
9
|
+
pascalName: string;
|
|
10
|
+
screamingName: string;
|
|
11
|
+
displayName: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
interface CodegenFlags {
|
|
15
|
+
oauth: boolean;
|
|
16
|
+
secret: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function generateAddonFromOpenAPI(spec: ParsedSpec, vars: AddonVars, flags: CodegenFlags): Record<string, string>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { schemaToZod, schemaVarName, createContext, } from './zod-codegen.js';
|
|
2
|
+
import { generateOperationNames, detectCommonPrefix, } from './naming.js';
|
|
3
|
+
const GENERIC_SUMMARIES = new Set([
|
|
4
|
+
'index', 'show', 'create', 'update', 'destroy', 'delete', 'list',
|
|
5
|
+
]);
|
|
6
|
+
function capitalize(str) {
|
|
7
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
8
|
+
}
|
|
9
|
+
function humanDescription(named, parsed) {
|
|
10
|
+
if (parsed.responseDescription) {
|
|
11
|
+
return capitalize(parsed.responseDescription);
|
|
12
|
+
}
|
|
13
|
+
const summary = parsed.summary?.trim();
|
|
14
|
+
if (summary && !GENERIC_SUMMARIES.has(summary.toLowerCase())) {
|
|
15
|
+
return capitalize(summary);
|
|
16
|
+
}
|
|
17
|
+
if (parsed.description && !GENERIC_SUMMARIES.has(parsed.description.trim().toLowerCase())) {
|
|
18
|
+
return capitalize(parsed.description.trim());
|
|
19
|
+
}
|
|
20
|
+
const words = named.functionName
|
|
21
|
+
.replace(/([A-Z])/g, ' $1')
|
|
22
|
+
.trim()
|
|
23
|
+
.toLowerCase();
|
|
24
|
+
return capitalize(words);
|
|
25
|
+
}
|
|
26
|
+
export function generateAddonFromOpenAPI(spec, vars, flags) {
|
|
27
|
+
const files = {};
|
|
28
|
+
const { name } = vars;
|
|
29
|
+
// Build context for Zod codegen with component schema refs
|
|
30
|
+
const schemaRefs = new Map();
|
|
31
|
+
for (const schemaName of Object.keys(spec.componentSchemas)) {
|
|
32
|
+
schemaRefs.set(schemaName, schemaVarName(schemaName));
|
|
33
|
+
}
|
|
34
|
+
const ctx = createContext(schemaRefs);
|
|
35
|
+
// Generate operation names
|
|
36
|
+
const paths = spec.operations.map((op) => op.path);
|
|
37
|
+
const commonPrefix = detectCommonPrefix(paths);
|
|
38
|
+
const namedOps = generateOperationNames(spec.operations.map((op) => ({
|
|
39
|
+
method: op.method,
|
|
40
|
+
path: op.path,
|
|
41
|
+
operationId: op.operationId,
|
|
42
|
+
})), commonPrefix);
|
|
43
|
+
// Pair named operations with their parsed data
|
|
44
|
+
const opPairs = namedOps.map((named, i) => ({ named, parsed: spec.operations[i] }));
|
|
45
|
+
// Generate types file with shared schemas (only if there are any)
|
|
46
|
+
if (Object.keys(spec.componentSchemas).length > 0) {
|
|
47
|
+
files[`src/${name}.types.ts`] = generateTypesFile(spec, ctx);
|
|
48
|
+
}
|
|
49
|
+
// Generate function files
|
|
50
|
+
const functionExports = [];
|
|
51
|
+
for (const { named, parsed } of opPairs) {
|
|
52
|
+
const funcCtx = createContext(schemaRefs);
|
|
53
|
+
const funcCode = generateFunctionFile(named, parsed, vars, funcCtx);
|
|
54
|
+
files[`src/functions/${named.functionName}.function.ts`] = funcCode;
|
|
55
|
+
functionExports.push(named.functionName);
|
|
56
|
+
}
|
|
57
|
+
// Generate index.ts with all exports
|
|
58
|
+
files['src/index.ts'] = generateIndexFile(functionExports);
|
|
59
|
+
// Generate typed API service class with route map
|
|
60
|
+
files[`src/${name}-api.service.ts`] = generateServiceFile(spec, opPairs, vars, flags);
|
|
61
|
+
return files;
|
|
62
|
+
}
|
|
63
|
+
function generateTypesFile(spec, ctx) {
|
|
64
|
+
const lines = [];
|
|
65
|
+
lines.push("import { z } from 'zod'");
|
|
66
|
+
lines.push('');
|
|
67
|
+
lines.push(`// Shared schemas from ${spec.info.title} v${spec.info.version}`);
|
|
68
|
+
lines.push('');
|
|
69
|
+
for (const [name, schema] of Object.entries(spec.componentSchemas)) {
|
|
70
|
+
const varName = schemaVarName(name);
|
|
71
|
+
const zodCode = schemaToZod(schema, ctx);
|
|
72
|
+
lines.push(`export const ${varName} = ${zodCode}`);
|
|
73
|
+
lines.push(`export type ${name} = z.infer<typeof ${varName}>`);
|
|
74
|
+
lines.push('');
|
|
75
|
+
}
|
|
76
|
+
return lines.join('\n');
|
|
77
|
+
}
|
|
78
|
+
function generateFunctionFile(named, parsed, vars, ctx) {
|
|
79
|
+
const lines = [];
|
|
80
|
+
const { camelName } = vars;
|
|
81
|
+
const hasInput = parsed.pathParams.length > 0 ||
|
|
82
|
+
parsed.queryParams.length > 0 ||
|
|
83
|
+
parsed.requestBody;
|
|
84
|
+
const pascalName = named.functionName.charAt(0).toUpperCase() + named.functionName.slice(1);
|
|
85
|
+
const inputName = `${pascalName}Input`;
|
|
86
|
+
const outputName = `${pascalName}Output`;
|
|
87
|
+
lines.push("import { z } from 'zod'");
|
|
88
|
+
lines.push("import { pikkuSessionlessFunc } from '#pikku'");
|
|
89
|
+
lines.push('');
|
|
90
|
+
// Build Input schema (exported for pikku schema discovery)
|
|
91
|
+
if (hasInput) {
|
|
92
|
+
const inputCode = buildInputSchema(parsed, ctx);
|
|
93
|
+
lines.push(`export const ${inputName} = ${inputCode}`);
|
|
94
|
+
lines.push('');
|
|
95
|
+
}
|
|
96
|
+
// Build Output schema (exported for pikku schema discovery)
|
|
97
|
+
if (parsed.responseSchema) {
|
|
98
|
+
const outputCode = schemaToZod(parsed.responseSchema, ctx);
|
|
99
|
+
lines.push(`export const ${outputName} = ${outputCode}`);
|
|
100
|
+
lines.push('');
|
|
101
|
+
}
|
|
102
|
+
const description = humanDescription(named, parsed);
|
|
103
|
+
const method = parsed.method.toUpperCase();
|
|
104
|
+
const funcConfig = [];
|
|
105
|
+
funcConfig.push(` description: ${JSON.stringify(description)},`);
|
|
106
|
+
if (hasInput)
|
|
107
|
+
funcConfig.push(` input: ${inputName},`);
|
|
108
|
+
if (parsed.responseSchema)
|
|
109
|
+
funcConfig.push(` output: ${outputName},`);
|
|
110
|
+
const funcParams = hasInput
|
|
111
|
+
? `{ ${camelName} }, data`
|
|
112
|
+
: `{ ${camelName} }`;
|
|
113
|
+
const returnCast = parsed.responseSchema ? ' as any' : '';
|
|
114
|
+
funcConfig.push(` func: async (${funcParams}) => {`, ` return ${camelName}.call('${method}', '${parsed.path}'${hasInput ? ', data' : ''})${returnCast}`, ' },');
|
|
115
|
+
lines.push(`export const ${named.functionName} = pikkuSessionlessFunc({`);
|
|
116
|
+
lines.push(funcConfig.join('\n'));
|
|
117
|
+
lines.push('})');
|
|
118
|
+
lines.push('');
|
|
119
|
+
return lines.join('\n');
|
|
120
|
+
}
|
|
121
|
+
function buildInputSchema(parsed, ctx) {
|
|
122
|
+
const props = [];
|
|
123
|
+
for (const param of parsed.pathParams) {
|
|
124
|
+
const zodCode = schemaToZod(param.schema, ctx, { optional: !param.required });
|
|
125
|
+
const desc = param.description
|
|
126
|
+
? `${zodCode}.describe(${JSON.stringify(param.description)})`
|
|
127
|
+
: zodCode;
|
|
128
|
+
props.push(` ${param.name}: ${desc},`);
|
|
129
|
+
}
|
|
130
|
+
for (const param of parsed.queryParams) {
|
|
131
|
+
const zodCode = schemaToZod(param.schema, ctx, { optional: !param.required });
|
|
132
|
+
const desc = param.description
|
|
133
|
+
? `${zodCode}.describe(${JSON.stringify(param.description)})`
|
|
134
|
+
: zodCode;
|
|
135
|
+
props.push(` ${param.name}: ${desc},`);
|
|
136
|
+
}
|
|
137
|
+
if (parsed.requestBody) {
|
|
138
|
+
if (parsed.requestBody.properties) {
|
|
139
|
+
const requiredSet = new Set(parsed.requestBody.required ?? []);
|
|
140
|
+
for (const [key, propSchema] of Object.entries(parsed.requestBody.properties)) {
|
|
141
|
+
const isOptional = !requiredSet.has(key);
|
|
142
|
+
const zodCode = schemaToZod(propSchema, ctx, { optional: isOptional });
|
|
143
|
+
props.push(` ${key}: ${zodCode},`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
const bodyZod = schemaToZod(parsed.requestBody, ctx);
|
|
148
|
+
props.push(` body: ${bodyZod},`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return `z.object({\n${props.join('\n')}\n})`;
|
|
152
|
+
}
|
|
153
|
+
function generateIndexFile(functionExports) {
|
|
154
|
+
const lines = [];
|
|
155
|
+
for (const name of functionExports) {
|
|
156
|
+
lines.push(`export { ${name} } from './functions/${name}.function.js'`);
|
|
157
|
+
}
|
|
158
|
+
lines.push('');
|
|
159
|
+
return lines.join('\n');
|
|
160
|
+
}
|
|
161
|
+
function generateServiceFile(spec, opPairs, vars, flags) {
|
|
162
|
+
const { name, pascalName, screamingName, displayName } = vars;
|
|
163
|
+
const lines = [];
|
|
164
|
+
const baseUrl = spec.baseUrl || 'https://api.example.com';
|
|
165
|
+
if (flags.oauth) {
|
|
166
|
+
lines.push("import { OAuth2Client } from '@pikku/core/oauth2'");
|
|
167
|
+
lines.push("import type { TypedSecretService } from '#pikku/secrets/pikku-secrets.gen.js'");
|
|
168
|
+
}
|
|
169
|
+
else if (flags.secret) {
|
|
170
|
+
lines.push(`import type { ${pascalName}Secrets } from './${name}.secret.js'`);
|
|
171
|
+
}
|
|
172
|
+
lines.push('');
|
|
173
|
+
lines.push(`const BASE_URL = ${JSON.stringify(baseUrl)}`);
|
|
174
|
+
lines.push('');
|
|
175
|
+
if (flags.oauth) {
|
|
176
|
+
lines.push(`export const ${screamingName}_OAUTH2_CONFIG = {`);
|
|
177
|
+
lines.push(` tokenSecretId: '${screamingName}_TOKENS',`);
|
|
178
|
+
lines.push(` authorizationUrl: 'https://example.com/oauth2/authorize',`);
|
|
179
|
+
lines.push(` tokenUrl: 'https://example.com/oauth2/token',`);
|
|
180
|
+
lines.push(" scopes: ['read', 'write'],");
|
|
181
|
+
lines.push('}');
|
|
182
|
+
lines.push('');
|
|
183
|
+
}
|
|
184
|
+
// Generate route map from parsed operations
|
|
185
|
+
const routes = {};
|
|
186
|
+
for (const { parsed } of opPairs) {
|
|
187
|
+
const key = `${parsed.method.toUpperCase()} ${parsed.path}`;
|
|
188
|
+
routes[key] = {
|
|
189
|
+
path: parsed.pathParams.map((p) => p.name),
|
|
190
|
+
query: parsed.queryParams.map((p) => p.name),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
lines.push(`const ROUTES: Record<string, { path: string[], query: string[] }> = ${JSON.stringify(routes, null, 2)}`);
|
|
194
|
+
lines.push('');
|
|
195
|
+
// Class declaration
|
|
196
|
+
lines.push(`export class ${pascalName}Service {`);
|
|
197
|
+
if (flags.oauth) {
|
|
198
|
+
lines.push(' private oauth: OAuth2Client');
|
|
199
|
+
lines.push('');
|
|
200
|
+
lines.push(` constructor(secrets: TypedSecretService) {`);
|
|
201
|
+
lines.push(' this.oauth = new OAuth2Client(');
|
|
202
|
+
lines.push(` ${screamingName}_OAUTH2_CONFIG,`);
|
|
203
|
+
lines.push(` '${screamingName}_APP_CREDENTIALS',`);
|
|
204
|
+
lines.push(' secrets');
|
|
205
|
+
lines.push(' )');
|
|
206
|
+
lines.push(' }');
|
|
207
|
+
}
|
|
208
|
+
else if (flags.secret) {
|
|
209
|
+
lines.push(` constructor(private creds: ${pascalName}Secrets) {}`);
|
|
210
|
+
}
|
|
211
|
+
lines.push('');
|
|
212
|
+
// call() method — splits data into path/query/body using route map
|
|
213
|
+
lines.push(' async call<T>(');
|
|
214
|
+
lines.push(" method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH',");
|
|
215
|
+
lines.push(' path: string,');
|
|
216
|
+
lines.push(' data?: Record<string, unknown>');
|
|
217
|
+
lines.push(' ): Promise<T> {');
|
|
218
|
+
lines.push(' const route = ROUTES[`${method} ${path}`]');
|
|
219
|
+
lines.push(' let endpoint = path');
|
|
220
|
+
lines.push(' let body: Record<string, unknown> | undefined');
|
|
221
|
+
lines.push(' const query: Record<string, string> = {}');
|
|
222
|
+
lines.push('');
|
|
223
|
+
lines.push(' if (data && route) {');
|
|
224
|
+
lines.push(' // Interpolate path params');
|
|
225
|
+
lines.push(' for (const param of route.path) {');
|
|
226
|
+
lines.push(' if (data[param] !== undefined) {');
|
|
227
|
+
lines.push(' endpoint = endpoint.replace(`{${param}}`, String(data[param]))');
|
|
228
|
+
lines.push(' }');
|
|
229
|
+
lines.push(' }');
|
|
230
|
+
lines.push(' // Extract query params');
|
|
231
|
+
lines.push(' for (const param of route.query) {');
|
|
232
|
+
lines.push(' if (data[param] !== undefined) {');
|
|
233
|
+
lines.push(' query[param] = String(data[param])');
|
|
234
|
+
lines.push(' }');
|
|
235
|
+
lines.push(' }');
|
|
236
|
+
lines.push(' // Everything else goes into body');
|
|
237
|
+
lines.push(' const pathAndQuery = new Set([...route.path, ...route.query])');
|
|
238
|
+
lines.push(' const remaining = Object.fromEntries(');
|
|
239
|
+
lines.push(' Object.entries(data).filter(([k]) => !pathAndQuery.has(k))');
|
|
240
|
+
lines.push(' )');
|
|
241
|
+
lines.push(' if (Object.keys(remaining).length > 0) {');
|
|
242
|
+
lines.push(' body = remaining');
|
|
243
|
+
lines.push(' }');
|
|
244
|
+
lines.push(' }');
|
|
245
|
+
lines.push('');
|
|
246
|
+
lines.push(' const url = new URL(`${BASE_URL}${endpoint}`)');
|
|
247
|
+
lines.push(' for (const [key, value] of Object.entries(query)) {');
|
|
248
|
+
lines.push(' url.searchParams.set(key, value)');
|
|
249
|
+
lines.push(' }');
|
|
250
|
+
lines.push('');
|
|
251
|
+
if (flags.oauth) {
|
|
252
|
+
lines.push(' const response = await this.oauth.request(url.toString(), {');
|
|
253
|
+
lines.push(' method,');
|
|
254
|
+
lines.push(" headers: { 'Content-Type': 'application/json' },");
|
|
255
|
+
lines.push(' body: body ? JSON.stringify(body) : undefined,');
|
|
256
|
+
lines.push(' })');
|
|
257
|
+
}
|
|
258
|
+
else if (flags.secret) {
|
|
259
|
+
lines.push(' const response = await fetch(url.toString(), {');
|
|
260
|
+
lines.push(' method,');
|
|
261
|
+
lines.push(' headers: {');
|
|
262
|
+
lines.push(" 'Content-Type': 'application/json',");
|
|
263
|
+
lines.push(' Authorization: `Bearer ${this.creds.apiKey}`,');
|
|
264
|
+
lines.push(' },');
|
|
265
|
+
lines.push(' body: body ? JSON.stringify(body) : undefined,');
|
|
266
|
+
lines.push(' })');
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
lines.push(' const response = await fetch(url.toString(), {');
|
|
270
|
+
lines.push(' method,');
|
|
271
|
+
lines.push(" headers: { 'Content-Type': 'application/json' },");
|
|
272
|
+
lines.push(' body: body ? JSON.stringify(body) : undefined,');
|
|
273
|
+
lines.push(' })');
|
|
274
|
+
}
|
|
275
|
+
lines.push('');
|
|
276
|
+
lines.push(' if (!response.ok) {');
|
|
277
|
+
lines.push(' const errorText = await response.text()');
|
|
278
|
+
lines.push(` throw new Error(\`${displayName} API error (\${response.status}): \${errorText}\`)`);
|
|
279
|
+
lines.push(' }');
|
|
280
|
+
lines.push('');
|
|
281
|
+
lines.push(' const text = await response.text()');
|
|
282
|
+
lines.push(" if (!text) return {} as T");
|
|
283
|
+
lines.push(' return JSON.parse(text) as T');
|
|
284
|
+
lines.push(' }');
|
|
285
|
+
lines.push('}');
|
|
286
|
+
lines.push('');
|
|
287
|
+
return lines.join('\n');
|
|
288
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives function/method names from HTTP method + path.
|
|
3
|
+
* Uses operationId when available, otherwise generates from path segments.
|
|
4
|
+
*/
|
|
5
|
+
export declare function singularize(word: string): string;
|
|
6
|
+
export declare function toCamelCase(str: string): string;
|
|
7
|
+
export declare function toPascalCase(str: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Strip common API prefix from paths (e.g. /api/v2/).
|
|
10
|
+
* Uses majority voting — a prefix shared by >75% of paths is stripped,
|
|
11
|
+
* so a few outlier paths (e.g. /oauth/...) don't break detection.
|
|
12
|
+
*/
|
|
13
|
+
export declare function detectCommonPrefix(paths: string[]): string;
|
|
14
|
+
interface OperationForNaming {
|
|
15
|
+
method: string;
|
|
16
|
+
path: string;
|
|
17
|
+
operationId?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface NamedOperation {
|
|
20
|
+
method: string;
|
|
21
|
+
path: string;
|
|
22
|
+
functionName: string;
|
|
23
|
+
methodName: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Generate function names for a list of operations.
|
|
27
|
+
* Handles collision detection and auto-deduplication.
|
|
28
|
+
*/
|
|
29
|
+
export declare function generateOperationNames(operations: OperationForNaming[], commonPrefix: string): NamedOperation[];
|
|
30
|
+
export {};
|