twenty-sdk 0.4.1 → 0.4.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 (95) hide show
  1. package/dist/AllIcons-CGPKtPQS-DNCqqVPl.js +18986 -0
  2. package/dist/AllIcons-CGPKtPQS-pnhRwY6h.mjs +30768 -0
  3. package/dist/README.md +282 -0
  4. package/dist/{cli.cjs → cli/index.cjs} +33 -33
  5. package/dist/{cli.mjs → cli/index.mjs} +14 -17
  6. package/dist/front-component/index.cjs +1 -0
  7. package/dist/front-component/index.mjs +2668 -0
  8. package/dist/front-component-constants/index.cjs +1 -0
  9. package/dist/{front-component-constants.mjs → front-component-constants/index.mjs} +1 -1
  10. package/dist/input-CCBkYU6b.mjs +28020 -0
  11. package/dist/input-QArI9uHN.js +402 -0
  12. package/dist/isValidCountryCode-B7MxBtRC-BNPnBggZ.js +25 -0
  13. package/dist/{jsx-runtime-C9ldtZbm.mjs → isValidCountryCode-B7MxBtRC-BsdyqBLg.mjs} +4054 -4685
  14. package/dist/jsx-runtime-BdMIAavf.mjs +639 -0
  15. package/dist/jsx-runtime-Bglt9wWZ.js +30 -0
  16. package/dist/package.json +87 -0
  17. package/dist/ui/index.cjs +2015 -0
  18. package/dist/ui/index.d.ts +11 -0
  19. package/dist/ui/index.mjs +9941 -0
  20. package/dist/vendor/twenty-shared/{isValidCountryCode-Dyji5s5r.mjs → isValidCountryCode-B7MxBtRC.mjs} +963 -939
  21. package/dist/vendor/twenty-shared/{isValidCountryCode-D-UqlXRW.js → isValidCountryCode-BXhYkDye.js} +3 -3
  22. package/dist/vendor/twenty-shared/types/FilterableFieldType.d.ts +1 -1
  23. package/dist/vendor/twenty-shared/types/FilterableFieldType.d.ts.map +1 -1
  24. package/dist/vendor/twenty-shared/types/RecordGqlOperationFilter.d.ts +5 -1
  25. package/dist/vendor/twenty-shared/types/RecordGqlOperationFilter.d.ts.map +1 -1
  26. package/dist/vendor/twenty-shared/types/index.d.ts +1 -1
  27. package/dist/vendor/twenty-shared/types/index.d.ts.map +1 -1
  28. package/dist/vendor/twenty-shared/types.cjs +1 -1
  29. package/dist/vendor/twenty-shared/types.mjs +3 -2
  30. package/dist/vendor/twenty-shared/utils/filter/index.d.ts +1 -0
  31. package/dist/vendor/twenty-shared/utils/filter/index.d.ts.map +1 -1
  32. package/dist/vendor/twenty-shared/utils/filter/turnRecordFilterIntoGqlOperationFilter.d.ts.map +1 -1
  33. package/dist/vendor/twenty-shared/utils/filter/utils/getEmptyRecordGqlOperationFilter.d.ts.map +1 -1
  34. package/dist/vendor/twenty-shared/utils/filter/utils/getFilterTypeFromFieldType.d.ts.map +1 -1
  35. package/dist/vendor/twenty-shared/utils/filter/utils/isMatchingFilesFilter.d.ts +7 -0
  36. package/dist/vendor/twenty-shared/utils/filter/utils/isMatchingFilesFilter.d.ts.map +1 -0
  37. package/dist/vendor/twenty-shared/utils/index.d.ts +1 -0
  38. package/dist/vendor/twenty-shared/utils/index.d.ts.map +1 -1
  39. package/dist/vendor/twenty-shared/utils.cjs +2 -2
  40. package/dist/vendor/twenty-shared/utils.mjs +171 -151
  41. package/dist/vendor/twenty-shared/workflow.cjs +1 -1
  42. package/dist/vendor/twenty-shared/workflow.mjs +1 -1
  43. package/dist/vendor/twenty-ui/{Avatar-zyamQwOj.cjs → Avatar-CRldFv_0.cjs} +1 -1
  44. package/dist/vendor/twenty-ui/{Avatar-Cg4dvBA_.js → Avatar-q9sRncB5.js} +2 -2
  45. package/dist/vendor/twenty-ui/{Button-BChGSHVB.js → Button-C4mFr9D-.js} +2 -2
  46. package/dist/vendor/twenty-ui/{Button-PLd38fEI.cjs → Button-DglXLX4t.cjs} +2 -2
  47. package/dist/vendor/twenty-ui/{ColorSample-BEUix7Ah.cjs → ColorSample-D9DM-_ee.cjs} +1 -1
  48. package/dist/vendor/twenty-ui/{ColorSample-Bp-he5lO.js → ColorSample-IEHpxKsX.js} +1 -1
  49. package/dist/vendor/twenty-ui/MainColorNames-C1tU0n7M.cjs +1 -0
  50. package/dist/vendor/twenty-ui/MainColorNames-CH_C4JeD.js +5 -0
  51. package/dist/vendor/twenty-ui/{MainColorsLight-x_vjLhiq.js → MainColorsLight--0X05KcO.js} +1 -1
  52. package/dist/vendor/twenty-ui/{MainColorsLight-GOpmobTe.cjs → MainColorsLight-CpgC1-1i.cjs} +1 -1
  53. package/dist/vendor/twenty-ui/{OverflowingTextWithTooltip-1P96Lw-o.cjs → OverflowingTextWithTooltip-C4x0j2AD.cjs} +1 -1
  54. package/dist/vendor/twenty-ui/{OverflowingTextWithTooltip-F-KEqUMB.js → OverflowingTextWithTooltip-FRJL71ks.js} +2 -2
  55. package/dist/vendor/twenty-ui/{Tag-CfX8tARK.js → Tag-C0nqcoLd.js} +3 -3
  56. package/dist/vendor/twenty-ui/{Tag-DIE1bmT7.cjs → Tag-C6YGTe8G.cjs} +1 -1
  57. package/dist/vendor/twenty-ui/{ThemeCommon-BiQXECTo.cjs → ThemeCommon-DMvprlEs.cjs} +1 -1
  58. package/dist/vendor/twenty-ui/{ThemeCommon-CUpBXrDJ.js → ThemeCommon-RVLgB4Pa.js} +1 -1
  59. package/dist/vendor/twenty-ui/components.cjs +1 -1
  60. package/dist/vendor/twenty-ui/components.mjs +5 -5
  61. package/dist/vendor/twenty-ui/{config-D3RPmuwk.cjs → config-2EfZqKOo.cjs} +1 -1
  62. package/dist/vendor/twenty-ui/{config-D9UgCg2c.js → config-wKIVPAkA.js} +1 -1
  63. package/dist/vendor/twenty-ui/display.cjs +1 -1
  64. package/dist/vendor/twenty-ui/display.mjs +9 -9
  65. package/dist/vendor/twenty-ui/feedback.cjs +1 -1
  66. package/dist/vendor/twenty-ui/feedback.mjs +1 -1
  67. package/dist/vendor/twenty-ui/{getDisplayValueByUrlType-BMzTxZmB.cjs → getDisplayValueByUrlType-DwG-FZ1p.cjs} +1 -1
  68. package/dist/vendor/twenty-ui/{getDisplayValueByUrlType-BqPVhhu2.js → getDisplayValueByUrlType-DxqXD84p.js} +1 -1
  69. package/dist/vendor/twenty-ui/input.cjs +4 -4
  70. package/dist/vendor/twenty-ui/input.mjs +6 -6
  71. package/dist/vendor/twenty-ui/{isValidCountryCode-Dyji5s5r-MH68p3NE.cjs → isValidCountryCode-B7MxBtRC-BroSlnrA.cjs} +6 -6
  72. package/dist/vendor/twenty-ui/{isValidCountryCode-Dyji5s5r-B7O5eJvP.js → isValidCountryCode-B7MxBtRC-DyiZn2sl.js} +647 -647
  73. package/dist/vendor/twenty-ui/json-visualizer.cjs +2 -2
  74. package/dist/vendor/twenty-ui/json-visualizer.mjs +1 -1
  75. package/dist/vendor/twenty-ui/layout.cjs +2 -2
  76. package/dist/vendor/twenty-ui/layout.mjs +1 -1
  77. package/dist/vendor/twenty-ui/navigation.cjs +5 -5
  78. package/dist/vendor/twenty-ui/navigation.mjs +6 -6
  79. package/dist/vendor/twenty-ui/testing.cjs +2 -2
  80. package/dist/vendor/twenty-ui/testing.mjs +2 -2
  81. package/dist/vendor/twenty-ui/theme.cjs +1 -1
  82. package/dist/vendor/twenty-ui/theme.mjs +6 -6
  83. package/dist/vendor/twenty-ui/{themeColorSchema-CgAr-Bzv.js → themeColorSchema-DVfjPoxx.js} +1 -1
  84. package/dist/vendor/twenty-ui/{themeColorSchema-DSPsU2O5.cjs → themeColorSchema-DfeeV1pm.cjs} +1 -1
  85. package/dist/vendor/twenty-ui/{useMouseDownNavigation-C_8Q5KFZ.cjs → useMouseDownNavigation-Dr9ganU0.cjs} +1 -1
  86. package/dist/vendor/twenty-ui/{useMouseDownNavigation-qpLZC7wJ.js → useMouseDownNavigation-QLT907PP.js} +1 -1
  87. package/dist/vendor/twenty-ui/utilities.cjs +1 -1
  88. package/dist/vendor/twenty-ui/utilities.mjs +3 -3
  89. package/package.json +20 -9
  90. package/dist/front-component-constants.cjs +0 -1
  91. package/dist/front-component.cjs +0 -155
  92. package/dist/front-component.mjs +0 -23453
  93. package/dist/jsx-runtime-CfccAQK_.js +0 -54
  94. package/dist/vendor/twenty-ui/MainColorNames-DNUaoKmR.cjs +0 -1
  95. package/dist/vendor/twenty-ui/MainColorNames-O_b9E7H3.js +0 -5
