twenty-sdk 0.1.3 → 0.2.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 (28) hide show
  1. package/dist/application/application-config.d.ts +2 -13
  2. package/dist/application/fields/field.decorator.d.ts +3 -0
  3. package/dist/application/function-config.d.ts +3 -19
  4. package/dist/application/index.d.ts +10 -8
  5. package/dist/application/objects/object.decorator.d.ts +4 -0
  6. package/dist/application/permission-flag-type.d.ts +1 -0
  7. package/dist/application/role-config.d.ts +2 -0
  8. package/dist/cli/commands/app-sync.command.d.ts +1 -1
  9. package/dist/cli/commands/app-uninstall.command.d.ts +1 -1
  10. package/dist/cli/services/api.service.d.ts +3 -2
  11. package/dist/cli/services/config.service.d.ts +4 -1
  12. package/dist/cli/services/generate.service.d.ts +1 -0
  13. package/dist/cli/types/api-response.types.d.ts +12 -0
  14. package/dist/cli/utils/load-manifest.d.ts +3 -2
  15. package/dist/cli.cjs +78 -39
  16. package/dist/cli.mjs +1513 -1454
  17. package/dist/index.cjs +12 -39
  18. package/dist/index.mjs +2749 -16950
  19. package/package.json +1 -1
  20. package/dist/application/field-metadata/field.decorator.d.ts +0 -14
  21. package/dist/application/object-metadata/object.decorator.d.ts +0 -11
  22. package/dist/cli/types/config.types.d.ts +0 -99
  23. /package/dist/application/{field-metadata → fields}/composite-fields.d.ts +0 -0
  24. /package/dist/application/{field-metadata → fields}/field-type.d.ts +0 -0
  25. /package/dist/application/{field-metadata → fields}/on-delete-action.d.ts +0 -0
  26. /package/dist/application/{field-metadata → fields}/relation-type.d.ts +0 -0
  27. /package/dist/application/{field-metadata → fields}/relation.decorator.d.ts +0 -0
  28. /package/dist/application/{object-metadata → objects}/standard-object-ids.d.ts +0 -0
