@lunora/codegen 1.0.0-alpha.150 → 1.0.0-alpha.152

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/index.d.mts +15 -2
  2. package/dist/index.d.ts +15 -2
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/AGENTS_FILENAME-CRdh_pOr.mjs +1 -0
  5. package/dist/packem_shared/CONTAINERS_FILENAME-BssQL6eI.mjs +1 -0
  6. package/dist/packem_shared/FLAGS_FILENAME-Bn_wWM4d.mjs +1 -0
  7. package/dist/packem_shared/{GENERATED_HEADER--PCtJMQc.mjs → GENERATED_HEADER-w7DB5GZI.mjs} +1 -1
  8. package/dist/packem_shared/NOTIFY_FILENAME-BH0djo6F.mjs +1 -0
  9. package/dist/packem_shared/{OPENRPC_VERSION-C4UXIUyy.mjs → OPENRPC_VERSION-BAgBIsQM.mjs} +1 -1
  10. package/dist/packem_shared/QUEUES_FILENAME-CIfuMMG3.mjs +1 -0
  11. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-S3Ey8df4.mjs +9 -0
  12. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-CWESEYLi.mjs +2 -0
  13. package/dist/packem_shared/{SchemaSnapshotParseError-yZc-1mxR.mjs → SchemaSnapshotParseError-yrVM8bTa.mjs} +1 -1
  14. package/dist/packem_shared/WORKFLOWS_FILENAME-CSqONfHS.mjs +1 -0
  15. package/dist/packem_shared/{buildOpenApiDocument-D5xOB07T.mjs → buildOpenApiDocument-ZdoDQXmt.mjs} +1 -1
  16. package/dist/packem_shared/chain-DboeOxBl.mjs +1 -0
  17. package/dist/packem_shared/classify-procedure-call-CRm5Etni.mjs +1 -0
  18. package/dist/packem_shared/context-property-calls-CBUh7oAY.mjs +1 -0
  19. package/dist/packem_shared/discoverAuthApiCalls-B5Qmjmyk.mjs +1 -0
  20. package/dist/packem_shared/discoverCrons-c0ig327z.mjs +1 -0
  21. package/dist/packem_shared/discoverFunctions-DeuEs6Ce.mjs +1 -0
  22. package/dist/packem_shared/discoverHttpRoutes-zWSSyyOj.mjs +1 -0
  23. package/dist/packem_shared/discoverHyperdriveCalls-C6kV2CPz.mjs +1 -0
  24. package/dist/packem_shared/discoverInserts-BB7o_8pU.mjs +1 -0
  25. package/dist/packem_shared/discoverMaskProcedures-CNqwOwXv.mjs +1 -0
  26. package/dist/packem_shared/discoverMigrations-CQjGLKW-.mjs +1 -0
  27. package/dist/packem_shared/discoverNondeterministicCalls-B07wjsd2.mjs +1 -0
  28. package/dist/packem_shared/discoverQueries-Dz2vDpE9.mjs +1 -0
  29. package/dist/packem_shared/discoverR2sqlCalls-CuHe5smg.mjs +1 -0
  30. package/dist/packem_shared/discoverRlsMetadata-CXWVNLk4.mjs +1 -0
  31. package/dist/packem_shared/discoverRlsProcedures-DXdr9YHi.mjs +1 -0
  32. package/dist/packem_shared/discoverSandboxUsage-BJHLHZR_.mjs +1 -0
  33. package/dist/packem_shared/discoverStorageRulesMetadata-CUa2Dtb4.mjs +1 -0
  34. package/dist/packem_shared/{emit-CXfWb_pY.mjs → emit-Dsr5DNpc.mjs} +291 -129
  35. package/dist/packem_shared/{emitApp-DcrQNgaz.mjs → emitApp-kFg_xYlc.mjs} +10 -2
  36. package/dist/packem_shared/{exported-procedure-chains-M40rbSYM.mjs → exported-procedure-chains-Cmt3Pr92.mjs} +1 -1
  37. package/dist/packem_shared/index-BsVoa-4F.mjs +1 -0
  38. package/dist/packem_shared/listLunoraSourceFiles-BvqYMy81.mjs +1 -0
  39. package/dist/packem_shared/queries-D8DheHbi.mjs +1 -0
  40. package/package.json +10 -10
  41. package/dist/packem_shared/AGENTS_FILENAME-B1Abt3Gl.mjs +0 -1
  42. package/dist/packem_shared/CONTAINERS_FILENAME-CtcysaKS.mjs +0 -1
  43. package/dist/packem_shared/FLAGS_FILENAME-B3VZ6vTw.mjs +0 -1
  44. package/dist/packem_shared/NOTIFY_FILENAME-CKO5gtGe.mjs +0 -1
  45. package/dist/packem_shared/QUEUES_FILENAME-C-pzLGy4.mjs +0 -1
  46. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DazENDSB.mjs +0 -9
  47. package/dist/packem_shared/SCHEMA_SNAPSHOT_VERSION-B1BUjuG5.mjs +0 -2
  48. package/dist/packem_shared/WORKFLOWS_FILENAME-BfvqsG9Z.mjs +0 -1
  49. package/dist/packem_shared/ast-BYoSZlae.mjs +0 -1
  50. package/dist/packem_shared/chain-Dygm2apY.mjs +0 -1
  51. package/dist/packem_shared/classify-procedure-call-Ib2EMtFH.mjs +0 -1
  52. package/dist/packem_shared/context-property-calls-Br0sVv8E.mjs +0 -1
  53. package/dist/packem_shared/discoverAuthApiCalls-DoNQSgso.mjs +0 -1
  54. package/dist/packem_shared/discoverCrons-DCxl4hty.mjs +0 -1
  55. package/dist/packem_shared/discoverFunctions-CXURzTDU.mjs +0 -1
  56. package/dist/packem_shared/discoverHttpRoutes-2XhMbeh5.mjs +0 -1
  57. package/dist/packem_shared/discoverHyperdriveCalls-DTq4PKT5.mjs +0 -1
  58. package/dist/packem_shared/discoverInserts-qU5F4W4g.mjs +0 -1
  59. package/dist/packem_shared/discoverMaskProcedures-BZsC5dHd.mjs +0 -1
  60. package/dist/packem_shared/discoverMigrations-BFkJQ8Sy.mjs +0 -1
  61. package/dist/packem_shared/discoverNondeterministicCalls-B-NNzzPW.mjs +0 -1
  62. package/dist/packem_shared/discoverQueries-B4emAFn5.mjs +0 -1
  63. package/dist/packem_shared/discoverR2sqlCalls-C2GtrFnl.mjs +0 -1
  64. package/dist/packem_shared/discoverRlsMetadata-BKcUnSNr.mjs +0 -1
  65. package/dist/packem_shared/discoverRlsProcedures-fAhxiIyD.mjs +0 -1
  66. package/dist/packem_shared/discoverSandboxUsage-CJhnKA0_.mjs +0 -1
  67. package/dist/packem_shared/discoverStorageRulesMetadata-C7XmORWp.mjs +0 -1
  68. package/dist/packem_shared/index-xGhyK9J_.mjs +0 -1
  69. package/dist/packem_shared/queries-Ddvo5dCs.mjs +0 -1
