@tailor-platform/sdk 1.18.0 → 1.20.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/dist/{application-gWUyKuzv.mjs → application-Bli2ieqY.mjs} +2704 -2394
  3. package/dist/application-Bli2ieqY.mjs.map +1 -0
  4. package/dist/application-CZdieD3K.mjs +9 -0
  5. package/dist/cli/index.mjs +121 -64
  6. package/dist/cli/index.mjs.map +1 -1
  7. package/dist/cli/lib.d.mts +122 -58
  8. package/dist/cli/lib.mjs +11 -9
  9. package/dist/cli/lib.mjs.map +1 -1
  10. package/dist/cli/skills.mjs +1 -1
  11. package/dist/cli/skills.mjs.map +1 -1
  12. package/dist/configure/index.d.mts +4 -4
  13. package/dist/configure/index.mjs +1 -1
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/{enum-constants-Cwd4qdpa.mjs → enum-constants-CGVvu3dd.mjs} +1 -1
  16. package/dist/{enum-constants-Cwd4qdpa.mjs.map → enum-constants-CGVvu3dd.mjs.map} +1 -1
  17. package/dist/{file-utils-cqcpFk87.mjs → file-utils-GX_tGWl4.mjs} +1 -1
  18. package/dist/{file-utils-cqcpFk87.mjs.map → file-utils-GX_tGWl4.mjs.map} +1 -1
  19. package/dist/{index-sSDpuVQY.d.mts → index-B86CIKCW.d.mts} +2 -2
  20. package/dist/{index-SqWgrTnF.d.mts → index-CGjiOz_W.d.mts} +2 -2
  21. package/dist/{index-BKXch-td.d.mts → index-CIXOwe6g.d.mts} +2 -2
  22. package/dist/{index-DP8EB9FK.d.mts → index-DcY0e3S5.d.mts} +10 -43
  23. package/dist/{index-C3Ib7pFc.d.mts → index-i6QUsr5p.d.mts} +2 -2
  24. package/dist/interceptor-D8MeZOxX.mjs +33 -0
  25. package/dist/interceptor-D8MeZOxX.mjs.map +1 -0
  26. package/dist/{jiti-DHlauMCo.mjs → jiti-DfS9jItj.mjs} +1 -1
  27. package/dist/{jiti-DHlauMCo.mjs.map → jiti-DfS9jItj.mjs.map} +1 -1
  28. package/dist/{kysely-type-DtUUoAi3.mjs → kysely-type-Cpq5TNGY.mjs} +2 -1
  29. package/dist/kysely-type-Cpq5TNGY.mjs.map +1 -0
  30. package/dist/package-json-3H5gfhA4.mjs +17 -0
  31. package/dist/package-json-3H5gfhA4.mjs.map +1 -0
  32. package/dist/package-json-DTDAqRRJ.mjs +3 -0
  33. package/dist/plugin/builtin/enum-constants/index.d.mts +2 -2
  34. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  35. package/dist/plugin/builtin/file-utils/index.d.mts +2 -2
  36. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  37. package/dist/plugin/builtin/kysely-type/index.d.mts +2 -2
  38. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  39. package/dist/plugin/builtin/seed/index.d.mts +2 -2
  40. package/dist/plugin/builtin/seed/index.mjs +1 -1
  41. package/dist/plugin/index.d.mts +1 -1
  42. package/dist/{schema-WDvc7Zel.mjs → schema-D5Cpd8fQ.mjs} +45 -3
  43. package/dist/schema-D5Cpd8fQ.mjs.map +1 -0
  44. package/dist/{seed-Dm7lrGZ3.mjs → seed-CeUEANfQ.mjs} +1 -1
  45. package/dist/{seed-Dm7lrGZ3.mjs.map → seed-CeUEANfQ.mjs.map} +1 -1
  46. package/dist/{src-i4uqS1G4.mjs → src-Bb1UVstT.mjs} +1 -1
  47. package/dist/{src-i4uqS1G4.mjs.map → src-Bb1UVstT.mjs.map} +1 -1
  48. package/dist/telemetry-Dhzj9Ncm.mjs +3 -0
  49. package/dist/telemetry-DuBhnd0X.mjs +84 -0
  50. package/dist/telemetry-DuBhnd0X.mjs.map +1 -0
  51. package/dist/{types-Bhl_wAM2.d.mts → types-C14GuyPI.d.mts} +94 -3
  52. package/dist/{types-DdvTxFiD.d.mts → types-CNw4p8V7.d.mts} +34 -10
  53. package/dist/types-ClK_HJ0G.mjs.map +1 -1
  54. package/dist/{update-BoNKMti-.mjs → update-DkpWgrzL.mjs} +548 -300
  55. package/dist/update-DkpWgrzL.mjs.map +1 -0
  56. package/dist/utils/test/index.d.mts +3 -3
  57. package/docs/cli/application.md +2 -0
  58. package/package.json +7 -1
  59. package/dist/application-Csj7Ow5Q.mjs +0 -8
  60. package/dist/application-gWUyKuzv.mjs.map +0 -1
  61. package/dist/kysely-type-DtUUoAi3.mjs.map +0 -1
  62. package/dist/schema-WDvc7Zel.mjs.map +0 -1
  63. package/dist/update-BoNKMti-.mjs.map +0 -1