@@ -1,13 +1,2 @@
1
- import { SyncableEntityOptions } from './syncable-entity-options.type';
2
- type ApplicationVariable = SyncableEntityOptions & {
3
- value?: string;
4
- description?: string;
5
- isSecret?: boolean;
6
- };
7
- export type ApplicationConfig = SyncableEntityOptions & {
8
- displayName?: string;
9
- description?: string;
10
- icon?: string;
11
- applicationVariables?: Record<string, ApplicationVariable>;
12
- };
13
- export {};
1
+ import { Application } from 'twenty-shared/application';
2
+ export type ApplicationConfig = Application;
@@ -0,0 +1,3 @@
1
+ import { FieldMetadataType } from 'twenty-shared/types';
2
+ import { FieldManifest } from 'twenty-shared/application';
3
+ export declare const Field: <T extends FieldMetadataType>(_: FieldManifest<T>) => PropertyDecorator;
@@ -1,23 +1,7 @@
1
- import { SyncableEntityOptions } from './syncable-entity-options.type';
2
- type RouteTrigger = {
3
- type: 'route';
4
- path: string;
5
- httpMethod: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
6
- isAuthRequired: boolean;
7
- };
8
- type CronTrigger = {
9
- type: 'cron';
10
- pattern: string;
11
- };
12
- type DatabaseEventTrigger = {
13
- type: 'databaseEvent';
14
- eventName: string;
15
- };
16
- type FunctionTrigger = SyncableEntityOptions & (RouteTrigger | CronTrigger | DatabaseEventTrigger);
17
- export type FunctionConfig = SyncableEntityOptions & {
1
+ import { ServerlessFunctionManifest, ServerlessFunctionTriggerManifest } from 'twenty-shared/application';
2
+ export type FunctionConfig = Omit<ServerlessFunctionManifest, 'handlerPath' | 'handlerName'> & {
18
3
  name?: string;
19
4
  description?: string;
20
5
  timeoutSeconds?: number;
21
- triggers?: FunctionTrigger[];
6
+ triggers?: ServerlessFunctionTriggerManifest[];
22
7
  };
23
- export {};
@@ -1,11 +1,13 @@
1
1
  export type { ApplicationConfig } from './application-config';
2
- export type { ActorField, AddressField, CurrencyField, EmailsField, FullNameField, LinksField, PhonesField, RichTextField, } from './field-metadata/composite-fields';
3
- export { FieldType } from './field-metadata/field-type';
4
- export { Field } from './field-metadata/field.decorator';
5
- export { OnDeleteAction } from './field-metadata/on-delete-action';
6
- export { RelationType } from './field-metadata/relation-type';
7
- export { Relation } from './field-metadata/relation.decorator';
2
+ export type { ActorField, AddressField, CurrencyField, EmailsField, FullNameField, LinksField, PhonesField, RichTextField, } from './fields/composite-fields';
3
+ export { FieldType } from './fields/field-type';
4
+ export { Field } from './fields/field.decorator';
5
+ export { OnDeleteAction } from './fields/on-delete-action';
6
+ export { RelationType } from './fields/relation-type';
7
+ export { Relation } from './fields/relation.decorator';
8
8
  export type { FunctionConfig } from './function-config';
9
- export { Object } from './object-metadata/object.decorator';
10
- export { STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS } from './object-metadata/standard-object-ids';
9
+ export { Object } from './objects/object.decorator';
10
+ export { STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS } from './objects/standard-object-ids';
11
+ export { PermissionFlag } from './permission-flag-type';
12
+ export type { RoleConfig } from './role-config';
11
13
  export type { SyncableEntityOptions } from './syncable-entity-options.type';
@@ -0,0 +1,4 @@
1
+ import { ObjectManifest } from 'twenty-shared/application';
2
+ type ObjectMetadataOptions = Omit<ObjectManifest, 'fields'>;
3
+ export declare const Object: (_: ObjectMetadataOptions) => ClassDecorator;
4
+ export {};
@@ -0,0 +1 @@
1
+ export { PermissionFlagType as PermissionFlag } from 'twenty-shared/constants';
@@ -0,0 +1,2 @@
1
+ import { RoleManifest } from 'twenty-shared/application';
2
+ export type RoleConfig = RoleManifest;
@@ -1,4 +1,4 @@
1
- import { ApiResponse } from '../types/config.types';
1
+ import { ApiResponse } from '../types/api-response.types';
2
2
  export declare class AppSyncCommand {
3
3
  private apiService;
4
4
  private generateService;
@@ -1,4 +1,4 @@
1
- import { ApiResponse } from '../types/config.types';
1
+ import { ApiResponse } from '../types/api-response.types';
2
2
  export declare class AppUninstallCommand {
3
3
  private apiService;
4
4
  execute({ appPath, askForConfirmation, }: {
@@ -1,4 +1,5 @@
1
- import { ApiResponse, AppManifest, PackageJson } from '../types/config.types';
1
+ import { ApiResponse } from '../types/api-response.types';
2
+ import { PackageJson, ApplicationManifest } from 'twenty-shared/application';
2
3
  export declare class ApiService {
3
4
  private client;
4
5
  private configService;
@@ -7,7 +8,7 @@ export declare class ApiService {
7
8
  syncApplication({ packageJson, yarnLock, manifest, }: {
8
9
  packageJson: PackageJson;
9
10
  yarnLock: string;
10
- manifest: AppManifest;
11
+ manifest: ApplicationManifest;
11
12
  }): Promise<ApiResponse>;
12
13
  uninstallApplication(universalIdentifier: string): Promise<ApiResponse>;
13
14
  getSchema(): Promise<ApiResponse<string>>;
@@ -1,4 +1,7 @@
1
- import { TwentyConfig } from '../types/config.types';
1
+ export type TwentyConfig = {
2
+ apiUrl: string;
3
+ apiKey?: string;
4
+ };
2
5
  export declare class ConfigService {
3
6
  private readonly configPath;
4
7
  private static activeWorkspace;
@@ -4,4 +4,5 @@ export declare class GenerateService {
4
4
  private apiService;
5
5
  constructor();
6
6
  generateClient(appPath: string): Promise<void>;
7
+ private injectTwentyClient;
7
8
  }
@@ -0,0 +1,12 @@
1
+ type SuccessfulApiResponse<T = unknown> = {
2
+ success: true;
3
+ data: T;
4
+ message?: string;
5
+ };
6
+ type FailingApiResponse = {
7
+ success: false;
8
+ error?: unknown;
9
+ message?: string;
10
+ };
11
+ export type ApiResponse<T = unknown> = SuccessfulApiResponse<T> | FailingApiResponse;
12
+ export {};
@@ -1,9 +1,10 @@
1
1
  import { Program } from 'typescript';
2
- import { AppManifest, Application, PackageJson } from '../types/config.types';
2
+ import { Application, PackageJson, ApplicationManifest, RoleManifest } from 'twenty-shared/application';
3
3
  export declare const extractTwentyAppConfig: (program: Program) => Application;
4
+ export declare const collectRoles: (program: Program) => Array<RoleManifest>;
4
5
  export declare const loadManifest: (appPath: string) => Promise<{
5
6
  packageJson: PackageJson;
6
7
  yarnLock: string;
7
- manifest: AppManifest;
8
+ manifest: ApplicationManifest;
8
9
  shouldGenerate: boolean;
9
10
  }>;