@pikku/cli 0.12.35 → 0.12.37
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-BOM3RFeu.js → index-Dxl3JsMK.js} +73 -73
- package/console-app/index.html +1 -1
- 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 +6 -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 +6 -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 +2 -2
- package/dist/.pikku/function/pikku-function-types.gen.js +17 -3
- package/dist/.pikku/function/pikku-functions-meta.gen.js +1 -1
- package/dist/.pikku/function/pikku-functions-meta.gen.json +74 -57
- 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/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/rpc/pikku-rpc-wirings-meta.internal.gen.json +3 -2
- 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 +9 -5
- package/dist/.pikku/schemas/schemas/DbGenerateInput.schema.json +1 -0
- package/dist/.pikku/schemas/schemas/PikkuCLIConfig.schema.json +1 -1
- package/dist/.pikku/schemas/schemas/PikkuFunctionTypesInput.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/meta/allWorkflow.gen.json +22 -4
- 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/cli.wiring.js +5 -0
- package/dist/src/fabric/functions/login.function.d.ts +1 -1
- package/dist/src/fabric/functions/login.function.js +1 -1
- package/dist/src/fabric/functions/validate.function.js +4 -0
- package/dist/src/functions/commands/bootstrap.js +1 -1
- package/dist/src/functions/commands/db-generate.d.ts +1 -0
- package/dist/src/functions/commands/db-generate.js +45 -0
- package/dist/src/functions/commands/db-migrate.js +13 -1
- package/dist/src/functions/db/better-auth-schema.d.ts +23 -0
- package/dist/src/functions/db/better-auth-schema.js +122 -0
- package/dist/src/functions/db/local-db.d.ts +33 -0
- package/dist/src/functions/db/local-db.js +125 -1
- package/dist/src/functions/db/zod-codegen.js +9 -6
- package/dist/src/functions/validate/workspace-validate.js +1 -1
- package/dist/src/functions/wirings/auth/pikku-command-auth.js +30 -4
- package/dist/src/functions/wirings/auth/serialize-auth-gen.d.ts +33 -1
- package/dist/src/functions/wirings/auth/serialize-auth-gen.js +122 -88
- package/dist/src/functions/wirings/auth/serialize-auth-meta.d.ts +32 -0
- package/dist/src/functions/wirings/auth/serialize-auth-meta.js +23 -0
- package/dist/src/functions/wirings/auth/serialize-auth-types.d.ts +27 -0
- package/dist/src/functions/wirings/auth/serialize-auth-types.js +58 -0
- package/dist/src/functions/wirings/functions/pikku-command-function-types.d.ts +7 -1
- package/dist/src/functions/wirings/functions/pikku-command-function-types.js +16 -3
- package/dist/src/functions/wirings/functions/pikku-command-services.d.ts +1 -1
- package/dist/src/functions/wirings/functions/pikku-command-services.js +9 -2
- package/dist/src/functions/wirings/functions/serialize-function-types.js +17 -3
- 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 -1
- package/dist/src/functions/workflows/all.workflow.js +16 -2
- package/dist/src/scaffold/rpc-remote.gen.js +1 -1
- package/dist/src/services.js +8 -0
- package/dist/src/utils/pikku-cli-config.js +12 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/skills/pikku-better-auth/SKILL.md +211 -0
- package/skills/pikku-auth-js/SKILL.md +0 -339
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import { PROVIDER_REGISTRY } from '@pikku/auth
|
|
1
|
+
import { PROVIDER_REGISTRY } from '@pikku/better-auth';
|
|
2
|
+
import { AUTH_HANDLER_FUNC_ID } from '@pikku/inspector';
|
|
3
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
4
|
+
// better-auth uses GET and POST for all of its endpoints (sign-in, callbacks,
|
|
5
|
+
// session, sign-out, plugin routes). A single catch-all per method forwards
|
|
6
|
+
// everything under basePath to better-auth's own internal router.
|
|
7
|
+
const AUTH_METHODS = ['get', 'post'];
|
|
2
8
|
function capitalize(s) {
|
|
3
9
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
4
10
|
}
|
|
@@ -8,110 +14,138 @@ function providerSchemaName(name) {
|
|
|
8
14
|
function providerSecretName(name) {
|
|
9
15
|
return `${name.replace(/-([a-z])/g, (_, c) => c.toUpperCase())}OAuth`;
|
|
10
16
|
}
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
function variableSchemaName(name, field) {
|
|
18
|
+
const camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
19
|
+
return `${capitalize(camel(name))}${capitalize(field)}VariableSchema`;
|
|
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 const serializeAuthGen = (definition, providers, authFile, typesDeclarationFile, packageMappings) => {
|
|
37
|
+
const known = providers.filter((p) => p in PROVIDER_REGISTRY);
|
|
38
|
+
const basePath = definition.basePath;
|
|
39
|
+
// Side-effect import of the user's auth file so `pikkuBetterAuth` runs and
|
|
40
|
+
// registers its factory into pikkuState before singleton services are built.
|
|
41
|
+
const configImportPath = getFileImportRelativePath(authFile, definition.sourceFile, packageMappings);
|
|
42
|
+
// Resolve the pikku types file relative to the scaffold location instead of
|
|
43
|
+
// hardcoding the `#pikku` subpath import — the scaffold dir may live outside
|
|
44
|
+
// the package's `imports` map (e.g. a project's `pikku/` dir), where `#pikku`
|
|
45
|
+
// would not resolve. This mirrors how the console/agent scaffolds import it.
|
|
46
|
+
const pikkuTypesImportPath = getFileImportRelativePath(authFile, typesDeclarationFile, packageMappings);
|
|
47
|
+
// ─── Secrets file: Zod schemas + wireSecret/wireVariable ──────────────────
|
|
48
|
+
const secrets = [
|
|
49
|
+
'// AUTO-GENERATED by pikku CLI — do not edit',
|
|
50
|
+
'',
|
|
51
|
+
`import { wireSecret } from '@pikku/core/secret'`,
|
|
52
|
+
];
|
|
53
|
+
const hasVariables = known.some((name) => PROVIDER_REGISTRY[name].variables);
|
|
54
|
+
if (hasVariables) {
|
|
55
|
+
secrets.push(`import { wireVariable } from '@pikku/core/variable'`);
|
|
22
56
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
57
|
+
secrets.push(`import { z } from 'zod'`, '');
|
|
58
|
+
// better-auth's session-signing secret is always required (its BETTER_AUTH_SECRET
|
|
59
|
+
// env convention). Wire it so the platform collects it, regardless of providers.
|
|
60
|
+
secrets.push(`export const BetterAuthSecretSchema = z.string()`);
|
|
61
|
+
secrets.push('');
|
|
62
|
+
secrets.push(`wireSecret({`);
|
|
63
|
+
secrets.push(` name: 'betterAuthSecret',`);
|
|
64
|
+
secrets.push(` displayName: 'Better Auth Secret',`);
|
|
65
|
+
secrets.push(` description: 'Signing secret for better-auth sessions',`);
|
|
66
|
+
secrets.push(` secretId: 'BETTER_AUTH_SECRET',`);
|
|
67
|
+
secrets.push(` schema: BetterAuthSecretSchema,`);
|
|
68
|
+
secrets.push(`})`);
|
|
69
|
+
secrets.push('');
|
|
70
|
+
// Zod schemas for each provider's OAuth credentials secret.
|
|
32
71
|
for (const name of known) {
|
|
33
72
|
const def = PROVIDER_REGISTRY[name];
|
|
34
73
|
const schemaName = providerSchemaName(name);
|
|
35
74
|
const fieldLines = Object.entries(def.fields).map(([field, zodExpr]) => ` ${field}: ${zodExpr},`);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
75
|
+
secrets.push(`export const ${schemaName} = z.object({`);
|
|
76
|
+
secrets.push(...fieldLines);
|
|
77
|
+
secrets.push(`})`);
|
|
78
|
+
secrets.push('');
|
|
40
79
|
}
|
|
41
|
-
// wireSecret for
|
|
42
|
-
lines.push(`export const AuthSecretSchema = z.string()`);
|
|
43
|
-
lines.push('');
|
|
44
|
-
lines.push(`wireSecret({`);
|
|
45
|
-
lines.push(` name: 'authSecret',`);
|
|
46
|
-
lines.push(` displayName: 'Auth Secret',`);
|
|
47
|
-
lines.push(` description: 'JWT signing secret for Auth.js sessions',`);
|
|
48
|
-
lines.push(` secretId: 'AUTH_SECRET',`);
|
|
49
|
-
lines.push(` schema: AuthSecretSchema,`);
|
|
50
|
-
lines.push(`})`);
|
|
51
|
-
lines.push('');
|
|
52
|
-
// wireSecret for each provider
|
|
80
|
+
// wireSecret for each provider.
|
|
53
81
|
for (const name of known) {
|
|
54
82
|
const def = PROVIDER_REGISTRY[name];
|
|
55
83
|
const schemaName = providerSchemaName(name);
|
|
56
84
|
const secretName = providerSecretName(name);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
85
|
+
secrets.push(`wireSecret({`);
|
|
86
|
+
secrets.push(` name: '${secretName}',`);
|
|
87
|
+
secrets.push(` displayName: '${def.displayName}',`);
|
|
88
|
+
secrets.push(` secretId: '${def.secretId}',`);
|
|
89
|
+
secrets.push(` schema: ${schemaName},`);
|
|
90
|
+
secrets.push(`})`);
|
|
91
|
+
secrets.push('');
|
|
64
92
|
}
|
|
65
|
-
// wireVariable for providers with non-secret config (issuer, tenantId, etc.)
|
|
93
|
+
// wireVariable for providers with non-secret config (issuer, tenantId, etc.).
|
|
66
94
|
for (const name of known) {
|
|
67
95
|
const def = PROVIDER_REGISTRY[name];
|
|
68
96
|
if (!def.variables)
|
|
69
97
|
continue;
|
|
70
98
|
for (const [field, meta] of Object.entries(def.variables)) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
99
|
+
// PKU111 requires `schema` to be a variable reference, not an inline
|
|
100
|
+
// expression — so each variable gets a named schema const.
|
|
101
|
+
const schemaName = variableSchemaName(name, field);
|
|
102
|
+
secrets.push(`export const ${schemaName} = z.string()`);
|
|
103
|
+
secrets.push('');
|
|
104
|
+
secrets.push(`wireVariable({`);
|
|
105
|
+
secrets.push(` name: '${name}_${field}',`);
|
|
106
|
+
secrets.push(` displayName: '${def.displayName} ${capitalize(field)}',`);
|
|
107
|
+
secrets.push(` description: '${meta.description}',`);
|
|
108
|
+
secrets.push(` variableId: '${meta.variableId}',`);
|
|
109
|
+
secrets.push(` schema: ${schemaName},`);
|
|
110
|
+
secrets.push(`})`);
|
|
111
|
+
secrets.push('');
|
|
79
112
|
}
|
|
80
113
|
}
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
// ─── Wiring file: handler + catch-all routes + session middleware ─────────
|
|
115
|
+
// Provider/plugin metadata for the console SSO page is emitted separately as
|
|
116
|
+
// `auth-meta.gen.json` (see serializeAuthMeta) rather than wired into the
|
|
117
|
+
// runtime, so it is available without evaluating the better-auth factory.
|
|
118
|
+
const wiring = [
|
|
119
|
+
'// AUTO-GENERATED by pikku CLI — do not edit',
|
|
120
|
+
'',
|
|
121
|
+
`import { pikkuSessionlessFunc, wireHTTPRoutes, addHTTPMiddleware } from '${pikkuTypesImportPath}'`,
|
|
122
|
+
`import { createAuthHandler, betterAuthSession } from '@pikku/better-auth'`,
|
|
123
|
+
`import '${configImportPath}'`,
|
|
124
|
+
'',
|
|
125
|
+
// createAuthHandler is called once at module load; the exported handler is a
|
|
126
|
+
// plain arrow (so the inspector can resolve a valid `func`) that delegates to
|
|
127
|
+
// it. The handler's required services are stamped onto its meta by the
|
|
128
|
+
// inspector from the pikkuBetterAuth factory.
|
|
129
|
+
`const authConfigHandler = createAuthHandler()`,
|
|
130
|
+
`export const ${AUTH_HANDLER_FUNC_ID} = pikkuSessionlessFunc({`,
|
|
131
|
+
` func: (services: any, data: any, interaction: any) =>`,
|
|
132
|
+
` authConfigHandler.func(services, data, interaction),`,
|
|
133
|
+
`})`,
|
|
134
|
+
'',
|
|
135
|
+
// Bridge the better-auth session into the Pikku session on every request.
|
|
136
|
+
`addHTTPMiddleware('*', [betterAuthSession()])`,
|
|
137
|
+
'',
|
|
138
|
+
`wireHTTPRoutes({`,
|
|
139
|
+
` routes: {`,
|
|
140
|
+
];
|
|
141
|
+
// One catch-all route per method. `{/*splat}` matches both the bare basePath
|
|
142
|
+
// and every sub-path under it, so better-auth's internal router sees the full
|
|
143
|
+
// request and handles all of its own endpoints.
|
|
144
|
+
for (const method of AUTH_METHODS) {
|
|
145
|
+
wiring.push(` ${method}AuthCatchAll: { method: '${method}', route: '${basePath}{/*splat}', func: ${AUTH_HANDLER_FUNC_ID}, auth: false },`);
|
|
104
146
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
lines.push(` trustHost: true,`);
|
|
110
|
-
lines.push(` basePath: '/auth',`);
|
|
111
|
-
lines.push(` }`);
|
|
112
|
-
lines.push(`})`);
|
|
113
|
-
lines.push('');
|
|
114
|
-
lines.push(`wireHTTPRoutes({ routes: { auth: authRoutes } })`);
|
|
115
|
-
lines.push('');
|
|
116
|
-
return lines.join('\n');
|
|
147
|
+
wiring.push(` },`);
|
|
148
|
+
wiring.push(`})`);
|
|
149
|
+
wiring.push('');
|
|
150
|
+
return { wiring: wiring.join('\n'), secrets: secrets.join('\n') };
|
|
117
151
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AuthDefinition } from '@pikku/inspector';
|
|
2
|
+
export interface AuthMetaProvider {
|
|
3
|
+
id: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
secretId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AuthMetaPlugin {
|
|
8
|
+
id: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The contents of `auth-meta.gen.json` — the static description of a project's
|
|
13
|
+
* Better Auth configuration the console SSO page reads (via getAuthProviders) to
|
|
14
|
+
* show which social providers and plugins are enabled. Replaces the previous
|
|
15
|
+
* runtime `setAuthRegistry`/`getAuthRegistry` mechanism with a generated file
|
|
16
|
+
* following the `*-meta.gen.json` convention.
|
|
17
|
+
*/
|
|
18
|
+
export interface AuthMeta {
|
|
19
|
+
basePath: string;
|
|
20
|
+
hasCredentials: boolean;
|
|
21
|
+
providers: AuthMetaProvider[];
|
|
22
|
+
plugins: AuthMetaPlugin[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Builds the `auth-meta.gen.json` payload from the inspected auth definition.
|
|
26
|
+
*
|
|
27
|
+
* Only providers known to {@link PROVIDER_REGISTRY} are emitted (the same ones
|
|
28
|
+
* the CLI wires a secret for); unknown keys (e.g. wired via the genericOAuth
|
|
29
|
+
* plugin) are dropped since they have no secret metadata. Every plugin id from
|
|
30
|
+
* the config is emitted, enriched with a display name.
|
|
31
|
+
*/
|
|
32
|
+
export declare const serializeAuthMeta: (definition: AuthDefinition, providers: string[]) => AuthMeta;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PROVIDER_REGISTRY, pluginDisplayName } from '@pikku/better-auth';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the `auth-meta.gen.json` payload from the inspected auth definition.
|
|
4
|
+
*
|
|
5
|
+
* Only providers known to {@link PROVIDER_REGISTRY} are emitted (the same ones
|
|
6
|
+
* the CLI wires a secret for); unknown keys (e.g. wired via the genericOAuth
|
|
7
|
+
* plugin) are dropped since they have no secret metadata. Every plugin id from
|
|
8
|
+
* the config is emitted, enriched with a display name.
|
|
9
|
+
*/
|
|
10
|
+
export const serializeAuthMeta = (definition, providers) => ({
|
|
11
|
+
basePath: definition.basePath,
|
|
12
|
+
hasCredentials: definition.hasCredentials,
|
|
13
|
+
providers: providers
|
|
14
|
+
.filter((id) => id in PROVIDER_REGISTRY)
|
|
15
|
+
.map((id) => {
|
|
16
|
+
const def = PROVIDER_REGISTRY[id];
|
|
17
|
+
return { id, displayName: def.displayName, secretId: def.secretId };
|
|
18
|
+
}),
|
|
19
|
+
plugins: definition.plugins.map((id) => ({
|
|
20
|
+
id,
|
|
21
|
+
displayName: pluginDisplayName(id),
|
|
22
|
+
})),
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates `.pikku/auth/auth.types.ts` — a typed wrapper around `pikkuBetterAuth`
|
|
3
|
+
* from `@pikku/better-auth` that substitutes the project's specific
|
|
4
|
+
* `SingletonServices` type for the generic `CoreSingletonServices`. This lets
|
|
5
|
+
* users write:
|
|
6
|
+
*
|
|
7
|
+
* import { pikkuBetterAuth } from '#pikku'
|
|
8
|
+
*
|
|
9
|
+
* and get proper autocomplete on the factory's `services` param (e.g.
|
|
10
|
+
* `(services) => betterAuth({ database: { db: services.kysely } })` types
|
|
11
|
+
* `services.kysely` as the project's Kysely instance, not the loose `any` from
|
|
12
|
+
* `CoreSingletonServices`).
|
|
13
|
+
*
|
|
14
|
+
* The wrapper also substitutes the project's generated `TypedSecretService` /
|
|
15
|
+
* `TypedVariablesService` for the base `secrets` / `variables` services and wraps
|
|
16
|
+
* them at runtime — the same treatment addon services get from
|
|
17
|
+
* `pikkuAddonServices`. That gives the factory typed, map-aware access:
|
|
18
|
+
*
|
|
19
|
+
* socialProviders: { github: await secrets.getSecret('GITHUB_OAUTH') }
|
|
20
|
+
*
|
|
21
|
+
* with no inline `getSecrets<{ ... }>()` generic, because the secret types flow
|
|
22
|
+
* from the generated `CredentialsMap`.
|
|
23
|
+
*
|
|
24
|
+
* The file is re-exported from `.pikku/pikku-types.gen.ts` (the `#pikku` hub)
|
|
25
|
+
* so the single import resolves correctly.
|
|
26
|
+
*/
|
|
27
|
+
export declare const serializeAuthTypes: (authTypesFile: string, functionTypesFile: string, secretsFile: string, variablesFile: string, packageMappings: Record<string, string>) => string;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
2
|
+
/**
|
|
3
|
+
* Generates `.pikku/auth/auth.types.ts` — a typed wrapper around `pikkuBetterAuth`
|
|
4
|
+
* from `@pikku/better-auth` that substitutes the project's specific
|
|
5
|
+
* `SingletonServices` type for the generic `CoreSingletonServices`. This lets
|
|
6
|
+
* users write:
|
|
7
|
+
*
|
|
8
|
+
* import { pikkuBetterAuth } from '#pikku'
|
|
9
|
+
*
|
|
10
|
+
* and get proper autocomplete on the factory's `services` param (e.g.
|
|
11
|
+
* `(services) => betterAuth({ database: { db: services.kysely } })` types
|
|
12
|
+
* `services.kysely` as the project's Kysely instance, not the loose `any` from
|
|
13
|
+
* `CoreSingletonServices`).
|
|
14
|
+
*
|
|
15
|
+
* The wrapper also substitutes the project's generated `TypedSecretService` /
|
|
16
|
+
* `TypedVariablesService` for the base `secrets` / `variables` services and wraps
|
|
17
|
+
* them at runtime — the same treatment addon services get from
|
|
18
|
+
* `pikkuAddonServices`. That gives the factory typed, map-aware access:
|
|
19
|
+
*
|
|
20
|
+
* socialProviders: { github: await secrets.getSecret('GITHUB_OAUTH') }
|
|
21
|
+
*
|
|
22
|
+
* with no inline `getSecrets<{ ... }>()` generic, because the secret types flow
|
|
23
|
+
* from the generated `CredentialsMap`.
|
|
24
|
+
*
|
|
25
|
+
* The file is re-exported from `.pikku/pikku-types.gen.ts` (the `#pikku` hub)
|
|
26
|
+
* so the single import resolves correctly.
|
|
27
|
+
*/
|
|
28
|
+
export const serializeAuthTypes = (authTypesFile, functionTypesFile, secretsFile, variablesFile, packageMappings) => {
|
|
29
|
+
const functionTypesImport = getFileImportRelativePath(authTypesFile, functionTypesFile, packageMappings);
|
|
30
|
+
const secretsImport = getFileImportRelativePath(authTypesFile, secretsFile, packageMappings);
|
|
31
|
+
const variablesImport = getFileImportRelativePath(authTypesFile, variablesFile, packageMappings);
|
|
32
|
+
return [
|
|
33
|
+
'// AUTO-GENERATED by pikku CLI — do not edit',
|
|
34
|
+
'',
|
|
35
|
+
`import { pikkuBetterAuth as _pikkuBetterAuth } from '@pikku/better-auth'`,
|
|
36
|
+
`import type { BetterAuthInstance, PikkuBetterAuthFactory } from '@pikku/better-auth'`,
|
|
37
|
+
`import type { SingletonServices } from '${functionTypesImport}'`,
|
|
38
|
+
`import { TypedSecretService } from '${secretsImport}'`,
|
|
39
|
+
`import { TypedVariablesService } from '${variablesImport}'`,
|
|
40
|
+
'',
|
|
41
|
+
`type AuthSingletonServices = Omit<SingletonServices, 'secrets' | 'variables'> & {`,
|
|
42
|
+
` secrets: TypedSecretService`,
|
|
43
|
+
` variables: TypedVariablesService`,
|
|
44
|
+
`}`,
|
|
45
|
+
'',
|
|
46
|
+
`export const pikkuBetterAuth = <I extends BetterAuthInstance>(`,
|
|
47
|
+
` factory: (services: AuthSingletonServices) => I | Promise<I>`,
|
|
48
|
+
`): PikkuBetterAuthFactory<I> =>`,
|
|
49
|
+
` _pikkuBetterAuth((services) =>`,
|
|
50
|
+
` factory({`,
|
|
51
|
+
` ...services,`,
|
|
52
|
+
` secrets: new TypedSecretService(services.secrets),`,
|
|
53
|
+
` variables: new TypedVariablesService(services.variables),`,
|
|
54
|
+
` } as AuthSingletonServices)`,
|
|
55
|
+
` )`,
|
|
56
|
+
'',
|
|
57
|
+
].join('\n');
|
|
58
|
+
};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export declare const pikkuFunctionTypes: import("#pikku").PikkuFunctionConfig<
|
|
1
|
+
export declare const pikkuFunctionTypes: import("#pikku").PikkuFunctionConfig<{
|
|
2
|
+
bootstrap?: boolean;
|
|
3
|
+
}, void, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<{
|
|
4
|
+
bootstrap?: boolean;
|
|
5
|
+
}, void, "rpc" | "session", import("#pikku").Services> | import("#pikku").PikkuFunction<{
|
|
6
|
+
bootstrap?: boolean;
|
|
7
|
+
}, void, "rpc" | "session", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -4,14 +4,27 @@ import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
|
4
4
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
5
5
|
import { serializePikkuTypesHub } from './serialize-pikku-types-hub.js';
|
|
6
6
|
export const pikkuFunctionTypes = pikkuSessionlessFunc({
|
|
7
|
-
func: async ({ logger, config }) => {
|
|
8
|
-
const { typesDeclarationFile: typesFile, packageMappings, functionTypesFile, httpTypesFile, channelsTypesFile, triggersTypesFile, schedulersTypesFile, queueTypesFile, mcpTypesFile, cliTypesFile, nodeTypesFile, secretTypesFile, addonTypesFile, } = config;
|
|
7
|
+
func: async ({ logger, config, getInspectorState }, data) => {
|
|
8
|
+
const { typesDeclarationFile: typesFile, packageMappings, functionTypesFile, httpTypesFile, channelsTypesFile, triggersTypesFile, schedulersTypesFile, queueTypesFile, mcpTypesFile, cliTypesFile, nodeTypesFile, secretTypesFile, addonTypesFile, authTypesFile, } = config;
|
|
9
9
|
const getImportPath = (file) => config.addon
|
|
10
10
|
? null
|
|
11
11
|
: getFileImportRelativePath(typesFile, file, packageMappings);
|
|
12
12
|
// Node and trigger types are included for addon packages
|
|
13
13
|
const getAlwaysImportPath = (file) => getFileImportRelativePath(typesFile, file, packageMappings);
|
|
14
|
-
|
|
14
|
+
// Include the typed pikkuBetterAuth re-export only when the project has a
|
|
15
|
+
// pikkuBetterAuth declaration. This avoids importing @pikku/better-auth in
|
|
16
|
+
// projects that don't use it.
|
|
17
|
+
//
|
|
18
|
+
// Skip inspector state entirely during cold bootstrap: .pikku doesn't exist
|
|
19
|
+
// yet, so a full inspect would runtime-import user files that themselves
|
|
20
|
+
// import `.pikku/pikku-types.gen.js` — deadlocking before this step can
|
|
21
|
+
// write that very file. The auth re-export is added on the later
|
|
22
|
+
// post-inspect pass (where .pikku already exists) instead.
|
|
23
|
+
const state = data?.bootstrap ? null : await getInspectorState();
|
|
24
|
+
const authTypesImportPath = authTypesFile && state?.auth.definition
|
|
25
|
+
? getFileImportRelativePath(typesFile, authTypesFile, packageMappings)
|
|
26
|
+
: null;
|
|
27
|
+
const content = serializePikkuTypesHub(getFileImportRelativePath(typesFile, functionTypesFile, packageMappings), getImportPath(httpTypesFile), getImportPath(channelsTypesFile), getAlwaysImportPath(triggersTypesFile), getImportPath(schedulersTypesFile), getImportPath(queueTypesFile), getImportPath(mcpTypesFile), getImportPath(cliTypesFile), getAlwaysImportPath(nodeTypesFile), getAlwaysImportPath(secretTypesFile), config.addon ? getAlwaysImportPath(addonTypesFile) : null, authTypesImportPath);
|
|
15
28
|
await writeFileInDir(logger, typesFile, content);
|
|
16
29
|
},
|
|
17
30
|
middleware: [
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const serializeServicesMap: (allSingletonServices: string[], allWireServices: string[], requiredServices: Set<string>, forceRequiredServices: string[] | undefined, servicesImport: string, wireServicesImport: string, addonRequiredParentServices?: string[]) => string;
|
|
1
|
+
export declare const serializeServicesMap: (allSingletonServices: string[], allWireServices: string[], requiredServices: Set<string>, forceRequiredServices: string[] | undefined, servicesImport: string, wireServicesImport: string, addonRequiredParentServices?: string[], authInjected?: boolean) => string;
|
|
2
2
|
export declare const pikkuServices: import("#pikku").PikkuFunctionConfig<void, void, "rpc" | "session", import("#pikku").PikkuFunctionSessionless<void, void, "rpc" | "session", import("#pikku").Services> | import("#pikku").PikkuFunction<void, void, "rpc" | "session", import("#pikku").Services>, undefined, undefined>;
|
|
@@ -3,7 +3,7 @@ import { getFileImportRelativePath } from '../../../utils/file-import-path.js';
|
|
|
3
3
|
import { checkRequiredTypes } from '../../../utils/check-required-types.js';
|
|
4
4
|
import { writeFileInDir } from '../../../utils/file-writer.js';
|
|
5
5
|
import { logCommandInfoAndTime } from '../../../middleware/log-command-info-and-time.js';
|
|
6
|
-
export const serializeServicesMap = (allSingletonServices, allWireServices, requiredServices, forceRequiredServices = [], servicesImport, wireServicesImport, addonRequiredParentServices = []) => {
|
|
6
|
+
export const serializeServicesMap = (allSingletonServices, allWireServices, requiredServices, forceRequiredServices = [], servicesImport, wireServicesImport, addonRequiredParentServices = [], authInjected = false) => {
|
|
7
7
|
// Use pre-aggregated services from inspector state
|
|
8
8
|
// This includes services from:
|
|
9
9
|
// - Wired functions (HTTP, channels, queues, schedulers, MCP, CLI, RPC)
|
|
@@ -32,6 +32,13 @@ export const serializeServicesMap = (allSingletonServices, allWireServices, requ
|
|
|
32
32
|
// Services that are always required internally by the framework
|
|
33
33
|
const defaultServices = ['config', 'logger', 'variables', 'schema', 'secrets'];
|
|
34
34
|
defaultServices.forEach((service) => usedServices.add(service));
|
|
35
|
+
// When a pikkuBetterAuth factory is present, the generated `pikkuServices`
|
|
36
|
+
// wrapper always injects a resolved `auth` singleton. Mark it required so
|
|
37
|
+
// RequiredSingletonServices keeps `auth` non-optional and stays assignable
|
|
38
|
+
// to a SingletonServices type that types `auth` from the factory's return.
|
|
39
|
+
if (authInjected) {
|
|
40
|
+
usedServices.add('auth');
|
|
41
|
+
}
|
|
35
42
|
// Create singleton services map: all singleton services with true/false based on usage
|
|
36
43
|
const singletonServicesMap = {};
|
|
37
44
|
allSingletonServices.forEach((service) => {
|
|
@@ -103,7 +110,7 @@ export const pikkuServices = pikkuSessionlessFunc({
|
|
|
103
110
|
}
|
|
104
111
|
const servicesImport = `import type { ${singletonServicesType.type} } from '${getFileImportRelativePath(config.typesDeclarationFile, singletonServicesType.typePath, config.packageMappings)}'`;
|
|
105
112
|
const wireServicesImport = `import type { ${wireServicesType.type} } from '${getFileImportRelativePath(config.typesDeclarationFile, wireServicesType.typePath, config.packageMappings)}'`;
|
|
106
|
-
const servicesCode = serializeServicesMap(visitState.serviceAggregation.allSingletonServices, visitState.serviceAggregation.allWireServices, visitState.serviceAggregation.requiredServices, config.forceRequiredServices, servicesImport, wireServicesImport, config.addonName ? visitState.addonRequiredParentServices : []);
|
|
113
|
+
const servicesCode = serializeServicesMap(visitState.serviceAggregation.allSingletonServices, visitState.serviceAggregation.allWireServices, visitState.serviceAggregation.requiredServices, config.forceRequiredServices, servicesImport, wireServicesImport, config.addonName ? visitState.addonRequiredParentServices : [], Boolean(visitState.auth?.definition));
|
|
107
114
|
await writeFileInDir(logger, config.servicesFile, servicesCode);
|
|
108
115
|
},
|
|
109
116
|
middleware: [
|
|
@@ -629,12 +629,26 @@ export const pikkuConfig = (
|
|
|
629
629
|
* \`\`\`
|
|
630
630
|
*/
|
|
631
631
|
export const pikkuServices = (
|
|
632
|
-
func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<RequiredSingletonServices
|
|
632
|
+
func: (config: Config, existingServices: Partial<SingletonServices>) => Promise<Omit<RequiredSingletonServices, 'auth'>>
|
|
633
633
|
) => {
|
|
634
634
|
return async (config: Config, existingServices: Partial<SingletonServices> = {}) => {
|
|
635
635
|
const services = await func(config, existingServices)
|
|
636
|
-
__pikkuState(null, 'package', '
|
|
637
|
-
|
|
636
|
+
const authFactory = __pikkuState(null, 'package', 'authFactory')
|
|
637
|
+
if (authFactory) {
|
|
638
|
+
let authInstance: Promise<unknown> | undefined
|
|
639
|
+
;(services as any).auth = () => {
|
|
640
|
+
authInstance ??= Promise.resolve()
|
|
641
|
+
.then(() => authFactory(services as any))
|
|
642
|
+
.catch((error) => {
|
|
643
|
+
authInstance = undefined
|
|
644
|
+
throw error
|
|
645
|
+
})
|
|
646
|
+
return authInstance
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
const resolved = services as RequiredSingletonServices
|
|
650
|
+
__pikkuState(null, 'package', 'singletonServices', resolved as any)
|
|
651
|
+
return resolved
|
|
638
652
|
}
|
|
639
653
|
}
|
|
640
654
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates the main pikku-types.gen.ts file as a re-export hub
|
|
3
3
|
*/
|
|
4
|
-
export declare const serializePikkuTypesHub: (functionTypesImportPath: string, httpTypesImportPath: string | null, channelTypesImportPath: string | null, triggerTypesImportPath: string | null, schedulerTypesImportPath: string | null, queueTypesImportPath: string | null, mcpTypesImportPath: string | null, cliTypesImportPath: string | null, nodeTypesImportPath: string | null, secretTypesImportPath: string | null, addonTypesImportPath: string | null) => string;
|
|
4
|
+
export declare const serializePikkuTypesHub: (functionTypesImportPath: string, httpTypesImportPath: string | null, channelTypesImportPath: string | null, triggerTypesImportPath: string | null, schedulerTypesImportPath: string | null, queueTypesImportPath: string | null, mcpTypesImportPath: string | null, cliTypesImportPath: string | null, nodeTypesImportPath: string | null, secretTypesImportPath: string | null, addonTypesImportPath: string | null, authTypesImportPath?: string | null) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates the main pikku-types.gen.ts file as a re-export hub
|
|
3
3
|
*/
|
|
4
|
-
export const serializePikkuTypesHub = (functionTypesImportPath, httpTypesImportPath, channelTypesImportPath, triggerTypesImportPath, schedulerTypesImportPath, queueTypesImportPath, mcpTypesImportPath, cliTypesImportPath, nodeTypesImportPath, secretTypesImportPath, addonTypesImportPath) => {
|
|
4
|
+
export const serializePikkuTypesHub = (functionTypesImportPath, httpTypesImportPath, channelTypesImportPath, triggerTypesImportPath, schedulerTypesImportPath, queueTypesImportPath, mcpTypesImportPath, cliTypesImportPath, nodeTypesImportPath, secretTypesImportPath, addonTypesImportPath, authTypesImportPath = null) => {
|
|
5
5
|
const exports = [
|
|
6
6
|
{
|
|
7
7
|
comment: 'Core function, middleware, and permission types',
|
|
@@ -17,6 +17,7 @@ export const serializePikkuTypesHub = (functionTypesImportPath, httpTypesImportP
|
|
|
17
17
|
{ comment: 'Node wiring types', path: nodeTypesImportPath },
|
|
18
18
|
{ comment: 'Secret definition types', path: secretTypesImportPath },
|
|
19
19
|
{ comment: 'Addon types', path: addonTypesImportPath },
|
|
20
|
+
{ comment: 'Auth types (typed pikkuBetterAuth re-export)', path: authTypesImportPath },
|
|
20
21
|
];
|
|
21
22
|
const exportStatements = exports
|
|
22
23
|
.filter((e) => e.path)
|
|
@@ -30,7 +30,9 @@ export const allWorkflow = pikkuWorkflowComplexFunc({
|
|
|
30
30
|
logger.debug(`• .pikku directory not found, running bootstrap first...`);
|
|
31
31
|
await workflow.do('Bootstrap inspect', async () => getInspectorState(false, true, true));
|
|
32
32
|
await workflow.do('Bootstrap function types split', 'pikkuFunctionTypesSplit', { bootstrap: true });
|
|
33
|
-
await workflow.do('Bootstrap function types', 'pikkuFunctionTypes',
|
|
33
|
+
await workflow.do('Bootstrap function types', 'pikkuFunctionTypes', {
|
|
34
|
+
bootstrap: true,
|
|
35
|
+
});
|
|
34
36
|
await workflow.do('Bootstrap addon types', 'pikkuAddonTypes', {
|
|
35
37
|
bootstrap: true,
|
|
36
38
|
});
|
|
@@ -66,7 +68,7 @@ export const allWorkflow = pikkuWorkflowComplexFunc({
|
|
|
66
68
|
await workflow.do(`Scaffold ${generator}`, generator, null);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
await workflow.do('Generate function types', 'pikkuFunctionTypes',
|
|
71
|
+
await workflow.do('Generate function types', 'pikkuFunctionTypes', {});
|
|
70
72
|
if (!typesDeclarationFileExists || missingScaffolds.length > 0) {
|
|
71
73
|
logger.debug(`• Type file or scaffolds first created, inspecting again...`);
|
|
72
74
|
await workflow.do('Re-inspect after types', async () => getInspectorState(true));
|
|
@@ -130,6 +132,18 @@ export const allWorkflow = pikkuWorkflowComplexFunc({
|
|
|
130
132
|
if (agents || !config.addon) {
|
|
131
133
|
await workflow.do('Re-inspect after agents', async () => getInspectorState(true));
|
|
132
134
|
}
|
|
135
|
+
// pikkuAuth generates auth-secrets.gen.ts (with wireSecret calls) inside the
|
|
136
|
+
// Promise.all above, but pikkuSecrets runs concurrently from the pre-auth
|
|
137
|
+
// inspector state. Re-run secret/credential/variable codegen now so that the
|
|
138
|
+
// freshly-generated auth-secrets.gen.ts (just picked up by Re-inspect above)
|
|
139
|
+
// is reflected in pikku-secrets-meta.gen.json.
|
|
140
|
+
if ((await getInspectorState()).auth.definition) {
|
|
141
|
+
await Promise.all([
|
|
142
|
+
workflow.do('Secrets (post-auth)', 'pikkuSecrets', null),
|
|
143
|
+
workflow.do('Credentials (post-auth)', 'pikkuCredentials', null),
|
|
144
|
+
workflow.do('Variables (post-auth)', 'pikkuVariables', null),
|
|
145
|
+
]);
|
|
146
|
+
}
|
|
133
147
|
const schemas = await workflow.do('Schemas', 'pikkuSchemas', null);
|
|
134
148
|
if (schemas) {
|
|
135
149
|
allImports.push(`${config.schemaDirectory}/register.gen.ts`);
|
package/dist/src/services.js
CHANGED
|
@@ -187,6 +187,14 @@ export const createSingletonServices = async (config) => {
|
|
|
187
187
|
config.workflowRoutesFile,
|
|
188
188
|
config.publicRpcFile,
|
|
189
189
|
config.publicAgentFile,
|
|
190
|
+
// The auth scaffold (catch-all routes + session middleware) and its
|
|
191
|
+
// sibling secrets file (wireSecret per provider) are generated into the
|
|
192
|
+
// scaffold dir, which may live outside srcDirectories (e.g. a project's
|
|
193
|
+
// `pikku/` dir). Add them explicitly so their wirings are inspected.
|
|
194
|
+
config.authFile,
|
|
195
|
+
config.authFile
|
|
196
|
+
? path.join(path.dirname(config.authFile), 'auth-secrets.gen.ts')
|
|
197
|
+
: undefined,
|
|
190
198
|
];
|
|
191
199
|
for (const file of scaffoldFiles) {
|
|
192
200
|
if (file && !wiringFiles.includes(file) && existsSync(file)) {
|
|
@@ -197,6 +197,15 @@ const _getPikkuCLIConfig = async (logger, configFile = undefined, requiredFields
|
|
|
197
197
|
if (result.scaffold?.console && !result.consoleFunctionsFile) {
|
|
198
198
|
result.consoleFunctionsFile = join(resolvedScaffoldDir, 'console.gen.ts');
|
|
199
199
|
}
|
|
200
|
+
if (!result.authFile) {
|
|
201
|
+
result.authFile = join(resolvedScaffoldDir, 'auth.gen.ts');
|
|
202
|
+
}
|
|
203
|
+
if (!result.authTypesFile) {
|
|
204
|
+
result.authTypesFile = join(result.outDir, 'auth', 'auth.types.ts');
|
|
205
|
+
}
|
|
206
|
+
if (!result.authMetaJsonFile) {
|
|
207
|
+
result.authMetaJsonFile = join(result.outDir, 'auth', 'pikku-auth-meta.gen.json');
|
|
208
|
+
}
|
|
200
209
|
if (result.scaffold?.events && !result.eventsChannelFile) {
|
|
201
210
|
result.eventsChannelFile = join(resolvedScaffoldDir, 'events.gen.ts');
|
|
202
211
|
}
|
|
@@ -422,6 +431,9 @@ const _getPikkuCLIConfig = async (logger, configFile = undefined, requiredFields
|
|
|
422
431
|
if (result.authFile && !isAbsolute(result.authFile)) {
|
|
423
432
|
result.authFile = join(result.configDir, result.authFile);
|
|
424
433
|
}
|
|
434
|
+
if (result.authTypesFile && !isAbsolute(result.authTypesFile)) {
|
|
435
|
+
result.authTypesFile = join(result.configDir, result.authTypesFile);
|
|
436
|
+
}
|
|
425
437
|
if (!isAbsolute(result.tsconfig)) {
|
|
426
438
|
result.tsconfig = join(result.rootDir, result.tsconfig);
|
|
427
439
|
}
|