@@ -0,0 +1,84 @@
1
+ import { SpanStatusCode, trace } from "@opentelemetry/api";
2
+
3
+ //#region src/cli/telemetry/config.ts
4
+ /**
5
+ * Parse telemetry configuration from standard OpenTelemetry environment variables.
6
+ * Tracing is enabled when OTEL_EXPORTER_OTLP_ENDPOINT is set.
7
+ * @returns Telemetry configuration
8
+ */
9
+ function parseTelemetryConfig() {
10
+ const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? "";
11
+ return {
12
+ enabled: endpoint.length > 0,
13
+ endpoint
14
+ };
15
+ }
16
+
17
+ //#endregion
18
+ //#region src/cli/telemetry/index.ts
19
+ let _config;
20
+ let _initialized = false;
21
+ let _provider;
22
+ /**
23
+ * Initialize telemetry if OTEL_EXPORTER_OTLP_ENDPOINT is set.
24
+ * When disabled, this is a no-op with zero overhead beyond reading env vars.
25
+ * @returns Promise that resolves when initialization completes
26
+ */
27
+ async function initTelemetry() {
28
+ if (_initialized) return;
29
+ _initialized = true;
30
+ _config = parseTelemetryConfig();
31
+ if (!_config.enabled) return;
32
+ const [{ NodeTracerProvider, BatchSpanProcessor }, { OTLPTraceExporter }, { resourceFromAttributes }, { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION }, { readPackageJson }] = await Promise.all([
33
+ import("@opentelemetry/sdk-trace-node"),
34
+ import("@opentelemetry/exporter-trace-otlp-proto"),
35
+ import("@opentelemetry/resources"),
36
+ import("@opentelemetry/semantic-conventions"),
37
+ import("./package-json-DTDAqRRJ.mjs")
38
+ ]);
39
+ const version = (await readPackageJson()).version ?? "unknown";
40
+ _provider = new NodeTracerProvider({
41
+ resource: resourceFromAttributes({
42
+ [ATTR_SERVICE_NAME]: "tailor-sdk",
43
+ [ATTR_SERVICE_VERSION]: version
44
+ }),
45
+ spanProcessors: [new BatchSpanProcessor(new OTLPTraceExporter({ url: `${_config.endpoint}/v1/traces` }))]
46
+ });
47
+ _provider.register();
48
+ }
49
+ /**
50
+ * Shutdown the telemetry provider, flushing all pending spans.
51
+ * Must be called before process exit to ensure traces are exported.
52
+ * @returns Promise that resolves when shutdown completes
53
+ */
54
+ async function shutdownTelemetry() {
55
+ if (!_provider) return;
56
+ await _provider.shutdown();
57
+ }
58
+ /**
59
+ * Execute a function within a new span. Records exceptions and sets span status.
60
+ * When no TracerProvider is registered, the OTel API automatically provides
61
+ * noop spans with zero overhead.
62
+ * @param name - Span name
63
+ * @param fn - Function to execute within the span
64
+ * @returns Result of fn
65
+ */
66
+ async function withSpan(name, fn) {
67
+ return trace.getTracer("tailor-sdk").startActiveSpan(name, async (span) => {
68
+ try {
69
+ const result = await fn(span);
70
+ span.setStatus({ code: SpanStatusCode.OK });
71
+ return result;
72
+ } catch (error) {
73
+ span.setStatus({ code: SpanStatusCode.ERROR });
74
+ if (error instanceof Error) span.recordException(error);
75
+ throw error;
76
+ } finally {
77
+ span.end();
78
+ }
79
+ });
80
+ }
81
+
82
+ //#endregion
83
+ export { shutdownTelemetry as n, withSpan as r, initTelemetry as t };
84
+ //# sourceMappingURL=telemetry-DuBhnd0X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry-DuBhnd0X.mjs","names":[],"sources":["../src/cli/telemetry/config.ts","../src/cli/telemetry/index.ts"],"sourcesContent":["/**\n * Telemetry configuration parsed from standard OpenTelemetry environment variables.\n * Tracing is enabled when OTEL_EXPORTER_OTLP_ENDPOINT is set.\n */\nexport interface TelemetryConfig {\n readonly enabled: boolean;\n readonly endpoint: string;\n}\n\n/**\n * Parse telemetry configuration from standard OpenTelemetry environment variables.\n * Tracing is enabled when OTEL_EXPORTER_OTLP_ENDPOINT is set.\n * @returns Telemetry configuration\n */\nexport function parseTelemetryConfig(): TelemetryConfig {\n const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? \"\";\n const enabled = endpoint.length > 0;\n\n return {\n enabled,\n endpoint,\n };\n}\n","import { trace, SpanStatusCode, type Span } from \"@opentelemetry/api\";\nimport { parseTelemetryConfig, type TelemetryConfig } from \"./config\";\n\nlet _config: TelemetryConfig | undefined;\nlet _initialized = false;\nlet _provider: { register: () => void; shutdown: () => Promise<void> } | undefined;\n\n/**\n * Check whether telemetry is currently enabled.\n * @returns true if telemetry has been initialized and is enabled\n */\nexport function isTelemetryEnabled(): boolean {\n return _config?.enabled ?? false;\n}\n\n/**\n * Initialize telemetry if OTEL_EXPORTER_OTLP_ENDPOINT is set.\n * When disabled, this is a no-op with zero overhead beyond reading env vars.\n * @returns Promise that resolves when initialization completes\n */\nexport async function initTelemetry(): Promise<void> {\n if (_initialized) return;\n _initialized = true;\n\n _config = parseTelemetryConfig();\n if (!_config.enabled) return;\n\n // Dynamic imports - only loaded when tracing is enabled\n const [\n { NodeTracerProvider, BatchSpanProcessor },\n { OTLPTraceExporter },\n { resourceFromAttributes },\n { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION },\n { readPackageJson },\n ] = await Promise.all([\n import(\"@opentelemetry/sdk-trace-node\"),\n import(\"@opentelemetry/exporter-trace-otlp-proto\"),\n import(\"@opentelemetry/resources\"),\n import(\"@opentelemetry/semantic-conventions\"),\n import(\"@/cli/shared/package-json\"),\n ]);\n\n const packageJson = await readPackageJson();\n const version = packageJson.version ?? \"unknown\";\n\n const resource = resourceFromAttributes({\n [ATTR_SERVICE_NAME]: \"tailor-sdk\",\n [ATTR_SERVICE_VERSION]: version,\n });\n\n const exporter = new OTLPTraceExporter({\n url: `${_config.endpoint}/v1/traces`,\n });\n\n _provider = new NodeTracerProvider({\n resource,\n spanProcessors: [new BatchSpanProcessor(exporter)],\n });\n\n _provider.register();\n}\n\n/**\n * Shutdown the telemetry provider, flushing all pending spans.\n * Must be called before process exit to ensure traces are exported.\n * @returns Promise that resolves when shutdown completes\n */\nexport async function shutdownTelemetry(): Promise<void> {\n if (!_provider) return;\n await _provider.shutdown();\n}\n\n/**\n * Execute a function within a new span. Records exceptions and sets span status.\n * When no TracerProvider is registered, the OTel API automatically provides\n * noop spans with zero overhead.\n * @param name - Span name\n * @param fn - Function to execute within the span\n * @returns Result of fn\n */\nexport async function withSpan<T>(name: string, fn: (span: Span) => Promise<T>): Promise<T> {\n const tracer = trace.getTracer(\"tailor-sdk\");\n\n return tracer.startActiveSpan(name, async (span) => {\n try {\n const result = await fn(span);\n span.setStatus({ code: SpanStatusCode.OK });\n return result;\n } catch (error) {\n span.setStatus({ code: SpanStatusCode.ERROR });\n if (error instanceof Error) {\n span.recordException(error);\n }\n throw error;\n } finally {\n span.end();\n }\n });\n}\n"],"mappings":";;;;;;;;AAcA,SAAgB,uBAAwC;CACtD,MAAM,WAAW,QAAQ,IAAI,+BAA+B;AAG5D,QAAO;EACL,SAHc,SAAS,SAAS;EAIhC;EACD;;;;;AClBH,IAAI;AACJ,IAAI,eAAe;AACnB,IAAI;;;;;;AAeJ,eAAsB,gBAA+B;AACnD,KAAI,aAAc;AAClB,gBAAe;AAEf,WAAU,sBAAsB;AAChC,KAAI,CAAC,QAAQ,QAAS;CAGtB,MAAM,CACJ,EAAE,oBAAoB,sBACtB,EAAE,qBACF,EAAE,0BACF,EAAE,mBAAmB,wBACrB,EAAE,qBACA,MAAM,QAAQ,IAAI;EACpB,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACR,CAAC;CAGF,MAAM,WADc,MAAM,iBAAiB,EACf,WAAW;AAWvC,aAAY,IAAI,mBAAmB;EACjC,UAVe,uBAAuB;IACrC,oBAAoB;IACpB,uBAAuB;GACzB,CAAC;EAQA,gBAAgB,CAAC,IAAI,mBANN,IAAI,kBAAkB,EACrC,KAAK,GAAG,QAAQ,SAAS,aAC1B,CAAC,CAIiD,CAAC;EACnD,CAAC;AAEF,WAAU,UAAU;;;;;;;AAQtB,eAAsB,oBAAmC;AACvD,KAAI,CAAC,UAAW;AAChB,OAAM,UAAU,UAAU;;;;;;;;;;AAW5B,eAAsB,SAAY,MAAc,IAA4C;AAG1F,QAFe,MAAM,UAAU,aAAa,CAE9B,gBAAgB,MAAM,OAAO,SAAS;AAClD,MAAI;GACF,MAAM,SAAS,MAAM,GAAG,KAAK;AAC7B,QAAK,UAAU,EAAE,MAAM,eAAe,IAAI,CAAC;AAC3C,UAAO;WACA,OAAO;AACd,QAAK,UAAU,EAAE,MAAM,eAAe,OAAO,CAAC;AAC9C,OAAI,iBAAiB,MACnB,MAAK,gBAAgB,MAAM;AAE7B,SAAM;YACE;AACR,QAAK,KAAK;;GAEZ"}
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./user-defined.d.ts" />
2
- import { P as ExecutorServiceInput, Pt as ResolverServiceInput, W as AuthConfig, Y as BuiltinIdP, qt as TailorDBServiceInput } from "./types-DdvTxFiD.mjs";
2
+ import { P as ExecutorServiceInput, Pt as ResolverServiceInput, W as AuthConfig, Y as BuiltinIdP, qt as TailorDBServiceInput } from "./types-CNw4p8V7.mjs";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/parser/service/workflow/types.d.ts
@@ -89,8 +89,92 @@ declare const IdPSchema: z.core.$ZodBranded<z.ZodObject<{
89
89
  disablePasswordAuth?: boolean | undefined;
90
90
  }>>>;