@@ -1 +0,0 @@
1
- import{l as f}from"./ast-BYoSZlae.mjs";const i=new Set(["@lunora/agent","@lunora/agent/sandbox"]),a={browserTool:"usesSandboxBrowser",containerTool:"usesSandboxContainer",fsTool:"usesSandboxFs"},u=()=>({usesSandboxBrowser:!1,usesSandboxContainer:!1,usesSandboxFs:!1}),d=o=>{const s=u();if(!i.has(o.getModuleSpecifierValue())||o.isTypeOnly())return s;for(const e of o.getNamedImports()){if(e.isTypeOnly())continue;const n=a[e.getNameNode().getText()];n!==void 0&&(s[n]=!0)}return s},b=(o,s)=>{const e=u();for(const n of f(s)){const c=o.getSourceFile(n)??o.addSourceFileAtPath(n);for(const t of c.getImportDeclarations()){const l=d(t);for(const r of Object.values(a))e[r]||=l[r]}if(Object.values(a).every(t=>e[t]))break}return e};export{b as discoverSandboxUsage};
@@ -1 +0,0 @@
1
- import{Node as u}from"ts-morph";import{l as f,a as p,c as l}from"./ast-BYoSZlae.mjs";import{w as d}from"./classify-procedure-call-Ib2EMtFH.mjs";import{e as m}from"./exported-procedure-chains-M40rbSYM.mjs";const h=new Set(["delete","list","read","write"]),g=t=>d(t,"use","storageRules"),x=(t,s,n)=>{const e=t.getArguments()[0];if(!e||!u.isArrayLiteralExpression(e))return[];const a=[];for(const o of e.getElements()){if(!u.isObjectLiteralExpression(o))continue;const r=l(o,"on");if(r===void 0||!h.has(r))continue;const i=l(o,"prefix"),c={bucket:l(o,"bucket")??"",file:s,on:r,procedure:n};i!==void 0&&(c.prefix=i),a.push(c)}return a},A=(t,s)=>{const n=[];for(const e of f(s)){const a=t.getSourceFile(e)??t.addSourceFileAtPath(e),o=p(s,e);for(const{name:r,receiver:i}of m(a))for(const c of g(i))n.push(...x(c,o,r))}return{rules:n}};export{A as default};
@@ -1 +0,0 @@
1
- import{Node as r}from"ts-morph";import{l as f,a as m,t as d}from"./ast-BYoSZlae.mjs";import{w as g,c as p}from"./classify-procedure-call-Ib2EMtFH.mjs";const u=e=>{if(!r.isPropertyAssignment(e)&&!r.isShorthandPropertyAssignment(e)&&!r.isMethodDeclaration(e)&&!r.isGetAccessorDeclaration(e))return;const t=e.getNameNode();return r.isStringLiteral(t)?t.getLiteralValue():e.getName()},h=e=>g(e,"use","mask"),x=e=>{if(r.isPropertyAssignment(e)){const t=e.getInitializer();if(t&&r.isStringLiteral(t)){const s=t.getLiteralText();if(s==="redact"||s==="hash")return s}}return"custom"},k=e=>{const t=e.getArguments()[0];if(!t||!r.isObjectLiteralExpression(t))return[];const s=[];for(const i of t.getProperties()){const n=u(i);if(n===void 0||!r.isPropertyAssignment(i))continue;const o=i.getInitializer();if(!(!o||!r.isObjectLiteralExpression(o)))for(const a of o.getProperties()){const c=u(a);c!==void 0&&s.push({column:c,table:n})}}return s},v=e=>{const t=h(e);return{maskColumns:t.flatMap(s=>k(s)),usesMask:t.length>0}},P=new Set(["findFirst","findFirstOrThrow","findMany","get","query"]),C=new Set(["delete","insert","patch","replace"]),M=(e,t)=>{if(!r.isVariableDeclaration(e))return;const s=e.getInitializer();if(!s||!r.isCallExpression(s))return;const i=p(s);if(!i)return;const n=i.receiver?v(i.receiver):{maskColumns:[],usesMask:!1},{tablesRead:o,tablesWritten:a}=d(e,P,C);return{exportName:e.getName(),file:t,maskColumns:n.maskColumns,tablesRead:o,tablesWritten:a,usesMask:n.usesMask,visibility:i.visibility}},E=(e,t)=>{const s=[];for(const i of f(t)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i),o=m(t,i);for(const a of n.getVariableStatements())if(a.isExported())for(const c of a.getDeclarations()){const l=M(c,o);l&&s.push(l)}}return s};export{u as a,E as d,h as m,x as s};
@@ -1 +0,0 @@
1
- import{Node as r,SyntaxKind as f}from"ts-morph";import{l as P,a as h,i as A}from"./ast-BYoSZlae.mjs";const m=(t,e)=>{if(t.getText()!==e)return!1;const s=t.getParent();return r.isPropertyAccessExpression(s)&&s.getNameNode()===t?!1:!(r.isPropertyAssignment(s)&&s.getNameNode()===t)},x=(t,e)=>r.isIdentifier(t)?m(t,e):t.getDescendantsOfKind(f.Identifier).some(s=>m(s,e)),g=t=>x(t,"ctx"),I=t=>{let e=t;for(;r.isPropertyAccessExpression(e)||r.isElementAccessExpression(e)||r.isNonNullExpression(e);)e=e.getExpression();return r.isIdentifier(e)?e:void 0},E=t=>x(t,"args"),u=t=>{if(!r.isIdentifier(t))return;const e=t.getText(),s=t.getFirstAncestor(o=>r.isArrowFunction(o)||r.isFunctionExpression(o)||r.isFunctionDeclaration(o));if(s===void 0)return;const i=t.getStart();let n,a=-1;for(const o of s.getDescendantsOfKind(f.VariableDeclaration)){if(o.getName()!==e)continue;const c=o.getInitializer(),l=o.getStart();c!==void 0&&l<i&&l>a&&(n=c,a=l)}return n},C=t=>{if(E(t))return!0;const e=u(t);return e!==void 0&&E(e)},K=t=>{if(r.isCallExpression(t)||r.isNewExpression(t))return!1;const e=u(t);return e===void 0||!(r.isCallExpression(e)||r.isNewExpression(e))},O=t=>{if(g(t))return!0;const e=u(t);if(e!==void 0&&g(e))return!0;const s=e??t;return(r.isIdentifier(s)?[s]:s.getDescendantsOfKind(f.Identifier)).some(n=>{const a=u(n);return a!==void 0&&g(a)})},p=(t,e)=>x(t,e),T=(t,e)=>{if(p(t,e))return!0;const s=u(t);if(s!==void 0&&p(s,e))return!0;const i=I(t);if(i!==void 0){const n=u(i);return n!==void 0&&p(n,e)}return!1},v=t=>{for(const e of t.getAncestors())if(r.isVariableDeclaration(e)&&e.getVariableStatement()?.hasExportKeyword()===!0)return e.getName();return"<module>"},N=new Set(["withGeoIndex","withIndex","withSearchIndex"]),S=new Set(["collect","collectWithScores","first","paginate","take","unique"]),b=t=>{const e=t.getExpression();if(!r.isPropertyAccessExpression(e)||e.getName()!=="query")return!1;const s=e.getExpression();return A(s)},y=t=>{const e=[];let s=t;for(;;){const i=s.getParent();if(!i||!r.isPropertyAccessExpression(i))break;const n=i.getParent();if(!n||!r.isCallExpression(n))break;e.push(i.getName()),s=n}return e},D=/\b[A-Za-z_$][\w$]*\._id\s*===?[^=]/u,w=t=>{let e=t;for(;;){const s=e.getParent();if(!s||!r.isPropertyAccessExpression(s))return!1;const i=s.getParent();if(!i||!r.isCallExpression(i))return!1;if(s.getName()==="filter"){const n=i.getArguments()[0];if(n&&D.test(n.getText()))return!0}e=i}},R=t=>{const e=t.getArguments()[0];return e&&r.isStringLiteral(e)?e.getLiteralText():""},_=(t,e)=>{const s=[];for(const i of P(e)){const n=t.getSourceFile(i)??t.addSourceFileAtPath(i),a=h(e,i);for(const o of n.getDescendantsOfKind(f.CallExpression)){if(!b(o))continue;const c=y(o),l=c.includes("filter");s.push({exportName:v(o),file:a,filtersPrimaryKey:l&&w(o),hasFilter:l,hasIndex:c.some(d=>N.has(d)),line:o.getStartLineNumber(),table:R(o),terminal:c.findLast(d=>S.has(d))})}}return s};export{O as a,K as b,T as c,_ as d,v as e,p as f,C as i,E as r,u as s};