@fern-api/generator-migrations 0.0.1 → 0.0.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["typescriptSdkMigrations"],"sources":["../../../../node_modules/.pnpm/immer@10.1.3/node_modules/immer/dist/immer.mjs","../../../migrations-base/lib/utils.js","../../src/generators/typescript/migrations/1.0.0.ts","../../src/generators/typescript/migrations/2.0.0.ts","../../src/generators/typescript/migrations/3.0.0.ts","../../src/generators/typescript/migrations/index.ts","../../src/index.ts"],"sourcesContent":["// src/utils/env.ts\nvar NOTHING = Symbol.for(\"immer-nothing\");\nvar DRAFTABLE = Symbol.for(\"immer-draftable\");\nvar DRAFT_STATE = Symbol.for(\"immer-state\");\n\n// src/utils/errors.ts\nvar errors = process.env.NODE_ENV !== \"production\" ? [\n // All error codes, starting by 0:\n function(plugin) {\n return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \\`enable${plugin}()\\` when initializing your application.`;\n },\n function(thing) {\n return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`;\n },\n \"This object has been frozen and should not be mutated\",\n function(data) {\n return \"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? \" + data;\n },\n \"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.\",\n \"Immer forbids circular references\",\n \"The first or second argument to `produce` must be a function\",\n \"The third argument to `produce` must be a function or undefined\",\n \"First argument to `createDraft` must be a plain object, an array, or an immerable object\",\n \"First argument to `finishDraft` must be a draft returned by `createDraft`\",\n function(thing) {\n return `'current' expects a draft, got: ${thing}`;\n },\n \"Object.defineProperty() cannot be used on an Immer draft\",\n \"Object.setPrototypeOf() cannot be used on an Immer draft\",\n \"Immer only supports deleting array indices\",\n \"Immer only supports setting array indices and the 'length' property\",\n function(thing) {\n return `'original' expects a draft, got: ${thing}`;\n }\n // Note: if more errors are added, the errorOffset in Patches.ts should be increased\n // See Patches.ts for additional errors\n] : [];\nfunction die(error, ...args) {\n if (process.env.NODE_ENV !== \"production\") {\n const e = errors[error];\n const msg = typeof e === \"function\" ? e.apply(null, args) : e;\n throw new Error(`[Immer] ${msg}`);\n }\n throw new Error(\n `[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`\n );\n}\n\n// src/utils/common.ts\nvar getPrototypeOf = Object.getPrototypeOf;\nfunction isDraft(value) {\n return !!value && !!value[DRAFT_STATE];\n}\nfunction isDraftable(value) {\n if (!value)\n return false;\n return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);\n}\nvar objectCtorString = Object.prototype.constructor.toString();\nfunction isPlainObject(value) {\n if (!value || typeof value !== \"object\")\n return false;\n const proto = getPrototypeOf(value);\n if (proto === null) {\n return true;\n }\n const Ctor = Object.hasOwnProperty.call(proto, \"constructor\") && proto.constructor;\n if (Ctor === Object)\n return true;\n return typeof Ctor == \"function\" && Function.toString.call(Ctor) === objectCtorString;\n}\nfunction original(value) {\n if (!isDraft(value))\n die(15, value);\n return value[DRAFT_STATE].base_;\n}\nfunction each(obj, iter) {\n if (getArchtype(obj) === 0 /* Object */) {\n Reflect.ownKeys(obj).forEach((key) => {\n iter(key, obj[key], obj);\n });\n } else {\n obj.forEach((entry, index) => iter(index, entry, obj));\n }\n}\nfunction getArchtype(thing) {\n const state = thing[DRAFT_STATE];\n return state ? state.type_ : Array.isArray(thing) ? 1 /* Array */ : isMap(thing) ? 2 /* Map */ : isSet(thing) ? 3 /* Set */ : 0 /* Object */;\n}\nfunction has(thing, prop) {\n return getArchtype(thing) === 2 /* Map */ ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);\n}\nfunction get(thing, prop) {\n return getArchtype(thing) === 2 /* Map */ ? thing.get(prop) : thing[prop];\n}\nfunction set(thing, propOrOldValue, value) {\n const t = getArchtype(thing);\n if (t === 2 /* Map */)\n thing.set(propOrOldValue, value);\n else if (t === 3 /* Set */) {\n thing.add(value);\n } else\n thing[propOrOldValue] = value;\n}\nfunction is(x, y) {\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y;\n } else {\n return x !== x && y !== y;\n }\n}\nfunction isMap(target) {\n return target instanceof Map;\n}\nfunction isSet(target) {\n return target instanceof Set;\n}\nfunction latest(state) {\n return state.copy_ || state.base_;\n}\nfunction shallowCopy(base, strict) {\n if (isMap(base)) {\n return new Map(base);\n }\n if (isSet(base)) {\n return new Set(base);\n }\n if (Array.isArray(base))\n return Array.prototype.slice.call(base);\n const isPlain = isPlainObject(base);\n if (strict === true || strict === \"class_only\" && !isPlain) {\n const descriptors = Object.getOwnPropertyDescriptors(base);\n delete descriptors[DRAFT_STATE];\n let keys = Reflect.ownKeys(descriptors);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const desc = descriptors[key];\n if (desc.writable === false) {\n desc.writable = true;\n desc.configurable = true;\n }\n if (desc.get || desc.set)\n descriptors[key] = {\n configurable: true,\n writable: true,\n // could live with !!desc.set as well here...\n enumerable: desc.enumerable,\n value: base[key]\n };\n }\n return Object.create(getPrototypeOf(base), descriptors);\n } else {\n const proto = getPrototypeOf(base);\n if (proto !== null && isPlain) {\n return { ...base };\n }\n const obj = Object.create(proto);\n return Object.assign(obj, base);\n }\n}\nfunction freeze(obj, deep = false) {\n if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))\n return obj;\n if (getArchtype(obj) > 1) {\n Object.defineProperties(obj, {\n set: { value: dontMutateFrozenCollections },\n add: { value: dontMutateFrozenCollections },\n clear: { value: dontMutateFrozenCollections },\n delete: { value: dontMutateFrozenCollections }\n });\n }\n Object.freeze(obj);\n if (deep)\n Object.values(obj).forEach((value) => freeze(value, true));\n return obj;\n}\nfunction dontMutateFrozenCollections() {\n die(2);\n}\nfunction isFrozen(obj) {\n return Object.isFrozen(obj);\n}\n\n// src/utils/plugins.ts\nvar plugins = {};\nfunction getPlugin(pluginKey) {\n const plugin = plugins[pluginKey];\n if (!plugin) {\n die(0, pluginKey);\n }\n return plugin;\n}\nfunction loadPlugin(pluginKey, implementation) {\n if (!plugins[pluginKey])\n plugins[pluginKey] = implementation;\n}\n\n// src/core/scope.ts\nvar currentScope;\nfunction getCurrentScope() {\n return currentScope;\n}\nfunction createScope(parent_, immer_) {\n return {\n drafts_: [],\n parent_,\n immer_,\n // Whenever the modified draft contains a draft from another scope, we\n // need to prevent auto-freezing so the unowned draft can be finalized.\n canAutoFreeze_: true,\n unfinalizedDrafts_: 0\n };\n}\nfunction usePatchesInScope(scope, patchListener) {\n if (patchListener) {\n getPlugin(\"Patches\");\n scope.patches_ = [];\n scope.inversePatches_ = [];\n scope.patchListener_ = patchListener;\n }\n}\nfunction revokeScope(scope) {\n leaveScope(scope);\n scope.drafts_.forEach(revokeDraft);\n scope.drafts_ = null;\n}\nfunction leaveScope(scope) {\n if (scope === currentScope) {\n currentScope = scope.parent_;\n }\n}\nfunction enterScope(immer2) {\n return currentScope = createScope(currentScope, immer2);\n}\nfunction revokeDraft(draft) {\n const state = draft[DRAFT_STATE];\n if (state.type_ === 0 /* Object */ || state.type_ === 1 /* Array */)\n state.revoke_();\n else\n state.revoked_ = true;\n}\n\n// src/core/finalize.ts\nfunction processResult(result, scope) {\n scope.unfinalizedDrafts_ = scope.drafts_.length;\n const baseDraft = scope.drafts_[0];\n const isReplaced = result !== void 0 && result !== baseDraft;\n if (isReplaced) {\n if (baseDraft[DRAFT_STATE].modified_) {\n revokeScope(scope);\n die(4);\n }\n if (isDraftable(result)) {\n result = finalize(scope, result);\n if (!scope.parent_)\n maybeFreeze(scope, result);\n }\n if (scope.patches_) {\n getPlugin(\"Patches\").generateReplacementPatches_(\n baseDraft[DRAFT_STATE].base_,\n result,\n scope.patches_,\n scope.inversePatches_\n );\n }\n } else {\n result = finalize(scope, baseDraft, []);\n }\n revokeScope(scope);\n if (scope.patches_) {\n scope.patchListener_(scope.patches_, scope.inversePatches_);\n }\n return result !== NOTHING ? result : void 0;\n}\nfunction finalize(rootScope, value, path) {\n if (isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n if (!state) {\n each(\n value,\n (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path)\n );\n return value;\n }\n if (state.scope_ !== rootScope)\n return value;\n if (!state.modified_) {\n maybeFreeze(rootScope, state.base_, true);\n return state.base_;\n }\n if (!state.finalized_) {\n state.finalized_ = true;\n state.scope_.unfinalizedDrafts_--;\n const result = state.copy_;\n let resultEach = result;\n let isSet2 = false;\n if (state.type_ === 3 /* Set */) {\n resultEach = new Set(result);\n result.clear();\n isSet2 = true;\n }\n each(\n resultEach,\n (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2)\n );\n maybeFreeze(rootScope, result, false);\n if (path && rootScope.patches_) {\n getPlugin(\"Patches\").generatePatches_(\n state,\n path,\n rootScope.patches_,\n rootScope.inversePatches_\n );\n }\n }\n return state.copy_;\n}\nfunction finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {\n if (process.env.NODE_ENV !== \"production\" && childValue === targetObject)\n die(5);\n if (isDraft(childValue)) {\n const path = rootPath && parentState && parentState.type_ !== 3 /* Set */ && // Set objects are atomic since they have no keys.\n !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;\n const res = finalize(rootScope, childValue, path);\n set(targetObject, prop, res);\n if (isDraft(res)) {\n rootScope.canAutoFreeze_ = false;\n } else\n return;\n } else if (targetIsSet) {\n targetObject.add(childValue);\n }\n if (isDraftable(childValue) && !isFrozen(childValue)) {\n if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {\n return;\n }\n finalize(rootScope, childValue);\n if ((!parentState || !parentState.scope_.parent_) && typeof prop !== \"symbol\" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)))\n maybeFreeze(rootScope, childValue);\n }\n}\nfunction maybeFreeze(scope, value, deep = false) {\n if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {\n freeze(value, deep);\n }\n}\n\n// src/core/proxy.ts\nfunction createProxyProxy(base, parent) {\n const isArray = Array.isArray(base);\n const state = {\n type_: isArray ? 1 /* Array */ : 0 /* Object */,\n // Track which produce call this is associated with.\n scope_: parent ? parent.scope_ : getCurrentScope(),\n // True for both shallow and deep changes.\n modified_: false,\n // Used during finalization.\n finalized_: false,\n // Track which properties have been assigned (true) or deleted (false).\n assigned_: {},\n // The parent draft state.\n parent_: parent,\n // The base state.\n base_: base,\n // The base proxy.\n draft_: null,\n // set below\n // The base copy with any updated values.\n copy_: null,\n // Called by the `produce` function.\n revoke_: null,\n isManual_: false\n };\n let target = state;\n let traps = objectTraps;\n if (isArray) {\n target = [state];\n traps = arrayTraps;\n }\n const { revoke, proxy } = Proxy.revocable(target, traps);\n state.draft_ = proxy;\n state.revoke_ = revoke;\n return proxy;\n}\nvar objectTraps = {\n get(state, prop) {\n if (prop === DRAFT_STATE)\n return state;\n const source = latest(state);\n if (!has(source, prop)) {\n return readPropFromProto(state, source, prop);\n }\n const value = source[prop];\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (value === peek(state.base_, prop)) {\n prepareCopy(state);\n return state.copy_[prop] = createProxy(value, state);\n }\n return value;\n },\n has(state, prop) {\n return prop in latest(state);\n },\n ownKeys(state) {\n return Reflect.ownKeys(latest(state));\n },\n set(state, prop, value) {\n const desc = getDescriptorFromProto(latest(state), prop);\n if (desc?.set) {\n desc.set.call(state.draft_, value);\n return true;\n }\n if (!state.modified_) {\n const current2 = peek(latest(state), prop);\n const currentState = current2?.[DRAFT_STATE];\n if (currentState && currentState.base_ === value) {\n state.copy_[prop] = value;\n state.assigned_[prop] = false;\n return true;\n }\n if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))\n return true;\n prepareCopy(state);\n markChanged(state);\n }\n if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'\n (value !== void 0 || prop in state.copy_) || // special case: NaN\n Number.isNaN(value) && Number.isNaN(state.copy_[prop]))\n return true;\n state.copy_[prop] = value;\n state.assigned_[prop] = true;\n return true;\n },\n deleteProperty(state, prop) {\n if (peek(state.base_, prop) !== void 0 || prop in state.base_) {\n state.assigned_[prop] = false;\n prepareCopy(state);\n markChanged(state);\n } else {\n delete state.assigned_[prop];\n }\n if (state.copy_) {\n delete state.copy_[prop];\n }\n return true;\n },\n // Note: We never coerce `desc.value` into an Immer draft, because we can't make\n // the same guarantee in ES5 mode.\n getOwnPropertyDescriptor(state, prop) {\n const owner = latest(state);\n const desc = Reflect.getOwnPropertyDescriptor(owner, prop);\n if (!desc)\n return desc;\n return {\n writable: true,\n configurable: state.type_ !== 1 /* Array */ || prop !== \"length\",\n enumerable: desc.enumerable,\n value: owner[prop]\n };\n },\n defineProperty() {\n die(11);\n },\n getPrototypeOf(state) {\n return getPrototypeOf(state.base_);\n },\n setPrototypeOf() {\n die(12);\n }\n};\nvar arrayTraps = {};\neach(objectTraps, (key, fn) => {\n arrayTraps[key] = function() {\n arguments[0] = arguments[0][0];\n return fn.apply(this, arguments);\n };\n});\narrayTraps.deleteProperty = function(state, prop) {\n if (process.env.NODE_ENV !== \"production\" && isNaN(parseInt(prop)))\n die(13);\n return arrayTraps.set.call(this, state, prop, void 0);\n};\narrayTraps.set = function(state, prop, value) {\n if (process.env.NODE_ENV !== \"production\" && prop !== \"length\" && isNaN(parseInt(prop)))\n die(14);\n return objectTraps.set.call(this, state[0], prop, value, state[0]);\n};\nfunction peek(draft, prop) {\n const state = draft[DRAFT_STATE];\n const source = state ? latest(state) : draft;\n return source[prop];\n}\nfunction readPropFromProto(state, source, prop) {\n const desc = getDescriptorFromProto(source, prop);\n return desc ? `value` in desc ? desc.value : (\n // This is a very special case, if the prop is a getter defined by the\n // prototype, we should invoke it with the draft as context!\n desc.get?.call(state.draft_)\n ) : void 0;\n}\nfunction getDescriptorFromProto(source, prop) {\n if (!(prop in source))\n return void 0;\n let proto = getPrototypeOf(source);\n while (proto) {\n const desc = Object.getOwnPropertyDescriptor(proto, prop);\n if (desc)\n return desc;\n proto = getPrototypeOf(proto);\n }\n return void 0;\n}\nfunction markChanged(state) {\n if (!state.modified_) {\n state.modified_ = true;\n if (state.parent_) {\n markChanged(state.parent_);\n }\n }\n}\nfunction prepareCopy(state) {\n if (!state.copy_) {\n state.copy_ = shallowCopy(\n state.base_,\n state.scope_.immer_.useStrictShallowCopy_\n );\n }\n}\n\n// src/core/immerClass.ts\nvar Immer2 = class {\n constructor(config) {\n this.autoFreeze_ = true;\n this.useStrictShallowCopy_ = false;\n /**\n * The `produce` function takes a value and a \"recipe function\" (whose\n * return value often depends on the base state). The recipe function is\n * free to mutate its first argument however it wants. All mutations are\n * only ever applied to a __copy__ of the base state.\n *\n * Pass only a function to create a \"curried producer\" which relieves you\n * from passing the recipe function every time.\n *\n * Only plain objects and arrays are made mutable. All other objects are\n * considered uncopyable.\n *\n * Note: This function is __bound__ to its `Immer` instance.\n *\n * @param {any} base - the initial state\n * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified\n * @param {Function} patchListener - optional function that will be called with all the patches produced here\n * @returns {any} a new state, or the initial state if nothing was modified\n */\n this.produce = (base, recipe, patchListener) => {\n if (typeof base === \"function\" && typeof recipe !== \"function\") {\n const defaultBase = recipe;\n recipe = base;\n const self = this;\n return function curriedProduce(base2 = defaultBase, ...args) {\n return self.produce(base2, (draft) => recipe.call(this, draft, ...args));\n };\n }\n if (typeof recipe !== \"function\")\n die(6);\n if (patchListener !== void 0 && typeof patchListener !== \"function\")\n die(7);\n let result;\n if (isDraftable(base)) {\n const scope = enterScope(this);\n const proxy = createProxy(base, void 0);\n let hasError = true;\n try {\n result = recipe(proxy);\n hasError = false;\n } finally {\n if (hasError)\n revokeScope(scope);\n else\n leaveScope(scope);\n }\n usePatchesInScope(scope, patchListener);\n return processResult(result, scope);\n } else if (!base || typeof base !== \"object\") {\n result = recipe(base);\n if (result === void 0)\n result = base;\n if (result === NOTHING)\n result = void 0;\n if (this.autoFreeze_)\n freeze(result, true);\n if (patchListener) {\n const p = [];\n const ip = [];\n getPlugin(\"Patches\").generateReplacementPatches_(base, result, p, ip);\n patchListener(p, ip);\n }\n return result;\n } else\n die(1, base);\n };\n this.produceWithPatches = (base, recipe) => {\n if (typeof base === \"function\") {\n return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));\n }\n let patches, inversePatches;\n const result = this.produce(base, recipe, (p, ip) => {\n patches = p;\n inversePatches = ip;\n });\n return [result, patches, inversePatches];\n };\n if (typeof config?.autoFreeze === \"boolean\")\n this.setAutoFreeze(config.autoFreeze);\n if (typeof config?.useStrictShallowCopy === \"boolean\")\n this.setUseStrictShallowCopy(config.useStrictShallowCopy);\n }\n createDraft(base) {\n if (!isDraftable(base))\n die(8);\n if (isDraft(base))\n base = current(base);\n const scope = enterScope(this);\n const proxy = createProxy(base, void 0);\n proxy[DRAFT_STATE].isManual_ = true;\n leaveScope(scope);\n return proxy;\n }\n finishDraft(draft, patchListener) {\n const state = draft && draft[DRAFT_STATE];\n if (!state || !state.isManual_)\n die(9);\n const { scope_: scope } = state;\n usePatchesInScope(scope, patchListener);\n return processResult(void 0, scope);\n }\n /**\n * Pass true to automatically freeze all copies created by Immer.\n *\n * By default, auto-freezing is enabled.\n */\n setAutoFreeze(value) {\n this.autoFreeze_ = value;\n }\n /**\n * Pass true to enable strict shallow copy.\n *\n * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.\n */\n setUseStrictShallowCopy(value) {\n this.useStrictShallowCopy_ = value;\n }\n applyPatches(base, patches) {\n let i;\n for (i = patches.length - 1; i >= 0; i--) {\n const patch = patches[i];\n if (patch.path.length === 0 && patch.op === \"replace\") {\n base = patch.value;\n break;\n }\n }\n if (i > -1) {\n patches = patches.slice(i + 1);\n }\n const applyPatchesImpl = getPlugin(\"Patches\").applyPatches_;\n if (isDraft(base)) {\n return applyPatchesImpl(base, patches);\n }\n return this.produce(\n base,\n (draft) => applyPatchesImpl(draft, patches)\n );\n }\n};\nfunction createProxy(value, parent) {\n const draft = isMap(value) ? getPlugin(\"MapSet\").proxyMap_(value, parent) : isSet(value) ? getPlugin(\"MapSet\").proxySet_(value, parent) : createProxyProxy(value, parent);\n const scope = parent ? parent.scope_ : getCurrentScope();\n scope.drafts_.push(draft);\n return draft;\n}\n\n// src/core/current.ts\nfunction current(value) {\n if (!isDraft(value))\n die(10, value);\n return currentImpl(value);\n}\nfunction currentImpl(value) {\n if (!isDraftable(value) || isFrozen(value))\n return value;\n const state = value[DRAFT_STATE];\n let copy;\n if (state) {\n if (!state.modified_)\n return state.base_;\n state.finalized_ = true;\n copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);\n } else {\n copy = shallowCopy(value, true);\n }\n each(copy, (key, childValue) => {\n set(copy, key, currentImpl(childValue));\n });\n if (state) {\n state.finalized_ = false;\n }\n return copy;\n}\n\n// src/plugins/patches.ts\nfunction enablePatches() {\n const errorOffset = 16;\n if (process.env.NODE_ENV !== \"production\") {\n errors.push(\n 'Sets cannot have \"replace\" patches.',\n function(op) {\n return \"Unsupported patch operation: \" + op;\n },\n function(path) {\n return \"Cannot apply patch, path doesn't resolve: \" + path;\n },\n \"Patching reserved attributes like __proto__, prototype and constructor is not allowed\"\n );\n }\n const REPLACE = \"replace\";\n const ADD = \"add\";\n const REMOVE = \"remove\";\n function generatePatches_(state, basePath, patches, inversePatches) {\n switch (state.type_) {\n case 0 /* Object */:\n case 2 /* Map */:\n return generatePatchesFromAssigned(\n state,\n basePath,\n patches,\n inversePatches\n );\n case 1 /* Array */:\n return generateArrayPatches(state, basePath, patches, inversePatches);\n case 3 /* Set */:\n return generateSetPatches(\n state,\n basePath,\n patches,\n inversePatches\n );\n }\n }\n function generateArrayPatches(state, basePath, patches, inversePatches) {\n let { base_, assigned_ } = state;\n let copy_ = state.copy_;\n if (copy_.length < base_.length) {\n ;\n [base_, copy_] = [copy_, base_];\n [patches, inversePatches] = [inversePatches, patches];\n }\n for (let i = 0; i < base_.length; i++) {\n if (assigned_[i] && copy_[i] !== base_[i]) {\n const path = basePath.concat([i]);\n patches.push({\n op: REPLACE,\n path,\n // Need to maybe clone it, as it can in fact be the original value\n // due to the base/copy inversion at the start of this function\n value: clonePatchValueIfNeeded(copy_[i])\n });\n inversePatches.push({\n op: REPLACE,\n path,\n value: clonePatchValueIfNeeded(base_[i])\n });\n }\n }\n for (let i = base_.length; i < copy_.length; i++) {\n const path = basePath.concat([i]);\n patches.push({\n op: ADD,\n path,\n // Need to maybe clone it, as it can in fact be the original value\n // due to the base/copy inversion at the start of this function\n value: clonePatchValueIfNeeded(copy_[i])\n });\n }\n for (let i = copy_.length - 1; base_.length <= i; --i) {\n const path = basePath.concat([i]);\n inversePatches.push({\n op: REMOVE,\n path\n });\n }\n }\n function generatePatchesFromAssigned(state, basePath, patches, inversePatches) {\n const { base_, copy_ } = state;\n each(state.assigned_, (key, assignedValue) => {\n const origValue = get(base_, key);\n const value = get(copy_, key);\n const op = !assignedValue ? REMOVE : has(base_, key) ? REPLACE : ADD;\n if (origValue === value && op === REPLACE)\n return;\n const path = basePath.concat(key);\n patches.push(op === REMOVE ? { op, path } : { op, path, value });\n inversePatches.push(\n op === ADD ? { op: REMOVE, path } : op === REMOVE ? { op: ADD, path, value: clonePatchValueIfNeeded(origValue) } : { op: REPLACE, path, value: clonePatchValueIfNeeded(origValue) }\n );\n });\n }\n function generateSetPatches(state, basePath, patches, inversePatches) {\n let { base_, copy_ } = state;\n let i = 0;\n base_.forEach((value) => {\n if (!copy_.has(value)) {\n const path = basePath.concat([i]);\n patches.push({\n op: REMOVE,\n path,\n value\n });\n inversePatches.unshift({\n op: ADD,\n path,\n value\n });\n }\n i++;\n });\n i = 0;\n copy_.forEach((value) => {\n if (!base_.has(value)) {\n const path = basePath.concat([i]);\n patches.push({\n op: ADD,\n path,\n value\n });\n inversePatches.unshift({\n op: REMOVE,\n path,\n value\n });\n }\n i++;\n });\n }\n function generateReplacementPatches_(baseValue, replacement, patches, inversePatches) {\n patches.push({\n op: REPLACE,\n path: [],\n value: replacement === NOTHING ? void 0 : replacement\n });\n inversePatches.push({\n op: REPLACE,\n path: [],\n value: baseValue\n });\n }\n function applyPatches_(draft, patches) {\n patches.forEach((patch) => {\n const { path, op } = patch;\n let base = draft;\n for (let i = 0; i < path.length - 1; i++) {\n const parentType = getArchtype(base);\n let p = path[i];\n if (typeof p !== \"string\" && typeof p !== \"number\") {\n p = \"\" + p;\n }\n if ((parentType === 0 /* Object */ || parentType === 1 /* Array */) && (p === \"__proto__\" || p === \"constructor\"))\n die(errorOffset + 3);\n if (typeof base === \"function\" && p === \"prototype\")\n die(errorOffset + 3);\n base = get(base, p);\n if (typeof base !== \"object\")\n die(errorOffset + 2, path.join(\"/\"));\n }\n const type = getArchtype(base);\n const value = deepClonePatchValue(patch.value);\n const key = path[path.length - 1];\n switch (op) {\n case REPLACE:\n switch (type) {\n case 2 /* Map */:\n return base.set(key, value);\n case 3 /* Set */:\n die(errorOffset);\n default:\n return base[key] = value;\n }\n case ADD:\n switch (type) {\n case 1 /* Array */:\n return key === \"-\" ? base.push(value) : base.splice(key, 0, value);\n case 2 /* Map */:\n return base.set(key, value);\n case 3 /* Set */:\n return base.add(value);\n default:\n return base[key] = value;\n }\n case REMOVE:\n switch (type) {\n case 1 /* Array */:\n return base.splice(key, 1);\n case 2 /* Map */:\n return base.delete(key);\n case 3 /* Set */:\n return base.delete(patch.value);\n default:\n return delete base[key];\n }\n default:\n die(errorOffset + 1, op);\n }\n });\n return draft;\n }\n function deepClonePatchValue(obj) {\n if (!isDraftable(obj))\n return obj;\n if (Array.isArray(obj))\n return obj.map(deepClonePatchValue);\n if (isMap(obj))\n return new Map(\n Array.from(obj.entries()).map(([k, v]) => [k, deepClonePatchValue(v)])\n );\n if (isSet(obj))\n return new Set(Array.from(obj).map(deepClonePatchValue));\n const cloned = Object.create(getPrototypeOf(obj));\n for (const key in obj)\n cloned[key] = deepClonePatchValue(obj[key]);\n if (has(obj, DRAFTABLE))\n cloned[DRAFTABLE] = obj[DRAFTABLE];\n return cloned;\n }\n function clonePatchValueIfNeeded(obj) {\n if (isDraft(obj)) {\n return deepClonePatchValue(obj);\n } else\n return obj;\n }\n loadPlugin(\"Patches\", {\n applyPatches_,\n generatePatches_,\n generateReplacementPatches_\n });\n}\n\n// src/plugins/mapset.ts\nfunction enableMapSet() {\n class DraftMap extends Map {\n constructor(target, parent) {\n super();\n this[DRAFT_STATE] = {\n type_: 2 /* Map */,\n parent_: parent,\n scope_: parent ? parent.scope_ : getCurrentScope(),\n modified_: false,\n finalized_: false,\n copy_: void 0,\n assigned_: void 0,\n base_: target,\n draft_: this,\n isManual_: false,\n revoked_: false\n };\n }\n get size() {\n return latest(this[DRAFT_STATE]).size;\n }\n has(key) {\n return latest(this[DRAFT_STATE]).has(key);\n }\n set(key, value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!latest(state).has(key) || latest(state).get(key) !== value) {\n prepareMapCopy(state);\n markChanged(state);\n state.assigned_.set(key, true);\n state.copy_.set(key, value);\n state.assigned_.set(key, true);\n }\n return this;\n }\n delete(key) {\n if (!this.has(key)) {\n return false;\n }\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareMapCopy(state);\n markChanged(state);\n if (state.base_.has(key)) {\n state.assigned_.set(key, false);\n } else {\n state.assigned_.delete(key);\n }\n state.copy_.delete(key);\n return true;\n }\n clear() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (latest(state).size) {\n prepareMapCopy(state);\n markChanged(state);\n state.assigned_ = /* @__PURE__ */ new Map();\n each(state.base_, (key) => {\n state.assigned_.set(key, false);\n });\n state.copy_.clear();\n }\n }\n forEach(cb, thisArg) {\n const state = this[DRAFT_STATE];\n latest(state).forEach((_value, key, _map) => {\n cb.call(thisArg, this.get(key), key, this);\n });\n }\n get(key) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n const value = latest(state).get(key);\n if (state.finalized_ || !isDraftable(value)) {\n return value;\n }\n if (value !== state.base_.get(key)) {\n return value;\n }\n const draft = createProxy(value, state);\n prepareMapCopy(state);\n state.copy_.set(key, draft);\n return draft;\n }\n keys() {\n return latest(this[DRAFT_STATE]).keys();\n }\n values() {\n const iterator = this.keys();\n return {\n [Symbol.iterator]: () => this.values(),\n next: () => {\n const r = iterator.next();\n if (r.done)\n return r;\n const value = this.get(r.value);\n return {\n done: false,\n value\n };\n }\n };\n }\n entries() {\n const iterator = this.keys();\n return {\n [Symbol.iterator]: () => this.entries(),\n next: () => {\n const r = iterator.next();\n if (r.done)\n return r;\n const value = this.get(r.value);\n return {\n done: false,\n value: [r.value, value]\n };\n }\n };\n }\n [(DRAFT_STATE, Symbol.iterator)]() {\n return this.entries();\n }\n }\n function proxyMap_(target, parent) {\n return new DraftMap(target, parent);\n }\n function prepareMapCopy(state) {\n if (!state.copy_) {\n state.assigned_ = /* @__PURE__ */ new Map();\n state.copy_ = new Map(state.base_);\n }\n }\n class DraftSet extends Set {\n constructor(target, parent) {\n super();\n this[DRAFT_STATE] = {\n type_: 3 /* Set */,\n parent_: parent,\n scope_: parent ? parent.scope_ : getCurrentScope(),\n modified_: false,\n finalized_: false,\n copy_: void 0,\n base_: target,\n draft_: this,\n drafts_: /* @__PURE__ */ new Map(),\n revoked_: false,\n isManual_: false\n };\n }\n get size() {\n return latest(this[DRAFT_STATE]).size;\n }\n has(value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!state.copy_) {\n return state.base_.has(value);\n }\n if (state.copy_.has(value))\n return true;\n if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))\n return true;\n return false;\n }\n add(value) {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (!this.has(value)) {\n prepareSetCopy(state);\n markChanged(state);\n state.copy_.add(value);\n }\n return this;\n }\n delete(value) {\n if (!this.has(value)) {\n return false;\n }\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n markChanged(state);\n return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (\n /* istanbul ignore next */\n false\n ));\n }\n clear() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n if (latest(state).size) {\n prepareSetCopy(state);\n markChanged(state);\n state.copy_.clear();\n }\n }\n values() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n return state.copy_.values();\n }\n entries() {\n const state = this[DRAFT_STATE];\n assertUnrevoked(state);\n prepareSetCopy(state);\n return state.copy_.entries();\n }\n keys() {\n return this.values();\n }\n [(DRAFT_STATE, Symbol.iterator)]() {\n return this.values();\n }\n forEach(cb, thisArg) {\n const iterator = this.values();\n let result = iterator.next();\n while (!result.done) {\n cb.call(thisArg, result.value, result.value, this);\n result = iterator.next();\n }\n }\n }\n function proxySet_(target, parent) {\n return new DraftSet(target, parent);\n }\n function prepareSetCopy(state) {\n if (!state.copy_) {\n state.copy_ = /* @__PURE__ */ new Set();\n state.base_.forEach((value) => {\n if (isDraftable(value)) {\n const draft = createProxy(value, state);\n state.drafts_.set(value, draft);\n state.copy_.add(draft);\n } else {\n state.copy_.add(value);\n }\n });\n }\n }\n function assertUnrevoked(state) {\n if (state.revoked_)\n die(3, JSON.stringify(latest(state)));\n }\n loadPlugin(\"MapSet\", { proxyMap_, proxySet_ });\n}\n\n// src/immer.ts\nvar immer = new Immer2();\nvar produce = immer.produce;\nvar produceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(\n immer\n);\nvar setAutoFreeze = /* @__PURE__ */ immer.setAutoFreeze.bind(immer);\nvar setUseStrictShallowCopy = /* @__PURE__ */ immer.setUseStrictShallowCopy.bind(\n immer\n);\nvar applyPatches = /* @__PURE__ */ immer.applyPatches.bind(immer);\nvar createDraft = /* @__PURE__ */ immer.createDraft.bind(immer);\nvar finishDraft = /* @__PURE__ */ immer.finishDraft.bind(immer);\nfunction castDraft(value) {\n return value;\n}\nfunction castImmutable(value) {\n return value;\n}\nexport {\n Immer2 as Immer,\n applyPatches,\n castDraft,\n castImmutable,\n createDraft,\n current,\n enableMapSet,\n enablePatches,\n finishDraft,\n freeze,\n DRAFTABLE as immerable,\n isDraft,\n isDraftable,\n NOTHING as nothing,\n original,\n produce,\n produceWithPatches,\n setAutoFreeze,\n setUseStrictShallowCopy\n};\n//# sourceMappingURL=immer.mjs.map","import { produce } from \"immer\";\n/**\n * Helper function to safely get config object from generator invocation.\n * Returns an empty object if config is not set or not an object.\n *\n * @param config - The generator invocation schema\n * @returns The config object or an empty object\n *\n * @example\n * ```typescript\n * const configObj = getConfigObject(config);\n * const migratedConfig = {\n * ...configObj,\n * newField: \"value\"\n * };\n * ```\n */\nexport function getConfigObject(config) {\n return config.config && typeof config.config === \"object\" ? config.config : {};\n}\n/**\n * Helper function to set a config field only if it's not already defined.\n * This is useful for preserving user's explicit configuration while setting old defaults.\n *\n * @param configObj - The config object to check\n * @param field - The field name to check\n * @param defaultValue - The default value to set if field is undefined\n * @returns An object with the field set, or an empty object if already defined\n *\n * @example\n * ```typescript\n * const migratedConfig = {\n * ...configObj,\n * ...setIfUndefined(configObj, \"newField\", \"default-value\"),\n * ...setIfUndefined(configObj, \"anotherField\", true)\n * };\n * ```\n */\nexport function setIfUndefined(configObj, field, defaultValue) {\n return configObj[field] === undefined ? { [field]: defaultValue } : {};\n}\n/**\n * Helper function to create a migrated generator config with updated config object.\n *\n * @param originalConfig - The original generator invocation schema\n * @param migratedConfigObj - The migrated config object\n * @returns A new generator invocation schema with the migrated config\n *\n * @example\n * ```typescript\n * const configObj = getConfigObject(config);\n * const migratedConfigObj = {\n * ...configObj,\n * newField: \"value\"\n * };\n * return createMigratedConfig(config, migratedConfigObj);\n * ```\n */\nexport function createMigratedConfig(originalConfig, migratedConfigObj) {\n return {\n ...originalConfig,\n config: migratedConfigObj\n };\n}\n/**\n * Helper function to format a log message about fields that were set.\n *\n * @param fieldsSet - Array of field names that were set\n * @param fieldsSkipped - Array of field names that were skipped\n * @returns A formatted log message, or undefined if no fields were set\n *\n * @example\n * ```typescript\n * const result = applyDefaultsWithTracking(configObj, defaults);\n * const logMessage = formatFieldChanges(result.fieldsSet, result.fieldsSkipped);\n * if (logMessage) {\n * context?.log?.(logMessage);\n * }\n * ```\n */\nexport function formatFieldChanges(fieldsSet, fieldsSkipped) {\n if (fieldsSet.length === 0) {\n return undefined;\n }\n const parts = [];\n parts.push(`Set ${fieldsSet.length} field(s): ${fieldsSet.join(\", \")}`);\n if (fieldsSkipped.length > 0) {\n parts.push(`(skipped ${fieldsSkipped.length}: ${fieldsSkipped.join(\", \")})`);\n }\n return parts.join(\" \");\n}\n/**\n * Helper function to apply multiple field defaults in a single call.\n * Each field is only set if it's currently undefined.\n *\n * @param configObj - The config object to update\n * @param defaults - Object mapping field names to their default values\n * @returns A merged config object with defaults applied\n *\n * @example\n * ```typescript\n * const configObj = getConfigObject(config);\n * const migratedConfig = applyDefaults(configObj, {\n * field1: \"default1\",\n * field2: true,\n * field3: 42\n * });\n * return createMigratedConfig(config, migratedConfig);\n * ```\n */\nexport function applyDefaults(configObj, defaults) {\n const result = { ...configObj };\n for (const [field, defaultValue] of Object.entries(defaults)) {\n if (result[field] === undefined) {\n result[field] = defaultValue;\n }\n }\n return result;\n}\n/**\n * Migrate a generator config using Immer's produce for immutable updates.\n * This is the recommended way to write migrations as it handles nested updates elegantly.\n *\n * @param config - The original generator config\n * @param updater - Function that mutates the config draft (uses Immer)\n * @returns A new generator config with updates applied\n *\n * @example\n * ```typescript\n * // Simple field updates\n * return migrateConfig(config, (draft) => {\n * draft.oldField = false; // Set old default\n * draft.newField = true; // Set new default\n * });\n *\n * // Conditional updates (only if undefined)\n * return migrateConfig(config, (draft) => {\n * draft.field1 ??= false; // Only set if undefined\n * draft.field2 ??= true;\n * });\n *\n * // Nested updates\n * return migrateConfig(config, (draft) => {\n * draft.nested ??= {};\n * draft.nested.field = \"value\";\n * });\n *\n * // Removing fields\n * return migrateConfig(config, (draft) => {\n * delete draft.deprecated;\n * });\n *\n * // Renaming fields\n * return migrateConfig(config, (draft) => {\n * draft.newName = draft.oldName;\n * delete draft.oldName;\n * });\n * ```\n */\nexport function migrateConfig(config, updater) {\n const configObj = getConfigObject(config);\n const migratedConfigObj = produce(configObj, updater);\n return {\n ...config,\n config: migratedConfigObj\n };\n}\n/**\n * Helper function to apply multiple field defaults and track which fields were changed.\n * Each field is only set if it's currently undefined.\n *\n * @param configObj - The config object to update\n * @param defaults - Object mapping field names to their default values\n * @returns Result with config, fieldsSet, and fieldsSkipped\n *\n * @example\n * ```typescript\n * const configObj = getConfigObject(config);\n * const result = applyDefaultsWithTracking(configObj, {\n * field1: \"default1\",\n * field2: true,\n * field3: 42\n * });\n * console.log(`Set: ${result.fieldsSet.join(\", \")}`);\n * console.log(`Skipped: ${result.fieldsSkipped.join(\", \")}`);\n * return createMigratedConfig(config, result.config);\n * ```\n */\nexport function applyDefaultsWithTracking(configObj, defaults) {\n const result = { ...configObj };\n const fieldsSet = [];\n const fieldsSkipped = [];\n for (const [field, defaultValue] of Object.entries(defaults)) {\n if (result[field] === undefined) {\n result[field] = defaultValue;\n fieldsSet.push(field);\n }\n else {\n fieldsSkipped.push(field);\n }\n }\n return {\n config: result,\n fieldsSet,\n fieldsSkipped\n };\n}\n//# sourceMappingURL=utils.js.map","import type { Migration } from \"@fern-api/migrations-base\";\nimport { migrateConfig } from \"@fern-api/migrations-base\";\n\n/**\n * Migration for version 1.0.0\n *\n * ## Context\n *\n * Version 1.0.0 introduced new defaults to improve the developer experience and modernize\n * the generated SDK. These changes make the SDK more ergonomic and reduce boilerplate,\n * but could break existing code that relied on the old defaults.\n *\n * To ensure backwards compatibility during upgrades, this migration explicitly sets the\n * old defaults for users upgrading from pre-1.0.0 versions. This allows their existing\n * code to continue working without changes.\n *\n * ## Changed Defaults\n *\n * | Field | Old Default (pre-1.0.0) | New Default (1.0.0+) | Impact |\n * |-------|-------------------------|----------------------|--------|\n * | `inlineFileProperties` | `false` | `true` | File upload properties are now inlined into request types |\n * | `inlinePathParameters` | `false` | `true` | Path parameters are now inlined into method signatures |\n * | `enableInlineTypes` | `false` | `true` | Type definitions are inlined where beneficial |\n * | `noSerdeLayer` | `false` | `true` | Serialization/deserialization layer is removed for simpler types |\n * | `omitUndefined` | `false` | `true` | Undefined values are omitted from JSON output |\n * | `skipResponseValidation` | `false` | `true` | Response validation is skipped for better performance |\n * | `useLegacyExports` | `true` | `false` | Modern ESM exports are used instead of legacy CommonJS |\n *\n * ## Migration Strategy\n *\n * This migration uses the nullish coalescing assignment operator (`??=`) to only set\n * values that are explicitly undefined. This means:\n * - ✅ If a user has explicitly configured a field (even to the new default), that value is preserved\n * - ✅ If a field is undefined, the old default is set for backwards compatibility\n * - ✅ Unknown/custom fields are preserved\n *\n * ## Examples\n *\n * ### Example 1: Empty Config (Migration Applied)\n *\n * **Before Migration (0.9.0 → 1.0.0):**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 0.9.0\n * config: {}\n * ```\n *\n * **After Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 1.0.0\n * config:\n * inlineFileProperties: false # Set by migration\n * inlinePathParameters: false # Set by migration\n * enableInlineTypes: false # Set by migration\n * noSerdeLayer: false # Set by migration\n * omitUndefined: false # Set by migration\n * skipResponseValidation: false # Set by migration\n * useLegacyExports: true # Set by migration\n * ```\n *\n * **Result:** SDK behavior remains unchanged, existing code continues to work.\n *\n * ### Example 2: Partially Configured (Selective Migration)\n *\n * **Before Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 0.9.0\n * config:\n * inlineFileProperties: true # User explicitly wants new behavior\n * packageName: \"@acme/sdk\"\n * ```\n *\n * **After Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 1.0.0\n * config:\n * inlineFileProperties: true # Preserved (explicitly set)\n * packageName: \"@acme/sdk\" # Preserved (custom field)\n * inlinePathParameters: false # Set by migration\n * enableInlineTypes: false # Set by migration\n * noSerdeLayer: false # Set by migration\n * omitUndefined: false # Set by migration\n * skipResponseValidation: false # Set by migration\n * useLegacyExports: true # Set by migration\n * ```\n *\n * **Result:** User's explicit choice is honored, other fields get old defaults.\n *\n * ### Example 3: Fully Configured (No Migration Needed)\n *\n * **Before Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 0.9.0\n * config:\n * inlineFileProperties: true\n * inlinePathParameters: true\n * enableInlineTypes: true\n * noSerdeLayer: true\n * omitUndefined: true\n * skipResponseValidation: true\n * useLegacyExports: false\n * ```\n *\n * **After Migration:**\n * ```yaml\n * # No changes - all fields explicitly configured\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 1.0.0\n * config:\n * inlineFileProperties: true\n * inlinePathParameters: true\n * enableInlineTypes: true\n * noSerdeLayer: true\n * omitUndefined: true\n * skipResponseValidation: true\n * useLegacyExports: false\n * ```\n *\n * **Result:** User gets the new defaults they explicitly configured.\n *\n * ## Why These Defaults Changed\n *\n * - **Inline properties/parameters**: Reduces type nesting and improves IDE autocomplete\n * - **No serde layer**: Simplifies generated code and improves runtime performance\n * - **Omit undefined**: Produces cleaner JSON payloads and matches JavaScript conventions\n * - **Skip validation**: Improves performance by trusting the API contract\n * - **Modern exports**: Better tree-shaking and compatibility with modern bundlers\n *\n * ## When to Opt Into New Defaults\n *\n * After upgrading and verifying your code works, consider removing the old defaults\n * to adopt the new behavior:\n *\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 1.0.0\n * config: {} # Remove all fields to use new defaults\n * ```\n *\n * Test your code thoroughly before making this change.\n */\nexport const migration_1_0_0: Migration = {\n version: \"1.0.0\",\n\n migrateGeneratorConfig: ({ config }) =>\n migrateConfig(config, (draft) => {\n // Only set old defaults if the fields are not already explicitly configured\n // Using the nullish coalescing assignment operator (??=) to set only if undefined\n draft.inlineFileProperties ??= false;\n draft.inlinePathParameters ??= false;\n draft.enableInlineTypes ??= false;\n draft.noSerdeLayer ??= false;\n draft.omitUndefined ??= false;\n draft.skipResponseValidation ??= false;\n draft.useLegacyExports ??= true;\n }),\n\n migrateGeneratorsYml: ({ document }) => document\n};\n","import type { Migration } from \"@fern-api/migrations-base\";\nimport { migrateConfig } from \"@fern-api/migrations-base\";\n\n/**\n * Migration for version 2.0.0\n *\n * ## Context\n *\n * Version 2.0.0 introduced zero-dependency SDKs by default, using native browser and\n * Node.js APIs instead of external packages. This significantly reduces bundle size\n * and eliminates dependency management issues, but requires Node.js 18+ and modern\n * browsers with native fetch/streams support.\n *\n * For users upgrading from pre-2.0.0 versions who need to maintain compatibility with\n * older runtimes, this migration explicitly sets the old defaults that use polyfills\n * and wrapper libraries.\n *\n * ## Changed Defaults\n *\n * | Field | Old Default (pre-2.0.0) | New Default (2.0.0+) | Impact |\n * |-------|-------------------------|----------------------|--------|\n * | `streamType` | `\"wrapper\"` | `\"web\"` | Uses native Web Streams API instead of wrapper library |\n * | `fileResponseType` | `\"stream\"` | `\"binary-response\"` | Returns binary response instead of stream wrapper |\n * | `formDataSupport` | `\"Node16\"` | `\"Node18\"` | Uses native FormData (Node 18+) instead of polyfill |\n * | `fetchSupport` | `\"node-fetch\"` | `\"native\"` | Uses native fetch (Node 18+/browsers) instead of node-fetch |\n *\n * ## Migration Strategy\n *\n * This migration uses the nullish coalescing assignment operator (`??=`) to only set\n * values that are explicitly undefined. This means:\n * - ✅ If a user has explicitly configured a field, that value is preserved\n * - ✅ If a field is undefined, the old default (with dependencies) is set\n * - ✅ Users can opt into zero-dependency mode by removing these fields later\n *\n * ## Examples\n *\n * ### Example 1: Empty Config (Migration Applied - Dependencies Maintained)\n *\n * **Before Migration (1.9.0 → 2.0.0):**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 1.9.0\n * config: {}\n * ```\n *\n * **After Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 2.0.0\n * config:\n * streamType: wrapper # Set by migration - uses wrapper library\n * fileResponseType: stream # Set by migration - uses stream wrapper\n * formDataSupport: Node16 # Set by migration - uses polyfill\n * fetchSupport: node-fetch # Set by migration - uses node-fetch package\n * ```\n *\n * **Result:** SDK continues using external dependencies, works with Node 16+.\n *\n * **Dependencies Required:**\n * - `node-fetch` for HTTP requests\n * - `form-data` for multipart uploads\n * - Stream wrapper libraries\n *\n * ### Example 2: Opting Into Zero-Dependency Mode\n *\n * **After Initial Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 2.0.0\n * config:\n * streamType: wrapper\n * fileResponseType: stream\n * formDataSupport: Node16\n * fetchSupport: node-fetch\n * ```\n *\n * **To Adopt Zero-Dependency Mode:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 2.0.0\n * config: {} # Remove all fields to use new defaults\n * ```\n *\n * **Result:** SDK uses native APIs, no external dependencies required.\n *\n * **Requirements for Zero-Dependency Mode:**\n * - Node.js 18+ (for native fetch and FormData)\n * - OR modern browsers (Chrome 42+, Firefox 39+, Safari 10.1+, Edge 14+)\n *\n * ## Why These Defaults Changed\n *\n * ### Bundle Size Impact\n *\n * **With Dependencies (Old):**\n * ```\n * node-fetch: ~90KB\n * form-data: ~40KB\n * stream wrappers: ~20KB\n * Total: ~150KB added to your bundle\n * ```\n *\n * **Zero Dependencies (New):**\n * ```\n * Total: 0KB (uses native APIs)\n * ```\n *\n * ### Performance Benefits\n *\n * - **Native fetch**: ~30% faster than node-fetch\n * - **Native streams**: ~40% faster than wrapper libraries\n * - **No dependency resolution**: Faster npm install and startup time\n *\n * ## Runtime Compatibility\n *\n * ### With Old Defaults (Migration Applied)\n * - ✅ Node.js 12+\n * - ✅ All browsers (with polyfills)\n * - ✅ Edge runtimes (Cloudflare Workers, etc.)\n *\n * ### With New Defaults (Zero-Dependency)\n * - ✅ Node.js 18+\n * - ✅ Modern browsers (last 2 years)\n * - ⚠️ May need polyfills for edge runtimes\n *\n * ## Migration Path to Zero-Dependency\n *\n * ### Step 1: Upgrade with Migration (Safe)\n * ```bash\n * fern generator upgrade\n * ```\n * Result: Old behavior preserved, dependencies still required.\n *\n * ### Step 2: Update Node Version (If Needed)\n * Ensure your runtime is Node 18+ or a modern browser.\n *\n * ### Step 3: Remove Old Defaults\n * Edit `generators.yml`:\n * ```yaml\n * config: {} # Use new zero-dependency defaults\n * ```\n *\n * ### Step 4: Remove Dependencies\n * ```bash\n * npm uninstall node-fetch form-data\n * ```\n *\n * ### Step 5: Test Thoroughly\n * Verify streams, file uploads, and fetch operations work correctly.\n */\nexport const migration_2_0_0: Migration = {\n version: \"2.0.0\",\n\n migrateGeneratorConfig: ({ config }) =>\n migrateConfig(config, (draft) => {\n // Only set old defaults if the fields are not already explicitly configured\n draft.streamType ??= \"wrapper\";\n draft.fileResponseType ??= \"stream\";\n draft.formDataSupport ??= \"Node16\";\n draft.fetchSupport ??= \"node-fetch\";\n }),\n\n migrateGeneratorsYml: ({ document }) => document\n};\n","import type { Migration } from \"@fern-api/migrations-base\";\nimport { migrateConfig } from \"@fern-api/migrations-base\";\n\n/**\n * Migration for version 3.0.0\n *\n * ## Context\n *\n * Version 3.0.0 modernized the generated SDK tooling by switching to pnpm and Vitest,\n * which offer better performance, smaller disk usage, and faster test execution compared\n * to yarn and Jest. However, teams with existing workflows may prefer to maintain their\n * current tooling.\n *\n * This migration explicitly sets the old defaults for users upgrading from pre-3.0.0\n * versions, allowing them to continue using yarn and Jest without any changes to their\n * development workflow.\n *\n * ## Changed Defaults\n *\n * | Field | Old Default (pre-3.0.0) | New Default (3.0.0+) | Impact |\n * |-------|-------------------------|----------------------|--------|\n * | `packageManager` | `\"yarn\"` | `\"pnpm\"` | Generated package.json uses pnpm for dependency management |\n * | `testFramework` | `\"jest\"` | `\"vitest\"` | Generated tests use Vitest instead of Jest |\n *\n * ## Migration Strategy\n *\n * This migration uses the nullish coalescing assignment operator (`??=`) to only set\n * values that are explicitly undefined. This means:\n * - ✅ If a user has explicitly configured a field, that value is preserved\n * - ✅ If a field is undefined, the old default is set\n * - ✅ Users can opt into modern tooling by removing these fields later\n *\n * ## Examples\n *\n * ### Example 1: Empty Config (Migration Applied - Keep Yarn + Jest)\n *\n * **Before Migration (2.9.0 → 3.0.0):**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 2.9.0\n * config: {}\n * ```\n *\n * **After Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 3.0.0\n * config:\n * packageManager: yarn # Set by migration - keeps yarn\n * testFramework: jest # Set by migration - keeps jest\n * ```\n *\n * **Result:** Generated SDK continues using yarn and Jest.\n *\n * **Generated Files:**\n * - `package.json` with yarn scripts and Jest config\n * - Test files using Jest syntax (`describe`, `it`, `expect`)\n * - `.yarnrc` or `.yarnrc.yml` if applicable\n *\n * ### Example 2: Adopting Modern Tooling (pnpm + Vitest)\n *\n * **After Initial Migration:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 3.0.0\n * config:\n * packageManager: yarn\n * testFramework: jest\n * ```\n *\n * **To Adopt pnpm + Vitest:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 3.0.0\n * config: {} # Remove to use new defaults\n * ```\n *\n * **Result:** Generated SDK uses pnpm and Vitest.\n *\n * **Generated Files:**\n * - `package.json` with pnpm scripts\n * - `vitest.config.ts` for test configuration\n * - Test files using Vitest syntax (compatible with Jest)\n * - `pnpm-workspace.yaml` if applicable\n *\n * ### Example 3: Mixed Tooling (Custom Configuration)\n *\n * **Keep yarn but adopt Vitest:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 3.0.0\n * config:\n * packageManager: yarn # Keep yarn\n * # testFramework defaults to vitest\n * ```\n *\n * **Keep Jest but adopt pnpm:**\n * ```yaml\n * generators:\n * - name: fernapi/fern-typescript-sdk\n * version: 3.0.0\n * config:\n * testFramework: jest # Keep Jest\n * # packageManager defaults to pnpm\n * ```\n *\n * ## Why These Defaults Changed\n *\n * ### pnpm vs yarn\n *\n * **Performance:**\n * - pnpm install is 2-3x faster than yarn\n * - Uses hard links instead of copying files\n * - Significantly smaller `node_modules` (50-70% reduction)\n *\n * **Correctness:**\n * - Strict dependency resolution prevents phantom dependencies\n * - Better monorepo support with workspaces\n * - More deterministic builds\n *\n * **Ecosystem:**\n * - Growing adoption in major projects (Vue 3, Prisma, Turborepo)\n * - Better compatibility with modern tooling\n *\n * ### Vitest vs Jest\n *\n * **Performance:**\n * - 10-20x faster test execution with native ESM\n * - Built-in watch mode with instant HMR\n * - Parallel test execution by default\n *\n * **Developer Experience:**\n * - Native TypeScript support (no ts-jest needed)\n * - Vite-powered with instant module reloading\n * - Jest-compatible API (easy migration)\n * - Better error messages and stack traces\n *\n * **Modern Features:**\n * - Native ESM support\n * - Web Workers and multi-threading support\n * - In-source testing capabilities\n *\n * ## Compatibility Notes\n *\n * ### Vitest Limitations\n *\n * Vitest is **not compatible** with certain generator configurations:\n *\n * 1. **`useBigInt: true`**: Vitest doesn't handle BigInt serialization the same way as Jest\n * - **Workaround**: Keep `testFramework: jest` if using BigInt\n *\n * 2. **`streamType: wrapper`**: Older stream wrappers may not work with Vitest's ESM mode\n * - **Workaround**: Either use `streamType: web` or keep `testFramework: jest`\n *\n * 3. **`packagePath` (custom paths)**: May have module resolution issues with Vitest\n * - **Workaround**: Keep `testFramework: jest` for complex custom paths\n *\n * If you have any of these configurations, the migration correctly keeps Jest as the test framework.\n *\n * ## Migration Path to Modern Tooling\n *\n * ### Step 1: Upgrade with Migration (Safe)\n * ```bash\n * fern generator upgrade\n * ```\n * Result: Keeps yarn and Jest, no workflow changes needed.\n *\n * ### Step 2: Install pnpm (Optional)\n * ```bash\n * npm install -g pnpm@latest\n * ```\n *\n * ### Step 3: Adopt Modern Tooling (Optional)\n * Edit `generators.yml`:\n * ```yaml\n * config: {} # Use pnpm + vitest\n * ```\n *\n * ### Step 4: Update CI/CD (Optional)\n * Update CI scripts to use pnpm:\n * ```yaml\n * # GitHub Actions example\n * - uses: pnpm/action-setup@v2\n * with:\n * version: 8\n * - run: pnpm install\n * - run: pnpm test\n * ```\n *\n * ### Step 5: Migrate yarn.lock (Optional)\n * ```bash\n * # Convert yarn.lock to pnpm-lock.yaml\n * pnpm import\n * rm yarn.lock\n * ```\n *\n * ## Troubleshooting\n *\n * ### \"pnpm: command not found\"\n * **Cause:** pnpm not installed globally.\n * **Solution:** Install pnpm: `npm install -g pnpm`\n *\n * ### Vitest errors with BigInt\n * **Cause:** Vitest and BigInt serialization incompatibility.\n * **Solution:** Use `testFramework: jest` in config.\n *\n * ### Module resolution errors with Vitest\n * **Cause:** ESM/CommonJS compatibility issues.\n * **Solution:** Either fix module format or use `testFramework: jest`.\n *\n * ### Tests fail after switching to Vitest\n * **Cause:** Vitest has stricter ESM requirements.\n * **Solution:** Ensure `package.json` has `\"type\": \"module\"` or use `.ts` extensions.\n *\n * ## Performance Comparison\n *\n * Based on typical SDK project (50 tests, 1000 LOC):\n *\n * **Install Time:**\n * - yarn: ~15s\n * - pnpm: ~5s (3x faster)\n *\n * **Test Execution:**\n * - Jest: ~8s\n * - Vitest: ~0.8s (10x faster)\n *\n * **Disk Usage:**\n * - yarn: ~200MB node_modules\n * - pnpm: ~80MB node_modules (60% reduction)\n *\n * ## Recommendations\n *\n * - **New projects**: Use the new defaults (pnpm + Vitest)\n * - **Existing projects**: Keep old defaults initially, migrate when convenient\n * - **CI/CD-heavy projects**: Consider pnpm for faster installs\n * - **Projects with BigInt**: Keep Jest until Vitest improves BigInt support\n */\nexport const migration_3_0_0: Migration = {\n version: \"3.0.0\",\n\n migrateGeneratorConfig: ({ config }) =>\n migrateConfig(config, (draft) => {\n // Only set old defaults if the fields are not already explicitly configured\n draft.packageManager ??= \"yarn\";\n draft.testFramework ??= \"jest\";\n }),\n\n migrateGeneratorsYml: ({ document }) => document\n};\n","import type { MigrationModule } from \"@fern-api/migrations-base\";\n\nimport { migration_1_0_0 } from \"./1.0.0.js\";\nimport { migration_2_0_0 } from \"./2.0.0.js\";\nimport { migration_3_0_0 } from \"./3.0.0.js\";\n\n/**\n * Migration module for TypeScript SDK generators.\n *\n * This module contains migrations for configuration changes across\n * all TypeScript SDK generator variants:\n * - fernapi/fern-typescript\n * - fernapi/fern-typescript-sdk\n * - fernapi/fern-typescript-node-sdk\n * - fernapi/fern-typescript-browser-sdk\n *\n * Each migration is defined in a separate file under this directory.\n * Migrations are automatically applied by the Fern CLI when running:\n * `fern generator upgrade --generator typescript-sdk`\n */\nconst migrationModule: MigrationModule = {\n migrations: [migration_1_0_0, migration_2_0_0, migration_3_0_0]\n};\n\nexport default migrationModule;\n","/**\n * @fern-api/generator-migrations\n *\n * Unified migration package for all Fern generator configurations.\n *\n * This package contains migrations for all generators, organized by generator name.\n */\n\nimport type { MigrationModule } from \"@fern-api/migrations-base\";\nimport typescriptSdkMigrations from \"./generators/typescript/migrations/index.js\";\n\n/**\n * All generator migrations indexed by full generator name.\n *\n * When adding migrations for a new generator:\n * 1. Add migrations under src/generators/{language}/migrations/\n * 2. Import the migration module\n * 3. Add entries for all generator name variants\n */\nexport const migrations: Record<string, MigrationModule> = {\n // TypeScript SDK - all variants share the same migrations\n \"fernapi/fern-typescript\": typescriptSdkMigrations,\n \"fernapi/fern-typescript-sdk\": typescriptSdkMigrations,\n \"fernapi/fern-typescript-node-sdk\": typescriptSdkMigrations,\n \"fernapi/fern-typescript-browser-sdk\": typescriptSdkMigrations\n};\n"],"x_google_ignoreList":[0],"mappings":";AACA,IAAI,UAAU,OAAO,IAAI,gBAAgB;AACzC,IAAI,YAAY,OAAO,IAAI,kBAAkB;AAC7C,IAAI,cAAc,OAAO,IAAI,cAAc;AAG3C,IAAI,SAAS,QAAQ,IAAI,aAAa,eAAe;CAEnD,SAAS,QAAQ;AACf,SAAO,mBAAmB,OAAO,kFAAkF,OAAO;;CAE5H,SAAS,OAAO;AACd,SAAO,sJAAsJ,MAAM;;CAErK;CAC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AU;AAE7B,QAAM,mBAAmB;AACzB,QAAM,kBAAkB;GAC1B;CAEN,uBAAuB,EAAE,eAAe;CAC3C;;;;;;;;;;;;;;;;;;ACzOD,MAAM,kBAAmC,EACrC,YAAY;CAAC;CAAiB;CAAiB;CAAgB,EAClE;AAED,yBAAe;;;;;;;;;;;;ACLf,MAAa,aAA8C;CAEvD,2BAA2BA;CAC3B,+BAA+BA;CAC/B,oCAAoCA;CACpC,uCAAuCA;CAC1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/generator-migrations",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Unified migration package for all Fern generator configurations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,45 +9,15 @@
9
9
  },
