@tailor-platform/sdk 1.51.2 → 1.53.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 (141) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/dist/{actor-Nag62ZDM.d.mts → actor-DwAh0Dij.d.mts} +3 -8
  3. package/dist/application-Cmz1Y7X_.mjs +4 -0
  4. package/dist/{application-Z-fNwyZB.mjs → application-DF74unzA.mjs} +11 -11
  5. package/dist/{application-Z-fNwyZB.mjs.map → application-DF74unzA.mjs.map} +1 -1
  6. package/dist/{authconnection-BUko4V6H.mjs → authconnection-D8SJGMpj.mjs} +2 -2
  7. package/dist/{authconnection-BUko4V6H.mjs.map → authconnection-D8SJGMpj.mjs.map} +1 -1
  8. package/dist/{authconnection-BDFTabLQ.d.mts → authconnection-TsdLYaLs.d.mts} +1 -1
  9. package/dist/{brand-Ll48SMXe.mjs → brand-DlnJ375c.mjs} +1 -1
  10. package/dist/{brand-Ll48SMXe.mjs.map → brand-DlnJ375c.mjs.map} +1 -1
  11. package/dist/cli/index.d.mts +1 -3
  12. package/dist/cli/index.mjs +16 -16
  13. package/dist/cli/lib.d.mts +8 -9
  14. package/dist/cli/lib.mjs +8 -8
  15. package/dist/cli/skills.mjs +1 -1
  16. package/dist/client-CGO7gniI.mjs +1061 -0
  17. package/dist/{client-BwV17byk.mjs.map → client-CGO7gniI.mjs.map} +1 -1
  18. package/dist/{client-D_a50aIg.mjs → client-yfFdZU9s.mjs} +1 -1
  19. package/dist/configure/index.d.mts +5 -5
  20. package/dist/configure/index.mjs +4 -4
  21. package/dist/{context-BXDgEQK9.d.mts → context-CUBwSBq4.d.mts} +1 -1
  22. package/dist/{context-BP5BUdcq.mjs → context-s0lxhu8_.mjs} +2 -2
  23. package/dist/{context-BP5BUdcq.mjs.map → context-s0lxhu8_.mjs.map} +1 -1
  24. package/dist/{crashreport-DauPOrKn.mjs → crashreport-DGdAgX8Y.mjs} +5 -5
  25. package/dist/{crashreport-DauPOrKn.mjs.map → crashreport-DGdAgX8Y.mjs.map} +1 -1
  26. package/dist/{crashreport-C4EbRoku.mjs → crashreport-DnwIxpzF.mjs} +1 -1
  27. package/dist/{enum-constants-DI85-fPE.mjs → enum-constants-C7DaWeQo.mjs} +1 -1
  28. package/dist/{enum-constants-DI85-fPE.mjs.map → enum-constants-C7DaWeQo.mjs.map} +1 -1
  29. package/dist/env-B-g-qgE4.d.mts +7 -0
  30. package/dist/{errors-C4cJ0M2K.mjs → errors-EsY4XO6O.mjs} +1 -1
  31. package/dist/{errors-C4cJ0M2K.mjs.map → errors-EsY4XO6O.mjs.map} +1 -1
  32. package/dist/{field-BY2vbJ8f.mjs → field-C4zdJLW5.mjs} +1 -1
  33. package/dist/{field-BY2vbJ8f.mjs.map → field-C4zdJLW5.mjs.map} +1 -1
  34. package/dist/{file-BE5Sy7lP.mjs → file-B58Dm-2P.mjs} +19 -4
  35. package/dist/file-B58Dm-2P.mjs.map +1 -0
  36. package/dist/{file-Dc4_QrlQ.d.mts → file-VTJbbOL3.d.mts} +49 -5
  37. package/dist/{file-utils-BM8t5jCy.mjs → file-utils-BHPxPXmn.mjs} +2 -2
  38. package/dist/{file-utils-BM8t5jCy.mjs.map → file-utils-BHPxPXmn.mjs.map} +1 -1
  39. package/dist/{iconv-BFNfdlIS.d.mts → iconv-Chu6Hit2.d.mts} +1 -1
  40. package/dist/{iconv-D0yL88Il.mjs → iconv-DreIffeM.mjs} +2 -2
  41. package/dist/{iconv-D0yL88Il.mjs.map → iconv-DreIffeM.mjs.map} +1 -1
  42. package/dist/{idp-B1b4O7ia.d.mts → idp-CbxR6A_0.d.mts} +1 -1
  43. package/dist/{idp-CM7N7iID.mjs → idp-Ch95ag8h.mjs} +2 -2
  44. package/dist/{idp-CM7N7iID.mjs.map → idp-Ch95ag8h.mjs.map} +1 -1
  45. package/dist/{index-CYAZkd4b.d.mts → index-BCJtNXKo.d.mts} +2 -2
  46. package/dist/{index-aiIbrFGw.d.mts → index-BIbKrme4.d.mts} +2 -2
  47. package/dist/{index-BXwAT_oE.d.mts → index-BL5LQnBX.d.mts} +2 -2
  48. package/dist/{index-CfSjuxzK.d.mts → index-DW6gAGmC.d.mts} +2 -2
  49. package/dist/{index-Dy3ZH5Wm.d.mts → index-ECerapTN.d.mts} +8 -8
  50. package/dist/{index-BD99GoHO.d.mts → index-UySZfxON.d.mts} +8 -6
  51. package/dist/{interceptor-Cr3kZWMc.mjs → interceptor-DOqRkCya.mjs} +1 -1
  52. package/dist/{interceptor-Cr3kZWMc.mjs.map → interceptor-DOqRkCya.mjs.map} +1 -1
  53. package/dist/{job-4GOnasfT.mjs → job-CEAJLiGp.mjs} +8 -5
  54. package/dist/job-CEAJLiGp.mjs.map +1 -0
  55. package/dist/kysely/index.mjs.map +1 -1
  56. package/dist/{kysely-type-BUoVDC5r.mjs → kysely-type-D1e0Vwkd.mjs} +2 -2
  57. package/dist/{kysely-type-BUoVDC5r.mjs.map → kysely-type-D1e0Vwkd.mjs.map} +1 -1
  58. package/dist/{logger-B1g4I9wT.mjs → logger-DpJyJvNz.mjs} +1 -1
  59. package/dist/{logger-B1g4I9wT.mjs.map → logger-DpJyJvNz.mjs.map} +1 -1
  60. package/dist/{mock-B2t5gDMl.mjs → mock-B6PI49C_.mjs} +44 -2
  61. package/dist/mock-B6PI49C_.mjs.map +1 -0
  62. package/dist/{multiline-G1yF18OH.mjs → multiline-Cf9ODpr1.mjs} +1 -1
  63. package/dist/{multiline-G1yF18OH.mjs.map → multiline-Cf9ODpr1.mjs.map} +1 -1
  64. package/dist/{package-json-ZL0MkZOO.mjs → package-json-DcQApfPQ.mjs} +1 -1
  65. package/dist/{package-json-ZL0MkZOO.mjs.map → package-json-DcQApfPQ.mjs.map} +1 -1
  66. package/dist/package-json-wzO6nV9O.mjs +4 -0
  67. package/dist/plugin/builtin/enum-constants/index.d.mts +1 -1
  68. package/dist/plugin/builtin/enum-constants/index.mjs +1 -1
  69. package/dist/plugin/builtin/file-utils/index.d.mts +1 -1
  70. package/dist/plugin/builtin/file-utils/index.mjs +1 -1
  71. package/dist/plugin/builtin/kysely-type/index.d.mts +1 -1
  72. package/dist/plugin/builtin/kysely-type/index.mjs +1 -1
  73. package/dist/plugin/builtin/seed/index.d.mts +1 -1
  74. package/dist/plugin/builtin/seed/index.mjs +1 -1
  75. package/dist/plugin/index.d.mts +3 -2
  76. package/dist/{repl-editor-yAjwS5_M.mjs → repl-editor-ihh8koiR.mjs} +1 -1
  77. package/dist/{repl-editor-yAjwS5_M.mjs.map → repl-editor-ihh8koiR.mjs.map} +1 -1
  78. package/dist/runtime/authconnection.d.mts +1 -1
  79. package/dist/runtime/authconnection.mjs +1 -1
  80. package/dist/runtime/context.d.mts +1 -1
  81. package/dist/runtime/context.mjs +1 -1
  82. package/dist/runtime/file.d.mts +2 -2
  83. package/dist/runtime/file.mjs +2 -2
  84. package/dist/runtime/globals.d.mts +6 -6
  85. package/dist/runtime/iconv.d.mts +1 -1
  86. package/dist/runtime/iconv.mjs +1 -1
  87. package/dist/runtime/idp.d.mts +1 -1
  88. package/dist/runtime/idp.mjs +1 -1
  89. package/dist/runtime/index.d.mts +8 -8
  90. package/dist/runtime/index.mjs +7 -7
  91. package/dist/runtime/secretmanager.d.mts +1 -1
  92. package/dist/runtime/secretmanager.mjs +1 -1
  93. package/dist/runtime/workflow.d.mts +1 -1
  94. package/dist/runtime/workflow.mjs +1 -1
  95. package/dist/{runtime-1NlbDNN0.mjs → runtime-D-3AE1x-.mjs} +264 -42
  96. package/dist/runtime-D-3AE1x-.mjs.map +1 -0
  97. package/dist/{schema-DBq6hr6h.mjs → schema-CQrYG_55.mjs} +3 -3
  98. package/dist/{schema-DBq6hr6h.mjs.map → schema-CQrYG_55.mjs.map} +1 -1
  99. package/dist/{secret-file-DnbmTWec.mjs → secret-file-CWzF8rry.mjs} +1 -1
  100. package/dist/{secret-file-DnbmTWec.mjs.map → secret-file-CWzF8rry.mjs.map} +1 -1
  101. package/dist/{secretmanager-CQTTuCmn.mjs → secretmanager-B9h-U_8U.mjs} +2 -2
  102. package/dist/{secretmanager-CQTTuCmn.mjs.map → secretmanager-B9h-U_8U.mjs.map} +1 -1
  103. package/dist/{secretmanager-Cjq3s2aU.d.mts → secretmanager-BhpDmxwT.d.mts} +1 -1
  104. package/dist/{seed-kNk-xLoB.mjs → seed-DfLyRh63.mjs} +2 -2
  105. package/dist/{seed-kNk-xLoB.mjs.map → seed-DfLyRh63.mjs.map} +1 -1
  106. package/dist/{service-DHgJ4YEF.mjs → service-aPT0fx3y.mjs} +3 -3
  107. package/dist/{service-DHgJ4YEF.mjs.map → service-aPT0fx3y.mjs.map} +1 -1
  108. package/dist/{tailor-db-field-BhWvOyky.d.mts → tailor-db-field-Y_zEoGu1.d.mts} +1 -1
  109. package/dist/{telemetry-C8xKz3GM.mjs → telemetry-BQbbVo2t.mjs} +2 -2
  110. package/dist/{telemetry-C8xKz3GM.mjs.map → telemetry-BQbbVo2t.mjs.map} +1 -1
  111. package/dist/telemetry-w92bvGdC.mjs +4 -0
  112. package/dist/test-env-key-CSnK4W1Y.mjs +30 -0
  113. package/dist/test-env-key-CSnK4W1Y.mjs.map +1 -0
  114. package/dist/{types-Duhhsx3R.mjs → types-BinLwXM9.mjs} +2 -2
  115. package/dist/{types-Duhhsx3R.mjs.map → types-BinLwXM9.mjs.map} +1 -1
  116. package/dist/types-UeXbHFXW.mjs +5 -0
  117. package/dist/utils/test/index.d.mts +3 -3
  118. package/dist/utils/test/index.mjs +1 -1
  119. package/dist/vitest/environment.mjs +1 -1
  120. package/dist/vitest/index.d.mts +7 -7
  121. package/dist/vitest/index.mjs +1 -1
  122. package/dist/vitest/setup.mjs +1 -1
  123. package/dist/{workflow-DJRr-0nl.mjs → workflow--aPbA8Uq.mjs} +2 -2
  124. package/dist/{workflow-DJRr-0nl.mjs.map → workflow--aPbA8Uq.mjs.map} +1 -1
  125. package/dist/{workflow-DV_88JEf.d.mts → workflow-dYYH7QFa.d.mts} +1 -1
  126. package/dist/{workflow.generated-DV87DJfO.d.mts → workflow.generated-BIY41La-.d.mts} +2 -2
  127. package/docs/cli/application.md +15 -6
  128. package/docs/cli/completion.md +5 -3
  129. package/docs/runtime.md +1 -1
  130. package/docs/testing.md +34 -14
  131. package/package.json +14 -14
  132. package/dist/application-Bcx-FbDE.mjs +0 -4
  133. package/dist/client-BwV17byk.mjs +0 -1061
  134. package/dist/file-BE5Sy7lP.mjs.map +0 -1
  135. package/dist/job-4GOnasfT.mjs.map +0 -1
  136. package/dist/mock-B2t5gDMl.mjs.map +0 -1
  137. package/dist/package-json-CAGKAJff.mjs +0 -4
  138. package/dist/runtime-1NlbDNN0.mjs.map +0 -1
  139. package/dist/telemetry-DQl47E1s.mjs +0 -4
  140. package/dist/types-BnphjkIJ.mjs +0 -5
  141. /package/dist/{chunk-DLeslSnM.mjs → chunk-BkoGK1jX.mjs} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"types-Duhhsx3R.mjs","names":[],"sources":["../src/configure/types/type.ts"],"sourcesContent":["import { type AllowedValues, type AllowedValuesOutput, mapAllowedValues } from \"./field\";\nimport type {\n DefinedFieldMetadata,\n TailorFieldType,\n TailorToTs,\n FieldMetadata,\n FieldOptions,\n FieldOutput,\n} from \"@/types/field-types\";\nimport type { InferFieldsOutput, Prettify } from \"@/types/helpers\";\nimport type { TailorField as TailorFieldBase } from \"@/types/tailor-field\";\nimport type { TailorUser } from \"@/types/user\";\nimport type { FieldValidateInput } from \"@/types/validation\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n// This helper type intentionally uses `any` as a placeholder for unknown field output.\n// oxlint-disable-next-line no-explicit-any\nexport type TailorAnyField = TailorField<any>;\n\n/**\n * Full TailorField interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorField<\n Defined extends DefinedFieldMetadata = DefinedFieldMetadata,\n // Generic default output type (kept loose on purpose for library ergonomics).\n // oxlint-disable-next-line no-explicit-any\n Output = any,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> extends TailorFieldBase<Defined, Output, M, T> {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n\n /**\n * Set a description for the field\n * @param description - The description text\n * @returns The field with updated metadata\n */\n description<CurrentDefined extends Defined>(\n this: CurrentDefined extends { description: unknown }\n ? never\n : TailorField<CurrentDefined, Output>,\n description: string,\n ): TailorField<Prettify<CurrentDefined & { description: true }>, Output>;\n\n /**\n * Set a custom type name for enum or nested types\n * @param typeName - The custom type name\n * @returns The field with updated metadata\n */\n typeName<CurrentDefined extends Defined>(\n this: CurrentDefined extends { typeName: unknown }\n ? never\n : CurrentDefined extends { type: \"enum\" | \"nested\" }\n ? TailorField<CurrentDefined, Output>\n : never,\n typeName: string,\n ): TailorField<Prettify<CurrentDefined & { typeName: true }>, Output>;\n\n /**\n * Add validation functions to the field\n * @param validate - One or more validation functions\n * @returns The field with updated metadata\n */\n validate<CurrentDefined extends Defined>(\n this: CurrentDefined extends { validate: unknown }\n ? never\n : TailorField<CurrentDefined, Output>,\n ...validate: FieldValidateInput<Output>[]\n ): TailorField<Prettify<CurrentDefined & { validate: true }>, Output>;\n\n /**\n * Parse and validate a value against this field's validation rules\n * Returns StandardSchema Result type with success or failure\n * @param args - Value, context data, and user\n * @returns Validation result\n */\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n\n /**\n * Internal parse method that tracks field path for nested validation\n * @private\n * @param args - Parse arguments\n * @returns Validation result\n */\n _parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<Output>;\n}\n\nconst regex = {\n uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n date: /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/,\n time: /^(?<hour>\\d{2}):(?<minute>\\d{2})$/,\n datetime:\n /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})T(?<hour>\\d{2}):(?<minute>\\d{2}):(?<second>\\d{2})(.(?<millisec>\\d{3}))?Z$/,\n decimal: /^-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/,\n} as const;\n\ntype FieldParseArgs = {\n value: unknown;\n data: unknown;\n user: TailorUser;\n};\n\ntype FieldValidateValueArgs<T extends TailorFieldType> = {\n value: TailorToTs[T];\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n};\n\ntype FieldParseInternalArgs = {\n // Runtime input is unknown/untyped; we validate and narrow it inside the parser.\n // oxlint-disable-next-line no-explicit-any\n value: any;\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n};\n\n/**\n * Creates a new TailorField instance.\n * @param type - Field type\n * @param options - Field options\n * @param fields - Nested fields for object-like types\n * @param values - Allowed values for enum-like fields\n * @returns A new TailorField\n */\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n): TailorField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n> {\n const _metadata: FieldMetadata = { required: true };\n\n if (options) {\n if (options.optional === true) {\n _metadata.required = false;\n }\n if (options.array === true) {\n _metadata.array = true;\n }\n }\n if (values) {\n _metadata.allowedValues = mapAllowedValues(values);\n }\n\n /**\n * Validate a single value (not an array element)\n * Used internally for array element validation\n * @param args - Value, context data, and user\n * @returns Array of validation issues\n */\n function validateValue(args: FieldValidateValueArgs<T>): StandardSchemaV1.Issue[] {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n\n // Type-specific validation\n switch (type) {\n case \"string\":\n if (typeof value !== \"string\") {\n issues.push({\n message: `Expected a string: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"integer\":\n if (typeof value !== \"number\" || !Number.isInteger(value)) {\n issues.push({\n message: `Expected an integer: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"float\":\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n issues.push({\n message: `Expected a number: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"boolean\":\n if (typeof value !== \"boolean\") {\n issues.push({\n message: `Expected a boolean: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"uuid\":\n if (typeof value !== \"string\" || !regex.uuid.test(value)) {\n issues.push({\n message: `Expected a valid UUID: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"date\":\n if (typeof value !== \"string\" || !regex.date.test(value)) {\n issues.push({\n message: `Expected to match \"yyyy-MM-dd\" format: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"datetime\":\n if (typeof value !== \"string\" || !regex.datetime.test(value)) {\n issues.push({\n message: `Expected to match ISO format: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"time\":\n if (typeof value !== \"string\" || !regex.time.test(value)) {\n issues.push({\n message: `Expected to match \"HH:mm\" format: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"decimal\":\n if (typeof value !== \"string\" || !regex.decimal.test(value)) {\n issues.push({\n message: `Expected a decimal string: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"enum\":\n if (field._metadata.allowedValues) {\n const allowedValues = field._metadata.allowedValues.map((v) => v.value);\n if (typeof value !== \"string\" || !allowedValues.includes(value)) {\n issues.push({\n message: `Must be one of [${allowedValues.join(\", \")}]: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n }\n break;\n\n case \"nested\":\n // Validate nested object fields\n if (\n typeof value !== \"object\" ||\n value === null ||\n Array.isArray(value) ||\n value instanceof Date\n ) {\n issues.push({\n message: `Expected an object: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n } else if (field.fields && Object.keys(field.fields).length > 0) {\n for (const [fieldName, nestedField] of Object.entries(field.fields)) {\n const fieldValue = value?.[fieldName];\n const result = nestedField._parseInternal({\n value: fieldValue,\n data,\n user,\n pathArray: pathArray.concat(fieldName),\n });\n if (result.issues) {\n issues.push(...result.issues);\n }\n }\n }\n break;\n }\n\n // Custom validation functions\n const validateFns = field._metadata.validate;\n if (validateFns && validateFns.length > 0) {\n for (const validateInput of validateFns) {\n const { fn, message } =\n typeof validateInput === \"function\"\n ? { fn: validateInput, message: \"Validation failed\" }\n : { fn: validateInput[0], message: validateInput[1] };\n\n if (!fn({ value, data, user })) {\n issues.push({\n message,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n }\n }\n\n return issues;\n }\n\n /**\n * Internal parse method that tracks field path for nested validation\n * @param args - Parse arguments\n * @returns Parse result with value or issues\n */\n function parseInternal(\n args: FieldParseInternalArgs,\n ): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n\n // 1. Check required/optional\n const isNullOrUndefined = value === null || value === undefined;\n if (field._metadata.required && isNullOrUndefined) {\n issues.push({\n message: \"Required field is missing\",\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n return { issues };\n }\n\n // If optional and null/undefined, skip further validation and normalize to null\n if (!field._metadata.required && isNullOrUndefined) {\n return { value: value ?? null };\n }\n\n // 2. Check array type\n if (field._metadata.array) {\n if (!Array.isArray(value)) {\n issues.push({\n message: \"Expected an array\",\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n return { issues };\n }\n\n // Validate each array element (without array flag)\n for (let i = 0; i < value.length; i++) {\n const elementValue = value[i];\n const elementPath = pathArray.concat(`[${i}]`);\n\n // Validate element with same type but without array flag\n const elementIssues = validateValue({\n value: elementValue,\n data,\n user,\n pathArray: elementPath,\n });\n if (elementIssues.length > 0) {\n issues.push(...elementIssues);\n }\n }\n\n if (issues.length > 0) {\n return { issues };\n }\n return { value: value as FieldOutput<OutputBase, TOptions> };\n }\n\n // 3. Type-specific validation and custom validation\n const valueIssues = validateValue({ value, data, user, pathArray });\n issues.push(...valueIssues);\n\n if (issues.length > 0) {\n return { issues };\n }\n\n return { value };\n }\n\n const field: TailorField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n > = {\n type,\n fields: fields ?? {},\n _defined: undefined as unknown as {\n type: T;\n array: TOptions extends { array: true } ? true : false;\n },\n _output: undefined as FieldOutput<OutputBase, TOptions>,\n _metadata,\n\n get metadata() {\n return { ...this._metadata };\n },\n\n description(description: string) {\n this._metadata.description = description;\n // Fluent API returns this with updated type\n // oxlint-disable-next-line no-explicit-any\n return this as any;\n },\n\n typeName(typeName: string) {\n this._metadata.typeName = typeName;\n // Fluent API returns this with updated type\n // oxlint-disable-next-line no-explicit-any\n return this as any;\n },\n\n validate(...validateInputs: FieldValidateInput<FieldOutput<OutputBase, TOptions>>[]) {\n this._metadata.validate = validateInputs;\n // Fluent API returns this with updated type\n // oxlint-disable-next-line no-explicit-any\n return this as any;\n },\n\n parse(args: FieldParseArgs): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n return parseInternal({\n value: args.value,\n data: args.data,\n user: args.user,\n pathArray: [],\n });\n },\n\n _parseInternal: parseInternal,\n };\n\n return field;\n}\n\n/**\n * Create a UUID field for resolver input/output.\n * @param options - Field configuration options\n * @returns A UUID field\n * @example t.uuid()\n */\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"uuid\", options);\n}\n\n/**\n * Create a string field for resolver input/output.\n * @param options - Field configuration options\n * @returns A string field\n * @example t.string()\n * @example t.string({ optional: true })\n * @example t.string({ array: true })\n */\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"string\", options);\n}\n\n/**\n * Create a boolean field for resolver input/output.\n * @param options - Field configuration options\n * @returns A boolean field\n * @example t.bool()\n */\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"boolean\", options);\n}\n\n/**\n * Create an integer field for resolver input/output.\n * @param options - Field configuration options\n * @returns An integer field\n * @example t.int()\n */\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"integer\", options);\n}\n\n/**\n * Create a float field for resolver input/output.\n * @param options - Field configuration options\n * @returns A float field\n * @example t.float()\n */\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"float\", options);\n}\n\n/**\n * Create a decimal field for resolver input/output (stored as string for precision).\n * @param options - Field configuration options\n * @returns A decimal field\n * @example t.decimal()\n * @example t.decimal({ optional: true })\n */\nfunction decimal<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"decimal\", options);\n}\n\n/**\n * Create a date field for resolver input/output.\n * @param options - Field configuration options\n * @returns A date field\n * @example t.date()\n */\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"date\", options);\n}\n\n/**\n * Create a datetime field for resolver input/output.\n * @param options - Field configuration options\n * @returns A datetime field\n * @example t.datetime()\n */\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"datetime\", options);\n}\n\n/**\n * Create a time field for resolver input/output.\n * @param options - Field configuration options\n * @returns A time field\n * @example t.time()\n */\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"time\", options);\n}\n\n/**\n * Create an enum field for resolver input/output.\n * @param values - Array of allowed string values\n * @param options - Field configuration options\n * @returns An enum field\n * @example t.enum([\"active\", \"inactive\"])\n */\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createTailorField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\n/**\n * Create a nested object field for resolver input/output.\n * @param fields - Record of field definitions\n * @param options - Field options (optional, array)\n * @returns A nested object field\n * @example\n * // Single object:\n * output: t.object({ name: t.string(), email: t.string() })\n * @example\n * // Array of objects:\n * items: t.object({ name: t.string() }, { array: true })\n */\nfunction object<const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(\n fields: F,\n options?: Opt,\n) {\n const objectField = createTailorField(\"nested\", options, fields) as TailorField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutput<F>, Opt>\n >;\n return objectField;\n}\n\nexport const t = {\n uuid,\n string,\n bool,\n int,\n float,\n decimal,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n};\n"],"mappings":";;;;AAyFA,MAAM,QAAQ;CACZ,MAAM;CACN,MAAM;CACN,MAAM;CACN,UACE;CACF,SAAS;AACX;;;;;;;;;AAgCA,SAAS,kBAKP,MACA,SACA,QACA,QAIA;CACA,MAAM,YAA2B,EAAE,UAAU,KAAK;CAElD,IAAI,SAAS;EACX,IAAI,QAAQ,aAAa,MACvB,UAAU,WAAW;EAEvB,IAAI,QAAQ,UAAU,MACpB,UAAU,QAAQ;CAEtB;CACA,IAAI,QACF,UAAU,gBAAgB,iBAAiB,MAAM;;;;;;;CASnD,SAAS,cAAc,MAA2D;EAChF,MAAM,EAAE,OAAO,MAAM,MAAM,cAAc;EACzC,MAAM,SAAmC,CAAC;EAG1C,QAAQ,MAAR;GACE,KAAK;IACH,IAAI,OAAO,UAAU,UACnB,OAAO,KAAK;KACV,SAAS,+BAA+B,OAAO,KAAK;KACpD,MAAM,UAAU,SAAS,IAAI,YAAY;IAC3C,CAAC;IAEH;GAEF,KAAK;IACH,IAAI,OAAO,UAAU,YAAY,CAAC,OAAO,UAAU,KAAK,GACtD,OAAO,KAAK;KACV,SAAS,iCAAiC,OAAO,KAAK;KACtD,MAAM,UAAU,SAAS,IAAI,YAAY;IAC3C,CAAC;IAEH;GAEF,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AAW;GAG1B,OAAO;EACT;EAEA,MAAM,MAAkF;GACtF,OAAO,cAAc;IACnB,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,MAAM,KAAK;IACX,WAAW,CAAC;GACd,CAAC;EACH;EAEA,gBAAgB;CAClB;CAEA,OAAO;AACT;;;;;;;AAQA,SAAS,KAAqC,SAAe;CAC3D,OAAO,kBAAkB,QAAQ,OAAO;AAC1C;;;;;;;;;AAUA,SAAS,OAAuC,SAAe;CAC7D,OAAO,kBAAkB,UAAU,OAAO;AAC5C;;;;;;;AAQA,SAAS,KAAqC,SAAe;CAC3D,OAAO,kBAAkB,WAAW,OAAO;AAC7C;;;;;;;AAQA,SAAS,IAAoC,SAAe;CAC1D,OAAO,kBAAkB,WAAW,OAAO;AAC7C;;;;;;;AAQA,SAAS,MAAsC,SAAe;CAC5D,OAAO,kBAAkB,SAAS,OAAO;AAC3C;;;;;;;;AASA,SAAS,QAAwC,SAAe;CAC9D,OAAO,kBAAkB,WAAW,OAAO;AAC7C;;;;;;;AAQA,SAAS,KAAqC,SAAe;CAC3D,OAAO,kBAAkB,QAAQ,OAAO;AAC1C;;;;;;;AAQA,SAAS,SAAyC,SAAe;CAC/D,OAAO,kBAAkB,YAAY,OAAO;AAC9C;;;;;;;AAQA,SAAS,KAAqC,SAAe;CAC3D,OAAO,kBAAkB,QAAQ,OAAO;AAC1C;;;;;;;;AASA,SAAS,MACP,QACA,SAIA;CACA,OAAO,kBAAuD,QAAQ,SAAS,QAAW,MAAM;AAClG;;;;;;;;;;;;;AAcA,SAAS,OACP,QACA,SACA;CAKA,OAJoB,kBAAkB,UAAU,SAAS,MAIxC;AACnB;AAEA,MAAa,IAAI;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,MAAM;CACN;AACF"}