91
91
  publishUserEvents: z.ZodOptional<z.ZodBoolean>;
92
+ gqlOperations: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodLiteral<"query">, z.ZodObject<{
93
+ create: z.ZodOptional<z.ZodBoolean>;
94
+ update: z.ZodOptional<z.ZodBoolean>;
95
+ delete: z.ZodOptional<z.ZodBoolean>;
96
+ read: z.ZodOptional<z.ZodBoolean>;
97
+ sendPasswordResetEmail: z.ZodOptional<z.ZodBoolean>;
98
+ }, z.core.$strip>]>, z.ZodTransform<IdPGqlOperations, "query" | {
99
+ create?: boolean | undefined;
100
+ update?: boolean | undefined;
101
+ delete?: boolean | undefined;
102
+ read?: boolean | undefined;
103
+ sendPasswordResetEmail?: boolean | undefined;
104
+ }>>>;
92
105
  }, z.core.$strip>, "IdPConfig", "out">;
93
106
  //#endregion
107
+ //#region src/configure/services/idp/index.d.ts
108
+ /**
109
+ * Configuration for GraphQL operations on IdP users.
110
+ * All operations are enabled by default (undefined or true = enabled, false = disabled).
111
+ */
112
+ interface IdPGqlOperations {
113
+ /** Enable _createUser mutation (default: true) */
114
+ create?: boolean;
115
+ /** Enable _updateUser mutation (default: true) */
116
+ update?: boolean;
117
+ /** Enable _deleteUser mutation (default: true) */
118
+ delete?: boolean;
119
+ /** Enable _users and _user queries (default: true) */
120
+ read?: boolean;
121
+ /** Enable _sendPasswordResetEmail mutation (default: true) */
122
+ sendPasswordResetEmail?: boolean;
123
+ }
124
+ /**
125
+ * Alias for common IdPGqlOperations configurations.
126
+ * - "query": Read-only mode - disables all mutations (create, update, delete, sendPasswordResetEmail)
127
+ */
128
+ type IdPGqlOperationsAliasQuery = "query";
129
+ /**
130
+ * Configuration for GraphQL operations - either an alias string or detailed object.
131
+ */
132
+ type IdPGqlOperationsConfig = IdPGqlOperationsAliasQuery | IdPGqlOperations;
133
+ /**
134
+ * Define an IdP service configuration for the Tailor SDK.
135
+ * @template TClients
136
+ * @param name - IdP service name
137
+ * @param config - IdP configuration
138
+ * @returns Defined IdP service
139
+ */
140
+ declare function defineIdp<const TClients extends string[]>(name: string, config: Omit<IdPInput, "name" | "clients"> & {
141
+ clients: TClients;
142
+ }): {
143
+ readonly name: string;
144
+ readonly provider: (providerName: string, clientName: TClients[number]) => {
145
+ readonly name: string;
146
+ readonly kind: "BuiltInIdP";
147
+ readonly namespace: string;
148
+ readonly clientName: TClients[number];
149
+ };
150
+ readonly authorization: "insecure" | "loggedIn" | {
151
+ cel: string;
152
+ };
153
+ readonly lang?: "en" | "ja" | undefined;
154
+ readonly userAuthPolicy?: {
155
+ useNonEmailIdentifier?: boolean | undefined;
156
+ allowSelfPasswordReset?: boolean | undefined;
157
+ passwordRequireUppercase?: boolean | undefined;
158
+ passwordRequireLowercase?: boolean | undefined;
159
+ passwordRequireNonAlphanumeric?: boolean | undefined;
160
+ passwordRequireNumeric?: boolean | undefined;
161
+ passwordMinLength?: number | undefined;
162
+ passwordMaxLength?: number | undefined;
163
+ allowedEmailDomains?: string[] | undefined;
164
+ allowGoogleOauth?: boolean | undefined;
165
+ disablePasswordAuth?: boolean | undefined;
166
+ } | undefined;
167
+ readonly publishUserEvents?: boolean | undefined;
168
+ readonly gqlOperations?: "query" | {
169
+ create?: boolean | undefined;
170
+ update?: boolean | undefined;
171
+ delete?: boolean | undefined;
172
+ read?: boolean | undefined;
173
+ sendPasswordResetEmail?: boolean | undefined;
174
+ } | undefined;
175
+ readonly clients: TClients;
176
+ } & IdpDefinitionBrand;
177
+ //#endregion
94
178
  //#region src/parser/service/idp/types.d.ts
