@tailor-platform/sdk 2.12.0 → 2.13.1

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.
@@ -164,7 +164,7 @@ import{t as e}from"./assert-WeXvmG4j.mjs";import{t}from"./multiline-EyzjEwn9.mjs
164
164
  }
165
165
  );
166
166
 
167
- `}function processLinesDb(e,t){if(n(t))return processLinesDbForPluginTable(e,t);if(!t.filePath)throw Error(`Missing source info for table ${e.name}`);if(!t.exportName)throw Error(`Missing export name for table ${e.name}`);let{optionalFields:r,omitFields:i,indexes:a,foreignKeys:o}=extractFieldMetadata(e);return{tableName:e.name,exportName:t.exportName,importPath:t.filePath,optionalFields:r,omitFields:i,foreignKeys:o,indexes:a}}function processLinesDbForPluginTable(e,t){let{optionalFields:n,omitFields:r,indexes:i,foreignKeys:a}=extractFieldMetadata(e);return{tableName:e.name,exportName:t.exportName,importPath:``,optionalFields:n,omitFields:r,foreignKeys:a,indexes:i,pluginSource:t}}function extractFieldMetadata(e){let t=[`id`],n=[],r=[],i=[];for(let[i,a]of Object.entries(e.fields))a.config.hooks?.create&&t.push(i),a.config.serial&&n.push(i),a.config.unique&&r.push({name:`${e.name.toLowerCase()}_${i}_unique_idx`,columns:[i],unique:!0});if(e.indexes)for(let[t,n]of Object.entries(e.indexes))r.push({name:t,columns:n.fields,unique:n.unique});for(let[t,n]of Object.entries(e.fields))n.relation&&i.push({column:t,references:{table:n.relation.targetType,column:n.relation.key}});return{optionalFields:t,omitFields:n,indexes:r,foreignKeys:i}}function generateSchemaOptions(e,t){let n=[];return e.length>0&&(n.push(`foreignKeys: [`),e.forEach(e=>{n.push(` ${JSON.stringify(e)},`)}),n.push(`],`)),t.length>0&&(n.push(`indexes: [`),t.forEach(e=>{n.push(` ${JSON.stringify(e)},`)}),n.push(`],`)),n.length>0?[`
167
+ `}function processLinesDb(e,t){if(n(t))return processLinesDbForPluginTable(e,t);if(!t.filePath)throw Error(`Missing source info for table ${e.name}`);if(!t.exportName)throw Error(`Missing export name for table ${e.name}`);let{optionalFields:r,omitFields:i,indexes:a,foreignKeys:o}=extractFieldMetadata(e);return{tableName:e.name,exportName:t.exportName,importPath:t.filePath,optionalFields:r,omitFields:i,foreignKeys:o,indexes:a}}function processLinesDbForPluginTable(e,t){let{optionalFields:n,omitFields:r,indexes:i,foreignKeys:a}=extractFieldMetadata(e);return{tableName:e.name,exportName:t.exportName,importPath:``,optionalFields:n,omitFields:r,foreignKeys:a,indexes:i,pluginSource:t}}function isGeneratedOnCreate(e){return e.config.hooks?.create!==void 0||e.config.default!==void 0}function extractFieldMetadata(e){let t=[`id`],n=[],r=[],i=[];for(let[i,a]of Object.entries(e.fields))isGeneratedOnCreate(a)&&t.push(i),a.config.serial&&n.push(i),a.config.unique&&r.push({name:`${e.name.toLowerCase()}_${i}_unique_idx`,columns:[i],unique:!0});if(e.indexes)for(let[t,n]of Object.entries(e.indexes))r.push({name:t,columns:n.fields,unique:n.unique});for(let[t,n]of Object.entries(e.fields))n.relation&&i.push({column:t,references:{table:n.relation.targetType,column:n.relation.key}});return{optionalFields:t,omitFields:n,indexes:r,foreignKeys:i}}function generateSchemaOptions(e,t){let n=[];return e.length>0&&(n.push(`foreignKeys: [`),e.forEach(e=>{n.push(` ${JSON.stringify(e)},`)}),n.push(`],`)),t.length>0&&(n.push(`indexes: [`),t.forEach(e=>{n.push(` ${JSON.stringify(e)},`)}),n.push(`],`)),n.length>0?[`
168
168
  {`,...n.map(e=>` ${e}`),` }`].join(`
169
169
  `):``}function generateLinesDbSchemaFile(e,n){let{exportName:r,optionalFields:i,omitFields:a,foreignKeys:o,indexes:s}=e,c=t`