1
+ {"version":3,"file":"types-BinLwXM9.mjs","names":[],"sources":["../src/configure/types/type.ts"],"sourcesContent":["import { type AllowedValues, type AllowedValuesOutput, mapAllowedValues } from \"./field\";\nimport type {\n DefinedFieldMetadata,\n TailorFieldType,\n TailorToTs,\n FieldMetadata,\n FieldOptions,\n FieldOutput,\n} from \"@/types/field-types\";\nimport type { InferFieldsOutput, Prettify } from \"@/types/helpers\";\nimport type { TailorField as TailorFieldBase } from \"@/types/tailor-field\";\nimport type { TailorUser } from \"@/types/user\";\nimport type { FieldValidateInput } from \"@/types/validation\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\n// This helper type intentionally uses `any` as a placeholder for unknown field output.\n// oxlint-disable-next-line no-explicit-any\nexport type TailorAnyField = TailorField<any>;\n\n/**\n * Full TailorField interface with builder methods.\n * Extends the minimal structural interface from types/ with fluent API methods.\n */\nexport interface TailorField<\n Defined extends DefinedFieldMetadata = DefinedFieldMetadata,\n // Generic default output type (kept loose on purpose for library ergonomics).\n // oxlint-disable-next-line no-explicit-any\n Output = any,\n M extends FieldMetadata = FieldMetadata,\n T extends TailorFieldType = TailorFieldType,\n> extends TailorFieldBase<Defined, Output, M, T> {\n readonly fields: Record<string, TailorAnyField>;\n _metadata: M;\n\n /**\n * Set a description for the field\n * @param description - The description text\n * @returns The field with updated metadata\n */\n description<CurrentDefined extends Defined>(\n this: CurrentDefined extends { description: unknown }\n ? never\n : TailorField<CurrentDefined, Output>,\n description: string,\n ): TailorField<Prettify<CurrentDefined & { description: true }>, Output>;\n\n /**\n * Set a custom type name for enum or nested types\n * @param typeName - The custom type name\n * @returns The field with updated metadata\n */\n typeName<CurrentDefined extends Defined>(\n this: CurrentDefined extends { typeName: unknown }\n ? never\n : CurrentDefined extends { type: \"enum\" | \"nested\" }\n ? TailorField<CurrentDefined, Output>\n : never,\n typeName: string,\n ): TailorField<Prettify<CurrentDefined & { typeName: true }>, Output>;\n\n /**\n * Add validation functions to the field\n * @param validate - One or more validation functions\n * @returns The field with updated metadata\n */\n validate<CurrentDefined extends Defined>(\n this: CurrentDefined extends { validate: unknown }\n ? never\n : TailorField<CurrentDefined, Output>,\n ...validate: FieldValidateInput<Output>[]\n ): TailorField<Prettify<CurrentDefined & { validate: true }>, Output>;\n\n /**\n * Parse and validate a value against this field's validation rules\n * Returns StandardSchema Result type with success or failure\n * @param args - Value, context data, and user\n * @returns Validation result\n */\n parse(args: FieldParseArgs): StandardSchemaV1.Result<Output>;\n\n /**\n * Internal parse method that tracks field path for nested validation\n * @private\n * @param args - Parse arguments\n * @returns Validation result\n */\n _parseInternal(args: FieldParseInternalArgs): StandardSchemaV1.Result<Output>;\n}\n\nconst regex = {\n uuid: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n date: /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})$/,\n time: /^(?<hour>\\d{2}):(?<minute>\\d{2})$/,\n datetime:\n /^(?<year>\\d{4})-(?<month>\\d{2})-(?<day>\\d{2})T(?<hour>\\d{2}):(?<minute>\\d{2}):(?<second>\\d{2})(.(?<millisec>\\d{3}))?Z$/,\n decimal: /^-?(\\d+\\.?\\d*|\\.\\d+)([eE][+-]?\\d+)?$/,\n} as const;\n\ntype FieldParseArgs = {\n value: unknown;\n data: unknown;\n user: TailorUser;\n};\n\ntype FieldValidateValueArgs<T extends TailorFieldType> = {\n value: TailorToTs[T];\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n};\n\ntype FieldParseInternalArgs = {\n // Runtime input is unknown/untyped; we validate and narrow it inside the parser.\n // oxlint-disable-next-line no-explicit-any\n value: any;\n data: unknown;\n user: TailorUser;\n pathArray: string[];\n};\n\n/**\n * Creates a new TailorField instance.\n * @param type - Field type\n * @param options - Field options\n * @param fields - Nested fields for object-like types\n * @param values - Allowed values for enum-like fields\n * @returns A new TailorField\n */\nfunction createTailorField<\n const T extends TailorFieldType,\n const TOptions extends FieldOptions,\n const OutputBase = TailorToTs[T],\n>(\n type: T,\n options?: TOptions,\n fields?: Record<string, TailorAnyField>,\n values?: AllowedValues,\n): TailorField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n> {\n const _metadata: FieldMetadata = { required: true };\n\n if (options) {\n if (options.optional === true) {\n _metadata.required = false;\n }\n if (options.array === true) {\n _metadata.array = true;\n }\n }\n if (values) {\n _metadata.allowedValues = mapAllowedValues(values);\n }\n\n /**\n * Validate a single value (not an array element)\n * Used internally for array element validation\n * @param args - Value, context data, and user\n * @returns Array of validation issues\n */\n function validateValue(args: FieldValidateValueArgs<T>): StandardSchemaV1.Issue[] {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n\n // Type-specific validation\n switch (type) {\n case \"string\":\n if (typeof value !== \"string\") {\n issues.push({\n message: `Expected a string: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"integer\":\n if (typeof value !== \"number\" || !Number.isInteger(value)) {\n issues.push({\n message: `Expected an integer: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"float\":\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n issues.push({\n message: `Expected a number: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"boolean\":\n if (typeof value !== \"boolean\") {\n issues.push({\n message: `Expected a boolean: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"uuid\":\n if (typeof value !== \"string\" || !regex.uuid.test(value)) {\n issues.push({\n message: `Expected a valid UUID: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"date\":\n if (typeof value !== \"string\" || !regex.date.test(value)) {\n issues.push({\n message: `Expected to match \"yyyy-MM-dd\" format: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"datetime\":\n if (typeof value !== \"string\" || !regex.datetime.test(value)) {\n issues.push({\n message: `Expected to match ISO format: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"time\":\n if (typeof value !== \"string\" || !regex.time.test(value)) {\n issues.push({\n message: `Expected to match \"HH:mm\" format: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n case \"decimal\":\n if (typeof value !== \"string\" || !regex.decimal.test(value)) {\n issues.push({\n message: `Expected a decimal string: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n break;\n\n case \"enum\":\n if (field._metadata.allowedValues) {\n const allowedValues = field._metadata.allowedValues.map((v) => v.value);\n if (typeof value !== \"string\" || !allowedValues.includes(value)) {\n issues.push({\n message: `Must be one of [${allowedValues.join(\", \")}]: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n }\n break;\n\n case \"nested\":\n // Validate nested object fields\n if (\n typeof value !== \"object\" ||\n value === null ||\n Array.isArray(value) ||\n value instanceof Date\n ) {\n issues.push({\n message: `Expected an object: received ${String(value)}`,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n } else if (field.fields && Object.keys(field.fields).length > 0) {\n for (const [fieldName, nestedField] of Object.entries(field.fields)) {\n const fieldValue = value?.[fieldName];\n const result = nestedField._parseInternal({\n value: fieldValue,\n data,\n user,\n pathArray: pathArray.concat(fieldName),\n });\n if (result.issues) {\n issues.push(...result.issues);\n }\n }\n }\n break;\n }\n\n // Custom validation functions\n const validateFns = field._metadata.validate;\n if (validateFns && validateFns.length > 0) {\n for (const validateInput of validateFns) {\n const { fn, message } =\n typeof validateInput === \"function\"\n ? { fn: validateInput, message: \"Validation failed\" }\n : { fn: validateInput[0], message: validateInput[1] };\n\n if (!fn({ value, data, user })) {\n issues.push({\n message,\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n }\n }\n }\n\n return issues;\n }\n\n /**\n * Internal parse method that tracks field path for nested validation\n * @param args - Parse arguments\n * @returns Parse result with value or issues\n */\n function parseInternal(\n args: FieldParseInternalArgs,\n ): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n const { value, data, user, pathArray } = args;\n const issues: StandardSchemaV1.Issue[] = [];\n\n // 1. Check required/optional\n const isNullOrUndefined = value === null || value === undefined;\n if (field._metadata.required && isNullOrUndefined) {\n issues.push({\n message: \"Required field is missing\",\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n return { issues };\n }\n\n // If optional and null/undefined, skip further validation and normalize to null\n if (!field._metadata.required && isNullOrUndefined) {\n return { value: value ?? null };\n }\n\n // 2. Check array type\n if (field._metadata.array) {\n if (!Array.isArray(value)) {\n issues.push({\n message: \"Expected an array\",\n path: pathArray.length > 0 ? pathArray : undefined,\n });\n return { issues };\n }\n\n // Validate each array element (without array flag)\n for (let i = 0; i < value.length; i++) {\n const elementValue = value[i];\n const elementPath = pathArray.concat(`[${i}]`);\n\n // Validate element with same type but without array flag\n const elementIssues = validateValue({\n value: elementValue,\n data,\n user,\n pathArray: elementPath,\n });\n if (elementIssues.length > 0) {\n issues.push(...elementIssues);\n }\n }\n\n if (issues.length > 0) {\n return { issues };\n }\n return { value: value as FieldOutput<OutputBase, TOptions> };\n }\n\n // 3. Type-specific validation and custom validation\n const valueIssues = validateValue({ value, data, user, pathArray });\n issues.push(...valueIssues);\n\n if (issues.length > 0) {\n return { issues };\n }\n\n return { value };\n }\n\n const field: TailorField<\n { type: T; array: TOptions extends { array: true } ? true : false },\n FieldOutput<OutputBase, TOptions>\n > = {\n type,\n fields: fields ?? {},\n _defined: undefined as unknown as {\n type: T;\n array: TOptions extends { array: true } ? true : false;\n },\n _output: undefined as FieldOutput<OutputBase, TOptions>,\n _metadata,\n\n get metadata() {\n return { ...this._metadata };\n },\n\n description(description: string) {\n this._metadata.description = description;\n // Fluent API returns this with updated type\n // oxlint-disable-next-line no-explicit-any\n return this as any;\n },\n\n typeName(typeName: string) {\n this._metadata.typeName = typeName;\n // Fluent API returns this with updated type\n // oxlint-disable-next-line no-explicit-any\n return this as any;\n },\n\n validate(...validateInputs: FieldValidateInput<FieldOutput<OutputBase, TOptions>>[]) {\n this._metadata.validate = validateInputs;\n // Fluent API returns this with updated type\n // oxlint-disable-next-line no-explicit-any\n return this as any;\n },\n\n parse(args: FieldParseArgs): StandardSchemaV1.Result<FieldOutput<OutputBase, TOptions>> {\n return parseInternal({\n value: args.value,\n data: args.data,\n user: args.user,\n pathArray: [],\n });\n },\n\n _parseInternal: parseInternal,\n };\n\n return field;\n}\n\n/**\n * Create a UUID field for resolver input/output.\n * @param options - Field configuration options\n * @returns A UUID field\n * @example t.uuid()\n */\nfunction uuid<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"uuid\", options);\n}\n\n/**\n * Create a string field for resolver input/output.\n * @param options - Field configuration options\n * @returns A string field\n * @example t.string()\n * @example t.string({ optional: true })\n * @example t.string({ array: true })\n */\nfunction string<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"string\", options);\n}\n\n/**\n * Create a boolean field for resolver input/output.\n * @param options - Field configuration options\n * @returns A boolean field\n * @example t.bool()\n */\nfunction bool<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"boolean\", options);\n}\n\n/**\n * Create an integer field for resolver input/output.\n * @param options - Field configuration options\n * @returns An integer field\n * @example t.int()\n */\nfunction int<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"integer\", options);\n}\n\n/**\n * Create a float field for resolver input/output.\n * @param options - Field configuration options\n * @returns A float field\n * @example t.float()\n */\nfunction float<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"float\", options);\n}\n\n/**\n * Create a decimal field for resolver input/output (stored as string for precision).\n * @param options - Field configuration options\n * @returns A decimal field\n * @example t.decimal()\n * @example t.decimal({ optional: true })\n */\nfunction decimal<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"decimal\", options);\n}\n\n/**\n * Create a date field for resolver input/output.\n * @param options - Field configuration options\n * @returns A date field\n * @example t.date()\n */\nfunction date<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"date\", options);\n}\n\n/**\n * Create a datetime field for resolver input/output.\n * @param options - Field configuration options\n * @returns A datetime field\n * @example t.datetime()\n */\nfunction datetime<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"datetime\", options);\n}\n\n/**\n * Create a time field for resolver input/output.\n * @param options - Field configuration options\n * @returns A time field\n * @example t.time()\n */\nfunction time<const Opt extends FieldOptions>(options?: Opt) {\n return createTailorField(\"time\", options);\n}\n\n/**\n * Create an enum field for resolver input/output.\n * @param values - Array of allowed string values\n * @param options - Field configuration options\n * @returns An enum field\n * @example t.enum([\"active\", \"inactive\"])\n */\nfunction _enum<const V extends AllowedValues, const Opt extends FieldOptions>(\n values: V,\n options?: Opt,\n): TailorField<\n { type: \"enum\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<AllowedValuesOutput<V>, Opt>\n> {\n return createTailorField<\"enum\", Opt, AllowedValuesOutput<V>>(\"enum\", options, undefined, values);\n}\n\n/**\n * Create a nested object field for resolver input/output.\n * @param fields - Record of field definitions\n * @param options - Field options (optional, array)\n * @returns A nested object field\n * @example\n * // Single object:\n * output: t.object({ name: t.string(), email: t.string() })\n * @example\n * // Array of objects:\n * items: t.object({ name: t.string() }, { array: true })\n */\nfunction object<const F extends Record<string, TailorAnyField>, const Opt extends FieldOptions>(\n fields: F,\n options?: Opt,\n) {\n const objectField = createTailorField(\"nested\", options, fields) as TailorField<\n { type: \"nested\"; array: Opt extends { array: true } ? true : false },\n FieldOutput<InferFieldsOutput<F>, Opt>\n >;\n return objectField;\n}\n\nexport const t = {\n uuid,\n string,\n bool,\n int,\n float,\n decimal,\n date,\n datetime,\n time,\n enum: _enum,\n object,\n};\n"],"mappings":";;;;AAyFA,MAAM,QAAQ;CACZ,MAAM;CACN,MAAM;CACN,MAAM;CACN,UACE;CACF,SAAS;AACX;;;;;;;;;AAgCA,SAAS,kBAKP,MACA,SACA,QACA,QAIA;CACA,MAAM,YAA2B,EAAE,UAAU,KAAK;CAElD,IAAI,SAAS;EACX,IAAI,QAAQ,aAAa,MACvB,UAAU,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AAC1C;;;;;;;AAQA,SAAS,SAAyC,SAAe;CAC/D,OAAO,kBAAkB,YAAY,OAAO;AAC9C;;;;;;;AAQA,SAAS,KAAqC,SAAe;CAC3D,OAAO,kBAAkB,QAAQ,OAAO;AAC1C;;;;;;;;AASA,SAAS,MACP,QACA,SAIA;CACA,OAAO,kBAAuD,QAAQ,SAAS,QAAW,MAAM;AAClG;;;;;;;;;;;;;AAcA,SAAS,OACP,QACA,SACA;CAKA,OAJoB,kBAAkB,UAAU,SAAS,MAIxC;AACnB;AAEA,MAAa,IAAI;CACf;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,MAAM;CACN;AACF"}
@@ -0,0 +1,5 @@
1
+
2
+ import { t as mapAllowedValues } from "./field-C4zdJLW5.mjs";
3
+ import { t } from "./types-BinLwXM9.mjs";
4
+
5
+ export { t };
@@ -1,6 +1,6 @@
1
- import { Vt as TailorInvoker } from "../../tailor-db-field-BhWvOyky.mjs";
2
- import { O as TailorDBType } from "../../workflow.generated-DV87DJfO.mjs";
3
- import { dt as WORKFLOW_TEST_ENV_KEY, n as output, xt as TailorField } from "../../index-BD99GoHO.mjs";
1
+ import { Vt as TailorInvoker } from "../../tailor-db-field-Y_zEoGu1.mjs";
2
+ import { O as TailorDBType } from "../../workflow.generated-BIY41La-.mjs";
3
+ import { dt as WORKFLOW_TEST_ENV_KEY, n as output, xt as TailorField } from "../../index-UySZfxON.mjs";
4
4
  import { StandardSchemaV1 } from "@standard-schema/spec";