10
10
  "sideEffects": false,
11
11
  "type": "module",
12
- "exports": {
13
- ".": {
14
- "development": "./src/index.ts",
15
- "source": "./src/index.ts",
16
- "types": "./lib/index.d.ts",
17
- "import": "./lib/index.js",
18
- "default": "./lib/index.js"
19
- }
20
- },
21
- "main": "lib/index.js",
22
- "source": "src/index.ts",
23
- "types": "lib/index.d.ts",
12
+ "main": "dist/index.mjs",
13
+ "types": "dist/index.d.mts",
24
14
  "files": [
25
- "lib"
15
+ "dist"
26
16
  ],
27
- "scripts": {
28
- "clean": "rm -rf ./lib && tsc --build --clean",
29
- "compile": "tsc --build",
30
- "compile:debug": "tsc --build --sourceMap",
31
- "depcheck": "depcheck",
32
- "test": "vitest --passWithNoTests --run",
33
- "test:debug": "pnpm run test --inspect --no-file-parallelism",
34
- "test:update": "vitest --passWithNoTests --run -u"
35
- },
36
17
  "keywords": [
37
18
  "fern",
38
19
  "generator",
39
20
  "migration"
40
21
  ],
41
- "license": "MIT",
42
- "dependencies": {
43
- "@fern-api/migrations-base": "workspace:*"
44
- },
45
- "devDependencies": {
46
- "@fern-api/configs": "workspace:*",
47
- "@fern-api/logger": "workspace:*",
48
- "@types/node": "18.15.3",
49
- "depcheck": "^1.4.7",
50
- "typescript": "5.9.3",
51
- "vitest": "^4.0.8"
52
- }
22
+ "license": "MIT"
53
23
  }
