@anchrd/colab-sdk 0.0.0-stage → 0.1.1
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 +65 -2
- package/dist/actions/actions.d.ts +810 -0
- package/dist/actions/actions.js +177 -0
- package/dist/admin-mode.d.ts +2 -0
- package/dist/admin-mode.js +5 -0
- package/dist/apps/apps.d.ts +108 -0
- package/dist/apps/apps.js +73 -0
- package/dist/archive/archive.d.ts +25 -0
- package/dist/archive/archive.js +27 -0
- package/dist/auth/auth.d.ts +27 -0
- package/dist/auth/auth.js +22 -0
- package/dist/authorization/authorization.d.ts +36 -0
- package/dist/authorization/authorization.js +23 -0
- package/dist/boards/boards.d.ts +612 -0
- package/dist/boards/boards.js +289 -0
- package/dist/columns/columns.d.ts +28 -0
- package/dist/columns/columns.js +28 -0
- package/dist/connections/connections.d.ts +149 -0
- package/dist/connections/connections.js +74 -0
- package/dist/connectors/connectors.d.ts +148 -0
- package/dist/connectors/connectors.js +83 -0
- package/dist/dashboards/dashboards.d.ts +221 -0
- package/dist/dashboards/dashboards.js +520 -0
- package/dist/directory/directory.d.ts +20 -0
- package/dist/directory/directory.js +18 -0
- package/dist/documents/documents.d.ts +61 -0
- package/dist/documents/documents.js +58 -0
- package/dist/error/error.d.ts +34 -0
- package/dist/error/error.js +30 -0
- package/dist/events/events.d.ts +104 -0
- package/dist/events/events.js +69 -0
- package/dist/files/files.d.ts +60 -0
- package/dist/files/files.js +139 -0
- package/dist/functions/functions.d.ts +26 -0
- package/dist/functions/functions.js +28 -0
- package/dist/grammar/grammar.d.ts +62 -0
- package/dist/grammar/grammar.js +197 -0
- package/dist/grants/grants.d.ts +93 -0
- package/dist/grants/grants.js +66 -0
- package/dist/ids/ids.d.ts +5 -0
- package/dist/ids/ids.js +12 -0
- package/dist/instructions/instructions.d.ts +19 -0
- package/dist/instructions/instructions.js +35 -0
- package/dist/interfaces/interfaces.d.ts +41 -0
- package/dist/interfaces/interfaces.js +52 -0
- package/dist/invitations/invitations.d.ts +98 -0
- package/dist/invitations/invitations.js +58 -0
- package/dist/links/links.d.ts +76 -0
- package/dist/links/links.js +73 -0
- package/dist/list-input.d.ts +3 -0
- package/dist/list-input.js +11 -0
- package/dist/machines/machines.d.ts +69 -0
- package/dist/machines/machines.js +39 -0
- package/dist/messages/messages.d.ts +117 -0
- package/dist/messages/messages.js +77 -0
- package/dist/nodes/nodes.d.ts +673 -0
- package/dist/nodes/nodes.js +354 -0
- package/dist/operators/operators.d.ts +898 -0
- package/dist/operators/operators.js +398 -0
- package/dist/pages/pages.d.ts +89 -0
- package/dist/pages/pages.js +62 -0
- package/dist/primitives/primitives.d.ts +5 -0
- package/dist/primitives/primitives.js +19 -0
- package/dist/profile/profile.d.ts +37 -0
- package/dist/profile/profile.js +43 -0
- package/dist/roles/roles.d.ts +135 -0
- package/dist/roles/roles.js +87 -0
- package/dist/runs/runs.d.ts +244 -0
- package/dist/runs/runs.js +137 -0
- package/dist/runtime-config.d.ts +12 -0
- package/dist/runtime-config.js +18 -0
- package/dist/sdk.d.ts +45 -0
- package/dist/sdk.js +48 -0
- package/dist/secrets/secrets.d.ts +65 -0
- package/dist/secrets/secrets.js +57 -0
- package/dist/service-client/service-client.d.ts +35 -0
- package/dist/service-client/service-client.js +90 -0
- package/dist/services/services.d.ts +122 -0
- package/dist/services/services.js +89 -0
- package/dist/sso/sso.d.ts +70 -0
- package/dist/sso/sso.js +54 -0
- package/dist/tables/tables.d.ts +133 -0
- package/dist/tables/tables.js +131 -0
- package/dist/tool.d.ts +31 -0
- package/dist/tool.js +4 -0
- package/dist/user-settings/user-settings.d.ts +44 -0
- package/dist/user-settings/user-settings.js +44 -0
- package/dist/users/users.d.ts +254 -0
- package/dist/users/users.js +125 -0
- package/dist/validation/validation.d.ts +106 -0
- package/dist/validation/validation.js +41 -0
- package/dist/versions/versions.d.ts +100 -0
- package/dist/versions/versions.js +70 -0
- package/package.json +27 -4
package/dist/sdk.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export { ActionChat, ActionItem, ActionList, ActionListInput, ActionNotice, ActionNoticeButton, ActionNoticeCrumb, ActionNoticeItem, ActionNoticeKind, ActionNoticeReason, ActionNoticeTitle, ActionProcess, ActionRow, ActionRun, ActionSection, ActionTask, actionFilters, isNodeRow, } from "./actions/actions.js";
|
|
2
|
+
export { adminModeHeader, adminModeOn } from "./admin-mode.js";
|
|
3
|
+
export { App, AppId, AppList, AppListInput, AppRevoked, AppRevokeInput, OwnAppListQuery, OwnSessionListQuery, Session, SessionId, SessionList, SessionListInput, SessionRevokeInput, SessionsRevoked, } from "./apps/apps.js";
|
|
4
|
+
export { NodeArchived, NodeArchiveInput, NodePurged, NodePurgeInput, NodeRestoreInput, } from "./archive/archive.js";
|
|
5
|
+
export { PasskeyDeleteInput, SetPasswordInput, SignUpInput, } from "./auth/auth.js";
|
|
6
|
+
export { AuthorizationRequest, AuthorizationResponse, Identity, Rules, } from "./authorization/authorization.js";
|
|
7
|
+
export { BoardColumn, BoardCreateInput, BoardDetail, BoardGetInput, BoardId, BoardKind, BoardLabel, BoardTaskCreateInput, BoardTaskItem, BoardTaskList, BoardTaskListInput, BoardUpdateInput, boardKinds, LabelId, ProcessCheck, TaskDetail, TaskGetInput, TaskId, TaskImage, TaskUpdateInput, } from "./boards/boards.js";
|
|
8
|
+
export { ColumnId, ColumnType, columnTypes, TaskColumn } from "./columns/columns.js";
|
|
9
|
+
export { Connection, ConnectionCreateInput, ConnectionCredential, ConnectionDetail, ConnectionGetInput, ConnectionId, ConnectionList, ConnectionListInput, ConnectionRevokeInput, ConnectionState, ConnectionTested, ConnectionTestInput, ConnectionTestResult, ConnectionUpdateInput, } from "./connections/connections.js";
|
|
10
|
+
export { Call, CallId, CallList, CallListInput, CallSource, Connector, ConnectorField, ConnectorGetInput, ConnectorId, ConnectorList, ConnectorListInput, ConnectorTool, } from "./connectors/connectors.js";
|
|
11
|
+
export { type BoxType, boxTypes, chartTypes, type DashboardBox, DashboardConfig, DashboardCreateInput, DashboardDetail, DashboardGetInput, DashboardId, DashboardKey, DashboardRun, DashboardUpdateInput, rhythms, Schedule, WhileOpen, weekdays, whileOpenModes, } from "./dashboards/dashboards.js";
|
|
12
|
+
export { DirectoryPrincipal, DirectorySearchInput } from "./directory/directory.js";
|
|
13
|
+
export { DocumentCreateInput, DocumentDetail, DocumentGetInput, DocumentUpdateInput, } from "./documents/documents.js";
|
|
14
|
+
export { ErrorCode, ErrorIssue, ErrorResponse, errorCodes } from "./error/error.js";
|
|
15
|
+
export { ActorKind, Event, EventId, EventKind, EventList, EventListInput, } from "./events/events.js";
|
|
16
|
+
export { FileCreateInput, FileDetail, type FileFormat, FileGetInput, FileId, FileUpdateInput, FileUpload, fileFormatExtensions, fileFormatOf, maxFileBytes, UploadTicket, uploadTicketHeader, uploadTicketLifetimeMs, } from "./files/files.js";
|
|
17
|
+
export { FunctionRemoved, ServiceInterfaceFunctionCreateInput, ServiceInterfaceFunctionRemoveInput, ServiceInterfaceFunctionUpdateInput, } from "./functions/functions.js";
|
|
18
|
+
export { type Action, actions, hasRoute, isAction, isPackage, isWord, type Package, packages, parseConnectorFunction, parseToolName, type Resource, type Route, resources, type ToolName, toolEvent, toolPermission, toolRoute, toolSchemaName, verbs, } from "./grammar/grammar.js";
|
|
19
|
+
export { GrantId, GrantRight, NodeGrant, NodeGrantList, NodeGrantListInput, NodeGrantRevoked, NodeGrantRevokeInput, NodeShared, NodeShareInput, } from "./grants/grants.js";
|
|
20
|
+
export { createId, type Id, idSchema } from "./ids/ids.js";
|
|
21
|
+
export { Instructions, InstructionsLink, instructionsNames, isInstructionsName, validationSection, } from "./instructions/instructions.js";
|
|
22
|
+
export { FunctionNames, InterfaceRemoved, ServiceInterfaceCreateInput, ServiceInterfaceDeclared, ServiceInterfaceDeclareInput, ServiceInterfaceRemoveInput, ServiceInterfaceUndeclared, ServiceInterfaceUpdateInput, } from "./interfaces/interfaces.js";
|
|
23
|
+
export { Delivery, Invitation, InvitationAcceptInput, InvitationCreateInput, InvitationId, InvitationLookup, InvitationLookupQuery, InvitationResendInput, InvitationRevokeInput, InvitationSent, InvitationSocialInput, InvitationStatus, RoleChip, } from "./invitations/invitations.js";
|
|
24
|
+
export { defaultLinkDays, LinkId, LinkStatus, maxLinkDays, NodeLink, NodeLinkCreateInput, NodeLinkList, NodeLinkListInput, NodeLinkRevokeInput, NodeLinkUpdateInput, publicLinkPath, } from "./links/links.js";
|
|
25
|
+
export { Flag, Limit } from "./list-input.js";
|
|
26
|
+
export { MachineArchiveInput, MachineCreateInput, MachineId, MachineKey, MachinePurged, MachinePurgeInput, MachineRestoreInput, MachineRotateInput, MachineUpdateInput, } from "./machines/machines.js";
|
|
27
|
+
export { ChatRead, ChatUpdateInput, Message, MessageAuthor, MessageCreateInput, MessageId, MessageList, MessageListInput, messageMaxLength, } from "./messages/messages.js";
|
|
28
|
+
export { BoardShownKind, BoardSystem, FolderCreated, FolderCreateInput, IntelligenceUser, IntelligenceUserList, IntelligenceUserListInput, NodeDetail, NodeGetInput, NodeHit, NodeHitFoundIn, NodeHitGroup, NodeId, NodeKind, NodeList, NodeListInput, NodeListItem, NodeMoved, NodeMoveInput, NodePath, NodePerson, NodeQuery, NodeReader, NodeSearch, NodeSection, NodeSort, NodeUpdateInput, NodeValidation, nodeKinds, responsibleKinds, SearchIndexState, SecretFields, SecretId, } from "./nodes/nodes.js";
|
|
29
|
+
export { Credential, CredentialCreateInput, CredentialGetInput, CredentialId, CredentialKind, CredentialList, CredentialListInput, CredentialRevokeInput, CredentialState, CredentialTested, CredentialTestInput, CredentialTestResult, CredentialUpdateInput, GatewayTarget, MachineDisableInput, MachineEnableInput, MachineGetInput, MachineListInput, modelsOf, Operator, OperatorLimits, OperatorList, OperatorMachineArchiveInput, OperatorMachineCreateInput, OperatorMachineUpdateInput, OperatorModel, type OperatorProviderEntry, OperatorRun, OperatorRunGetInput, OperatorRunId, OperatorRunList, OperatorRunListInput, OperatorRunReason, OperatorRunStatus, OperatorRunTokens, OperatorRunTouched, OperatorRunTrigger, OperatorRunUsage, OperatorState, operatorDefaults, operatorProviders, PauseReason, Subagents, Trigger, } from "./operators/operators.js";
|
|
30
|
+
export { PageDetail, PageGetInput, PageHead, PageHeading, PageId, PageList, PageListInput, PageSummary, } from "./pages/pages.js";
|
|
31
|
+
export { IdempotencyKey, Rev } from "./primitives/primitives.js";
|
|
32
|
+
export { Locale, locales, Name, ProfileImageResponse, ProfileUpdateInput, profileImageMaxBytes, profileImageTypes, Theme, TimeZone, themes, } from "./profile/profile.js";
|
|
33
|
+
export { GrantChange, PermissionsResponse, RightInCode, RightPath, RightTree, Role, RoleArchiveInput, RoleCreateInput, RoleDetail, RoleGetInput, RoleGrantCreateInput, RoleGrantRevokeInput, RoleId, RoleList, RoleListInput, RoleRestoreInput, RoleUpdateInput, } from "./roles/roles.js";
|
|
34
|
+
export { BoardRunCreateInput, DashboardRunCreateInput, RunCompleteInput, RunDetail, RunGetInput, RunId, RunItem, RunList, RunListInput, RunStatus, RunUpdateInput, RunValue, RunValueValue, runStatuses, } from "./runs/runs.js";
|
|
35
|
+
export { RuntimeConfig } from "./runtime-config.js";
|
|
36
|
+
export { NodeSecret, NodeSecretCreateInput, NodeSecretDetail, NodeSecretGetInput, NodeSecretRemoveInput, NodeSecretUpdateInput, NodeUnlocked, NodeUnlockInput, unlockMinutes, } from "./secrets/secrets.js";
|
|
37
|
+
export { type Authorized, type AuthorizeResult, createServiceClient, type InterfaceDeclaredResult, type InterfaceRemovedResult, type ServiceClient, type ServiceClientDeps, type ServiceClientFailure, } from "./service-client/service-client.js";
|
|
38
|
+
export { FunctionId, InterfaceId, RightWord, Service, ServiceArchiveInput, ServiceCreateInput, ServiceFunction, ServiceId, ServiceInterface, ServiceKeyIssued, ServiceList, ServiceListInput, ServiceName, ServicePurged, ServicePurgeInput, ServiceRestoreInput, ServiceRotateInput, ServiceUpdateInput, } from "./services/services.js";
|
|
39
|
+
export { SignInProviders, Sso, SsoId, SsoList, SsoListInput, SsoRemoveInput, SsoSource, SsoUpdateInput, ssoIds, } from "./sso/sso.js";
|
|
40
|
+
export { TableColumn, TableColumnChange, TableColumnType, TableCreateInput, TableDetail, TableGetInput, TableId, TableSaved, TableUpdateInput, tableColumnTypes, tableFormats, } from "./tables/tables.js";
|
|
41
|
+
export { type Actor, defineTool, type Permission, type Tool, type ToolAnnotations, type ToolContext, type ToolInput, type ToolSource, } from "./tool.js";
|
|
42
|
+
export { IntelligenceUserGetInput, IntelligenceUserUpdateInput, NotifyMode, notifyModes, UserSettings, } from "./user-settings/user-settings.js";
|
|
43
|
+
export { MachineFacts, MachineKeyFacts, MachineKind, MessageMachine, OperatorProvider, OwnRoleList, SignInMethod, User, UserDetail, UserDisableInput, UserEnableInput, UserGetInput, UserId, UserKind, UserList, UserListInput, UserListItem, UserStatus, UserTestInput, UserTestResult, UserUpdateInput, } from "./users/users.js";
|
|
44
|
+
export { TicketColumn, TicketMove, TicketSubject, TicketSubjectRef, ValidationBoardId, validationBoardId, } from "./validation/validation.js";
|
|
45
|
+
export { NodeVersion, NodeVersionCreateInput, NodeVersionDetail, NodeVersionGetInput, NodeVersionList, NodeVersionListInput, VersionId, versionKinds, } from "./versions/versions.js";
|
package/dist/sdk.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// The contract between UI, backends and outside services, published as `@anchrd/colab-sdk`. The
|
|
2
|
+
// package exports only this file, so everything public is named here once.
|
|
3
|
+
// biome-ignore lint/performance/noBarrelFile: this file IS the entry point of the package.
|
|
4
|
+
export { ActionChat, ActionItem, ActionList, ActionListInput, ActionNotice, ActionNoticeButton, ActionNoticeCrumb, ActionNoticeItem, ActionNoticeKind, ActionNoticeReason, ActionNoticeTitle, ActionProcess, ActionRow, ActionRun, ActionSection, ActionTask, actionFilters, isNodeRow, } from "./actions/actions.js";
|
|
5
|
+
export { adminModeHeader, adminModeOn } from "./admin-mode.js";
|
|
6
|
+
export { App, AppId, AppList, AppListInput, AppRevoked, AppRevokeInput, OwnAppListQuery, OwnSessionListQuery, Session, SessionId, SessionList, SessionListInput, SessionRevokeInput, SessionsRevoked, } from "./apps/apps.js";
|
|
7
|
+
export { NodeArchived, NodeArchiveInput, NodePurged, NodePurgeInput, NodeRestoreInput, } from "./archive/archive.js";
|
|
8
|
+
export { PasskeyDeleteInput, SetPasswordInput, SignUpInput, } from "./auth/auth.js";
|
|
9
|
+
export { AuthorizationRequest, AuthorizationResponse, Identity, Rules, } from "./authorization/authorization.js";
|
|
10
|
+
export { BoardColumn, BoardCreateInput, BoardDetail, BoardGetInput, BoardId, BoardKind, BoardLabel, BoardTaskCreateInput, BoardTaskItem, BoardTaskList, BoardTaskListInput, BoardUpdateInput, boardKinds, LabelId, ProcessCheck, TaskDetail, TaskGetInput, TaskId, TaskImage, TaskUpdateInput, } from "./boards/boards.js";
|
|
11
|
+
export { ColumnId, ColumnType, columnTypes, TaskColumn } from "./columns/columns.js";
|
|
12
|
+
export { Connection, ConnectionCreateInput, ConnectionCredential, ConnectionDetail, ConnectionGetInput, ConnectionId, ConnectionList, ConnectionListInput, ConnectionRevokeInput, ConnectionState, ConnectionTested, ConnectionTestInput, ConnectionTestResult, ConnectionUpdateInput, } from "./connections/connections.js";
|
|
13
|
+
export { Call, CallId, CallList, CallListInput, CallSource, Connector, ConnectorField, ConnectorGetInput, ConnectorId, ConnectorList, ConnectorListInput, ConnectorTool, } from "./connectors/connectors.js";
|
|
14
|
+
export { boxTypes, chartTypes, DashboardConfig, DashboardCreateInput, DashboardDetail, DashboardGetInput, DashboardId, DashboardKey, DashboardRun, DashboardUpdateInput, rhythms, Schedule, WhileOpen, weekdays, whileOpenModes, } from "./dashboards/dashboards.js";
|
|
15
|
+
export { DirectoryPrincipal, DirectorySearchInput } from "./directory/directory.js";
|
|
16
|
+
export { DocumentCreateInput, DocumentDetail, DocumentGetInput, DocumentUpdateInput, } from "./documents/documents.js";
|
|
17
|
+
export { ErrorCode, ErrorIssue, ErrorResponse, errorCodes } from "./error/error.js";
|
|
18
|
+
export { ActorKind, Event, EventId, EventKind, EventList, EventListInput, } from "./events/events.js";
|
|
19
|
+
export { FileCreateInput, FileDetail, FileGetInput, FileId, FileUpdateInput, FileUpload, fileFormatExtensions, fileFormatOf, maxFileBytes, UploadTicket, uploadTicketHeader, uploadTicketLifetimeMs, } from "./files/files.js";
|
|
20
|
+
export { FunctionRemoved, ServiceInterfaceFunctionCreateInput, ServiceInterfaceFunctionRemoveInput, ServiceInterfaceFunctionUpdateInput, } from "./functions/functions.js";
|
|
21
|
+
export { actions, hasRoute, isAction, isPackage, isWord, packages, parseConnectorFunction, parseToolName, resources, toolEvent, toolPermission, toolRoute, toolSchemaName, verbs, } from "./grammar/grammar.js";
|
|
22
|
+
export { GrantId, GrantRight, NodeGrant, NodeGrantList, NodeGrantListInput, NodeGrantRevoked, NodeGrantRevokeInput, NodeShared, NodeShareInput, } from "./grants/grants.js";
|
|
23
|
+
export { createId, idSchema } from "./ids/ids.js";
|
|
24
|
+
export { Instructions, InstructionsLink, instructionsNames, isInstructionsName, validationSection, } from "./instructions/instructions.js";
|
|
25
|
+
export { FunctionNames, InterfaceRemoved, ServiceInterfaceCreateInput, ServiceInterfaceDeclared, ServiceInterfaceDeclareInput, ServiceInterfaceRemoveInput, ServiceInterfaceUndeclared, ServiceInterfaceUpdateInput, } from "./interfaces/interfaces.js";
|
|
26
|
+
export { Delivery, Invitation, InvitationAcceptInput, InvitationCreateInput, InvitationId, InvitationLookup, InvitationLookupQuery, InvitationResendInput, InvitationRevokeInput, InvitationSent, InvitationSocialInput, InvitationStatus, RoleChip, } from "./invitations/invitations.js";
|
|
27
|
+
export { defaultLinkDays, LinkId, LinkStatus, maxLinkDays, NodeLink, NodeLinkCreateInput, NodeLinkList, NodeLinkListInput, NodeLinkRevokeInput, NodeLinkUpdateInput, publicLinkPath, } from "./links/links.js";
|
|
28
|
+
export { Flag, Limit } from "./list-input.js";
|
|
29
|
+
export { MachineArchiveInput, MachineCreateInput, MachineId, MachineKey, MachinePurged, MachinePurgeInput, MachineRestoreInput, MachineRotateInput, MachineUpdateInput, } from "./machines/machines.js";
|
|
30
|
+
export { ChatRead, ChatUpdateInput, Message, MessageAuthor, MessageCreateInput, MessageId, MessageList, MessageListInput, messageMaxLength, } from "./messages/messages.js";
|
|
31
|
+
export { BoardShownKind, BoardSystem, FolderCreated, FolderCreateInput, IntelligenceUser, IntelligenceUserList, IntelligenceUserListInput, NodeDetail, NodeGetInput, NodeHit, NodeHitFoundIn, NodeHitGroup, NodeId, NodeKind, NodeList, NodeListInput, NodeListItem, NodeMoved, NodeMoveInput, NodePath, NodePerson, NodeQuery, NodeReader, NodeSearch, NodeSection, NodeSort, NodeUpdateInput, NodeValidation, nodeKinds, responsibleKinds, SearchIndexState, SecretFields, SecretId, } from "./nodes/nodes.js";
|
|
32
|
+
export { Credential, CredentialCreateInput, CredentialGetInput, CredentialId, CredentialKind, CredentialList, CredentialListInput, CredentialRevokeInput, CredentialState, CredentialTested, CredentialTestInput, CredentialTestResult, CredentialUpdateInput, GatewayTarget, MachineDisableInput, MachineEnableInput, MachineGetInput, MachineListInput, modelsOf, Operator, OperatorLimits, OperatorList, OperatorMachineArchiveInput, OperatorMachineCreateInput, OperatorMachineUpdateInput, OperatorModel, OperatorRun, OperatorRunGetInput, OperatorRunId, OperatorRunList, OperatorRunListInput, OperatorRunReason, OperatorRunStatus, OperatorRunTokens, OperatorRunTouched, OperatorRunTrigger, OperatorRunUsage, OperatorState, operatorDefaults, operatorProviders, PauseReason, Subagents, Trigger, } from "./operators/operators.js";
|
|
33
|
+
export { PageDetail, PageGetInput, PageHead, PageHeading, PageId, PageList, PageListInput, PageSummary, } from "./pages/pages.js";
|
|
34
|
+
export { IdempotencyKey, Rev } from "./primitives/primitives.js";
|
|
35
|
+
export { Locale, locales, Name, ProfileImageResponse, ProfileUpdateInput, profileImageMaxBytes, profileImageTypes, Theme, TimeZone, themes, } from "./profile/profile.js";
|
|
36
|
+
export { GrantChange, PermissionsResponse, RightInCode, RightPath, RightTree, Role, RoleArchiveInput, RoleCreateInput, RoleDetail, RoleGetInput, RoleGrantCreateInput, RoleGrantRevokeInput, RoleId, RoleList, RoleListInput, RoleRestoreInput, RoleUpdateInput, } from "./roles/roles.js";
|
|
37
|
+
export { BoardRunCreateInput, DashboardRunCreateInput, RunCompleteInput, RunDetail, RunGetInput, RunId, RunItem, RunList, RunListInput, RunStatus, RunUpdateInput, RunValue, RunValueValue, runStatuses, } from "./runs/runs.js";
|
|
38
|
+
export { RuntimeConfig } from "./runtime-config.js";
|
|
39
|
+
export { NodeSecret, NodeSecretCreateInput, NodeSecretDetail, NodeSecretGetInput, NodeSecretRemoveInput, NodeSecretUpdateInput, NodeUnlocked, NodeUnlockInput, unlockMinutes, } from "./secrets/secrets.js";
|
|
40
|
+
export { createServiceClient, } from "./service-client/service-client.js";
|
|
41
|
+
export { FunctionId, InterfaceId, RightWord, Service, ServiceArchiveInput, ServiceCreateInput, ServiceFunction, ServiceId, ServiceInterface, ServiceKeyIssued, ServiceList, ServiceListInput, ServiceName, ServicePurged, ServicePurgeInput, ServiceRestoreInput, ServiceRotateInput, ServiceUpdateInput, } from "./services/services.js";
|
|
42
|
+
export { SignInProviders, Sso, SsoId, SsoList, SsoListInput, SsoRemoveInput, SsoSource, SsoUpdateInput, ssoIds, } from "./sso/sso.js";
|
|
43
|
+
export { TableColumn, TableColumnChange, TableColumnType, TableCreateInput, TableDetail, TableGetInput, TableId, TableSaved, TableUpdateInput, tableColumnTypes, tableFormats, } from "./tables/tables.js";
|
|
44
|
+
export { defineTool, } from "./tool.js";
|
|
45
|
+
export { IntelligenceUserGetInput, IntelligenceUserUpdateInput, NotifyMode, notifyModes, UserSettings, } from "./user-settings/user-settings.js";
|
|
46
|
+
export { MachineFacts, MachineKeyFacts, MachineKind, MessageMachine, OperatorProvider, OwnRoleList, SignInMethod, User, UserDetail, UserDisableInput, UserEnableInput, UserGetInput, UserId, UserKind, UserList, UserListInput, UserListItem, UserStatus, UserTestInput, UserTestResult, UserUpdateInput, } from "./users/users.js";
|
|
47
|
+
export { TicketColumn, TicketMove, TicketSubject, TicketSubjectRef, ValidationBoardId, validationBoardId, } from "./validation/validation.js";
|
|
48
|
+
export { NodeVersion, NodeVersionCreateInput, NodeVersionDetail, NodeVersionGetInput, NodeVersionList, NodeVersionListInput, VersionId, versionKinds, } from "./versions/versions.js";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const unlockMinutes = 15;
|
|
3
|
+
export declare const NodeSecretCreateInput: z.ZodObject<{
|
|
4
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
5
|
+
password: z.ZodString;
|
|
6
|
+
idempotencyKey: z.ZodString;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type NodeSecretCreateInput = z.infer<typeof NodeSecretCreateInput>;
|
|
9
|
+
export declare const NodeSecretUpdateInput: z.ZodObject<{
|
|
10
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
11
|
+
secretId: z.ZodTemplateLiteral<`secret_${string}`>;
|
|
12
|
+
password: z.ZodString;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export type NodeSecretUpdateInput = z.infer<typeof NodeSecretUpdateInput>;
|
|
15
|
+
export declare const NodeSecretGetInput: z.ZodObject<{
|
|
16
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
17
|
+
secretId: z.ZodTemplateLiteral<`secret_${string}`>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
export type NodeSecretGetInput = z.infer<typeof NodeSecretGetInput>;
|
|
20
|
+
export declare const NodeSecretRemoveInput: z.ZodObject<{
|
|
21
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
22
|
+
secretId: z.ZodTemplateLiteral<`secret_${string}`>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
export type NodeSecretRemoveInput = z.infer<typeof NodeSecretRemoveInput>;
|
|
25
|
+
export declare const NodeUnlockInput: z.ZodObject<{
|
|
26
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
27
|
+
password: z.ZodString;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export type NodeUnlockInput = z.infer<typeof NodeUnlockInput>;
|
|
30
|
+
export declare const NodeSecret: z.ZodObject<{
|
|
31
|
+
secretId: z.ZodTemplateLiteral<`secret_${string}`>;
|
|
32
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
33
|
+
createdBy: z.ZodObject<{
|
|
34
|
+
userId: z.ZodString;
|
|
35
|
+
name: z.ZodNullable<z.ZodString>;
|
|
36
|
+
kind: z.ZodNullable<z.ZodEnum<{
|
|
37
|
+
machine: "machine";
|
|
38
|
+
human: "human";
|
|
39
|
+
}>>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
createdAt: z.ZodISODateTime;
|
|
42
|
+
updatedAt: z.ZodISODateTime;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export type NodeSecret = z.infer<typeof NodeSecret>;
|
|
45
|
+
export declare const NodeSecretDetail: z.ZodObject<{
|
|
46
|
+
secretId: z.ZodTemplateLiteral<`secret_${string}`>;
|
|
47
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
48
|
+
createdBy: z.ZodObject<{
|
|
49
|
+
userId: z.ZodString;
|
|
50
|
+
name: z.ZodNullable<z.ZodString>;
|
|
51
|
+
kind: z.ZodNullable<z.ZodEnum<{
|
|
52
|
+
machine: "machine";
|
|
53
|
+
human: "human";
|
|
54
|
+
}>>;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
createdAt: z.ZodISODateTime;
|
|
57
|
+
updatedAt: z.ZodISODateTime;
|
|
58
|
+
password: z.ZodString;
|
|
59
|
+
}, z.core.$strict>;
|
|
60
|
+
export type NodeSecretDetail = z.infer<typeof NodeSecretDetail>;
|
|
61
|
+
export declare const NodeUnlocked: z.ZodObject<{
|
|
62
|
+
nodeId: z.ZodTemplateLiteral<`node_${string}`>;
|
|
63
|
+
unlockedUntil: z.ZodISODateTime;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
export type NodeUnlocked = z.infer<typeof NodeUnlocked>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { NodeId, NodePerson, SecretId } from "../nodes/nodes.js";
|
|
3
|
+
import { IdempotencyKey } from "../primitives/primitives.js";
|
|
4
|
+
// Secret documents and tables (#357, Nodes › Geheime Dokumente und Tabellen, E94): the inputs of
|
|
5
|
+
// `intelligence_node_secret_create`, `_update`, `_get`, `_remove` and `intelligence_node_unlock`, and
|
|
6
|
+
// their answers. The content of a secret node and every version of it are encrypted with the
|
|
7
|
+
// installation's key; a person unlocks it with its password in the browser, for this session and
|
|
8
|
+
// `unlockMinutes`. No AI and no machine reads it, an admin in admin mode does.
|
|
9
|
+
// How long an unlock holds on one browser session (E94).
|
|
10
|
+
export const unlockMinutes = 15;
|
|
11
|
+
const Password = z
|
|
12
|
+
.string()
|
|
13
|
+
.min(4)
|
|
14
|
+
.max(200)
|
|
15
|
+
.describe("The password people unlock the node with, 4 to 200 characters. It is stored encrypted; an admin can show it in the node's settings.");
|
|
16
|
+
const SecretNodeId = NodeId.describe("The document or table that is secret.");
|
|
17
|
+
export const NodeSecretCreateInput = z.strictObject({
|
|
18
|
+
nodeId: NodeId.describe("The document or table to make secret; you need the right to share it. Other kinds cannot be secret."),
|
|
19
|
+
password: Password,
|
|
20
|
+
idempotencyKey: IdempotencyKey,
|
|
21
|
+
});
|
|
22
|
+
export const NodeSecretUpdateInput = z.strictObject({
|
|
23
|
+
nodeId: SecretNodeId,
|
|
24
|
+
secretId: SecretId,
|
|
25
|
+
password: Password.describe("The new password. Whoever unlocked the node with the old one has to unlock it again."),
|
|
26
|
+
});
|
|
27
|
+
export const NodeSecretGetInput = z.strictObject({
|
|
28
|
+
nodeId: SecretNodeId,
|
|
29
|
+
secretId: SecretId,
|
|
30
|
+
});
|
|
31
|
+
export const NodeSecretRemoveInput = z.strictObject({
|
|
32
|
+
nodeId: SecretNodeId,
|
|
33
|
+
secretId: SecretId.describe("The password to take away: the node is public again for everyone who reads it, its content and every version decrypted."),
|
|
34
|
+
});
|
|
35
|
+
export const NodeUnlockInput = z.strictObject({
|
|
36
|
+
nodeId: SecretNodeId,
|
|
37
|
+
password: z
|
|
38
|
+
.string()
|
|
39
|
+
.min(1)
|
|
40
|
+
.max(200)
|
|
41
|
+
.describe("The node's password, as its creator or an admin gave it to you."),
|
|
42
|
+
});
|
|
43
|
+
// A node's password as its settings show it; never the password itself.
|
|
44
|
+
export const NodeSecret = z.strictObject({
|
|
45
|
+
secretId: SecretId,
|
|
46
|
+
nodeId: NodeId,
|
|
47
|
+
createdBy: NodePerson,
|
|
48
|
+
createdAt: z.iso.datetime(),
|
|
49
|
+
updatedAt: z.iso.datetime(),
|
|
50
|
+
});
|
|
51
|
+
// Only for an admin in admin mode, in the browser: the password itself.
|
|
52
|
+
export const NodeSecretDetail = NodeSecret.extend({ password: z.string() });
|
|
53
|
+
// The answer of an unlock: until when this browser session reads the node.
|
|
54
|
+
export const NodeUnlocked = z.strictObject({
|
|
55
|
+
nodeId: NodeId,
|
|
56
|
+
unlockedUntil: z.iso.datetime(),
|
|
57
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type Identity, type Rules } from "../authorization/authorization.js";
|
|
2
|
+
import { ErrorResponse } from "../error/error.js";
|
|
3
|
+
import { ServiceInterfaceDeclared, ServiceInterfaceUndeclared } from "../interfaces/interfaces.js";
|
|
4
|
+
export type ServiceClientDeps = {
|
|
5
|
+
url: string;
|
|
6
|
+
serviceKey: string;
|
|
7
|
+
fetch?: typeof fetch;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
};
|
|
10
|
+
export type ServiceClientFailure = {
|
|
11
|
+
ok: false;
|
|
12
|
+
status: number;
|
|
13
|
+
error: ErrorResponse["error"];
|
|
14
|
+
};
|
|
15
|
+
export type Authorized = {
|
|
16
|
+
ok: true;
|
|
17
|
+
identity: Identity;
|
|
18
|
+
rules: Rules;
|
|
19
|
+
can(iface: string, fn: string): boolean;
|
|
20
|
+
};
|
|
21
|
+
export type AuthorizeResult = Authorized | ServiceClientFailure;
|
|
22
|
+
export type InterfaceDeclaredResult = ({
|
|
23
|
+
ok: true;
|
|
24
|
+
} & ServiceInterfaceDeclared) | ServiceClientFailure;
|
|
25
|
+
export type InterfaceRemovedResult = ({
|
|
26
|
+
ok: true;
|
|
27
|
+
} & ServiceInterfaceUndeclared) | ServiceClientFailure;
|
|
28
|
+
export type ServiceClient = {
|
|
29
|
+
authorize(bearer: string): Promise<AuthorizeResult>;
|
|
30
|
+
interfaces: {
|
|
31
|
+
set(name: string, functions: string[]): Promise<InterfaceDeclaredResult>;
|
|
32
|
+
remove(name: string): Promise<InterfaceRemovedResult>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare function createServiceClient(deps: ServiceClientDeps): ServiceClient;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { AuthorizationResponse, } from "../authorization/authorization.js";
|
|
2
|
+
import { ErrorResponse } from "../error/error.js";
|
|
3
|
+
import { ServiceInterfaceDeclared, ServiceInterfaceUndeclared } from "../interfaces/interfaces.js";
|
|
4
|
+
// The error shape of the answer, or one of our own when the body is not one: a contradictory body
|
|
5
|
+
// must not pass as a refusal (validated, not cast).
|
|
6
|
+
function errorOf(status, body) {
|
|
7
|
+
const parsed = ErrorResponse.safeParse(body);
|
|
8
|
+
if (parsed.success)
|
|
9
|
+
return parsed.data.error;
|
|
10
|
+
return {
|
|
11
|
+
code: status === 401 ? "unauthenticated" : "unavailable",
|
|
12
|
+
message: "Unexpected answer.",
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const contractBroken = (what) => ({
|
|
16
|
+
ok: false,
|
|
17
|
+
status: 502,
|
|
18
|
+
error: { code: "unavailable", message: `The ${what} does not match the contract.` },
|
|
19
|
+
});
|
|
20
|
+
export function createServiceClient(deps) {
|
|
21
|
+
const doFetch = deps.fetch ?? fetch;
|
|
22
|
+
const base = deps.url.replace(/\/+$/, "");
|
|
23
|
+
async function call(path, method, payload) {
|
|
24
|
+
let response;
|
|
25
|
+
try {
|
|
26
|
+
response = await doFetch(`${base}/auth/service${path}`, {
|
|
27
|
+
method,
|
|
28
|
+
signal: AbortSignal.timeout(deps.timeoutMs ?? 10_000),
|
|
29
|
+
headers: {
|
|
30
|
+
authorization: `Bearer ${deps.serviceKey}`,
|
|
31
|
+
...(payload !== undefined && { "content-type": "application/json" }),
|
|
32
|
+
},
|
|
33
|
+
...(payload !== undefined && { body: JSON.stringify(payload) }),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (cause) {
|
|
37
|
+
// A refused connection or an expired timeout (#194). The thrown message is not passed on:
|
|
38
|
+
// a runtime may name the request in it, and a result never carries more than we chose.
|
|
39
|
+
const timedOut = cause instanceof Error && cause.name === "TimeoutError";
|
|
40
|
+
return {
|
|
41
|
+
ok: false,
|
|
42
|
+
status: 503,
|
|
43
|
+
error: {
|
|
44
|
+
code: "unavailable",
|
|
45
|
+
message: timedOut
|
|
46
|
+
? "The installation did not answer in time."
|
|
47
|
+
: "The installation is not reachable.",
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const body = await response.json().catch(() => null);
|
|
52
|
+
if (!response.ok)
|
|
53
|
+
return { ok: false, status: response.status, error: errorOf(response.status, body) };
|
|
54
|
+
return { ok: true, body };
|
|
55
|
+
}
|
|
56
|
+
const interfacePath = (name) => `/interfaces/${encodeURIComponent(name)}`;
|
|
57
|
+
return {
|
|
58
|
+
async authorize(bearer) {
|
|
59
|
+
const answer = await call("/authorization", "POST", { token: bearer });
|
|
60
|
+
if (!answer.ok)
|
|
61
|
+
return answer;
|
|
62
|
+
const parsed = AuthorizationResponse.safeParse(answer.body);
|
|
63
|
+
if (!parsed.success)
|
|
64
|
+
return contractBroken("authorization answer");
|
|
65
|
+
const { identity, rules } = parsed.data;
|
|
66
|
+
return {
|
|
67
|
+
ok: true,
|
|
68
|
+
identity,
|
|
69
|
+
rules,
|
|
70
|
+
can: (iface, fn) => rules[iface]?.includes(fn) ?? false,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
interfaces: {
|
|
74
|
+
async set(name, functions) {
|
|
75
|
+
const answer = await call(interfacePath(name), "PUT", { functions });
|
|
76
|
+
if (!answer.ok)
|
|
77
|
+
return answer;
|
|
78
|
+
const parsed = ServiceInterfaceDeclared.safeParse(answer.body);
|
|
79
|
+
return parsed.success ? { ok: true, ...parsed.data } : contractBroken("interface answer");
|
|
80
|
+
},
|
|
81
|
+
async remove(name) {
|
|
82
|
+
const answer = await call(`${interfacePath(name)}/remove`, "POST");
|
|
83
|
+
if (!answer.ok)
|
|
84
|
+
return answer;
|
|
85
|
+
const parsed = ServiceInterfaceUndeclared.safeParse(answer.body);
|
|
86
|
+
return parsed.success ? { ok: true, ...parsed.data } : contractBroken("interface answer");
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ServiceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
3
|
+
export declare const InterfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
|
|
4
|
+
export declare const FunctionId: z.ZodTemplateLiteral<`function_${string}`>;
|
|
5
|
+
export declare const RightWord: z.ZodString;
|
|
6
|
+
export declare const ServiceName: z.ZodString;
|
|
7
|
+
export declare const McpUrl: z.ZodURL;
|
|
8
|
+
export declare const ServiceFunction: z.ZodObject<{
|
|
9
|
+
functionId: z.ZodTemplateLiteral<`function_${string}`>;
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type ServiceFunction = z.infer<typeof ServiceFunction>;
|
|
13
|
+
export declare const ServiceInterface: z.ZodObject<{
|
|
14
|
+
interfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
|
|
15
|
+
name: z.ZodString;
|
|
16
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
17
|
+
functionId: z.ZodTemplateLiteral<`function_${string}`>;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
}, z.core.$strict>>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
export type ServiceInterface = z.infer<typeof ServiceInterface>;
|
|
22
|
+
export declare const Service: z.ZodObject<{
|
|
23
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
24
|
+
name: z.ZodString;
|
|
25
|
+
oauthResource: z.ZodNullable<z.ZodString>;
|
|
26
|
+
mcpUrl: z.ZodNullable<z.ZodString>;
|
|
27
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
28
|
+
createdAt: z.ZodISODateTime;
|
|
29
|
+
updatedAt: z.ZodISODateTime;
|
|
30
|
+
interfaces: z.ZodArray<z.ZodObject<{
|
|
31
|
+
interfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
34
|
+
functionId: z.ZodTemplateLiteral<`function_${string}`>;
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type Service = z.infer<typeof Service>;
|
|
40
|
+
export declare const ServiceListInput: z.ZodObject<{
|
|
41
|
+
archived: z.ZodOptional<z.ZodPreprocess<z.ZodBoolean, unknown>>;
|
|
42
|
+
cursor: z.ZodOptional<z.ZodTemplateLiteral<`service_${string}`>>;
|
|
43
|
+
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type ServiceListInput = z.infer<typeof ServiceListInput>;
|
|
46
|
+
export declare const ServiceList: z.ZodObject<{
|
|
47
|
+
items: z.ZodArray<z.ZodObject<{
|
|
48
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
oauthResource: z.ZodNullable<z.ZodString>;
|
|
51
|
+
mcpUrl: z.ZodNullable<z.ZodString>;
|
|
52
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
53
|
+
createdAt: z.ZodISODateTime;
|
|
54
|
+
updatedAt: z.ZodISODateTime;
|
|
55
|
+
interfaces: z.ZodArray<z.ZodObject<{
|
|
56
|
+
interfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
59
|
+
functionId: z.ZodTemplateLiteral<`function_${string}`>;
|
|
60
|
+
name: z.ZodString;
|
|
61
|
+
}, z.core.$strict>>;
|
|
62
|
+
}, z.core.$strict>>;
|
|
63
|
+
}, z.core.$strict>>;
|
|
64
|
+
nextCursor: z.ZodNullable<z.ZodTemplateLiteral<`service_${string}`>>;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
export type ServiceList = z.infer<typeof ServiceList>;
|
|
67
|
+
export declare const ServiceCreateInput: z.ZodObject<{
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
oauthResource: z.ZodOptional<z.ZodURL>;
|
|
70
|
+
mcpUrl: z.ZodOptional<z.ZodURL>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export type ServiceCreateInput = z.infer<typeof ServiceCreateInput>;
|
|
73
|
+
export declare const ServiceKeyIssued: z.ZodObject<{
|
|
74
|
+
service: z.ZodObject<{
|
|
75
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
oauthResource: z.ZodNullable<z.ZodString>;
|
|
78
|
+
mcpUrl: z.ZodNullable<z.ZodString>;
|
|
79
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
80
|
+
createdAt: z.ZodISODateTime;
|
|
81
|
+
updatedAt: z.ZodISODateTime;
|
|
82
|
+
interfaces: z.ZodArray<z.ZodObject<{
|
|
83
|
+
interfaceId: z.ZodTemplateLiteral<`interface_${string}`>;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
functions: z.ZodArray<z.ZodObject<{
|
|
86
|
+
functionId: z.ZodTemplateLiteral<`function_${string}`>;
|
|
87
|
+
name: z.ZodString;
|
|
88
|
+
}, z.core.$strict>>;
|
|
89
|
+
}, z.core.$strict>>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
serviceKey: z.ZodString;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
export type ServiceKeyIssued = z.infer<typeof ServiceKeyIssued>;
|
|
94
|
+
export declare const ServiceUpdateInput: z.ZodObject<{
|
|
95
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
96
|
+
name: z.ZodOptional<z.ZodString>;
|
|
97
|
+
oauthResource: z.ZodOptional<z.ZodURL>;
|
|
98
|
+
mcpUrl: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
export type ServiceUpdateInput = z.infer<typeof ServiceUpdateInput>;
|
|
101
|
+
export declare const ServiceRotateInput: z.ZodObject<{
|
|
102
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
103
|
+
}, z.core.$strict>;
|
|
104
|
+
export type ServiceRotateInput = z.infer<typeof ServiceRotateInput>;
|
|
105
|
+
export declare const ServiceArchiveInput: z.ZodObject<{
|
|
106
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
107
|
+
}, z.core.$strict>;
|
|
108
|
+
export type ServiceArchiveInput = z.infer<typeof ServiceArchiveInput>;
|
|
109
|
+
export declare const ServiceRestoreInput: z.ZodObject<{
|
|
110
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
export type ServiceRestoreInput = z.infer<typeof ServiceRestoreInput>;
|
|
113
|
+
export declare const ServicePurgeInput: z.ZodObject<{
|
|
114
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
export type ServicePurgeInput = z.infer<typeof ServicePurgeInput>;
|
|
117
|
+
export declare const ServicePurged: z.ZodObject<{
|
|
118
|
+
serviceId: z.ZodTemplateLiteral<`service_${string}`>;
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
grants: z.ZodNumber;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
export type ServicePurged = z.infer<typeof ServicePurged>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { packages } from "../grammar/grammar.js";
|
|
3
|
+
import { idSchema } from "../ids/ids.js";
|
|
4
|
+
import { Flag, Limit } from "../list-input.js";
|
|
5
|
+
// The outside services (Einstellungen › Services, #26): customer edges that sign in from outside
|
|
6
|
+
// through the SDK, each with one key, its interfaces and their functions. Their rights read like the
|
|
7
|
+
// fixed groups' (Rechte): `service / interface / function`, stored by name in the role's grants.
|
|
8
|
+
export const ServiceId = idSchema("service");
|
|
9
|
+
export const InterfaceId = idSchema("interface");
|
|
10
|
+
export const FunctionId = idSchema("function");
|
|
11
|
+
// A name that stands in a right, so one word like every word of a right (E64): `datawarehouse`,
|
|
12
|
+
// `reports`, `read`. The right is `datawarehouse / reports / read`.
|
|
13
|
+
export const RightWord = z
|
|
14
|
+
.string()
|
|
15
|
+
.max(64)
|
|
16
|
+
.regex(/^[a-z][a-z0-9]*$/, "One word: lowercase letters and digits, starting with a letter");
|
|
17
|
+
// A service's name is the first word of its rights, beside the fixed groups; a package's word would
|
|
18
|
+
// make its rights those of the package.
|
|
19
|
+
export const ServiceName = RightWord.refine((name) => !packages.includes(name), "This name belongs to a part of Colab");
|
|
20
|
+
// Where a service answers as an MCP server (E80), so an Operator reaches it directly with a token of
|
|
21
|
+
// its own. Only `https`: the token travels in the header. Locally also `http` on this computer, for
|
|
22
|
+
// the seed's fake service under `bun run dev`.
|
|
23
|
+
const localHosts = new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
24
|
+
export const McpUrl = z
|
|
25
|
+
.url()
|
|
26
|
+
.max(2048)
|
|
27
|
+
.refine((value) => {
|
|
28
|
+
// Zod runs this after a failed `url()` too, with a value `URL` cannot read.
|
|
29
|
+
const url = URL.parse(value);
|
|
30
|
+
return (url !== null &&
|
|
31
|
+
(url.protocol === "https:" || (url.protocol === "http:" && localHosts.has(url.hostname))));
|
|
32
|
+
}, "An MCP address starts with https:// (on this computer also http://localhost)");
|
|
33
|
+
export const ServiceFunction = z.strictObject({ functionId: FunctionId, name: z.string() });
|
|
34
|
+
export const ServiceInterface = z.strictObject({
|
|
35
|
+
interfaceId: InterfaceId,
|
|
36
|
+
name: z.string(),
|
|
37
|
+
functions: z.array(ServiceFunction),
|
|
38
|
+
});
|
|
39
|
+
// A service with its interfaces and functions as a tree. ⚠️ Never its key or the key's hash, and no
|
|
40
|
+
// "last seen" (Einstellungen › Services).
|
|
41
|
+
export const Service = z.strictObject({
|
|
42
|
+
serviceId: ServiceId,
|
|
43
|
+
name: z.string(),
|
|
44
|
+
oauthResource: z.string().nullable(),
|
|
45
|
+
mcpUrl: z.string().nullable(),
|
|
46
|
+
archivedAt: z.iso.datetime().nullable(),
|
|
47
|
+
createdAt: z.iso.datetime(),
|
|
48
|
+
updatedAt: z.iso.datetime(),
|
|
49
|
+
interfaces: z.array(ServiceInterface),
|
|
50
|
+
});
|
|
51
|
+
export const ServiceListInput = z.strictObject({
|
|
52
|
+
// The archive instead of the services in use.
|
|
53
|
+
archived: Flag.optional(),
|
|
54
|
+
cursor: ServiceId.optional(),
|
|
55
|
+
limit: Limit.optional(),
|
|
56
|
+
});
|
|
57
|
+
export const ServiceList = z.strictObject({
|
|
58
|
+
items: z.array(Service),
|
|
59
|
+
nextCursor: ServiceId.nullable(),
|
|
60
|
+
});
|
|
61
|
+
export const ServiceCreateInput = z.strictObject({
|
|
62
|
+
name: ServiceName,
|
|
63
|
+
oauthResource: z.url().optional(),
|
|
64
|
+
mcpUrl: McpUrl.optional(),
|
|
65
|
+
});
|
|
66
|
+
// The answer of create and rotate: the key, shown this once. Only its hash is stored, so nobody can
|
|
67
|
+
// show it again; a lost key is rotated.
|
|
68
|
+
export const ServiceKeyIssued = z.strictObject({ service: Service, serviceKey: z.string() });
|
|
69
|
+
// Renaming a service renames its rights in every role (the only way that keeps them). The OAuth
|
|
70
|
+
// resource is bound once: set while it is empty, never changed after. The MCP address changes freely;
|
|
71
|
+
// `null` takes it away.
|
|
72
|
+
export const ServiceUpdateInput = z
|
|
73
|
+
.strictObject({
|
|
74
|
+
serviceId: ServiceId,
|
|
75
|
+
name: ServiceName.optional(),
|
|
76
|
+
oauthResource: z.url().optional(),
|
|
77
|
+
mcpUrl: McpUrl.nullable().optional(),
|
|
78
|
+
})
|
|
79
|
+
.refine((input) => input.name !== undefined || input.oauthResource !== undefined || input.mcpUrl !== undefined, { message: "Name a field to change: name, oauthResource or mcpUrl." });
|
|
80
|
+
export const ServiceRotateInput = z.strictObject({ serviceId: ServiceId });
|
|
81
|
+
export const ServiceArchiveInput = z.strictObject({ serviceId: ServiceId });
|
|
82
|
+
export const ServiceRestoreInput = z.strictObject({ serviceId: ServiceId });
|
|
83
|
+
export const ServicePurgeInput = z.strictObject({ serviceId: ServiceId });
|
|
84
|
+
// What fell with a purged service: its name (the row is gone) and how many rights the roles lost.
|
|
85
|
+
export const ServicePurged = z.strictObject({
|
|
86
|
+
serviceId: ServiceId,
|
|
87
|
+
name: z.string(),
|
|
88
|
+
grants: z.number().int(),
|
|
89
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ssoIds: readonly ["google", "microsoft"];
|
|
3
|
+
export declare const SsoId: z.ZodEnum<{
|
|
4
|
+
google: "google";
|
|
5
|
+
microsoft: "microsoft";
|
|
6
|
+
}>;
|
|
7
|
+
export type SsoId = z.infer<typeof SsoId>;
|
|
8
|
+
export declare const SsoSource: z.ZodEnum<{
|
|
9
|
+
settings: "settings";
|
|
10
|
+
environment: "environment";
|
|
11
|
+
}>;
|
|
12
|
+
export type SsoSource = z.infer<typeof SsoSource>;
|
|
13
|
+
export declare const SsoListInput: z.ZodObject<{}, z.core.$strict>;
|
|
14
|
+
export type SsoListInput = z.infer<typeof SsoListInput>;
|
|
15
|
+
export declare const SsoUpdateInput: z.ZodObject<{
|
|
16
|
+
ssoId: z.ZodEnum<{
|
|
17
|
+
google: "google";
|
|
18
|
+
microsoft: "microsoft";
|
|
19
|
+
}>;
|
|
20
|
+
clientId: z.ZodString;
|
|
21
|
+
clientSecret: z.ZodString;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export type SsoUpdateInput = z.infer<typeof SsoUpdateInput>;
|
|
24
|
+
export declare const SsoRemoveInput: z.ZodObject<{
|
|
25
|
+
ssoId: z.ZodEnum<{
|
|
26
|
+
google: "google";
|
|
27
|
+
microsoft: "microsoft";
|
|
28
|
+
}>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export type SsoRemoveInput = z.infer<typeof SsoRemoveInput>;
|
|
31
|
+
export declare const Sso: z.ZodObject<{
|
|
32
|
+
ssoId: z.ZodEnum<{
|
|
33
|
+
google: "google";
|
|
34
|
+
microsoft: "microsoft";
|
|
35
|
+
}>;
|
|
36
|
+
clientId: z.ZodNullable<z.ZodString>;
|
|
37
|
+
setAt: z.ZodNullable<z.ZodISODateTime>;
|
|
38
|
+
setBy: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
|
|
39
|
+
source: z.ZodNullable<z.ZodEnum<{
|
|
40
|
+
settings: "settings";
|
|
41
|
+
environment: "environment";
|
|
42
|
+
}>>;
|
|
43
|
+
redirectUrl: z.ZodURL;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export type Sso = z.infer<typeof Sso>;
|
|
46
|
+
export declare const SsoList: z.ZodObject<{
|
|
47
|
+
items: z.ZodArray<z.ZodObject<{
|
|
48
|
+
ssoId: z.ZodEnum<{
|
|
49
|
+
google: "google";
|
|
50
|
+
microsoft: "microsoft";
|
|
51
|
+
}>;
|
|
52
|
+
clientId: z.ZodNullable<z.ZodString>;
|
|
53
|
+
setAt: z.ZodNullable<z.ZodISODateTime>;
|
|
54
|
+
setBy: z.ZodNullable<z.ZodTemplateLiteral<`user_${string}`>>;
|
|
55
|
+
source: z.ZodNullable<z.ZodEnum<{
|
|
56
|
+
settings: "settings";
|
|
57
|
+
environment: "environment";
|
|
58
|
+
}>>;
|
|
59
|
+
redirectUrl: z.ZodURL;
|
|
60
|
+
}, z.core.$strict>>;
|
|
61
|
+
nextCursor: z.ZodNull;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
export type SsoList = z.infer<typeof SsoList>;
|
|
64
|
+
export declare const SignInProviders: z.ZodObject<{
|
|
65
|
+
providers: z.ZodArray<z.ZodEnum<{
|
|
66
|
+
google: "google";
|
|
67
|
+
microsoft: "microsoft";
|
|
68
|
+
}>>;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export type SignInProviders = z.infer<typeof SignInProviders>;
|