twenty-sdk 2.9.0 → 2.10.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.
- package/CHANGELOG.md +25 -0
- package/dist/billing/index.cjs.map +1 -1
- package/dist/billing/index.mjs.map +1 -1
- package/dist/catalog-sync-BHD2q_KA.mjs +18 -0
- package/dist/catalog-sync-Dp2RKu2c.js +1 -0
- package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +2 -0
- package/dist/cli/utilities/build/manifest/utils/validate-conditional-availability-usage.d.ts +1 -0
- package/dist/cli/utilities/build/manifest/utils/validate-package-json-dependencies.d.ts +1 -0
- package/dist/cli/utilities/entity/entity-view-field-template.d.ts +3 -0
- package/dist/cli.cjs +93 -77
- package/dist/cli.mjs +1868 -1830
- package/dist/define/index.cjs +38 -16
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +871 -52
- package/dist/define/index.mjs +13655 -3526
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs +37 -15
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.d.ts +1 -135
- package/dist/front-component/index.mjs +12833 -3490
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/get-function-input-schema-DTlcRJz3-BweFaTLz.mjs +73 -0
- package/dist/get-function-input-schema-DTlcRJz3-DWdkAlue.js +1 -0
- package/dist/logic-function/index.cjs +37 -1
- package/dist/logic-function/index.cjs.map +1 -1
- package/dist/logic-function/index.d.ts +33 -2
- package/dist/logic-function/index.mjs +97 -28
- package/dist/logic-function/index.mjs.map +1 -1
- package/dist/{login-oauth-DSC3zo9c.mjs → login-oauth-BPSmh2dn.mjs} +15214 -4936
- package/dist/login-oauth-DnF6U1Ak.js +340 -0
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +2 -2
- package/dist/ui/index.cjs +48 -26
- package/dist/ui/index.mjs +20941 -11460
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.mjs.map +1 -1
- package/package.json +11 -9
- package/dist/catalog-sync-CanLpG9v.js +0 -1
- package/dist/catalog-sync-DyCidT5d.mjs +0 -16
- package/dist/get-function-input-schema-BZ7_XyUh-COeGJwHh.js +0 -1
- package/dist/get-function-input-schema-BZ7_XyUh-Dql7-b-j.mjs +0 -62
- package/dist/login-oauth-BESuSxoP.js +0 -298
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the [Twenty SDK](https://www.npmjs.com/package/twenty-sdk) are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [2.8.0]
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
- **`twenty-sdk` must now be a dev dependency.** It ships the `twenty` CLI and the build/scaffolding tooling, which only run at development and build time — it is never imported by a published app's runtime. Newly scaffolded apps already place it under `devDependencies`. Apps created before `2.8.0` must move it when upgrading:
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"twenty-client-sdk": "^2.8.0"
|
|
16
|
+
- "twenty-sdk": "^2.8.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
+ "twenty-sdk": "^2.8.0"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then reinstall with `rm -rf node_modules && yarn install`. `twenty-client-sdk` stays under `dependencies` because app code imports it at runtime.
|
|
24
|
+
|
|
25
|
+
`twenty build` now emits a warning when `twenty-sdk` is still listed under `dependencies`, so existing apps are flagged automatically.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["const _ = \"public\", A = \"TWENTY_API_KEY\", T = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\",
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["const _ = \"public\", A = \"TWENTY_API_KEY\", T = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", N = \"generated\", t = {\n js: `import { createRequire as __createRequire } from 'module';\nconst require = __createRequire(import.meta.url);`\n}, u = \".twenty/output\", I = \"Standard\", P = \"20202020-64aa-4b6f-b003-9c74b97cee20\";\nvar o = /* @__PURE__ */ ((e) => (e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e))(o || {});\nexport {\n _ as ASSETS_DIR,\n A as DEFAULT_API_KEY_NAME,\n T as DEFAULT_API_URL_NAME,\n r as DEFAULT_APP_ACCESS_TOKEN_NAME,\n N as GENERATED_DIR,\n t as NODE_ESM_CJS_BANNER,\n u as OUTPUT_DIR,\n o as SyncableEntity,\n I as TWENTY_STANDARD_APPLICATION_NAME,\n P as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER\n};\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst BILLING_CHARGE_TIMEOUT_MS = 5_000;\n\nexport type ChargeCreditsParams = {\n creditsUsedMicro: number;\n operationType: string;\n quantity?: number;\n resourceContext?: string;\n};\n\n// Records credit usage against the running application via the Twenty\n// server's `/app/billing/charge` endpoint. Reads `TWENTY_API_URL` and\n// `TWENTY_APP_ACCESS_TOKEN` from the execution env (injected by the\n// logic-function runtime). No-ops silently when either is missing so\n// local/test runs don't crash. Failures are non-fatal — a billing error\n// never surfaces as a tool failure.\nexport const chargeCredits = async ({\n creditsUsedMicro,\n operationType,\n quantity = 1,\n resourceContext,\n}: ChargeCreditsParams): Promise<void> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const token = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !token) {\n return;\n }\n\n try {\n const response = await fetch(\n `${apiUrl.replace(/\\/$/, '')}/app/billing/charge`,\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n creditsUsedMicro,\n quantity,\n operationType,\n resourceContext,\n }),\n signal: AbortSignal.timeout(BILLING_CHARGE_TIMEOUT_MS),\n },\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n\n console.error(\n `chargeCredits: ${response.status} ${response.statusText}: ${body}`,\n );\n }\n } catch (error) {\n console.error(\n `chargeCredits: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n"],"names":["T","r","BILLING_CHARGE_TIMEOUT_MS","chargeCredits","creditsUsedMicro","operationType","quantity","resourceContext","apiUrl","DEFAULT_API_URL_NAME","token","DEFAULT_APP_ACCESS_TOKEN_NAME","response","body","error"],"mappings":"gFAAK,MAAqCA,EAAI,iBAAkBC,EAAI,0BCK9DC,EAA4B,IAerBC,EAAgB,MAAO,CAClC,iBAAAC,EACA,cAAAC,EACA,SAAAC,EAAW,EACX,gBAAAC,CACF,IAA0C,CACxC,MAAMC,EAAS,QAAQ,IAAIC,CAAoB,EACzCC,EAAQ,QAAQ,IAAIC,CAA6B,EAEvD,GAAI,GAACH,GAAU,CAACE,GAIhB,GAAI,CACF,MAAME,EAAW,MAAM,MACrB,GAAGJ,EAAO,QAAQ,MAAO,EAAE,CAAC,sBAC5B,CACE,OAAQ,OACR,QAAS,CACP,cAAe,UAAUE,CAAK,GAC9B,eAAgB,kBAAA,EAElB,KAAM,KAAK,UAAU,CACnB,iBAAAN,EACA,SAAAE,EACA,cAAAD,EACA,gBAAAE,CAAA,CACD,EACD,OAAQ,YAAY,QAAQL,CAAyB,CAAA,CACvD,EAGF,GAAI,CAACU,EAAS,GAAI,CAChB,MAAMC,EAAO,MAAMD,EAAS,OAAO,MAAM,IAAM,EAAE,EAEjD,QAAQ,MACN,kBAAkBA,EAAS,MAAM,IAAIA,EAAS,UAAU,KAAKC,CAAI,EAAA,CAErE,CACF,OAASC,EAAO,CACd,QAAQ,MACN,kBAAkBA,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAAC,EAAA,CAE5E,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["const _ = \"public\", A = \"TWENTY_API_KEY\", T = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\",
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../twenty-shared/dist/application.mjs","../../src/sdk/billing/charge-credits.ts"],"sourcesContent":["const _ = \"public\", A = \"TWENTY_API_KEY\", T = \"TWENTY_API_URL\", r = \"TWENTY_APP_ACCESS_TOKEN\", N = \"generated\", t = {\n js: `import { createRequire as __createRequire } from 'module';\nconst require = __createRequire(import.meta.url);`\n}, u = \".twenty/output\", I = \"Standard\", P = \"20202020-64aa-4b6f-b003-9c74b97cee20\";\nvar o = /* @__PURE__ */ ((e) => (e.Object = \"object\", e.Field = \"field\", e.LogicFunction = \"logicFunction\", e.FrontComponent = \"frontComponent\", e.Role = \"role\", e.Skill = \"skill\", e.Agent = \"agent\", e.ConnectionProvider = \"connectionProvider\", e.View = \"view\", e.ViewField = \"viewField\", e.NavigationMenuItem = \"navigationMenuItem\", e.PageLayout = \"pageLayout\", e.PageLayoutTab = \"pageLayoutTab\", e.CommandMenuItem = \"commandMenuItem\", e))(o || {});\nexport {\n _ as ASSETS_DIR,\n A as DEFAULT_API_KEY_NAME,\n T as DEFAULT_API_URL_NAME,\n r as DEFAULT_APP_ACCESS_TOKEN_NAME,\n N as GENERATED_DIR,\n t as NODE_ESM_CJS_BANNER,\n u as OUTPUT_DIR,\n o as SyncableEntity,\n I as TWENTY_STANDARD_APPLICATION_NAME,\n P as TWENTY_STANDARD_APPLICATION_UNIVERSAL_IDENTIFIER\n};\n","import {\n DEFAULT_API_URL_NAME,\n DEFAULT_APP_ACCESS_TOKEN_NAME,\n} from 'twenty-shared/application';\n\nconst BILLING_CHARGE_TIMEOUT_MS = 5_000;\n\nexport type ChargeCreditsParams = {\n creditsUsedMicro: number;\n operationType: string;\n quantity?: number;\n resourceContext?: string;\n};\n\n// Records credit usage against the running application via the Twenty\n// server's `/app/billing/charge` endpoint. Reads `TWENTY_API_URL` and\n// `TWENTY_APP_ACCESS_TOKEN` from the execution env (injected by the\n// logic-function runtime). No-ops silently when either is missing so\n// local/test runs don't crash. Failures are non-fatal — a billing error\n// never surfaces as a tool failure.\nexport const chargeCredits = async ({\n creditsUsedMicro,\n operationType,\n quantity = 1,\n resourceContext,\n}: ChargeCreditsParams): Promise<void> => {\n const apiUrl = process.env[DEFAULT_API_URL_NAME];\n const token = process.env[DEFAULT_APP_ACCESS_TOKEN_NAME];\n\n if (!apiUrl || !token) {\n return;\n }\n\n try {\n const response = await fetch(\n `${apiUrl.replace(/\\/$/, '')}/app/billing/charge`,\n {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${token}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n creditsUsedMicro,\n quantity,\n operationType,\n resourceContext,\n }),\n signal: AbortSignal.timeout(BILLING_CHARGE_TIMEOUT_MS),\n },\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n\n console.error(\n `chargeCredits: ${response.status} ${response.statusText}: ${body}`,\n );\n }\n } catch (error) {\n console.error(\n `chargeCredits: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n};\n"],"names":["T","r","chargeCredits","creditsUsedMicro","operationType","quantity","resourceContext","apiUrl","DEFAULT_API_URL_NAME","token","DEFAULT_APP_ACCESS_TOKEN_NAME","response","body","error"],"mappings":"AAAK,MAAqCA,IAAI,kBAAkBC,IAAI;ACoB7D,MAAMC,IAAgB,OAAO;AAAA,EAClC,kBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,iBAAAC;AACF,MAA0C;AACxC,QAAMC,IAAS,QAAQ,IAAIC,CAAoB,GACzCC,IAAQ,QAAQ,IAAIC,CAA6B;AAEvD,MAAI,GAACH,KAAU,CAACE;AAIhB,QAAI;AACF,YAAME,IAAW,MAAM;AAAA,QACrB,GAAGJ,EAAO,QAAQ,OAAO,EAAE,CAAC;AAAA,QAC5B;AAAA,UACE,QAAQ;AAAA,UACR,SAAS;AAAA,YACP,eAAe,UAAUE,CAAK;AAAA,YAC9B,gBAAgB;AAAA,UAAA;AAAA,UAElB,MAAM,KAAK,UAAU;AAAA,YACnB,kBAAAN;AAAA,YACA,UAAAE;AAAA,YACA,eAAAD;AAAA,YACA,iBAAAE;AAAA,UAAA,CACD;AAAA,UACD,QAAQ,YAAY,QAAQ,GAAyB;AAAA,QAAA;AAAA,MACvD;AAGF,UAAI,CAACK,EAAS,IAAI;AAChB,cAAMC,IAAO,MAAMD,EAAS,OAAO,MAAM,MAAM,EAAE;AAEjD,gBAAQ;AAAA,UACN,kBAAkBA,EAAS,MAAM,IAAIA,EAAS,UAAU,KAAKC,CAAI;AAAA,QAAA;AAAA,MAErE;AAAA,IACF,SAASC,GAAO;AACd,cAAQ;AAAA,QACN,kBAAkBA,aAAiB,QAAQA,EAAM,UAAU,OAAOA,CAAK,CAAC;AAAA,MAAA;AAAA,IAE5E;AACF;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { C as c, A as t } from "./login-oauth-BPSmh2dn.mjs";
|
|
2
|
+
import r from "chalk";
|
|
3
|
+
class m {
|
|
4
|
+
async execute(o) {
|
|
5
|
+
o.remote && c.setActiveRemote(o.remote);
|
|
6
|
+
const a = c.getActiveRemote();
|
|
7
|
+
console.log(r.blue(`Syncing marketplace catalog on ${a}...`));
|
|
8
|
+
const e = await new t().syncMarketplaceCatalog();
|
|
9
|
+
e.success || (console.error(
|
|
10
|
+
r.red(
|
|
11
|
+
`Catalog sync failed: ${e.error instanceof Error ? e.error.message : String(e.error)}`
|
|
12
|
+
)
|
|
13
|
+
), process.exit(1)), console.log(r.green("✓ Marketplace catalog synced successfully"));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
m as CatalogSyncCommand
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./login-oauth-DnF6U1Ak.js"),l=require("chalk"),n=e=>e&&e.__esModule?e:{default:e},a=n(l);class s{async execute(c){c.remote&&o.ConfigService.setActiveRemote(c.remote);const r=o.ConfigService.getActiveRemote();console.log(a.default.blue(`Syncing marketplace catalog on ${r}...`));const t=await new o.ApiService().syncMarketplaceCatalog();t.success||(console.error(a.default.red(`Catalog sync failed: ${t.error instanceof Error?t.error.message:String(t.error)}`)),process.exit(1)),console.log(a.default.green("✓ Marketplace catalog synced successfully"))}}exports.CatalogSyncCommand=s;
|
|
@@ -14,6 +14,7 @@ export declare enum TargetFunction {
|
|
|
14
14
|
DefineConnectionProvider = "defineConnectionProvider",
|
|
15
15
|
DefineFrontComponent = "defineFrontComponent",
|
|
16
16
|
DefineView = "defineView",
|
|
17
|
+
DefineViewField = "defineViewField",
|
|
17
18
|
DefineNavigationMenuItem = "defineNavigationMenuItem",
|
|
18
19
|
DefinePageLayout = "definePageLayout",
|
|
19
20
|
DefinePageLayoutTab = "definePageLayoutTab",
|
|
@@ -33,6 +34,7 @@ export declare enum ManifestEntityKey {
|
|
|
33
34
|
FrontComponents = "frontComponents",
|
|
34
35
|
PublicAssets = "publicAssets",
|
|
35
36
|
Views = "views",
|
|
37
|
+
ViewFields = "viewFields",
|
|
36
38
|
NavigationMenuItems = "navigationMenuItems",
|
|
37
39
|
PageLayouts = "pageLayouts",
|
|
38
40
|
PageLayoutTabs = "pageLayoutTabs",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateConditionalAvailabilityUsage: (fileContent: string, relativePath: string) => string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validatePackageJsonDependencies: (appPath: string) => Promise<string[]>;
|