• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

teableio / teable / 10279245315

07 Aug 2024 06:25AM UTC coverage: 17.351% (-0.4%) from 17.728%
10279245315

Pull #721

github

web-flow
Merge 70fc54bd4 into 1df1bc808
Pull Request #721: feat: sql query

1388 of 2837 branches covered (48.92%)

25 of 1927 new or added lines in 39 files covered. (1.3%)

1 existing line in 1 file now uncovered.

14099 of 81259 relevant lines covered (17.35%)

1.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/core/src/auth/actions.ts
1
/* eslint-disable @typescript-eslint/naming-convention */
×
2
import { z } from 'zod';
×
3

×
4
export enum ActionPrefix {
×
5
  Space = 'space',
×
6
  Base = 'base',
×
7
  Table = 'table',
×
8
  View = 'view',
×
9
  Record = 'record',
×
10
  Field = 'field',
×
11
  Automation = 'automation',
×
12
  User = 'user',
×
13
}
×
14

×
15
const defaultActionsSchema = z.enum(['create', 'update', 'delete', 'read']);
×
16

×
17
export const spaceActionsSchema = defaultActionsSchema.or(
×
18
  z.enum(['invite_email', 'invite_link', 'grant_role'])
×
19
);
×
20

×
21
export type SpaceActions = `${ActionPrefix.Space}|${z.infer<typeof spaceActionsSchema>}`;
×
22

×
23
export const baseActionsSchema = defaultActionsSchema.or(
×
24
  z.enum([
×
25
    'invite_email',
×
26
    'invite_link',
×
27
    'table_import',
×
28
    'table_export',
×
29
    'authority_matrix_config',
×
30
    'db_connection',
×
NEW
31
    'query_data',
×
32
  ])
×
33
);
×
34

×
35
export type BaseActions = `${ActionPrefix.Base}|${z.infer<typeof baseActionsSchema>}`;
×
36

×
37
export const tableActionsSchema = defaultActionsSchema.or(z.enum(['import', 'export']));
×
38

×
39
export type TableActions = `${ActionPrefix.Table}|${z.infer<typeof tableActionsSchema>}`;
×
40

×
41
export const viewActionsSchema = defaultActionsSchema;
×
42

×
43
export type ViewActions = `${ActionPrefix.View}|${z.infer<typeof viewActionsSchema>}`;
×
44

×
45
export const fieldActionsSchema = defaultActionsSchema;
×
46

×
47
export type FieldActions = `${ActionPrefix.Field}|${z.infer<typeof fieldActionsSchema>}`;
×
48

×
49
export const recordActionsSchema = defaultActionsSchema.or(z.enum(['comment']));
×
50

×
51
export type RecordActions = `${ActionPrefix.Record}|${z.infer<typeof recordActionsSchema>}`;
×
52

×
53
export const automationActionsSchema = defaultActionsSchema;
×
54

×
55
export type AutomationActions =
×
56
  `${ActionPrefix.Automation}|${z.infer<typeof automationActionsSchema>}`;
×
57

×
58
export const userActionsSchema = z.enum(['email_read']);
×
59

×
60
export type UserActions = `${ActionPrefix.User}|${z.infer<typeof userActionsSchema>}`;
×
61

×
62
export type AllActions =
×
63
  | SpaceActions
×
64
  | BaseActions
×
65
  | TableActions
×
66
  | ViewActions
×
67
  | FieldActions
×
68
  | RecordActions
×
69
  | AutomationActions
×
70
  | UserActions;
×
71

×
72
export type ActionPrefixMap = {
×
73
  [ActionPrefix.Space]: SpaceActions[];
×
74
  [ActionPrefix.Base]: BaseActions[];
×
75
  [ActionPrefix.Table]: TableActions[];
×
76
  [ActionPrefix.View]: ViewActions[];
×
77
  [ActionPrefix.Field]: FieldActions[];
×
78
  [ActionPrefix.Record]: RecordActions[];
×
79
  [ActionPrefix.Automation]: AutomationActions[];
×
80
  [ActionPrefix.User]: UserActions[];
×
81
};
×
82

×
83
export const actionPrefixMap: ActionPrefixMap = {
×
84
  [ActionPrefix.Space]: ['space|create', 'space|delete', 'space|read', 'space|update'],
×
85
  [ActionPrefix.Base]: [
×
86
    'base|create',
×
87
    'base|delete',
×
88
    'base|read',
×
89
    'base|update',
×
90
    'base|table_import',
×
91
    'base|table_export',
×
92
    'base|db_connection',
×
93
    'base|authority_matrix_config',
×
94
  ],
×
95
  [ActionPrefix.Table]: [
×
96
    'table|create',
×
97
    'table|delete',
×
98
    'table|read',
×
99
    'table|update',
×
100
    'table|import',
×
101
    'table|export',
×
102
  ],
×
103
  [ActionPrefix.View]: ['view|create', 'view|delete', 'view|read', 'view|update'],
×
104
  [ActionPrefix.Field]: ['field|create', 'field|delete', 'field|read', 'field|update'],
×
105
  [ActionPrefix.Record]: [
×
106
    'record|create',
×
107
    'record|delete',
×
108
    'record|read',
×
109
    'record|update',
×
110
    'record|comment',
×
111
  ],
×
112
  [ActionPrefix.Automation]: [
×
113
    'automation|create',
×
114
    'automation|delete',
×
115
    'automation|read',
×
116
    'automation|update',
×
117
  ],
×
118
  [ActionPrefix.User]: ['user|email_read'],
×
119
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc