twenty 0.2.0 → 2.46.0

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 (183) hide show
  1. package/CONTRIBUTING.md +166 -0
  2. package/LICENSE +21 -0
  3. package/README.md +64 -57
  4. package/dist/app-template/.nvmrc +1 -0
  5. package/dist/app-template/.oxlintrc.json +37 -0
  6. package/dist/app-template/AGENTS.md +70 -0
  7. package/dist/app-template/CHANGELOG.md +7 -0
  8. package/dist/app-template/README.md +34 -0
  9. package/dist/app-template/SETUP.md +47 -0
  10. package/dist/app-template/github/workflows/cd.yml +42 -0
  11. package/dist/app-template/github/workflows/ci.yml +60 -0
  12. package/dist/app-template/github/workflows/publish.yml +52 -0
  13. package/dist/app-template/gitignore +43 -0
  14. package/dist/app-template/locales/en.json +1 -0
  15. package/dist/app-template/package.json +36 -0
  16. package/dist/app-template/public/logo.svg +7 -0
  17. package/dist/app-template/src/__tests__/application-config.test.ts +14 -0
  18. package/dist/app-template/src/__tests__/global-setup.ts +56 -0
  19. package/dist/app-template/src/__tests__/run-twenty.ts +66 -0
  20. package/dist/app-template/src/__tests__/schema.integration-test.ts +46 -0
  21. package/dist/app-template/src/application-config.ts +13 -0
  22. package/dist/app-template/src/constants/universal-identifiers.ts +12 -0
  23. package/dist/app-template/src/default-role.ts +16 -0
  24. package/dist/app-template/src/front-components/main-page.tsx +287 -0
  25. package/dist/app-template/src/logic-functions/health-check.ts +11 -0
  26. package/dist/app-template/src/navigation-menu-items/main-page.navigation-menu-item.ts +19 -0
  27. package/dist/app-template/src/page-layouts/main-page.page-layout.ts +42 -0
  28. package/dist/app-template/tsconfig.json +37 -0
  29. package/dist/app-template/tsconfig.spec.json +9 -0
  30. package/dist/app-template/vitest.config.ts +31 -0
  31. package/dist/app-template/vitest.unit.config.ts +14 -0
  32. package/dist/app-template/yarn.lock +3374 -0
  33. package/dist/app-template/yarnrc.yml +1 -0
  34. package/dist/app-worker.cjs +1 -0
  35. package/dist/chunks/application-DuIJE2qG.cjs +5 -0
  36. package/dist/chunks/assert-pull-paths-BuQ1ZRvQ.cjs +1 -0
  37. package/dist/chunks/build-CX6FBrbu.cjs +1 -0
  38. package/dist/chunks/build-pull-entities-zwArrVMk.cjs +5 -0
  39. package/dist/chunks/build-source-manifest-CLKH5vzc.cjs +2 -0
  40. package/dist/chunks/build-source-snapshot-CbGsy1-v.cjs +206 -0
  41. package/dist/chunks/check-node-requirement-mqwNPktb.cjs +1 -0
  42. package/dist/chunks/cli-error-CSsayo0u.cjs +1 -0
  43. package/dist/chunks/cli-version.constant-aSp8WZDh.cjs +1 -0
  44. package/dist/chunks/collect-watch-inputs-B9jWG4W0.cjs +1 -0
  45. package/dist/chunks/compile-application-translations-B59jYVWc.cjs +1 -0
  46. package/dist/chunks/config-file-mode.constant-DLBzKKUl.cjs +1 -0
  47. package/dist/chunks/confirm-in-terminal-BxEM5lxE.cjs +1 -0
  48. package/dist/chunks/constants-CL6mrTMT-B748cNNG.cjs +23 -0
  49. package/dist/chunks/constants-Cf5-CwMu.cjs +1 -0
  50. package/dist/chunks/convert-to-label-BPBLtc_O.cjs +1 -0
  51. package/dist/chunks/create-app-not-installed-error-Cc8YZqI7.cjs +1 -0
  52. package/dist/chunks/create-cancelled-error-DgrNfOv2.cjs +1 -0
  53. package/dist/chunks/create-http-status-error-D3gy3DzB.cjs +1 -0
  54. package/dist/chunks/create-metadata-client-ChjDalSi.cjs +6 -0
  55. package/dist/chunks/create-pull-base-write-rxjcKtD-.cjs +1 -0
  56. package/dist/chunks/create-rest-client-eAfOFfDA.cjs +58 -0
  57. package/dist/chunks/create-tooling-failure-DLI5FlQP.cjs +1 -0
  58. package/dist/chunks/credential-kind-labels.constant-CKdoQF8o.cjs +1 -0
  59. package/dist/chunks/extract-manifest-from-file-j-Y9wNas.cjs +1 -0
  60. package/dist/chunks/fetch-metadata-inspection-Dp034TpK.cjs +1 -0
  61. package/dist/chunks/fetch-signed-in-identity-BhvaL3zp.cjs +1 -0
  62. package/dist/chunks/fetch-workspace-id-DJStmf_V.cjs +1 -0
  63. package/dist/chunks/find-remote-D48r20g0.cjs +1 -0
  64. package/dist/chunks/format-app-duration-gu2oRLB4.cjs +1 -0
  65. package/dist/chunks/format-body-VcKL4WXt.cjs +1 -0
  66. package/dist/chunks/format-data-value-B6rIbpJv.cjs +1 -0
  67. package/dist/chunks/format-details-COEwKz_M.cjs +2 -0
  68. package/dist/chunks/format-metadata-fields-DJnTg1R9.cjs +2 -0
  69. package/dist/chunks/format-metadata-owner-yUeocnwY.cjs +1 -0
  70. package/dist/chunks/format-table-4drtI5sP.cjs +2 -0
  71. package/dist/chunks/fs-utils-Bl1fQcaJ.cjs +2 -0
  72. package/dist/chunks/generate-application-client-CCVLjxTj.cjs +1 -0
  73. package/dist/chunks/get-app-plan-summary-B0uwHXbO.cjs +8 -0
  74. package/dist/chunks/get-config-path-C-D-QHuX.cjs +1 -0
  75. package/dist/chunks/get-credential-kind-JI9heHe2.cjs +1 -0
  76. package/dist/chunks/get-function-input-schema-GNk3NRLJ-Bfph1o9z.cjs +1 -0
  77. package/dist/chunks/get-tooling-error-context-C69TBSej.cjs +1 -0
  78. package/dist/chunks/global-flags.constant-8GfW0sNU.cjs +1 -0
  79. package/dist/chunks/has-yarn-plug-and-play-X3ay5Xl0.cjs +1 -0
  80. package/dist/chunks/is-access-token-expiring-gICPXsbO.cjs +1 -0
  81. package/dist/chunks/is-application-not-found-error-mNeGbxmT.cjs +1 -0
  82. package/dist/chunks/is-exported-manifest-CriNOWvx.cjs +1 -0
  83. package/dist/chunks/is-inside-directory-t3ixLQDr.cjs +1 -0
  84. package/dist/chunks/is-interaction-allowed-ycbAFMIj.cjs +1 -0
  85. package/dist/chunks/is-same-universal-identifier-BCBib3RP.cjs +1 -0
  86. package/dist/chunks/is-supported-locale-BAjnKnKj.cjs +20 -0
  87. package/dist/chunks/kebab-case-D0usAzG-.cjs +1 -0
  88. package/dist/chunks/list-application-source-files-jEau5Rie.cjs +1 -0
  89. package/dist/chunks/metadata-D9sQOTRK.cjs +1 -0
  90. package/dist/chunks/metadata-page.constant-BkG4ndrO.cjs +1 -0
  91. package/dist/chunks/oauth-timing.constant-BClMQcKn.cjs +1 -0
  92. package/dist/chunks/open-browser-LPuVspT7.cjs +1 -0
  93. package/dist/chunks/package-CdYv4LEx.cjs +1 -0
  94. package/dist/chunks/parse-api-url-BllxRdpE.cjs +1 -0
  95. package/dist/chunks/parse-app-export-BkfflyUY.cjs +1 -0
  96. package/dist/chunks/parse-graphql-response-CtP9KTS2.cjs +1 -0
  97. package/dist/chunks/parse-json-input-CvMTKAWw.cjs +1 -0
  98. package/dist/chunks/print-typescript-value-DhElcFzI.cjs +3 -0
  99. package/dist/chunks/pull-source-eoiJwFb9.cjs +1 -0
  100. package/dist/chunks/read-app-identity-SeleQ_D6.cjs +1 -0
  101. package/dist/chunks/read-application-identity-BFg_p84F.cjs +1 -0
  102. package/dist/chunks/read-command-values-uSJqBG_E.cjs +1 -0
  103. package/dist/chunks/read-config-DUJ27809.cjs +1 -0
  104. package/dist/chunks/read-input-value-Cxgh_r2g.cjs +1 -0
  105. package/dist/chunks/read-source-identity-C8LG1v6U.cjs +1 -0
  106. package/dist/chunks/read-watch-input-stamp-BxeOb0vI.cjs +1 -0
  107. package/dist/chunks/record-pull-base-BbxvlnU8.cjs +1 -0
  108. package/dist/chunks/record-typecheck-config-inputs-BDqkKCrj.cjs +1 -0
  109. package/dist/chunks/request-oauth-tokens-C4KKlTQT.cjs +1 -0
  110. package/dist/chunks/request-timeout-milliseconds.constant-DtyQHrll.cjs +1 -0
  111. package/dist/chunks/require-approval-fhegB1ap.cjs +1 -0
  112. package/dist/chunks/resolve-app-project-D5ZXIpsG.cjs +1 -0
  113. package/dist/chunks/resolve-inside-sdk-p-16gKb4.cjs +1 -0
  114. package/dist/chunks/resolve-metadata-object-QoDi-Aik.cjs +1 -0
  115. package/dist/chunks/resolve-project-typescript-CDY8BbmP.cjs +1 -0
  116. package/dist/chunks/resolve-request-url-jC5kYwkn.cjs +1 -0
  117. package/dist/chunks/resolve-source-sdk-mK-f4q55.cjs +1 -0
  118. package/dist/chunks/result-item-limit.constant-CDrOhiWD.cjs +1 -0
  119. package/dist/chunks/run-api-graphql-command-Biy0WqXa.cjs +1 -0
  120. package/dist/chunks/run-api-rest-command-D9kdQceV.cjs +1 -0
  121. package/dist/chunks/run-app-add-command-DcTQg7Si.cjs +163 -0
  122. package/dist/chunks/run-app-apply-command-DwLPPJ-Y.cjs +2 -0
  123. package/dist/chunks/run-app-build-command-BRYb0one.cjs +2 -0
  124. package/dist/chunks/run-app-dev-command-CVeh9Gab.cjs +2 -0
  125. package/dist/chunks/run-app-exec-command-DKLNLbL5.cjs +3 -0
  126. package/dist/chunks/run-app-init-command-CJj8_spC.cjs +2 -0
  127. package/dist/chunks/run-app-logs-command-Dusb8K-W.cjs +9 -0
  128. package/dist/chunks/run-app-operation-BWrY9YZK.cjs +1 -0
  129. package/dist/chunks/run-app-plan-command-C0_3e332.cjs +1 -0
  130. package/dist/chunks/run-app-pull-command-DcZqs8gR.cjs +3 -0
  131. package/dist/chunks/run-app-typecheck-command-C8LqpOej.cjs +1 -0
  132. package/dist/chunks/run-app-uninstall-command-ncWS_k-p.cjs +2 -0
  133. package/dist/chunks/run-auth-login-command-_zDgRcth.cjs +1 -0
  134. package/dist/chunks/run-auth-logout-command-BO6O7GVi.cjs +2 -0
  135. package/dist/chunks/run-auth-status-command-Cj-vqoHg.cjs +1 -0
  136. package/dist/chunks/run-auth-token-command-D4geJ-rx.cjs +1 -0
  137. package/dist/chunks/run-cli-c9TOR0zj.cjs +23 -0
  138. package/dist/chunks/run-commands-command-C6gvMpQ_.cjs +2 -0
  139. package/dist/chunks/run-data-get-command-jDEU4EG1.cjs +1 -0
  140. package/dist/chunks/run-data-list-command-EnCdbuzc.cjs +1 -0
  141. package/dist/chunks/run-doctor-command-DnJ6io-m.cjs +2 -0
  142. package/dist/chunks/run-metadata-field-describe-command-vJngpw2S.cjs +3 -0
  143. package/dist/chunks/run-metadata-field-list-command-CR4w7fI6.cjs +3 -0
  144. package/dist/chunks/run-metadata-object-describe-command-CHP8K-W2.cjs +3 -0
  145. package/dist/chunks/run-metadata-object-list-command-BqXMcAp6.cjs +2 -0
  146. package/dist/chunks/run-open-command-DKl8acw0.cjs +1 -0
  147. package/dist/chunks/run-remote-list-command-DeAzr5Mn.cjs +1 -0
  148. package/dist/chunks/run-remote-remove-command-D0C5sWjP.cjs +2 -0
  149. package/dist/chunks/run-remote-rename-command-Byq9WRHd.cjs +1 -0
  150. package/dist/chunks/run-remote-use-command-B6VVDlMG.cjs +1 -0
  151. package/dist/chunks/run-version-command-BmSk8PUV.cjs +1 -0
  152. package/dist/chunks/select-target-C1VZjf-A.cjs +1 -0
  153. package/dist/chunks/sign-in-to-remote-again-CW8HPSTP.cjs +1 -0
  154. package/dist/chunks/sign-in-with-browser-C3kC6uP2.cjs +1 -0
  155. package/dist/chunks/style-BR52fK4V.cjs +1 -0
  156. package/dist/chunks/target-environment-variable.constant-D7z8AihP.cjs +1 -0
  157. package/dist/chunks/to-cli-error-BBYf_wqo.cjs +1 -0
  158. package/dist/chunks/to-public-target-CIAwoOKL.cjs +1 -0
  159. package/dist/chunks/to-worker-output-diagnostics-lprh9b0l.cjs +2 -0
  160. package/dist/chunks/typecheck-application-DGrovgX9.cjs +2 -0
  161. package/dist/chunks/undici-D3mKdfwl.cjs +95 -0
  162. package/dist/chunks/update-config-BkKBEfAp.cjs +1 -0
  163. package/dist/chunks/utils-B8EXJeaX-DK3gCslL.cjs +33 -0
  164. package/dist/chunks/validate-app-path-Dau-PC0a.cjs +1 -0
  165. package/dist/chunks/validate-remote-name-w-qnr43w.cjs +1 -0
  166. package/dist/chunks/write-config-atomically-DRWTukU-.cjs +1 -0
  167. package/dist/cli.cjs +2 -0
  168. package/docs/commands.md +564 -0
  169. package/package.json +41 -18
  170. package/src/app/README.md +43 -0
  171. package/src/app/add/README.md +69 -0
  172. package/src/app/bundles/README.md +85 -0
  173. package/src/app/client/README.md +62 -0
  174. package/src/app/dev/README.md +35 -0
  175. package/src/app/exec/README.md +48 -0
  176. package/src/app/function-logs/README.md +44 -0
  177. package/src/app/manifest/README.md +74 -0
  178. package/src/app/pull/README.md +28 -0
  179. package/src/app/source/README.md +33 -0
  180. package/src/app/typecheck/README.md +67 -0
  181. package/.npmignore +0 -2
  182. package/bin/twenty +0 -2
  183. package/index.js +0 -118