95
179
  type IdPInput = z.input<typeof IdPSchema>;
96
180
  declare const idpDefinitionBrand: unique symbol;
@@ -145,7 +229,14 @@ interface AppConfig<Auth extends AuthConfig = AuthConfig, Idp extends IdPConfig[
145
229
  workflow?: WorkflowServiceInput;
146
230
  /** Static website configurations. Must be an array, e.g. `[website]`. */
147
231
  staticWebsites?: StaticWebsites;
232
+ /**
233
+ * Enable inline sourcemaps in bundled functions for better error stack traces.
234
+ * When enabled, sourcemaps are embedded directly in the bundle file.
235
+ * Set to `false` to disable (e.g. if bundle size exceeds limits).
236
+ * @default true
237
+ */
238
+ inlineSourcemap?: boolean;
148
239
  }
149
240
  //#endregion
150
- export { IdpDefinitionBrand as a, WorkflowServiceConfig as c, IdPInput as i, WorkflowServiceInput as l, IdPConfig as n, StaticWebsiteConfig as o, IdPExternalConfig as r, defineStaticWebSite as s, AppConfig as t };
151
- //# sourceMappingURL=types-Bhl_wAM2.d.mts.map
241
+ export { IdPGqlOperationsAliasQuery as a, StaticWebsiteConfig as c, WorkflowServiceInput as d, IdPGqlOperations as i, defineStaticWebSite as l, IdPConfig as n, IdPGqlOperationsConfig as o, IdPExternalConfig as r, defineIdp as s, AppConfig as t, WorkflowServiceConfig as u };
242
+ //# sourceMappingURL=types-C14GuyPI.d.mts.map
@@ -534,11 +534,11 @@ declare const RawPermissionsSchema: z.ZodObject<{
534
534
  }, z.core.$strict>, z.ZodString, z.ZodBoolean, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodBoolean>]>], null>>>>;
535
535
  actions: z.ZodUnion<readonly [z.ZodLiteral<"all">, z.ZodReadonly<z.ZodArray<z.ZodEnum<{
536
536
  create: "create";
537
- delete: "delete";
538
537
  update: "update";
538
+ delete: "delete";
539
+ read: "read";
539
540
  aggregate: "aggregate";
540
541
  bulkUpsert: "bulkUpsert";
541
- read: "read";
542
542
  }>>>]>;
543
543
  permit: z.ZodOptional<z.ZodBoolean>;
544
544
  description: z.ZodOptional<z.ZodString>;
