mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
docs: nextjs,frontends,transfers (3 files)
This commit is contained in:
@@ -29,6 +29,12 @@ Every archive includes:
|
||||
|
||||
The runtime-specific paragraph is drawn from the `runtime` value, and the CLI stub prints project, runtime, package, tone, and brief so Super God users can inspect it before shipping.
|
||||
|
||||
## Interactive builder
|
||||
|
||||
- **Path**: `/codegen`
|
||||
- **Experience**: A Material UI-powered scaffold designer that bundles the same payload used by the API and streams the ZIP for download.
|
||||
- **Feedback**: Inline alerts surface success or failure so teams can iteratively tune briefs before sharing the starter kit with collaborators.
|
||||
|
||||
## Development tooling
|
||||
|
||||
- `frontends/nextjs/src/lib/codegen/*` houses the generator helpers: one function per file (`createProjectTemplate`, `generateCodegenZip`).
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest'
|
||||
|
||||
const mockList = vi.fn()
|
||||
const mockCreate = vi.fn()
|
||||
const mockUpdate = vi.fn()
|
||||
const mockDelete = vi.fn()
|
||||
|
||||
vi.mock('../dbal-client', () => ({
|
||||
getAdapter: () => ({
|
||||
list: mockList,
|
||||
create: mockCreate,
|
||||
update: mockUpdate,
|
||||
delete: mockDelete,
|
||||
}),
|
||||
}))
|
||||
|
||||
import {
|
||||
addPowerTransferRequest,
|
||||
getPowerTransferRequests,
|
||||
updatePowerTransferRequest,
|
||||
} from './index'
|
||||
|
||||
describe('power-transfers db helpers', () => {
|
||||
beforeEach(() => {
|
||||
mockList.mockReset()
|
||||
mockCreate.mockReset()
|
||||
mockUpdate.mockReset()
|
||||
mockDelete.mockReset()
|
||||
})
|
||||
|
||||
it('maps stored requests to plain objects', async () => {
|
||||
mockList.mockResolvedValue({
|
||||
data: [
|
||||
{
|
||||
id: 'req#1',
|
||||
fromUserId: 'user_supergod',
|
||||
toUserId: 'user_target',
|
||||
status: 'pending',
|
||||
createdAt: BigInt(1_000),
|
||||
expiresAt: BigInt(5_000),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const result = await getPowerTransferRequests()
|
||||
|
||||
expect(mockList).toHaveBeenCalledWith('PowerTransferRequest')
|
||||
expect(result).toEqual([
|
||||
{
|
||||
id: 'req#1',
|
||||
fromUserId: 'user_supergod',
|
||||
toUserId: 'user_target',
|
||||
status: 'pending',
|
||||
createdAt: 1000,
|
||||
expiresAt: 5000,
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it('creates power transfer requests with bigint timestamps', async () => {
|
||||
const request = {
|
||||
id: 'req#2',
|
||||
fromUserId: 'user_supergod',
|
||||
toUserId: 'user_target',
|
||||
status: 'pending' as const,
|
||||
createdAt: 1_000,
|
||||
expiresAt: 3_000,
|
||||
}
|
||||
|
||||
await addPowerTransferRequest(request)
|
||||
|
||||
expect(mockCreate).toHaveBeenCalledWith('PowerTransferRequest', {
|
||||
id: 'req#2',
|
||||
fromUserId: 'user_supergod',
|
||||
toUserId: 'user_target',
|
||||
status: 'pending',
|
||||
createdAt: BigInt(1_000),
|
||||
expiresAt: BigInt(3_000),
|
||||
})
|
||||
})
|
||||
|
||||
it('updates power transfer request statuses', async () => {
|
||||
await updatePowerTransferRequest('req#3', { status: 'accepted' })
|
||||
|
||||
expect(mockUpdate).toHaveBeenCalledWith('PowerTransferRequest', 'req#3', {
|
||||
status: 'accepted',
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -13,6 +13,7 @@ import { installPackage } from './install-package'
|
||||
import { installPackageComponents } from './install-package-components'
|
||||
import { installPackageScripts } from './install-package-scripts'
|
||||
import { isPackageInstalled } from './is-package-installed'
|
||||
import { loadPackageIndex } from './load-package-index'
|
||||
import { uninstallPackage } from './uninstall-package'
|
||||
|
||||
export type { LuaScriptFile, PackageDefinition, PackageRegistry } from './types'
|
||||
@@ -33,6 +34,7 @@ export {
|
||||
installPackageComponents,
|
||||
installPackageScripts,
|
||||
isPackageInstalled,
|
||||
loadPackageIndex,
|
||||
uninstallPackage,
|
||||
}
|
||||
export { PackageGlue, packageGlue } from './package-glue'
|
||||
|
||||
Reference in New Issue
Block a user