170
170
  const schemaType = t.object({
@@ -228,4 +228,4 @@ import{t as e}from"./assert-WeXvmG4j.mjs";import{t}from"./multiline-EyzjEwn9.mjs
228
228
  );
229
229
 
230
230
  `}const a=`@tailor-platform/seed`;function resolveIdpUserSyncFKs(e){return{emitUserToIdpFK:!(e?.userToIdp??!1),emitIdpToUserFK:!(e?.idpToUser??!1)}}function seedPlugin(t){return{id:a,description:`Generates seed data and schema files for the tailor seed CLI plugin`,pluginConfig:t,async onTailorDBReady(t){let n=[],i=t.auth?processIdpUser(t.auth)??null:null,a=resolveIdpUserSyncFKs(t.pluginConfig.disableIdpUserSync);for(let o of t.tailordb)for(let[s,c]of Object.entries(o.tables)){let l=processLinesDb(c,e(o.sourceInfo.get(s),`source info missing for table: ${s}`));a.emitUserToIdpFK&&i&&s===i.schema.userTableName&&l.foreignKeys.push({column:i.schema.usernameField,references:{table:`_User`,column:`name`}}),n.push({path:r.join(t.pluginConfig.distPath,`data`,`${l.tableName}.jsonl`),content:``,skipIfExists:!0});let u=r.join(t.pluginConfig.distPath,`data`,`${l.tableName}.schema.ts`);if(l.pluginSource&&l.pluginSource.pluginImportPath){let e;if(l.pluginSource.originalFilePath&&l.pluginSource.originalExportName){let t=r.relative(r.dirname(u),l.pluginSource.originalFilePath);e=t.replace(/\.ts$/,``).startsWith(`.`)?t.replace(/\.ts$/,``):`./${t.replace(/\.ts$/,``)}`}let i=generateLinesDbSchemaFileWithPluginAPI(l,{configImportPath:r.relative(r.dirname(u),t.configPath),originalImportPath:e});n.push({path:u,content:i})}else{let e=r.relative(r.dirname(u),l.importPath),t=generateLinesDbSchemaFile(l,e.replace(/\.ts$/,``).startsWith(`.`)?e.replace(/\.ts$/,``):`./${e.replace(/\.ts$/,``)}`);n.push({path:u,content:t})}}return i&&(n.push({path:r.join(t.pluginConfig.distPath,i.dataFile),content:``,skipIfExists:!0}),n.push({path:r.join(t.pluginConfig.distPath,`data`,`${i.name}.schema.ts`),content:generateIdpUserSchemaFile({usernameField:i.schema.usernameField,userTableName:i.schema.userTableName,includeUserProfileFK:a.emitIdpToUserFK})})),{files:n}}}}export{generateIdpSeedScriptCode as a,generateIdpListUsersScriptCode as i,seedPlugin as n,generateIdpTruncateScriptCode as o,processLinesDb as r,processIdpUser as s,a as t};
231
- //# sourceMappingURL=seed-CMkupmX8.mjs.map
231
+ //# sourceMappingURL=seed-CCc9Xk66.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-CCc9Xk66.mjs","names":[],"sources":["../src/plugin/builtin/seed/idp-user-processor.ts","../src/plugin/builtin/seed/lines-db-processor.ts","../src/plugin/builtin/seed/index.ts"],"sourcesContent":["import ml from \"#/utils/multiline\";\nimport type { GeneratorAuthInput } from \"#/plugin/types\";\n\nexport interface IdpUserMetadata {\n name: \"_User\";\n dependencies: string[];\n dataFile: string;\n idpNamespace: string;\n schema: {\n usernameField: string;\n userTableName: string;\n };\n}\n\n/**\n * Processes auth configuration to generate IdP user seed metadata\n * @param auth - Auth configuration from generator\n * @returns IdP user metadata or undefined if not applicable\n */\nexport function processIdpUser(auth: GeneratorAuthInput): IdpUserMetadata | undefined {\n // Only process if idProvider is BuiltInIdP and userProfile is defined\n if (auth.idProvider?.kind !== \"BuiltInIdP\" || !auth.userProfile) {\n return undefined;\n }\n\n const { tableName, usernameField } = auth.userProfile;\n\n return {\n name: \"_User\",\n dependencies: [tableName],\n dataFile: \"data/_User.jsonl\",\n idpNamespace: auth.idProvider.namespace,\n schema: {\n usernameField,\n userTableName: tableName,\n },\n };\n}\n\n/**\n * Generates the server-side IDP seed script code.\n * Uses the global tailor.idp.Client - no bundling required.\n * @param idpNamespace - The IDP namespace name\n * @returns Script code string\n */\nexport function generateIdpSeedScriptCode(idpNamespace: string): string {\n return ml /* ts */ `\n export async function main(input) {\n const client = new tailor.idp.Client({ namespace: \"${idpNamespace}\" });\n const errors = [];\n let processed = 0;\n let created = 0;\n let updated = 0;\n let skipped = 0;\n const upsert = input.upsert === true;\n // Rows may arrive as one chunk of a larger dataset; report row numbers\n // relative to the whole dataset so they match the source JSONL.\n const offset = typeof input.offset === \"number\" ? input.offset : 0;\n const total = typeof input.total === \"number\" ? input.total : input.users.length;\n\n for (let i = 0; i < input.users.length; i++) {\n try {\n if (upsert) {\n let existing;\n let lookupError;\n try {\n existing = await client.userByName(input.users[i].name);\n } catch (error) {\n existing = undefined;\n lookupError = error instanceof Error ? error.message : String(error);\n }\n\n if (existing) {\n const { name, ...attributes } = input.users[i];\n if (Object.keys(attributes).length === 0) {\n skipped++;\n } else {\n await client.updateUser({ id: existing.id, ...attributes });\n updated++;\n }\n } else {\n try {\n await client.createUser(input.users[i]);\n created++;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n throw new Error(\n lookupError ? \\`create failed (\\${message}); lookup failed (\\${lookupError})\\` : message,\n );\n }\n }\n } else {\n await client.createUser(input.users[i]);\n created++;\n }\n processed++;\n console.log(\\`[_User] \\${offset + i + 1}/\\${total}: \\${input.users[i].name}\\`);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n errors.push(\\`Row \\${offset + i + 1} (\\${input.users[i].name}): \\${message}\\`);\n console.error(\\`[_User] Row \\${offset + i + 1} failed: \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n processed,\n created,\n updated,\n skipped,\n errors,\n };\n }\n `;\n}\n\nconst listIdpUsersFunction = ml /* ts */ `\n async function listUsers(client) {\n let after = undefined;\n const users = [];\n do {\n const response = await client.users(after ? { after } : undefined);\n for (const user of response.users || []) {\n users.push({ id: user.id, name: user.name });\n }\n after = response.nextPageToken;\n } while (after);\n console.log(\\`Found \\${users.length} IDP users to delete\\`);\n return users;\n }\n`;\n\n/**\n * Generates the server-side script that lists every IdP user for truncation.\n * @param idpNamespace - The IDP namespace name\n * @returns Script code string\n */\nexport function generateIdpListUsersScriptCode(idpNamespace: string): string {\n return ml /* ts */ `\n ${listIdpUsersFunction}\n\n export async function main() {\n const client = new tailor.idp.Client({ namespace: \"${idpNamespace}\" });\n const users = await listUsers(client);\n return { success: true, users };\n }\n `;\n}\n\n/**\n * Generates the server-side IDP truncation script code.\n * Deletes the users passed in `input.users` (one chunk of the listing produced by\n * {@link generateIdpListUsersScriptCode}), or every user when no chunk is passed so\n * older seed plugins that call it without input keep working. A user that is already\n * gone counts as deleted.\n * @param idpNamespace - The IDP namespace name\n * @returns Script code string\n */\nexport function generateIdpTruncateScriptCode(idpNamespace: string): string {\n return ml /* ts */ `\n ${listIdpUsersFunction}\n\n export async function main(input) {\n const client = new tailor.idp.Client({ namespace: \"${idpNamespace}\" });\n const errors = [];\n let deleted = 0;\n let notFound = 0;\n const users = Array.isArray(input.users) ? input.users : await listUsers(client);\n const offset = typeof input.offset === \"number\" ? input.offset : 0;\n const total = typeof input.total === \"number\" ? input.total : users.length;\n\n for (let i = 0; i < users.length; i++) {\n const user = users[i];\n try {\n await client.deleteUser(user.id);\n deleted++;\n console.log(\\`[_User] Deleted \\${offset + i + 1}/\\${total}: \\${user.name}\\`);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (/user not found/i.test(message)) {\n notFound++;\n console.log(\\`[_User] Already deleted \\${offset + i + 1}/\\${total}: \\${user.name}\\`);\n continue;\n }\n errors.push(\\`User \\${user.id} (\\${user.name}): \\${message}\\`);\n console.error(\\`[_User] Delete failed for \\${user.name}: \\${message}\\`);\n }\n }\n\n return {\n success: errors.length === 0,\n deleted,\n notFound,\n total: users.length,\n errors,\n };\n }\n `;\n}\n\ntype GenerateIdpUserSchemaFileOptions = {\n usernameField: string;\n userTableName: string;\n /**\n * When `true` (default), emit a foreign key from `_User.name` to the\n * userProfile table's username field so that seed validation rejects `_User`\n * rows without a matching userProfile row. Set to `false` to seed `_User`\n * rows that do not yet have a corresponding userProfile row.\n */\n includeUserProfileFK?: boolean;\n};\n\n/**\n * Generates the schema file content for IdP users. Emits the\n * `_User.name -> <userProfile>.<usernameField>` foreign key by default; pass\n * `includeUserProfileFK: false` to omit it (e.g. when seeding `_User` rows\n * that do not yet have a corresponding userProfile row).\n * @param options - Schema generation options\n * @param options.usernameField - Username field name\n * @param options.userTableName - TailorDB user table name\n * @param options.includeUserProfileFK - Whether to emit the `_User -> userProfile` foreign key (default `true`)\n * @returns Schema file contents\n */\nexport function generateIdpUserSchemaFile(options: GenerateIdpUserSchemaFileOptions): string {\n const { usernameField, userTableName, includeUserProfileFK = true } = options;\n const schemaBody = includeUserProfileFK\n ? ml`\n primaryKey: \"name\",\n indexes: [\n { name: \"_user_name_unique_idx\", columns: [\"name\"], unique: true },\n ],\n foreignKeys: [\n {\n column: \"name\",\n references: {\n table: \"${userTableName}\",\n column: \"${usernameField}\",\n },\n },\n ],\n `\n : ml`\n primaryKey: \"name\",\n indexes: [\n { name: \"_user_name_unique_idx\", columns: [\"name\"], unique: true },\n ],\n `;\n\n return ml /* ts */ `\n import { t } from \"@tailor-platform/sdk\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createStandardSchema } from \"@tailor-platform/sdk/test\";\n\n const schemaType = t.object({\n name: t.string(),\n password: t.string(),\n });\n\n // Simple identity hook for _User (no TailorDB backing table)\n export const hook = <T>(data: unknown) => data as T;\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook),\n {\n ${schemaBody}\n }\n );\n\n `;\n}\n","import { isPluginGeneratedTable } from \"#/parser/service/tailordb/type-source\";\nimport ml from \"#/utils/multiline\";\nimport type {\n ParsedField,\n PluginGeneratedTableSource,\n TailorDBType,\n TypeSourceInfoEntry,\n} from \"#/parser/service/tailordb/types\";\nimport type { LinesDbMetadata } from \"./types\";\nimport type { ForeignKeyDefinition, IndexDefinition } from \"@toiroakr/lines-db\";\n\n/**\n * Processes TailorDB tables to generate lines-db metadata\n * @param type - Parsed TailorDB table\n * @param source - Source file info\n * @returns Generated lines-db metadata\n */\nexport function processLinesDb(type: TailorDBType, source: TypeSourceInfoEntry): LinesDbMetadata {\n if (isPluginGeneratedTable(source)) {\n // Plugin-generated table\n return processLinesDbForPluginTable(type, source);\n }\n\n // User-defined table\n if (!source.filePath) {\n throw new Error(`Missing source info for table ${type.name}`);\n }\n if (!source.exportName) {\n throw new Error(`Missing export name for table ${type.name}`);\n }\n\n const { optionalFields, omitFields, indexes, foreignKeys } = extractFieldMetadata(type);\n\n return {\n tableName: type.name,\n exportName: source.exportName,\n importPath: source.filePath,\n optionalFields,\n omitFields,\n foreignKeys,\n indexes,\n };\n}\n\n/**\n * Process lines-db metadata for plugin-generated tables\n * @param type - Parsed TailorDB table\n * @param source - Plugin-generated table source info\n * @returns Generated lines-db metadata with plugin source\n */\nfunction processLinesDbForPluginTable(\n type: TailorDBType,\n source: PluginGeneratedTableSource,\n): LinesDbMetadata {\n const { optionalFields, omitFields, indexes, foreignKeys } = extractFieldMetadata(type);\n\n return {\n tableName: type.name,\n exportName: source.exportName,\n importPath: \"\",\n optionalFields,\n omitFields,\n foreignKeys,\n indexes,\n pluginSource: source,\n };\n}\n\n/**\n * Whether the platform produces a value for the field on create when a row omits it,\n * either from a create hook or from a schema default. Such fields stay optional in seed\n * data even when the table marks them required.\n * @param field - Parsed TailorDB field\n * @returns True when a seed row does not have to supply the field\n */\nfunction isGeneratedOnCreate(field: ParsedField): boolean {\n return field.config.hooks?.create !== undefined || field.config.default !== undefined;\n}\n\n/**\n * Extract field metadata from TailorDB table\n * @param type - Parsed TailorDB table\n * @returns Field metadata including optional fields, omit fields, indexes, and foreign keys\n */\nfunction extractFieldMetadata(type: TailorDBType): {\n optionalFields: string[];\n omitFields: string[];\n indexes: IndexDefinition[];\n foreignKeys: ForeignKeyDefinition[];\n} {\n const optionalFields = [\"id\"]; // id is always optional\n const omitFields: string[] = [];\n const indexes: IndexDefinition[] = [];\n const foreignKeys: ForeignKeyDefinition[] = [];\n\n // Find fields generated on create, or serial\n for (const [fieldName, field] of Object.entries(type.fields)) {\n if (isGeneratedOnCreate(field)) {\n optionalFields.push(fieldName);\n }\n // Serial fields are auto-generated, so they are excluded from the seed schema entirely\n if (field.config.serial) {\n omitFields.push(fieldName);\n }\n if (field.config.unique) {\n indexes.push({\n name: `${type.name.toLowerCase()}_${fieldName}_unique_idx`,\n columns: [fieldName],\n unique: true,\n });\n }\n }\n\n // Extract indexes\n if (type.indexes) {\n for (const [indexName, indexDef] of Object.entries(type.indexes)) {\n indexes.push({\n name: indexName,\n columns: indexDef.fields,\n unique: indexDef.unique,\n });\n }\n }\n\n // Extract foreign keys from relations\n for (const [fieldName, field] of Object.entries(type.fields)) {\n if (field.relation) {\n foreignKeys.push({\n column: fieldName,\n references: {\n table: field.relation.targetType,\n column: field.relation.key,\n },\n });\n }\n }\n\n return { optionalFields, omitFields, indexes, foreignKeys };\n}\n\n/**\n * Generate schema options code for lines-db\n * @param foreignKeys - Foreign key definitions\n * @param indexes - Index definitions\n * @returns Schema options code string\n */\nfunction generateSchemaOptions(\n foreignKeys: ForeignKeyDefinition[],\n indexes: IndexDefinition[],\n): string {\n const schemaOptions: string[] = [];\n\n if (foreignKeys.length > 0) {\n schemaOptions.push(`foreignKeys: [`);\n foreignKeys.forEach((fk) => {\n schemaOptions.push(` ${JSON.stringify(fk)},`);\n });\n schemaOptions.push(`],`);\n }\n\n if (indexes.length > 0) {\n schemaOptions.push(`indexes: [`);\n indexes.forEach((index) => {\n schemaOptions.push(` ${JSON.stringify(index)},`);\n });\n schemaOptions.push(\"],\");\n }\n\n return schemaOptions.length > 0\n ? [\"\\n {\", ...schemaOptions.map((option) => ` ${option}`), \" }\"].join(\"\\n\")\n : \"\";\n}\n\n/**\n * Generates the schema file content for lines-db (for user-defined tables with import)\n * @param metadata - lines-db metadata\n * @param importPath - Import path for the TailorDB table\n * @returns Schema file contents\n */\nexport function generateLinesDbSchemaFile(metadata: LinesDbMetadata, importPath: string): string {\n const { exportName, optionalFields, omitFields, foreignKeys, indexes } = metadata;\n\n const schemaTypeCode = ml /* ts */ `\n const schemaType = t.object({\n ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),\n ...${exportName}.omitFields(${JSON.stringify([...optionalFields, ...omitFields])}),\n });\n `;\n\n const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);\n\n return ml /* ts */ `\n import { t } from \"@tailor-platform/sdk\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createTailorDBHook, createStandardSchema } from \"@tailor-platform/sdk/test\";\n import { ${exportName} } from \"${importPath}\";\n\n ${schemaTypeCode}\n\n export const hook = createTailorDBHook(${exportName});\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}\n );\n\n `;\n}\n\n/**\n * Parameters for generating a plugin-generated table's schema file\n */\nexport interface PluginSchemaParams {\n /** Relative path from schema output to tailor.config.ts */\n configImportPath: string;\n /** Relative import path to the original table file (for table-attached plugins) */\n originalImportPath?: string;\n}\n\n/**\n * Generates the schema file content using getGeneratedTable API\n * (for plugin-generated tables)\n * @param metadata - lines-db metadata (must have pluginSource)\n * @param params - Plugin import paths\n * @returns Schema file contents\n */\nexport function generateLinesDbSchemaFileWithPluginAPI(\n metadata: LinesDbMetadata,\n params: PluginSchemaParams,\n): string {\n const { tableName, exportName, optionalFields, omitFields, foreignKeys, indexes, pluginSource } =\n metadata;\n\n if (!pluginSource) {\n throw new Error(`pluginSource is required for plugin-generated table \"${tableName}\"`);\n }\n\n const { configImportPath, originalImportPath } = params;\n\n const schemaTypeCode = ml /* ts */ `\n const schemaType = t.object({\n ...${exportName}.pickFields(${JSON.stringify(optionalFields)}, { optional: true }),\n ...${exportName}.omitFields(${JSON.stringify([...optionalFields, ...omitFields])}),\n });\n `;\n\n const schemaOptionsCode = generateSchemaOptions(foreignKeys, indexes);\n\n // Table-attached plugin (e.g., changeset): import the original table and use getGeneratedTable(configPath, pluginId, table, kind)\n if (pluginSource.originalExportName && originalImportPath && pluginSource.generatedTableKind) {\n return ml /* ts */ `\n import { join } from \"node:path\";\n import { t } from \"@tailor-platform/sdk\";\n import { getGeneratedTable } from \"@tailor-platform/sdk/plugin\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createTailorDBHook, createStandardSchema } from \"@tailor-platform/sdk/test\";\n import { ${pluginSource.originalExportName} } from \"${originalImportPath}\";\n\n const configPath = join(import.meta.dirname, \"${configImportPath}\");\n const ${exportName} = await getGeneratedTable(configPath, \"${pluginSource.pluginId}\", ${pluginSource.originalExportName}, \"${pluginSource.generatedTableKind}\");\n\n ${schemaTypeCode}\n\n export const hook = createTailorDBHook(${exportName});\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}\n );\n\n `;\n }\n\n // Namespace plugin (e.g., audit-log): use getGeneratedTable(configPath, pluginId, null, kind)\n // For namespace plugins, generatedTableKind is required\n if (!pluginSource.generatedTableKind) {\n throw new Error(\n `Namespace plugin \"${pluginSource.pluginId}\" must provide generatedTableKind for table \"${tableName}\"`,\n );\n }\n\n return ml /* ts */ `\n import { join } from \"node:path\";\n import { t } from \"@tailor-platform/sdk\";\n import { getGeneratedTable } from \"@tailor-platform/sdk/plugin\";\n import { defineSchema } from \"@tailor-platform/sdk/seed\";\n import { createTailorDBHook, createStandardSchema } from \"@tailor-platform/sdk/test\";\n\n const configPath = join(import.meta.dirname, \"${configImportPath}\");\n const ${exportName} = await getGeneratedTable(configPath, \"${pluginSource.pluginId}\", null, \"${pluginSource.generatedTableKind}\");\n\n ${schemaTypeCode}\n\n export const hook = createTailorDBHook(${exportName});\n\n export const schema = defineSchema(\n createStandardSchema(schemaType, hook, ${exportName}),${schemaOptionsCode}\n );\n\n `;\n}\n","import * as path from \"pathe\";\nimport { assertDefined } from \"#/utils/assert\";\nimport { processIdpUser, generateIdpUserSchemaFile } from \"./idp-user-processor\";\nimport {\n processLinesDb,\n generateLinesDbSchemaFile,\n generateLinesDbSchemaFileWithPluginAPI,\n type PluginSchemaParams,\n} from \"./lines-db-processor\";\nimport type { Plugin, GeneratorResult, TailorDBReadyContext } from \"#/plugin/types\";\n\n/** Unique identifier for the seed generator plugin. */\nexport const SeedGeneratorID = \"@tailor-platform/seed\";\n\ntype DisableIdpUserSyncDirections = {\n /**\n * Skip emitting the foreign key from `<userProfile>.<usernameField>` to\n * `_User.name`. Defaults to `false` (FK emitted).\n *\n * Set to `true` to seed pre-registration states such as\n * invited-but-not-registered users.\n */\n userToIdp?: boolean;\n /**\n * Skip emitting the foreign key from `_User.name` to\n * `<userProfile>.<usernameField>`. Defaults to `false` (FK emitted).\n *\n * Set to `true` to seed `_User` rows that do not yet have a corresponding\n * userProfile row.\n */\n idpToUser?: boolean;\n};\n\nexport type SeedPluginOptions = {\n distPath: string;\n machineUserName?: string;\n /**\n * Disable individual `_User <-> userProfile` foreign keys emitted into\n * the generated seed schema. Both directions are emitted by default.\n *\n * Set a direction to `true` to relax it — for example to seed invited\n * users that do not yet have an IdP credential.\n */\n disableIdpUserSync?: DisableIdpUserSyncDirections;\n};\n\ndeclare module \"@tailor-platform/sdk/plugin\" {\n interface PluginConfigRegistry {\n \"@tailor-platform/seed\": SeedPluginOptions;\n }\n}\n\nfunction resolveIdpUserSyncFKs(option: SeedPluginOptions[\"disableIdpUserSync\"]): {\n emitUserToIdpFK: boolean;\n emitIdpToUserFK: boolean;\n} {\n return {\n emitUserToIdpFK: !(option?.userToIdp ?? false),\n emitIdpToUserFK: !(option?.idpToUser ?? false),\n };\n}\n/**\n * Plugin that generates seed data and schema files consumed by the\n * `tailor seed` commands (@tailor-platform/sdk-plugin-seed).\n * @param options - Plugin options\n * @param options.distPath - Output directory path for generated seed files\n * @param options.machineUserName - Default machine user name for authentication\n * @param options.disableIdpUserSync - Skip emitting individual `_User <-> userProfile` foreign keys. Both directions are emitted by default; set a direction to `true` to relax that side.\n * @returns Plugin instance with onTailorDBReady hook\n */\nexport function seedPlugin(options: SeedPluginOptions): Plugin<unknown, SeedPluginOptions> {\n return {\n id: SeedGeneratorID,\n description: \"Generates seed data and schema files for the tailor seed CLI plugin\",\n pluginConfig: options,\n\n async onTailorDBReady(ctx: TailorDBReadyContext<SeedPluginOptions>): Promise<GeneratorResult> {\n const files: GeneratorResult[\"files\"] = [];\n\n // Process IdP user early so we can add reverse FK to the user profile type\n const idpUser = ctx.auth ? (processIdpUser(ctx.auth) ?? null) : null;\n const idpUserSyncFKs = resolveIdpUserSyncFKs(ctx.pluginConfig.disableIdpUserSync);\n\n for (const ns of ctx.tailordb) {\n for (const [tableName, type] of Object.entries(ns.tables)) {\n const source = assertDefined(\n ns.sourceInfo.get(tableName),\n `source info missing for table: ${tableName}`,\n );\n const linesDb = processLinesDb(type, source);\n\n // Add reverse FK from userProfile table to _User (opt-out via disableIdpUserSync.userToIdp: true)\n if (\n idpUserSyncFKs.emitUserToIdpFK &&\n idpUser &&\n tableName === idpUser.schema.userTableName\n ) {\n linesDb.foreignKeys.push({\n column: idpUser.schema.usernameField,\n references: {\n table: \"_User\",\n column: \"name\",\n },\n });\n }\n\n // Generate empty JSONL data file\n files.push({\n path: path.join(ctx.pluginConfig.distPath, \"data\", `${linesDb.tableName}.jsonl`),\n content: \"\",\n skipIfExists: true,\n });\n\n const schemaOutputPath = path.join(\n ctx.pluginConfig.distPath,\n \"data\",\n `${linesDb.tableName}.schema.ts`,\n );\n\n // Plugin-generated table: use getGeneratedTable API\n if (linesDb.pluginSource && linesDb.pluginSource.pluginImportPath) {\n // Build original type import path\n let originalImportPath: string | undefined;\n if (linesDb.pluginSource.originalFilePath && linesDb.pluginSource.originalExportName) {\n const relativePath = path.relative(\n path.dirname(schemaOutputPath),\n linesDb.pluginSource.originalFilePath,\n );\n originalImportPath = relativePath.replace(/\\.ts$/, \"\").startsWith(\".\")\n ? relativePath.replace(/\\.ts$/, \"\")\n : `./${relativePath.replace(/\\.ts$/, \"\")}`;\n }\n\n // Compute relative path from schema output to config file\n const configImportPath = path.relative(path.dirname(schemaOutputPath), ctx.configPath);\n\n const params: PluginSchemaParams = {\n configImportPath,\n originalImportPath,\n };\n\n const schemaContent = generateLinesDbSchemaFileWithPluginAPI(linesDb, params);\n\n files.push({\n path: schemaOutputPath,\n content: schemaContent,\n });\n } else {\n // User-defined type: import from source file\n const relativePath = path.relative(path.dirname(schemaOutputPath), linesDb.importPath);\n const typeImportPath = relativePath.replace(/\\.ts$/, \"\").startsWith(\".\")\n ? relativePath.replace(/\\.ts$/, \"\")\n : `./${relativePath.replace(/\\.ts$/, \"\")}`;\n const schemaContent = generateLinesDbSchemaFile(linesDb, typeImportPath);\n\n files.push({\n path: schemaOutputPath,\n content: schemaContent,\n });\n }\n }\n }\n\n if (idpUser) {\n // Generate empty JSONL data file\n files.push({\n path: path.join(ctx.pluginConfig.distPath, idpUser.dataFile),\n content: \"\",\n skipIfExists: true,\n });\n\n // Generate schema file with foreign key (opt-out via disableIdpUserSync.idpToUser: true)\n files.push({\n path: path.join(ctx.pluginConfig.distPath, \"data\", `${idpUser.name}.schema.ts`),\n content: generateIdpUserSchemaFile({\n usernameField: idpUser.schema.usernameField,\n userTableName: idpUser.schema.userTableName,\n includeUserProfileFK: idpUserSyncFKs.emitIdpToUserFK,\n }),\n });\n }\n\n return { files };\n },\n };\n}\n"],"mappings":"yJAmBA,SAAgB,eAAe,EAAuD,CAEpF,GAAI,EAAK,YAAY,OAAS,cAAgB,CAAC,EAAK,YAClD,OAGF,GAAM,CAAE,YAAW,iBAAkB,EAAK,YAE1C,MAAO,CACL,KAAM,QACN,aAAc,CAAC,CAAS,EACxB,SAAU,mBACV,aAAc,EAAK,WAAW,UAC9B,OAAQ,CACN,gBACA,cAAe,CACjB,CACF,CACF,CAQA,SAAgB,0BAA0B,EAA8B,CACtE,MAAO,EAAY;;2DAEsC,EAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkExE,CAEA,MAAM,EAAuB,CAAY;;;;;;;;;;;;;;EAqBzC,SAAgB,+BAA+B,EAA8B,CAC3E,MAAO,EAAY;MACf,EAAqB;;;2DAGgC,EAAa;;;;GAKxE,CAWA,SAAgB,8BAA8B,EAA8B,CAC1E,MAAO,EAAY;MACf,EAAqB;;;2DAGgC,EAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCxE,CAyBA,SAAgB,0BAA0B,EAAmD,CAC3F,GAAM,CAAE,gBAAe,gBAAe,uBAAuB,IAAS,EAChE,EAAa,EACf,CAAE;;;;;;;;;sBASc,EAAc;uBACb,EAAc;;;;MA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EAAE,GAC8B,EAEvE,EAAM,KAAK,CACT,KAAM,EACN,QAAS,CACX,CAAC,CACH,CACF,CAsBF,OAnBI,IAEF,EAAM,KAAK,CACT,KAAM,EAAK,KAAK,EAAI,aAAa,SAAU,EAAQ,QAAQ,EAC3D,QAAS,GACT,aAAc,EAChB,CAAC,EAGD,EAAM,KAAK,CACT,KAAM,EAAK,KAAK,EAAI,aAAa,SAAU,OAAQ,GAAG,EAAQ,KAAK,WAAW,EAC9E,QAAS,0BAA0B,CACjC,cAAe,EAAQ,OAAO,cAC9B,cAAe,EAAQ,OAAO,cAC9B,qBAAsB,EAAe,eACvC,CAAC,CACH,CAAC,GAGI,CAAE,OAAM,CACjB,CACF,CACF"}
package/docs/cli/user.md CHANGED
@@ -135,9 +135,15 @@ Show current user.
135
135
  **Usage**
136
136
 
137
137
  ```
138
- tailor user current
138
+ tailor user current [options]
139
139
  ```
140
140
 
141
+ **Options**
142
+
143
+ | Option | Alias | Description | Required | Default | Env |
144
+ | --------------------- | ----- | ----------------- | -------- | ------- | ------------------------- |
145
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
146
+
141
147
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
142
148
 
143
149
  ### user list
@@ -147,9 +153,15 @@ List all users.
147
153
  **Usage**
148
154
 
149
155
  ```
150
- tailor user list
156
+ tailor user list [options]
151
157
  ```
152
158
 
159
+ **Options**
160
+
161
+ | Option | Alias | Description | Required | Default | Env |
162
+ | --------------------- | ----- | ----------------- | -------- | ------- | ------------------------- |
163
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
164
+
153
165
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
154
166
 
155
167
  ### user pat
@@ -191,9 +203,10 @@ tailor user pat create [options] <name>
191
203
 
192
204
  **Options**
193
205
 
194
- | Option | Alias | Description | Required | Default |
195
- | --------- | ----- | ------------------------------------------- | -------- | ------- |
196
- | `--write` | `-W` | Grant write permission (default: read-only) | No | `false` |
206
+ | Option | Alias | Description | Required | Default | Env |
207
+ | --------------------- | ----- | ------------------------------------------- | -------- | ------- | ------------------------- |
208
+ | `--write` | `-W` | Grant write permission (default: read-only) | No | `false` | - |
209
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
197
210
 
198
211
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
199
212
 
@@ -204,7 +217,7 @@ Delete a personal access token.
204
217
  **Usage**
205
218
 
206
219
  ```
207
- tailor user pat delete <name>
220
+ tailor user pat delete [options] <name>
208
221
  ```
209
222
 
210
223
  **Arguments**
@@ -213,6 +226,12 @@ tailor user pat delete <name>
213
226
  | -------- | ----------- | -------- |
214
227
  | `name` | Token name | Yes |
215
228
 
229
+ **Options**
230
+
231
+ | Option | Alias | Description | Required | Default | Env |
232
+ | --------------------- | ----- | ----------------- | -------- | ------- | ------------------------- |
233
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
234
+
216
235
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
217
236
 
218
237
  #### user pat list
@@ -227,10 +246,11 @@ tailor user pat list [options]
227
246
 
228
247
  **Options**
229
248
 
230
- | Option | Alias | Description | Required | Default |
231
- | ----------------- | ----- | -------------------------------------------------------- | -------- | -------- |
232
- | `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` |
233
- | `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - |
249
+ | Option | Alias | Description | Required | Default | Env |
250
+ | --------------------- | ----- | -------------------------------------------------------- | -------- | -------- | ------------------------- |
251
+ | `--order <ORDER>` | - | Sort order (asc or desc) | No | `"desc"` | - |
252
+ | `--limit <LIMIT>` | `-l` | Maximum number of items to return (0 or omit: unlimited) | No | - | - |
253
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
234
254
 
235
255
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
236
256
 
@@ -252,9 +272,10 @@ tailor user pat update [options] <name>
252
272
 
253
273
  **Options**
254
274
 
255
- | Option | Alias | Description | Required | Default |
256
- | --------- | ----- | ---------------------------------------------------------- | -------- | ------- |
257
- | `--write` | `-W` | Grant write permission (if not specified, keeps read-only) | No | `false` |
275
+ | Option | Alias | Description | Required | Default | Env |
276
+ | --------------------- | ----- | ---------------------------------------------------------- | -------- | ------- | ------------------------- |
277
+ | `--write` | `-W` | Grant write permission (if not specified, keeps read-only) | No | `false` | - |
278
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
258
279
 
259
280
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
260
281
 
@@ -265,7 +286,7 @@ Set current user.
265
286
  **Usage**
266
287
 
267
288
  ```
268
- tailor user switch <user>
289
+ tailor user switch [options] <user>
269
290
  ```
270
291
 
271
292
  **Arguments**
@@ -274,6 +295,12 @@ tailor user switch <user>
274
295
  | -------- | -------------------------------------------- | -------- |
275
296
  | `user` | User email address or machine user client ID | Yes |
276
297
 
298
+ **Options**
299
+
300
+ | Option | Alias | Description | Required | Default | Env |
301
+ | --------------------- | ----- | ----------------- | -------- | ------- | ------------------------- |
302
+ | `--profile <PROFILE>` | `-p` | Workspace profile | No | - | `TAILOR_PLATFORM_PROFILE` |
303
+
277
304
  See [Global Options](../cli-reference.md#global-options) for options available to all commands.
278
305
  When no subcommand is provided, defaults to `list`.
279
306
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailor-platform/sdk",
3
- "version": "2.12.0",
3
+ "version": "2.13.1",
4
4
  "description": "Tailor Platform SDK - The SDK to work with Tailor Platform",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -164,7 +164,7 @@
164
164
  "@opentelemetry/resources": "2.10.0",
165
165
  "@opentelemetry/sdk-trace-node": "2.10.0",
166
166
  "@opentelemetry/semantic-conventions": "1.43.0",
167
- "@oxc-project/types": "0.147.0",
167
+ "@oxc-project/types": "0.148.0",
168
168
  "@secretlint/core": "13.0.5",
169
169
  "@secretlint/secretlint-rule-preset-recommend": "13.0.5",
170
170
  "@standard-schema/spec": "1.1.0",
@@ -185,8 +185,8 @@
185
185
  "kysely": "0.29.5",
186
186
  "mime-types": "3.0.2",
187
187
  "open": "11.0.2",
188
- "oxc-parser": "0.147.0",
189
- "p-limit": "7.3.1",
188
+ "oxc-parser": "0.148.0",
189
+ "p-limit": "7.3.2",
190
190
  "pathe": "2.0.3",
191
191
  "pgsql-ast-parser": "12.0.2",
192
192
  "pkg-types": "2.3.1",
@@ -196,7 +196,7 @@
196
196
  "sql-highlight": "6.1.0",
197
197
  "std-env": "4.2.0",
198
198
  "ts-cron-validator": "1.1.5",
199
- "type-fest": "5.8.0",
199
+ "type-fest": "5.9.0",
200
200
  "xdg-basedir": "5.1.0",
201
201
  "zod": "4.5.4"
202
202
  },
@@ -209,9 +209,9 @@
209
209
  "@types/semver": "7.8.0",
210
210
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
211
211
  "@vitest/coverage-v8": "4.1.11",
212
- "eslint-plugin-zod": "4.10.0",
213
- "oxfmt": "0.65.0",
214
- "oxlint": "1.80.0",
212
+ "eslint-plugin-zod": "4.12.0",
213
+ "oxfmt": "0.66.0",
214
+ "oxlint": "1.81.0",
215
215
  "oxlint-tsgolint": "7.0.2001",
216
216
  "sonda": "0.14.0",
217
217
  "tsdown": "0.22.14",