twenty-sdk 0.2.1 → 0.2.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.
Files changed (33) hide show
  1. package/dist/application/{function-config.d.ts → functions/function-config.d.ts} +1 -1
  2. package/dist/application/functions/triggers/cron-payload-type.d.ts +1 -0
  3. package/dist/application/functions/triggers/database-event-payload-type.d.ts +1 -0
  4. package/dist/application/index.d.ts +3 -1
  5. package/dist/cli.cjs +1 -1
  6. package/dist/cli.mjs +1 -1
  7. package/dist/vendor/twenty-shared/database-events/database-event-payload.type.d.ts +26 -0
  8. package/dist/vendor/twenty-shared/database-events/database-event-payload.type.d.ts.map +1 -0
  9. package/dist/vendor/twenty-shared/database-events/index.d.ts +12 -0
  10. package/dist/vendor/twenty-shared/database-events/index.d.ts.map +1 -0
  11. package/dist/vendor/twenty-shared/database-events/object-record-create.event.d.ts +8 -0
  12. package/dist/vendor/twenty-shared/database-events/object-record-create.event.d.ts.map +1 -0
  13. package/dist/vendor/twenty-shared/database-events/object-record-delete.event.d.ts +8 -0
  14. package/dist/vendor/twenty-shared/database-events/object-record-delete.event.d.ts.map +1 -0
  15. package/dist/vendor/twenty-shared/database-events/object-record-destroy.event.d.ts +8 -0
  16. package/dist/vendor/twenty-shared/database-events/object-record-destroy.event.d.ts.map +1 -0
  17. package/dist/vendor/twenty-shared/database-events/object-record-diff.d.ts +7 -0
  18. package/dist/vendor/twenty-shared/database-events/object-record-diff.d.ts.map +1 -0
  19. package/dist/vendor/twenty-shared/database-events/object-record-event.event.d.ts +9 -0
  20. package/dist/vendor/twenty-shared/database-events/object-record-event.event.d.ts.map +1 -0
  21. package/dist/vendor/twenty-shared/database-events/object-record-non-destructive-event.d.ts +8 -0
  22. package/dist/vendor/twenty-shared/database-events/object-record-non-destructive-event.d.ts.map +1 -0
  23. package/dist/vendor/twenty-shared/database-events/object-record-restore.event.d.ts +8 -0
  24. package/dist/vendor/twenty-shared/database-events/object-record-restore.event.d.ts.map +1 -0
  25. package/dist/vendor/twenty-shared/database-events/object-record-update.event.d.ts +12 -0
  26. package/dist/vendor/twenty-shared/database-events/object-record-update.event.d.ts.map +1 -0
  27. package/dist/vendor/twenty-shared/database-events/object-record-upsert.event.d.ts +12 -0
  28. package/dist/vendor/twenty-shared/database-events/object-record-upsert.event.d.ts.map +1 -0
  29. package/dist/vendor/twenty-shared/database-events/object-record.base.event.d.ts +16 -0
  30. package/dist/vendor/twenty-shared/database-events/object-record.base.event.d.ts.map +1 -0
  31. package/dist/vendor/twenty-shared/database-events.cjs +1 -0
  32. package/dist/vendor/twenty-shared/database-events.mjs +23 -0
  33. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { ServerlessFunctionManifest, ServerlessFunctionTriggerManifest } from '../vendor/twenty-shared/application';
