@pikku/cli 0.12.71 → 0.12.72
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/channel/pikku-channel-types.gen.d.ts +1 -1
- package/dist/.pikku/channel/pikku-channel-types.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-contracts-meta.gen.d.ts +1 -1
- package/dist/.pikku/cli/pikku-cli-contracts-meta.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.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 +1 -1
- 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/pikku-bootstrap.gen.d.ts +1 -1
- package/dist/.pikku/pikku-bootstrap.gen.js +1 -1
- package/dist/.pikku/pikku-meta-service.gen.d.ts +1 -1
- package/dist/.pikku/pikku-meta-service.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/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-rpc-wirings-meta.internal.gen.js +1 -1
- 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/schemas/register.gen.js +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.js +1 -1
- package/dist/bin/pikku-bin.mjs +2 -2
- package/dist/src/functions/wirings/auth/pikku-command-auth.js +1 -1
- package/dist/src/functions/wirings/auth/serialize-auth-gen.d.ts +1 -16
- package/dist/src/functions/wirings/auth/serialize-auth-gen.js +36 -3
- 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.72
|
|
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';
|
|
@@ -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.72
|
|
3
3
|
*/
|
|
4
4
|
export { wireVariable } from '@pikku/core/variable';
|
|
5
5
|
export type { CoreVariable, VariableDefinitionMeta, VariableDefinitionsMeta } from '@pikku/core/variable';
|
package/dist/bin/pikku-bin.mjs
CHANGED
|
@@ -11,8 +11,8 @@ async function checkForUpdate() {
|
|
|
11
11
|
})
|
|
12
12
|
if (!res.ok) return
|
|
13
13
|
const { version: latest } = await res.json()
|
|
14
|
-
if (latest !== '0.12.
|
|
15
|
-
process.stderr.write(`\n Update available 0.12.
|
|
14
|
+
if (latest !== '0.12.72') {
|
|
15
|
+
process.stderr.write(`\n Update available 0.12.72 → ${latest}\n brew upgrade pikku or npm install -g @pikku/cli\n\n`)
|
|
16
16
|
}
|
|
17
17
|
} catch {}
|
|
18
18
|
}
|
|
@@ -30,7 +30,7 @@ export const pikkuAuth = pikkuSessionlessFunc({
|
|
|
30
30
|
// has no OAuth providers — still generates its /auth/* wiring.
|
|
31
31
|
if (!state.auth.definition)
|
|
32
32
|
return;
|
|
33
|
-
const { wiring, secrets, middleware } = serializeAuthGen(state.auth.definition, state.auth.providers, authFile, typesDeclarationFile, packageMappings ?? {}, state.auth.hasUserSessionMiddleware ?? false);
|
|
33
|
+
const { wiring, secrets, middleware } = serializeAuthGen(state.auth.definition, state.auth.providers, authFile, typesDeclarationFile, packageMappings ?? {}, state.auth.hasUserSessionMiddleware ?? false, Boolean(config.scaffold?.console));
|
|
34
34
|
// The secrets file sits alongside authFile so re-inspection rediscovers it.
|
|
35
35
|
// It is kept separate from the wiring file because the CLI forbids Zod
|
|
36
36
|
// schemas and HTTP wiring (wireHTTPRoutes) in the same file (PKU490).
|
|
@@ -18,19 +18,4 @@ export interface AuthGenOutput {
|
|
|
18
18
|
* `session.cookieCache` is enabled (stateless path); undefined otherwise. */
|
|
19
19
|
middleware?: string;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
* Generates the `auth.gen.ts` (HTTP wiring) and `auth-secrets.gen.ts` (schemas +
|
|
23
|
-
* secret/variable wiring) files from a `pikkuBetterAuth((services) => betterAuth(...))`
|
|
24
|
-
* export.
|
|
25
|
-
*
|
|
26
|
-
* The wiring file side-effect imports the user's auth file (so `pikkuBetterAuth`
|
|
27
|
-
* registers its factory), builds ONE shared sessionless handler that reads the
|
|
28
|
-
* resolved `services.auth` and delegates to better-auth's fetch handler, wires a
|
|
29
|
-
* catch-all `${basePath}{/*splat}` route per method to it, and registers the
|
|
30
|
-
* better-auth session-bridge middleware globally. Provider/plugin metadata for
|
|
31
|
-
* the console is emitted separately as `auth-meta.gen.json` (see
|
|
32
|
-
* serializeAuthMeta). Because this is normal, statically inspectable HTTP
|
|
33
|
-
* wiring, the routes flow through inspection into the deploy manifest (one
|
|
34
|
-
* worker for all auth routes).
|
|
35
|
-
*/
|
|
36
|
-
export declare const serializeAuthGen: (definition: AuthDefinition, providers: string[], authFile: string, typesDeclarationFile: string, packageMappings: Record<string, string>, hasUserSessionMiddleware?: boolean) => AuthGenOutput;
|
|
21
|
+
export declare const serializeAuthGen: (definition: AuthDefinition, providers: string[], authFile: string, typesDeclarationFile: string, packageMappings: Record<string, string>, hasUserSessionMiddleware?: boolean, includeConsoleToken?: boolean) => AuthGenOutput;
|
|
@@ -33,7 +33,22 @@ function variableSchemaName(name, field) {
|
|
|
33
33
|
* wiring, the routes flow through inspection into the deploy manifest (one
|
|
34
34
|
* worker for all auth routes).
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
// External consoles (served from another origin) cannot carry the session
|
|
37
|
+
// cookie, so they authenticate with 'Authorization: Bearer <PIKKU_CONSOLE_TOKEN>'.
|
|
38
|
+
// The expected token resolves through the secrets service per request and the
|
|
39
|
+
// middleware is a no-op while the secret is unset. Emitted into the same
|
|
40
|
+
// addHTTPMiddleware('*') call as the session middleware: the inspector keys
|
|
41
|
+
// route-middleware groups by pattern, so a second '*' registration from another
|
|
42
|
+
// file would silently displace this one in deployed units.
|
|
43
|
+
const consoleTokenMiddlewareLines = () => [
|
|
44
|
+
` authBearer({`,
|
|
45
|
+
` token: {`,
|
|
46
|
+
` secretId: 'PIKKU_CONSOLE_TOKEN',`,
|
|
47
|
+
` userSession: { userId: 'pikku-console-token' },`,
|
|
48
|
+
` },`,
|
|
49
|
+
` }),`,
|
|
50
|
+
];
|
|
51
|
+
export const serializeAuthGen = (definition, providers, authFile, typesDeclarationFile, packageMappings, hasUserSessionMiddleware = false, includeConsoleToken = false) => {
|
|
37
52
|
const known = providers.filter((p) => p in PROVIDER_REGISTRY);
|
|
38
53
|
const basePath = definition.basePath;
|
|
39
54
|
// Side-effect import of the user's auth file so `pikkuBetterAuth` runs and
|
|
@@ -132,6 +147,9 @@ export const serializeAuthGen = (definition, providers, authFile, typesDeclarati
|
|
|
132
147
|
emitStatefulSession
|
|
133
148
|
? `import { createAuthHandler, betterAuthSession } from '@pikku/better-auth'`
|
|
134
149
|
: `import { createAuthHandler } from '@pikku/better-auth'`,
|
|
150
|
+
...(emitStatefulSession && includeConsoleToken
|
|
151
|
+
? [`import { authBearer } from '@pikku/core/middleware'`]
|
|
152
|
+
: []),
|
|
135
153
|
`import '${configImportPath}'`,
|
|
136
154
|
'',
|
|
137
155
|
// createAuthHandler is called once at module load; the exported handler is a
|
|
@@ -148,7 +166,12 @@ export const serializeAuthGen = (definition, providers, authFile, typesDeclarati
|
|
|
148
166
|
if (emitStatefulSession) {
|
|
149
167
|
// Stateful: betterAuthSession calls services.auth(), so it stays here with
|
|
150
168
|
// the auth.wiring import.
|
|
151
|
-
|
|
169
|
+
if (includeConsoleToken) {
|
|
170
|
+
wiring.push(`addHTTPMiddleware('*', [`, ` betterAuthSession(),`, ...consoleTokenMiddlewareLines(), `])`, '');
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
wiring.push(`addHTTPMiddleware('*', [betterAuthSession()])`, '');
|
|
174
|
+
}
|
|
152
175
|
}
|
|
153
176
|
wiring.push(`wireHTTPRoutes({`, ` routes: {`);
|
|
154
177
|
// One catch-all route per method. `{/*splat}` matches both the bare basePath
|
|
@@ -172,8 +195,18 @@ export const serializeAuthGen = (definition, providers, authFile, typesDeclarati
|
|
|
172
195
|
'',
|
|
173
196
|
`import { addHTTPMiddleware } from '${pikkuTypesImportPath}'`,
|
|
174
197
|
`import { betterAuthStatelessSession } from '@pikku/better-auth'`,
|
|
198
|
+
...(includeConsoleToken
|
|
199
|
+
? [`import { authBearer } from '@pikku/core/middleware'`]
|
|
200
|
+
: []),
|
|
175
201
|
'',
|
|
176
|
-
|
|
202
|
+
...(includeConsoleToken
|
|
203
|
+
? [
|
|
204
|
+
`addHTTPMiddleware('*', [`,
|
|
205
|
+
` betterAuthStatelessSession(),`,
|
|
206
|
+
...consoleTokenMiddlewareLines(),
|
|
207
|
+
`])`,
|
|
208
|
+
]
|
|
209
|
+
: [`addHTTPMiddleware('*', [betterAuthStatelessSession()])`]),
|
|
177
210
|
'',
|
|
178
211
|
];
|
|
179
212
|
output.middleware = middleware.join('\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.72",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"imports": {
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"zod-to-ts": "^2.1.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@pikku/core": "^0.12.
|
|
62
|
+
"@pikku/core": "^0.12.55"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@pikku/core": "^0.12.
|
|
65
|
+
"@pikku/core": "^0.12.55",
|
|
66
66
|
"@types/istanbul-lib-instrument": "^1.7.7",
|
|
67
67
|
"@types/node": "^24.11.0",
|
|
68
68
|
"@types/pg": "^8.11.0",
|