@webstudio-is/trpc-interface 0.90.0 → 0.260.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +26 -25
- package/src/authorize/project.server.test.ts +443 -0
- package/src/authorize/project.server.ts +309 -121
- package/src/authorize/role.ts +18 -0
- package/src/context/context.server.ts +59 -24
- package/src/context/errors.server.ts +16 -0
- package/src/context/router.server.ts +19 -0
- package/src/index.server.ts +15 -3
- package/src/shared/client.ts +0 -2
- package/src/shared/deployment.ts +23 -6
- package/src/shared/domain.ts +3 -3
- package/src/shared/plan-client.server.ts +7 -0
- package/src/shared/plan-features.ts +7 -0
- package/src/shared/shared-router.ts +0 -2
- package/src/shared/trpc.ts +5 -1
- package/src/trpc-caller-link.test.ts +1 -1
- package/src/trpc-caller-link.ts +1 -2
- package/tsconfig.json +3 -0
- package/lib/authorize/authorization-token.server.js +0 -72
- package/lib/authorize/project.server.js +0 -103
- package/lib/cjs/authorize/authorization-token.server.js +0 -92
- package/lib/cjs/authorize/project.server.js +0 -123
- package/lib/cjs/context/context.server.js +0 -16
- package/lib/cjs/context/errors.server.js +0 -29
- package/lib/cjs/index.js +0 -18
- package/lib/cjs/index.server.js +0 -40
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/shared/authorization-router.js +0 -184
- package/lib/cjs/shared/client.js +0 -63
- package/lib/cjs/shared/deployment.js +0 -51
- package/lib/cjs/shared/domain.js +0 -98
- package/lib/cjs/shared/shared-router.js +0 -32
- package/lib/cjs/shared/trpc.js +0 -31
- package/lib/cjs/trpc-caller-link.js +0 -46
- package/lib/context/context.server.js +0 -0
- package/lib/context/errors.server.js +0 -9
- package/lib/index.js +0 -1
- package/lib/index.server.js +0 -10
- package/lib/shared/authorization-router.js +0 -164
- package/lib/shared/client.js +0 -35
- package/lib/shared/deployment.js +0 -31
- package/lib/shared/domain.js +0 -78
- package/lib/shared/shared-router.js +0 -12
- package/lib/shared/trpc.js +0 -11
- package/lib/trpc-caller-link.js +0 -26
- package/lib/types/authorize/authorization-token.server.d.ts +0 -21
- package/lib/types/authorize/project.server.d.ts +0 -25
- package/lib/types/context/context.server.d.ts +0 -53
- package/lib/types/context/errors.server.d.ts +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.server.d.ts +0 -7
- package/lib/types/shared/authorization-router.d.ts +0 -276
- package/lib/types/shared/client.d.ts +0 -8
- package/lib/types/shared/deployment.d.ts +0 -45
- package/lib/types/shared/domain.d.ts +0 -119
- package/lib/types/shared/shared-router.d.ts +0 -415
- package/lib/types/shared/trpc.d.ts +0 -48
- package/lib/types/trpc-caller-link.d.ts +0 -16
- package/lib/types/trpc-caller-link.test.d.ts +0 -49
- package/src/authorize/authorization-token.server.ts +0 -106
- package/src/shared/authorization-router.ts +0 -198
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare const AuthPermit: z.ZodEnum<["view", "edit", "build", "own"]>;
|
|
3
|
-
export type AuthPermit = z.infer<typeof AuthPermit>;
|
|
4
|
-
export declare const authorizationRouter: import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
5
|
-
ctx: {};
|
|
6
|
-
meta: object;
|
|
7
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
8
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
9
|
-
}>, {
|
|
10
|
-
/**
|
|
11
|
-
* Relation expansion in authorize looks like a tree
|
|
12
|
-
*
|
|
13
|
-
* :#@Project:AliceProjectUUID#viewers
|
|
14
|
-
* :#@Email:bob@bob.com#owner
|
|
15
|
-
* :#@User:BobUUID️
|
|
16
|
-
* :#@Token:LinkRandomSequence️
|
|
17
|
-
*
|
|
18
|
-
* We don't need the whole tree in UI and need only the leaf nodes.
|
|
19
|
-
* i.e. @User:BobUUID️, @Token:LinkRandomSequence️ and the root relation i.e "viewers"
|
|
20
|
-
*/
|
|
21
|
-
expandLeafNodes: import("@trpc/server").BuildProcedure<"query", {
|
|
22
|
-
_config: import("@trpc/server").RootConfig<{
|
|
23
|
-
ctx: {};
|
|
24
|
-
meta: object;
|
|
25
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
26
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
27
|
-
}>;
|
|
28
|
-
_meta: object;
|
|
29
|
-
_ctx_out: {};
|
|
30
|
-
_input_in: {
|
|
31
|
-
id: string;
|
|
32
|
-
namespace: "Project";
|
|
33
|
-
};
|
|
34
|
-
_input_out: {
|
|
35
|
-
id: string;
|
|
36
|
-
namespace: "Project";
|
|
37
|
-
};
|
|
38
|
-
_output_in: {
|
|
39
|
-
id: string;
|
|
40
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
41
|
-
namespace: "User" | "Token" | "Email";
|
|
42
|
-
}[];
|
|
43
|
-
_output_out: {
|
|
44
|
-
id: string;
|
|
45
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
46
|
-
namespace: "User" | "Token" | "Email";
|
|
47
|
-
}[];
|
|
48
|
-
}, unknown>;
|
|
49
|
-
/**
|
|
50
|
-
* Check if subject has permit on the resource
|
|
51
|
-
*/
|
|
52
|
-
check: import("@trpc/server").BuildProcedure<"query", {
|
|
53
|
-
_config: import("@trpc/server").RootConfig<{
|
|
54
|
-
ctx: {};
|
|
55
|
-
meta: object;
|
|
56
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
57
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
58
|
-
}>;
|
|
59
|
-
_meta: object;
|
|
60
|
-
_ctx_out: {};
|
|
61
|
-
_input_in: {
|
|
62
|
-
id: string;
|
|
63
|
-
namespace: "Project";
|
|
64
|
-
subjectSet: {
|
|
65
|
-
id: string;
|
|
66
|
-
namespace: "User" | "Token";
|
|
67
|
-
};
|
|
68
|
-
permit: "build" | "view" | "edit" | "own";
|
|
69
|
-
};
|
|
70
|
-
_input_out: {
|
|
71
|
-
id: string;
|
|
72
|
-
namespace: "Project";
|
|
73
|
-
subjectSet: {
|
|
74
|
-
id: string;
|
|
75
|
-
namespace: "User" | "Token";
|
|
76
|
-
};
|
|
77
|
-
permit: "build" | "view" | "edit" | "own";
|
|
78
|
-
};
|
|
79
|
-
_output_in: {
|
|
80
|
-
allowed: boolean;
|
|
81
|
-
};
|
|
82
|
-
_output_out: {
|
|
83
|
-
allowed: boolean;
|
|
84
|
-
};
|
|
85
|
-
}, unknown>;
|
|
86
|
-
/**
|
|
87
|
-
* In OSS we extract owner relation from the Project table, and the rest from the authorizationToken table
|
|
88
|
-
*/
|
|
89
|
-
create: import("@trpc/server").BuildProcedure<"mutation", {
|
|
90
|
-
_config: import("@trpc/server").RootConfig<{
|
|
91
|
-
ctx: {};
|
|
92
|
-
meta: object;
|
|
93
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
94
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
95
|
-
}>;
|
|
96
|
-
_meta: object;
|
|
97
|
-
_ctx_out: {};
|
|
98
|
-
_input_in: {
|
|
99
|
-
id: string;
|
|
100
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
101
|
-
namespace: "Project";
|
|
102
|
-
subjectSet: {
|
|
103
|
-
id: string;
|
|
104
|
-
namespace: "User";
|
|
105
|
-
} | {
|
|
106
|
-
id: string;
|
|
107
|
-
namespace: "Token";
|
|
108
|
-
} | {
|
|
109
|
-
id: string;
|
|
110
|
-
relation: "owners";
|
|
111
|
-
namespace: "Email";
|
|
112
|
-
};
|
|
113
|
-
} | {
|
|
114
|
-
id: string;
|
|
115
|
-
relation: "owners";
|
|
116
|
-
namespace: "Email";
|
|
117
|
-
subjectSet: {
|
|
118
|
-
id: string;
|
|
119
|
-
namespace: "User";
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
_input_out: {
|
|
123
|
-
id: string;
|
|
124
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
125
|
-
namespace: "Project";
|
|
126
|
-
subjectSet: {
|
|
127
|
-
id: string;
|
|
128
|
-
namespace: "User";
|
|
129
|
-
} | {
|
|
130
|
-
id: string;
|
|
131
|
-
namespace: "Token";
|
|
132
|
-
} | {
|
|
133
|
-
id: string;
|
|
134
|
-
relation: "owners";
|
|
135
|
-
namespace: "Email";
|
|
136
|
-
};
|
|
137
|
-
} | {
|
|
138
|
-
id: string;
|
|
139
|
-
relation: "owners";
|
|
140
|
-
namespace: "Email";
|
|
141
|
-
subjectSet: {
|
|
142
|
-
id: string;
|
|
143
|
-
namespace: "User";
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
147
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
148
|
-
}, void>;
|
|
149
|
-
delete: import("@trpc/server").BuildProcedure<"mutation", {
|
|
150
|
-
_config: import("@trpc/server").RootConfig<{
|
|
151
|
-
ctx: {};
|
|
152
|
-
meta: object;
|
|
153
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
154
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
155
|
-
}>;
|
|
156
|
-
_meta: object;
|
|
157
|
-
_ctx_out: {};
|
|
158
|
-
_input_in: {
|
|
159
|
-
id: string;
|
|
160
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
161
|
-
namespace: "Project";
|
|
162
|
-
subjectSet: {
|
|
163
|
-
id: string;
|
|
164
|
-
namespace: "User";
|
|
165
|
-
} | {
|
|
166
|
-
id: string;
|
|
167
|
-
namespace: "Token";
|
|
168
|
-
} | {
|
|
169
|
-
id: string;
|
|
170
|
-
relation: "owners";
|
|
171
|
-
namespace: "Email";
|
|
172
|
-
};
|
|
173
|
-
} | {
|
|
174
|
-
id: string;
|
|
175
|
-
relation: "owners";
|
|
176
|
-
namespace: "Email";
|
|
177
|
-
subjectSet: {
|
|
178
|
-
id: string;
|
|
179
|
-
namespace: "User";
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
_input_out: {
|
|
183
|
-
id: string;
|
|
184
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
185
|
-
namespace: "Project";
|
|
186
|
-
subjectSet: {
|
|
187
|
-
id: string;
|
|
188
|
-
namespace: "User";
|
|
189
|
-
} | {
|
|
190
|
-
id: string;
|
|
191
|
-
namespace: "Token";
|
|
192
|
-
} | {
|
|
193
|
-
id: string;
|
|
194
|
-
relation: "owners";
|
|
195
|
-
namespace: "Email";
|
|
196
|
-
};
|
|
197
|
-
} | {
|
|
198
|
-
id: string;
|
|
199
|
-
relation: "owners";
|
|
200
|
-
namespace: "Email";
|
|
201
|
-
subjectSet: {
|
|
202
|
-
id: string;
|
|
203
|
-
namespace: "User";
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
207
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
208
|
-
}, void>;
|
|
209
|
-
patch: import("@trpc/server").BuildProcedure<"mutation", {
|
|
210
|
-
_config: import("@trpc/server").RootConfig<{
|
|
211
|
-
ctx: {};
|
|
212
|
-
meta: object;
|
|
213
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
214
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
215
|
-
}>;
|
|
216
|
-
_meta: object;
|
|
217
|
-
_ctx_out: {};
|
|
218
|
-
_input_in: {
|
|
219
|
-
action: "delete" | "insert";
|
|
220
|
-
relationTuple: {
|
|
221
|
-
id: string;
|
|
222
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
223
|
-
namespace: "Project";
|
|
224
|
-
subjectSet: {
|
|
225
|
-
id: string;
|
|
226
|
-
namespace: "User";
|
|
227
|
-
} | {
|
|
228
|
-
id: string;
|
|
229
|
-
namespace: "Token";
|
|
230
|
-
} | {
|
|
231
|
-
id: string;
|
|
232
|
-
relation: "owners";
|
|
233
|
-
namespace: "Email";
|
|
234
|
-
};
|
|
235
|
-
} | {
|
|
236
|
-
id: string;
|
|
237
|
-
relation: "owners";
|
|
238
|
-
namespace: "Email";
|
|
239
|
-
subjectSet: {
|
|
240
|
-
id: string;
|
|
241
|
-
namespace: "User";
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
}[];
|
|
245
|
-
_input_out: {
|
|
246
|
-
action: "delete" | "insert";
|
|
247
|
-
relationTuple: {
|
|
248
|
-
id: string;
|
|
249
|
-
relation: "viewers" | "editors" | "builders" | "owners";
|
|
250
|
-
namespace: "Project";
|
|
251
|
-
subjectSet: {
|
|
252
|
-
id: string;
|
|
253
|
-
namespace: "User";
|
|
254
|
-
} | {
|
|
255
|
-
id: string;
|
|
256
|
-
namespace: "Token";
|
|
257
|
-
} | {
|
|
258
|
-
id: string;
|
|
259
|
-
relation: "owners";
|
|
260
|
-
namespace: "Email";
|
|
261
|
-
};
|
|
262
|
-
} | {
|
|
263
|
-
id: string;
|
|
264
|
-
relation: "owners";
|
|
265
|
-
namespace: "Email";
|
|
266
|
-
subjectSet: {
|
|
267
|
-
id: string;
|
|
268
|
-
namespace: "User";
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
}[];
|
|
272
|
-
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
273
|
-
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
274
|
-
}, void>;
|
|
275
|
-
}>;
|
|
276
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type TrpcInterfaceClient } from "./shared-router";
|
|
2
|
-
type SharedClientOptions = {
|
|
3
|
-
url: string;
|
|
4
|
-
token: string;
|
|
5
|
-
branchName: string | undefined;
|
|
6
|
-
};
|
|
7
|
-
export declare const createTrpcProxyServiceClient: (options?: SharedClientOptions | undefined) => TrpcInterfaceClient;
|
|
8
|
-
export {};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the ContentManagementService. It is currently used to publish content to a custom domain.
|
|
3
|
-
* In the future, additional methods, such as a 'preview' function, could be added.
|
|
4
|
-
**/
|
|
5
|
-
export declare const deploymentRouter: import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
6
|
-
ctx: {};
|
|
7
|
-
meta: object;
|
|
8
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
9
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
10
|
-
}>, {
|
|
11
|
-
publish: import("@trpc/server").BuildProcedure<"mutation", {
|
|
12
|
-
_config: import("@trpc/server").RootConfig<{
|
|
13
|
-
ctx: {};
|
|
14
|
-
meta: object;
|
|
15
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
16
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
17
|
-
}>;
|
|
18
|
-
_meta: object;
|
|
19
|
-
_ctx_out: {};
|
|
20
|
-
_input_in: {
|
|
21
|
-
buildId: string;
|
|
22
|
-
builderApiOrigin: string;
|
|
23
|
-
branchName: string;
|
|
24
|
-
projectDomainName: string;
|
|
25
|
-
};
|
|
26
|
-
_input_out: {
|
|
27
|
-
buildId: string;
|
|
28
|
-
builderApiOrigin: string;
|
|
29
|
-
branchName: string;
|
|
30
|
-
projectDomainName: string;
|
|
31
|
-
};
|
|
32
|
-
_output_in: {
|
|
33
|
-
success: true;
|
|
34
|
-
} | {
|
|
35
|
-
error: string;
|
|
36
|
-
success: false;
|
|
37
|
-
};
|
|
38
|
-
_output_out: {
|
|
39
|
-
success: true;
|
|
40
|
-
} | {
|
|
41
|
-
error: string;
|
|
42
|
-
success: false;
|
|
43
|
-
};
|
|
44
|
-
}, unknown>;
|
|
45
|
-
}>;
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
var dnsTxtEntries: Map<string, string>;
|
|
3
|
-
var domainStates: Map<string, "active" | "pending" | "error">;
|
|
4
|
-
}
|
|
5
|
-
export declare const domainRouter: import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
6
|
-
ctx: {};
|
|
7
|
-
meta: object;
|
|
8
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
9
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
10
|
-
}>, {
|
|
11
|
-
/**
|
|
12
|
-
* Verify TXT record and add custom domain entry to DNS
|
|
13
|
-
*/
|
|
14
|
-
create: import("@trpc/server").BuildProcedure<"mutation", {
|
|
15
|
-
_config: import("@trpc/server").RootConfig<{
|
|
16
|
-
ctx: {};
|
|
17
|
-
meta: object;
|
|
18
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
19
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
20
|
-
}>;
|
|
21
|
-
_meta: object;
|
|
22
|
-
_ctx_out: {};
|
|
23
|
-
_input_in: {
|
|
24
|
-
domain: string;
|
|
25
|
-
txtRecord: string;
|
|
26
|
-
};
|
|
27
|
-
_input_out: {
|
|
28
|
-
domain: string;
|
|
29
|
-
txtRecord: string;
|
|
30
|
-
};
|
|
31
|
-
_output_in: {
|
|
32
|
-
success: true;
|
|
33
|
-
data?: undefined;
|
|
34
|
-
} | {
|
|
35
|
-
error: string;
|
|
36
|
-
success: false;
|
|
37
|
-
};
|
|
38
|
-
_output_out: {
|
|
39
|
-
success: true;
|
|
40
|
-
data?: undefined;
|
|
41
|
-
} | {
|
|
42
|
-
error: string;
|
|
43
|
-
success: false;
|
|
44
|
-
};
|
|
45
|
-
}, unknown>;
|
|
46
|
-
refresh: import("@trpc/server").BuildProcedure<"mutation", {
|
|
47
|
-
_config: import("@trpc/server").RootConfig<{
|
|
48
|
-
ctx: {};
|
|
49
|
-
meta: object;
|
|
50
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
51
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
52
|
-
}>;
|
|
53
|
-
_meta: object;
|
|
54
|
-
_ctx_out: {};
|
|
55
|
-
_input_in: {
|
|
56
|
-
domain: string;
|
|
57
|
-
};
|
|
58
|
-
_input_out: {
|
|
59
|
-
domain: string;
|
|
60
|
-
};
|
|
61
|
-
_output_in: {
|
|
62
|
-
success: true;
|
|
63
|
-
data?: undefined;
|
|
64
|
-
} | {
|
|
65
|
-
error: string;
|
|
66
|
-
success: false;
|
|
67
|
-
};
|
|
68
|
-
_output_out: {
|
|
69
|
-
success: true;
|
|
70
|
-
data?: undefined;
|
|
71
|
-
} | {
|
|
72
|
-
error: string;
|
|
73
|
-
success: false;
|
|
74
|
-
};
|
|
75
|
-
}, unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* Get status of verified domain
|
|
78
|
-
*/
|
|
79
|
-
getStatus: import("@trpc/server").BuildProcedure<"query", {
|
|
80
|
-
_config: import("@trpc/server").RootConfig<{
|
|
81
|
-
ctx: {};
|
|
82
|
-
meta: object;
|
|
83
|
-
errorShape: import("@trpc/server").DefaultErrorShape;
|
|
84
|
-
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
85
|
-
}>;
|
|
86
|
-
_meta: object;
|
|
87
|
-
_ctx_out: {};
|
|
88
|
-
_input_in: {
|
|
89
|
-
domain: string;
|
|
90
|
-
};
|
|
91
|
-
_input_out: {
|
|
92
|
-
domain: string;
|
|
93
|
-
};
|
|
94
|
-
_output_in: {
|
|
95
|
-
data: {
|
|
96
|
-
status: "active" | "pending";
|
|
97
|
-
} | {
|
|
98
|
-
error: string;
|
|
99
|
-
status: "error";
|
|
100
|
-
};
|
|
101
|
-
success: true;
|
|
102
|
-
} | {
|
|
103
|
-
error: string;
|
|
104
|
-
success: false;
|
|
105
|
-
};
|
|
106
|
-
_output_out: {
|
|
107
|
-
data: {
|
|
108
|
-
status: "active" | "pending";
|
|
109
|
-
} | {
|
|
110
|
-
error: string;
|
|
111
|
-
status: "error";
|
|
112
|
-
};
|
|
113
|
-
success: true;
|
|
114
|
-
} | {
|
|
115
|
-
error: string;
|
|
116
|
-
success: false;
|
|
117
|
-
};
|
|
118
|
-
}, unknown>;
|
|
119
|
-
}>;
|