5
5
 
6
6
  //#region src/utils/test/mock.d.ts
@@ -1,5 +1,5 @@
1
1
 
2
- import { t as WORKFLOW_TEST_ENV_KEY } from "../../job-4GOnasfT.mjs";
2
+ import { t as WORKFLOW_TEST_ENV_KEY } from "../../job-CEAJLiGp.mjs";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import * as path from "node:path";
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { c as injectMocks, i as cleanupMocks, n as STATE_KEY, t as RUNTIME_FLAG_KEY } from "../mock-B2t5gDMl.mjs";
2
+ import { c as injectMocks, i as cleanupMocks, n as STATE_KEY, t as RUNTIME_FLAG_KEY } from "../mock-B6PI49C_.mjs";
3
3
  import * as globals from "globals";
4
4
 
5
5
  //#region src/vitest/environment.ts
@@ -1,13 +1,7 @@
1
+ import { n as TailorEnv } from "../env-B-g-qgE4.mjs";
1
2
  import { Plugin } from "vitest/config";
2
3
 
3
4
  //#region src/vitest/mock.d.ts
4
- /**
5
- * Mock implementations for Tailor Platform APIs.
6
- *
7
- * Provides singleton mock objects that are automatically injected into
8
- * globalThis by the tailor-runtime Vitest environment. Tests can configure
9
- * responses and assert on recorded calls via the exported mock objects.
10
- */
11
5
  type QueryResolver = (query: string, params: unknown[]) => unknown[];