package/dist/README.md ADDED
@@ -0,0 +1,282 @@
1
+ <div align="center">
2
+ <a href="https://twenty.com">
3
+ <picture>
4
+ <img alt="Twenty logo" src="https://raw.githubusercontent.com/twentyhq/twenty/2f25922f4cd5bd61e1427c57c4f8ea224e1d552c/packages/twenty-website/public/images/core/logo.svg" height="128">
5
+ </picture>
6
+ </a>
7
+ <h1>Twenty SDK</h1>
8
+
9
+ <a href="https://www.npmjs.com/package/twenty-sdk"><img alt="NPM version" src="https://img.shields.io/npm/v/twenty-sdk.svg?style=for-the-badge&labelColor=000000"></a>
10
+ <a href="https://github.com/twentyhq/twenty/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/npm/l/next.svg?style=for-the-badge&labelColor=000000"></a>
11
+ <a href="https://discord.gg/cx5n4Jzs57"><img alt="Join the community on Discord" src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&logo=Twenty&labelColor=000000&logoWidth=20"></a>
12
+
13
+ </div>
14
+
15
+ A CLI and SDK to develop, build, and publish applications that extend [Twenty CRM](https://twenty.com).
16
+
17
+ - Type‑safe client and workspace entity typings
18
+ - Built‑in CLI for auth, dev mode (watch & sync), generate, uninstall, and function management
19
+ - Works great with the scaffolder: [create-twenty-app](https://www.npmjs.com/package/create-twenty-app)
20
+
21
+ ## Documentation
22
+ See Twenty application documentation https://docs.twenty.com/developers/extend/capabilities/apps
23
+
24
+ ## Prerequisites
25
+ - Node.js 24+ (recommended) and Yarn 4
26
+ - A Twenty workspace and an API key. Generate one at https://app.twenty.com/settings/api-webhooks
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ npm install twenty-sdk
32
+ # or
33
+ yarn add twenty-sdk
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ```
39
+ Usage: twenty [options] [command]
40
+
41
+ CLI for Twenty application development
42
+
43
+ Options:
44
+ --workspace <name> Use a specific workspace configuration (default: "default")
45
+ -V, --version output the version number
46
+ -h, --help display help for command
47
+
48
+ Commands:
49
+ auth:login Authenticate with Twenty
50
+ auth:logout Remove authentication credentials
51
+ auth:status Check authentication status
52
+ auth:switch Switch the default workspace
53
+ auth:list List all configured workspaces
54
+ app:dev Watch and sync local application changes
55
+ app:generate Generate Twenty client
56
+ app:uninstall Uninstall application from Twenty
57
+ entity:add Add a new entity to your application
58
+ function:logs Watch application function logs
59
+ function:execute Execute a logic function with a JSON payload
60
+ help [command] display help for command
61
+ ```
62
+
63
+ ## Global Options
64
+
65
+ - `--workspace <name>`: Use a specific workspace configuration profile. Defaults to `default`. See Configuration for details.
66
+
67
+ ## Commands
68
+
69
+ ### Auth
70
+
71
+ Authenticate the CLI against your Twenty workspace.
72
+
73
+ - `twenty auth:login` — Authenticate with Twenty.
74
+ - Options:
75
+ - `--api-key <key>`: API key for authentication.
76
+ - `--api-url <url>`: Twenty API URL (defaults to your current profile's value or `http://localhost:3000`).
77
+ - Behavior: Prompts for any missing values, persists them to the active workspace profile, and validates the credentials.
78
+
79
+ - `twenty auth:logout` — Remove authentication credentials for the active workspace profile.
80
+
81
+ - `twenty auth:status` — Print the current authentication status (API URL, masked API key, validity).
82
+
83
+ - `twenty auth:list` — List all configured workspaces.
84
+ - Behavior: Displays all available workspaces with their authentication status and API URLs. Shows which workspace is the current default.
85
+
86
+ - `twenty auth:switch [workspace]` — Switch the default workspace for authentication.
87
+ - Arguments:
88
+ - `workspace` (optional): Name of the workspace to switch to. If omitted, shows an interactive selection.
89
+ - Behavior: Sets the specified workspace as the default, so subsequent commands use it without needing `--workspace`.
90
+
91
+ Examples:
92
+
93
+ ```bash
94
+ # Login interactively (recommended)
95
+ twenty auth:login
96
+
97
+ # Provide values in flags
98
+ twenty auth:login --api-key $TWENTY_API_KEY --api-url https://api.twenty.com
99
+
100
+ # Login interactively for a specific workspace profile
101
+ twenty auth:login --workspace my-custom-workspace
102
+
103
+ # Check status
104
+ twenty auth:status
105
+
106
+ # Logout current profile
107
+ twenty auth:logout
108
+
109
+ # List all configured workspaces
110
+ twenty auth:list
111
+
112
+ # Switch default workspace interactively
113
+ twenty auth:switch
114
+
115
+ # Switch to a specific workspace
116
+ twenty auth:switch production
117
+ ```
118
+
119
+ ### App
120
+
121
+ Application development commands.
122
+
123
+ - `twenty app:dev [appPath]` — Start development mode: watch and sync local application changes.
124
+ - Behavior: Builds your application (functions and front components), computes the manifest, syncs everything to your workspace, then watches the directory for changes and re-syncs automatically. Displays an interactive UI showing build and sync status in real time. Press Ctrl+C to stop.
125
+
126
+ - `twenty app:uninstall [appPath]` — Uninstall the application from the current workspace.
127
+
128
+ - `twenty app:generate [appPath]` — Generate the typed Twenty client for your application.
129
+
130
+ ### Entity
131
+
132
+ - `twenty entity:add [entityType]` — Add a new entity to your application.
133
+ - Arguments:
134
+ - `entityType`: one of `function`, `front-component`, `object`, or `role`. If omitted, an interactive prompt is shown.
135
+ - Options:
136
+ - `--path <path>`: The path where the entity file should be created (relative to the current directory).
137
+ - Behavior:
138
+ - `object`: prompts for singular/plural names and labels, then creates a `*.object.ts` definition file.
139
+ - `function`: prompts for a name and scaffolds a `*.function.ts` logic function file.
140
+ - `front-component`: prompts for a name and scaffolds a `*.front-component.tsx` file.
141
+ - `role`: prompts for a name and scaffolds a `*.role.ts` role definition file.
142
+
143
+ ### Function
144
+
145
+ - `twenty function:logs [appPath]` — Stream application function logs.
146
+ - Options:
147
+ - `-u, --functionUniversalIdentifier <id>`: Only show logs for a specific function universal ID.
148
+ - `-n, --functionName <name>`: Only show logs for a specific function name.
149
+
150
+ - `twenty function:execute [appPath]` — Execute a logic function with a JSON payload.
151
+ - Options:
152
+ - `-n, --functionName <name>`: Name of the function to execute (required if `-u` not provided).
153
+ - `-u, --functionUniversalIdentifier <id>`: Universal ID of the function to execute (required if `-n` not provided).
154
+ - `-p, --payload <payload>`: JSON payload to send to the function (default: `{}`).
155
+
156
+ Examples:
157
+
158
+ ```bash
159
+ # Start dev mode (watch, build, and sync)
160
+ twenty app:dev
161
+
162
+ # Start dev mode with a custom workspace profile
163
+ twenty app:dev --workspace my-custom-workspace
164
+
165
+ # Add a new entity interactively
166
+ twenty entity:add
167
+
168
+ # Add a new function
169
+ twenty entity:add function
170
+
171
+ # Add a new front component
172
+ twenty entity:add front-component
173
+
174
+ # Generate client types
175
+ twenty app:generate
176
+
177
+ # Uninstall the app from the workspace
178
+ twenty app:uninstall
179
+
180
+ # Watch all function logs
181
+ twenty function:logs
182
+
183
+ # Watch logs for a specific function by name
184
+ twenty function:logs -n my-function
185
+
186
+ # Execute a function by name (with empty payload)
187
+ twenty function:execute -n my-function
188
+
189
+ # Execute a function with a JSON payload
190
+ twenty function:execute -n my-function -p '{"name": "test"}'
191
+
192
+ # Execute a function by universal identifier
193
+ twenty function:execute -u e56d363b-0bdc-4d8a-a393-6f0d1c75bdcf -p '{"key": "value"}'
194
+ ```
195
+
196
+ ## Configuration
197
+
198
+ The CLI stores configuration per user in a JSON file:
199
+
200
+ - Location: `~/.twenty/config.json`
201
+ - Structure: Profiles keyed by workspace name. The active profile is selected with `--workspace <name>` or by the `defaultWorkspace` setting.
202
+
203
+ Example configuration file:
204
+
205
+ ```json
206
+ {
207
+ "defaultWorkspace": "prod",
208
+ "profiles": {
209
+ "default": {
210
+ "apiUrl": "http://localhost:3000",
211
+ "apiKey": "<your-api-key>"
212
+ },
213
+ "prod": {
214
+ "apiUrl": "https://api.twenty.com",
215
+ "apiKey": "<your-api-key>"
216
+ }
217
+ }
218
+ }
219
+ ```
220
+
221
+ Notes:
222
+
223
+ - If a profile is missing, `apiUrl` defaults to `http://localhost:3000` until set.
224
+ - `twenty auth:login` writes the `apiUrl` and `apiKey` for the active workspace profile.
225
+ - `twenty auth:login --workspace custom-workspace` writes the `apiUrl` and `apiKey` for a custom `custom-workspace` profile.
226
+ - `twenty auth:switch` sets the `defaultWorkspace` field, which is used when `--workspace` is not specified.
227
+ - `twenty auth:list` shows all configured workspaces and their authentication status.
228
+
229
+
230
+ ## Troubleshooting
231
+ - Auth errors: run `twenty auth:login` again and ensure the API key has the required permissions.
232
+ - Typings out of date: run `twenty app:generate` to refresh the client and types.
233
+ - Not seeing changes in dev: make sure dev mode is running (`twenty app:dev`).
234
+
235
+ ## Contributing
236
+
237
+ ### Development Setup
238
+
239
+ To contribute to the twenty-sdk package, clone the repository and install dependencies:
240
+
241
+ ```bash
242
+ git clone https://github.com/twentyhq/twenty.git
243
+ cd twenty
244
+ yarn install
245
+ ```
246
+
247
+ ### Development Mode
248
+
249
+ Run the SDK build in watch mode to automatically rebuild on file changes:
250
+
251
+ ```bash
252
+ npx nx run twenty-sdk:dev
253
+ ```
254
+
255
+ This will watch for changes and rebuild the `dist` folder automatically.
256
+
257
+ ### Production Build
258
+
259
+ Build the SDK for production:
260
+
261
+ ```bash
262
+ npx nx run twenty-sdk:build
263
+ ```
264
+
265
+ ### Running the CLI Locally
266
+
267
+ After building, you can run the CLI directly:
268
+
269
+ ```bash
270
+ npx nx run twenty-sdk:start -- <command>
271
+ # Example: npx nx run twenty-sdk:start -- auth:status
272
+ ```
273
+
274
+ Or run the built CLI directly:
275
+
276
+ ```bash
277
+ node packages/twenty-sdk/dist/cli.cjs <command>
278
+ ```
279
+
280
+ ### Resources
281
+ - See our [GitHub](https://github.com/twentyhq/twenty)
282
+ - Join our [Discord](https://discord.gg/cx5n4Jzs57)