@@ -677,11 +677,12 @@ declare const TailorFieldSchema: z.ZodObject<{
677
677
  type: z.ZodEnum<{
678
678
  string: "string";
679
679
  boolean: "boolean";
680
- date: "date";
681
- enum: "enum";
682
680
  uuid: "uuid";
683
681
  integer: "integer";
684
682
  float: "float";
683
+ decimal: "decimal";
684
+ enum: "enum";
685
+ date: "date";
685
686
  datetime: "datetime";
686
687
  time: "time";
687
688
  nested: "nested";
@@ -710,11 +711,12 @@ declare const ResolverSchema: z.ZodObject<{
710
711
  type: z.ZodEnum<{
711
712
  string: "string";
712
713
  boolean: "boolean";
713
- date: "date";
714
- enum: "enum";
715
714
  uuid: "uuid";
716
715
  integer: "integer";
717
716
  float: "float";
717
+ decimal: "decimal";
718
+ enum: "enum";
719
+ date: "date";
718
720
  datetime: "datetime";
719
721
  time: "time";
720
722
  nested: "nested";
@@ -740,11 +742,12 @@ declare const ResolverSchema: z.ZodObject<{
740
742
  type: z.ZodEnum<{
741
743
  string: "string";
742
744
  boolean: "boolean";
743
- date: "date";
744
- enum: "enum";
745
745
  uuid: "uuid";
746
746
  integer: "integer";
747
747
  float: "float";
748
+ decimal: "decimal";
749
+ enum: "enum";
750
+ date: "date";
748
751
  datetime: "datetime";
749
752
  time: "time";
750
753
  nested: "nested";
@@ -905,11 +908,12 @@ type Validators<F extends Record<string, {
905
908
  }>> = ValidatorsBase<F, "id">;
906
909
  //#endregion
907
910
  //#region src/configure/types/types.d.ts
908
- type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "enum" | "date" | "datetime" | "time" | "nested";
911
+ type TailorFieldType = "uuid" | "string" | "boolean" | "integer" | "float" | "decimal" | "enum" | "date" | "datetime" | "time" | "nested";
909
912
  type TailorToTs = {
910
913
  string: string;
911
914
  integer: number;
912
915
  float: number;
916
+ decimal: string;
913
917
  boolean: boolean;
914
918
  uuid: string;
915
919
  date: string;
@@ -1074,6 +1078,7 @@ interface DBFieldMetadata extends FieldMetadata {
1074
1078
  hooks?: Hook<any, any>;
1075
1079
  serial?: SerialConfig;
1076
1080
  relation?: boolean;
1081
+ scale?: number;
1077
1082
  }
1078
1083
  interface DefinedDBFieldMetadata extends DefinedFieldMetadata {
1079
1084
  index?: boolean;
@@ -2329,6 +2334,23 @@ declare function float<const Opt extends FieldOptions>(options?: Opt): TailorDBF
2329
2334
  array: true;
2330
2335
  } ? true : false;
2331
2336
  }, Opt["optional"] extends true ? ArrayFieldOutput<number, Opt> | null : ArrayFieldOutput<number, Opt>>;
2337
+ interface DecimalFieldOptions extends FieldOptions {
2338
+ scale?: number;
2339
+ }
2340
+ /**
2341
+ * Create a decimal field (stored as string for precision).
2342
+ * @param options - Field configuration options including optional scale (0-12)
2343
+ * @returns A decimal field
2344
+ * @example db.decimal()
2345
+ * @example db.decimal({ scale: 2 })
2346
+ * @example db.decimal({ scale: 2, optional: true })
2347
+ */
2348
+ declare function decimal<const Opt extends DecimalFieldOptions>(options?: Opt): TailorDBField<{
2349
+ type: "decimal";
2350
+ array: Opt extends {
2351
+ array: true;
2352
+ } ? true : false;
2353
+ }, Opt["optional"] extends true ? ArrayFieldOutput<string, Opt> | null : ArrayFieldOutput<string, Opt>>;
2332
2354
  /**
2333
2355
  * Create a date field (date only, no time component).
2334
2356
  * Format: "yyyy-MM-dd"
@@ -2542,6 +2564,7 @@ declare const db: {
2542
2564
  bool: typeof bool;
2543
2565
  int: typeof int;
2544
2566
  float: typeof float;
2567
+ decimal: typeof decimal;
2545
2568
  date: typeof date;
2546
2569
  datetime: typeof datetime;
2547
2570
  time: typeof time;
@@ -2679,6 +2702,7 @@ interface OperatorFieldConfig {
2679
2702
  maxValue?: number;
2680
2703
  format?: string;
2681
2704
  };
2705
+ scale?: number;
2682
2706
  fields?: Record<string, OperatorFieldConfig>;
2683
2707
  }
2684
2708
  type GqlPermissionAction = "read" | "create" | "update" | "delete" | "aggregate" | "bulkUpsert";
@@ -2775,4 +2799,4 @@ interface TailorDBType {
2775
2799
  }
2776
2800
  //#endregion
2777
2801
  export { OAuth2ClientGrantType as $, AuthAccessTokenTrigger as A, Resolver as At, ResolverExecutedTrigger as B, TailorActor as Bt, TypePluginOutput as C, FieldMetadata as Ct, ResolverReadyContext as D, TailorAnyField as Dt, ResolverNamespaceData as E, TailorFieldType as Et, FunctionOperation as F, InferFieldsOutput as Ft, AuthExternalConfig as G, AllowedValues as Gt, WebhookOperation as H, AttributeMap as Ht, GqlOperation as I, JsonCompatible as It, AuthServiceInput as J, AuthInvoker as K, AllowedValuesOutput as Kt, IdpUserTrigger as L, output as Lt, ExecutorInput as M, ResolverInput as Mt, ExecutorServiceConfig as N, ResolverServiceConfig as Nt, TailorDBNamespaceData as O, TailorField as Ot, ExecutorServiceInput as P, ResolverServiceInput as Pt, IdProviderConfig as Q, IncomingWebhookTrigger as R, Env as Rt, TailorDBTypeForPlugin as S, DefinedFieldMetadata as St, GeneratorResult as T, FieldOutput$1 as Tt, WorkflowOperation as U, TailorUser as Ut, ScheduleTriggerInput as V, AttributeList as Vt, AuthConfig as W, unauthenticatedTailorUser as Wt, DefinedAuth as X, BuiltinIdP as Y, IDToken as Z, PluginGeneratedResolver as _, TailorTypeGqlPermission as _t, TailorDBField as a, SCIMAttributeType as at, PluginOutput as b, unsafeAllowAllTypePermission as bt, db as c, SCIMResource as ct, PluginAttachment as d, UserAttributeListKey as dt, OAuth2ClientInput as et, PluginConfigs as f, UserAttributeMap as ft, PluginGeneratedExecutorWithFile as g, PermissionCondition as gt, PluginGeneratedExecutor as h, GeneratorConfig as ht, TailorAnyDBType as i, SCIMAttributeMapping as it, Executor as j, ResolverExternalConfig as jt, TailorDBReadyContext as k, QueryType as kt, NamespacePluginOutput as l, TenantProviderConfig as lt, PluginExecutorContextBase as m, ValueOperand as mt, TypeSourceInfoEntry as n, SAML as nt, TailorDBInstance as o, SCIMAuthorization as ot, PluginExecutorContext as p, UsernameFieldKey as pt, AuthOwnConfig as q, TailorDBServiceInput as qt, TailorAnyDBField as r, SCIMAttribute as rt, TailorDBType$1 as s, SCIMConfig as st, TailorDBType as t, OIDC as tt, Plugin as u, UserAttributeKey as ut, PluginGeneratedType as v, TailorTypePermission as vt, ExecutorReadyContext as w, FieldOptions as wt, PluginProcessContext as x, ArrayFieldOutput as xt, PluginNamespaceProcessContext as y, unsafeAllowAllGqlPermission as yt, RecordTrigger as z, TailorEnv as zt };
2778
- //# sourceMappingURL=types-DdvTxFiD.d.mts.map
2802
+ //# sourceMappingURL=types-CNw4p8V7.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-ClK_HJ0G.mjs","names":[],"sources":["../src/parser/service/tailordb/types.ts"],"sourcesContent":["import type { RelationType } from \"./relation\";\nimport type {\n DBFieldMetadataSchema,\n RawRelationConfigSchema,\n RawPermissionsSchema,\n TailorDBTypeSchema,\n TailorDBServiceConfig as TailorDBServiceConfigType,\n TailorDBTypeSettingsSchema,\n} from \"./schema\";\nimport type { GqlOperationsConfig } from \"@/configure/services/tailordb\";\nimport type { ValueOperand } from \"@/parser/service/auth/types\";\nimport type { z } from \"zod\";\n\nexport type { RelationType } from \"./relation\";\nexport type { TypeSourceInfo } from \"./type-parser\";\n\n// ========================================\n// Source info type for TailorDB types\n// ========================================\n\n/**\n * Source information for a user-defined TailorDB type.\n */\nexport interface UserDefinedTypeSource {\n /** File path to import from */\n filePath: string;\n /** Export name in the source file */\n exportName: string;\n /** Not present for user-defined types */\n pluginId?: never;\n}\n\n/**\n * Source information for a plugin-generated TailorDB type.\n */\nexport interface PluginGeneratedTypeSource {\n /** Not present for plugin-generated types */\n filePath?: never;\n /** Export name of the generated type */\n exportName: string;\n /** Plugin ID that generated this type */\n pluginId: string;\n /** Plugin import path for code generators */\n pluginImportPath: string;\n /** Original type's file path */\n originalFilePath: string;\n /** Original type's export name */\n originalExportName: string;\n /** Generated type kind for getGeneratedType() API (e.g., \"request\", \"step\") */\n generatedTypeKind?: string;\n /** Plugin config used to generate this type */\n pluginConfig?: unknown;\n /** Namespace where this type was generated */\n namespace?: string;\n}\n\n/**\n * Source information for a TailorDB type.\n * Discriminated union: use `pluginId` to distinguish between user-defined and plugin-generated types.\n */\nexport type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;\n\n/**\n * Type guard to check if source is plugin-generated\n * @param source - Type source info to check\n * @returns True if source is plugin-generated\n */\nexport function isPluginGeneratedType(\n source: TypeSourceInfoEntry,\n): source is PluginGeneratedTypeSource {\n return source.pluginId !== undefined;\n}\n\nexport type {\n TailorAnyDBField,\n TailorAnyDBType,\n TailorDBField,\n DBFieldMetadata,\n Hook,\n TailorTypePermission,\n TailorTypeGqlPermission,\n GqlOperationsConfig,\n GqlOperations,\n} from \"@/configure/services/tailordb\";\nexport type {\n TailorDBServiceConfigInput,\n TailorDBServiceConfig,\n TailorDBExternalConfig,\n TailorDBServiceInput,\n} from \"./schema\";\n\n/**\n * Parsed and normalized settings for TailorDB type.\n * gqlOperations is normalized from alias to object format.\n * @public\n */\nexport type TailorDBTypeParsedSettings = z.output<typeof TailorDBTypeSettingsSchema>;\n\n/**\n * Migration configuration for TailorDB\n * @public\n */\nexport type TailorDBMigrationConfig = NonNullable<TailorDBServiceConfigType[\"migration\"]>;\n\nexport type TailorDBTypeSchemaOutput = z.output<typeof TailorDBTypeSchema>;\n\nexport type DBFieldMetadataOutput = z.output<typeof DBFieldMetadataSchema>;\nexport type RawRelationConfigOutput = z.output<typeof RawRelationConfigSchema>;\n\nexport type RawPermissions = z.output<typeof RawPermissionsSchema>;\n\nexport type TailorDBFieldOutput = {\n type: string;\n fields?: Record<string, TailorDBFieldOutput>;\n metadata: DBFieldMetadataOutput;\n rawRelation?: RawRelationConfigOutput;\n};\n\nexport interface Script {\n expr: string;\n}\n\nexport interface EnumValue {\n value: string;\n description?: string;\n}\n\ninterface OperatorValidateConfig {\n script: Script;\n errorMessage: string;\n}\n\ninterface OperatorFieldHook {\n create?: Script;\n update?: Script;\n}\n\n/**\n * Raw relation config stored in configure layer, processed in parser layer.\n * This is the serialized form of RelationConfig from schema.ts where\n * the TailorDBType reference is replaced with the type name string.\n */\nexport interface RawRelationConfig {\n type: RelationType;\n toward: {\n type: string;\n as?: string;\n key?: string;\n };\n backward?: string;\n}\n\nexport interface OperatorFieldConfig {\n type: string;\n required?: boolean;\n description?: string;\n allowedValues?: EnumValue[];\n array?: boolean;\n index?: boolean;\n unique?: boolean;\n vector?: boolean;\n foreignKey?: boolean;\n foreignKeyType?: string;\n foreignKeyField?: string;\n rawRelation?: RawRelationConfig;\n validate?: OperatorValidateConfig[];\n hooks?: OperatorFieldHook;\n serial?: {\n start: number;\n maxValue?: number;\n format?: string;\n };\n fields?: Record<string, OperatorFieldConfig>;\n}\n\ntype GqlPermissionAction = \"read\" | \"create\" | \"update\" | \"delete\" | \"aggregate\" | \"bulkUpsert\";\n\ntype StandardPermissionOperator = \"eq\" | \"ne\" | \"in\" | \"nin\" | \"hasAny\" | \"nhasAny\";\n\ntype UserOperand = {\n user: string;\n};\n\ntype RecordOperand<Update extends boolean = false> = Update extends true\n ? { oldRecord: string } | { newRecord: string }\n : { record: string };\n\nexport type PermissionOperand<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = UserOperand | ValueOperand | (Level extends \"record\" ? RecordOperand<Update> : never);\n\nexport type StandardPermissionCondition<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = readonly [\n PermissionOperand<Level, Update>,\n StandardPermissionOperator,\n PermissionOperand<Level, Update>,\n];\n\nexport type StandardActionPermission<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = {\n conditions: readonly StandardPermissionCondition<Level, Update>[];\n description?: string;\n permit: \"allow\" | \"deny\";\n};\n\nexport type StandardTailorTypePermission = {\n create: readonly StandardActionPermission<\"record\", false>[];\n read: readonly StandardActionPermission<\"record\", false>[];\n update: readonly StandardActionPermission<\"record\", true>[];\n delete: readonly StandardActionPermission<\"record\", false>[];\n};\n\nexport type StandardGqlPermissionPolicy = {\n conditions: readonly StandardPermissionCondition<\"gql\">[];\n actions: readonly [\"all\"] | readonly GqlPermissionAction[];\n permit: \"allow\" | \"deny\";\n description?: string;\n};\n\nexport type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];\n\nexport interface Permissions {\n record?: StandardTailorTypePermission;\n gql?: StandardTailorTypeGqlPermission;\n}\n\nexport interface TailorDBTypeMetadata {\n name: string;\n description?: string;\n settings?: {\n pluralForm?: string;\n aggregation?: boolean;\n bulkUpsert?: boolean;\n gqlOperations?: GqlOperationsConfig;\n };\n permissions: RawPermissions;\n files: Record<string, string>;\n indexes?: Record<\n string,\n {\n fields: string[];\n unique?: boolean;\n }\n >;\n}\n\n/**\n * Parsed and normalized TailorDB field information\n */\nexport interface ParsedField {\n name: string;\n config: OperatorFieldConfig;\n relation?: {\n targetType: string;\n forwardName: string;\n backwardName: string;\n key: string;\n unique: boolean;\n };\n}\n\n/**\n * Parsed and normalized TailorDB relationship information\n */\nexport interface ParsedRelationship {\n name: string;\n targetType: string;\n targetField: string;\n sourceField: string;\n isArray: boolean;\n description: string;\n}\n\n/**\n * Parsed and normalized TailorDB type information\n */\nexport interface TailorDBType {\n name: string;\n pluralForm: string;\n description?: string;\n fields: Record<string, ParsedField>;\n forwardRelationships: Record<string, ParsedRelationship>;\n backwardRelationships: Record<string, ParsedRelationship>;\n settings: TailorDBTypeParsedSettings;\n permissions: Permissions;\n indexes?: TailorDBTypeMetadata[\"indexes\"];\n files?: TailorDBTypeMetadata[\"files\"];\n}\n"],"mappings":";;;;;;AAmEA,SAAgB,sBACd,QACqC;AACrC,QAAO,OAAO,aAAa"}
1
+ {"version":3,"file":"types-ClK_HJ0G.mjs","names":[],"sources":["../src/parser/service/tailordb/types.ts"],"sourcesContent":["import type { RelationType } from \"./relation\";\nimport type {\n DBFieldMetadataSchema,\n RawRelationConfigSchema,\n RawPermissionsSchema,\n TailorDBTypeSchema,\n TailorDBServiceConfig as TailorDBServiceConfigType,\n TailorDBTypeSettingsSchema,\n} from \"./schema\";\nimport type { GqlOperationsConfig } from \"@/configure/services/tailordb\";\nimport type { ValueOperand } from \"@/parser/service/auth/types\";\nimport type { z } from \"zod\";\n\nexport type { RelationType } from \"./relation\";\nexport type { TypeSourceInfo } from \"./type-parser\";\n\n// ========================================\n// Source info type for TailorDB types\n// ========================================\n\n/**\n * Source information for a user-defined TailorDB type.\n */\nexport interface UserDefinedTypeSource {\n /** File path to import from */\n filePath: string;\n /** Export name in the source file */\n exportName: string;\n /** Not present for user-defined types */\n pluginId?: never;\n}\n\n/**\n * Source information for a plugin-generated TailorDB type.\n */\nexport interface PluginGeneratedTypeSource {\n /** Not present for plugin-generated types */\n filePath?: never;\n /** Export name of the generated type */\n exportName: string;\n /** Plugin ID that generated this type */\n pluginId: string;\n /** Plugin import path for code generators */\n pluginImportPath: string;\n /** Original type's file path */\n originalFilePath: string;\n /** Original type's export name */\n originalExportName: string;\n /** Generated type kind for getGeneratedType() API (e.g., \"request\", \"step\") */\n generatedTypeKind?: string;\n /** Plugin config used to generate this type */\n pluginConfig?: unknown;\n /** Namespace where this type was generated */\n namespace?: string;\n}\n\n/**\n * Source information for a TailorDB type.\n * Discriminated union: use `pluginId` to distinguish between user-defined and plugin-generated types.\n */\nexport type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;\n\n/**\n * Type guard to check if source is plugin-generated\n * @param source - Type source info to check\n * @returns True if source is plugin-generated\n */\nexport function isPluginGeneratedType(\n source: TypeSourceInfoEntry,\n): source is PluginGeneratedTypeSource {\n return source.pluginId !== undefined;\n}\n\nexport type {\n TailorAnyDBField,\n TailorAnyDBType,\n TailorDBField,\n DBFieldMetadata,\n Hook,\n TailorTypePermission,\n TailorTypeGqlPermission,\n GqlOperationsConfig,\n GqlOperations,\n} from \"@/configure/services/tailordb\";\nexport type {\n TailorDBServiceConfigInput,\n TailorDBServiceConfig,\n TailorDBExternalConfig,\n TailorDBServiceInput,\n} from \"./schema\";\n\n/**\n * Parsed and normalized settings for TailorDB type.\n * gqlOperations is normalized from alias to object format.\n * @public\n */\nexport type TailorDBTypeParsedSettings = z.output<typeof TailorDBTypeSettingsSchema>;\n\n/**\n * Migration configuration for TailorDB\n * @public\n */\nexport type TailorDBMigrationConfig = NonNullable<TailorDBServiceConfigType[\"migration\"]>;\n\nexport type TailorDBTypeSchemaOutput = z.output<typeof TailorDBTypeSchema>;\n\nexport type DBFieldMetadataOutput = z.output<typeof DBFieldMetadataSchema>;\nexport type RawRelationConfigOutput = z.output<typeof RawRelationConfigSchema>;\n\nexport type RawPermissions = z.output<typeof RawPermissionsSchema>;\n\nexport type TailorDBFieldOutput = {\n type: string;\n fields?: Record<string, TailorDBFieldOutput>;\n metadata: DBFieldMetadataOutput;\n rawRelation?: RawRelationConfigOutput;\n};\n\nexport interface Script {\n expr: string;\n}\n\nexport interface EnumValue {\n value: string;\n description?: string;\n}\n\ninterface OperatorValidateConfig {\n script: Script;\n errorMessage: string;\n}\n\ninterface OperatorFieldHook {\n create?: Script;\n update?: Script;\n}\n\n/**\n * Raw relation config stored in configure layer, processed in parser layer.\n * This is the serialized form of RelationConfig from schema.ts where\n * the TailorDBType reference is replaced with the type name string.\n */\nexport interface RawRelationConfig {\n type: RelationType;\n toward: {\n type: string;\n as?: string;\n key?: string;\n };\n backward?: string;\n}\n\nexport interface OperatorFieldConfig {\n type: string;\n required?: boolean;\n description?: string;\n allowedValues?: EnumValue[];\n array?: boolean;\n index?: boolean;\n unique?: boolean;\n vector?: boolean;\n foreignKey?: boolean;\n foreignKeyType?: string;\n foreignKeyField?: string;\n rawRelation?: RawRelationConfig;\n validate?: OperatorValidateConfig[];\n hooks?: OperatorFieldHook;\n serial?: {\n start: number;\n maxValue?: number;\n format?: string;\n };\n scale?: number;\n fields?: Record<string, OperatorFieldConfig>;\n}\n\ntype GqlPermissionAction = \"read\" | \"create\" | \"update\" | \"delete\" | \"aggregate\" | \"bulkUpsert\";\n\ntype StandardPermissionOperator = \"eq\" | \"ne\" | \"in\" | \"nin\" | \"hasAny\" | \"nhasAny\";\n\ntype UserOperand = {\n user: string;\n};\n\ntype RecordOperand<Update extends boolean = false> = Update extends true\n ? { oldRecord: string } | { newRecord: string }\n : { record: string };\n\nexport type PermissionOperand<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = UserOperand | ValueOperand | (Level extends \"record\" ? RecordOperand<Update> : never);\n\nexport type StandardPermissionCondition<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = readonly [\n PermissionOperand<Level, Update>,\n StandardPermissionOperator,\n PermissionOperand<Level, Update>,\n];\n\nexport type StandardActionPermission<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = {\n conditions: readonly StandardPermissionCondition<Level, Update>[];\n description?: string;\n permit: \"allow\" | \"deny\";\n};\n\nexport type StandardTailorTypePermission = {\n create: readonly StandardActionPermission<\"record\", false>[];\n read: readonly StandardActionPermission<\"record\", false>[];\n update: readonly StandardActionPermission<\"record\", true>[];\n delete: readonly StandardActionPermission<\"record\", false>[];\n};\n\nexport type StandardGqlPermissionPolicy = {\n conditions: readonly StandardPermissionCondition<\"gql\">[];\n actions: readonly [\"all\"] | readonly GqlPermissionAction[];\n permit: \"allow\" | \"deny\";\n description?: string;\n};\n\nexport type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];\n\nexport interface Permissions {\n record?: StandardTailorTypePermission;\n gql?: StandardTailorTypeGqlPermission;\n}\n\nexport interface TailorDBTypeMetadata {\n name: string;\n description?: string;\n settings?: {\n pluralForm?: string;\n aggregation?: boolean;\n bulkUpsert?: boolean;\n gqlOperations?: GqlOperationsConfig;\n };\n permissions: RawPermissions;\n files: Record<string, string>;\n indexes?: Record<\n string,\n {\n fields: string[];\n unique?: boolean;\n }\n >;\n}\n\n/**\n * Parsed and normalized TailorDB field information\n */\nexport interface ParsedField {\n name: string;\n config: OperatorFieldConfig;\n relation?: {\n targetType: string;\n forwardName: string;\n backwardName: string;\n key: string;\n unique: boolean;\n };\n}\n\n/**\n * Parsed and normalized TailorDB relationship information\n */\nexport interface ParsedRelationship {\n name: string;\n targetType: string;\n targetField: string;\n sourceField: string;\n isArray: boolean;\n description: string;\n}\n\n/**\n * Parsed and normalized TailorDB type information\n */\nexport interface TailorDBType {\n name: string;\n pluralForm: string;\n description?: string;\n fields: Record<string, ParsedField>;\n forwardRelationships: Record<string, ParsedRelationship>;\n backwardRelationships: Record<string, ParsedRelationship>;\n settings: TailorDBTypeParsedSettings;\n permissions: Permissions;\n indexes?: TailorDBTypeMetadata[\"indexes\"];\n files?: TailorDBTypeMetadata[\"files\"];\n}\n"],"mappings":";;;;;;AAmEA,SAAgB,sBACd,QACqC;AACrC,QAAO,OAAO,aAAa"}