mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
@@ -2,6 +2,7 @@ import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
|
|||||||
import superjson from 'superjson';
|
import superjson from 'superjson';
|
||||||
import type { Runtime } from '@morten-olsen/mini-loader-server';
|
import type { Runtime } from '@morten-olsen/mini-loader-server';
|
||||||
import type { RootRouter } from '@morten-olsen/mini-loader-server';
|
import type { RootRouter } from '@morten-olsen/mini-loader-server';
|
||||||
|
import pkg from '../../package.json';
|
||||||
import { Context } from '../context/context.js';
|
import { Context } from '../context/context.js';
|
||||||
|
|
||||||
const createClient = (context: Context) => {
|
const createClient = (context: Context) => {
|
||||||
@@ -14,6 +15,7 @@ const createClient = (context: Context) => {
|
|||||||
httpBatchLink({
|
httpBatchLink({
|
||||||
url: `${context.host}/trpc`,
|
url: `${context.host}/trpc`,
|
||||||
headers: {
|
headers: {
|
||||||
|
'x-version': pkg.version,
|
||||||
authorization: `Bearer ${context.token}`,
|
authorization: `Bearer ${context.token}`,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { program } from 'commander';
|
import { Command, program } from 'commander';
|
||||||
|
import pkg from '../package.json';
|
||||||
import { loads } from './commands/loads/loads.js';
|
import { loads } from './commands/loads/loads.js';
|
||||||
import { runs } from './commands/runs/runs.js';
|
import { runs } from './commands/runs/runs.js';
|
||||||
import { logs } from './commands/logs/logs.js';
|
import { logs } from './commands/logs/logs.js';
|
||||||
@@ -17,4 +18,12 @@ program.addCommand(local);
|
|||||||
program.addCommand(auth);
|
program.addCommand(auth);
|
||||||
program.addCommand(contexts);
|
program.addCommand(contexts);
|
||||||
|
|
||||||
|
program.version(pkg.version);
|
||||||
|
|
||||||
|
const version = new Command('version');
|
||||||
|
version.action(() => {
|
||||||
|
console.log(pkg.version);
|
||||||
|
});
|
||||||
|
program.addCommand(version);
|
||||||
|
|
||||||
await program.parseAsync();
|
await program.parseAsync();
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"jsx": "react"
|
"jsx": "react"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ start.action(async () => {
|
|||||||
const createToken = new Command('create-token');
|
const createToken = new Command('create-token');
|
||||||
createToken.action(async () => {
|
createToken.action(async () => {
|
||||||
const runtime = await Runtime.create();
|
const runtime = await Runtime.create();
|
||||||
const token = await runtime.auth.createToken({});
|
const token = await runtime.auth.createToken({
|
||||||
|
policy: {
|
||||||
|
'*:*': ['*'],
|
||||||
|
},
|
||||||
|
});
|
||||||
console.log(token);
|
console.log(token);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user