twenty-client-sdk 2.22.0 → 2.23.0-alpha.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.
@@ -1 +1 @@
1
- var e=function(e){return e.ACTOR=`ACTOR`,e.ADDRESS=`ADDRESS`,e.ARRAY=`ARRAY`,e.BOOLEAN=`BOOLEAN`,e.CURRENCY=`CURRENCY`,e.DATE=`DATE`,e.DATE_TIME=`DATE_TIME`,e.EMAILS=`EMAILS`,e.FILES=`FILES`,e.FULL_NAME=`FULL_NAME`,e.LINKS=`LINKS`,e.MORPH_RELATION=`MORPH_RELATION`,e.MULTI_SELECT=`MULTI_SELECT`,e.NUMBER=`NUMBER`,e.NUMERIC=`NUMERIC`,e.PHONES=`PHONES`,e.POSITION=`POSITION`,e.RATING=`RATING`,e.RAW_JSON=`RAW_JSON`,e.RELATION=`RELATION`,e.RICH_TEXT=`RICH_TEXT`,e.SELECT=`SELECT`,e.TEXT=`TEXT`,e.TS_VECTOR=`TS_VECTOR`,e.UUID=`UUID`,e}({}),t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function n(e){return typeof e==`string`&&t.test(e)}function r(e){if(!n(e))throw TypeError(`Invalid UUID`);let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).slice(1));function a(e,t=0){return(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+`-`+i[e[t+4]]+i[e[t+5]]+`-`+i[e[t+6]]+i[e[t+7]]+`-`+i[e[t+8]]+i[e[t+9]]+`-`+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase()}function o(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}var s=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`,c=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`;function l(e,t,n,i,s,c){let l=typeof n==`string`?o(n):n,u=typeof i==`string`?r(i):i;if(typeof i==`string`&&(i=r(i)),i?.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let d=new Uint8Array(16+l.length);if(d.set(u),d.set(l,u.length),d=t(d),d[6]=d[6]&15|e,d[8]=d[8]&63|128,s){if(c||=0,c<0||c+16>s.length)throw RangeError(`UUID byte range ${c}:${c+15} is out of buffer bounds`);for(let e=0;e<16;++e)s[c+e]=d[e];return s}return a(d)}function u(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function d(e,t){return e<<t|e>>>32-t}function f(e){let t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128,e=r;let i=e.length/4+2,a=Math.ceil(i/16),o=Array(a);for(let t=0;t<a;++t){let n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[t*64+r*4]<<24|e[t*64+r*4+1]<<16|e[t*64+r*4+2]<<8|e[t*64+r*4+3];o[t]=n}o[a-1][14]=(e.length-1)*8/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(e.length-1)*8&4294967295;for(let e=0;e<a;++e){let r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=o[e][t];for(let e=16;e<80;++e)r[e]=d(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],a=n[1],s=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){let n=Math.floor(e/20),o=d(i,5)+u(n,a,s,c)+l+t[n]+r[e]>>>0;l=c,c=s,s=d(a,30)>>>0,a=i,i=o}n[0]=n[0]+i>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function p(e,t,n,r){return l(80,f,e,t,n,r)}p.DNS=s,p.URL=c,e.TEXT,e.ARRAY,e.BOOLEAN,e.DATE,e.DATE_TIME,e.NUMBER,e.NUMERIC,e.RAW_JSON,e.RICH_TEXT,e.SELECT,e.MULTI_SELECT;var m=`TWENTY_API_KEY`,h=`TWENTY_API_URL`,g=`TWENTY_APP_ACCESS_TOKEN`,_=`TWENTY_FUNCTIONS_URL`;Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return g}});
1
+ var e=function(e){return e.ACTOR=`ACTOR`,e.ADDRESS=`ADDRESS`,e.ARRAY=`ARRAY`,e.BOOLEAN=`BOOLEAN`,e.CURRENCY=`CURRENCY`,e.DATE=`DATE`,e.DATE_TIME=`DATE_TIME`,e.EMAILS=`EMAILS`,e.FILES=`FILES`,e.FULL_NAME=`FULL_NAME`,e.LINKS=`LINKS`,e.MORPH_RELATION=`MORPH_RELATION`,e.MULTI_SELECT=`MULTI_SELECT`,e.NUMBER=`NUMBER`,e.NUMERIC=`NUMERIC`,e.PHONES=`PHONES`,e.POSITION=`POSITION`,e.RATING=`RATING`,e.RAW_JSON=`RAW_JSON`,e.RELATION=`RELATION`,e.RICH_TEXT=`RICH_TEXT`,e.SELECT=`SELECT`,e.TEXT=`TEXT`,e.TS_VECTOR=`TS_VECTOR`,e.UUID=`UUID`,e}({}),t=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function n(e){return typeof e==`string`&&t.test(e)}function r(e){if(!n(e))throw TypeError(`Invalid UUID`);let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,t&255,(t=parseInt(e.slice(9,13),16))>>>8,t&255,(t=parseInt(e.slice(14,18),16))>>>8,t&255,(t=parseInt(e.slice(19,23),16))>>>8,t&255,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255)}var i=[];for(let e=0;e<256;++e)i.push((e+256).toString(16).slice(1));function a(e,t=0){return(i[e[t+0]]+i[e[t+1]]+i[e[t+2]]+i[e[t+3]]+`-`+i[e[t+4]]+i[e[t+5]]+`-`+i[e[t+6]]+i[e[t+7]]+`-`+i[e[t+8]]+i[e[t+9]]+`-`+i[e[t+10]]+i[e[t+11]]+i[e[t+12]]+i[e[t+13]]+i[e[t+14]]+i[e[t+15]]).toLowerCase()}function o(e){e=unescape(encodeURIComponent(e));let t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}var s=`6ba7b810-9dad-11d1-80b4-00c04fd430c8`,c=`6ba7b811-9dad-11d1-80b4-00c04fd430c8`;function l(e,t,n,i,s,c){let l=typeof n==`string`?o(n):n,u=typeof i==`string`?r(i):i;if(typeof i==`string`&&(i=r(i)),i?.length!==16)throw TypeError(`Namespace must be array-like (16 iterable integer values, 0-255)`);let d=new Uint8Array(16+l.length);if(d.set(u),d.set(l,u.length),d=t(d),d[6]=d[6]&15|e,d[8]=d[8]&63|128,s){if(c||=0,c<0||c+16>s.length)throw RangeError(`UUID byte range ${c}:${c+15} is out of buffer bounds`);for(let e=0;e<16;++e)s[c+e]=d[e];return s}return a(d)}function u(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function d(e,t){return e<<t|e>>>32-t}function f(e){let t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128,e=r;let i=e.length/4+2,a=Math.ceil(i/16),o=Array(a);for(let t=0;t<a;++t){let n=new Uint32Array(16);for(let r=0;r<16;++r)n[r]=e[t*64+r*4]<<24|e[t*64+r*4+1]<<16|e[t*64+r*4+2]<<8|e[t*64+r*4+3];o[t]=n}o[a-1][14]=(e.length-1)*8/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=(e.length-1)*8&4294967295;for(let e=0;e<a;++e){let r=new Uint32Array(80);for(let t=0;t<16;++t)r[t]=o[e][t];for(let e=16;e<80;++e)r[e]=d(r[e-3]^r[e-8]^r[e-14]^r[e-16],1);let i=n[0],a=n[1],s=n[2],c=n[3],l=n[4];for(let e=0;e<80;++e){let n=Math.floor(e/20),o=d(i,5)+u(n,a,s,c)+l+t[n]+r[e]>>>0;l=c,c=s,s=d(a,30)>>>0,a=i,i=o}n[0]=n[0]+i>>>0,n[1]=n[1]+a>>>0,n[2]=n[2]+s>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function p(e,t,n,r){return l(80,f,e,t,n,r)}p.DNS=s,p.URL=c,e.TEXT,e.ARRAY,e.BOOLEAN,e.DATE,e.DATE_TIME,e.NUMBER,e.NUMERIC,e.RAW_JSON,e.RICH_TEXT,e.SELECT,e.MULTI_SELECT;var m=`TWENTY_API_KEY`,h=`TWENTY_API_URL`,g=`TWENTY_APP_ACCESS_TOKEN`,_=`TWENTY_FUNCTIONS_URL`;Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
@@ -98,4 +98,4 @@ p.DNS = s, p.URL = c, e.TEXT, e.ARRAY, e.BOOLEAN, e.DATE, e.DATE_TIME, e.NUMBER,
98
98
  //#region ../twenty-shared/dist/application.mjs
99
99
  var m = "TWENTY_API_KEY", h = "TWENTY_API_URL", g = "TWENTY_APP_ACCESS_TOKEN", _ = "TWENTY_FUNCTIONS_URL";
100
100
  //#endregion
101
- export { h as i, _ as n, m as r, g as t };
101
+ export { m as i, g as n, _ as r, h as t };
package/dist/generate.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./chunk-DWNI8pZO.js"),t=require("./application-B4QqyXs-.js");let n=require("node:fs/promises"),r=require("node:path"),i=require("esbuild"),a=require("graphql"),o=require("lodash/camelCase.js");o=e.n(o);let s=require("node:fs"),c=require("node:os"),l=require("prettier/standalone");l=e.n(l);let u=require("prettier/plugins/graphql");u=e.n(u);let d=require("prettier/plugins/typescript");d=e.n(d);let f=require("prettier/plugins/estree");f=e.n(f);let p=require("lodash/uniq.js");p=e.n(p);let ee=require("node:url");var te=`// __STRIPPED_DURING_INJECTION_START__`,ne=`// __STRIPPED_DURING_INJECTION_END__`,m=`// __UPLOAD_FILE_START__`,h=`// __UPLOAD_FILE_END__`,g=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),_=(e,t)=>{let n=e;return n=n.replace(RegExp(`${g(te)}[\\s\\S]*?${g(ne)}\\n?`),``),n=n.replace(`'__TWENTY_DEFAULT_URL__'`,t.defaultUrl),n=n.replace(/TwentyGeneratedClient/g,t.apiClientName),t.includeUploadFile?(n=n.replace(RegExp(`\\s*${g(m)}\\n`),`
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./chunk-DWNI8pZO.js"),t=require("./application-BypHiXV3.js");let n=require("node:fs/promises"),r=require("node:path"),i=require("esbuild"),a=require("graphql"),o=require("lodash/camelCase.js");o=e.n(o);let s=require("node:fs"),c=require("node:os"),l=require("prettier/standalone");l=e.n(l);let u=require("prettier/plugins/graphql");u=e.n(u);let d=require("prettier/plugins/typescript");d=e.n(d);let f=require("prettier/plugins/estree");f=e.n(f);let p=require("lodash/uniq.js");p=e.n(p);let ee=require("node:url");var te=`// __STRIPPED_DURING_INJECTION_START__`,ne=`// __STRIPPED_DURING_INJECTION_END__`,m=`// __UPLOAD_FILE_START__`,h=`// __UPLOAD_FILE_END__`,g=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),_=(e,t)=>{let n=e;return n=n.replace(RegExp(`${g(te)}[\\s\\S]*?${g(ne)}\\n?`),``),n=n.replace(`'__TWENTY_DEFAULT_URL__'`,t.defaultUrl),n=n.replace(/TwentyGeneratedClient/g,t.apiClientName),t.includeUploadFile?(n=n.replace(RegExp(`\\s*${g(m)}\\n`),`
2
2
  `),n=n.replace(RegExp(`\\s*${g(h)}\\n`),`
3
3
  `)):n=n.replace(RegExp(`\\s*${g(m)}[\\s\\S]*?${g(h)}\\n?`),`
4
4
  `),`\n// ${t.apiClientName} (auto-injected by twenty-client-sdk)\n${n}`},v=e=>(0,n.mkdir)(e,{recursive:!0}),y=async e=>{let t;try{t=await(0,n.readdir)(e)}catch(t){if(t instanceof Error&&`code`in t&&t.code===`ENOENT`){await(0,n.mkdir)(e,{recursive:!0});return}throw t}await Promise.all(t.map(t=>(0,n.rm)((0,r.join)(e,t),{recursive:!0,force:!0})))},b=async(e,t)=>{try{await(0,n.rename)(e,t)}catch(r){if(r instanceof Error&&`code`in r&&r.code===`EXDEV`)await(0,n.cp)(e,t,{recursive:!0}),await(0,n.rm)(e,{recursive:!0,force:!0});else throw r}},x=e=>(0,n.rm)(e,{recursive:!0,force:!0}),re=e=>{let{root:t}=(0,r.parse)(e),n=e.slice(t.length).split(/[\\/]/).filter(Boolean).length,i=(0,r.resolve)((0,c.homedir)()),a=e===i||i.startsWith(`${e}/`);if(e===t||n<2||a)throw Error(`Refusing to recursively clear unsafe path: ${e}`)},S=async(e,t=!1)=>{let n=(0,r.resolve)(...e);t&&(re(n),await s.promises.rm(n,{recursive:!0,force:!0})),await s.promises.mkdir(n,{recursive:!0})},C=async(e,t)=>{let n=(0,r.resolve)(...e,`..`);await s.promises.mkdir(n,{recursive:!0}),await s.promises.writeFile((0,r.resolve)(...e),t)},w=`./runtime`,T=e=>e?`${e.name}GenqlSelection`:``,ie=e=>{let t=e.config?.endpoint?`"${e.config.endpoint}"`:`undefined`,n=e.config?.fetchImport;return`
@@ -1525,7 +1525,7 @@ export class TwentyGeneratedClient {
1525
1525
  processEnvironment[APP_ACCESS_TOKEN_ENV_KEY] = token;
1526
1526
  }
1527
1527
  }
1528
- `,s=`${i}.tmp`;await v(s),await y(s);try{await Z({schema:e,output:s,scalarTypes:Le});let a=_(o,{apiClientName:`CoreApiClient`,defaultUrl:`\`\${process.env.${t.i}}/graphql\``,includeUploadFile:!0});await(0,n.appendFile)((0,r.join)(s,`index.ts`),a),await x(i),await b(s,i),await ze(i)}catch(e){throw await x(s),e}},Re=async({packageRoot:e,schema:t})=>{let i=(0,r.join)(e,`dist`,Q);await $({schema:t,outputPath:i}),await(0,n.copyFile)((0,r.join)(i,`index.mjs`),(0,r.join)(e,`dist`,`core.mjs`)),await(0,n.copyFile)((0,r.join)(i,`index.cjs`),(0,r.join)(e,`dist`,`core.cjs`))},ze=async e=>{let t=(0,r.join)(e,`index.ts`),a=(0,r.join)(e,`index.mjs`);await(0,i.build)({entryPoints:[t],outfile:a,bundle:!0,format:`esm`,platform:`node`,target:`node18`,sourcemap:!1,minify:!1}),await(0,i.build)({entryPoints:[t],outfile:(0,r.join)(e,`index.cjs`),bundle:!0,format:`cjs`,platform:`node`,target:`node18`,sourcemap:!1,minify:!1}),await(0,n.writeFile)((0,r.join)(e,`package.json`),JSON.stringify({type:`module`,main:`index.mjs`,module:`index.mjs`},null,2))},Be={DateTime:`string`,JSON:`Record<string, unknown>`,UUID:`string`},Ve=async({schema:e,outputPath:i,clientWrapperTemplateSource:a})=>{let o=a??`// Ambient type stubs for the genql-generated code this template gets
1528
+ `,s=`${i}.tmp`;await v(s),await y(s);try{await Z({schema:e,output:s,scalarTypes:Le});let a=_(o,{apiClientName:`CoreApiClient`,defaultUrl:`\`\${process.env.${t.t}}/graphql\``,includeUploadFile:!0});await(0,n.appendFile)((0,r.join)(s,`index.ts`),a),await x(i),await b(s,i),await ze(i)}catch(e){throw await x(s),e}},Re=async({packageRoot:e,schema:t})=>{let i=(0,r.join)(e,`dist`,Q);await $({schema:t,outputPath:i}),await(0,n.copyFile)((0,r.join)(i,`index.mjs`),(0,r.join)(e,`dist`,`core.mjs`)),await(0,n.copyFile)((0,r.join)(i,`index.cjs`),(0,r.join)(e,`dist`,`core.cjs`))},ze=async e=>{let t=(0,r.join)(e,`index.ts`),a=(0,r.join)(e,`index.mjs`);await(0,i.build)({entryPoints:[t],outfile:a,bundle:!0,format:`esm`,platform:`node`,target:`node18`,sourcemap:!1,minify:!1}),await(0,i.build)({entryPoints:[t],outfile:(0,r.join)(e,`index.cjs`),bundle:!0,format:`cjs`,platform:`node`,target:`node18`,sourcemap:!1,minify:!1}),await(0,n.writeFile)((0,r.join)(e,`package.json`),JSON.stringify({type:`module`,main:`index.mjs`,module:`index.mjs`},null,2))},Be={DateTime:`string`,JSON:`Record<string, unknown>`,UUID:`string`},Ve=async({schema:e,outputPath:i,clientWrapperTemplateSource:a})=>{let o=a??`// Ambient type stubs for the genql-generated code this template gets
1529
1529
  // injected into. They enable full typecheck/lint on this file.
1530
1530
  // __STRIPPED_DURING_INJECTION_START__
1531
1531
  type QueryGenqlSelection = Record<string, unknown>;
@@ -1959,4 +1959,4 @@ export class TwentyGeneratedClient {
1959
1959
  processEnvironment[APP_ACCESS_TOKEN_ENV_KEY] = token;
1960
1960
  }
1961
1961
  }
1962
- `;await v(i),await y(i),await Z({schema:e,output:i,scalarTypes:{...Be,Upload:`File`}});let s=_(o,{apiClientName:`MetadataApiClient`,defaultUrl:`\`\${process.env.${t.i}}/metadata\``,includeUploadFile:!0});await(0,n.appendFile)((0,r.join)(i,`index.ts`),s)};exports.GENERATED_CORE_DIR=Q,exports.generateCoreClientFromSchema=$,exports.generateMetadataClient=Ve,exports.replaceCoreClient=Re;
1962
+ `;await v(i),await y(i),await Z({schema:e,output:i,scalarTypes:{...Be,Upload:`File`}});let s=_(o,{apiClientName:`MetadataApiClient`,defaultUrl:`\`\${process.env.${t.t}}/metadata\``,includeUploadFile:!0});await(0,n.appendFile)((0,r.join)(i,`index.ts`),s)};exports.GENERATED_CORE_DIR=Q,exports.generateCoreClientFromSchema=$,exports.generateMetadataClient=Ve,exports.replaceCoreClient=Re;
package/dist/generate.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { i as e } from "./application-BMFsJxEw.mjs";
1
+ import { t as e } from "./application-DS1TbVoz.mjs";
2
2
  import { appendFile as t, copyFile as n, cp as r, mkdir as i, readdir as a, rename as o, rm as s, writeFile as c } from "node:fs/promises";
3
3
  import { dirname as l, join as u, parse as ee, relative as d, resolve as f } from "node:path";
4
4
  import { build as p } from "esbuild";