PHP 8.2.30
Preview: record-json.factory.ts Size: 1.17 KB
//proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/src/frontend/components/spec/record-json.factory.ts

import { factory } from 'factory-girl'

import './action-json.factory.js'
import { ActionJSON, RecordJSON } from '../../interfaces/index.js'

factory.define<RecordJSON>('RecordJSON', Object, {
  params: {
    param1: 'value1',
    'nested.param': 'value2',
  },
  populated: {},
  baseError: null,
  errors: {},
  id: factory.sequence('JSONRecord.id', (n) => `someId${n}`),
  title: factory.sequence('JSONRecord.id', (n) => `someTitle${n}`),
  recordActions: [],
  bulkActions: [],
})

factory.extend('RecordJSON', 'RecordJSON.total', {
  // params set for properties from ResourceJSON.total factory's properties
  params: {
    name: 'John',
    surname: 'Doe',
    gender: 'MALE',
  },
}, {
  afterBuild: async (model) => {
    const showAction = await factory.build<ActionJSON>('ActionJSON', {
      name: 'show', actionType: 'record',
    })
    const editAction = await factory.build<ActionJSON>('ActionJSON', {
      name: 'edit', actionType: 'record',
    })
    const deleteAction = await factory.build<ActionJSON>('ActionJSON', {
      name: 'delete', actionType: 'record',
    })
    return {
      ...model,
      recordActions: [showAction, editAction, deleteAction],
    }
  },
})

Directory Contents

Dirs: 0 × Files: 8

Name Size Perms Modified Actions
543 B lrw-r--r-- 2026-02-28 00:31:58
Edit Download
298 B lrw-r--r-- 2026-02-28 00:32:10
Edit Download
127 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download
283 B lrw-r--r-- 2026-02-28 00:32:38
Edit Download
876 B lrw-r--r-- 2026-02-28 00:32:40
Edit Download
1.17 KB lrw-r--r-- 2026-02-28 00:32:40
Edit Download
1.65 KB lrw-r--r-- 2026-02-28 00:32:42
Edit Download
996 B lrw-r--r-- 2026-02-28 00:32:50
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).