@tailor-platform/sdk 0.0.1 → 0.8.0
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/CHANGELOG.md +784 -0
- package/LICENSE +21 -0
- package/README.md +8 -41
- package/dist/auth-Di3vQUrT.mjs +743 -0
- package/dist/cli/api.d.mts +213 -0
- package/dist/cli/api.mjs +4 -0
- package/dist/cli/index.d.mts +3 -0
- package/dist/cli/index.mjs +996 -0
- package/dist/configure/index.d.mts +5 -0
- package/dist/configure/index.mjs +108 -0
- package/dist/index-D-0knE68.d.mts +232 -0
- package/dist/plugin-generated.d.ts +14 -0
- package/dist/token-PbgBrNwb.mjs +5498 -0
- package/dist/types-DSAthMLp.d.mts +1389 -0
- package/dist/utils/test/index.d.mts +40 -0
- package/dist/utils/test/index.mjs +63 -0
- package/docs/cli-reference.md +484 -0
- package/docs/configuration.md +132 -0
- package/docs/core-concepts.md +504 -0
- package/docs/quickstart.md +96 -0
- package/docs/testing.md +298 -0
- package/package.json +87 -8
- package/postinstall.mjs +87 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/// <reference path="./../plugin-generated.d.ts" />
|
|
2
|
+
|
|
3
|
+
import { AppConfig, CodeGeneratorBase, Executor, Generator, Resolver, TailorDBTypeConfig } from "../types-DSAthMLp.mjs";
|
|
4
|
+
import "citty";
|
|
5
|
+
import "zod";
|
|
6
|
+
import "@bufbuild/protobuf/wkt";
|
|
7
|
+
import "@bufbuild/protobuf/codegenv2";
|
|
8
|
+
import "@bufbuild/protobuf";
|
|
9
|
+
|
|
10
|
+
//#region src/cli/apply/index.d.ts
|
|
11
|
+
interface ApplyOptions {
|
|
12
|
+
workspaceId?: string;
|
|
13
|
+
profile?: string;
|
|
14
|
+
configPath?: string;
|
|
15
|
+
dryRun?: boolean;
|
|
16
|
+
buildOnly?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare function apply(options?: ApplyOptions): Promise<void>;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/parser/service/tailordb/types.d.ts
|
|
21
|
+
/**
|
|
22
|
+
* Parsed and normalized TailorDB field information
|
|
23
|
+
*/
|
|
24
|
+
interface ParsedField {
|
|
25
|
+
name: string;
|
|
26
|
+
config: TailorDBTypeConfig["schema"]["fields"][string];
|
|
27
|
+
relation?: {
|
|
28
|
+
targetType: string;
|
|
29
|
+
forwardName: string;
|
|
30
|
+
backwardName: string;
|
|
31
|
+
key: string;
|
|
32
|
+
unique: boolean;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parsed and normalized TailorDB relationship information
|
|
37
|
+
*/
|
|
38
|
+
interface ParsedRelationship {
|
|
39
|
+
name: string;
|
|
40
|
+
targetType: string;
|
|
41
|
+
targetField: string;
|
|
42
|
+
sourceField: string;
|
|
43
|
+
isArray: boolean;
|
|
44
|
+
description: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Parsed and normalized TailorDB type information
|
|
48
|
+
*/
|
|
49
|
+
interface ParsedTailorDBType {
|
|
50
|
+
name: string;
|
|
51
|
+
pluralForm: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
fields: Record<string, ParsedField>;
|
|
54
|
+
forwardRelationships: Record<string, ParsedRelationship>;
|
|
55
|
+
backwardRelationships: Record<string, ParsedRelationship>;
|
|
56
|
+
settings: TailorDBTypeConfig["schema"]["settings"];
|
|
57
|
+
permissions: TailorDBTypeConfig["schema"]["permissions"];
|
|
58
|
+
indexes?: TailorDBTypeConfig["schema"]["indexes"];
|
|
59
|
+
files?: TailorDBTypeConfig["schema"]["files"];
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/cli/generator/types.d.ts
|
|
63
|
+
interface GeneratedFile {
|
|
64
|
+
path: string;
|
|
65
|
+
content: string;
|
|
66
|
+
skipIfExists?: boolean;
|
|
67
|
+
executable?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface GeneratorResult {
|
|
70
|
+
files: GeneratedFile[];
|
|
71
|
+
errors?: string[];
|
|
72
|
+
}
|
|
73
|
+
interface TailorDBNamespaceResult<T> {
|
|
74
|
+
namespace: string;
|
|
75
|
+
types: T;
|
|
76
|
+
}
|
|
77
|
+
interface ResolverNamespaceResult<R> {
|
|
78
|
+
namespace: string;
|
|
79
|
+
resolvers: R;
|
|
80
|
+
}
|
|
81
|
+
interface GeneratorInput<T, R> {
|
|
82
|
+
applicationNamespace: string;
|
|
83
|
+
tailordb: TailorDBNamespaceResult<T>[];
|
|
84
|
+
resolver: ResolverNamespaceResult<R>[];
|
|
85
|
+
}
|
|
86
|
+
interface CodeGenerator<T = any, R = any, E = any, Ts = any, Rs = any> extends Omit<CodeGeneratorBase, "processType" | "processResolver" | "processExecutor" | "aggregate"> {
|
|
87
|
+
processType(args: {
|
|
88
|
+
type: ParsedTailorDBType;
|
|
89
|
+
applicationNamespace: string;
|
|
90
|
+
namespace: string;
|
|
91
|
+
source: {
|
|
92
|
+
filePath: string;
|
|
93
|
+
exportName: string;
|
|
94
|
+
};
|
|
95
|
+
}): T | Promise<T>;
|
|
96
|
+
processResolver(args: {
|
|
97
|
+
resolver: Resolver;
|
|
98
|
+
applicationNamespace: string;
|
|
99
|
+
namespace: string;
|
|
100
|
+
}): R | Promise<R>;
|
|
101
|
+
processExecutor(executor: Executor): E | Promise<E>;
|
|
102
|
+
processTailorDBNamespace?(args: {
|
|
103
|
+
applicationNamespace: string;
|
|
104
|
+
namespace: string;
|
|
105
|
+
types: Record<string, T>;
|
|
106
|
+
}): Ts | Promise<Ts>;
|
|
107
|
+
processResolverNamespace?(args: {
|
|
108
|
+
applicationNamespace: string;
|
|
109
|
+
namespace: string;
|
|
110
|
+
resolvers: Record<string, R>;
|
|
111
|
+
}): Rs | Promise<Rs>;
|
|
112
|
+
aggregate(args: {
|
|
113
|
+
inputs: GeneratorInput<Ts, Rs>[];
|
|
114
|
+
executorInputs: E[];
|
|
115
|
+
baseDir: string;
|
|
116
|
+
}): GeneratorResult | Promise<GeneratorResult>;
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/cli/generator/options.d.ts
|
|
120
|
+
type GenerateOptions = {
|
|
121
|
+
configPath?: string;
|
|
122
|
+
watch?: boolean;
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/cli/generator/index.d.ts
|
|
126
|
+
declare function generate(options?: GenerateOptions): Promise<void>;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/cli/config-loader.d.ts
|
|
129
|
+
declare function loadConfig(configPath: string): Promise<{
|
|
130
|
+
config: AppConfig;
|
|
131
|
+
generators: Generator[];
|
|
132
|
+
}>;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/cli/type-generator.d.ts
|
|
135
|
+
declare function generateUserTypes(config: AppConfig, configPath: string): Promise<void>;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/cli/show.d.ts
|
|
138
|
+
interface ShowOptions {
|
|
139
|
+
workspaceId?: string;
|
|
140
|
+
profile?: string;
|
|
141
|
+
configPath?: string;
|
|
142
|
+
}
|
|
143
|
+
interface ApplicationInfo {
|
|
144
|
+
name: string;
|
|
145
|
+
domain: string;
|
|
146
|
+
url: string;
|
|
147
|
+
auth: string;
|
|
148
|
+
cors: string[];
|
|
149
|
+
allowedIpAddresses: string[];
|
|
150
|
+
disableIntrospection: boolean;
|
|
151
|
+
createdAt: string;
|
|
152
|
+
updatedAt: string;
|
|
153
|
+
}
|
|
154
|
+
declare function show(options?: ShowOptions): Promise<ApplicationInfo>;
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/cli/workspace/transform.d.ts
|
|
157
|
+
interface WorkspaceInfo {
|
|
158
|
+
id: string;
|
|
159
|
+
name: string;
|
|
160
|
+
region: string;
|
|
161
|
+
createdAt: string;
|
|
162
|
+
updatedAt: string;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/cli/workspace/create.d.ts
|
|
166
|
+
interface WorkspaceCreateOptions {
|
|
167
|
+
name: string;
|
|
168
|
+
region: string;
|
|
169
|
+
deleteProtection?: boolean;
|
|
170
|
+
organizationId?: string;
|
|
171
|
+
folderId?: string;
|
|
172
|
+
}
|
|
173
|
+
declare function workspaceCreate(options: WorkspaceCreateOptions): Promise<WorkspaceInfo>;
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/cli/workspace/list.d.ts
|
|
176
|
+
declare function workspaceList(): Promise<WorkspaceInfo[]>;
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/cli/workspace/delete.d.ts
|
|
179
|
+
interface WorkspaceDeleteOptions {
|
|
180
|
+
workspaceId: string;
|
|
181
|
+
}
|
|
182
|
+
declare function workspaceDelete(options: WorkspaceDeleteOptions): Promise<void>;
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/cli/machineuser/list.d.ts
|
|
185
|
+
interface MachineUserListOptions {
|
|
186
|
+
workspaceId?: string;
|
|
187
|
+
profile?: string;
|
|
188
|
+
configPath?: string;
|
|
189
|
+
}
|
|
190
|
+
interface MachineUserInfo {
|
|
191
|
+
name: string;
|
|
192
|
+
clientId: string;
|
|
193
|
+
clientSecret: string;
|
|
194
|
+
createdAt: string;
|
|
195
|
+
updatedAt: string;
|
|
196
|
+
}
|
|
197
|
+
declare function machineUserList(options?: MachineUserListOptions): Promise<MachineUserInfo[]>;
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/cli/machineuser/token.d.ts
|
|
200
|
+
interface MachineUserTokenOptions {
|
|
201
|
+
name: string;
|
|
202
|
+
workspaceId?: string;
|
|
203
|
+
profile?: string;
|
|
204
|
+
configPath?: string;
|
|
205
|
+
}
|
|
206
|
+
interface MachineUserTokenInfo {
|
|
207
|
+
accessToken: string;
|
|
208
|
+
tokenType: string;
|
|
209
|
+
expiresAt: string;
|
|
210
|
+
}
|
|
211
|
+
declare function machineUserToken(options: MachineUserTokenOptions): Promise<MachineUserTokenInfo>;
|
|
212
|
+
//#endregion
|
|
213
|
+
export { type ApplicationInfo, type ApplyOptions, type CodeGenerator, type Executor, type GenerateOptions, type GeneratorInput, type GeneratorResult, type MachineUserInfo, type MachineUserListOptions, type MachineUserTokenInfo, type MachineUserTokenOptions, type Resolver, type ShowOptions, type ParsedTailorDBType as TailorDBType, type WorkspaceCreateOptions, type WorkspaceDeleteOptions, type WorkspaceInfo, apply, generate, generateUserTypes, loadConfig, machineUserList, machineUserToken, show, workspaceCreate, workspaceDelete, workspaceList };
|
package/dist/cli/api.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { apply, generate, generateUserTypes, loadConfig, machineUserList, machineUserToken, show, workspaceCreate, workspaceDelete, workspaceList } from "../token-PbgBrNwb.mjs";
|
|
2
|
+
import "../auth-Di3vQUrT.mjs";
|
|
3
|
+
|
|
4
|
+
export { apply, generate, generateUserTypes, loadConfig, machineUserList, machineUserToken, show, workspaceCreate, workspaceDelete, workspaceList };
|