Skip to content

Commit

Permalink
Using platform api (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
imsitnikov authored Jan 22, 2024
1 parent 40a2fe2 commit 8fe0a14
Show file tree
Hide file tree
Showing 14 changed files with 196 additions and 0 deletions.
19 changes: 19 additions & 0 deletions api/components.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export {getGatewayConfig} from '../src/components/gateway';

export {
default as compileSchema,
makeSchemaValidator,
KEY_REG,
} from '../src/components/validation-schema-compiler';

export {OrganizationPermission, ProjectPermission} from '../src/components/iam';

export {default as prepareResponse} from '../src/components/response-presenter';
export {default as prepareErrorResponse} from '../src/components/error-response-presenter';

export {isEnabledFeature, Feature} from '../src/components/features';
export type {FeaturesConfig} from '../src/components/features/types';

export {isGatewayError} from '../src/components/gateway';

export {resolvePrivatePermissions} from '../src/components/private-permissions';
18 changes: 18 additions & 0 deletions api/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export {
AppEnv,
BiTrackingLogs,
US_MASTER_TOKEN_HEADER,
DL_COMPONENT_HEADER,
ERROR_BY_DLS_STATUS_CODE,
SYSTEM_USER,
ORG_TENANT_PREFIX,
AJV_PATTERN_KEYS_NOT_OBJECT,
US_ERRORS,
CURRENT_TIMESTAMP,
DEFAULT_QUERY_TIMEOUT,
ALL_COLUMNS,
RETURN_COLUMNS,
RETURN_META_COLUMNS,
RETURN_FAVORITES_COLUMNS,
RETURN_NAVIGATION_COLUMNS,
} from '../src/const';
2 changes: 2 additions & 0 deletions api/controllers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {default as entriesController} from '../src/controllers/entries';
export {default as statesController} from '../src/controllers/states';
69 changes: 69 additions & 0 deletions api/db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
export {getId, Model} from '../src/db';

export {default as LegacyEntry} from '../src/db/models/entry';
export {default as LegacyRevision} from '../src/db/models/revision';
export {default as LegacyFavorite} from '../src/db/models/favorite';
export {default as LegacyNavigation} from '../src/db/models/navigation';
export {default as LegacyTemplate} from '../src/db/models/template';
export {default as LegacyTenant} from '../src/db/models/tenant';

export {Entry, EntryColumn} from '../src/db/models/new/entry';
export {EntryScope, EntryType} from '../src/db/models/new/entry/types';
export {
RevisionModel,
RevisionModelColumn,
RevisionModelColumnRaw,
} from '../src/db/models/new/revision';

export {Tenant, TenantColumn} from '../src/db/models/new/tenant';
export {MigrationTenant, MigrationTenantColumn} from '../src/db/models/new/migration-tenant';

export {WorkbookModel, WorkbookModelColumn} from '../src/db/models/new/workbook';
export {CollectionModel, CollectionModelColumn} from '../src/db/models/new/collection';

export {State} from '../src/db/models/new/state';
export {Template} from '../src/db/models/new/template';
export {Preset} from '../src/db/models/new/preset';
export {Link} from '../src/db/models/new/link';
export {Lock} from '../src/db/models/new/lock';
export {Favorite} from '../src/db/models/new/favorite';
export {UserSettings} from '../src/db/models/new/user-settings';
export {Comment, CommentType} from '../src/db/models/new/comment';

export {EmbedModel, EmbedModelColumn} from '../src/db/models/new/embed';
export {
EmbeddingSecretModel,
EmbeddingSecretModelColumn,
} from '../src/db/models/new/embedding-secret';

export {ColorPaletteModel, ColorPaletteModelColumn} from '../src/db/models/new/color-palette';

export {
OperationModel,
OperationModelColumn,
OperationModelColumnRaw,
OperationStatus,
} from '../src/db/models/new/operation';

export {
JoinedEntryRevision,
JoinRevisionArgs,
joinRevision,
JoinedEntryRevisionColumns,
} from '../src/db/presentations/joined-entry-revision';
export {
JoinedEntryRevisionFavorite,
JoinedEntryRevisionFavoriteColumns,
} from '../src/db/presentations/joined-entry-revision-favorite';
export {
JoinMigrationTenantArgs,
JoinedMigrationTenant,
JoinedMigrationTenantColumn,
joinMigrationTenant,
LeftJoinedMigrationTenantColumns,
} from '../src/db/presentations/joined-migration-tenant';
export {JoinedEntryMigrationTenant} from '../src/db/presentations/joined-entry-migration-tenant';
export {
JoinedEmbedEmbeddingSecret,
JoinedEmbedEmbeddingSecretColumns,
} from '../src/db/presentations/joined-embed-embedding-secret';
10 changes: 10 additions & 0 deletions api/entities.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export {
CollectionPermission,
CollectionRole,
Permissions as CollectionPermissions,
} from '../src/entities/collection';
export {
WorkbookPermission,
WorkbookRole,
Permissions as WorkbookPermissions,
} from '../src/entities/workbook';
1 change: 1 addition & 0 deletions api/init-db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {initDB} from '../src/db/init-db';
9 changes: 9 additions & 0 deletions api/middlewares.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export {
decodeId,
waitDatabase,
setCiEnv,
dlContext,
finalRequestHandler,
checkReadOnlyMode,
resolveWorkbookId,
} from '../src/components/middlewares';
1 change: 1 addition & 0 deletions api/registry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {registry} from '../src/registry';
1 change: 1 addition & 0 deletions api/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {getRoutes, GetRoutesOptions, ExtendedAppRouteDescription} from '../src/routes';
28 changes: 28 additions & 0 deletions api/services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export {ServiceArgs, CountAggregation} from '../src/services/new/types';
export {getPrimary, getReplica} from '../src/services/new/utils';

export {checkEntry} from '../src/services/entry/actions/check-entry';
export {getRelatedEntries} from '../src/services/entry/actions/get-related-entries';

export {getCollection} from '../src/services/new/collection/get-collection';
export {getParentIds} from '../src/services/new/collection/utils/get-parents';
export {getWorkbook} from '../src/services/new/workbook/get-workbook';
export {checkWorkbookPermission} from '../src/services/new/workbook/utils/check-workbook-permission';
export {copyEntriesToWorkbook} from '../src/services/new/entry';

export {formatOperation} from '../src/services/new/formatters';

export {
deleteEntry,
updateEntry,
getEntryByKey as legacyGetEntryByKey,
GetEntryByKeyData,
getLegacyEntryRevisions,
} from '../src/services/entry';

export {default as EntryService} from '../src/services/entry.service';
export {default as NavigationService} from '../src/services/navigation.service';

export {getEntryByKey, GetEntryByKeyArgs} from '../src/services/new/entry';
export {getEntriesByKeyPattern} from '../src/services/entry';
export {formatGetEntryByKeyResponse} from '../src/services/new/entry/formatters';
1 change: 1 addition & 0 deletions api/tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {testTenantId} from '../src/tests/int/constants';
25 changes: 25 additions & 0 deletions api/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export {UserCtxInfo, CtxInfo} from '../src/types/ctx';
export {CTX} from '../src/types/models/core';

export type {DlsPermissionsMode} from '../src/types/models/dls';

export * as MT from '../src/types/models';
export {
DlsActions,
UsPermission,
UsPermissions,
DlsEntity,
EntriesFilters,
EntriesOrderByFilter,
PaginationEntriesResponse,
EntryType,
EntryColumns,
RevisionColumns,
CountAggregation,
DlsPermissionSubject,
EntryScope,
} from '../src/types/models';

export * as ST from '../src/types/services.types';

export {EmbeddingToken} from '../src/types/embedding';
12 changes: 12 additions & 0 deletions api/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export {
default as Utils,
logInfo,
makeUserId,
isTenantIdWithOrgId,
getOrgIdFromTenantId,
makeTenantIdFromOrgId,
} from '../src/utils';

export {normalizedEnv} from '../src/utils/normalized-env';

export {default as axiosInstance} from '../src/utils/axios';
Empty file removed src/entities/types.ts
Empty file.

0 comments on commit 8fe0a14

Please sign in to comment.