Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
105 lines (94 loc) · 2.56 KB
/
Copy pathtypes.ts
File metadata and controls
105 lines (94 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/** Config application submitted by the user client for Access/Request setup. */
export type ApplicationStatus = "pending" | "approved" | "rejected";
export type HttpBodyType = "JSON" | "PARAM" | "FORM" | "DATA";
export type ApiJsonOp =
| "get"
| "head"
| "gets"
| "heads"
| "post"
| "put"
| "delete"
| "crud";
export type WriteTargetResult = {
ok: boolean;
action?: "post" | "put" | "skip";
id?: number | string;
error?: string;
body?: unknown;
};
export type ApplicationWriteResults = {
Access?: WriteTargetResult;
Request?: WriteTargetResult;
Document?: WriteTargetResult;
Chain?: WriteTargetResult;
/** APIJSON `/reload` after Access/Request writes (TYPE_RELOAD verify). */
Reload?: WriteTargetResult;
};
/**
* User-submitted permission / API config application.
* Carries table+op+role+version and the HTTP APIJSON call to authorize.
*/
export type ConfigApplication = {
id: string;
status: ApplicationStatus;
createdAt: string;
updatedAt?: string;
decidedAt?: string;
decidedBy?: string;
/** Business table alias (e.g. User) or physical name. */
table: string;
/** APIJSON method / Access column (get|post|put|delete|…). */
operation: ApiJsonOp | string;
/** Role to grant (LOGIN|OWNER|ADMIN|…). */
role: string;
/** Request.version */
version: number;
/** HTTP Method for Document (GET|POST|PUT|DELETE|…). */
method: string;
/** Document.type */
type: HttpBodyType;
/** Document.url — often http://host/put or /put */
url: string;
/** APIJSON request body */
json: Record<string, unknown>;
/** Request.tag — defaults to table */
tag?: string;
/** Request.structure — editable before approve */
structure?: Record<string, unknown>;
/** Access.alias when different from table */
accessAlias?: string;
/** Access.name (physical table) when known */
accessName?: string;
/** Document.name */
name?: string;
/** Free-form detail / rationale */
detail?: string;
/** Linked HITL / chat-demo request */
requestId?: string;
sessionId?: string;
submitter?: string;
issues?: string[];
writeResults?: ApplicationWriteResults;
error?: string;
};
export type ApplicationSubmitInput = {
table: string;
operation: string;
role?: string;
version?: number;
method: string;
type?: HttpBodyType;
url: string;
json: Record<string, unknown> | string;
tag?: string;
structure?: Record<string, unknown>;
accessAlias?: string;
accessName?: string;
name?: string;
detail?: string;
requestId?: string;
sessionId?: string;
submitter?: string;
issues?: string[];
};