twenty-sdk 2.2.0 → 2.3.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/README.md +3 -3
- package/dist/billing/index.cjs.map +1 -1
- package/dist/billing/index.mjs +9 -9
- package/dist/billing/index.mjs.map +1 -1
- package/dist/cli/commands/add.d.ts +1 -0
- package/dist/cli/operations/deploy.d.ts +2 -0
- package/dist/cli/types.d.ts +1 -0
- package/dist/cli/utilities/build/manifest/manifest-extract-config.d.ts +6 -2
- package/dist/cli/utilities/entity/entity-command-menu-item-template.d.ts +3 -0
- package/dist/cli/utilities/entity/entity-connection-provider-template.d.ts +4 -0
- package/dist/cli/utilities/file/append-server-variables.util.d.ts +22 -0
- package/dist/cli/utilities/server/docker-container.d.ts +1 -0
- package/dist/cli.cjs +125 -83
- package/dist/cli.mjs +3150 -2979
- package/dist/define/index.cjs +12 -12
- package/dist/define/index.cjs.map +1 -1
- package/dist/define/index.d.ts +72 -20
- package/dist/define/index.mjs +889 -888
- package/dist/define/index.mjs.map +1 -1
- package/dist/front-component/index.cjs +13 -13
- package/dist/front-component/index.cjs.map +1 -1
- package/dist/front-component/index.d.ts +12 -1
- package/dist/front-component/index.mjs +866 -896
- package/dist/front-component/index.mjs.map +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-DI4AlRRA.js → get-function-input-schema-BZ7_XyUh-BXB2AcBE.js} +1 -1
- package/dist/{get-function-input-schema-BZ7_XyUh-YHOkHl_i.mjs → get-function-input-schema-BZ7_XyUh-PnCntsct.mjs} +1 -1
- package/dist/logic-function/index.cjs +1 -1
- package/dist/logic-function/index.cjs.map +1 -1
- package/dist/logic-function/index.d.ts +90 -6
- package/dist/logic-function/index.mjs +52 -1
- package/dist/logic-function/index.mjs.map +1 -1
- package/dist/operations.cjs +1 -1
- package/dist/operations.mjs +2 -2
- package/dist/ui/index.cjs +15 -2233
- package/dist/ui/index.mjs +246 -3350
- package/dist/uninstall-BiLmSWhb.js +253 -0
- package/dist/{uninstall-DXr3k3Da.mjs → uninstall-DAf2XiS3.mjs} +1825 -1715
- package/package.json +2 -2
- package/dist/uninstall-D3my_KZK.js +0 -250
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<a href="https://twenty.com">
|
|
3
3
|
<picture>
|
|
4
|
-
<img alt="Twenty logo" src="https://raw.githubusercontent.com/twentyhq/twenty/
|
|
4
|
+
<img alt="Twenty logo" src="https://raw.githubusercontent.com/twentyhq/twenty/main/packages/twenty-website-new/public/images/core/logo.svg" height="128">
|
|
5
5
|
</picture>
|
|
6
6
|
</a>
|
|
7
7
|
<h1>Twenty SDK</h1>
|
|
@@ -19,8 +19,8 @@ A CLI and SDK to develop, build, and publish applications that extend [Twenty CR
|
|
|
19
19
|
The recommended way to start is with [create-twenty-app](https://www.npmjs.com/package/create-twenty-app):
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npx create-twenty-app@latest my-app
|
|
23
|
-
cd my-app
|
|
22
|
+
npx create-twenty-app@latest my-twenty-app
|
|
23
|
+
cd my-twenty-app
|
|
24
24
|
yarn twenty dev
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -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\",
|
|
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\", t = \"generated\", N = {\n js: `import { createRequire as __createRequire } from 'module';\nconst require = __createRequire(import.meta.url);`\n}, u = \".twenty/output\", I = \"Standard\", n = \"20202020-64aa-4b6f-b003-9c74b97cee20\";\nvar e = /* @__PURE__ */ ((o) => (o.Object = \"object\", o.Field = \"field\", o.LogicFunction = \"logicFunction\", o.FrontComponent = \"frontComponent\", o.Role = \"role\", o.Skill = \"skill\", o.Agent = \"agent\", o.ConnectionProvider = \"connectionProvider\", o.View = \"view\", o.NavigationMenuItem = \"navigationMenuItem\", o.PageLayout = \"pageLayout\", o.PageLayoutTab = \"pageLayoutTab\", o.CommandMenuItem = \"commandMenuItem\", o))(e || {});\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 t as GENERATED_DIR,\n N as NODE_ESM_CJS_BANNER,\n u as OUTPUT_DIR,\n e as SyncableEntity,\n I as TWENTY_STANDARD_APPLICATION_NAME,\n n 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"}
|
package/dist/billing/index.mjs
CHANGED
|
@@ -5,11 +5,11 @@ const p = async ({
|
|
|
5
5
|
quantity: n = 1,
|
|
6
6
|
resourceContext: a
|
|
7
7
|
}) => {
|
|
8
|
-
const
|
|
9
|
-
if (!(!
|
|
8
|
+
const t = process.env[i], r = process.env[T];
|
|
9
|
+
if (!(!t || !r))
|
|
10
10
|
try {
|
|
11
|
-
const
|
|
12
|
-
`${
|
|
11
|
+
const e = await fetch(
|
|
12
|
+
`${t.replace(/\/$/, "")}/app/billing/charge`,
|
|
13
13
|
{
|
|
14
14
|
method: "POST",
|
|
15
15
|
headers: {
|
|
@@ -25,15 +25,15 @@ const p = async ({
|
|
|
25
25
|
signal: AbortSignal.timeout(5e3)
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
|
-
if (!
|
|
29
|
-
const c = await
|
|
28
|
+
if (!e.ok) {
|
|
29
|
+
const c = await e.text().catch(() => "");
|
|
30
30
|
console.error(
|
|
31
|
-
`chargeCredits: ${
|
|
31
|
+
`chargeCredits: ${e.status} ${e.statusText}: ${c}`
|
|
32
32
|
);
|
|
33
33
|
}
|
|
34
|
-
} catch (
|
|
34
|
+
} catch (e) {
|
|
35
35
|
console.error(
|
|
36
|
-
`chargeCredits: ${
|
|
36
|
+
`chargeCredits: ${e instanceof Error ? e.message : String(e)}`
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
@@ -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\",
|
|
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\", t = \"generated\", N = {\n js: `import { createRequire as __createRequire } from 'module';\nconst require = __createRequire(import.meta.url);`\n}, u = \".twenty/output\", I = \"Standard\", n = \"20202020-64aa-4b6f-b003-9c74b97cee20\";\nvar e = /* @__PURE__ */ ((o) => (o.Object = \"object\", o.Field = \"field\", o.LogicFunction = \"logicFunction\", o.FrontComponent = \"frontComponent\", o.Role = \"role\", o.Skill = \"skill\", o.Agent = \"agent\", o.ConnectionProvider = \"connectionProvider\", o.View = \"view\", o.NavigationMenuItem = \"navigationMenuItem\", o.PageLayout = \"pageLayout\", o.PageLayoutTab = \"pageLayoutTab\", o.CommandMenuItem = \"commandMenuItem\", o))(e || {});\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 t as GENERATED_DIR,\n N as NODE_ESM_CJS_BANNER,\n u as OUTPUT_DIR,\n e as SyncableEntity,\n I as TWENTY_STANDARD_APPLICATION_NAME,\n n 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;"}
|
|
@@ -6,6 +6,7 @@ export declare class EntityAddCommand {
|
|
|
6
6
|
execute(entityType?: SyncableEntity, path?: string): Promise<void>;
|
|
7
7
|
private getEntityData;
|
|
8
8
|
private promptAndCreateObjectCompanions;
|
|
9
|
+
private registerConnectionProviderServerVariables;
|
|
9
10
|
private buildRecordPageFieldsViewFields;
|
|
10
11
|
private getEntity;
|
|
11
12
|
private handleFileExist;
|
|
@@ -7,6 +7,8 @@ export type AppDeployOptions = {
|
|
|
7
7
|
onProgress?: (message: string) => void;
|
|
8
8
|
};
|
|
9
9
|
export type AppDeployResult = {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
10
12
|
universalIdentifier: string;
|
|
11
13
|
};
|
|
12
14
|
export declare const appDeploy: (options: AppDeployOptions) => Promise<CommandResult<AppDeployResult>>;
|
package/dist/cli/types.d.ts
CHANGED
|
@@ -8,11 +8,13 @@ export declare enum TargetFunction {
|
|
|
8
8
|
DefineRole = "defineRole",
|
|
9
9
|
DefineSkill = "defineSkill",
|
|
10
10
|
DefineAgent = "defineAgent",
|
|
11
|
+
DefineConnectionProvider = "defineConnectionProvider",
|
|
11
12
|
DefineFrontComponent = "defineFrontComponent",
|
|
12
13
|
DefineView = "defineView",
|
|
13
14
|
DefineNavigationMenuItem = "defineNavigationMenuItem",
|
|
14
15
|
DefinePageLayout = "definePageLayout",
|
|
15
|
-
DefinePageLayoutTab = "definePageLayoutTab"
|
|
16
|
+
DefinePageLayoutTab = "definePageLayoutTab",
|
|
17
|
+
DefineCommandMenuItem = "defineCommandMenuItem"
|
|
16
18
|
}
|
|
17
19
|
export declare enum ManifestEntityKey {
|
|
18
20
|
Application = "application",
|
|
@@ -22,12 +24,14 @@ export declare enum ManifestEntityKey {
|
|
|
22
24
|
Roles = "roles",
|
|
23
25
|
Skills = "skills",
|
|
24
26
|
Agents = "agents",
|
|
27
|
+
ConnectionProviders = "connectionProviders",
|
|
25
28
|
FrontComponents = "frontComponents",
|
|
26
29
|
PublicAssets = "publicAssets",
|
|
27
30
|
Views = "views",
|
|
28
31
|
NavigationMenuItems = "navigationMenuItems",
|
|
29
32
|
PageLayouts = "pageLayouts",
|
|
30
|
-
PageLayoutTabs = "pageLayoutTabs"
|
|
33
|
+
PageLayoutTabs = "pageLayoutTabs",
|
|
34
|
+
CommandMenuItems = "commandMenuItems"
|
|
31
35
|
}
|
|
32
36
|
export type EntityFilePaths = Record<ManifestEntityKey, string[]>;
|
|
33
37
|
export declare const TARGET_FUNCTION_TO_ENTITY_KEY_MAPPING: Record<TargetFunction, ManifestEntityKey>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ServerVariableSpec = {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
isSecret: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type AppendResult = {
|
|
7
|
+
status: 'appended';
|
|
8
|
+
file: string;
|
|
9
|
+
} | {
|
|
10
|
+
status: 'created';
|
|
11
|
+
file: string;
|
|
12
|
+
} | {
|
|
13
|
+
status: 'skipped-existing';
|
|
14
|
+
} | {
|
|
15
|
+
status: 'skipped-no-config';
|
|
16
|
+
} | {
|
|
17
|
+
status: 'skipped-no-app-call';
|
|
18
|
+
};
|
|
19
|
+
export declare const appendServerVariablesToAppConfig: ({ projectRoot, variables, }: {
|
|
20
|
+
projectRoot: string;
|
|
21
|
+
variables: ServerVariableSpec[];
|
|
22
|
+
}) => Promise<AppendResult>;
|
|
@@ -11,3 +11,4 @@ export declare const getContainerDigest: (containerName?: string) => string | nu
|
|
|
11
11
|
export declare const getImageDigest: (image: string) => string | null;
|
|
12
12
|
export declare const getContainerEnvVar: (envVar: string, containerName?: string) => string | null;
|
|
13
13
|
export declare const checkDockerRunning: () => boolean;
|
|
14
|
+
export declare const getDockerNotRunningMessage: (retryCommand: string) => string;
|