parent
365f472717
commit
059836f4bc
12
package.json
12
package.json
@ -4,7 +4,8 @@
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "tachybase build",
|
||||
"build": "tachybase build --no-dts",
|
||||
"build:full": "tachybase build",
|
||||
"build:p": "tachybase build --no-dts",
|
||||
"changelog": "auto-changelog -p -t keepachangelog",
|
||||
"clean": "tachybase clean",
|
||||
@ -19,19 +20,17 @@
|
||||
"pm2": "tachybase pm2",
|
||||
"prepare": "husky",
|
||||
"release": "pnpm -r exec -- npm version patch && npm version patch --no-git-tag-version && git commit -a -m 'chore(version): release '$(jq -r '.version | \"v\\(.)\"' package.json | tr -d '\"') && git tag $(jq -r '.version | \"v\\(.)\"' package.json | tr -d '\"')",
|
||||
"run:example": "tsx -r dotenv/config -r tsconfig-paths/register ./examples/index.ts",
|
||||
"start": "tachybase start",
|
||||
"tachybase": "tachybase",
|
||||
"tag": "changeset",
|
||||
"tar": "tachybase tar",
|
||||
"tb": "tachybase",
|
||||
"tbi": "tachybase install",
|
||||
"tbu": "tachybase upgrade",
|
||||
"tc": "tachybase test:client",
|
||||
"test": "tachybase test",
|
||||
"test:client": "tachybase test:client",
|
||||
"test:server": "tachybase test:server",
|
||||
"ts": "tachybase test:server",
|
||||
"ver": "changeset version"
|
||||
"ts": "tachybase test:server"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,json,sql}": [
|
||||
@ -76,7 +75,8 @@
|
||||
"react-dom": "^18.2.0",
|
||||
"tsx": "^4.7.2",
|
||||
"typescript": "5.4.5",
|
||||
"umi": "^4.1.10"
|
||||
"umi": "^4.1.10",
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"packageManager": "pnpm@8.15.5",
|
||||
"engines": {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { vi } from 'vitest';
|
||||
import { Context } from '@tachybase/actions';
|
||||
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { ACL } from '..';
|
||||
|
||||
describe('acl', () => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { ACL } from '..';
|
||||
import { AllowManager } from '../allow-manager';
|
||||
|
||||
describe('allow manager', () => {
|
||||
let acl: ACL;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { ACL } from '..';
|
||||
|
||||
describe('skip', () => {
|
||||
|
@ -13,5 +13,8 @@ export interface AvailableActionOptions {
|
||||
}
|
||||
|
||||
export class ACLAvailableAction {
|
||||
constructor(public name: string, public options: AvailableActionOptions) {}
|
||||
constructor(
|
||||
public name: string,
|
||||
public options: AvailableActionOptions,
|
||||
) {}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { ACL } from './acl';
|
||||
|
||||
type StrategyValue = false | '*' | string | string[];
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { ACLRole, RoleActionParams } from './acl-role';
|
||||
import { ACL, ListenerContext } from './acl';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { ACL, ListenerContext } from './acl';
|
||||
import { ACLRole, RoleActionParams } from './acl-role';
|
||||
|
||||
export type ResourceActions = { [key: string]: RoleActionParams };
|
||||
|
||||
interface AclResourceOptions {
|
||||
|
@ -1,8 +1,9 @@
|
||||
import lodash from 'lodash';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
import { ACL, DefineOptions } from './acl';
|
||||
import { ACLAvailableStrategy, AvailableStrategyOptions } from './acl-available-strategy';
|
||||
import { ACLResource } from './acl-resource';
|
||||
import lodash from 'lodash';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
export interface RoleActionParams {
|
||||
fields?: string[];
|
||||
|
@ -1,8 +1,10 @@
|
||||
import EventEmitter from 'events';
|
||||
import { Action } from '@tachybase/resourcer';
|
||||
import { assign, parseFilter, Toposort, ToposortOptions } from '@tachybase/utils';
|
||||
import EventEmitter from 'events';
|
||||
|
||||
import compose from 'koa-compose';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { ACLAvailableAction, AvailableActionOptions } from './acl-available-action';
|
||||
import { ACLAvailableStrategy, AvailableStrategyOptions, predicate } from './acl-available-strategy';
|
||||
import { ACLRole, ResourceActionsOptions, RoleActionParams } from './acl-role';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { mockServer, MockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { mockServer, MockServer } from './index';
|
||||
|
||||
describe('add action', () => {
|
||||
let app: MockServer;
|
||||
let Post;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { mockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('create action', () => {
|
||||
let app;
|
||||
let Post;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('destroy action', () => {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { mockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
import { Collection } from '@tachybase/database';
|
||||
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('first or create', () => {
|
||||
let app;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { MockServer, mockServer } from './';
|
||||
|
||||
describe('get action', () => {
|
||||
|
@ -1,9 +1,11 @@
|
||||
import Database, { CollectionOptions, mockDatabase } from '@tachybase/database';
|
||||
import { Handlers, ResourceOptions, Resourcer } from '@tachybase/resourcer';
|
||||
|
||||
import Koa from 'koa';
|
||||
import bodyParser from 'koa-bodyparser';
|
||||
import qs from 'qs';
|
||||
import supertest, { SuperAgentTest } from 'supertest';
|
||||
|
||||
import db2resource from '../../../server/src/middlewares/db2resource';
|
||||
|
||||
interface ActionParams {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
import { MockServer, mockServer as actionMockServer } from './index';
|
||||
|
||||
import { mockServer as actionMockServer, MockServer } from './index';
|
||||
|
||||
describe('list action', () => {
|
||||
let app: MockServer;
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { mockServer, MockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
import { Collection, Database } from '@tachybase/database';
|
||||
import { waitSecond } from '@tachybase/test';
|
||||
|
||||
import { mockServer, MockServer } from './index';
|
||||
|
||||
describe('sort action', () => {
|
||||
describe('associations', () => {
|
||||
let api: MockServer;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { mockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('remove action', () => {
|
||||
let app;
|
||||
let Post;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { mockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('set action', () => {
|
||||
let app;
|
||||
let Post;
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { mockServer } from './index';
|
||||
import { SortAbleCollection } from '../actions';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { SortAbleCollection } from '../actions';
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('sort collections', () => {
|
||||
let app;
|
||||
let Post;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { mockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('toggle action', () => {
|
||||
let app;
|
||||
let Post;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { MockServer, mockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
|
||||
import { MockServer, mockServer } from './index';
|
||||
|
||||
describe('update action', () => {
|
||||
let app: MockServer;
|
||||
let Post;
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { mockServer } from './index';
|
||||
import { registerActions } from '@tachybase/actions';
|
||||
import { Collection } from '@tachybase/database';
|
||||
|
||||
import { mockServer } from './index';
|
||||
|
||||
describe('update or create', () => {
|
||||
let app;
|
||||
|
||||
|
@ -4,6 +4,7 @@ import {
|
||||
HasManyRepository,
|
||||
MultipleRelationRepository,
|
||||
} from '@tachybase/database';
|
||||
|
||||
import { Context } from '..';
|
||||
import { getRepositoryFromParams } from '../utils';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { getRepositoryFromParams } from '../utils';
|
||||
import { Context } from '../index';
|
||||
import { getRepositoryFromParams } from '../utils';
|
||||
|
||||
export async function destroy(ctx: Context, next) {
|
||||
const repository = getRepositoryFromParams(ctx);
|
||||
|
@ -1,9 +1,11 @@
|
||||
import { assign } from '@tachybase/utils';
|
||||
import { Context } from '..';
|
||||
import { getRepositoryFromParams, pageArgsToLimitArgs } from '../utils';
|
||||
import { DEFAULT_PAGE, DEFAULT_PER_PAGE } from '../constants';
|
||||
import { Op, QueryTypes } from 'sequelize';
|
||||
import qs from 'querystring';
|
||||
import { assign } from '@tachybase/utils';
|
||||
|
||||
import { Op, QueryTypes } from 'sequelize';
|
||||
|
||||
import { Context } from '..';
|
||||
import { DEFAULT_PAGE, DEFAULT_PER_PAGE } from '../constants';
|
||||
import { getRepositoryFromParams, pageArgsToLimitArgs } from '../utils';
|
||||
|
||||
function totalPage(total, pageSize): number {
|
||||
return Math.ceil(total / pageSize);
|
||||
|
@ -1,6 +1,3 @@
|
||||
import { Model, Op } from 'sequelize';
|
||||
|
||||
import { Context } from '..';
|
||||
import {
|
||||
BelongsToManyRepository,
|
||||
Collection,
|
||||
@ -9,6 +6,10 @@ import {
|
||||
SortField,
|
||||
TargetKey,
|
||||
} from '@tachybase/database';
|
||||
|
||||
import { Model, Op } from 'sequelize';
|
||||
|
||||
import { Context } from '..';
|
||||
import { getRepositoryFromParams } from '../utils';
|
||||
|
||||
export async function move(ctx: Context, next) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { Context } from '../index';
|
||||
import { getRepositoryFromParams } from '../utils';
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
import { RelationRepositoryActionBuilder } from '../utils';
|
||||
|
||||
export const remove = RelationRepositoryActionBuilder('remove');
|
||||
|
@ -1,2 +1,3 @@
|
||||
import { RelationRepositoryActionBuilder } from '../utils';
|
||||
|
||||
export const set = RelationRepositoryActionBuilder('set');
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { BelongsToManyRepository } from '@tachybase/database';
|
||||
|
||||
import { Context } from '..';
|
||||
import { getRepositoryFromParams } from '../utils';
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { MultipleRelationRepository, Repository } from '@tachybase/database';
|
||||
|
||||
import { Context } from '.';
|
||||
|
||||
export function pageArgsToLimitArgs(
|
||||
|
@ -11,7 +11,10 @@
|
||||
"@tachybase/database": "workspace:*",
|
||||
"@tachybase/resourcer": "workspace:*",
|
||||
"@tachybase/utils": "workspace:*",
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"jsonwebtoken": "^8.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"vitest": "^1.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { vi } from 'vitest';
|
||||
import { Context } from '@tachybase/actions';
|
||||
import { Auth, AuthManager } from '@tachybase/auth';
|
||||
import Database, { Model } from '@tachybase/database';
|
||||
import { MockServer, mockServer } from '@tachybase/test';
|
||||
|
||||
import { vi } from 'vitest';
|
||||
|
||||
class MockStorer {
|
||||
elements: Map<string, any> = new Map();
|
||||
async set(name: string, value: any) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Context, Next } from '@tachybase/actions';
|
||||
import { Registry } from '@tachybase/utils';
|
||||
|
||||
import { Auth, AuthExtend } from './auth';
|
||||
import { JwtOptions, JwtService } from './base/jwt-service';
|
||||
import { ITokenBlacklistService } from './base/token-blacklist-service';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Context } from '@tachybase/actions';
|
||||
import { Model } from '@tachybase/database';
|
||||
|
||||
import { Authenticator } from './auth-manager';
|
||||
|
||||
export type AuthConfig = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Collection, Model } from '@tachybase/database';
|
||||
|
||||
import { Auth, AuthConfig } from '../auth';
|
||||
import { JwtService } from './jwt-service';
|
||||
import { Cache } from '@tachybase/cache';
|
||||
|
||||
/**
|
||||
* BaseAuth
|
||||
@ -56,7 +56,7 @@ export class BaseAuth extends Auth {
|
||||
this.ctx.headers['x-role'] = roleName;
|
||||
}
|
||||
|
||||
const cache = this.ctx.cache as Cache;
|
||||
const cache = this.ctx.cache;
|
||||
return await cache.wrap(this.getCacheKey(userId), () =>
|
||||
this.userRepository.findOne({
|
||||
filter: {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import jwt, { SignOptions } from 'jsonwebtoken';
|
||||
|
||||
import { ITokenBlacklistService } from './token-blacklist-service';
|
||||
|
||||
export interface JwtOptions {
|
||||
|
10
packages/core/cache/package.json
vendored
10
packages/core/cache/package.json
vendored
@ -8,11 +8,13 @@
|
||||
"dependencies": {
|
||||
"bloom-filters": "^3.0.1",
|
||||
"cache-manager": "^5.2.4",
|
||||
"cache-manager-redis-yet": "^4.1.2"
|
||||
"cache-manager-redis-yet": "^4.1.2",
|
||||
"deepmerge": "^4.2.2",
|
||||
"lodash": "4.17.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"deepmerge": "^4.2.2",
|
||||
"lodash": "4.17.21",
|
||||
"redis": "^4.6.10"
|
||||
"@types/lodash": "^4.17.5",
|
||||
"redis": "^4.6.10",
|
||||
"vitest": "^1.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { Cache } from '../cache';
|
||||
import { CacheManager } from '../cache-manager';
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { Cache } from '../cache';
|
||||
import { CacheManager } from '../cache-manager';
|
||||
import lodash from 'lodash';
|
||||
|
||||
describe('cache', () => {
|
||||
let cache: Cache;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { BloomFilter } from 'bloom-filters';
|
||||
|
||||
import { BloomFilter as IBloomFilter } from '.';
|
||||
import { Cache } from '../cache';
|
||||
import { BloomFilter } from 'bloom-filters';
|
||||
|
||||
export class MemoryBloomFilter implements IBloomFilter {
|
||||
cache: Cache;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { RedisStore } from 'cache-manager-redis-yet';
|
||||
import type { RedisClientType } from 'redis';
|
||||
|
||||
import { BloomFilter } from '.';
|
||||
import { Cache } from '../cache';
|
||||
|
||||
|
@ -17,5 +17,14 @@
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
"koa-compose": "^4.1.0",
|
||||
"lodash": "4.17.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/koa": "^2.15.0",
|
||||
"@types/koa-bodyparser": "^4.3.12",
|
||||
"@types/lodash": "^4.17.5",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"koa": "^2.15.3",
|
||||
"koa-bodyparser": "4.4.1",
|
||||
"supertest": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { createMockServer } from '@tachybase/test';
|
||||
|
||||
import { DataSource } from '../data-source';
|
||||
import { ICollectionManager } from '../types';
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { createMockServer, mockDatabase, supertest } from '@tachybase/test';
|
||||
|
||||
import { SequelizeDataSource } from '../sequelize-data-source';
|
||||
|
||||
describe('example', () => {
|
||||
|
@ -1,7 +1,9 @@
|
||||
import { mockDatabase } from '@tachybase/test';
|
||||
|
||||
import Koa from 'koa';
|
||||
import bodyParser from 'koa-bodyparser';
|
||||
import supertest from 'supertest';
|
||||
|
||||
import { DataSourceManager } from '../data-source-manager';
|
||||
import { SequelizeDataSource } from '../sequelize-data-source';
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { CollectionOptions, ICollection, ICollectionManager, IField, IRepository } from './types';
|
||||
import { default as lodash } from 'lodash';
|
||||
import merge from 'deepmerge';
|
||||
import { default as lodash } from 'lodash';
|
||||
|
||||
import { CollectionField } from './collection-field';
|
||||
import { CollectionOptions, ICollection, ICollectionManager, IField, IRepository } from './types';
|
||||
|
||||
export class Collection implements ICollection {
|
||||
repository: IRepository;
|
||||
|
@ -1,7 +1,9 @@
|
||||
import EventEmitter from 'events';
|
||||
import { ACL } from '@tachybase/acl';
|
||||
import { getNameByParams, parseRequest } from '@tachybase/resourcer';
|
||||
import EventEmitter from 'events';
|
||||
|
||||
import compose from 'koa-compose';
|
||||
|
||||
import { loadDefaultActions } from './load-default-actions';
|
||||
import { ResourceManager } from './resource-manager';
|
||||
import { ICollectionManager } from './types';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { assign } from '@tachybase/utils';
|
||||
import { getRepositoryFromParams, pageArgsToLimitArgs } from './utils';
|
||||
import { Context } from '@tachybase/actions';
|
||||
import { assign } from '@tachybase/utils';
|
||||
|
||||
import { getRepositoryFromParams, pageArgsToLimitArgs } from './utils';
|
||||
|
||||
function totalPage(total, pageSize): number {
|
||||
return Math.ceil(total / pageSize);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { DataSource } from '../data-source';
|
||||
import { getRepositoryFromParams } from './utils';
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Context } from '@tachybase/actions';
|
||||
|
||||
import { DataSource, IRepository } from '../';
|
||||
|
||||
export function pageArgsToLimitArgs(
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { DataSource } from './data-source';
|
||||
import { list } from './default-actions/list';
|
||||
import { move } from './default-actions/move';
|
||||
import { proxyToRepository } from './default-actions/proxy-to-repository';
|
||||
import { DataSource } from './data-source';
|
||||
|
||||
type Actions = { [key: string]: { params: Array<string> | ((ctx: any) => Array<string>); method: string } };
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { IModel, IRepository } from './types';
|
||||
import * as console from 'console';
|
||||
|
||||
import { IModel, IRepository } from './types';
|
||||
|
||||
export class Repository implements IRepository {
|
||||
async create(options) {
|
||||
console.log('Repository.create....');
|
||||
|
@ -1,4 +1,5 @@
|
||||
import Database from '@tachybase/database';
|
||||
|
||||
import { CollectionOptions, ICollection, ICollectionManager, IRepository, MergeOptions } from './types';
|
||||
|
||||
export class SequelizeCollectionManager implements ICollectionManager {
|
||||
|
@ -28,7 +28,8 @@
|
||||
"umzug": "^3.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/flat": "^5.0.5",
|
||||
"@types/glob": "^7.2.0",
|
||||
"@types/lodash": "4.17.0"
|
||||
"@types/lodash": "^4.17.5"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { mockDatabase } from './';
|
||||
import Database from '../database';
|
||||
import { mockDatabase } from './';
|
||||
|
||||
describe('adjacency list repository', () => {
|
||||
let db: Database;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Database } from '../../database';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('association references', () => {
|
||||
let db: Database;
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { Collection } from '../collection';
|
||||
import Database from '../database';
|
||||
import { mockDatabase } from './index';
|
||||
import { Collection } from '../collection';
|
||||
|
||||
describe('collection factory', function () {
|
||||
let db: Database;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { ImporterReader } from '../collection-importer';
|
||||
import * as path from 'path';
|
||||
|
||||
import { ImporterReader } from '../collection-importer';
|
||||
import { extend } from '../database';
|
||||
|
||||
describe('collection importer', () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { mockDatabase } from './index';
|
||||
import { Database } from '../database';
|
||||
import { mockDatabase } from './index';
|
||||
|
||||
describe('collection sortable options', () => {
|
||||
let db: Database;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Collection } from '../collection';
|
||||
import { Database } from '../database';
|
||||
import { mockDatabase } from './index';
|
||||
import { IdentifierError } from '../errors/identifier-error';
|
||||
import { mockDatabase } from './index';
|
||||
|
||||
const pgOnly = () => (process.env.DB_DIALECT == 'postgres' ? it : it.skip);
|
||||
describe('collection', () => {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { mockDatabase } from './index';
|
||||
import path from 'path';
|
||||
|
||||
import Database from '../database';
|
||||
import { mockDatabase } from './index';
|
||||
|
||||
describe('database', () => {
|
||||
let db: Database;
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { vi } from 'vitest';
|
||||
import path from 'path';
|
||||
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { Database, Model } from '..';
|
||||
import { ArrayFieldRepository } from '../field-repository/array-field-repository';
|
||||
import { mockDatabase } from './index';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import Database, { mockDatabase } from '@tachybase/database';
|
||||
|
||||
import { EagerLoadingTree } from '../../eager-loading/eager-loading-tree';
|
||||
|
||||
describe('Eager loading tree', () => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { mockDatabase } from '@tachybase/test';
|
||||
|
||||
import { BelongsToManyRepository, Database } from '../../index';
|
||||
|
||||
describe('associated field order', () => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import Database from '../../database';
|
||||
import { ArrayFieldRepository } from '../../field-repository/array-field-repository';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('Array field repository', () => {
|
||||
let db: Database;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Database } from '../../database';
|
||||
import { mockDatabase } from '../';
|
||||
import { Database } from '../../database';
|
||||
import { IdentifierError } from '../../errors/identifier-error';
|
||||
|
||||
describe('belongs to field', () => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { DataTypes } from 'sequelize';
|
||||
|
||||
import { mockDatabase } from '../';
|
||||
import { Database } from '../../';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Database } from '../../database';
|
||||
import { mockDatabase } from '../';
|
||||
import { Database } from '../../database';
|
||||
import { IdentifierError } from '../../errors/identifier-error';
|
||||
|
||||
describe('has many field', () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Database } from '../../database';
|
||||
import { mockDatabase } from '../';
|
||||
import { Database } from '../../database';
|
||||
import { IdentifierError } from '../../errors/identifier-error';
|
||||
|
||||
describe('has many field', () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Database } from '../../database';
|
||||
import { mockDatabase } from '../';
|
||||
import { Database } from '../../database';
|
||||
import { SortField } from '../../fields';
|
||||
|
||||
describe('string field', () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Database } from '../../database';
|
||||
import { mockDatabase } from '../';
|
||||
import { Database } from '../../database';
|
||||
|
||||
describe('string field', () => {
|
||||
let db: Database;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Op } from 'sequelize';
|
||||
|
||||
import { Database } from '../database';
|
||||
import FilterParser from '../filter-parser';
|
||||
import { mockDatabase } from './index';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Database, mockDatabase } from '@tachybase/database';
|
||||
|
||||
import sequelize from 'sequelize';
|
||||
|
||||
describe('migrator', () => {
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { BelongsToManyRepository } from '@tachybase/database';
|
||||
import { isPg } from '@tachybase/test';
|
||||
|
||||
import Database from '../../database';
|
||||
import { InheritedCollection } from '../../inherited-collection';
|
||||
import { mockDatabase } from '../index';
|
||||
import { isPg } from '@tachybase/test';
|
||||
|
||||
describe.runIf(isPg())('collection inherits', () => {
|
||||
let db: Database;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { vi } from 'vitest';
|
||||
import { Database, Migration, mockDatabase } from '@tachybase/database';
|
||||
import { resolve } from 'path';
|
||||
import { Database, Migration, mockDatabase } from '@tachybase/database';
|
||||
|
||||
import { vi } from 'vitest';
|
||||
|
||||
const names = (migrations: Array<{ name: string }>) => migrations.map((m) => m.name);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Database } from '..';
|
||||
import { mockDatabase } from '.';
|
||||
import { Database } from '..';
|
||||
|
||||
describe('model hook', () => {
|
||||
let db: Database;
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Database from '../../database';
|
||||
import { Collection } from '../../collection';
|
||||
|
||||
import Database from '../../database';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('association operator', () => {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import Database from '../../database';
|
||||
import { Collection } from '../../collection';
|
||||
|
||||
import Database from '../../database';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('empty operator', () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import Database from '../../database';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('ne operator', () => {
|
||||
let db: Database;
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import { Database } from '../../database';
|
||||
import { randomStr } from '@tachybase/test';
|
||||
|
||||
import { Database } from '../../database';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('auth', () => {
|
||||
let db: Database;
|
||||
afterEach(async () => {
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { Collection } from '@tachybase/database';
|
||||
import { pgOnly } from '@tachybase/test';
|
||||
|
||||
import Database from '../../database';
|
||||
import { BelongsToManyRepository } from '../../relation-repository/belongs-to-many-repository';
|
||||
import { mockDatabase } from '../index';
|
||||
import { pgOnly } from '@tachybase/test';
|
||||
|
||||
pgOnly()('belongs to many with targetCollection', () => {
|
||||
let db: Database;
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import { HasManyRepository } from '../../relation-repository/hasmany-repository';
|
||||
import { BelongsToManyRepository } from '../../relation-repository/belongs-to-many-repository';
|
||||
import Database, { Collection } from '@tachybase/database';
|
||||
|
||||
import { BelongsToManyRepository } from '../../relation-repository/belongs-to-many-repository';
|
||||
import { HasManyRepository } from '../../relation-repository/hasmany-repository';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('has many with target key', function () {
|
||||
let db: Database;
|
||||
afterEach(async () => {
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { Repository } from '@tachybase/database';
|
||||
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { Collection } from '../collection';
|
||||
import { Database } from '../database';
|
||||
import { mockDatabase } from './';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { BelongsToManyRepository, HasManyRepository, mockDatabase } from '../../index';
|
||||
import Database from '../../database';
|
||||
import { Collection } from '../../collection';
|
||||
import Database from '../../database';
|
||||
import { BelongsToManyRepository, HasManyRepository, mockDatabase } from '../../index';
|
||||
|
||||
describe('association aggregation', () => {
|
||||
let db: Database;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import { HasManyRepository } from '../../relation-repository/hasmany-repository';
|
||||
import { Collection } from '../../collection';
|
||||
import { HasManyRepository } from '../../relation-repository/hasmany-repository';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('count', () => {
|
||||
let db;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import Database from '../../database';
|
||||
import { Collection } from '../../collection';
|
||||
import Database from '../../database';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('create with hasMany', () => {
|
||||
let db: Database;
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import { Collection } from '../../collection';
|
||||
import { Database } from '@tachybase/database';
|
||||
|
||||
import { Collection } from '../../collection';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('destroy with targetKey', function () {
|
||||
let db: Database;
|
||||
let User: Collection;
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { mockDatabase } from '../index';
|
||||
import Database from '@tachybase/database';
|
||||
import { Collection } from '../../collection';
|
||||
|
||||
import qs from 'qs';
|
||||
|
||||
import { Collection } from '../../collection';
|
||||
import { mockDatabase } from '../index';
|
||||
|
||||
describe('find with associations', () => {
|
||||
let db: Database;
|
||||
beforeEach(async () => {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { Database } from '../database';
|
||||
import { mockDatabase } from './index';
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { SQLModel } from '../../sql-collection/sql-model';
|
||||
import { Sequelize } from 'sequelize';
|
||||
|
||||
import { SQLModel } from '../../sql-collection/sql-model';
|
||||
|
||||
describe('select query', () => {
|
||||
const model = class extends SQLModel {};
|
||||
model.init(null, {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { vi } from 'vitest';
|
||||
import { Database, mockDatabase } from '@tachybase/database';
|
||||
|
||||
import { vi } from 'vitest';
|
||||
|
||||
describe('sync', () => {
|
||||
let db: Database;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Database, mockDatabase } from '@tachybase/database';
|
||||
import * as process from 'process';
|
||||
import { Database, mockDatabase } from '@tachybase/database';
|
||||
|
||||
describe('empty table', () => {
|
||||
let db: Database;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Database, mockDatabase } from '../../index';
|
||||
import * as process from 'process';
|
||||
|
||||
import { Database, mockDatabase } from '../../index';
|
||||
|
||||
describe('primary key', () => {
|
||||
let db: Database;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { Database } from '../database';
|
||||
import { mockDatabase } from './';
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { Collection } from '../collection';
|
||||
import { mockDatabase } from './index';
|
||||
import { UpdateGuard } from '../update-guard';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { Collection } from '../collection';
|
||||
import { Database } from '../database';
|
||||
import { UpdateGuard } from '../update-guard';
|
||||
import { mockDatabase } from './index';
|
||||
|
||||
describe('update-guard', () => {
|
||||
let db: Database;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { Database, mockDatabase } from '../..';
|
||||
import { DateValueParser } from '../../value-parsers';
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { vi } from 'vitest';
|
||||
import { uid } from '@tachybase/utils';
|
||||
|
||||
import { vi } from 'vitest';
|
||||
|
||||
import { Database, mockDatabase } from '../../index';
|
||||
import { ViewCollection } from '../../view-collection';
|
||||
import pgOnly from '../inhertits/helper';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Database, mockDatabase } from '@tachybase/database';
|
||||
|
||||
import { ViewFieldInference } from '../../view/view-inference';
|
||||
|
||||
describe('view inference', function () {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user