12
6
  type JobHandler = (jobName: string, args: unknown) => unknown;
13
7
  type IdpResolver = (method: string, args: unknown[], namespace: string) => unknown;
@@ -197,6 +191,12 @@ declare const workflowMock: {
197
191
  * @param handler - Static value or a function that returns one
198
192
  */
199
193
  setWaitHandler: SetWaitHandler;
194
+ /**
195
+ * Set the `env` passed to job bodies invoked via `createWorkflowJob().trigger()`.
196
+ * Cleared by `workflowMock.reset()`.
197
+ * @param env - Env passed to job bodies.
198
+ */
199
+ setEnv(env: TailorEnv): void;
200
200
  /**
201
201
  * Configure how `tailor.workflow.resolve` runs the user-supplied callback. The handler
202
202
  * receives `(executionId, key, callback)` — invoke `callback(payload)` to drive
@@ -1,5 +1,5 @@
1
1
 
2
- import { a as fileMock, d as workflowMock, l as secretmanagerMock, o as iconvMock, r as authconnectionMock, s as idpMock, u as tailordbMock } from "../mock-B2t5gDMl.mjs";
2
+ import { a as fileMock, d as workflowMock, l as secretmanagerMock, o as iconvMock, r as authconnectionMock, s as idpMock, u as tailordbMock } from "../mock-B6PI49C_.mjs";
3
3
  import { builtinModules } from "node:module";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { dirname, isAbsolute, matchesGlob, relative, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
1
 
2
- import { l as secretmanagerMock, t as RUNTIME_FLAG_KEY } from "../mock-B2t5gDMl.mjs";
2
+ import { l as secretmanagerMock, t as RUNTIME_FLAG_KEY } from "../mock-B6PI49C_.mjs";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import { afterEach, beforeAll, beforeEach } from "vitest";
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { t as __exportAll } from "./chunk-DLeslSnM.mjs";
2
+ import { t as __exportAll } from "./chunk-BkoGK1jX.mjs";
3
3
 
4
4
  //#region src/runtime/workflow.ts
5
5
  var workflow_exports = /* @__PURE__ */ __exportAll({
@@ -36,4 +36,4 @@ const resolve = (...args) => api().resolve(...args);
36
36
 
37
37
  //#endregion
38
38
  export { workflow_exports as a, wait as i, triggerJobFunction as n, triggerWorkflow as r, resolve as t };
39
- //# sourceMappingURL=workflow-DJRr-0nl.mjs.map
39
+ //# sourceMappingURL=workflow--aPbA8Uq.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-DJRr-0nl.mjs","names":[],"sources":["../src/runtime/workflow.ts"],"sourcesContent":["/**\n * Workflow utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.workflow` runtime API.\n * At runtime this delegates to `globalThis.tailor.workflow`. Use `workflowMock`\n * from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n * @example\n * import { workflow } from \"@tailor-platform/sdk/runtime\";\n *\n * const executionId = await workflow.triggerWorkflow(\"myWorkflow\", { data: \"value\" });\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Specifies the machine user that should be used to execute the workflow.\n * This allows workflows to run with specific authentication context.\n */\nexport interface AuthInvoker {\n /** The namespace where the machine user is defined */\n namespace: string;\n /** The name of the machine user to use for workflow execution */\n machineUserName: string;\n}\n\n/** Options for {@link triggerWorkflow}. */\nexport interface TriggerWorkflowOptions {\n /** Optional authentication invoker to specify which machine user should execute the workflow */\n authInvoker?: AuthInvoker;\n}\n\n/**\n * Platform API surface for `tailor.workflow`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.workflow`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as workflow from\n * \"@tailor-platform/sdk/runtime/workflow\"` or pick individual methods.\n */\nexport interface TailorWorkflowAPI {\n /**\n * Triggers a workflow and returns its execution ID.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional trigger options (e.g. `authInvoker`)\n * @returns The execution ID of the triggered workflow\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n ): Promise<string>;\n\n /**\n * Triggers a job function and returns its result.\n * @param jobName - Job name as defined in the workflow\n * @param args - Arguments forwarded to the job\n * @returns The job's return value\n */\n triggerJobFunction(jobName: string, args?: any): any;\n\n /**\n * Suspends the current workflow execution and waits for an external signal to resume.\n * @param key - Wait point key\n * @param payload - Optional payload to record with the wait point\n * @returns The payload supplied by the corresponding `resolve` call\n */\n wait(key: string, payload?: any): any;\n\n /**\n * Resolves a waiting workflow execution, causing it to resume.\n * @param executionId - The execution to resume\n * @param key - Wait point key to resolve\n * @param callback - Callback receiving the wait payload; its return value is forwarded to `wait`\n * @returns A promise that resolves once the resolve has been recorded\n */\n resolve(executionId: string, key: string, callback: (waitPayload: any) => any): Promise<void>;\n}\n\nconst api = (): TailorWorkflowAPI =>\n (globalThis as { tailor: { workflow: TailorWorkflowAPI } }).tailor.workflow;\n\n/**\n * See {@link TailorWorkflowAPI.triggerWorkflow}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.triggerWorkflow}\n * @returns The execution ID of the triggered workflow\n */\nexport const triggerWorkflow: TailorWorkflowAPI[\"triggerWorkflow\"] = (...args) =>\n api().triggerWorkflow(...args);\n\n/**\n * See {@link TailorWorkflowAPI.triggerJobFunction}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.triggerJobFunction}\n * @returns The job's return value\n */\nexport const triggerJobFunction: TailorWorkflowAPI[\"triggerJobFunction\"] = (...args) =>\n api().triggerJobFunction(...args);\n\n/**\n * See {@link TailorWorkflowAPI.wait}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.wait}\n * @returns The payload supplied by the corresponding `resolve` call\n */\nexport const wait: TailorWorkflowAPI[\"wait\"] = (...args) => api().wait(...args);\n\n/**\n * See {@link TailorWorkflowAPI.resolve}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resolve}\n * @returns A promise that resolves once the resolve has been recorded\n */\nexport const resolve: TailorWorkflowAPI[\"resolve\"] = (...args) => api().resolve(...args);\n"],"mappings":";;;;;;;;;;AA+EA,MAAM,YACH,WAA2D,OAAO;;;;;;AAOrE,MAAa,mBAAyD,GAAG,SACvE,IAAI,EAAE,gBAAgB,GAAG,IAAI;;;;;;AAO/B,MAAa,sBAA+D,GAAG,SAC7E,IAAI,EAAE,mBAAmB,GAAG,IAAI;;;;;;AAOlC,MAAa,QAAmC,GAAG,SAAS,IAAI,EAAE,KAAK,GAAG,IAAI;;;;;;AAO9E,MAAa,WAAyC,GAAG,SAAS,IAAI,EAAE,QAAQ,GAAG,IAAI"}
1
+ {"version":3,"file":"workflow--aPbA8Uq.mjs","names":[],"sources":["../src/runtime/workflow.ts"],"sourcesContent":["/**\n * Workflow utilities.\n *\n * Thin typed wrapper around the platform-provided `tailor.workflow` runtime API.\n * At runtime this delegates to `globalThis.tailor.workflow`. Use `workflowMock`\n * from `@tailor-platform/sdk/vitest` to mock these calls in unit tests.\n * @example\n * import { workflow } from \"@tailor-platform/sdk/runtime\";\n *\n * const executionId = await workflow.triggerWorkflow(\"myWorkflow\", { data: \"value\" });\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Specifies the machine user that should be used to execute the workflow.\n * This allows workflows to run with specific authentication context.\n */\nexport interface AuthInvoker {\n /** The namespace where the machine user is defined */\n namespace: string;\n /** The name of the machine user to use for workflow execution */\n machineUserName: string;\n}\n\n/** Options for {@link triggerWorkflow}. */\nexport interface TriggerWorkflowOptions {\n /** Optional authentication invoker to specify which machine user should execute the workflow */\n authInvoker?: AuthInvoker;\n}\n\n/**\n * Platform API surface for `tailor.workflow`. Describes the shape the platform\n * runtime injects on `globalThis.tailor.workflow`.\n *\n * Each method below is also re-exported as a top-level named export from this\n * module so callers can either `import * as workflow from\n * \"@tailor-platform/sdk/runtime/workflow\"` or pick individual methods.\n */\nexport interface TailorWorkflowAPI {\n /**\n * Triggers a workflow and returns its execution ID.\n * @param workflowName - Workflow name as defined in tailor.config\n * @param args - Arguments forwarded to the workflow's main job\n * @param options - Optional trigger options (e.g. `authInvoker`)\n * @returns The execution ID of the triggered workflow\n */\n triggerWorkflow(\n workflowName: string,\n args?: any,\n options?: TriggerWorkflowOptions,\n ): Promise<string>;\n\n /**\n * Triggers a job function and returns its result.\n * @param jobName - Job name as defined in the workflow\n * @param args - Arguments forwarded to the job\n * @returns The job's return value\n */\n triggerJobFunction(jobName: string, args?: any): any;\n\n /**\n * Suspends the current workflow execution and waits for an external signal to resume.\n * @param key - Wait point key\n * @param payload - Optional payload to record with the wait point\n * @returns The payload supplied by the corresponding `resolve` call\n */\n wait(key: string, payload?: any): any;\n\n /**\n * Resolves a waiting workflow execution, causing it to resume.\n * @param executionId - The execution to resume\n * @param key - Wait point key to resolve\n * @param callback - Callback receiving the wait payload; its return value is forwarded to `wait`\n * @returns A promise that resolves once the resolve has been recorded\n */\n resolve(executionId: string, key: string, callback: (waitPayload: any) => any): Promise<void>;\n}\n\nconst api = (): TailorWorkflowAPI =>\n (globalThis as { tailor: { workflow: TailorWorkflowAPI } }).tailor.workflow;\n\n/**\n * See {@link TailorWorkflowAPI.triggerWorkflow}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.triggerWorkflow}\n * @returns The execution ID of the triggered workflow\n */\nexport const triggerWorkflow: TailorWorkflowAPI[\"triggerWorkflow\"] = (...args) =>\n api().triggerWorkflow(...args);\n\n/**\n * See {@link TailorWorkflowAPI.triggerJobFunction}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.triggerJobFunction}\n * @returns The job's return value\n */\nexport const triggerJobFunction: TailorWorkflowAPI[\"triggerJobFunction\"] = (...args) =>\n api().triggerJobFunction(...args);\n\n/**\n * See {@link TailorWorkflowAPI.wait}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.wait}\n * @returns The payload supplied by the corresponding `resolve` call\n */\nexport const wait: TailorWorkflowAPI[\"wait\"] = (...args) => api().wait(...args);\n\n/**\n * See {@link TailorWorkflowAPI.resolve}.\n * @param args - Forwarded to {@link TailorWorkflowAPI.resolve}\n * @returns A promise that resolves once the resolve has been recorded\n */\nexport const resolve: TailorWorkflowAPI[\"resolve\"] = (...args) => api().resolve(...args);\n"],"mappings":";;;;;;;;;;AA+EA,MAAM,YACH,WAA2D,OAAO;;;;;;AAOrE,MAAa,mBAAyD,GAAG,SACvE,IAAI,EAAE,gBAAgB,GAAG,IAAI;;;;;;AAO/B,MAAa,sBAA+D,GAAG,SAC7E,IAAI,EAAE,mBAAmB,GAAG,IAAI;;;;;;AAOlC,MAAa,QAAmC,GAAG,SAAS,IAAI,EAAE,KAAK,GAAG,IAAI;;;;;;AAO9E,MAAa,WAAyC,GAAG,SAAS,IAAI,EAAE,QAAQ,GAAG,IAAI"}
@@ -93,4 +93,4 @@ declare const wait: TailorWorkflowAPI["wait"];
93
93
  declare const resolve: TailorWorkflowAPI["resolve"];
94
94
  //#endregion
95
95
  export { triggerJobFunction as a, workflow_d_exports as c, resolve as i, TailorWorkflowAPI as n, triggerWorkflow as o, TriggerWorkflowOptions as r, wait as s, AuthInvoker as t };
96
- //# sourceMappingURL=workflow-DV_88JEf.d.mts.map
96
+ //# sourceMappingURL=workflow-dYYH7QFa.d.mts.map
@@ -1,4 +1,4 @@
1
- import { A as RelationType, Bt as InferredAttributeMap, D as DefinedDBFieldMetadata, Dt as ArrayFieldOutput, E as DBFieldMetadata, F as AuthConfig, Ft as FieldValidateInput, Ht as TailorUser, It as Validators, Jt as output, M as TailorDBServiceInput, Mt as FieldOutput, O as GqlOperationsConfig, Pt as TailorToTs, Wt as InferFieldsOutput, Y as TailorField, c as PluginConfigs, ht as BuiltinIdP, i as TailorDBType$1, j as SerialConfig, jt as FieldOptions, k as IndexDef, kt as EnumValue, qt as Prettify, r as TailorDBField$1, t as TailorAnyDBField$1 } from "./tailor-db-field-BhWvOyky.mjs";
1
+ import { A as RelationType, Bt as InferredAttributeMap, D as DefinedDBFieldMetadata, Dt as ArrayFieldOutput, E as DBFieldMetadata, F as AuthConfig, Ft as FieldValidateInput, Ht as TailorUser, It as Validators, Jt as output, M as TailorDBServiceInput, Mt as FieldOutput, O as GqlOperationsConfig, Pt as TailorToTs, Wt as InferFieldsOutput, Y as TailorField, c as PluginConfigs, ht as BuiltinIdP, i as TailorDBType$1, j as SerialConfig, jt as FieldOptions, k as IndexDef, kt as EnumValue, qt as Prettify, r as TailorDBField$1, t as TailorAnyDBField$1 } from "./tailor-db-field-Y_zEoGu1.mjs";
2
2
  import { NonEmptyObject } from "type-fest";
3
3
  import { StandardSchemaV1 } from "@standard-schema/spec";
4
4
 
@@ -1216,4 +1216,4 @@ type ConcurrencyPolicy = {
1216
1216
  };
1217
1217
  //#endregion
1218
1218
  export { PermissionCondition as A, IdPInput as C, TailorDBInstance as D, TailorDBField as E, AllowedValues as F, AllowedValuesOutput as I, TailorTypePermission as M, unsafeAllowAllGqlPermission as N, TailorDBType as O, unsafeAllowAllTypePermission as P, IdPGqlOperationsInput as S, TailorAnyDBType as T, IdPExternalConfig as _, ExecutorServiceInput as a, IdPEmailConfig as b, ResolverServiceInput as c, StaticWebsiteConfig as d, StaticWebsiteDefinitionBrand as f, IdPConfig as g, SecretsDefinitionBrand as h, ExecutorServiceConfig as i, TailorTypeGqlPermission as j, db as k, WorkflowServiceConfig as l, SecretsConfig as m, RetryPolicy as n, ResolverExternalConfig as o, StaticWebsiteInput as p, AppConfig as r, ResolverServiceConfig as s, ConcurrencyPolicy as t, WorkflowServiceInput as u, IdPUserField as v, TailorAnyDBField as w, IdPGqlOperations as x, IdpDefinitionBrand as y };
1219
- //# sourceMappingURL=workflow.generated-DV87DJfO.d.mts.map
1219
+ //# sourceMappingURL=workflow.generated-BIY41La-.d.mts.map
@@ -336,12 +336,13 @@ tailor-sdk api [options] [command] <endpoint>
336
336
 
337
337
  **Options**
338
338
 
339
- | Option | Alias | Description | Required | Default | Env |
340
- | ------------------------------- | ----- | ----------------------- | -------- | -------------------- | --------------------------------- |
341
- | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
342
- | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
343
- | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
344
- | `--body <BODY>` | `-b` | Request body as JSON. | No | `"{}"` | - |
339
+ | Option | Alias | Description | Required | Default | Env |
340
+ | ------------------------------- | ----- | --------------------------------------------------------------------------------- | -------- | -------------------- | --------------------------------- |
341
+ | `--workspace-id <WORKSPACE_ID>` | `-w` | Workspace ID | No | - | `TAILOR_PLATFORM_WORKSPACE_ID` |
342
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
343
+ | `--config <CONFIG>` | `-c` | Path to SDK config file | No | `"tailor.config.ts"` | `TAILOR_PLATFORM_SDK_CONFIG_PATH` |
344
+ | `--body <BODY>` | `-b` | Request body as JSON. | No | `"{}"` | - |
345
+ | `--field <FIELD>` | `-f` | Set a body field as `key=value` (repeatable; dotted keys nest). Overrides --body. | No | - | - |
345
346
 
346
347
  <!-- politty:command:api:options:end -->
347
348
 
@@ -361,6 +362,12 @@ See [Global Options](../cli-reference.md#global-options) for options available t
361
362
  $ tailor-sdk api GetApplication -b '{"applicationName":"app-1"}'
362
363
  ```
363
364
 
365
+ **Same as above, using --field instead of --body.**
366
+
367
+ ```bash
368
+ $ tailor-sdk api GetApplication -f applicationName=app-1
369
+ ```
370
+
364
371
  **List all invocable OperatorService methods.**
365
372
 
366
373
  ```bash
@@ -390,6 +397,8 @@ The request body is inferred from the proto definition of the target endpoint, a
390
397
 
391
398
  Values already present in `--body` are never overridden. If a value cannot be resolved (e.g. no config found), injection is silently skipped and the server-side validation error takes precedence.
392
399
 
400
+ Use `--field key=value` (repeatable) to set request body fields without writing JSON. Dotted keys (e.g. `application.name=foo`) build nested objects. `--field` overrides matching fields in `--body` and tab-completes from the endpoint's proto schema.
401
+
393
402
  <!-- politty:command:api:notes:end -->
394
403
  <!-- politty:command:api inspect:heading:start -->
395
404
 
@@ -36,9 +36,11 @@ tailor-sdk completion [options] [shell]
36
36
 
37
37
  **Options**
38
38
 
39
- | Option | Alias | Description | Required | Default |
40
- | ---------------- | ----- | ------------------------------ | -------- | ------- |
41
- | `--instructions` | `-i` | Show installation instructions | No | `false` |
39
+ | Option | Alias | Description | Required | Default |
40
+ | ---------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------- |
41
+ | `--instructions` | `-i` | Show installation instructions | No | `false` |
42
+ | `--loader` | - | Print just the rc loader snippet (bash/zsh). Add it to ~/.bashrc or ~/.zshrc; it auto-regenerates the cache when the binary changes. | No | `false` |
43
+ | `--install` | - | Write the completion script to its on-disk cache (bash/zsh) or autoload location (fish) instead of printing it. | No | `false` |
42
44
 
43
45
  <!-- politty:command:completion:options:end -->
44
46
 
package/docs/runtime.md CHANGED
@@ -78,7 +78,7 @@ The runtime entry re-exports the following namespaces. Detailed signatures, para
78
78
  - `idp` — IdP user management (`new Client({ namespace })`)
79
79
  - `workflow` — workflow & job control (`triggerWorkflow`, `triggerJobFunction`, `wait`, `resolve`)
80
80
  - `context` — execution context (`getInvoker`)
81
- - `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `openDownloadStream`)
81
+ - `file` — `tailordb.file` BLOB API (`upload`, `download`, `downloadAsBase64`, `delete`, `getMetadata`, `downloadStream`, `uploadStream`, `openDownloadStream` _(deprecated)_)
82
82
 
83
83
  ## Testing
84
84
 
package/docs/testing.md CHANGED
@@ -18,7 +18,6 @@ Unit-test entrypoints exposed by the SDK:
18
18
  Helpers under `@tailor-platform/sdk/test`:
19
19
 
20
20
  - `unauthenticatedTailorUser` — default `user` value for resolver contexts
21
- - `WORKFLOW_TEST_ENV_KEY` — env key consumed by `.trigger()` when run locally
22
21
 
23
22
  Platform API mocks under `@tailor-platform/sdk/vitest` (auto-injected by the [`tailor-runtime` Vitest environment](#runtime-environment-emulation-beta) below):
24
23
 
@@ -228,10 +227,30 @@ test("mock file download", async () => {
228
227
  });
229
228
  ```
230
229
 
231
- For `openDownloadStream`, enqueue an iterable of `StreamValue` items `metadata`, one or more `chunk` items, and a terminal `complete`. Raw `Uint8Array` / `ArrayBuffer` chunks are rejected so tests stay aligned with the platform's structured stream contract.
230
+ For `downloadStream`, enqueue a `FileDownloadStreamResponse` object with a `ReadableStream` body and metadata:
232
231
 
233
232
  ```typescript
234
233
  test("mock file download stream", async () => {
234
+ const body = new ReadableStream({
235
+ start(controller) {
236
+ controller.enqueue(new Uint8Array([1, 2, 3]));
237
+ controller.close();
238
+ },
239
+ });
240
+ fileMock.enqueueResult({
241
+ body,
242
+ metadata: { contentType: "image/png", fileSize: 3, sha256sum: "abc", lastUploadedAt: "" },
243
+ });
244
+
245
+ const result = await tailordb.file.downloadStream("ns", "Doc", "attachment", "r-1");
246
+ expect(result.metadata.fileSize).toBe(3);
247
+ });
248
+ ```
249
+
250
+ For the deprecated `openDownloadStream`, enqueue an iterable of `StreamValue` items — `metadata`, one or more `chunk` items, and a terminal `complete`. Raw `Uint8Array` / `ArrayBuffer` chunks are rejected so tests stay aligned with the platform's structured stream contract.
251
+
252
+ ```typescript
253
+ test("mock file download stream (deprecated openDownloadStream)", async () => {
235
254
  fileMock.enqueueResult([
236
255
  {
237
256
  type: "metadata",
@@ -497,7 +516,7 @@ import * as shared from "./shared";
497
516
 
498
517
  describe("onUserCreated executor", () => {
499
518
  test("creates an audit log with the new user's name and email", async () => {
500
- const createAuditLog = vi.spyOn(shared, "createAuditLog").mockResolvedValue(undefined);
519
+ using createAuditLog = vi.spyOn(shared, "createAuditLog").mockResolvedValue(undefined);
501
520
 
502
521
  if (onUserCreated.operation.kind !== "function") {
503
522
  throw new Error("expected function operation");
@@ -556,20 +575,21 @@ describe("validateOrder", () => {
556
575
  Spy on each dependent job's `.trigger()` to replace it with a deterministic result:
557
576
 
558
577
  ```typescript
559
- import { afterEach, describe, expect, test, vi } from "vitest";
578
+ import { describe, expect, test, vi } from "vitest";
560
579
  import { fulfillOrder, processPayment, sendConfirmation, validateOrder } from "./order-fulfillment";
561
580
 
562
581
  describe("fulfillOrder", () => {
563
- afterEach(() => vi.restoreAllMocks());
564
-
565
582
  test("chains validate → pay → confirm", async () => {
566
- vi.spyOn(validateOrder, "trigger").mockResolvedValue({ valid: true, orderId: "order-1" });
567
- vi.spyOn(processPayment, "trigger").mockResolvedValue({
583
+ using _validateSpy = vi.spyOn(validateOrder, "trigger").mockResolvedValue({
584
+ valid: true,
585
+ orderId: "order-1",
586
+ });
587
+ using _paymentSpy = vi.spyOn(processPayment, "trigger").mockResolvedValue({
568
588
  transactionId: "txn-order-1",
569
589
  amount: 100,
570
590
  status: "completed",
571
591
  });
572
- vi.spyOn(sendConfirmation, "trigger").mockResolvedValue({
592
+ using _confirmSpy = vi.spyOn(sendConfirmation, "trigger").mockResolvedValue({
573
593
  orderId: "order-1",
574
594
  transactionId: "txn-order-1",
575
595
  confirmed: true,
@@ -625,18 +645,18 @@ describe("processWithApproval", () => {
625
645
 
626
646
  #### Running a full workflow locally
627
647
 
628
- To exercise the full chain without any mocking, call `workflow.mainJob.trigger()`. Dependent jobs run their real `.body()` functions. Set `WORKFLOW_TEST_ENV_KEY` first so triggered jobs see the workflow env:
648
+ To exercise the full chain with real job bodies, call `workflow.mainJob.trigger()`. Dependent jobs run their real `.body()` functions. Use `workflowMock.setEnv()` to control the env value that triggered jobs receive in their context (defaults to `{}`):
629
649
 
630
650
  ```typescript
631
- import { WORKFLOW_TEST_ENV_KEY } from "@tailor-platform/sdk/test";
632
- import { afterEach, describe, expect, test, vi } from "vitest";
651
+ import { workflowMock } from "@tailor-platform/sdk/vitest";
652
+ import { afterEach, describe, expect, test } from "vitest";
633
653
  import workflow from "./order-fulfillment";
634
654
 
635
655
  describe("order-fulfillment workflow", () => {
636
- afterEach(() => vi.unstubAllEnvs());
656
+ afterEach(() => workflowMock.reset());
637
657
 
638
658
  test("mainJob.trigger() executes all jobs", async () => {
639
- vi.stubEnv(WORKFLOW_TEST_ENV_KEY, JSON.stringify({}));
659
+ workflowMock.setEnv({ PAYMENT_GATEWAY: "stripe" });
640
660
 
641
661
  const result = await workflow.mainJob.trigger({ orderId: "order-3", amount: 300 });
642
662
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "1.51.2",
3
+ "version": "1.53.0",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -140,8 +140,8 @@
140
140
  "@bufbuild/protobuf": "2.12.0",
141
141
  "@connectrpc/connect": "2.1.1",
142
142
  "@connectrpc/connect-node": "2.1.1",
143
- "@inquirer/core": "11.1.10",
144
- "@inquirer/prompts": "8.4.3",
143
+ "@inquirer/core": "11.2.0",
144
+ "@inquirer/prompts": "8.5.0",
145
145
  "@jridgewell/trace-mapping": "0.3.31",
146
146
  "@liam-hq/cli": "0.7.24",
147
147
  "@napi-rs/keyring": "1.3.0",
@@ -150,7 +150,7 @@
150
150
  "@opentelemetry/resources": "2.7.1",
151
151
  "@opentelemetry/sdk-trace-node": "2.7.1",
152
152
  "@opentelemetry/semantic-conventions": "1.41.1",
153
- "@oxc-project/types": "0.127.0",
153
+ "@oxc-project/types": "0.133.0",
154
154
  "@standard-schema/spec": "1.1.0",
155
155
  "@tailor-platform/function-kysely-tailordb": "0.1.3",
156
156
  "@toiroakr/lines-db": "0.9.2",
@@ -160,22 +160,22 @@
160
160
  "chokidar": "5.0.0",
161
161
  "confbox": "0.2.4",
162
162
  "date-fns": "4.3.0",
163
- "es-toolkit": "1.46.1",
163
+ "es-toolkit": "1.47.0",
164
164
  "find-up-simple": "1.0.1",
165
165
  "globals": "17.6.0",
166
166
  "graphql": "16.14.0",
167
167
  "inflection": "3.0.2",
168
- "kysely": "0.28.17",
168
+ "kysely": "0.29.2",
169
169
  "madge": "8.0.0",
170
170
  "mime-types": "3.0.2",
171
171
  "open": "11.0.0",
172
- "oxc-parser": "0.127.0",
172
+ "oxc-parser": "0.133.0",
173
173
  "p-limit": "7.3.0",
174
174
  "pathe": "2.0.3",
175
175
  "pgsql-ast-parser": "12.0.2",
176
176
  "pkg-types": "2.3.1",
177
- "politty": "0.4.15",
178
- "rolldown": "1.0.1",
177
+ "politty": "0.5.0",
178
+ "rolldown": "1.0.3",
179
179
  "semver": "7.8.1",
180
180
  "serve": "14.2.6",
181
181
  "sql-highlight": "6.1.0",
@@ -184,7 +184,7 @@
184
184
  "ts-cron-validator": "1.1.5",
185
185
  "tsx": "4.22.3",
186
186
  "type-fest": "5.6.0",
187
- "undici": "6.25.0",
187
+ "undici": "8.3.0",
188
188
  "xdg-basedir": "5.1.0",
189
189
  "zod": "4.4.3"
190
190
  },
@@ -194,13 +194,13 @@
194
194
  "@types/mime-types": "3.0.1",
195
195
  "@types/node": "24.12.4",
196
196
  "@types/semver": "7.7.1",
197
- "@typescript/native-preview": "7.0.0-dev.20260524.1",
197
+ "@typescript/native-preview": "7.0.0-dev.20260527.2",
198
198
  "@vitest/coverage-v8": "4.1.7",
199
- "oxfmt": "0.46.0",
200
- "oxlint": "1.61.0",
199
+ "oxfmt": "0.52.0",
200
+ "oxlint": "1.67.0",
201
201
  "oxlint-tsgolint": "0.23.0",
202
202
  "sonda": "0.11.1",
203
- "tsdown": "0.22.0",
203
+ "tsdown": "0.22.1",
204
204
  "typescript": "5.9.3",
205
205
  "vitest": "4.1.7",
206
206
  "zinfer": "0.1.8"
@@ -1,4 +0,0 @@
1
-
2
- import { n as generatePluginFilesIfNeeded, r as loadApplication, t as defineApplication } from "./application-Z-fNwyZB.mjs";
3
-
4
- export { defineApplication };