Skip to content

Instantly share code, notes, and snippets.

import type { ZodTypeAny } from 'zod';
import { ZodFirstPartyTypeKind } from 'zod';
export function toAST(schema: ZodTypeAny): Record<string, any> {
const def = schema._def;
const base = {
label: schema.description || undefined,
};
import { AnyAbility, ForbiddenError, Generics, Normalize } from '@casl/ability';
import { Rule } from '@casl/ability/dist/types/Rule';
import { rulesToQuery } from '@casl/ability/extra';
import { CompoundCondition } from '@ucast/core';
import type { Condition } from '@ucast/core/dist/types/Condition';
import {
allInterpreters,
createSqlInterpreter,
pg,
SqlQueryOptions,

Например у нас есть такие записи. Ориентироватся можно по createdAt

{
  "data": [
    {
      "_id": "60b146a8046dfa8692a293c3",
      "createdAt": "2021-05-26T16:21:40.225Z",
      "cursor": "NjBiMTQ2YTgwNDZkZmE4NjkyYTI5M2MzXzE2MjIwNDYxMDAyMjU="
    },
    {
export const declareType = options => {
const {
name, definition, enums = [], readOnly
} = options
const types = {
...declareBaseType(name, definition),
...declareWhereInput(options),
...readOnly ? {} : declareCreateInput(name, definition),
...readOnly ? {} : declareUpdateInput(name, definition)
}