@tailor-platform/sdk 2.13.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.
- package/CHANGELOG.md +10 -0
- package/dist/cli/lib.mjs +1 -1
- package/dist/cli/main.mjs +1 -1
- package/dist/completion/zsh-worker.zsh +1 -1
- package/dist/plugin/builtin/seed/index.mjs +1 -1
- package/dist/{register-ts-hook-CoZS-8Mx.mjs → register-ts-hook-BJmGCQAA.mjs} +8 -8
- package/dist/register-ts-hook-BJmGCQAA.mjs.map +1 -0
- package/dist/{seed-CMkupmX8.mjs → seed-CCc9Xk66.mjs} +2 -2
- package/dist/seed-CCc9Xk66.mjs.map +1 -0
- package/package.json +5 -5
- package/dist/register-ts-hook-CoZS-8Mx.mjs.map +0 -1
- package/dist/seed-CMkupmX8.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @tailor-platform/sdk
|
|
2
2
|
|
|
3
|
+
## 2.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2249](https://github.com/tailor-platform/sdk/pull/2249) [`ab26f98`](https://github.com/tailor-platform/sdk/commit/ab26f98c19b85eac31d0dd84d889fa313ad72c58) Thanks [@dqn](https://github.com/dqn)! - Fix the generated migration `db.ts` for an enum field whose allowed values change in the same migration as its required-ness: the write slots now follow the post-migration schema, so making the field required rejects `null` in `migrate.ts`, and making it optional accepts `null`. When an emptied enum becomes optional, the scaffolded `migrate.ts` writes `null` for the removed values instead of a `"NEW_VALUE"` placeholder.
|
|
8
|
+
|
|
9
|
+
- [#2256](https://github.com/tailor-platform/sdk/pull/2256) [`915f35d`](https://github.com/tailor-platform/sdk/commit/915f35d5148144940721cc115fd0eb961eb5a851) Thanks [@tailor-bobbin](https://github.com/apps/tailor-bobbin)! - Fix `seed apply --upsert` rejecting rows that omit fields the platform fills in on create, such as the `createdAt` / `updatedAt` fields from `db.fields.timestamps()` or any field declared with `.default()`
|
|
10
|
+
|
|
11
|
+
- [#2260](https://github.com/tailor-platform/sdk/pull/2260) [`1f1bd6f`](https://github.com/tailor-platform/sdk/commit/1f1bd6f13f4000a355c4fab61d46ddd71d508845) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): update oxc to v0.148.0
|
|
12
|
+
|
|
3
13
|
## 2.13.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/dist/cli/lib.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as ee,r as e}from"../logger-CCjs1DuH.mjs";import{A as t,Ar as n,At as r,B as i,Bn as a,Bt as o,Cn as s,Cr as c,D as l,Et as u,F as d,Fn as f,G as p,Gr as m,Gt as h,H as g,Hn as _,It as v,J as y,Jn as b,Jr as x,Jt as S,Kn as C,Lr as w,Lt as T,M as E,N as D,Ot as O,P as k,Pt as A,Q as j,Qn as M,Qr as N,Qt as P,Rn as F,Rt as I,S as L,St as R,T as z,Tr as B,Tt as V,U as H,Un as U,Ut as W,Vn as G,Vt as K,Xn as q,Xr as J,Y,Yn as X,Yr as Z,Zn as Q,Zr as te,Zt as ne,_ as $,b as re,ct as ie,d as ae,dn as oe,et as se,fr as ce,ft as le,h as ue,ht as de,i as fe,ii as pe,it as me,jt as he,k as ge,kn as _e,l as ve,mr as ye,mt as be,n as xe,nr as Se,nt as Ce,on as we,or as Te,ot as Ee,p as De,pn as Oe,pr as ke,qt as Ae,r as je,rn as Me,s as Ne,sr as Pe,t as Fe,un as Ie,ut as Le,vt as Re,wr as ze,wt as Be,xr as Ve,y as He,yt as Ue,zn as We}from"../register-ts-hook-
|
|
1
|
+
import{n as ee,r as e}from"../logger-CCjs1DuH.mjs";import{A as t,Ar as n,At as r,B as i,Bn as a,Bt as o,Cn as s,Cr as c,D as l,Et as u,F as d,Fn as f,G as p,Gr as m,Gt as h,H as g,Hn as _,It as v,J as y,Jn as b,Jr as x,Jt as S,Kn as C,Lr as w,Lt as T,M as E,N as D,Ot as O,P as k,Pt as A,Q as j,Qn as M,Qr as N,Qt as P,Rn as F,Rt as I,S as L,St as R,T as z,Tr as B,Tt as V,U as H,Un as U,Ut as W,Vn as G,Vt as K,Xn as q,Xr as J,Y,Yn as X,Yr as Z,Zn as Q,Zr as te,Zt as ne,_ as $,b as re,ct as ie,d as ae,dn as oe,et as se,fr as ce,ft as le,h as ue,ht as de,i as fe,ii as pe,it as me,jt as he,k as ge,kn as _e,l as ve,mr as ye,mt as be,n as xe,nr as Se,nt as Ce,on as we,or as Te,ot as Ee,p as De,pn as Oe,pr as ke,qt as Ae,r as je,rn as Me,s as Ne,sr as Pe,t as Fe,un as Ie,ut as Le,vt as Re,wr as ze,wt as Be,xr as Ve,y as He,yt as Ue,zn as We}from"../register-ts-hook-BJmGCQAA.mjs";import{Q as Ge}from"../application-D3HlhR3i.mjs";import{t as Ke}from"../type-source--ZNcV8RJ.mjs";import{arg as qe,defineCommand as Je,runCommand as Ye,runMain as Xe}from"politty";await Fe(new URL(`./ts-hook.mjs`,import.meta.url));export{We as DB_TYPES_FILE_NAME,a as DIFF_FILE_NAME,G as INITIAL_SCHEMA_NUMBER,_ as MIGRATE_FILE_NAME,U as MIGRATE_TEST_FILE_NAME,Se as MIGRATION_LABEL_KEY,C as SCHEMA_FILE_NAME,c as apiCall,P as apply,P as deploy,qe as arg,ze as assertWritable,s as bundleMigrationScript,k as bundleSeedScript,D as chunkSeedData,Te as compareLocalTypesWithSnapshot,Pe as compareSnapshots,x as configArg,Z as confirmationArgs,J as createCommonArgs,Le as createFolder,f as createSnapshotFromLocalTypes,we as createWorkspace,m as defineAppCommand,Je as defineCommand,ie as deleteFolder,He as deleteWorkspace,g as deployStaticWebsite,te as deploymentArgs,oe as ensureConfigId,xe as errorToJson,V as executeScript,Be as extractOwnedNamespaces,ce as formatDiffSummary,ke as formatMigrationDiff,Ue as generate,Oe as generateUserTypes,L as getAppHealth,ne as getExecutor,T as getExecutorJob,I as getExecutorWaitFailureMessage,Ee as getFolder,r as getFunctionRegistry,b as getLatestMigrationNumber,de as getMachineUserToken,X as getMigrationDirPath,q as getMigrationFilePath,Q as getMigrationFiles,_e as getNamespacesWithMigrations,M as getNextMigrationNumber,be as getOAuth2Client,se as getOrganization,h as getWorkflow,Ae as getWorkflowExecution,$ as getWorkspace,ye as hasChanges,Ge as initOperatorClient,De as inviteUser,Ke as isPluginGeneratedTable,re as listApps,o as listExecutorJobs,v as listExecutors,me as listFolders,O as listFunctionRegistries,Re as listMachineUsers,le as listOAuth2Clients,j as listOrganizations,ae as listUsers,he as listWebhookExecutors,S as listWorkflowExecutions,ge as listWorkflows,Me as listWorkspaces,n as loadAccessToken,B as loadConfig,N as loadEnvFiles,E as loadSeedContext,R as loadTailorDBNamespaces,w as loadWorkspaceId,i as logBetaWarning,ee as logger,d as migrateGenerate,Y as organizationTree,Ve as prompt,fe as query,F as reconstructSnapshotFromMigrations,p as remove,ve as removeUser,ue as restoreWorkspace,l as resumeWorkflow,Ye as runCommand,Xe as runMain,je as serializeError,H as show,W as startWorkflow,e as styles,A as triggerExecutor,t as truncate,Ce as updateFolder,y as updateOrganization,Ne as updateUser,u as waitForExecution,z as waitWorkflowExecution,K as watchExecutorJob,pe as workspaceArgs,Ie as workspaceNameSchema};
|
|
2
2
|
//# sourceMappingURL=lib.mjs.map
|
package/dist/cli/main.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"../schema-6d_OHyZf.mjs";import{E as t,Ft as n,Ht as r,Ot as i,q as a}from"../workspace_resource_pb-u9bj6p3i.mjs";import{t as o}from"../assert-WeXvmG4j.mjs";import{a as s,n as c,r as l}from"../logger-CCjs1DuH.mjs";import{$ as u,$n as d,$r as f,$t as p,An as m,Ar as h,B as g,Br as _,C as v,Cn as y,Cr as b,Ct as x,Dn as ee,Dr as S,Dt as C,E as te,En as ne,Er as re,Fn as ie,Fr as ae,Ft as oe,Gn as se,Gr as w,Hr as ce,Ht as le,I as ue,In as de,Ir as fe,Jn as pe,Jr as me,K as he,Kt as ge,L as _e,Ln as T,Lr as ve,M as ye,Mn as be,Mr as xe,Mt as Se,N as Ce,Nn as we,Nr as Te,Nt as Ee,O as De,On as Oe,Or as ke,P as Ae,Pn as je,Pr as Me,R as Ne,Rn as E,Rr as Pe,Sn as Fe,Sr as D,St as Ie,Tn as Le,Tr as O,Tt as Re,Ur as ze,V as Be,Vr as Ve,W as He,Wn as Ue,Wr as k,Wt as We,X as Ge,Xn as Ke,Xt as qe,Yr as A,Yt as Je,Z as Ye,Zn as Xe,Zr as j,_n as Ze,_r as Qe,_t as $e,a as et,an as tt,ar as nt,at as rt,bn as it,br as at,bt as ot,c as st,cn as ct,cr as lt,dr as ut,dt,ei as ft,en as pt,er as mt,f as ht,fn as gt,fr as _t,g as vt,gn as yt,gr as M,gt as bt,hn as xt,hr as St,ii as N,in as Ct,ir as wt,j as Tt,jn as Et,jr as Dt,kn as P,kr as Ot,kt,ln as At,lr as jt,lt as Mt,m as Nt,mn as Pt,mr as Ft,ni as It,nn as Lt,nr as Rt,o as zt,or as Bt,pr as Vt,pt as Ht,q as Ut,qn as Wt,qr as Gt,r as Kt,ri as F,rr as qt,rt as Jt,sn as Yt,sr as Xt,st as Zt,t as Qt,ti as I,tn as $t,tr as en,tt as tn,u as nn,ur as L,v as rn,vn as an,vr as on,w as sn,wn as cn,wr as R,wt as ln,x as un,xn as dn,xr as z,xt as fn,yn as pn,yr as mn,yt as hn,z as gn,zr as B,zt as _n}from"../register-ts-hook-
|
|
2
|
+
import{r as e}from"../schema-6d_OHyZf.mjs";import{E as t,Ft as n,Ht as r,Ot as i,q as a}from"../workspace_resource_pb-u9bj6p3i.mjs";import{t as o}from"../assert-WeXvmG4j.mjs";import{a as s,n as c,r as l}from"../logger-CCjs1DuH.mjs";import{$ as u,$n as d,$r as f,$t as p,An as m,Ar as h,B as g,Br as _,C as v,Cn as y,Cr as b,Ct as x,Dn as ee,Dr as S,Dt as C,E as te,En as ne,Er as re,Fn as ie,Fr as ae,Ft as oe,Gn as se,Gr as w,Hr as ce,Ht as le,I as ue,In as de,Ir as fe,Jn as pe,Jr as me,K as he,Kt as ge,L as _e,Ln as T,Lr as ve,M as ye,Mn as be,Mr as xe,Mt as Se,N as Ce,Nn as we,Nr as Te,Nt as Ee,O as De,On as Oe,Or as ke,P as Ae,Pn as je,Pr as Me,R as Ne,Rn as E,Rr as Pe,Sn as Fe,Sr as D,St as Ie,Tn as Le,Tr as O,Tt as Re,Ur as ze,V as Be,Vr as Ve,W as He,Wn as Ue,Wr as k,Wt as We,X as Ge,Xn as Ke,Xt as qe,Yr as A,Yt as Je,Z as Ye,Zn as Xe,Zr as j,_n as Ze,_r as Qe,_t as $e,a as et,an as tt,ar as nt,at as rt,bn as it,br as at,bt as ot,c as st,cn as ct,cr as lt,dr as ut,dt,ei as ft,en as pt,er as mt,f as ht,fn as gt,fr as _t,g as vt,gn as yt,gr as M,gt as bt,hn as xt,hr as St,ii as N,in as Ct,ir as wt,j as Tt,jn as Et,jr as Dt,kn as P,kr as Ot,kt,ln as At,lr as jt,lt as Mt,m as Nt,mn as Pt,mr as Ft,ni as It,nn as Lt,nr as Rt,o as zt,or as Bt,pr as Vt,pt as Ht,q as Ut,qn as Wt,qr as Gt,r as Kt,ri as F,rr as qt,rt as Jt,sn as Yt,sr as Xt,st as Zt,t as Qt,ti as I,tn as $t,tr as en,tt as tn,u as nn,ur as L,v as rn,vn as an,vr as on,w as sn,wn as cn,wr as R,wt as ln,x as un,xn as dn,xr as z,xt as fn,yn as pn,yr as mn,yt as hn,z as gn,zr as B,zt as _n}from"../register-ts-hook-BJmGCQAA.mjs";import{$ as vn,A as yn,B as bn,D as xn,E as Sn,G as Cn,H as wn,J as Tn,K as En,M as Dn,O as On,Q as kn,T as An,V as jn,W as V,X as Mn,Y as Nn,Z as Pn,_ as Fn,a as In,d as Ln,f as Rn,j as zn,k as Bn,m as Vn,o as Hn,u as Un,v as Wn,z as Gn}from"../application-D3HlhR3i.mjs";import{g as Kn,i as qn,r as Jn}from"../service-BzsSm2f6.mjs";import{t as H}from"../multiline-EyzjEwn9.mjs";import{t as Yn}from"../package-json-C690ceex.mjs";import{t as Xn}from"../user-agent-vdHYF3QL.mjs";import{a as Zn,i as Qn,n as $n,o as er,r as tr,t as nr}from"../errors-BlX4gUw5.mjs";import{t as rr}from"../service_pb-CxHztLk1.mjs";import{a as ir,i as ar,o as or,r as sr,t as cr}from"../crashreport-BN28xp5B.mjs";import{a as lr,i as ur,n as dr}from"../kysely-type-B-BOlXH7.mjs";import*as U from"pathe";import{dirname as fr,resolve as pr}from"pathe";import{resolvePackageJSON as mr}from"pkg-types";import{arg as W,defineCommand as G,extractFields as hr,runCommand as K,runMain as gr,toCamelCase as _r}from"politty";import{withCompletionCommand as vr}from"politty/completion";import{withSkillCommand as yr}from"politty/skill";import{z as q}from"zod";import{ScalarType as J,create as br}from"@bufbuild/protobuf";import*as Y from"node:fs";import{accessSync as xr,constants as Sr,readdirSync as Cr}from"node:fs";import{timestampDate as X}from"@bufbuild/protobuf/wkt";import{pathToFileURL as wr}from"node:url";import{generateCodeVerifier as Tr}from"@badgateway/oauth2-client";import{Code as Z,ConnectError as Q}from"@connectrpc/connect";import*as Er from"node:crypto";import{randomBytes as Dr}from"node:crypto";import*as Or from"node:http";import kr from"open";import*as Ar from"rolldown";import{parseSync as jr}from"oxc-parser";import*as Mr from"node:os";import*as $ from"node:fs/promises";import{TraceMap as Nr,generatedPositionFor as Pr,originalPositionFor as Fr}from"@jridgewell/trace-mapping";import{spawn as Ir,spawnSync as Lr}from"node:child_process";const Rr=rr.methods.filter(e=>e.methodKind===`unary`);function listMethodNames(){return Rr.map(e=>e.name).toSorted()}function listMethodChoices(){return Rr.flatMap(e=>[e.name,`${rr.typeName}/${e.name}`]).toSorted()}function getMethodDescriptor(e){return Rr.find(t=>t.name===e)}function extractMethodName(e){return e.includes(`/`)?e.split(`/`).pop()??e:e}function nestedMessage(e){if(e.fieldKind===`message`||e.fieldKind===`list`&&e.listKind===`message`||e.fieldKind===`map`&&e.mapKind===`message`)return e.message}function isWellKnownType(e){return e.typeName.startsWith(`google.protobuf.`)}const zr=new Set([`google.protobuf.Struct`,`google.protobuf.Value`,`google.protobuf.ListValue`,`google.protobuf.NullValue`,`google.protobuf.Any`,`google.protobuf.Empty`]);function isUnrepresentableWellKnownType(e){return zr.has(e.typeName)}function enumerateAllFieldCompletions(e){let t=getMethodDescriptor(e);if(!t)return[];let n=[],r=new Set;function walk(e,t){r.add(e);for(let i of e.fields){if(i.fieldKind===`list`||i.fieldKind===`map`)continue;let e=t+i.localName;if(i.fieldKind===`message`){if(isUnrepresentableWellKnownType(i.message))continue;if(!isWellKnownType(i.message)){let t=i.message;n.push({value:`${e}.`,description:`${e} (message)`}),r.has(t)||walk(t,`${e}.`);continue}}if(n.push({value:`${e}=`,description:`Set ${e}`}),i.fieldKind===`enum`)for(let t of i.enum.values)n.push({value:`${e}=${t.name}`,description:t.name});else i.fieldKind===`scalar`&&i.scalar===J.BOOL&&(n.push({value:`${e}=true`,description:`true`}),n.push({value:`${e}=false`,description:`false`}))}r.delete(e)}return walk(t.input,``),n}function resolveLeafField(e,t){let n=e;for(let e=0;e<t.length;e++){let r=n.fields.find(n=>n.localName===t[e]);if(!r)return;if(e===t.length-1)return r.fieldKind===`message`&&isUnrepresentableWellKnownType(r.message)?void 0:r;if(r.fieldKind!==`message`||isWellKnownType(r.message))return;n=r.message}}const Br={[J.DOUBLE]:`double`,[J.FLOAT]:`float`,[J.INT64]:`int64`,[J.UINT64]:`uint64`,[J.INT32]:`int32`,[J.FIXED64]:`fixed64`,[J.FIXED32]:`fixed32`,[J.BOOL]:`bool`,[J.STRING]:`string`,[J.BYTES]:`bytes`,[J.UINT32]:`uint32`,[J.SFIXED32]:`sfixed32`,[J.SFIXED64]:`sfixed64`,[J.SINT32]:`sint32`,[J.SINT64]:`sint64`};function shortName(e){let t=e.lastIndexOf(`.`);return t<0?e:e.slice(t+1)}function scalarLabel(e){return Br[e]??`scalar(${e})`}function enumLabel(e){return`enum ${shortName(e.typeName)}`}function enumOf(e){if(e.fieldKind===`enum`||e.fieldKind===`list`&&e.listKind===`enum`)return e.enum}function describeFieldType(e){switch(e.fieldKind){case`scalar`:return scalarLabel(e.scalar);case`enum`:return enumLabel(e.enum);case`message`:return shortName(e.message.typeName);case`list`:{let t;return t=e.listKind===`scalar`?scalarLabel(e.scalar):e.listKind===`enum`?enumLabel(e.enum):shortName(e.message.typeName),`repeated ${t}`}case`map`:{let t=scalarLabel(e.mapKey),n;return n=e.mapKind===`scalar`?scalarLabel(e.scalar):e.mapKind===`enum`?enumLabel(e.enum):shortName(e.message.typeName),`map<${t}, ${n}>`}default:return`<unknown>`}}function fieldToJson(e,t){let n={name:e.localName,protoName:e.name,type:describeFieldType(e),fieldKind:e.fieldKind,repeated:e.fieldKind===`list`};e.oneof&&(n.oneof=e.oneof.name);let r=enumOf(e);r&&(n.enumValues=r.values.map(e=>e.name));let i=nestedMessage(e);return i&&!t.has(i)?(t.add(i),n.message={typeName:i.typeName,fields:i.fields.map(e=>fieldToJson(e,t))},t.delete(i)):i&&(n.message={typeName:i.typeName,fields:[],recursive:!0}),n}function renderInspectJson(e){let t=new Set([e.input]);return{method:e.name,input:{typeName:e.input.typeName,fields:e.input.fields.map(e=>fieldToJson(e,t))},output:{typeName:e.output.typeName}}}function renderFieldText(e,t,n){let r=[],i=e.oneof?` (oneof ${e.oneof.name})`:``;r.push(`${t}${e.localName}: ${describeFieldType(e)}${i}`);let a=enumOf(e);if(a){let e=a.values.map(e=>e.name).join(`, `);r.push(`${t} values: ${e}`)}let o=nestedMessage(e);if(o&&!n.has(o)){n.add(o);for(let e of o.fields)r.push(...renderFieldText(e,`${t} `,n));n.delete(o)}else o&&r.push(`${t} …(recursive ${o.typeName})`);return r}function renderInspectText(e){let t=[];t.push(`${e.name}`),t.push(` request: ${e.input.typeName}`);let n=new Set([e.input]);for(let r of e.input.fields)t.push(...renderFieldText(r,` `,n));return t.push(` response: ${e.output.typeName}`),t.join(`
|
|
3
3
|
`)}const Vr=w({name:`inspect`,description:`Print the input message tree of an OperatorService endpoint.`,notes:"Combine with the global `--json` flag for a machine-readable descriptor. Recursive type references and `oneof` membership are annotated. Use `tailor api list` to discover endpoint names.",examples:[{cmd:`GetApplication`,desc:`Show fields of GetApplicationRequest.`},{cmd:`CreateExecutorExecutor`,desc:"Inspect a deeply nested input with `(oneof config)` annotations."}],args:q.strictObject({endpoint:W(q.string(),{positional:!0,description:`API endpoint to inspect (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication').`,completion:{custom:{choices:listMethodNames()}}})}),run:e=>{let t=extractMethodName(e.endpoint),n=getMethodDescriptor(t);if(!n)throw nr({message:`unknown method: ${t}`,suggestion:"Run `tailor api list` to see available methods.",command:`api inspect`});c.jsonMode?c.out(renderInspectJson(n)):c.out(renderInspectText(n))}}),Hr=w({name:`list`,description:`List all invocable OperatorService methods.`,notes:`Only single-request (non-streaming) methods are listed, because the CLI issues a single JSON request and reads one JSON response.`,args:q.strictObject({}),run:()=>{let e=listMethodNames();if(c.jsonMode)c.out(e);else for(let t of e)c.out(t)}});function resolveNamespaceName(e,t){if(/Auth|Tenant|UserProfile/.test(e))return t.auth?.name;if(/IdP/.test(e))return t.idp?.length===1?o(t.idp[0],`idp config missing`).name:void 0;if(/TailorDB/.test(e)){let e=Object.keys(t.db??{});return e.length===1?e[0]:void 0}if(/Pipeline/.test(e)){let e=Object.keys(t.resolver??{});return e.length===1?e[0]:void 0}}function parseBodyAsObject(e){let t;try{t=JSON.parse(e)}catch{return}if(!(typeof t!=`object`||!t||Array.isArray(t)))return t}function setNestedPath(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=o(t[e],`path segment missing`),i=r[n];(typeof i!=`object`||!i||Array.isArray(i))&&(r[n]={}),r=r[n]}r[o(t[t.length-1],`path last segment missing`)]=n}function coerceFieldValue(e,t){if(e&&e.fieldKind===`scalar`&&e.scalar===J.BOOL){if(t===`true`)return!0;if(t===`false`)return!1;throw Error(`Invalid value for bool field: '${t}'. Expected 'true' or 'false'.`)}return t}function normalizeBodyFieldKeys(e,t){let n=new Map;for(let e of t)n.set(e.name,e.localName),n.set(e.jsonName,e.localName);let r=!1;for(let t of Object.keys(e)){let i=n.get(t);!i||i===t||(Object.hasOwn(e,i)||(e[i]=e[t]),delete e[t],r=!0)}return r}const Ur=new Set([`__proto__`,`constructor`,`prototype`]),Wr=q.string().transform((e,t)=>{let n=e.indexOf(`=`);if(n<0)return t.addIssue({code:`custom`,message:`Invalid field format: '${e}'. Expected format: 'key=value' or 'a.b.c=value'`}),q.NEVER;let r=e.slice(0,n);if(r.length===0)return t.addIssue({code:`custom`,message:`Field key cannot be empty`}),q.NEVER;let i=r.split(`.`);if(i.some(e=>e.length===0))return t.addIssue({code:`custom`,message:`Invalid field key: '${r}'. Dotted segments cannot be empty`}),q.NEVER;let a=i.find(e=>Ur.has(e));return a?(t.addIssue({code:`custom`,message:`Invalid field key: '${r}'. Segment '${a}' is not allowed.`}),q.NEVER):{path:i,value:e.slice(n+1)}}),Gr=w({name:`api`,description:`Call Tailor Platform API endpoints directly.`,notes:"Use `tailor api list` to enumerate invocable methods and `tailor api inspect <endpoint>` to print an endpoint's input message tree (combine with `--json` for machine-readable output).\n\nThe request body is inferred from the target endpoint's request schema, and commonly required fields are auto-injected so they can be omitted from `--body`:\n\n- `workspaceId` — resolved from `-w` / `TAILOR_PLATFORM_WORKSPACE_ID` / the selected profile.\n- `namespaceName` — resolved from `tailor.config.ts` based on the endpoint's service:\n - Auth / Tenant / UserProfile endpoints use `auth.name`.\n - IdP / TailorDB / Pipeline endpoints use the sole configured namespace when exactly one is defined.\n\nValues already present in `--body` are never overridden. If a value cannot be resolved (e.g. no config found), injection is silently skipped and the server-side validation error takes precedence.\n\nUse `--field key=value` (repeatable) to set request body fields without writing JSON. Dotted keys (e.g. `application.name=foo`) build nested objects. `--field` overrides matching fields in `--body` and tab-completes from the endpoint's request schema.",examples:[{cmd:`GetApplication -b '{"applicationName":"app-1"}'`,desc:`Call an endpoint; workspaceId is auto-injected.`},{cmd:`GetApplication -f applicationName=app-1`,desc:`Same as above, using --field instead of --body.`},{cmd:`list`,desc:`List all invocable OperatorService methods.`},{cmd:`inspect GetApplication`,desc:`Show the input message tree for an endpoint.`}],subCommands:{list:Hr,inspect:Vr},args:q.strictObject({...N,...me,body:W(q.string().default(`{}`),{alias:`b`,description:`Request body as JSON.`}),field:W(Wr.array().optional(),{alias:`f`,description:"Set a body field as `key=value` (repeatable; dotted keys nest). Overrides --body.",completion:{custom:{expand:{dependsOn:[`endpoint`],enumerate:({endpoint:e})=>enumerateAllFieldCompletions(extractMethodName(e??``))}}}}),endpoint:W(q.string(),{positional:!0,description:`API endpoint to call (e.g., 'GetApplication' or 'tailor.v1.OperatorService/GetApplication').`,completion:{custom:{choices:listMethodChoices()}}})}),run:async e=>{await R({profile:e.profile});let t=extractMethodName(e.endpoint),n=getMethodDescriptor(t),r=parseBodyAsObject(e.body),i=!1;if(e.field&&e.field.length>0){if(!r)throw Error(`--field requires --body to be a JSON object (or omitted).`);for(let t of e.field){let e=n?resolveLeafField(n.input,t.path):void 0;setNestedPath(r,t.path,coerceFieldValue(e,t.value))}i=!0}if(r&&n){normalizeBodyFieldKeys(r,n.input.fields)&&(i=!0);let a=n.input.fields.map(e=>e.localName);if(a.includes(`workspaceId`)&&!Object.hasOwn(r,`workspaceId`))try{r.workspaceId=await ve({workspaceId:e[`workspace-id`],profile:e.profile}),i=!0}catch{}if(a.includes(`namespaceName`)&&!Object.hasOwn(r,`namespaceName`))try{let{config:n}=await O(e.config),a=resolveNamespaceName(t,n);a&&(r.namespaceName=a,i=!0)}catch{}}let a=await b({profile:e.profile,endpoint:e.endpoint,body:i&&r?JSON.stringify(r):e.body});c.out(JSON.stringify(a.data,null,2))}}),Kr=w({name:`status`,description:`Show the active Tailor Platform authentication status without printing tokens.`,args:q.strictObject({profile:N.profile}),run:async({profile:e})=>{let t=await Dt({profile:e});if(c.out(t),!t.authenticated)throw Error(`Not authenticated. Run 'tailor login' and try again.`)}}),qr=w({name:`token`,description:`Print a valid Tailor Platform access token to stdout, refreshing it first if expired.`,args:q.strictObject({profile:N.profile}),run:async({profile:e})=>{let t=await h({profile:e});c.out(t)}}),Jr=G({name:`auth`,description:`Authentication helpers for scripts and plugins.`,subCommands:{status:Kr,token:qr}}),Yr={name:W(q.string(),{alias:`n`,description:`Auth connection name`})};async function fetchOIDCDiscovery(e){let t=e.replace(/\/$/,``)+`/.well-known/openid-configuration`,n=await fetch(t).catch(e=>{throw Error(`Failed to fetch OIDC discovery from ${t}: ${Zn(e).message}`,{cause:e})});if(!n.ok)throw Error(`Failed to fetch OIDC discovery from ${t}: ${n.status}`);return n.json()}function randomState$1(){return Er.randomBytes(32).toString(`base64url`)}const Xr=w({name:`authorize`,description:`Authorize an auth connection via OAuth2 flow.`,args:q.strictObject({...N,...Yr,scopes:q.string().optional().default(`openid,profile,email`).describe(`OAuth2 scopes to request (comma-separated)`),port:q.coerce.number().optional().default(8080).describe(`Local callback server port`),"no-browser":q.boolean().optional().default(!1).describe(`Don't open browser automatically`)}),run:async e=>{await R({profile:e.profile});let{client:t,workspaceId:n}=await D({profile:e.profile,workspaceId:e[`workspace-id`]}),r=(await jn(async(e,r)=>{let{connections:i,nextPageToken:a}=await t.listAuthConnections({workspaceId:n,pageToken:e,pageSize:r});return[i,a]})).find(t=>t.name===e.name);if(!r)throw Error(`Auth connection "${e.name}" not found.`);if(r.config.case!==`oauth2`)throw Error(`Auth connection "${e.name}" is not an OAuth2 connection.`);let i=r.config.value,a=`http://localhost:${e.port}/callback`,o=randomState$1(),s;s=i.authUrl?i.authUrl:(await fetchOIDCDiscovery(i.providerUrl)).authorization_endpoint;let l=new URL(s);l.searchParams.set(`client_id`,i.clientId),l.searchParams.set(`redirect_uri`,a),l.searchParams.set(`response_type`,`code`),l.searchParams.set(`scope`,e.scopes.replace(/,/g,` `)),l.searchParams.set(`state`,o),l.searchParams.set(`access_type`,`offline`),await new Promise((r,i)=>{let handleCallback=async(c,l)=>{if(!c.url?.startsWith(`/callback`)){l.writeHead(404),l.end(`Not found`);return}try{let i=new URL(c.url,`http://localhost:${e.port}`),u=i.searchParams.get(`code`),d=i.searchParams.get(`state`),f=i.searchParams.get(`error`);if(f)throw Error(`Authorization failed: ${f}`);if(d!==o)throw Error(`State mismatch — possible CSRF attack.`);if(!u)throw Error(`No authorization code received.`);await t.exchangeAuthConnectionAuthorizationCode({workspaceId:n,connectionName:e.name,authorizationCode:u,redirectUri:a}),l.writeHead(200,{"Content-Type":`text/html`}),l.end(`<html><body><h1>Authorization successful</h1><p>You can close this window.</p></body></html>`),s.close(),r()}catch(e){l.writeHead(400,{"Content-Type":`text/plain`}),l.end(`Authorization failed: ${e instanceof Error?e.message:`Unknown error`}`),s.close(),i(Zn(e))}},s=Or.createServer((e,t)=>void handleCallback(e,t)),u=setTimeout(()=>{s.close(),i(Error(`Authorization timeout exceeded (5 minutes).`))},3e5);s.on(`close`,()=>{clearTimeout(u)}),s.on(`error`,t=>{clearTimeout(u);let n=t.code,r=n===`EADDRINUSE`||n===`EACCES`?`Try a different port with --port, or authorize via the Console instead:`:`Authorize via the Console instead:`;c.warn(`Could not start the local callback server on port ${e.port}${n?` (${n})`:``}.\n${r}\n tailor authconnection open`),i(t)});let announceAuthorizeUrl=async()=>{let t=l.toString();if(c.info(e[`no-browser`]?`Open this URL in your browser to authorize:\n\n${t}\n`:`Opening browser for authorization:\n\n${t}\n`),c.info(`If this flow doesn't complete, you can authorize via the Console instead:
|
|
4
4
|
tailor authconnection open`),!e[`no-browser`])try{await kr(t)}catch{c.warn(`Failed to open browser automatically. Please open the URL above manually.`)}};s.listen(e.port,()=>void announceAuthorizeUrl())}),c.success(`Auth connection "${e.name}" authorized successfully.`)}}),Zr=w({name:`delete`,description:`Delete an auth connection entirely.`,args:q.strictObject({...N,...Yr,...A}),run:async e=>{await R({profile:e.profile});let{client:t,workspaceId:n}=await D({profile:e.profile,workspaceId:e[`workspace-id`]});if(!e.yes&&await z.text({message:`Enter the connection name to confirm deletion ("${e.name}"):`})!==e.name){c.info(`Auth connection deletion cancelled.`);return}try{await t.deleteAuthConnection({workspaceId:n,connectionName:e.name})}catch(t){throw t instanceof Q&&t.code===Z.NotFound?Error(`Auth connection "${e.name}" not found.`,{cause:t}):t}c.success(`Auth connection "${e.name}" deleted.`)}});function connectionInfo(e){let t=e.config.case===`oauth2`?e.config.value:void 0;return{name:e.name,type:e.config.case??`unknown`,providerUrl:t?.providerUrl??``,issuerUrl:t?.issuerUrl??``,clientId:t?.clientId??``,authUrl:t?.authUrl??``,tokenUrl:t?.tokenUrl??``,createdAt:e.createdAt?X(e.createdAt):null}}const Qr=w({name:`list`,description:`List all auth connections.`,args:q.strictObject({...N,...I()}),run:async e=>{let{client:t,workspaceId:n}=await D({profile:e.profile,workspaceId:e[`workspace-id`]});try{let r=F(e.order),i=await V(async(e,i)=>{let{connections:a,nextPageToken:o}=await t.listAuthConnections({workspaceId:n,pageToken:e,pageSize:i,pageDirection:r});return[a,o]},{limit:e.limit});c.out(i.map(connectionInfo))}catch(e){if(e instanceof Q&&e.code===Z.NotFound){c.out([]);return}throw e}}}),$r=w({name:`open`,description:`Open the auth connections page in the Tailor Platform Console.`,args:q.strictObject({...N}),run:async e=>{let t=await ve({workspaceId:e[`workspace-id`],profile:e.profile}),n=s(process.env.TAILOR_CONSOLE_NEXT)===!0?`/workspaces/${t}/services/auth-connections`:`/workspaces/${t}/settings/connections`,r=await Te({profile:e.profile,...e[`workspace-id`]===void 0?{}:{allowMissingProfile:!0}}),i=new URL(n,r).toString(),a=c.jsonMode;c.info(`Opening auth connections page in Tailor Platform Console...`);let o=!0;try{await kr(i)}catch{o=!1}if(a){c.out({consoleUrl:i,workspaceId:t,opened:o});return}o?(c.out(`Console URL: ${i}`),c.out(`Workspace ID: ${t}`)):c.warn(`Failed to open browser automatically. Please open this URL manually:\n${i}`)}}),ei=w({name:`revoke`,description:`Revoke an auth connection's tokens (keeps the connection; use 'delete' to remove it).`,notes:"Revoke invalidates the connection's active session and tokens but keeps the connection and its stored credentials, so it can be re-authorized later. Use `delete` to remove the connection entirely.",args:q.strictObject({...N,...Yr,...A}),run:async e=>{await R({profile:e.profile});let{client:t,workspaceId:n}=await D({profile:e.profile,workspaceId:e[`workspace-id`]});if(!e.yes&&await z.text({message:`Enter the connection name to confirm revocation ("${e.name}"):`})!==e.name){c.info(`Auth connection revocation cancelled.`);return}try{await t.revokeAuthConnection({workspaceId:n,connectionName:e.name})}catch(t){throw t instanceof Q&&t.code===Z.NotFound?Error(`Auth connection "${e.name}" not found.`,{cause:t}):t}c.success(`Auth connection "${e.name}" revoked.`)}}),ti=G({name:`authconnection`,description:`Manage auth connections.`,subCommands:{authorize:Xr,list:Qr,open:$r,revoke:ei,delete:Zr},async run(){await K(Qr,[])}});function orderAndLimitCrashReports(e,t){let n=e.filter(e=>e.endsWith(ar)).toSorted(),r=t.order===`asc`?n:n.toReversed();return t.limit&&t.limit>0?r.slice(0,t.limit):r}function formatCrashReportFiles(e,t){return e.map(e=>({file:e,path:U.join(t,e)}))}const ni=w({name:`list`,description:`List local crash report files.`,args:q.strictObject({...I()}),run:async e=>{let t=or(),n=c.jsonMode;if(!t.localDir){c.info(`Crash report directory not available.`),n&&c.out([]);return}let r;try{r=Y.readdirSync(t.localDir)}catch{c.info(`No crash reports found.`),n&&c.out([]);return}let i=orderAndLimitCrashReports(r,{order:e.order,limit:e.limit});if(i.length===0){c.info(`No crash reports found.`),n&&c.out([]);return}if(n){c.out(formatCrashReportFiles(i,t.localDir));return}c.info(`${i.length} crash report(s) in ${t.localDir}:`);for(let e of i)c.log(` ${e}`)}}),ri=w({name:`send`,description:`Submit a crash report to help improve the SDK.`,args:q.strictObject({file:W(q.string(),{description:`Path to the crash report file`,required:!0,completion:{type:`file`,extensions:[`log`]}})}),run:async e=>{let t;try{t=Y.readFileSync(e.file,`utf-8`)}catch{c.error(`Crash report file not found: ${e.file}`),process.exit(1)}let n=parseCrashLogFile(t);n||(c.error(`Failed to parse crash report file. The file may be corrupted.`),process.exit(1));let r=await Xn();c.info(`Sending crash report...`),await sr(n,r)?c.success(`Crash report submitted successfully. Thank you!`):(c.error(`Failed to submit crash report. The server may be unavailable.`),process.exit(1))}});function parseCrashLogFile(e){try{let t=e.replace(/\r\n/g,`
|
|
5
5
|
`),n=`\n${ir}\n`,r=t.lastIndexOf(n);if(r===-1)return;let i=t.slice(r+n.length).split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"../../../seed-
|
|
1
|
+
import{n as e,t}from"../../../seed-CCc9Xk66.mjs";export{t as SeedGeneratorID,e as seedPlugin};
|