@@ -0,0 +1,67 @@
1
+ # Application typechecking
2
+
3
+ The CLI typechecks applications using their own TypeScript installation.
4
+ See the [app tooling overview](../README.md) for package ownership.
5
+
6
+ The internal `typecheckSource` worker request checks the app's source and compiler
7
+ configuration. `bundleSnapshot` runs this typecheck after bundling. A failed check
8
+ discards that build's snapshot. Public build, typecheck, plan, apply and uninstall
9
+ commands use this pipeline.
10
+
11
+ ## Compiler ownership
12
+
13
+ The globally installed CLI resolves `typescript` from the app's `node_modules`
14
+ or a workspace ancestor. It never falls back to its own parser dependency,
15
+ `NODE_PATH` or Node's global package folders. Apps keep TypeScript in their
16
+ development dependencies; neither apps nor the SDK depend on the CLI.
17
+
18
+ Missing TypeScript returns `TYPESCRIPT_NOT_INSTALLED`. An incomplete installation,
19
+ missing compiler API or unsupported Plug'n'Play installation returns
20
+ `TOOLING_UNSUPPORTED`. The resolved compiler entry must belong to the app's
21
+ TypeScript installation so checks use the project's compiler version.
22
+
23
+ TypeScript is loaded only in the child worker. Its public JavaScript compiler API
24
+ is required. The CLI uses the installed compiler's diagnostic categories and
25
+ message formatter, so diagnostics follow the project's compiler version. The CLI
26
+ parser used for source loading remains independent.
27
+
28
+ ## Compiler contract
29
+
30
+ - Read the app's `tsconfig.json`, preserve its project references and force
31
+ `noEmit: true`. Do not write JavaScript, declarations or build information.
32
+ - Configuration read/parse errors fail the check, including missing configs,
33
+ invalid options and missing extended configs. Source diagnostics use TS codes,
34
+ project-relative paths and one-based line and column numbers.
35
+ - Unbuilt project references fail with TS6305, including diagnostics without a
36
+ source location. Build the referenced projects separately; this check does not
37
+ build them or silently ignore their errors.
38
+ - Build warnings remain alongside typecheck diagnostics. Failure never holds a
39
+ snapshot for upload, and cleanup preserves unrelated snapshots.
40
+ - Check cancellation before and after the synchronous compiler work. A busy
41
+ compiler cannot process IPC cancellation mid-call; the worker grace
42
+ period and forced termination remain the fallback.
43
+
44
+ Different compiler versions can produce different diagnostics. Align compiler
45
+ versions when comparing CLI results with another tool. See the
46
+ [build requirements](../../../docs/commands.md#build-and-check-an-app) for
47
+ configuration and project-reference troubleshooting.
48
+
49
+ ## Verification
50
+
51
+ From `packages/twenty-cli`, after building the shared and SDK dependencies:
52
+
53
+ ```sh
54
+ node ../../node_modules/vitest/vitest.mjs run --config vitest.config.ts src/app/typecheck src/app/snapshots --maxWorkers=1
55
+ ```
56
+
57
+ The typecheck suite compares the SDK reference, the CLI implementation
58
+ and the production worker with the same compiler. It also tests absent and hoisted
59
+ compilers, global-path fallback, incomplete installations and actual TypeScript
60
+ 5.9.3 versus 5.7.3 behavior. The 5.7.3 compiler comes from the SDK's
61
+ ts-morph dependency for this test only.
62
+
63
+ Snapshot parity runs both real typecheck phases, with no compiler bypass.
64
+ The app fixture supplies only the SDK's authoring/runtime exports. The apply
65
+ contract exercises CLI snapshots against a local HTTP fixture.
66
+ For the fresh CLI template, parity compares successful builds with the test
67
+ setup included and Vitest configuration files excluded.
package/.npmignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules/
2
- todo.txt
package/bin/twenty DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- require('../index').cli();
package/index.js DELETED
@@ -1,118 +0,0 @@
1
- var dns = require('dns');
2
- var request = require('request');
3
-
4
- var ipRegexStr = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' +
5
- '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' +
6
- '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' +
7
- '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)';
8
- var ipRegex = new RegExp(ipRegexStr);
9
-
10
- var toRad = function(num) {
11
- return num * (Math.PI / 180);
12
- };
13
-
14
- var getIpInfo = function(server, callback) {
15
- var ipinfo = function(p, cb) {
16
- request('http://ipinfo.io/' + p, function(err, response, body) {
17
- var json;
18
- try {
19
- json = JSON.parse(body);
20
- } catch(error) {
21
- return cb(error, null);
22
- }
23
- cb(err, json);
24
- });
25
- };
26
-
27
- if (!server) {
28
- return ipinfo('json', callback);
29
- } else if (!server.match(ipRegex)) {
30
- return dns.lookup(server, function(err, data) {
31
- ipinfo(data, callback);
32
- });
33
- } else {
34
- return ipinfo(server, callback);
35
- }
36
- };
37
-
38
- var ipDistance = function(lat1, lon1, lat2, lon2) {
39
- // Earth radius in km
40
- var r = 6371;
41
-
42
- var dLat = toRad(lat2 - lat1);
43
- var dLon = toRad(lon2 - lon1);
44
- lat1 = toRad(lat1);
45
- lat2 = toRad(lat2);
46
-
47
- var a = Math.sin(dLat / 2.0) * Math.sin(dLat / 2.0) +
48
- Math.sin(dLon / 2.0) * Math.sin(dLon / 2.0) * Math.cos(lat1) * Math.cos(lat2);
49
- var c = 2.0 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0 - a));
50
- return r * c;
51
- };
52
-
53
- var findDistance = function(ip1, ip2, callback) {
54
- var lat1, lon1, lat2, lon2;
55
-
56
- getIpInfo(ip1, function(err, data1) {
57
- var coords1 = data1.loc.split(',');
58
- lat1 = Number(coords1[0]);
59
- lon1 = Number(coords1[1]);
60
- getIpInfo(ip2, function(err, data2) {
61
- var coords2 = data2.loc.split(',');
62
- lat2 = Number(coords2[0]);
63
- lon2 = Number(coords2[1]);
64
-
65
- var dist = ipDistance(lat1, lon1, lat2, lon2);
66
- callback(null, dist);
67
- });
68
- });
69
- };
70
-
71
- var cli = function() {
72
- var yargs = require('yargs')
73
- .usage('Usage: $0 [command] [options]')
74
- .command('distance <loc1> [loc2]', 'Compute the approx. distance between IPs/URLs')
75
- .option('json', {
76
- alias: 'j',
77
- describe: 'Return data as json',
78
- })
79
- .example('$0', 'Get location info for your IP address')
80
- .example('$0 -j', 'Get location info for your IP as json')
81
- .example('$0 distance 8.8.8.8', 'Get distance from your IP to given IP')
82
- .example('$0 distance stackabuse.com google.com', 'Get the distance between two given URLs')
83
- .help('help')
84
- .alias('h', 'help')
85
- .epilog('Copyright 2016 Scott Robinson');
86
-
87
- var argv = yargs.argv;
88
-
89
- if (argv.loc1) {
90
- findDistance(argv.loc1, argv.loc2, function(err, distance) {
91
- console.log(String(distance.toFixed(2)) + ' km');
92
- });
93
- } else if (argv.json) {
94
- getIpInfo(argv._[0], function(err, data) {
95
- console.log(JSON.stringify(data, null, 4));
96
- });
97
- } else {
98
- getIpInfo(argv._[0], function(err, data) {
99
- if (err) {
100
- console.log('Error:', err.message);
101
- return;
102
- }
103
-
104
- console.log('IP:', data.ip);
105
- console.log('Hostname:', data.hostname || '-');
106
- console.log('City:', data.city || '-');
107
- console.log('Region:', data.region || '-');
108
- console.log('Postal:', data.postal || '-');
109
- console.log('Country:', data.country || '-');
110
- console.log('Coordinates:', data.loc || '-');
111
- console.log('ISP:', data.org || '-');
112
- });
113
- }
114
- };
115
-
116
- exports.info = getIpInfo;
117
- exports.distance = findDistance;
118
- exports.cli = cli;