@pikku/inspector 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/CHANGELOG.md +25 -0
- package/dist/add/add-ai-agent.d.ts +1 -1
- package/dist/add/add-ai-agent.js +1 -1
- package/dist/add/add-channel.js +12 -0
- package/dist/add/add-cli.d.ts +1 -1
- package/dist/add/add-cli.js +6 -1
- package/dist/add/add-file-extends-core-type.d.ts +1 -1
- package/dist/add/add-file-with-config.d.ts +1 -1
- package/dist/add/add-file-with-factory.d.ts +1 -1
- package/dist/add/add-file-with-factory.js +2 -2
- package/dist/add/add-functions.d.ts +1 -1
- package/dist/add/add-functions.js +6 -7
- package/dist/add/add-http-route.d.ts +3 -2
- package/dist/add/add-http-route.js +5 -1
- package/dist/add/add-http-routes.d.ts +1 -1
- package/dist/add/add-http-routes.js +1 -0
- package/dist/add/add-keyed-wiring.d.ts +1 -1
- package/dist/add/add-mcp-prompt.d.ts +1 -1
- package/dist/add/add-mcp-resource.d.ts +1 -1
- package/dist/add/add-queue-worker.d.ts +1 -1
- package/dist/add/add-rpc-invocations.d.ts +3 -3
- package/dist/add/add-rpc-invocations.js +10 -10
- package/dist/add/add-schedule.d.ts +1 -1
- package/dist/add/add-secret.d.ts +1 -1
- package/dist/add/add-trigger.d.ts +1 -1
- package/dist/add/add-trigger.js +2 -2
- package/dist/add/add-wire-addon.d.ts +7 -0
- package/dist/add/add-wire-addon.js +70 -0
- package/dist/add/add-workflow.d.ts +1 -1
- package/dist/error-codes.d.ts +1 -0
- package/dist/error-codes.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/inspector.d.ts +1 -1
- package/dist/inspector.js +7 -4
- package/dist/types.d.ts +26 -20
- package/dist/utils/compute-required-schemas.js +1 -2
- package/dist/utils/contract-hashes.d.ts +20 -3
- package/dist/utils/contract-hashes.js +77 -10
- package/dist/utils/custom-types-generator.d.ts +1 -1
- package/dist/utils/detect-schema-vendor.d.ts +1 -1
- package/dist/utils/does-type-extend-core-type.d.ts +1 -1
- package/dist/utils/ensure-function-metadata.d.ts +1 -1
- package/dist/utils/extract-services.d.ts +1 -1
- package/dist/utils/filter-inspector-state.d.ts +1 -1
- package/dist/utils/filter-utils.d.ts +2 -2
- package/dist/utils/get-files-and-methods.d.ts +1 -1
- package/dist/utils/middleware.d.ts +2 -2
- package/dist/utils/permissions.d.ts +2 -2
- package/dist/utils/post-process.d.ts +4 -3
- package/dist/utils/post-process.js +24 -8
- package/dist/utils/resolve-addon-package.d.ts +16 -0
- package/dist/utils/{resolve-external-package.js → resolve-addon-package.js} +8 -8
- package/dist/utils/schema-generator.d.ts +2 -2
- package/dist/utils/serialize-inspector-state.d.ts +13 -3
- package/dist/utils/serialize-inspector-state.js +6 -2
- package/dist/utils/validate-auth-sessionless.d.ts +3 -0
- package/dist/utils/validate-auth-sessionless.js +14 -0
- package/dist/utils/workflow/dsl/extract-dsl-workflow.d.ts +1 -1
- package/dist/visit.d.ts +1 -1
- package/dist/visit.js +2 -0
- package/package.json +2 -2
- package/src/add/add-ai-agent.ts +2 -2
- package/src/add/add-channel.ts +21 -0
- package/src/add/add-cli.ts +19 -4
- package/src/add/add-file-extends-core-type.ts +1 -1
- package/src/add/add-file-with-config.ts +1 -1
- package/src/add/add-file-with-factory.ts +3 -3
- package/src/add/add-functions.ts +21 -19
- package/src/add/add-http-route.ts +19 -2
- package/src/add/add-http-routes.ts +2 -1
- package/src/add/add-keyed-wiring.ts +1 -1
- package/src/add/add-mcp-prompt.ts +1 -1
- package/src/add/add-mcp-resource.ts +1 -1
- package/src/add/add-queue-worker.ts +1 -1
- package/src/add/add-rpc-invocations.ts +11 -11
- package/src/add/add-schedule.ts +1 -1
- package/src/add/add-secret.ts +1 -1
- package/src/add/add-trigger.ts +4 -4
- package/src/add/add-wire-addon.ts +80 -0
- package/src/add/add-workflow.ts +2 -2
- package/src/error-codes.ts +1 -0
- package/src/index.ts +1 -0
- package/src/inspector.ts +13 -5
- package/src/types.ts +33 -20
- package/src/utils/compute-required-schemas.ts +1 -2
- package/src/utils/contract-hashes.test.ts +30 -5
- package/src/utils/contract-hashes.ts +110 -14
- package/src/utils/custom-types-generator.ts +1 -1
- package/src/utils/detect-schema-vendor.ts +1 -1
- package/src/utils/does-type-extend-core-type.ts +1 -1
- package/src/utils/ensure-function-metadata.ts +1 -1
- package/src/utils/extract-services.ts +1 -1
- package/src/utils/filter-inspector-state.test.ts +3 -5
- package/src/utils/filter-inspector-state.ts +7 -2
- package/src/utils/filter-utils.test.ts +1 -1
- package/src/utils/filter-utils.ts +2 -2
- package/src/utils/get-files-and-methods.ts +1 -1
- package/src/utils/middleware.ts +2 -2
- package/src/utils/permissions.ts +2 -2
- package/src/utils/post-process.ts +34 -12
- package/src/utils/{resolve-external-package.ts → resolve-addon-package.ts} +17 -10
- package/src/utils/resolve-versions.test.ts +1 -1
- package/src/utils/schema-generator.ts +4 -4
- package/src/utils/serialize-inspector-state.ts +23 -5
- package/src/utils/validate-auth-sessionless.ts +29 -0
- package/src/utils/workflow/dsl/extract-dsl-workflow.ts +2 -2
- package/src/visit.ts +7 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/resolve-external-package.d.ts +0 -12
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as ts from 'typescript'
|
|
2
|
+
import { getPropertyValue } from './get-property-value.js'
|
|
3
|
+
import { ErrorCode } from '../error-codes.js'
|
|
4
|
+
import type { InspectorLogger, InspectorState } from '../types.js'
|
|
5
|
+
|
|
6
|
+
export function validateAuthSessionless(
|
|
7
|
+
logger: InspectorLogger,
|
|
8
|
+
obj: ts.ObjectLiteralExpression,
|
|
9
|
+
state: InspectorState,
|
|
10
|
+
funcName: string,
|
|
11
|
+
wireDescription: string,
|
|
12
|
+
inheritedAuth?: boolean
|
|
13
|
+
): boolean {
|
|
14
|
+
const fnMeta = state.functions.meta[funcName]
|
|
15
|
+
if (!fnMeta) return true
|
|
16
|
+
|
|
17
|
+
const routeAuth = getPropertyValue(obj, 'auth')
|
|
18
|
+
const resolvedAuth =
|
|
19
|
+
routeAuth === true || routeAuth === false ? routeAuth : inheritedAuth
|
|
20
|
+
if (resolvedAuth === false && fnMeta.sessionless === false) {
|
|
21
|
+
logger.critical(
|
|
22
|
+
ErrorCode.AUTH_DISABLED_REQUIRES_SESSIONLESS,
|
|
23
|
+
`${wireDescription} has auth disabled but function '${funcName}' uses pikkuFunc (requires session). Use pikkuSessionlessFunc instead.`
|
|
24
|
+
)
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return true
|
|
29
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as ts from 'typescript'
|
|
2
|
-
import {
|
|
2
|
+
import type {
|
|
3
3
|
WorkflowStepMeta,
|
|
4
4
|
RpcStepMeta,
|
|
5
5
|
BranchStepMeta,
|
|
@@ -33,11 +33,11 @@ import {
|
|
|
33
33
|
isArrayType,
|
|
34
34
|
getSourceText,
|
|
35
35
|
} from './patterns.js'
|
|
36
|
+
import type { ValidationError } from './validation.js'
|
|
36
37
|
import {
|
|
37
38
|
validateNoDisallowedPatterns,
|
|
38
39
|
validateAwaitedCalls,
|
|
39
40
|
formatValidationErrors,
|
|
40
|
-
ValidationError,
|
|
41
41
|
} from './validation.js'
|
|
42
42
|
import {
|
|
43
43
|
extractStringLiteral,
|
package/src/visit.ts
CHANGED
|
@@ -9,10 +9,15 @@ import { addQueueWorker } from './add/add-queue-worker.js'
|
|
|
9
9
|
import { addWorkflow } from './add/add-workflow.js'
|
|
10
10
|
import { addMCPResource } from './add/add-mcp-resource.js'
|
|
11
11
|
import { addMCPPrompt } from './add/add-mcp-prompt.js'
|
|
12
|
-
import {
|
|
12
|
+
import type {
|
|
13
|
+
InspectorState,
|
|
14
|
+
InspectorLogger,
|
|
15
|
+
InspectorOptions,
|
|
16
|
+
} from './types.js'
|
|
13
17
|
import { addFunctions } from './add/add-functions.js'
|
|
14
18
|
import { addChannel } from './add/add-channel.js'
|
|
15
19
|
import { addRPCInvocations } from './add/add-rpc-invocations.js'
|
|
20
|
+
import { addWireAddon } from './add/add-wire-addon.js'
|
|
16
21
|
import { addMiddleware } from './add/add-middleware.js'
|
|
17
22
|
import { addPermission } from './add/add-permission.js'
|
|
18
23
|
import { addCLI, addCLIRenderers } from './add/add-cli.js'
|
|
@@ -78,6 +83,7 @@ export const visitSetup = (
|
|
|
78
83
|
addFileWithFactory(node, checker, state.configFactories, 'CreateConfig')
|
|
79
84
|
|
|
80
85
|
addRPCInvocations(node, state, logger)
|
|
86
|
+
addWireAddon(node, state, logger)
|
|
81
87
|
addMiddleware(logger, node, checker, state, options)
|
|
82
88
|
addPermission(logger, node, checker, state, options)
|
|
83
89
|
addWorkflow(logger, node, checker, state, options)
|