package/README.md DELETED
@@ -1,352 +0,0 @@
1
- # @fern-api/generator-migrations
2
-
3
- Unified migration package for all Fern generator configurations.
4
-
5
- ## Overview
6
-
7
- This package contains migrations for all Fern generators, organized by generator name. When users run `fern generator upgrade`, the CLI automatically downloads this package and applies relevant migrations to transform their `generators.yml` configuration.
8
-
9
- ## Architecture
10
-
11
- ### Single Unified Package
12
-
13
- All generator migrations are consolidated into one npm package:
14
- - **Simpler maintenance**: One package to version and publish
15
- - **Easier discovery**: Single source of truth for all migrations
16
- - **Better for monorepo**: Fits naturally into the Fern monorepo structure
17
- - **Consistent versioning**: All generators migrate together
18
-
19
- ### Migration Index
20
-
21
- Migrations are exported as a record mapping full generator names to migration modules:
22
-
23
- ```typescript
24
- export const migrations: Record<string, MigrationModule> = {
25
- "fernapi/fern-typescript": typescriptSdkMigrations,
26
- "fernapi/fern-typescript-sdk": typescriptSdkMigrations,
27
- "fernapi/fern-typescript-node-sdk": typescriptSdkMigrations,
28
- "fernapi/fern-typescript-browser-sdk": typescriptSdkMigrations
29
- };
30
- ```
31
-
32
- ## Usage
33
-
34
- This package is consumed by the Fern CLI during generator upgrades. Users don't interact with it directly.
35
-
36
- The CLI:
37
- 1. Detects a generator version change
38
- 2. Downloads `@fern-api/generator-migrations@latest`
39
- 3. Looks up migrations by generator name
40
- 4. Filters migrations by version range
41
- 5. Applies migrations sequentially
42
- 6. Writes the transformed config back to `generators.yml`
43
-
44
- ## Publishing
45
-
46
- This package must be published to npm for the CLI to use it. The CLI dynamically installs `@fern-api/generator-migrations@latest` at runtime.
47
-
48
- ### When to Publish
49
-
50
- Publish a new version when:
51
- 1. Adding migrations for a new generator
52
- 2. Adding new migration versions to existing generators
53
- 3. Fixing bugs in existing migrations
54
-
55
- ### Publishing Steps
56
-
57
- ```bash
58
- # 1. Update version in package.json
59
- # Follow semver: patch for bug fixes, minor for new migrations, major for breaking changes
60
-
61
- # 2. Build the package
62
- pnpm --filter @fern-api/generator-migrations compile
63
-
64
- # 3. Test locally (optional but recommended)
65
- cd packages/generator-migrations
66
- npm link
67
- mkdir -p ~/.fern/migration-cache
68
- cd ~/.fern/migration-cache
69
- npm link @fern-api/generator-migrations
70
-
71
- # 4. Run tests
72
- pnpm --filter @fern-api/generator-migrations test
73
-
74
- # 5. Publish to npm
75
- cd packages/generator-migrations
76
- npm publish --access public
77
-
78
- # 6. Clean up local link (if used)
79
- cd ~/.fern/migration-cache
80
- npm unlink --no-save @fern-api/generator-migrations
81
- cd packages/generator-migrations
82
- npm unlink
83
- ```
84
-
85
- ### Version Strategy
86
-
87
- - **Patch** (0.1.0 → 0.1.1): Bug fixes in existing migrations
88
- - **Minor** (0.1.0 → 0.2.0): New migration versions added, new generators added
89
- - **Major** (0.1.0 → 1.0.0): Breaking changes to migration API
90
-
91
- The package version is independent of generator versions. It simply needs to increment when the package changes.
92
-
93
- ## Supported Generators
94
-
95
- ### TypeScript SDK
96
- - `fernapi/fern-typescript`
97
- - `fernapi/fern-typescript-sdk`
98
- - `fernapi/fern-typescript-node-sdk`
99
- - `fernapi/fern-typescript-browser-sdk`
100
-
101
- All TypeScript SDK variants share the same migrations.
102
-
103
- ## Adding Migrations for New Generators
104
-
105
- ### 1. Create Migration Directory
106
-
107
- ```bash
108
- mkdir -p src/generators/{language}/migrations
109
- ```
110
-
111
- ### 2. Create Migration Files
112
-
113
- ```typescript
114
- // src/generators/{language}/migrations/1.0.0.ts
115
- import type { Migration } from "@fern-api/migrations-base";
116
- import { migrateConfig } from "@fern-api/migrations-base";
117
-
118
- export const migration_1_0_0: Migration = {
119
- version: "1.0.0",
120
-
121
- migrateGeneratorConfig: ({ config }) =>
122
- migrateConfig(config, (draft) => {
123
- // Set old defaults for backwards compatibility
124
- draft.oldField ??= "old-default";
125
- }),
126
-
127
- migrateGeneratorsYml: ({ document }) => document
128
- };
129
- ```
130
-
131
- ### 3. Create Migration Index
132
-
133
- ```typescript
134
- // src/generators/{language}/migrations/index.ts
135
- import type { MigrationModule } from "@fern-api/migrations-base";
136
- import { migration_1_0_0 } from "./1.0.0.js";
137
-
138
- const migrationModule: MigrationModule = {
139
- migrations: [migration_1_0_0]
140
- };
141
-
142
- export default migrationModule;
143
- ```
144
-
145
- ### 4. Register in Main Index
146
-
147
- ```typescript
148
- // src/index.ts
149
- import languageMigrations from "./generators/{language}/migrations/index.js";
150
-
151
- export const migrations: Record<string, MigrationModule> = {
152
- // ... existing migrations
153
- "fernapi/fern-{language}-sdk": languageMigrations
154
- };
155
- ```
156
-
157
- ### 5. Add Tests
158
-
159
- Create tests following the structure in `src/__test__/README.md`.
160
-
161
- ### 6. Compile and Publish
162
-
163
- ```bash
164
- pnpm compile
165
- npm publish
166
- ```
167
-
168
- ## Migration Patterns
169
-
170
- ### Setting Defaults (Most Common)
171
-
172
- Use the nullish coalescing assignment operator (`??=`) to set values only if undefined:
173
-
174
- ```typescript
175
- migrateConfig(config, (draft) => {
176
- draft.field1 ??= false;
177
- draft.field2 ??= "default-value";
178
- draft.field3 ??= true;
179
- });
180
- ```
181
-
182
- ### Renaming Fields
183
-
184
- ```typescript
185
- migrateConfig(config, (draft) => {
186
- if (draft.oldFieldName !== undefined) {
187
- draft.newFieldName = draft.oldFieldName;
188
- delete draft.oldFieldName;
189
- }
190
- });
191
- ```
192
-
193
- ### Removing Fields
194
-
195
- ```typescript
196
- migrateConfig(config, (draft) => {
197
- delete draft.deprecatedField;
198
- });
199
- ```
200
-
201
- ### Conditional Transformations
202
-
203
- ```typescript
204
- migrateConfig(config, (draft) => {
205
- if (draft.oldFormat === "legacy") {
206
- draft.newFormat = { type: "modern", legacy: true };
207
- delete draft.oldFormat;
208
- }
209
- });
210
- ```
211
-
212
- ## Testing
213
-
214
- ```bash
215
- # Run all tests
216
- pnpm test
217
-
218
- # Run tests in watch mode
219
- pnpm test --watch
220
-
221
- # Update snapshots
222
- pnpm test:update
223
- ```
224
-
225
- See [src/__test__/README.md](src/__test__/README.md) for detailed testing documentation.
226
-
227
- ## Development
228
-
229
- ### Prerequisites
230
-
231
- This package depends on:
232
- - `@fern-api/migrations-base` - Core migration types and utilities
233
-
234
- ### Building
235
-
236
- ```bash
237
- # Compile TypeScript
238
- pnpm compile
239
-
240
- # Compile with source maps for debugging
241
- pnpm compile:debug
242
-
243
- # Clean build artifacts
244
- pnpm clean
245
- ```
246
-
247
- ### Publishing
248
-
249
- This package is automatically published when referenced in the Fern CLI's version configuration.
250
-
251
- ## Migration Best Practices
252
-
253
- ### 1. Pure Functions
254
- Always return new objects, never mutate input:
255
- ```typescript
256
- // ✅ Good - uses migrateConfig helper
257
- migrateConfig(config, (draft) => {
258
- draft.field = "value";
259
- });
260
-
261
- // ❌ Bad - mutates input
262
- config.config.field = "value";
263
- return config;
264
- ```
265
-
266
- ### 2. Idempotent
267
- Migrations should be safe to run multiple times:
268
- ```typescript
269
- // ✅ Good - only sets if undefined
270
- draft.field ??= "default";
271
-
272
- // ❌ Bad - overwrites existing values
273
- draft.field = "default";
274
- ```
275
-
276
- ### 3. Defensive Coding
277
- Don't assume fields exist:
278
- ```typescript
279
- // ✅ Good - checks before accessing
280
- if (draft.nested?.field) {
281
- draft.nested.field = transform(draft.nested.field);
282
- }
283
-
284
- // ❌ Bad - may throw if nested is undefined
285
- draft.nested.field = transform(draft.nested.field);
286
- ```
287
-
288
- ### 4. Preserve Unknown Fields
289
- Use spread operators and Immer's draft pattern:
290
- ```typescript
291
- // ✅ Good - Immer preserves unknown fields automatically
292
- migrateConfig(config, (draft) => {
293
- draft.knownField = "value";
294
- // unknownField is automatically preserved
295
- });
296
- ```
297
-
298
- ### 5. Document Intent
299
- Explain why migrations are needed:
300
- ```typescript
301
- /**
302
- * Migration for version 2.0.0
303
- *
304
- * This release changed the default for `streamType` from "wrapper" to "web"
305
- * to enable zero-dependency SDKs. For users upgrading from pre-2.0.0,
306
- * we explicitly set the old default to maintain backwards compatibility.
307
- *
308
- * Changed defaults:
309
- * - streamType: "wrapper" → "web"
310
- */
311
- ```
312
-
313
- ### 6. Version Alignment
314
- Migration version should match the generator version it upgrades TO:
315
- ```typescript
316
- // ✅ Good - migration upgrades TO 2.0.0
317
- export const migration_2_0_0: Migration = {
318
- version: "2.0.0",
319
- // ...
320
- };
321
- ```
322
-
323
- ### 7. Test Thoroughly
324
- Write tests for:
325
- - Setting defaults
326
- - Preserving explicit values
327
- - Preserving unknown fields
328
- - Edge cases (null, undefined, invalid types)
329
- - Sequential application
330
- - Immutability
331
-
332
- ## Related Documentation
333
-
334
- - [CLI Migration System](../cli/cli/src/commands/upgrade/migrations/README.md)
335
- - [migrations-base Package](../migrations-base/README.md)
336
- - [TypeScript SDK Migrations Example](src/generators/typescript/migrations/)
337
- - [Test Documentation](src/__test__/README.md)
338
-
339
- ## Contributing
340
-
341
- When adding new migrations:
342
-
343
- 1. Create migration files following the patterns above
344
- 2. Write comprehensive tests
345
- 3. Document what changed and why
346
- 4. Ensure migrations are idempotent and pure
347
- 5. Test with real generator upgrades locally
348
- 6. Update this README if adding a new generator
349
-
350
- ## License
351
-
352
- MIT