1
+ import { ServerlessFunctionManifest, ServerlessFunctionTriggerManifest } from '../../vendor/twenty-shared/application';
2
2
  export type FunctionConfig = Omit<ServerlessFunctionManifest, 'handlerPath' | 'handlerName'> & {
3
3
  name?: string;
4
4
  description?: string;
@@ -0,0 +1 @@
1
+ export type CronPayload = {};
@@ -0,0 +1 @@
1
+ export type { DatabaseEventPayload, ObjectRecordCreateEvent, ObjectRecordUpdateEvent, ObjectRecordEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordBaseEvent, ObjectRecordRestoreEvent, ObjectRecordUpsertEvent, } from '../../../vendor/twenty-shared/database-events';
@@ -5,7 +5,9 @@ export { Field } from './fields/field.decorator';
5
5
  export { OnDeleteAction } from './fields/on-delete-action';
6
6
  export { RelationType } from './fields/relation-type';
7
7
  export { Relation } from './fields/relation.decorator';
8
- export type { FunctionConfig } from './function-config';
8
+ export type { FunctionConfig } from './functions/function-config';
9
+ export type { CronPayload } from './functions/triggers/cron-payload-type';
10
+ export type { DatabaseEventPayload, ObjectRecordCreateEvent, ObjectRecordUpdateEvent, ObjectRecordEvent, ObjectRecordDeleteEvent, ObjectRecordDestroyEvent, ObjectRecordBaseEvent, ObjectRecordRestoreEvent, ObjectRecordUpsertEvent, } from './functions/triggers/database-event-payload-type';
9
11
  export { Object } from './objects/object.decorator';
10
12
  export { STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS } from './objects/standard-object-ids';
11
13
  export { PermissionFlag } from './permission-flag-type';
package/dist/cli.cjs CHANGED
@@ -285,4 +285,4 @@ export default class Twenty {
285
285
  `;await Ge.appendFile(Oe.join(i,"index.ts"),r)}}const sc=async(n,i)=>{const r=_i.default.join(n,i);if(await Ge.pathExists(r))return r;throw new Error(`${i} not found in ${n}`)},Mv=({appPath:n,tsconfigPath:i="tsconfig.json"})=>{const r=L.readConfigFile(Oe.join(n,i),L.sys.readFile);if(r.error)throw new Error(L.formatDiagnosticsWithColorAndContext([r.error],{getCanonicalFileName:u=>u,getCurrentDirectory:L.sys.getCurrentDirectory,getNewLine:()=>L.sys.newLine}));const a=L.parseJsonConfigFileContent(r.config,L.sys,n);if(a.errors.length)throw new Error(L.formatDiagnosticsWithColorAndContext(a.errors,{getCanonicalFileName:u=>u,getCurrentDirectory:L.sys.getCurrentDirectory,getNewLine:()=>L.sys.newLine}));return L.createProgram(a.fileNames,a.options)},$v=async({appPath:n})=>{const i=Mv({appPath:n,tsconfigPath:"tsconfig.json"});return{diagnostics:[...i.getSyntacticDiagnostics(),...i.getSemanticDiagnostics(),...i.getGlobalDiagnostics()],program:i}};class co extends Error{constructor(i,r,a){super(i),this.parseErrors=r,this.filePath=a,this.name="JsoncParseError"}}const Bv=(n,i={})=>{const r=[],a=K0.parse(n,r,{allowTrailingComma:i.allowTrailingComma??!0,disallowComments:i.disallowComments??!1,allowEmptyContent:i.allowEmptyContent??!1});if(r.length>0){const u=r.map(p=>`Line ${p.offset}: ${p.error}`);throw new co(`JSONC parse errors:
286
286
  ${u.join(`
287
287
  `)}`,r)}return a},Gv=async n=>await Ge.readFile(n,"utf8"),Wv=async(n,i={})=>{try{const r=await Ge.readFile(n,"utf8");return Bv(r,i)}catch(r){throw r instanceof co?new co(r.message,r.parseErrors,n):new Error(`Failed to read file ${n}: ${r}`)}},Vv=({diagnostics:n})=>{if(n.length>0){const i=L.formatDiagnosticsWithColorAndContext(n,{getCanonicalFileName:r=>r,getCurrentDirectory:L.sys.getCurrentDirectory,getNewLine:()=>L.sys.newLine});console.warn(i)}},vi=(n,i)=>{const r=n.expression;if(L.isCallExpression(r)){if(L.isIdentifier(r.expression))return r.expression.text===i;if(L.isPropertyAccessExpression(r.expression))return r.expression.name.text===i}return!1},dn=n=>{if(L.isStringLiteralLike(n))return n.text;if(L.isNumericLiteral(n))return Number(n.text);if(n.kind===L.SyntaxKind.TrueKeyword)return!0;if(n.kind===L.SyntaxKind.FalseKeyword)return!1;if(n.kind===L.SyntaxKind.NullKeyword)return null;if(L.isPropertyAccessExpression(n))return L.isIdentifier(n.expression)&&L.isIdentifier(n.name)?n.name.text:String(n.getText());if(L.isNoSubstitutionTemplateLiteral(n))return n.text;if(L.isTemplateExpression(n)){let i=n.head.text;for(const r of n.templateSpans){const a=dn(r.expression);i+=String(a)+r.literal.text}return i}if(L.isArrayLiteralExpression(n))return n.elements.map(i=>i.kind===L.SyntaxKind.SpreadElement?[]:dn(i));if(L.isObjectLiteralExpression(n)){const i={};for(const r of n.properties)if(L.isPropertyAssignment(r)){const a=L.isIdentifier(r.name)||L.isStringLiteralLike(r.name)?r.name.text:L.isComputedPropertyName(r.name)&&L.isStringLiteralLike(r.name.expression)?r.name.expression.text:void 0;a&&(i[a]=dn(r.initializer))}else L.isShorthandPropertyAssignment(r);return i}return L.isIdentifier(n)?n.text:String(n.getText?.()??"")},oc=n=>{if(!L.isCallExpression(n.expression))return;const[i]=n.expression.arguments;return i&&L.isObjectLiteralExpression(i)?dn(i):void 0},jv=n=>{const i=[];for(const r of n.getSourceFiles()){if(r.isDeclarationFile)continue;const a=u=>{if(L.isClassDeclaration(u)&&L.getDecorators(u)?.length){const y=L.getDecorators(u)?.find(_=>vi(_,"ObjectMetadata")||vi(_,"Object"));if(y){const _=oc(y);if(_&&typeof _=="object"&&!Array.isArray(_)){const N=[];for(const D of u.members){if(!L.isPropertyDeclaration(D))continue;const C=L.getDecorators(D)?.find(oe=>vi(oe,"FieldManifest")||vi(oe,"Field"));if(!C)continue;const J=oc(C);if(!J)continue;let Y;D.name&&L.isIdentifier(D.name)?Y=D.name.text:Y=D.name?.getText?.()??void 0,N.push({...J,...Y?{name:Y}:{}})}i.push({..._,fields:N})}}}L.forEachChild(u,a)};a(r)}return i},ac=n=>n.modifiers?.some(i=>i.kind===L.SyntaxKind.ExportKeyword)??!1,qv=n=>{const i=[];for(const _ of n.statements)if(!(!L.isVariableStatement(_)||!ac(_)))for(const N of _.declarationList.declarations){if(!L.isIdentifier(N.name))continue;const D=N.name.text,C=N.initializer??void 0;i.push({name:D,kind:"const",init:C,declNode:N})}for(const _ of n.statements)if(_.kind===L.SyntaxKind.FunctionDeclaration&&ac(_)){const N=_;N.name&&L.isIdentifier(N.name)&&i.push({name:N.name.text,kind:"function",init:void 0,declNode:N})}const r=Array.from(new Map(i.map(_=>[_.name,_])).values());if(r.length!==2)throw new Error(`Serverless file ${n.fileName} must export exactly 2 bindings (handler + config). Found: ${r.map(_=>_.name).join(", ")}`);const a=r.find(_=>_.name==="config");if(!a)throw new Error(`Serverless file ${n.fileName} must export a binding named "config".`);if(!a.init||!L.isObjectLiteralExpression(a.init))throw new Error(`"config" in ${n.fileName} must be initialized to an object literal.`);const u=a.declNode;if("type"in u&&u.type){const _=u.type.getText(n);if(!/\bFunctionConfig\b/.test(_))throw new Error(`"config" in ${n.fileName} must be typed as FunctionConfig (got: ${_}).`)}const p=dn(a.init),y=r.find(_=>_.name!=="config");if(!y)throw new Error(`Could not find the handler export in ${n.fileName}.`);if(y.kind==="const"){const _=y.init;if(!(!!_&&(L.isArrowFunction(_)||L.isFunctionExpression(_))))throw new Error(`Handler "${y.name}" in ${n.fileName} must be a function (arrow or function expression).`)}return{handlerName:y.name,configObject:p}},Jv=(n,i)=>Oe.relative(i,n).split(Oe.sep).join(Oe.posix.sep),Qv=(n,i)=>{const r=[];for(const a of n.getSourceFiles())if(!a.isDeclarationFile)try{const{handlerName:u,configObject:p}=qv(a),y=Jv(a.fileName,i);r.push({...p,handlerPath:y,handlerName:u})}catch{continue}return r},zv=(n,i,r)=>{let a=n;for(let u=0;u<i.length;u++){const p=i[u];u===i.length-1?a[p]=r:(a[p]=a[p]??{},a=a[p])}},Yv=async(n,i)=>{const r={};for(const a of n.getSourceFiles()){const u=a.fileName;if(a.isDeclarationFile||!u.startsWith(i+Oe.sep)&&u!==i||!(u.endsWith(".ts")||u.endsWith(".tsx"))||u.includes(`${Oe.sep}node_modules${Oe.sep}`))continue;const y=Oe.relative(i,u).split(Oe.sep),_=await Ge.readFile(u,"utf8");zv(r,y,_)}return r},Hv=n=>{for(const i of n.getSourceFiles()){if(i.isDeclarationFile||!i.fileName.endsWith("application.config.ts"))continue;let r;const a=u=>{if(L.isExportAssignment(u)&&L.isIdentifier(u.expression)){const p=u.expression.text;for(const y of i.statements)if(L.isVariableStatement(y))for(const _ of y.declarationList.declarations)L.isIdentifier(_.name)&&_.name.text===p&&_.initializer&&L.isObjectLiteralExpression(_.initializer)&&(r=dn(_.initializer))}r||L.forEachChild(u,a)};if(a(i),r)return r}throw new Error("Could not find default exported ApplicationConfig")},Kv=n=>{for(const i of n.getSourceFiles()){if(i.isDeclarationFile)continue;let r=!1;const a=u=>{if(!r){if(L.isImportDeclaration(u)){const p=u.moduleSpecifier;if(L.isStringLiteralLike(p)){const y=p.text;if((y===uo||y.endsWith(`/${uo}`))&&u.importClause){r=!0;return}}}L.forEachChild(u,a)}};if(a(i),r)return!0}return!1},Xv=n=>{const i=[];for(const r of n.getSourceFiles())if(!r.isDeclarationFile){for(const a of r.statements)if(!(!L.isVariableStatement(a)||!(a.modifiers?.some(p=>p.kind===L.SyntaxKind.ExportKeyword)??!1)))for(const p of a.declarationList.declarations){if(!L.isIdentifier(p.name)||!(p.type?.getText(r)??"").includes("RoleConfig"))continue;const _=p.initializer;!_||!L.isObjectLiteralExpression(_)||i.push(dn(_))}}return i},mr=async n=>{const i=await Wv(await sc(n,"package.json")),r=await Gv(await sc(n,"yarn.lock")),{diagnostics:a,program:u}=await $v({appPath:n});Vv({diagnostics:a});const[p,y,_,N,D]=[jv(u),Qv(u,n),Hv(u),Xv(u),await Yv(u,n)],C=Kv(u);return{packageJson:i,yarnLock:r,manifest:{application:_,objects:p,serverlessFunctions:y,roles:N,sources:D},shouldGenerate:C}};class Zv{constructor(){this.apiService=new Wn}async execute({appPath:i=mn,askForConfirmation:r}){try{console.log($.default.blue("🚀 Uninstall Twenty Application")),console.log($.default.gray(`📁 App Path: ${i}`)),console.log(""),r&&!await this.confirmationPrompt()&&(console.error($.default.red("⛔️ Aborting uninstall")),process.exit(1));const{manifest:a}=await mr(i),u=await this.apiService.uninstallApplication(a.application.universalIdentifier);return u.success===!1?console.error($.default.red("❌ Uninstall failed:"),u.error):console.log($.default.green("✅ Application uninstalled successfully")),u}catch(a){throw console.error($.default.red("Uninstall failed:"),a instanceof Error?a.message:a),a}}async confirmationPrompt(){const{confirmation:i}=await Pn.default.prompt([{type:"confirm",name:"confirmation",message:"Are you sure you want to uninstall this application?",default:!1}]);return i}}class e_{constructor(){this.apiService=new Wn}async execute(i){try{const r=i.appPath??mn,a=parseInt(i.debounce,10);this.logStartupInfo(r,a),await this.synchronize(r);const u=this.setupFileWatcher(r,a);this.setupGracefulShutdown(u)}catch(r){console.error($.default.red("Development mode failed:"),r instanceof Error?r.message:r),process.exit(1)}}async synchronize(i){const{manifest:r,packageJson:a,yarnLock:u}=await mr(i);await this.apiService.syncApplication({manifest:r,packageJson:a,yarnLock:u})}logStartupInfo(i,r){console.log($.default.blue("🚀 Starting Twenty Application Development Mode")),console.log($.default.gray(`📁 App Path: ${i}`)),console.log($.default.gray(`⏱️ Debounce: ${r}ms`)),console.log("")}setupFileWatcher(i,r){const a=ty.watch(i,{ignored:/node_modules|\.git/,persistent:!0});let u=null;const p=()=>{u&&clearTimeout(u),u=setTimeout(async()=>{console.log($.default.blue("🔄 Changes detected, syncing...")),await this.synchronize(i),console.log($.default.gray("👀 Watching for changes... (Press Ctrl+C to stop)"))},r)};return a.on("change",()=>{p()}),console.log($.default.gray("👀 Watching for changes... (Press Ctrl+C to stop)")),a}setupGracefulShutdown(i){process.on("SIGINT",()=>{console.log($.default.yellow(`
288
- 🛑 Stopping development mode...`)),i.close(),process.exit(0)})}}class t_{constructor(){this.apiService=new Wn,this.generateService=new Qc}async execute(i=mn){try{return console.log($.default.blue("🚀 Syncing Twenty Application")),console.log($.default.gray(`📁 App Path: ${i}`)),console.log(""),await this.synchronize({appPath:i})}catch(r){throw console.error($.default.red("Sync failed:"),r instanceof Error?r.message:r),r}}async synchronize({appPath:i}){const{manifest:r,packageJson:a,yarnLock:u,shouldGenerate:p}=await mr(i);let y=await this.apiService.syncApplication({manifest:r,packageJson:a,yarnLock:u});if(p){await this.generateService.generateClient(i);const{manifest:_}=await mr(i);y=await this.apiService.syncApplication({manifest:_,packageJson:a,yarnLock:u})}return y.success===!1?console.error($.default.red("❌ Serverless functions Sync failed:"),y.error):console.log($.default.green("✅ Serverless functions synced successfully")),y}}const kn=n=>n&&!n?.startsWith("/")?Oe.join(mn,n):n;class n_{constructor(){this.generateService=new Qc}async execute(i=mn){try{await this.generateService.generateClient(i)}catch(r){throw console.error($.default.red("Generate Twenty client failed:"),r instanceof Error?r.message:r),r}}}class r_{constructor(){this.apiService=new Wn}async execute({appPath:i=mn,functionUniversalIdentifier:r,functionName:a}){try{const{manifest:u}=await mr(i);this.logWatchInfo({appName:u.application.displayName,functionUniversalIdentifier:r,functionName:a}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:u.application.universalIdentifier,functionUniversalIdentifier:r,functionName:a})}catch(u){console.error($.default.red("Watch logs failed:"),u instanceof Error?u.message:u),process.exit(1)}}logWatchInfo({appName:i,functionUniversalIdentifier:r,functionName:a}){const u=i??"Twenty Application",p=r||a?`function "${r||a}"`:"functions";console.log($.default.blue(`🚀 Watching ${u} ${p} logs:`)),console.log("")}}class i_{constructor(){this.devCommand=new e_,this.syncCommand=new t_,this.uninstallCommand=new Zv,this.addCommand=new uy,this.generateCommand=new n_,this.logsCommand=new r_}getCommand(){const i=new xi.Command("app");return i.description("Application development commands"),i.command("dev [appPath]").description("Watch and sync local application changes").option("-d, --debounce <ms>","Debounce delay in milliseconds","1000").action(async(r,a)=>{await this.devCommand.execute({...a,appPath:kn(r)})}),i.command("sync [appPath]").description("Sync application to Twenty").action(async r=>{try{(await this.syncCommand.execute(kn(r))).success||process.exit(1)}catch{process.exit(1)}}),i.command("uninstall [appPath]").description("Uninstall application from Twenty").action(async r=>{try{(await this.uninstallCommand.execute({appPath:kn(r),askForConfirmation:!0})).success||process.exit(1)}catch{process.exit(1)}}),i.command("delete [appPath]",{hidden:!0}).description("Delete application from Twenty").action(async r=>{try{(await this.uninstallCommand.execute({appPath:kn(r),askForConfirmation:!0})).success||process.exit(1)}catch{process.exit(1)}}),i.command("add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(wi).join("|")})`).action(async(r,a)=>{r&&!ay(r)&&(console.error($.default.red(`Invalid entity type "${r}". Must be one of: ${Object.values(wi).join("|")}`)),process.exit(1)),await this.addCommand.execute(r,a?.path)}),i.command("generate [outputPath]").description("Generate Twenty client").action(async r=>{await this.generateCommand.execute(kn(r))}),i.command("logs [appPath]").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").description("Watch application function logs").action(async(r,a)=>{await this.logsCommand.execute({...a,appPath:kn(r)})}),i}}class s_{constructor(){this.configService=new At,this.apiService=new Wn}getCommand(){const i=new xi.Command("auth");return i.description("Authentication commands"),i.command("login").description("Authenticate with Twenty").option("--api-key <key>","API key for authentication").option("--api-url <url>","Twenty API URL").action(async r=>{await this.login(r)}),i.command("logout").description("Remove authentication credentials").action(async()=>{await this.logout()}),i.command("status").description("Check authentication status").action(async()=>{await this.status()}),i}async login(i){try{let{apiKey:r,apiUrl:a}=i;const u=await this.configService.getConfig();if(a||(a=(await Pn.default.prompt([{type:"input",name:"apiUrl",message:"Twenty API URL:",default:u.apiUrl,validate:_=>{try{return new URL(_),!0}catch{return"Please enter a valid URL"}}}])).apiUrl),r||(r=(await Pn.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:_=>_.length>0||"API key is required"}])).apiKey),await this.configService.setConfig({apiUrl:a,apiKey:r}),await this.apiService.validateAuth()){const y=At.getActiveWorkspace();console.log($.default.green(`✓ Successfully authenticated with Twenty (workspace: ${y})`))}else console.log($.default.red("✗ Authentication failed. Please check your credentials.")),process.exit(1)}catch(r){console.error($.default.red("Login failed:"),r instanceof Error?r.message:r),process.exit(1)}}async logout(){try{await this.configService.clearConfig();const i=At.getActiveWorkspace();console.log($.default.green(`✓ Successfully logged out (workspace: ${i})`))}catch(i){console.error($.default.red("Logout failed:"),i instanceof Error?i.message:i),process.exit(1)}}async status(){try{const i=At.getActiveWorkspace(),r=await this.configService.getConfig();if(console.log($.default.blue("Authentication Status:")),console.log(`Workspace: ${i}`),console.log(`API URL: ${r.apiUrl}`),console.log(`API Key: ${r.apiKey?"***"+r.apiKey.slice(-4):"Not set"}`),r.apiKey){const a=await this.apiService.validateAuth();console.log(`Status: ${a?$.default.green("✓ Valid"):$.default.red("✗ Invalid")}`)}else console.log(`Status: ${$.default.yellow("⚠ Not authenticated")}`)}catch(i){console.error($.default.red("Status check failed:"),i instanceof Error?i.message:i),process.exit(1)}}}const o_="0.2.1",a_={version:o_},vn=new xi.Command;vn.name("twenty").description("CLI for Twenty application development").version(a_.version);vn.option("--workspace <name>","Use a specific workspace configuration","default");vn.hook("preAction",n=>{const r=(n.optsWithGlobals?n.optsWithGlobals():n.opts()).workspace;At.setActiveWorkspace(r),console.log($.default.gray(`👩‍💻 Workspace - ${At.getActiveWorkspace()}`))});vn.addCommand(new s_().getCommand());vn.addCommand(new i_().getCommand());vn.exitOverride();try{vn.parse()}catch(n){n instanceof xi.CommanderError&&process.exit(n.exitCode),n instanceof Error&&(console.error($.default.red("Error:"),n.message),process.exit(1))}
288
+ 🛑 Stopping development mode...`)),i.close(),process.exit(0)})}}class t_{constructor(){this.apiService=new Wn,this.generateService=new Qc}async execute(i=mn){try{return console.log($.default.blue("🚀 Syncing Twenty Application")),console.log($.default.gray(`📁 App Path: ${i}`)),console.log(""),await this.synchronize({appPath:i})}catch(r){throw console.error($.default.red("Sync failed:"),r instanceof Error?r.message:r),r}}async synchronize({appPath:i}){const{manifest:r,packageJson:a,yarnLock:u,shouldGenerate:p}=await mr(i);let y=await this.apiService.syncApplication({manifest:r,packageJson:a,yarnLock:u});if(p){await this.generateService.generateClient(i);const{manifest:_}=await mr(i);y=await this.apiService.syncApplication({manifest:_,packageJson:a,yarnLock:u})}return y.success===!1?console.error($.default.red("❌ Serverless functions Sync failed:"),y.error):console.log($.default.green("✅ Serverless functions synced successfully")),y}}const kn=n=>n&&!n?.startsWith("/")?Oe.join(mn,n):n;class n_{constructor(){this.generateService=new Qc}async execute(i=mn){try{await this.generateService.generateClient(i)}catch(r){throw console.error($.default.red("Generate Twenty client failed:"),r instanceof Error?r.message:r),r}}}class r_{constructor(){this.apiService=new Wn}async execute({appPath:i=mn,functionUniversalIdentifier:r,functionName:a}){try{const{manifest:u}=await mr(i);this.logWatchInfo({appName:u.application.displayName,functionUniversalIdentifier:r,functionName:a}),await this.apiService.subscribeToLogs({applicationUniversalIdentifier:u.application.universalIdentifier,functionUniversalIdentifier:r,functionName:a})}catch(u){console.error($.default.red("Watch logs failed:"),u instanceof Error?u.message:u),process.exit(1)}}logWatchInfo({appName:i,functionUniversalIdentifier:r,functionName:a}){const u=i??"Twenty Application",p=r||a?`function "${r||a}"`:"functions";console.log($.default.blue(`🚀 Watching ${u} ${p} logs:`)),console.log("")}}class i_{constructor(){this.devCommand=new e_,this.syncCommand=new t_,this.uninstallCommand=new Zv,this.addCommand=new uy,this.generateCommand=new n_,this.logsCommand=new r_}getCommand(){const i=new xi.Command("app");return i.description("Application development commands"),i.command("dev [appPath]").description("Watch and sync local application changes").option("-d, --debounce <ms>","Debounce delay in milliseconds","1000").action(async(r,a)=>{await this.devCommand.execute({...a,appPath:kn(r)})}),i.command("sync [appPath]").description("Sync application to Twenty").action(async r=>{try{(await this.syncCommand.execute(kn(r))).success||process.exit(1)}catch{process.exit(1)}}),i.command("uninstall [appPath]").description("Uninstall application from Twenty").action(async r=>{try{(await this.uninstallCommand.execute({appPath:kn(r),askForConfirmation:!0})).success||process.exit(1)}catch{process.exit(1)}}),i.command("delete [appPath]",{hidden:!0}).description("Delete application from Twenty").action(async r=>{try{(await this.uninstallCommand.execute({appPath:kn(r),askForConfirmation:!0})).success||process.exit(1)}catch{process.exit(1)}}),i.command("add [entityType]").option("--path <path>","Path in which the entity should be created.").description(`Add a new entity to your application (${Object.values(wi).join("|")})`).action(async(r,a)=>{r&&!ay(r)&&(console.error($.default.red(`Invalid entity type "${r}". Must be one of: ${Object.values(wi).join("|")}`)),process.exit(1)),await this.addCommand.execute(r,a?.path)}),i.command("generate [outputPath]").description("Generate Twenty client").action(async r=>{await this.generateCommand.execute(kn(r))}),i.command("logs [appPath]").option("-u, --functionUniversalIdentifier <functionUniversalIdentifier>","Only show logs for the function with this universal ID").option("-n, --functionName <functionName>","Only show logs for the function with this name").description("Watch application function logs").action(async(r,a)=>{await this.logsCommand.execute({...a,appPath:kn(r)})}),i}}class s_{constructor(){this.configService=new At,this.apiService=new Wn}getCommand(){const i=new xi.Command("auth");return i.description("Authentication commands"),i.command("login").description("Authenticate with Twenty").option("--api-key <key>","API key for authentication").option("--api-url <url>","Twenty API URL").action(async r=>{await this.login(r)}),i.command("logout").description("Remove authentication credentials").action(async()=>{await this.logout()}),i.command("status").description("Check authentication status").action(async()=>{await this.status()}),i}async login(i){try{let{apiKey:r,apiUrl:a}=i;const u=await this.configService.getConfig();if(a||(a=(await Pn.default.prompt([{type:"input",name:"apiUrl",message:"Twenty API URL:",default:u.apiUrl,validate:_=>{try{return new URL(_),!0}catch{return"Please enter a valid URL"}}}])).apiUrl),r||(r=(await Pn.default.prompt([{type:"password",name:"apiKey",message:"API Key:",mask:"*",validate:_=>_.length>0||"API key is required"}])).apiKey),await this.configService.setConfig({apiUrl:a,apiKey:r}),await this.apiService.validateAuth()){const y=At.getActiveWorkspace();console.log($.default.green(`✓ Successfully authenticated with Twenty (workspace: ${y})`))}else console.log($.default.red("✗ Authentication failed. Please check your credentials.")),process.exit(1)}catch(r){console.error($.default.red("Login failed:"),r instanceof Error?r.message:r),process.exit(1)}}async logout(){try{await this.configService.clearConfig();const i=At.getActiveWorkspace();console.log($.default.green(`✓ Successfully logged out (workspace: ${i})`))}catch(i){console.error($.default.red("Logout failed:"),i instanceof Error?i.message:i),process.exit(1)}}async status(){try{const i=At.getActiveWorkspace(),r=await this.configService.getConfig();if(console.log($.default.blue("Authentication Status:")),console.log(`Workspace: ${i}`),console.log(`API URL: ${r.apiUrl}`),console.log(`API Key: ${r.apiKey?"***"+r.apiKey.slice(-4):"Not set"}`),r.apiKey){const a=await this.apiService.validateAuth();console.log(`Status: ${a?$.default.green("✓ Valid"):$.default.red("✗ Invalid")}`)}else console.log(`Status: ${$.default.yellow("⚠ Not authenticated")}`)}catch(i){console.error($.default.red("Status check failed:"),i instanceof Error?i.message:i),process.exit(1)}}}const o_="0.2.2",a_={version:o_},vn=new xi.Command;vn.name("twenty").description("CLI for Twenty application development").version(a_.version);vn.option("--workspace <name>","Use a specific workspace configuration","default");vn.hook("preAction",n=>{const r=(n.optsWithGlobals?n.optsWithGlobals():n.opts()).workspace;At.setActiveWorkspace(r),console.log($.default.gray(`👩‍💻 Workspace - ${At.getActiveWorkspace()}`))});vn.addCommand(new s_().getCommand());vn.addCommand(new i_().getCommand());vn.exitOverride();try{vn.parse()}catch(n){n instanceof xi.CommanderError&&process.exit(n.exitCode),n instanceof Error&&(console.error($.default.red("Error:"),n.message),process.exit(1))}
package/dist/cli.mjs CHANGED
@@ -9638,7 +9638,7 @@ class S_ {
9638
9638
  }
9639
9639
  }
9640
9640
  }
9641
- const b_ = "0.2.1", O_ = {
9641
+ const b_ = "0.2.2", O_ = {
9642
9642
  version: b_
9643
9643
  }, Tt = new go();
9644
9644
  Tt.name("twenty").description("CLI for Twenty application development").version(O_.version);
@@ -0,0 +1,26 @@
1
+ import { ObjectRecordEvent } from './object-record-event.event';
2
+
3
+ type SimplifiedFlatObjectMetadata = {
4
+ id: string;
5
+ nameSingular: string;
6
+ namePlural: string;
7
+ labelSingular: string;
8
+ labelPlural: string;
9
+ description: string | null;
10
+ icon: string | null;
11
+ universalIdentifier: string;
12
+ applicationId: string | null;
13
+ } & {
14
+ fieldMetadataIds: string[];
15
+ indexMetadataIds: string[];
16
+ viewIds: string[];
17
+ };
18
+ type WorkspaceEventBatch<WorkspaceEvent> = {
19
+ name: string;
20
+ workspaceId: string;
21
+ objectMetadata: SimplifiedFlatObjectMetadata;
22
+ events: WorkspaceEvent[];
23
+ };
24
+ export type DatabaseEventPayload<T = ObjectRecordEvent> = Omit<WorkspaceEventBatch<T>, 'events'> & T;
25
+ export {};
26
+ //# sourceMappingURL=database-event-payload.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-event-payload.type.d.ts","sourceRoot":"","sources":["../../src/database-events/database-event-payload.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAErF,KAAK,4BAA4B,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG;IACF,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,KAAK,mBAAmB,CAAC,cAAc,IAAI;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,4BAA4B,CAAC;IAC7C,MAAM,EAAE,cAAc,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,CAAC,GAAG,iBAAiB,IAAI,IAAI,CAC5D,mBAAmB,CAAC,CAAC,CAAC,EACtB,QAAQ,CACT,GACC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type { DatabaseEventPayload } from './database-event-payload.type';
2
+ export { ObjectRecordCreateEvent } from './object-record-create.event';
3
+ export { ObjectRecordDeleteEvent } from './object-record-delete.event';
4
+ export { ObjectRecordDestroyEvent } from './object-record-destroy.event';
5
+ export type { ObjectRecordDiff } from './object-record-diff';
6
+ export type { ObjectRecordEvent } from './object-record-event.event';
7
+ export type { ObjectRecordNonDestructiveEvent } from './object-record-non-destructive-event';
8
+ export { ObjectRecordRestoreEvent } from './object-record-restore.event';
9
+ export { ObjectRecordUpdateEvent } from './object-record-update.event';
10
+ export { ObjectRecordUpsertEvent } from './object-record-upsert.event';
11
+ export { ObjectRecordBaseEvent } from './object-record.base.event';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/database-events/index.ts"],"names":[],"mappings":"AASA,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ObjectRecordBaseEvent } from './object-record.base.event';
2
+
3
+ export declare class ObjectRecordCreateEvent<T = object> extends ObjectRecordBaseEvent<T> {
4
+ properties: {
5
+ after: T;
6
+ };
7
+ }
8
+ //# sourceMappingURL=object-record-create.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-create.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-create.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,qBAAa,uBAAuB,CAClC,CAAC,GAAG,MAAM,CACV,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACxB,UAAU,EAAE;QAClB,KAAK,EAAE,CAAC,CAAC;KACV,CAAC;CACH"}
@@ -0,0 +1,8 @@
1
+ import { ObjectRecordBaseEvent } from './object-record.base.event';
2
+
3
+ export declare class ObjectRecordDeleteEvent<T = object> extends ObjectRecordBaseEvent<T> {
4
+ properties: {
5
+ before: T;
6
+ };
7
+ }
8
+ //# sourceMappingURL=object-record-delete.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-delete.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-delete.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,qBAAa,uBAAuB,CAClC,CAAC,GAAG,MAAM,CACV,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACxB,UAAU,EAAE;QAClB,MAAM,EAAE,CAAC,CAAC;KACX,CAAC;CACH"}
@@ -0,0 +1,8 @@
1
+ import { ObjectRecordBaseEvent } from './object-record.base.event';
2
+
3
+ export declare class ObjectRecordDestroyEvent<T = object> extends ObjectRecordBaseEvent<T> {
4
+ properties: {
5
+ before: T;
6
+ };
7
+ }
8
+ //# sourceMappingURL=object-record-destroy.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-destroy.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-destroy.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,qBAAa,wBAAwB,CACnC,CAAC,GAAG,MAAM,CACV,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACxB,UAAU,EAAE;QAClB,MAAM,EAAE,CAAC,CAAC;KACX,CAAC;CACH"}
@@ -0,0 +1,7 @@
1
+ export type ObjectRecordDiff<T> = {
2
+ [K in keyof T]: {
3
+ before: T[K];
4
+ after: T[K];
5
+ };
6
+ };
7
+ //# sourceMappingURL=object-record-diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-diff.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-diff.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;KAC/B,CAAC,IAAI,MAAM,CAAC,GAAG;QAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE;CAC9C,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { ObjectRecordUpsertEvent } from './object-record-upsert.event';
2
+ import { ObjectRecordRestoreEvent } from './object-record-restore.event';
3
+ import { ObjectRecordDestroyEvent } from './object-record-destroy.event';
4
+ import { ObjectRecordCreateEvent } from './object-record-create.event';
5
+ import { ObjectRecordUpdateEvent } from './object-record-update.event';
6
+ import { ObjectRecordDeleteEvent } from './object-record-delete.event';
7
+
8
+ export type ObjectRecordEvent<T = object> = ObjectRecordUpdateEvent<T> | ObjectRecordDeleteEvent<T> | ObjectRecordCreateEvent<T> | ObjectRecordDestroyEvent<T> | ObjectRecordRestoreEvent<T> | ObjectRecordUpsertEvent<T>;
9
+ //# sourceMappingURL=object-record-event.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-event.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-event.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAE5F,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,MAAM,IACpC,uBAAuB,CAAC,CAAC,CAAC,GAC1B,uBAAuB,CAAC,CAAC,CAAC,GAC1B,uBAAuB,CAAC,CAAC,CAAC,GAC1B,wBAAwB,CAAC,CAAC,CAAC,GAC3B,wBAAwB,CAAC,CAAC,CAAC,GAC3B,uBAAuB,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ObjectRecordUpdateEvent } from './object-record-update.event';
2
+ import { ObjectRecordUpsertEvent } from './object-record-upsert.event';
3
+ import { ObjectRecordRestoreEvent } from './object-record-restore.event';
4
+ import { ObjectRecordDeleteEvent } from './object-record-delete.event';
5
+ import { ObjectRecordCreateEvent } from './object-record-create.event';
6
+
7
+ export type ObjectRecordNonDestructiveEvent = ObjectRecordCreateEvent | ObjectRecordUpdateEvent | ObjectRecordDeleteEvent | ObjectRecordRestoreEvent | ObjectRecordUpsertEvent;
8
+ //# sourceMappingURL=object-record-non-destructive-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-non-destructive-event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-non-destructive-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAE5F,MAAM,MAAM,+BAA+B,GACvC,uBAAuB,GACvB,uBAAuB,GACvB,uBAAuB,GACvB,wBAAwB,GACxB,uBAAuB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ObjectRecordCreateEvent } from './object-record-create.event';
2
+
3
+ export declare class ObjectRecordRestoreEvent<T = object> extends ObjectRecordCreateEvent<T> {
4
+ properties: {
5
+ after: T;
6
+ };
7
+ }
8
+ //# sourceMappingURL=object-record-restore.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-restore.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-restore.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAEvF,qBAAa,wBAAwB,CACnC,CAAC,GAAG,MAAM,CACV,SAAQ,uBAAuB,CAAC,CAAC,CAAC;IAC1B,UAAU,EAAE;QAClB,KAAK,EAAE,CAAC,CAAC;KACV,CAAC;CACH"}
@@ -0,0 +1,12 @@
1
+ import { ObjectRecordDiff } from './object-record-diff';
2
+ import { ObjectRecordBaseEvent } from './object-record.base.event';
3
+
4
+ export declare class ObjectRecordUpdateEvent<T = object> extends ObjectRecordBaseEvent<T> {
5
+ properties: {
6
+ updatedFields?: string[];
7
+ diff?: Partial<ObjectRecordDiff<T>>;
8
+ before: T;
9
+ after: T;
10
+ };
11
+ }
12
+ //# sourceMappingURL=object-record-update.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-update.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-update.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,qBAAa,uBAAuB,CAClC,CAAC,GAAG,MAAM,CACV,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACxB,UAAU,EAAE;QAClB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,EAAE,CAAC,CAAC;QACV,KAAK,EAAE,CAAC,CAAC;KACV,CAAC;CACH"}
@@ -0,0 +1,12 @@
1
+ import { ObjectRecordDiff } from './object-record-diff';
2
+ import { ObjectRecordBaseEvent } from './object-record.base.event';
3
+
4
+ export declare class ObjectRecordUpsertEvent<T = object> extends ObjectRecordBaseEvent<T> {
5
+ properties: {
6
+ before?: T;
7
+ after: T;
8
+ diff?: Partial<ObjectRecordDiff<T>>;
9
+ updatedFields?: string[];
10
+ };
11
+ }
12
+ //# sourceMappingURL=object-record-upsert.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record-upsert.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record-upsert.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,qBAAa,uBAAuB,CAClC,CAAC,GAAG,MAAM,CACV,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IACxB,UAAU,EAAE;QAClB,MAAM,CAAC,EAAE,CAAC,CAAC;QACX,KAAK,EAAE,CAAC,CAAC;QACT,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;CACH"}
@@ -0,0 +1,16 @@
1
+ import { ObjectRecordDiff } from './object-record-diff';
2
+
3
+ type Properties<T> = {
4
+ updatedFields?: string[];
5
+ before?: T;
6
+ after?: T;
7
+ diff?: Partial<ObjectRecordDiff<T>>;
8
+ };
9
+ export declare class ObjectRecordBaseEvent<T = object> {
10
+ recordId: string;
11
+ userId?: string;
12
+ workspaceMemberId?: string;
13
+ properties: Properties<T>;
14
+ }
15
+ export {};
16
+ //# sourceMappingURL=object-record.base.event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object-record.base.event.d.ts","sourceRoot":"","sources":["../../src/database-events/object-record.base.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,KAAK,UAAU,CAAC,CAAC,IAAI;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,KAAK,CAAC,EAAE,CAAC,CAAC;IACV,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;CACrC,CAAC;AAEF,qBAAa,qBAAqB,CAAC,CAAC,GAAG,MAAM;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CAC3B"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class t{}class c extends t{}class s extends t{}class r extends t{}class d extends c{}class o extends t{}class n extends t{}exports.ObjectRecordBaseEvent=t;exports.ObjectRecordCreateEvent=c;exports.ObjectRecordDeleteEvent=s;exports.ObjectRecordDestroyEvent=r;exports.ObjectRecordRestoreEvent=d;exports.ObjectRecordUpdateEvent=o;exports.ObjectRecordUpsertEvent=n;
@@ -0,0 +1,23 @@
1
+ class t {
2
+ }
3
+ class s extends t {
4
+ }
5
+ class c extends t {
6
+ }
7
+ class d extends t {
8
+ }
9
+ class n extends s {
10
+ }
11
+ class r extends t {
12
+ }
13
+ class a extends t {
14
+ }
15
+ export {
16
+ t as ObjectRecordBaseEvent,
17
+ s as ObjectRecordCreateEvent,
18
+ c as ObjectRecordDeleteEvent,
19
+ d as ObjectRecordDestroyEvent,
20
+ n as ObjectRecordRestoreEvent,
21
+ r as ObjectRecordUpdateEvent,
22
+ a as ObjectRecordUpsertEvent
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twenty-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",