@tailor-platform/sdk 2.36.0 → 2.38.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 +132 -0
- package/dist/{application-DaJbleMi.mjs → application-Bz80INH4.mjs} +1 -1
- package/dist/application-CeqD1OK-.mjs +207 -0
- package/dist/application-CeqD1OK-.mjs.map +1 -0
- package/dist/cli/commands/deploy/deploy.d.mts +7 -1
- package/dist/cli/commands/deploy/tailordb/migration-validation.d.mts +3 -0
- package/dist/cli/commands/executor/jobs.d.mts +3 -0
- package/dist/cli/commands/tailordb/migrate/bundler.d.mts +3 -0
- package/dist/cli/commands/tailordb/migrate/config.d.mts +4 -0
- package/dist/cli/commands/tailordb/migrate/diff-calculator.d.mts +10 -0
- package/dist/cli/commands/tailordb/migrate/generate.d.mts +28 -2
- package/dist/cli/commands/tailordb/migrate/hints.d.mts +1 -0
- package/dist/cli/commands/tailordb/migrate/remote-state.d.mts +3 -0
- package/dist/cli/commands/tailordb/migrate/schema-checks.d.mts +3 -1
- package/dist/cli/commands/tailordb/migrate/snapshot-comparison.d.mts +4 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-files.d.mts +44 -6
- package/dist/cli/commands/tailordb/migrate/snapshot-local.d.mts +2 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-migrations.d.mts +2 -0
- package/dist/cli/commands/tailordb/migrate/snapshot-types.d.mts +8 -0
- package/dist/cli/commands/tailordb/migrate/types.d.mts +2 -0
- package/dist/cli/commands/workspace/create.d.mts +1 -1
- package/dist/cli/lib.d.mts +3 -3
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/lib.mjs.map +1 -1
- package/dist/cli/main.mjs +65 -58
- package/dist/cli/main.mjs.map +1 -1
- package/dist/cli/shared/args.d.mts +14 -5
- package/dist/cli/shared/client.d.mts +40 -3
- package/dist/cli/shared/error-json.d.mts +12 -26
- package/dist/cli/shared/function-execution.d.mts +2 -0
- package/dist/cli/shared/prompt.d.mts +9 -4
- package/dist/client-CHXix4LD.mjs +1 -0
- package/dist/client-DOQv-BP8.mjs +2 -0
- package/dist/client-DOQv-BP8.mjs.map +1 -0
- package/dist/completion/zsh-worker.zsh +151 -79
- package/dist/configure/config/index.d.mts +2 -0
- package/dist/configure/config/types.d.mts +2 -0
- package/dist/configure/index.mjs.map +1 -1
- package/dist/configure/services/executor/operation.d.mts +5 -4
- package/dist/configure/services/http-adapter/http-adapter.d.mts +1 -1
- package/dist/configure/services/index.d.mts +0 -1
- package/dist/configure/services/tailordb/schema.d.mts +1 -0
- package/dist/configure/services/tailordb/types.d.mts +12 -0
- package/dist/context-DSi5kfqr.mjs +23 -0
- package/dist/context-DSi5kfqr.mjs.map +1 -0
- package/dist/context-OOASEQLA.mjs +1 -0
- package/dist/{crashreport-DGU6lwiX.mjs → crashreport-CQTAlnbA.mjs} +4 -4
- package/dist/{crashreport-DGU6lwiX.mjs.map → crashreport-CQTAlnbA.mjs.map} +1 -1
- package/dist/crashreport-GRnWyDnF.mjs +1 -0
- package/dist/date-representation-Cr7W7Pn2.mjs.map +1 -1
- package/dist/{errors-BXmGBX-7.mjs → errors-9OOL3xOM.mjs} +6 -5
- package/dist/errors-9OOL3xOM.mjs.map +1 -0
- package/dist/field_behavior_pb-B196sUx6.mjs +2 -0
- package/dist/field_behavior_pb-B196sUx6.mjs.map +1 -0
- package/dist/{kysely-type-B0ri1-Xs.mjs → kysely-type-DhAZqdQg.mjs} +14 -10
- package/dist/kysely-type-DhAZqdQg.mjs.map +1 -0
- package/dist/notification_resource_pb-BZ0hCA01.mjs +1 -0
- package/dist/notification_resource_pb-Dwzah7gO.mjs +2 -0
- package/dist/notification_resource_pb-Dwzah7gO.mjs.map +1 -0
- package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
- package/dist/plugin/builtin/seed/seed-type-processor.d.mts +4 -3
- package/dist/plugin/get-generated-table.d.mts +4 -0
- package/dist/plugin/index.mjs.map +1 -1
- package/dist/plugin/types.d.mts +55 -3
- package/dist/plugin/with-context.d.mts +16 -0
- package/dist/register-ts-hook-CXYYYgCl.mjs +1094 -0
- package/dist/register-ts-hook-CXYYYgCl.mjs.map +1 -0
- package/dist/repl-editor-Bposemei.mjs +2 -0
- package/dist/repl-editor-Bposemei.mjs.map +1 -0
- package/dist/resource_pb-elY668ZB.mjs +2 -0
- package/dist/resource_pb-elY668ZB.mjs.map +1 -0
- package/dist/schema-BU1aIQ63.mjs.map +1 -1
- package/dist/{secret-file-BxZ-J_Nz.mjs → secret-file-CSXzcg4c.mjs} +2 -2
- package/dist/{secret-file-BxZ-J_Nz.mjs.map → secret-file-CSXzcg4c.mjs.map} +1 -1
- package/dist/{service-CaGmqg0r.mjs → service-B2vx6CGM.mjs} +2 -2
- package/dist/{service-CaGmqg0r.mjs.map → service-B2vx6CGM.mjs.map} +1 -1
- package/dist/service-DB-RHn25.mjs +9 -0
- package/dist/service-DB-RHn25.mjs.map +1 -0
- package/dist/service-DsAWXbVX.mjs +1 -0
- package/dist/service_pb-Bethc2NW.mjs +1 -0
- package/dist/service_pb-CfpSriCy.mjs +2 -0
- package/dist/service_pb-CfpSriCy.mjs.map +1 -0
- package/dist/tailor-proto/src/tailor/v1/function_pb.d.mts +3 -3
- package/dist/tailor-proto/src/tailor/v1/function_resource_pb.d.mts +92 -0
- package/dist/tailor-proto/src/tailor/v1/notification_pb.d.mts +176 -0
- package/dist/tailor-proto/src/tailor/v1/notification_resource_pb.d.mts +172 -0
- package/dist/tailor-proto/src/tailor/v1/service_pb.d.mts +78 -0
- package/dist/types/app-config.generated.d.mts +1 -1
- package/dist/types/auth-connection.generated.d.mts +2 -2
- package/dist/types/auth.generated.d.mts +13 -13
- package/dist/types/executor.generated.d.mts +25 -25
- package/dist/types/field.generated.d.mts +2 -2
- package/dist/types/http-adapter.generated.d.mts +4 -4
- package/dist/types/idp.generated.d.mts +272 -272
- package/dist/types/resolver.generated.d.mts +10 -10
- package/dist/types/tailordb.generated.d.mts +84 -80
- package/dist/types/workflow.generated.d.mts +2 -2
- package/dist/validation-errors-DqCeUW4L.mjs +3 -0
- package/dist/validation-errors-DqCeUW4L.mjs.map +1 -0
- package/{LICENSE → dist/vendor/graphql/LICENSE} +6 -6
- package/dist/vendor/graphql/language/KindTypeMap.d.mts +3 -0
- package/dist/vendor/graphql/language/ast.d.mts +784 -0
- package/dist/vendor/graphql/language/kinds_.d.mts +203 -0
- package/dist/vendor/graphql/language/source.d.mts +46 -0
- package/dist/vendor/graphql/language/tokenKind.d.mts +35 -0
- package/dist/vitest/date-representation.d.mts +2 -0
- package/dist/vitest/environment.d.mts +1 -0
- package/dist/vitest/environment.mjs.map +1 -1
- package/dist/vitest/index.mjs.map +1 -1
- package/dist/vitest/migration-steps.d.mts +13 -2
- package/dist/vitest/mock-kysely.d.mts +12 -2
- package/dist/vitest/mocks/aigateway.d.mts +7 -1
- package/dist/vitest/mocks/authconnection.d.mts +7 -1
- package/dist/vitest/mocks/file.d.mts +8 -2
- package/dist/vitest/mocks/iconv.d.mts +7 -1
- package/dist/vitest/mocks/idp.d.mts +7 -1
- package/dist/vitest/mocks/logger.d.mts +7 -1
- package/dist/vitest/mocks/secretmanager.d.mts +7 -1
- package/dist/vitest/mocks/tailordb-pglite.d.mts +12 -2
- package/dist/vitest/mocks/tailordb.d.mts +22 -4
- package/dist/vitest/mocks/workflow.d.mts +2 -1
- package/dist/vitest/pglite-kysely.d.mts +18 -2
- package/dist/vitest/pglite-temporal.d.mts +5 -1
- package/dist/vitest/workflow-local.d.mts +7 -0
- package/dist/workspace_resource_pb-Cow7mrJY.mjs +2 -0
- package/dist/workspace_resource_pb-Cow7mrJY.mjs.map +1 -0
- package/docs/cli/application.md +63 -29
- package/docs/cli/executor.md +2 -0
- package/docs/cli/function.md +3 -1
- package/docs/cli/notification.md +128 -0
- package/docs/cli/tailordb.md +45 -68
- package/docs/cli/workflow.md +2 -0
- package/docs/cli/workspace.md +20 -18
- package/docs/cli-reference.md +231 -50
- package/docs/configuration.md +2 -2
- package/docs/data-clone.md +1 -1
- package/docs/github-actions.md +266 -41
- package/docs/plugin/custom.md +4 -4
- package/docs/runtime.md +1 -1
- package/docs/services/auth.md +2 -0
- package/docs/services/idp.md +2 -0
- package/docs/services/tailordb/index.md +13 -4
- package/docs/services/tailordb/migration.md +109 -71
- package/docs/services/workflow.md +1 -1
- package/docs/testing.md +9 -10
- package/package.json +23 -19
- package/dist/application-BbORWCj-.mjs +0 -207
- package/dist/application-BbORWCj-.mjs.map +0 -1
- package/dist/configure/services/http-adapter/index.d.mts +0 -2
- package/dist/crashreport-WsYAWARW.mjs +0 -1
- package/dist/errors-BXmGBX-7.mjs.map +0 -1
- package/dist/kysely-type-B0ri1-Xs.mjs.map +0 -1
- package/dist/register-ts-hook-iAcG1dfz.mjs +0 -1057
- package/dist/register-ts-hook-iAcG1dfz.mjs.map +0 -1
- package/dist/repl-editor-DkrCZmmg.mjs +0 -2
- package/dist/repl-editor-DkrCZmmg.mjs.map +0 -1
- package/dist/service-DTrVVaDJ.mjs +0 -1
- package/dist/service-hIarp2Gl.mjs +0 -8
- package/dist/service-hIarp2Gl.mjs.map +0 -1
- package/dist/service_pb-6EkMfdOb.mjs +0 -2
- package/dist/service_pb-6EkMfdOb.mjs.map +0 -1
- package/dist/service_pb-CsJKokDl.mjs +0 -1
- package/dist/workspace_resource_pb-C4CkoYww.mjs +0 -2
- package/dist/workspace_resource_pb-C4CkoYww.mjs.map +0 -1
|
@@ -2,22 +2,22 @@ import { TailorField } from "./field.generated.mjs";
|
|
|
2
2
|
/**
|
|
3
3
|
* GraphQL operation type
|
|
4
4
|
*/
|
|
5
|
-
export type QueryType = "
|
|
5
|
+
export type QueryType = "mutation" | "query";
|
|
6
6
|
export type Resolver = {
|
|
7
7
|
/** GraphQL operation type (query or mutation) */
|
|
8
8
|
operation: QueryType;
|
|
9
9
|
/** Resolver name */
|
|
10
10
|
name: string;
|
|
11
|
-
/** Resolver implementation function */
|
|
12
|
-
body: Function;
|
|
13
|
-
/** Output field definition */
|
|
14
|
-
output: TailorField;
|
|
15
11
|
/** Resolver description */
|
|
16
12
|
description?: string | undefined;
|
|
17
13
|
/** Input field definitions */
|
|
18
14
|
input?: {
|
|
19
15
|
[x: string]: TailorField;
|
|
20
16
|
};
|
|
17
|
+
/** Resolver implementation function */
|
|
18
|
+
body: Function;
|
|
19
|
+
/** Output field definition */
|
|
20
|
+
output: TailorField;
|
|
21
21
|
/** Enable publishing events from this resolver */
|
|
22
22
|
publishEvents?: boolean | undefined;
|
|
23
23
|
/** Machine user to execute this resolver as */
|
|
@@ -29,15 +29,15 @@ export type Resolver = {
|
|
|
29
29
|
} | undefined;
|
|
30
30
|
/** Access requirement for this resolver, evaluated against the original caller (unaffected by `invoker`) before `body` runs. "allowAnonymous" documents that anonymous callers are allowed. Omitted (default): unchanged, anonymous callers can reach the resolver */
|
|
31
31
|
permission?: "allowAnonymous" | readonly {
|
|
32
|
-
conditions: readonly [(string | boolean | {
|
|
32
|
+
conditions: readonly (readonly [(string | boolean | {
|
|
33
33
|
user: string;
|
|
34
|
-
}), "
|
|
34
|
+
}), "!=" | "=", (string | boolean | {
|
|
35
35
|
user: string;
|
|
36
|
-
})] | readonly
|
|
36
|
+
})])[] | readonly [(string | boolean | {
|
|
37
37
|
user: string;
|
|
38
|
-
}), "
|
|
38
|
+
}), "!=" | "=", (string | boolean | {
|
|
39
39
|
user: string;
|
|
40
|
-
})]
|
|
40
|
+
})];
|
|
41
41
|
permit: boolean;
|
|
42
42
|
/** Reason recorded for this policy, used in the access-denied error message */
|
|
43
43
|
description?: string | undefined;
|
|
@@ -10,13 +10,13 @@ export type GqlOperationsInput = "query" | {
|
|
|
10
10
|
};
|
|
11
11
|
export type GqlOperations = {
|
|
12
12
|
/** Enable create mutation (default: true) */
|
|
13
|
-
create?: boolean
|
|
13
|
+
create?: boolean;
|
|
14
14
|
/** Enable update mutation (default: true) */
|
|
15
|
-
update?: boolean
|
|
15
|
+
update?: boolean;
|
|
16
16
|
/** Enable delete mutation (default: true) */
|
|
17
|
-
delete?: boolean
|
|
17
|
+
delete?: boolean;
|
|
18
18
|
/** Enable read queries - get, list, aggregation (default: true) */
|
|
19
|
-
read?: boolean
|
|
19
|
+
read?: boolean;
|
|
20
20
|
};
|
|
21
21
|
export type DBFieldMetadata = {
|
|
22
22
|
/** Whether the field is required */
|
|
@@ -89,39 +89,7 @@ export type TailorDBTypeParsedSettings = {
|
|
|
89
89
|
};
|
|
90
90
|
export type RawPermissions = {
|
|
91
91
|
record?: {
|
|
92
|
-
create: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
93
|
-
user: string;
|
|
94
|
-
} | {
|
|
95
|
-
record: string;
|
|
96
|
-
} | {
|
|
97
|
-
oldRecord: string;
|
|
98
|
-
} | {
|
|
99
|
-
newRecord: string;
|
|
100
|
-
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
101
|
-
user: string;
|
|
102
|
-
} | {
|
|
103
|
-
record: string;
|
|
104
|
-
} | {
|
|
105
|
-
oldRecord: string;
|
|
106
|
-
} | {
|
|
107
|
-
newRecord: string;
|
|
108
|
-
})] | readonly [(string | boolean | string[] | boolean[] | {
|
|
109
|
-
user: string;
|
|
110
|
-
} | {
|
|
111
|
-
record: string;
|
|
112
|
-
} | {
|
|
113
|
-
oldRecord: string;
|
|
114
|
-
} | {
|
|
115
|
-
newRecord: string;
|
|
116
|
-
}), "=" | "!=" | "in" | "not in" | "hasAny" | "not hasAny", (string | boolean | string[] | boolean[] | {
|
|
117
|
-
user: string;
|
|
118
|
-
} | {
|
|
119
|
-
record: string;
|
|
120
|
-
} | {
|
|
121
|
-
oldRecord: string;
|
|
122
|
-
} | {
|
|
123
|
-
newRecord: string;
|
|
124
|
-
}), boolean] | readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
92
|
+
create: readonly (readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
125
93
|
user: string;
|
|
126
94
|
} | {
|
|
127
95
|
record: string;
|
|
@@ -129,7 +97,7 @@ export type RawPermissions = {
|
|
|
129
97
|
oldRecord: string;
|
|
130
98
|
} | {
|
|
131
99
|
newRecord: string;
|
|
132
|
-
}), "
|
|
100
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
133
101
|
user: string;
|
|
134
102
|
} | {
|
|
135
103
|
record: string;
|
|
@@ -138,7 +106,7 @@ export type RawPermissions = {
|
|
|
138
106
|
} | {
|
|
139
107
|
newRecord: string;
|
|
140
108
|
})])[] | {
|
|
141
|
-
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
109
|
+
conditions: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
142
110
|
user: string;
|
|
143
111
|
} | {
|
|
144
112
|
record: string;
|
|
@@ -146,7 +114,7 @@ export type RawPermissions = {
|
|
|
146
114
|
oldRecord: string;
|
|
147
115
|
} | {
|
|
148
116
|
newRecord: string;
|
|
149
|
-
}), "
|
|
117
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
150
118
|
user: string;
|
|
151
119
|
} | {
|
|
152
120
|
record: string;
|
|
@@ -154,7 +122,7 @@ export type RawPermissions = {
|
|
|
154
122
|
oldRecord: string;
|
|
155
123
|
} | {
|
|
156
124
|
newRecord: string;
|
|
157
|
-
})] | readonly
|
|
125
|
+
})])[] | readonly [(string | boolean | string[] | boolean[] | {
|
|
158
126
|
user: string;
|
|
159
127
|
} | {
|
|
160
128
|
record: string;
|
|
@@ -162,7 +130,7 @@ export type RawPermissions = {
|
|
|
162
130
|
oldRecord: string;
|
|
163
131
|
} | {
|
|
164
132
|
newRecord: string;
|
|
165
|
-
}), "
|
|
133
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
166
134
|
user: string;
|
|
167
135
|
} | {
|
|
168
136
|
record: string;
|
|
@@ -170,11 +138,10 @@ export type RawPermissions = {
|
|
|
170
138
|
oldRecord: string;
|
|
171
139
|
} | {
|
|
172
140
|
newRecord: string;
|
|
173
|
-
})]
|
|
141
|
+
})];
|
|
174
142
|
description?: string | undefined;
|
|
175
143
|
permit?: boolean | undefined;
|
|
176
|
-
}
|
|
177
|
-
read: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
144
|
+
} | readonly [(string | boolean | string[] | boolean[] | {
|
|
178
145
|
user: string;
|
|
179
146
|
} | {
|
|
180
147
|
record: string;
|
|
@@ -182,7 +149,7 @@ export type RawPermissions = {
|
|
|
182
149
|
oldRecord: string;
|
|
183
150
|
} | {
|
|
184
151
|
newRecord: string;
|
|
185
|
-
}), "
|
|
152
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
186
153
|
user: string;
|
|
187
154
|
} | {
|
|
188
155
|
record: string;
|
|
@@ -198,7 +165,7 @@ export type RawPermissions = {
|
|
|
198
165
|
oldRecord: string;
|
|
199
166
|
} | {
|
|
200
167
|
newRecord: string;
|
|
201
|
-
}), "
|
|
168
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
202
169
|
user: string;
|
|
203
170
|
} | {
|
|
204
171
|
record: string;
|
|
@@ -206,7 +173,8 @@ export type RawPermissions = {
|
|
|
206
173
|
oldRecord: string;
|
|
207
174
|
} | {
|
|
208
175
|
newRecord: string;
|
|
209
|
-
}), boolean]
|
|
176
|
+
}), boolean])[];
|
|
177
|
+
read: readonly (readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
210
178
|
user: string;
|
|
211
179
|
} | {
|
|
212
180
|
record: string;
|
|
@@ -214,7 +182,7 @@ export type RawPermissions = {
|
|
|
214
182
|
oldRecord: string;
|
|
215
183
|
} | {
|
|
216
184
|
newRecord: string;
|
|
217
|
-
}), "
|
|
185
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
218
186
|
user: string;
|
|
219
187
|
} | {
|
|
220
188
|
record: string;
|
|
@@ -223,7 +191,7 @@ export type RawPermissions = {
|
|
|
223
191
|
} | {
|
|
224
192
|
newRecord: string;
|
|
225
193
|
})])[] | {
|
|
226
|
-
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
194
|
+
conditions: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
227
195
|
user: string;
|
|
228
196
|
} | {
|
|
229
197
|
record: string;
|
|
@@ -231,7 +199,7 @@ export type RawPermissions = {
|
|
|
231
199
|
oldRecord: string;
|
|
232
200
|
} | {
|
|
233
201
|
newRecord: string;
|
|
234
|
-
}), "
|
|
202
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
235
203
|
user: string;
|
|
236
204
|
} | {
|
|
237
205
|
record: string;
|
|
@@ -239,7 +207,7 @@ export type RawPermissions = {
|
|
|
239
207
|
oldRecord: string;
|
|
240
208
|
} | {
|
|
241
209
|
newRecord: string;
|
|
242
|
-
})] | readonly
|
|
210
|
+
})])[] | readonly [(string | boolean | string[] | boolean[] | {
|
|
243
211
|
user: string;
|
|
244
212
|
} | {
|
|
245
213
|
record: string;
|
|
@@ -247,7 +215,7 @@ export type RawPermissions = {
|
|
|
247
215
|
oldRecord: string;
|
|
248
216
|
} | {
|
|
249
217
|
newRecord: string;
|
|
250
|
-
}), "
|
|
218
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
251
219
|
user: string;
|
|
252
220
|
} | {
|
|
253
221
|
record: string;
|
|
@@ -255,11 +223,10 @@ export type RawPermissions = {
|
|
|
255
223
|
oldRecord: string;
|
|
256
224
|
} | {
|
|
257
225
|
newRecord: string;
|
|
258
|
-
})]
|
|
226
|
+
})];
|
|
259
227
|
description?: string | undefined;
|
|
260
228
|
permit?: boolean | undefined;
|
|
261
|
-
}
|
|
262
|
-
update: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
229
|
+
} | readonly [(string | boolean | string[] | boolean[] | {
|
|
263
230
|
user: string;
|
|
264
231
|
} | {
|
|
265
232
|
record: string;
|
|
@@ -267,7 +234,7 @@ export type RawPermissions = {
|
|
|
267
234
|
oldRecord: string;
|
|
268
235
|
} | {
|
|
269
236
|
newRecord: string;
|
|
270
|
-
}), "
|
|
237
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
271
238
|
user: string;
|
|
272
239
|
} | {
|
|
273
240
|
record: string;
|
|
@@ -283,7 +250,7 @@ export type RawPermissions = {
|
|
|
283
250
|
oldRecord: string;
|
|
284
251
|
} | {
|
|
285
252
|
newRecord: string;
|
|
286
|
-
}), "
|
|
253
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
287
254
|
user: string;
|
|
288
255
|
} | {
|
|
289
256
|
record: string;
|
|
@@ -291,7 +258,8 @@ export type RawPermissions = {
|
|
|
291
258
|
oldRecord: string;
|
|
292
259
|
} | {
|
|
293
260
|
newRecord: string;
|
|
294
|
-
}), boolean]
|
|
261
|
+
}), boolean])[];
|
|
262
|
+
update: readonly (readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
295
263
|
user: string;
|
|
296
264
|
} | {
|
|
297
265
|
record: string;
|
|
@@ -299,7 +267,7 @@ export type RawPermissions = {
|
|
|
299
267
|
oldRecord: string;
|
|
300
268
|
} | {
|
|
301
269
|
newRecord: string;
|
|
302
|
-
}), "
|
|
270
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
303
271
|
user: string;
|
|
304
272
|
} | {
|
|
305
273
|
record: string;
|
|
@@ -308,7 +276,7 @@ export type RawPermissions = {
|
|
|
308
276
|
} | {
|
|
309
277
|
newRecord: string;
|
|
310
278
|
})])[] | {
|
|
311
|
-
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
279
|
+
conditions: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
312
280
|
user: string;
|
|
313
281
|
} | {
|
|
314
282
|
record: string;
|
|
@@ -316,7 +284,7 @@ export type RawPermissions = {
|
|
|
316
284
|
oldRecord: string;
|
|
317
285
|
} | {
|
|
318
286
|
newRecord: string;
|
|
319
|
-
}), "
|
|
287
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
320
288
|
user: string;
|
|
321
289
|
} | {
|
|
322
290
|
record: string;
|
|
@@ -324,7 +292,7 @@ export type RawPermissions = {
|
|
|
324
292
|
oldRecord: string;
|
|
325
293
|
} | {
|
|
326
294
|
newRecord: string;
|
|
327
|
-
})] | readonly
|
|
295
|
+
})])[] | readonly [(string | boolean | string[] | boolean[] | {
|
|
328
296
|
user: string;
|
|
329
297
|
} | {
|
|
330
298
|
record: string;
|
|
@@ -332,7 +300,7 @@ export type RawPermissions = {
|
|
|
332
300
|
oldRecord: string;
|
|
333
301
|
} | {
|
|
334
302
|
newRecord: string;
|
|
335
|
-
}), "
|
|
303
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
336
304
|
user: string;
|
|
337
305
|
} | {
|
|
338
306
|
record: string;
|
|
@@ -340,11 +308,10 @@ export type RawPermissions = {
|
|
|
340
308
|
oldRecord: string;
|
|
341
309
|
} | {
|
|
342
310
|
newRecord: string;
|
|
343
|
-
})]
|
|
311
|
+
})];
|
|
344
312
|
description?: string | undefined;
|
|
345
313
|
permit?: boolean | undefined;
|
|
346
|
-
}
|
|
347
|
-
delete: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
314
|
+
} | readonly [(string | boolean | string[] | boolean[] | {
|
|
348
315
|
user: string;
|
|
349
316
|
} | {
|
|
350
317
|
record: string;
|
|
@@ -352,7 +319,7 @@ export type RawPermissions = {
|
|
|
352
319
|
oldRecord: string;
|
|
353
320
|
} | {
|
|
354
321
|
newRecord: string;
|
|
355
|
-
}), "
|
|
322
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
356
323
|
user: string;
|
|
357
324
|
} | {
|
|
358
325
|
record: string;
|
|
@@ -368,7 +335,7 @@ export type RawPermissions = {
|
|
|
368
335
|
oldRecord: string;
|
|
369
336
|
} | {
|
|
370
337
|
newRecord: string;
|
|
371
|
-
}), "
|
|
338
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
372
339
|
user: string;
|
|
373
340
|
} | {
|
|
374
341
|
record: string;
|
|
@@ -376,7 +343,8 @@ export type RawPermissions = {
|
|
|
376
343
|
oldRecord: string;
|
|
377
344
|
} | {
|
|
378
345
|
newRecord: string;
|
|
379
|
-
}), boolean]
|
|
346
|
+
}), boolean])[];
|
|
347
|
+
delete: readonly (readonly (boolean | readonly [(string | boolean | string[] | boolean[] | {
|
|
380
348
|
user: string;
|
|
381
349
|
} | {
|
|
382
350
|
record: string;
|
|
@@ -384,7 +352,7 @@ export type RawPermissions = {
|
|
|
384
352
|
oldRecord: string;
|
|
385
353
|
} | {
|
|
386
354
|
newRecord: string;
|
|
387
|
-
}), "
|
|
355
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
388
356
|
user: string;
|
|
389
357
|
} | {
|
|
390
358
|
record: string;
|
|
@@ -393,7 +361,7 @@ export type RawPermissions = {
|
|
|
393
361
|
} | {
|
|
394
362
|
newRecord: string;
|
|
395
363
|
})])[] | {
|
|
396
|
-
conditions: readonly [(string | boolean | string[] | boolean[] | {
|
|
364
|
+
conditions: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
397
365
|
user: string;
|
|
398
366
|
} | {
|
|
399
367
|
record: string;
|
|
@@ -401,7 +369,7 @@ export type RawPermissions = {
|
|
|
401
369
|
oldRecord: string;
|
|
402
370
|
} | {
|
|
403
371
|
newRecord: string;
|
|
404
|
-
}), "
|
|
372
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
405
373
|
user: string;
|
|
406
374
|
} | {
|
|
407
375
|
record: string;
|
|
@@ -409,7 +377,7 @@ export type RawPermissions = {
|
|
|
409
377
|
oldRecord: string;
|
|
410
378
|
} | {
|
|
411
379
|
newRecord: string;
|
|
412
|
-
})] | readonly
|
|
380
|
+
})])[] | readonly [(string | boolean | string[] | boolean[] | {
|
|
413
381
|
user: string;
|
|
414
382
|
} | {
|
|
415
383
|
record: string;
|
|
@@ -417,7 +385,7 @@ export type RawPermissions = {
|
|
|
417
385
|
oldRecord: string;
|
|
418
386
|
} | {
|
|
419
387
|
newRecord: string;
|
|
420
|
-
}), "
|
|
388
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
421
389
|
user: string;
|
|
422
390
|
} | {
|
|
423
391
|
record: string;
|
|
@@ -425,18 +393,50 @@ export type RawPermissions = {
|
|
|
425
393
|
oldRecord: string;
|
|
426
394
|
} | {
|
|
427
395
|
newRecord: string;
|
|
428
|
-
})]
|
|
396
|
+
})];
|
|
429
397
|
description?: string | undefined;
|
|
430
398
|
permit?: boolean | undefined;
|
|
431
|
-
}
|
|
399
|
+
} | readonly [(string | boolean | string[] | boolean[] | {
|
|
400
|
+
user: string;
|
|
401
|
+
} | {
|
|
402
|
+
record: string;
|
|
403
|
+
} | {
|
|
404
|
+
oldRecord: string;
|
|
405
|
+
} | {
|
|
406
|
+
newRecord: string;
|
|
407
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
408
|
+
user: string;
|
|
409
|
+
} | {
|
|
410
|
+
record: string;
|
|
411
|
+
} | {
|
|
412
|
+
oldRecord: string;
|
|
413
|
+
} | {
|
|
414
|
+
newRecord: string;
|
|
415
|
+
})] | readonly [(string | boolean | string[] | boolean[] | {
|
|
416
|
+
user: string;
|
|
417
|
+
} | {
|
|
418
|
+
record: string;
|
|
419
|
+
} | {
|
|
420
|
+
oldRecord: string;
|
|
421
|
+
} | {
|
|
422
|
+
newRecord: string;
|
|
423
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
424
|
+
user: string;
|
|
425
|
+
} | {
|
|
426
|
+
record: string;
|
|
427
|
+
} | {
|
|
428
|
+
oldRecord: string;
|
|
429
|
+
} | {
|
|
430
|
+
newRecord: string;
|
|
431
|
+
}), boolean])[];
|
|
432
432
|
} | undefined;
|
|
433
433
|
gql?: readonly {
|
|
434
434
|
conditions: readonly (readonly [(string | boolean | string[] | boolean[] | {
|
|
435
435
|
user: string;
|
|
436
|
-
}), "
|
|
436
|
+
}), "!=" | "=" | "hasAny" | "in" | "not hasAny" | "not in", (string | boolean | string[] | boolean[] | {
|
|
437
437
|
user: string;
|
|
438
438
|
})])[];
|
|
439
|
-
actions: "all" | readonly ("
|
|
439
|
+
actions: "all" | readonly ("aggregate" | "bulkUpsert" | "create" | "delete" | "read" | "update")[];
|
|
440
440
|
permit?: boolean | undefined;
|
|
441
441
|
description?: string | undefined;
|
|
442
442
|
}[] | undefined;
|
|
@@ -446,7 +446,11 @@ export type TailorDBServiceConfigInput = {
|
|
|
446
446
|
files: string[];
|
|
447
447
|
/** Glob patterns to exclude from table discovery */
|
|
448
448
|
ignores?: string[] | undefined;
|
|
449
|
-
/**
|
|
449
|
+
/**
|
|
450
|
+
* Migration configuration
|
|
451
|
+
*
|
|
452
|
+
* **Beta:** This API may change in future releases.
|
|
453
|
+
*/
|
|
450
454
|
migration?: {
|
|
451
455
|
/** Directory containing migration files */
|
|
452
456
|
directory: string;
|
|
@@ -2,9 +2,9 @@ export type RetryPolicy = {
|
|
|
2
2
|
/** Maximum number of retries (1-10) */
|
|
3
3
|
maxRetries: number;
|
|
4
4
|
/** Initial backoff duration (e.g., '1s', '500ms', '1m', max 1h) */
|
|
5
|
-
initialBackoff: `${number}
|
|
5
|
+
initialBackoff: `${number}m` | `${number}ms` | `${number}s`;
|
|
6
6
|
/** Maximum backoff duration (e.g., '30s', '5m', max 24h) */
|
|
7
|
-
maxBackoff: `${number}
|
|
7
|
+
maxBackoff: `${number}m` | `${number}ms` | `${number}s`;
|
|
8
8
|
/** Backoff multiplier (>= 1) */
|
|
9
9
|
backoffMultiplier: number;
|
|
10
10
|
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e,t}from"./errors-9OOL3xOM.mjs";import*as n from"pathe";import{Code as r,ConnectError as i}from"@connectrpc/connect";const a=/* @__PURE__ */ new WeakMap;function withErrorDiagnostics(e,t){return a.set(e,{...a.get(e),...t}),e}function getErrorDiagnostics(e){return{...e instanceof i?{suggestion:rpcSuggestion(e.code)}:{},...a.get(e)}}function rpcSuggestion(e){switch(e){case r.Unauthenticated:return"Check the active token and profile with `tailor auth status` (include the same --profile option). For an environment token, replace TAILOR_PLATFORM_TOKEN; otherwise use the original browser or --machine-user login method with the same profile. See `tailor login --help`.";case r.PermissionDenied:return"Check the active identity and profile with `tailor auth status` (include the same --profile option), then verify its workspace role and token permissions.";case r.Unavailable:case r.DeadlineExceeded:return`Check network connectivity and platform availability. A write may already have completed; inspect the current resource state before retrying.`;default:return}}function flattenZodIssues(e,t=[]){return e.flatMap(e=>{let n=[...t,...e.path];return e.code===`invalid_union`?flattenUnion(e,n):e.code===`invalid_key`?flattenZodIssues(e.issues,n):[toFlatIssue(e,n)]})}function formatIssueList(e){return e.map(e=>` - ${e.path.join(`.`)||`(root)`}: ${e.message}`).join(`
|
|
2
|
+
`)}function flattenUnion(e,t){let n=e.errors,r=n.map(e=>new Set(e.map(issueKey))),i=(n[0]??[]).filter(e=>r.every(t=>t.has(issueKey(e)))),a=new Set(i.map(issueKey)),o=n.map(e=>{let t=e.filter(e=>!a.has(issueKey(e)));return{own:t,depth:t.length===0?1/0:Math.max(...t.map(e=>e.path.length))}}).toSorted((e,t)=>t.depth-e.depth||e.own.length-t.own.length),[s,c]=o;return s===void 0||s.own.length>0&&c!==void 0&&s.depth===c.depth&&s.own.length===c.own.length?[...flattenZodIssues(i,t),{...toFlatIssue(e,t),message:tiedUnionMessage(e,o)}]:[...flattenZodIssues(i,t),...flattenZodIssues(s.own,t)]}function tiedUnionMessage(e,t){if(e.message!==`Invalid input`)return e.message;let n=/* @__PURE__ */ new Set;for(let r of t.flatMap(e=>e.own)){if(r.path.length>0)return e.message;if(r.code===`invalid_type`)n.add(r.expected);else if(r.code===`invalid_value`)for(let e of r.values)n.add(typeof e==`string`?JSON.stringify(e):String(e));else return e.message}return n.size===0?e.message:`${e.message}: expected ${[...n].join(` | `)}`}function issueKey(e){return JSON.stringify([e.path.map(String),e.code,e.message])}function toFlatIssue(e,t){return{path:t.map(e=>typeof e==`symbol`?String(e):e),message:e.message}}function configInvalidError(e){let{file:n,exportName:r,subject:i,error:a,pathPrefix:o,service:s}=e,c=flattenZodIssues(a.issues,o);return withErrorDiagnostics(t({code:`CONFIG_INVALID`,message:`Invalid ${i} in ${relativeFile(n)}:\n${formatIssueList(c)}`,context:{file:n,exportName:r,...s,issues:c},cause:a}),{location:{file:n}})}const o={resolver:`resolver`,executor:`executor`,"tailordb-type":`TailorDB type`,"http-adapter":`HTTP adapter`,workflow:`workflow`,"workflow-job":`workflow job`};function definitionInvalidError(e){let{kind:n,file:r,exportName:i,error:a}=e,s=flattenZodIssues(a.issues),c=i==="default"?``:` \`${i}\``;return withErrorDiagnostics(t({code:`DEFINITION_INVALID`,message:`Invalid ${o[n]}${c} in ${relativeFile(r)}:\n${formatIssueList(s)}`,context:{kind:n,file:r,exportName:i,issues:s},cause:a}),{location:{file:r}})}function definitionExportError(e){let{kind:n,file:r,exportName:i}=e,a=o[n],s=`${a.charAt(0).toUpperCase()}${a.slice(1)} in ${relativeFile(r)}`,c=i==="default"?{message:`${s} must not be the default export.`,suggestion:`Export it under a name instead.`}:{message:`${s} must not be a named export, but it is exported as \`${i}\`.`,suggestion:`Export it only as the default export.`};return withErrorDiagnostics(t({code:`DEFINITION_EXPORT_INVALID`,...c,context:{kind:n,file:r,exportName:i}}),{location:{file:r}})}function isSyntaxDiagnostic(e){if(typeof e!=`object`||!e||e instanceof Error)return!1;let{code:t,message:n,filename:r,startLine:i}=e;return t===`InvalidSyntax`&&typeof n==`string`&&typeof r==`string`&&(i===void 0||typeof i==`number`)}function syntaxInvalidError(e){if(!isSyntaxDiagnostic(e))return;let{message:n,filename:r,startLine:i}=e,a=i===void 0?{file:r}:{file:r,line:i},o=i===void 0?``:`:${i}`;return withErrorDiagnostics(t({code:`SYNTAX_INVALID`,message:`Invalid syntax in ${relativeFile(r)}${o}: ${n}`,context:a,cause:e}),{location:a})}function invalidDataError(t,n){return e(`Invalid ${t}:\n${formatIssueList(flattenZodIssues(n.issues))}`,{cause:n})}function relativeFile(e){return n.relative(process.cwd(),e)}export{syntaxInvalidError as a,getErrorDiagnostics as c,invalidDataError as i,withErrorDiagnostics as l,definitionExportError as n,flattenZodIssues as o,definitionInvalidError as r,formatIssueList as s,configInvalidError as t};
|
|
3
|
+
//# sourceMappingURL=validation-errors-DqCeUW4L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-errors-DqCeUW4L.mjs","names":["internalError","path","diagnostics","error","details","ConnectError","code","Code","issues","prefix","issue","branches","union","branchKeys","branch","shared","keys","sharedKeys","ranked","own","b","a","closest","runnerUp","expected","value","segment","params","pathPrefix","CLIError","subject","file","service","DEFINITION_LABELS","exportLabel","exportName","kind","label","placement","message","filename","startLine","thrown","line","location","lineSuffix"],"sources":["../src/cli/shared/error-diagnostics.ts","../src/cli/shared/zod-issues.ts","../src/cli/shared/validation-errors.ts"],"sourcesContent":["import { Code, ConnectError } from \"@connectrpc/connect\";\nimport type { Jsonifiable } from \"type-fest\";\n\n/** Where a failure originated, for tooling that links to source. */\nexport interface ErrorSourceLocation {\n /** Absolute path to the file the failure points at. */\n file: string;\n /** 1-based line within `file`. */\n line?: number;\n}\n\ninterface ErrorDiagnostics {\n code?: string;\n suggestion?: string;\n context?: Readonly<Record<string, Jsonifiable | undefined>>;\n causes?: Readonly<Record<string, unknown>>;\n location?: ErrorSourceLocation;\n}\n\nconst diagnostics = new WeakMap<Error, ErrorDiagnostics>();\n\n/**\n * Attach output diagnostics without changing the error type used by callers.\n * @param error - Original error\n * @param details - Safe diagnostic fields supplied by the producer\n * @returns Original error\n */\nexport function withErrorDiagnostics<T extends Error>(error: T, details: ErrorDiagnostics): T {\n diagnostics.set(error, { ...diagnostics.get(error), ...details });\n return error;\n}\n\n/**\n * Read producer diagnostics and recovery guidance for a failure.\n * @param error - Failure being rendered\n * @returns Diagnostic fields\n */\nexport function getErrorDiagnostics(error: Error): ErrorDiagnostics {\n return {\n ...(error instanceof ConnectError ? { suggestion: rpcSuggestion(error.code) } : {}),\n ...diagnostics.get(error),\n };\n}\n\nfunction rpcSuggestion(code: Code): string | undefined {\n switch (code) {\n case Code.Unauthenticated:\n return \"Check the active token and profile with `tailor auth status` (include the same --profile option). For an environment token, replace TAILOR_PLATFORM_TOKEN; otherwise use the original browser or --machine-user login method with the same profile. See `tailor login --help`.\";\n case Code.PermissionDenied:\n return \"Check the active identity and profile with `tailor auth status` (include the same --profile option), then verify its workspace role and token permissions.\";\n case Code.Unavailable:\n case Code.DeadlineExceeded:\n return \"Check network connectivity and platform availability. A write may already have completed; inspect the current resource state before retrying.\";\n default:\n return undefined;\n }\n}\n","import type { z } from \"zod\";\n\ntype ZodIssue = z.core.$ZodIssue;\n\nexport type FlatIssue = {\n path: Array<string | number>;\n message: string;\n};\n\n/**\n * Flatten Zod issues into one entry per offending field. A failed union is\n * replaced by the issues of the branch the input came closest to matching,\n * and an invalid record key by the issues of the key schema.\n * @param issues - Issues from a failed parse\n * @param prefix - Path of the parsed value, prepended to every issue path\n * @returns Issues with absolute paths\n */\nexport function flattenZodIssues(\n issues: readonly ZodIssue[],\n prefix: readonly PropertyKey[] = [],\n): FlatIssue[] {\n return issues.flatMap((issue) => {\n const path = [...prefix, ...issue.path];\n if (issue.code === \"invalid_union\") {\n return flattenUnion(issue, path);\n }\n if (issue.code === \"invalid_key\") {\n return flattenZodIssues(issue.issues, path);\n }\n return [toFlatIssue(issue, path)];\n });\n}\n\n/**\n * Render flattened issues as an indented list, one `path: message` line each.\n * @param issues - Issues from `flattenZodIssues`\n * @returns Lines joined by newlines\n */\nexport function formatIssueList(issues: readonly FlatIssue[]): string {\n return issues\n .map((issue) => ` - ${issue.path.join(\".\") || \"(root)\"}: ${issue.message}`)\n .join(\"\\n\");\n}\n\nfunction flattenUnion(\n union: z.core.$ZodIssueInvalidUnion,\n path: readonly PropertyKey[],\n): FlatIssue[] {\n const branches: readonly (readonly ZodIssue[])[] = union.errors;\n const branchKeys = branches.map((branch) => new Set(branch.map(issueKey)));\n const shared = (branches[0] ?? []).filter((issue) =>\n branchKeys.every((keys) => keys.has(issueKey(issue))),\n );\n const sharedKeys = new Set(shared.map(issueKey));\n const ranked = branches\n .map((branch) => {\n const own = branch.filter((issue) => !sharedKeys.has(issueKey(issue)));\n const depth =\n own.length === 0 ? Infinity : Math.max(...own.map((issue) => issue.path.length));\n return { own, depth };\n })\n .toSorted((a, b) => b.depth - a.depth || a.own.length - b.own.length);\n const [closest, runnerUp] = ranked;\n if (\n closest === undefined ||\n (closest.own.length > 0 &&\n runnerUp !== undefined &&\n closest.depth === runnerUp.depth &&\n closest.own.length === runnerUp.own.length)\n ) {\n return [\n ...flattenZodIssues(shared, path),\n { ...toFlatIssue(union, path), message: tiedUnionMessage(union, ranked) },\n ];\n }\n return [...flattenZodIssues(shared, path), ...flattenZodIssues(closest.own, path)];\n}\n\n// zod's own message for a union; any other message was written for the field.\nconst DEFAULT_UNION_MESSAGE = \"Invalid input\";\n\nfunction tiedUnionMessage(\n union: z.core.$ZodIssueInvalidUnion,\n branches: readonly { own: readonly ZodIssue[] }[],\n): string {\n if (union.message !== DEFAULT_UNION_MESSAGE) {\n return union.message;\n }\n const expected = new Set<string>();\n for (const issue of branches.flatMap((branch) => branch.own)) {\n if (issue.path.length > 0) {\n return union.message;\n }\n if (issue.code === \"invalid_type\") {\n expected.add(issue.expected);\n } else if (issue.code === \"invalid_value\") {\n for (const value of issue.values) {\n expected.add(typeof value === \"string\" ? JSON.stringify(value) : String(value));\n }\n } else {\n return union.message;\n }\n }\n return expected.size === 0\n ? union.message\n : `${union.message}: expected ${[...expected].join(\" | \")}`;\n}\n\nfunction issueKey(issue: ZodIssue): string {\n return JSON.stringify([issue.path.map(String), issue.code, issue.message]);\n}\n\nfunction toFlatIssue(issue: ZodIssue, path: readonly PropertyKey[]): FlatIssue {\n return {\n path: path.map((segment) => (typeof segment === \"symbol\" ? String(segment) : segment)),\n message: issue.message,\n };\n}\n","import * as path from \"pathe\";\nimport { withErrorDiagnostics } from \"./error-diagnostics\";\nimport { CLIError, internalError } from \"./errors\";\nimport { flattenZodIssues, formatIssueList, type FlatIssue } from \"./zod-issues\";\nimport type { AppConfig } from \"#/configure/config/types\";\nimport type { SdkBrandKind } from \"#/utils/brand\";\nimport type { z } from \"zod\";\n\ninterface ConfigServiceRef {\n /** `defineConfig` property the service is configured under. */\n configKey: keyof AppConfig;\n /** Service name, or the namespace for TailorDB. */\n name?: string;\n}\n\nexport interface ConfigInvalidErrorParams {\n /** Config file that failed validation. */\n file: string;\n /** Config module export that failed validation. */\n exportName: \"default\" | \"plugins\";\n /** What failed, as it reads after \"Invalid\", such as `Tailor config`. */\n subject: string;\n /** Validation error of the failing value. */\n error: z.ZodError;\n /** Path of the failing value within `exportName`. */\n pathPrefix?: FlatIssue[\"path\"];\n /** The service that failed, when a single service config failed. */\n service?: ConfigServiceRef;\n}\n\n/**\n * Create the error for a config file that failed validation.\n * @param params - Failed config and its validation error\n * @returns CLIError coded `CONFIG_INVALID`, located at the config file\n */\nexport function configInvalidError(params: ConfigInvalidErrorParams): CLIError {\n const { file, exportName, subject, error, pathPrefix, service } = params;\n const issues = flattenZodIssues(error.issues, pathPrefix);\n return withErrorDiagnostics(\n CLIError({\n code: \"CONFIG_INVALID\",\n message: `Invalid ${subject} in ${relativeFile(file)}:\\n${formatIssueList(issues)}`,\n context: { file, exportName, ...service, issues },\n cause: error,\n }),\n { location: { file } },\n );\n}\n\nconst DEFINITION_LABELS = {\n resolver: \"resolver\",\n executor: \"executor\",\n \"tailordb-type\": \"TailorDB type\",\n \"http-adapter\": \"HTTP adapter\",\n workflow: \"workflow\",\n \"workflow-job\": \"workflow job\",\n} as const satisfies Partial<Record<SdkBrandKind, string>>;\n\nexport interface DefinitionErrorParams {\n /** Brand kind of the exported definition. */\n kind: keyof typeof DEFINITION_LABELS;\n /** Absolute path of the file that exports the definition. */\n file: string;\n /** Export the definition was found under. */\n exportName: string;\n}\n\nexport interface DefinitionInvalidErrorParams extends DefinitionErrorParams {\n /** Validation error of the definition. */\n error: z.ZodError;\n}\n\n/**\n * Create the error for an SDK definition that failed validation.\n * @param params - Failed definition and its validation error\n * @returns CLIError coded `DEFINITION_INVALID`, located at the definition file\n */\nexport function definitionInvalidError(params: DefinitionInvalidErrorParams): CLIError {\n const { kind, file, exportName, error } = params;\n const issues = flattenZodIssues(error.issues);\n const exportLabel = exportName === \"default\" ? \"\" : ` \\`${exportName}\\``;\n return withErrorDiagnostics(\n CLIError({\n code: \"DEFINITION_INVALID\",\n message: `Invalid ${DEFINITION_LABELS[kind]}${exportLabel} in ${relativeFile(file)}:\\n${formatIssueList(issues)}`,\n context: { kind, file, exportName, issues },\n cause: error,\n }),\n { location: { file } },\n );\n}\n\n/**\n * Create the error for an SDK definition exported where its loader does not read it.\n * @param params - Misplaced definition\n * @returns CLIError coded `DEFINITION_EXPORT_INVALID`, located at the definition file\n */\nexport function definitionExportError(params: DefinitionErrorParams): CLIError {\n const { kind, file, exportName } = params;\n const label = DEFINITION_LABELS[kind];\n const subject = `${label.charAt(0).toUpperCase()}${label.slice(1)} in ${relativeFile(file)}`;\n const placement =\n exportName === \"default\"\n ? {\n message: `${subject} must not be the default export.`,\n suggestion: \"Export it under a name instead.\",\n }\n : {\n message: `${subject} must not be a named export, but it is exported as \\`${exportName}\\`.`,\n suggestion: \"Export it only as the default export.\",\n };\n return withErrorDiagnostics(\n CLIError({\n code: \"DEFINITION_EXPORT_INVALID\",\n ...placement,\n context: { kind, file, exportName },\n }),\n { location: { file } },\n );\n}\n\n/** Plain object the TypeScript transform throws for source it cannot parse. */\ninterface SyntaxDiagnostic {\n code: \"InvalidSyntax\";\n message: string;\n filename: string;\n startLine?: number;\n}\n\nfunction isSyntaxDiagnostic(value: unknown): value is SyntaxDiagnostic {\n if (typeof value !== \"object\" || value === null || value instanceof Error) return false;\n const { code, message, filename, startLine } = value as Record<string, unknown>;\n return (\n code === \"InvalidSyntax\" &&\n typeof message === \"string\" &&\n typeof filename === \"string\" &&\n (startLine === undefined || typeof startLine === \"number\")\n );\n}\n\n/**\n * Create the error for a user module whose source does not parse.\n * @param thrown - Value thrown while importing the module\n * @returns CLIError coded `SYNTAX_INVALID`, located at the file and line the\n * source failed to parse on, or undefined when `thrown` is another failure\n */\nexport function syntaxInvalidError(thrown: unknown): CLIError | undefined {\n if (!isSyntaxDiagnostic(thrown)) return undefined;\n const { message, filename: file, startLine: line } = thrown;\n const location = line === undefined ? { file } : { file, line };\n const lineSuffix = line === undefined ? \"\" : `:${line}`;\n return withErrorDiagnostics(\n CLIError({\n code: \"SYNTAX_INVALID\",\n message: `Invalid syntax in ${relativeFile(file)}${lineSuffix}: ${message}`,\n context: location,\n cause: thrown,\n }),\n { location },\n );\n}\n\n/**\n * Create the error for SDK- or Platform-produced data that failed validation,\n * which no user action can fix.\n * @param subject - What failed, as it reads after \"Invalid\", such as `workspace context`\n * @param error - Validation error of the data\n * @returns Plain Error, reported as `UNEXPECTED_ERROR`\n */\nexport function invalidDataError(subject: string, error: z.ZodError): Error {\n return internalError(`Invalid ${subject}:\\n${formatIssueList(flattenZodIssues(error.issues))}`, {\n cause: error,\n });\n}\n\nfunction relativeFile(file: string): string {\n return path.relative(process.cwd(), file);\n}\n"],"mappings":"A,iIAmBA,MAAME,kBAAc,IAAI,QAQxB,SAAgB,qBAAsC,EAAU,EAA8B,CAE5F,OADAA,EAAY,IAAIC,EAAO,CAAE,GAAGD,EAAY,IAAIC,CAAK,EAAG,GAAGC,CAAQ,CAAC,EACzDD,CACT,CAOA,SAAgB,oBAAoB,EAAgC,CAClE,MAAO,CACL,GAAIA,aAAiBE,EAAe,CAAE,WAAY,cAAcF,EAAM,IAAI,CAAE,EAAI,CAAC,EACjF,GAAGD,EAAY,IAAIC,CAAK,CAC1B,CACF,CAEA,SAAS,cAAc,EAAgC,CACrD,OAAQG,EAAR,CACE,KAAKC,EAAK,gBACR,MAAO,iRACT,KAAKA,EAAK,iBACR,MAAO,6JACT,KAAKA,EAAK,YACV,KAAKA,EAAK,iBACR,MAAO,gJACT,QACE,MACJ,CACF,CCvCA,SAAgB,iBACd,EACA,EAAiC,CAAC,EACrB,CACb,OAAOC,EAAO,QAAS,GAAU,CAC/B,IAAMP,EAAO,CAAC,GAAGQ,EAAQ,GAAGC,EAAM,IAAI,EAOtC,OANIA,EAAM,OAAS,gBACV,aAAaA,EAAOT,CAAI,EAE7BS,EAAM,OAAS,cACV,iBAAiBA,EAAM,OAAQT,CAAI,EAErC,CAAC,YAAYS,EAAOT,CAAI,CAAC,CAClC,CAAC,CACH,CAOA,SAAgB,gBAAgB,EAAsC,CACpE,OAAOO,EACJ,IAAK,GAAU,OAAOE,EAAM,KAAK,KAAK,GAAG,GAAK,SAAS,IAAIA,EAAM,SAAS,CAAC,CAC3E,KAAK;CAAI,CACd,CAEA,SAAS,aACP,EACA,EACa,CACb,IAAMC,EAA6CC,EAAM,OACnDC,EAAaF,EAAS,IAAK,GAAW,IAAI,IAAIG,EAAO,IAAI,QAAQ,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,UAAS,CACb,CACF,CASA,SAAgB,iBAAiB,EAAiB,EAA0B,CAC1E,OAAO1C,EAAc,WAAW8B,EAAQ,KAAK,gBAAgB,iBAAiB3B,EAAM,MAAM,CAAC,IAAK,CAC9F,MAAOA,CACT,CAAC,CACH,CAEA,SAAS,aAAa,EAAsB,CAC1C,OAAOF,EAAK,SAAS,QAAQ,IAAI,EAAG8B,CAAI,CAC1C,C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright (c) GraphQL Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|