@elyx-code/editor-ui 0.0.2
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 +2 -0
- package/package.json +109 -0
- package/src/App.tsx +31 -0
- package/src/Router.tsx +115 -0
- package/src/__mocks__/defaultModuleMock.ts +1 -0
- package/src/__mocks__/fileMock.ts +1 -0
- package/src/__mocks__/styleMock.ts +1 -0
- package/src/assets/Clock-11.1s-18px.svg +16 -0
- package/src/assets/Clock-11.1s-28px.svg +16 -0
- package/src/assets/authentication.svg +1 -0
- package/src/assets/canvas-backdrop-0.png +0 -0
- package/src/assets/canvas-backdrop-1.png +0 -0
- package/src/assets/canvas-backdrop-2.png +0 -0
- package/src/assets/canvas-backdrop-3.png +0 -0
- package/src/assets/canvas-backdrop-4.png +0 -0
- package/src/assets/canvas-backdrop-5.png +0 -0
- package/src/assets/canvas-backdrop.png +0 -0
- package/src/assets/checkmark-animation.gif +0 -0
- package/src/assets/checkmark-animation.mp4 +0 -0
- package/src/assets/code-formatting/format-black.svg +6 -0
- package/src/assets/code-formatting/format-dark-grey.svg +6 -0
- package/src/assets/code-formatting/format-light-grey.svg +6 -0
- package/src/assets/code-formatting/format-white.svg +6 -0
- package/src/assets/code-formatting/inline-black.svg +5 -0
- package/src/assets/code-formatting/inline-dark-grey.svg +5 -0
- package/src/assets/code-formatting/inline-light-grey.svg +5 -0
- package/src/assets/code-formatting/inline-white.svg +5 -0
- package/src/assets/contained-logo-full-word.png +0 -0
- package/src/assets/cron-job-color.png +0 -0
- package/src/assets/cron-job.png +0 -0
- package/src/assets/database-table-color.png +0 -0
- package/src/assets/database-table.png +0 -0
- package/src/assets/datatype-icons/black/any.svg +1 -0
- package/src/assets/datatype-icons/black/binary.svg +1 -0
- package/src/assets/datatype-icons/black/boolean.svg +3 -0
- package/src/assets/datatype-icons/black/date-time.svg +3 -0
- package/src/assets/datatype-icons/black/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/black/key-file.svg +1 -0
- package/src/assets/datatype-icons/black/list.svg +3 -0
- package/src/assets/datatype-icons/black/null.svg +3 -0
- package/src/assets/datatype-icons/black/number.svg +13 -0
- package/src/assets/datatype-icons/black/project.svg +12 -0
- package/src/assets/datatype-icons/black/sql-program.svg +2 -0
- package/src/assets/datatype-icons/black/text.svg +3 -0
- package/src/assets/datatype-icons/black/unknown.svg +3 -0
- package/src/assets/datatype-icons/black/uuid.svg +4 -0
- package/src/assets/datatype-icons/black/void.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/any.svg +1 -0
- package/src/assets/datatype-icons/dark-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/dark-grey/list.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/null.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/number.svg +13 -0
- package/src/assets/datatype-icons/dark-grey/project.svg +12 -0
- package/src/assets/datatype-icons/dark-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/dark-grey/text.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/dark-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/dark-grey/void.svg +1 -0
- package/src/assets/datatype-icons/light-grey/any.svg +1 -0
- package/src/assets/datatype-icons/light-grey/boolean.svg +3 -0
- package/src/assets/datatype-icons/light-grey/date-time.svg +3 -0
- package/src/assets/datatype-icons/light-grey/definition-entity.svg +6 -0
- package/src/assets/datatype-icons/light-grey/list.svg +3 -0
- package/src/assets/datatype-icons/light-grey/null.svg +3 -0
- package/src/assets/datatype-icons/light-grey/number.svg +13 -0
- package/src/assets/datatype-icons/light-grey/project.svg +12 -0
- package/src/assets/datatype-icons/light-grey/sql-program.svg +2 -0
- package/src/assets/datatype-icons/light-grey/text.svg +3 -0
- package/src/assets/datatype-icons/light-grey/unknown.svg +3 -0
- package/src/assets/datatype-icons/light-grey/uuid.svg +4 -0
- package/src/assets/datatype-icons/light-grey/void.svg +1 -0
- package/src/assets/edit.png +0 -0
- package/src/assets/execution.svg +13 -0
- package/src/assets/favicon.svg +14 -0
- package/src/assets/file-search.svg +1 -0
- package/src/assets/http-endpoint.png +0 -0
- package/src/assets/image-input-placeholder.png +0 -0
- package/src/assets/logo-full-word-white.png +0 -0
- package/src/assets/logo-full-word.png +0 -0
- package/src/assets/password.svg +85 -0
- package/src/assets/pencil.png +0 -0
- package/src/assets/publish-project-rich-icon-2.svg +1 -0
- package/src/assets/publish-project-rich-icon.svg +1 -0
- package/src/assets/relational-database.png +0 -0
- package/src/assets/resources.svg +3 -0
- package/src/assets/resume-icon-14px.png +0 -0
- package/src/assets/server.png +0 -0
- package/src/assets/small-status/checkmark.svg +4 -0
- package/src/assets/small-status/error.svg +4 -0
- package/src/assets/small-status/loading.svg +4 -0
- package/src/assets/small-status/skipped.svg +11 -0
- package/src/assets/sql-connection-config.svg +1 -0
- package/src/assets/sql-row-transformer.svg +1 -0
- package/src/assets/ssl-certificate-config.svg +1 -0
- package/src/assets/sync.svg +1 -0
- package/src/assets/testing-logic-icon.svg +1 -0
- package/src/assets/versions.svg +25 -0
- package/src/assets/visual-programming-icon.svg +1 -0
- package/src/assets/warning-sign-24px.png +0 -0
- package/src/auth/index.ts +318 -0
- package/src/components/DialogLoader.tsx +94 -0
- package/src/components/EntityDialogHeader.tsx +110 -0
- package/src/components/EntityDialogSectionHeader.tsx +214 -0
- package/src/components/GalleryAddExternalIntegrationInfoDialog.tsx +87 -0
- package/src/components/GenerateProjectStartingLogicPromptDialog.tsx +281 -0
- package/src/components/LegacyRouteRedirector.tsx +55 -0
- package/src/components/ProPlanChip.tsx +23 -0
- package/src/components/ReportBugDialog.tsx +412 -0
- package/src/components/RequestIntegrationAccessDialog.tsx +261 -0
- package/src/components/UseTemplateProjectDialog.tsx +193 -0
- package/src/components/WorkspaceLayout.tsx +152 -0
- package/src/components/animated-svg/AnimatedCheckmark.tsx +41 -0
- package/src/components/animated-svg/AnimatedCrossmark.tsx +51 -0
- package/src/components/animated-svg/AnimatedEmailSending.tsx +38 -0
- package/src/components/animated-svg/AnimatedLoading.tsx +72 -0
- package/src/components/animated-svg/animated-svg.css +239 -0
- package/src/components/canvas/Canvas.tsx +16 -0
- package/src/components/canvas/CreateEntityMenu.tsx +2020 -0
- package/src/components/canvas/canvas.css +10 -0
- package/src/components/canvas/create-entity-menu.css +579 -0
- package/src/components/canvas-search/CanvasSearch.tsx +501 -0
- package/src/components/canvas-search/canvas-search.css +126 -0
- package/src/components/canvas-settings-menu/CanvasSettingsMenuButton.tsx +515 -0
- package/src/components/canvas-settings-menu/canvas-settings-menu.css +96 -0
- package/src/components/circular-image-upload/CircularImageUpload.tsx +113 -0
- package/src/components/circular-image-upload/circular-image-upload.css +69 -0
- package/src/components/costs/CostsDialog.tsx +459 -0
- package/src/components/data-type/DataTypeBuilder.tsx +3127 -0
- package/src/components/data-type/data-type-builder.css +45 -0
- package/src/components/dialogs/BetaAcknowledgeDialog.tsx +43 -0
- package/src/components/dialogs/ComplexDataDialog.tsx +458 -0
- package/src/components/dialogs/CronBuilderDialog.tsx +2145 -0
- package/src/components/dialogs/ExternalIntegrationConnections.tsx +565 -0
- package/src/components/dialogs/JsonEditorDialog.tsx +1392 -0
- package/src/components/dialogs/StringEditorDialog.tsx +268 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclaration.tsx +1167 -0
- package/src/components/dialogs/argument-declaration/ArgumentDeclarationDialogContent.tsx +128 -0
- package/src/components/dialogs/beta-dialog.css +165 -0
- package/src/components/dialogs/condition/Condition.tsx +431 -0
- package/src/components/dialogs/condition/ConditionDialogContent.tsx +126 -0
- package/src/components/dialogs/definition-entity/DefinitionEntityDialogContent.tsx +973 -0
- package/src/components/dialogs/function-call/FunctionCall.tsx +442 -0
- package/src/components/dialogs/function-call/FunctionCallDialogContent.tsx +126 -0
- package/src/components/dialogs/function-declaration/FunctionDeclaration.tsx +926 -0
- package/src/components/dialogs/function-declaration/FunctionDeclarationDialogContent.tsx +124 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/GeneratingProjectStartingLogicOverlay.tsx +176 -0
- package/src/components/dialogs/generating-project-starting-logic-overlay/generating-project-starting-logic-overlay.css +13 -0
- package/src/components/dialogs/global-event/GlobalEvent.tsx +475 -0
- package/src/components/dialogs/global-event/GlobalEventDialogContent.tsx +126 -0
- package/src/components/dialogs/help/HelpDialog.tsx +217 -0
- package/src/components/dialogs/help/HelpDilalogHomeContent.tsx +178 -0
- package/src/components/dialogs/help/help-dialog.css +116 -0
- package/src/components/dialogs/help/help-icon/HelpIconButton.tsx +41 -0
- package/src/components/dialogs/help/help-icon/help-icon.css +9 -0
- package/src/components/dialogs/input-map/InputMap.tsx +635 -0
- package/src/components/dialogs/input-map/InputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/json-editor-dialog.css +4 -0
- package/src/components/dialogs/loop/Loop.tsx +650 -0
- package/src/components/dialogs/loop/LoopDialogContent.tsx +122 -0
- package/src/components/dialogs/operation/Operation.tsx +440 -0
- package/src/components/dialogs/operation/OperationDialogContent.tsx +126 -0
- package/src/components/dialogs/output-map/OutputMap.tsx +536 -0
- package/src/components/dialogs/output-map/OutputMapDialogContent.tsx +126 -0
- package/src/components/dialogs/property/Property.tsx +1490 -0
- package/src/components/dialogs/property/PropertyDialogContent.tsx +106 -0
- package/src/components/dialogs/search-statement/ColumnSelector.tsx +334 -0
- package/src/components/dialogs/search-statement/ConditionBuilder.tsx +750 -0
- package/src/components/dialogs/search-statement/DataAggregationSection.tsx +621 -0
- package/src/components/dialogs/search-statement/DataSourceSelection.tsx +734 -0
- package/src/components/dialogs/search-statement/EntityMetadataSection.tsx +135 -0
- package/src/components/dialogs/search-statement/FilterConditionsSection.tsx +151 -0
- package/src/components/dialogs/search-statement/InlineInputMap.tsx +153 -0
- package/src/components/dialogs/search-statement/LiteralValue.tsx +616 -0
- package/src/components/dialogs/search-statement/MainSourceAndInputsSection.tsx +271 -0
- package/src/components/dialogs/search-statement/NestedSearchStatementBuilder.tsx +170 -0
- package/src/components/dialogs/search-statement/OutputFormatSection.tsx +1779 -0
- package/src/components/dialogs/search-statement/ResultsSection.tsx +344 -0
- package/src/components/dialogs/search-statement/SearchStatementBuilder.tsx +251 -0
- package/src/components/dialogs/search-statement/SearchStatementDialogContent.tsx +398 -0
- package/src/components/dialogs/search-statement/ValueSelector.tsx +766 -0
- package/src/components/dialogs/search-statement/search-statement-context.tsx +1630 -0
- package/src/components/dialogs/search-statement/search-statement-dialog.css +56 -0
- package/src/components/dialogs/search-statement/test.sql +111 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptor.tsx +824 -0
- package/src/components/dialogs/value-descriptor/ValueDescriptorDialogContent.tsx +124 -0
- package/src/components/dialogs/variable-declaration/VariableDeclaration.tsx +836 -0
- package/src/components/dialogs/variable-declaration/VariableDeclarationDialogContent.tsx +106 -0
- package/src/components/dialogs/variable-instance/VariableInstance.tsx +443 -0
- package/src/components/dialogs/variable-instance/VariableInstanceDialogContent.tsx +124 -0
- package/src/components/draggable-entity-card/ArgumentDeclaration.tsx +736 -0
- package/src/components/draggable-entity-card/CollapseEntityButton.tsx +170 -0
- package/src/components/draggable-entity-card/ConditionCard.tsx +1062 -0
- package/src/components/draggable-entity-card/ConnectionDeleteButton.tsx +309 -0
- package/src/components/draggable-entity-card/DataTypeIcon.tsx +624 -0
- package/src/components/draggable-entity-card/DraggableEntityCard.tsx +617 -0
- package/src/components/draggable-entity-card/ErrorMapProperty.tsx +464 -0
- package/src/components/draggable-entity-card/EventCard.tsx +700 -0
- package/src/components/draggable-entity-card/ExecutionInProgressValue.tsx +327 -0
- package/src/components/draggable-entity-card/FunctionDeclarationCard.tsx +819 -0
- package/src/components/draggable-entity-card/InputMapProperty.tsx +1067 -0
- package/src/components/draggable-entity-card/InternalCall.tsx +978 -0
- package/src/components/draggable-entity-card/InternalCallExecutionNode.tsx +643 -0
- package/src/components/draggable-entity-card/LogicScopeCallerNode.tsx +262 -0
- package/src/components/draggable-entity-card/LoopCard.tsx +791 -0
- package/src/components/draggable-entity-card/MainValueInput.tsx +523 -0
- package/src/components/draggable-entity-card/MainValueOutput.tsx +458 -0
- package/src/components/draggable-entity-card/MethodDeclaration.tsx +1088 -0
- package/src/components/draggable-entity-card/NestedCondition.tsx +1025 -0
- package/src/components/draggable-entity-card/OutputMapProperty.tsx +843 -0
- package/src/components/draggable-entity-card/PassthroughEntityCard.tsx +1247 -0
- package/src/components/draggable-entity-card/ReturnedError.tsx +549 -0
- package/src/components/draggable-entity-card/SmallSuccessFailureNodes.tsx +523 -0
- package/src/components/draggable-entity-card/SuccessFailureNodes.tsx +509 -0
- package/src/components/draggable-entity-card/TestEntityButton.tsx +946 -0
- package/src/components/draggable-entity-card/TestMenu.tsx +523 -0
- package/src/components/draggable-entity-card/TestMenuValidationDropdown.tsx +84 -0
- package/src/components/draggable-entity-card/UnreachableMarker.tsx +114 -0
- package/src/components/draggable-entity-card/VariableCard.tsx +1577 -0
- package/src/components/draggable-entity-card/VariableScopeMarker.tsx +117 -0
- package/src/components/draggable-entity-card/collapse-entity-button.css +44 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityCard.tsx +1181 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityIcon.tsx +36 -0
- package/src/components/draggable-entity-card/definition-entity/DefinitionEntityProperty.tsx +478 -0
- package/src/components/draggable-entity-card/definition-entity/DynamicFooterActions.tsx +112 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/ExportCredentialsFooterAction.tsx +461 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/RestablishConnectionFooterAction.tsx +199 -0
- package/src/components/draggable-entity-card/definition-entity/actions/external-integration-connection/restablish-connection-footer-action.css +85 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/GoogleDriveFilePickerAPIFooterAction.tsx +277 -0
- package/src/components/draggable-entity-card/definition-entity/actions/google-drive/google-drive-file-picker-api-footer-action.css +107 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/DatabaseFooterAction.tsx +452 -0
- package/src/components/draggable-entity-card/definition-entity/actions/persisted-entity/database-footer-action.css +86 -0
- package/src/components/draggable-entity-card/definition-entity/definition-entity-card.css +17 -0
- package/src/components/draggable-entity-card/draggable-entity-card.css +1140 -0
- package/src/components/draggable-entity-card/entity-locked-icon/EntityLockedIcon.tsx +133 -0
- package/src/components/draggable-entity-card/entity-locked-icon/entity-locked.css +8 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/ExpandPropertiesIconButton.tsx +84 -0
- package/src/components/draggable-entity-card/expand-properties-icon-button/expand-properties-icon-button.css +21 -0
- package/src/components/draggable-entity-card/implement-entity-icon/ImplementEntityIcon.tsx +74 -0
- package/src/components/draggable-entity-card/implement-entity-icon/implement-entity-icon.css +13 -0
- package/src/components/draggable-entity-card/logic-error/LogicErrorIconMenu.tsx +424 -0
- package/src/components/draggable-entity-card/logic-error/logic-error.css +23 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewCardInputButton.tsx +193 -0
- package/src/components/draggable-entity-card/new-card-input-button/NewDynamicInputButton.tsx +214 -0
- package/src/components/draggable-entity-card/new-card-input-button/new-card-input-button.css +71 -0
- package/src/components/draggable-entity-card/new-card-output-button/NewCardOutputButton.tsx +192 -0
- package/src/components/draggable-entity-card/new-card-output-button/new-card-output-button.css +71 -0
- package/src/components/draggable-entity-card/termination-statement/TerminationStatementCard.tsx +1543 -0
- package/src/components/draggable-entity-card/termination-statement/termination-statement-card.css +17 -0
- package/src/components/draggable-entity-card/test-entity-button.css +55 -0
- package/src/components/draggable-entity-card/test-menu.css +181 -0
- package/src/components/draggable-entity-card/unreachable-marker.css +43 -0
- package/src/components/draggable-entity-card/variable-scope-marker.css +22 -0
- package/src/components/dynamic-value/DynamicValue.tsx +2395 -0
- package/src/components/dynamic-value/DynamicValueEntry.tsx +1957 -0
- package/src/components/dynamic-value/dynamic-value.css +230 -0
- package/src/components/editor/ElyxMonacoEditor.tsx +38 -0
- package/src/components/entity-error/EntityErrorListItem.tsx +47 -0
- package/src/components/entity-error/entity-error.css +198 -0
- package/src/components/entity-icon/EntityIcon.tsx +292 -0
- package/src/components/entity-icon/entity-icon.css +39 -0
- package/src/components/gallery-card/CreateNewProject.tsx +222 -0
- package/src/components/gallery-card/GalleryCard.tsx +171 -0
- package/src/components/gallery-card/MarketplaceCard.tsx +87 -0
- package/src/components/gallery-card/ProjectDuplicationCard.tsx +575 -0
- package/src/components/gallery-card/gallery-card.css +25 -0
- package/src/components/notifications/NotificationsIconButton.tsx +124 -0
- package/src/components/notifications/NotificationsPanel.tsx +385 -0
- package/src/components/notifications/notifications.css +189 -0
- package/src/components/online-users/LocalOnlineUsers.tsx +175 -0
- package/src/components/online-users/PageOnlineUsers.tsx +297 -0
- package/src/components/online-users/online-users.css +72 -0
- package/src/components/page-backdrop/PageBackdrop.tsx +8 -0
- package/src/components/page-backdrop/page-backdrop.css +7 -0
- package/src/components/project-configuration/DeleteProjectConfirmationDialog.tsx +134 -0
- package/src/components/project-configuration/ProjectConfigurationDialog.tsx +972 -0
- package/src/components/project-configuration/ProjectDataForm.tsx +121 -0
- package/src/components/project-configuration/UnpublishProjectConfirmationDialog.tsx +162 -0
- package/src/components/project-configuration/project-configuration-content.css +209 -0
- package/src/components/project-name/ProjectName.tsx +2025 -0
- package/src/components/project-name/project-name.css +599 -0
- package/src/components/publishing/Publication.tsx +133 -0
- package/src/components/publishing/history/PublicationHistoryContent.tsx +414 -0
- package/src/components/publishing/history/PublicationHistoryDialog.tsx +234 -0
- package/src/components/publishing/preview/PublicationPreviewDialog.tsx +1158 -0
- package/src/components/publishing/preview/PublishingPriceForecast.tsx +160 -0
- package/src/components/publishing/preview/PublishingResourcesDetails.tsx +91 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceContent.tsx +375 -0
- package/src/components/publishing/publication-sequence/PublishingSequenceDialog.tsx +344 -0
- package/src/components/publishing/publishing-dialog.css +142 -0
- package/src/components/publishing/utils.ts +227 -0
- package/src/components/resources/ResourcesDialog.tsx +591 -0
- package/src/components/resources/UpgradeBanner.tsx +102 -0
- package/src/components/resources/codebase/CodebaseDetails.tsx +156 -0
- package/src/components/resources/cron-job/CronJobsList.tsx +532 -0
- package/src/components/resources/functions/FunctionsList.tsx +454 -0
- package/src/components/resources/http-api/HttpAPI.tsx +566 -0
- package/src/components/resources/http-api/HttpAPIClientModule.tsx +37 -0
- package/src/components/resources/logs/LogsViewer.tsx +768 -0
- package/src/components/resources/query.ts +74 -0
- package/src/components/resources/relational-database/DatabaseTable.tsx +905 -0
- package/src/components/resources/relational-database/RelationalDatabase.tsx +83 -0
- package/src/components/resources/relational-database/RelationalDatabaseSecrets.tsx +361 -0
- package/src/components/resources/resources-dialog.css +74 -0
- package/src/components/test-relational-database/DatabaseTable.tsx +913 -0
- package/src/components/test-relational-database/TestDatabaseDialogContent.tsx +670 -0
- package/src/components/test-relational-database/query.ts +74 -0
- package/src/components/toolbar/ToolBar.tsx +236 -0
- package/src/components/toolbar/toolbar.css +78 -0
- package/src/components/transaction-history/TransactionHistoryDialog.tsx +268 -0
- package/src/components/user/CurrentUserAvatar.tsx +65 -0
- package/src/components/user/UserChip.tsx +62 -0
- package/src/components/user/user.css +39 -0
- package/src/components/user-profile/ChangePasswordForm.tsx +67 -0
- package/src/components/user-profile/OwnUserProfileContent.tsx +665 -0
- package/src/components/user-profile/PublicUserProfileContent.tsx +99 -0
- package/src/components/user-profile/UserDataForm.tsx +75 -0
- package/src/components/user-profile/UserProfileDialog.tsx +110 -0
- package/src/components/user-profile/user-profile-content.css +25 -0
- package/src/config.ts +130 -0
- package/src/globals.d.ts +13 -0
- package/src/index.html +27 -0
- package/src/index.tsx +23 -0
- package/src/lib/badge/Badge.tsx +35 -0
- package/src/lib/badge/badge.css +32 -0
- package/src/lib/button/Button.tsx +129 -0
- package/src/lib/button/button.css +145 -0
- package/src/lib/canvas/canvas-undo-redo.ts +263 -0
- package/src/lib/canvas/defs.ts +170 -0
- package/src/lib/canvas/index.test.ts +189 -0
- package/src/lib/canvas/index.ts +6999 -0
- package/src/lib/canvas/utils.ts +59 -0
- package/src/lib/card/Card.tsx +62 -0
- package/src/lib/card/LoadingCard.tsx +82 -0
- package/src/lib/card/card.css +259 -0
- package/src/lib/chip/Chip.tsx +79 -0
- package/src/lib/chip/chip.css +0 -0
- package/src/lib/dialog/Dialog.tsx +122 -0
- package/src/lib/dialog/SmallDialog.tsx +61 -0
- package/src/lib/dialog/dialog.css +40 -0
- package/src/lib/display-data-structure/index.tsx +21 -0
- package/src/lib/dropdown/CanvasDropdownMenuCard.tsx +68 -0
- package/src/lib/dropdown/CanvasDropdownMenuCardOption.tsx +136 -0
- package/src/lib/dropdown/DropdownButton.tsx +104 -0
- package/src/lib/dropdown/DropdownMenuCard.tsx +324 -0
- package/src/lib/dropdown/DropdownMenuPopup.tsx +27 -0
- package/src/lib/dropdown/dropdown-button.css +76 -0
- package/src/lib/dropdown/dropdown-menu.css +151 -0
- package/src/lib/json-editor/RawJsonEditor.tsx +137 -0
- package/src/lib/json-editor/json-editor.css +35 -0
- package/src/lib/loader/Loader.tsx +120 -0
- package/src/lib/loader/loader.css +38 -0
- package/src/lib/pagination/Pagination.tsx +64 -0
- package/src/lib/popup/CanvasPopupBaseComponent.tsx +103 -0
- package/src/lib/popup/Popup.tsx +243 -0
- package/src/lib/popup/popup.css +16 -0
- package/src/lib/table/RowForm.tsx +301 -0
- package/src/lib/table/Table.tsx +1069 -0
- package/src/lib/table/table.css +249 -0
- package/src/lib/table/types.ts +108 -0
- package/src/lib/text-area/TextArea.tsx +183 -0
- package/src/lib/text-area/text-area.css +156 -0
- package/src/lib/text-field/TextField.tsx +218 -0
- package/src/lib/text-field/index.ts +8 -0
- package/src/lib/text-field/text-field.css +201 -0
- package/src/lib/tooltip/Tooltip.tsx +24 -0
- package/src/lib/tooltip/tooltip.css +17 -0
- package/src/localization/index.ts +47 -0
- package/src/main.css +343 -0
- package/src/pages/Auth.tsx +848 -0
- package/src/pages/Editor.tsx +883 -0
- package/src/pages/ErrorPage.tsx +179 -0
- package/src/pages/Gallery.tsx +1693 -0
- package/src/pages/NewPaymentMethodCallback.tsx +53 -0
- package/src/pages/NotFoundPage.tsx +126 -0
- package/src/pages/PricingPlans.tsx +155 -0
- package/src/pages/auth.css +304 -0
- package/src/pages/gallery.css +421 -0
- package/src/payments/index.ts +187 -0
- package/src/popup-notification/index.ts +90 -0
- package/src/services/database/index.ts +1 -0
- package/src/services/database/utils.ts +1301 -0
- package/src/services/editor/CanvasElement.tsx +2934 -0
- package/src/services/editor/CanvasElementConnectionDeleteButton.ts +204 -0
- package/src/services/editor/CanvasPopup.tsx +749 -0
- package/src/services/editor/EditorService.ts +8157 -0
- package/src/services/editor/area.ts +1312 -0
- package/src/services/editor/connections.ts +1019 -0
- package/src/services/editor/create/condition.ts +25 -0
- package/src/services/editor/create/definition-entity.ts +29 -0
- package/src/services/editor/create/function-call.ts +25 -0
- package/src/services/editor/create/global-event.ts +33 -0
- package/src/services/editor/create/loop.ts +25 -0
- package/src/services/editor/create/operation.ts +30 -0
- package/src/services/editor/create/utils.ts +140 -0
- package/src/services/editor/create/variable-declaration.ts +135 -0
- package/src/services/editor/create/variable-instance.ts +100 -0
- package/src/services/editor/editor-ui-extensions-context.ts +43 -0
- package/src/services/editor/entities-metadata.json +9310 -0
- package/src/services/editor/icons.ts +1093 -0
- package/src/services/editor/index.ts +1 -0
- package/src/services/editor/layout.ts +102 -0
- package/src/services/editor/modules/built-in-function-implementations/base.ts +14 -0
- package/src/services/editor/modules/built-in-function-implementations/create-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/built-in-function-implementations/delete-persisted-entity/index.ts +55 -0
- package/src/services/editor/modules/built-in-function-implementations/index.ts +4 -0
- package/src/services/editor/modules/built-in-function-implementations/update-persisted-entity/index.ts +56 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/get-files.ts +183 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-drives.ts +124 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/list-root-folders.ts +125 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/smart-fetch-document.ts +702 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-drive/upload-document.ts +535 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-gemini/generate-content.ts +193 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/get-emails.ts +586 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/google-mail/send-email.ts +386 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/index.ts +12 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/channels.ts +240 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/messages.ts +210 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/replies.ts +200 -0
- package/src/services/editor/modules/operations-implementations/external-integrations/slack/send-message.ts +177 -0
- package/src/services/editor/modules/operations-implementations/index.ts +1 -0
- package/src/services/editor/modules/search-node-implementation/index.ts +42 -0
- package/src/services/editor/modules/sql-migrations-generation.tsx +1054 -0
- package/src/services/editor/publication/publication.ts +578 -0
- package/src/services/editor/ui.ts +1348 -0
- package/src/services/editor/utils.ts +5868 -0
- package/src/services/editor/value-store.ts +619 -0
- package/src/services/execution/built-in-function-implementations.ts +422 -0
- package/src/services/execution/index.ts +4747 -0
- package/src/services/execution/logic.ts +121 -0
- package/src/services/execution/test-instance.tsx +2296 -0
- package/src/services/execution/utils.ts +33 -0
- package/src/services/execution/value-resolution.test.ts +424 -0
- package/src/services/execution/value-resolution.ts +4087 -0
- package/src/services/integrations/ExternalIntegrationsService.ts +439 -0
- package/src/services/integrations/api.ts +175 -0
- package/src/services/local-relational-database/idb_helper.ts +66 -0
- package/src/services/local-relational-database/index.ts +3308 -0
- package/src/services/local-relational-database/utils.ts +403 -0
- package/src/services/notifications/index.ts +525 -0
- package/src/services/user/index.ts +144 -0
- package/src/setupTests.ts +1 -0
- package/src/socket/socket.ts +248 -0
- package/src/socket/utils.ts +10 -0
- package/src/store/workspace.ts +12 -0
- package/src/theme.ts +19 -0
- package/src/utils/DOM.ts +39 -0
- package/src/utils/date.ts +169 -0
- package/src/utils/index.ts +158 -0
- package/src/utils/react.tsx +679 -0
- package/src/utils/testing.ts +103 -0
|
@@ -0,0 +1,702 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActionDescriptorState,
|
|
3
|
+
OperationState,
|
|
4
|
+
IPrimitiveExecutionResult,
|
|
5
|
+
ExecutionTerminationType,
|
|
6
|
+
DefinitionEntityState,
|
|
7
|
+
IDynamicValue,
|
|
8
|
+
BaseRegisteredExtension,
|
|
9
|
+
ExtensionContextType,
|
|
10
|
+
ExtensionManifest,
|
|
11
|
+
ExtensionPermissions,
|
|
12
|
+
ExtentionPriority,
|
|
13
|
+
IRegisteredExtension,
|
|
14
|
+
DefaultEditorContext,
|
|
15
|
+
DefaultProjectLogicContext,
|
|
16
|
+
getConnectionIdFromDefinitionEntity,
|
|
17
|
+
OperationsImplementation,
|
|
18
|
+
BUILT_IN_FUNCTION_IMPLEMENTATIONS__PREFIX,
|
|
19
|
+
ExternalIntegrationOperations,
|
|
20
|
+
ExternalIntegrationNames,
|
|
21
|
+
} from '@elyx-code/project-logic-tree';
|
|
22
|
+
import { EditorService } from '../../../../EditorService';
|
|
23
|
+
import axios, { AxiosResponse } from 'axios';
|
|
24
|
+
import { editorRuntimeServiceBaseUrl } from '../../../../../integrations/api';
|
|
25
|
+
import { getAccessToken } from '../../../../../../auth';
|
|
26
|
+
import { Logger } from '@elyx-code/common-ts-utils';
|
|
27
|
+
|
|
28
|
+
type SmartMode = 'auto' | 'native' | 'binary' | 'plain-text';
|
|
29
|
+
|
|
30
|
+
type ProxyConfig = {
|
|
31
|
+
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
32
|
+
endpoint: string;
|
|
33
|
+
baseUrlOverride?: string;
|
|
34
|
+
params?: Record<string, string>;
|
|
35
|
+
data?: any;
|
|
36
|
+
headers?: Record<string, string>;
|
|
37
|
+
retries?: number;
|
|
38
|
+
responseType?: 'json' | 'text' | 'arraybuffer';
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export enum GoogleDriveMimeType {
|
|
42
|
+
Audio = 'application/vnd.google-apps.audio',
|
|
43
|
+
Document = 'application/vnd.google-apps.document',
|
|
44
|
+
DriveSdk = 'application/vnd.google-apps.drive-sdk',
|
|
45
|
+
Drawing = 'application/vnd.google-apps.drawing',
|
|
46
|
+
File = 'application/vnd.google-apps.file',
|
|
47
|
+
Folder = 'application/vnd.google-apps.folder',
|
|
48
|
+
Form = 'application/vnd.google-apps.form',
|
|
49
|
+
FusionTable = 'application/vnd.google-apps.fusiontable',
|
|
50
|
+
Jam = 'application/vnd.google-apps.jam',
|
|
51
|
+
MailLayout = 'application/vnd.google-apps.mail-layout',
|
|
52
|
+
Map = 'application/vnd.google-apps.map',
|
|
53
|
+
Photo = 'application/vnd.google-apps.photo',
|
|
54
|
+
Presentation = 'application/vnd.google-apps.presentation',
|
|
55
|
+
Script = 'application/vnd.google-apps.script',
|
|
56
|
+
Shortcut = 'application/vnd.google-apps.shortcut',
|
|
57
|
+
Site = 'application/vnd.google-apps.site',
|
|
58
|
+
Spreadsheet = 'application/vnd.google-apps.spreadsheet',
|
|
59
|
+
Unknown = 'application/vnd.google-apps.unknown',
|
|
60
|
+
Vid = 'application/vnd.google-apps.vid',
|
|
61
|
+
Video = 'application/vnd.google-apps.video',
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type FileMetadata = {
|
|
65
|
+
id: string;
|
|
66
|
+
mimeType: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
size?: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Body shape when Lambda returns inline */
|
|
72
|
+
type ProxyWrapped<T = any> = {
|
|
73
|
+
status: number;
|
|
74
|
+
data: T;
|
|
75
|
+
headers?: Record<string, string>;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** Body shape when Lambda stores payload in S3 */
|
|
79
|
+
type ProxyStoredEnvelope = {
|
|
80
|
+
encoding?: 'utf8' | 'base64' | 'raw';
|
|
81
|
+
headers?: Record<string, string>;
|
|
82
|
+
bytes: number;
|
|
83
|
+
contentEncoding?: 'gzip';
|
|
84
|
+
contentType?: string; // e.g. application/json
|
|
85
|
+
key: string;
|
|
86
|
+
note?: string;
|
|
87
|
+
presignedUrl: string;
|
|
88
|
+
// upstream status might be absent; treat as success if present payload
|
|
89
|
+
status?: number;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
type ProxyBody<T = any> = ProxyWrapped<T> | ProxyStoredEnvelope;
|
|
93
|
+
|
|
94
|
+
function isStoredEnvelopeBody(x: any): x is ProxyStoredEnvelope {
|
|
95
|
+
return !!x && typeof x === 'object' && typeof x.presignedUrl === 'string';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export class OperationsImplementationsGoogleDriveSmartFetchDocumentModule
|
|
99
|
+
extends BaseRegisteredExtension
|
|
100
|
+
implements IRegisteredExtension<OperationsImplementation>
|
|
101
|
+
{
|
|
102
|
+
manifest: ExtensionManifest = {
|
|
103
|
+
id:
|
|
104
|
+
BUILT_IN_FUNCTION_IMPLEMENTATIONS__PREFIX +
|
|
105
|
+
ExternalIntegrationOperations.GoogleDriveSmartFetchDocument,
|
|
106
|
+
version: '1.0.2',
|
|
107
|
+
description:
|
|
108
|
+
'Google Drive: smart fetch document (Docs/Sheets JSON, text, or binary)',
|
|
109
|
+
initPriority: ExtentionPriority.High,
|
|
110
|
+
permissions: [ExtensionPermissions.All],
|
|
111
|
+
contexts: [ExtensionContextType.Editor, ExtensionContextType.Logic],
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
module = {
|
|
115
|
+
init: (contexts: (DefaultEditorContext | DefaultProjectLogicContext)[]) => {
|
|
116
|
+
const projectState = contexts.find(
|
|
117
|
+
(c) => c.contextType === ExtensionContextType.Logic
|
|
118
|
+
) as DefaultProjectLogicContext;
|
|
119
|
+
|
|
120
|
+
if (projectState) {
|
|
121
|
+
const operation = projectState.get(
|
|
122
|
+
ExternalIntegrationOperations.GoogleDriveSmartFetchDocument
|
|
123
|
+
) as ActionDescriptorState;
|
|
124
|
+
if (operation) operation.implementation = this.module.main;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* INPUTS (index):
|
|
130
|
+
* 0 = connection (DefinitionEntityState)
|
|
131
|
+
* 1 = fileId (string)
|
|
132
|
+
* 2 = mode (SmartMode) — optional, defaults to 'auto'
|
|
133
|
+
*
|
|
134
|
+
* OUTPUTS (array order):
|
|
135
|
+
* 0 = kind: 'docs' | 'sheets' | 'text' | 'binary'
|
|
136
|
+
* 1 = mime: string
|
|
137
|
+
* 2 = isBinary: boolean
|
|
138
|
+
* 3 = title: string | null
|
|
139
|
+
* 4 = sizeBytes: number | null
|
|
140
|
+
* 5 = text: string | null
|
|
141
|
+
* 6 = base64: string | null
|
|
142
|
+
* 7 = json: string | null
|
|
143
|
+
* 8 = raw_json: string
|
|
144
|
+
*/
|
|
145
|
+
main: async (
|
|
146
|
+
entity: OperationState,
|
|
147
|
+
_inputs: IDynamicValue[]
|
|
148
|
+
): Promise<IPrimitiveExecutionResult> => {
|
|
149
|
+
try {
|
|
150
|
+
const inputs = _inputs.map(
|
|
151
|
+
(i) => i.value?.valueAsType || i.value?.value
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const connectionEntity = inputs[0] as DefinitionEntityState;
|
|
155
|
+
const fileId = (inputs[1] as string)?.trim();
|
|
156
|
+
const mode = (inputs[2] as SmartMode) || 'auto';
|
|
157
|
+
|
|
158
|
+
if (
|
|
159
|
+
!connectionEntity ||
|
|
160
|
+
!(connectionEntity instanceof DefinitionEntityState)
|
|
161
|
+
) {
|
|
162
|
+
return bail(entity, 'Invalid or missing connection entity');
|
|
163
|
+
}
|
|
164
|
+
if (!fileId) {
|
|
165
|
+
return bail(entity, 'Missing required input: fileId');
|
|
166
|
+
}
|
|
167
|
+
if (!['auto', 'native', 'binary', 'plain-text'].includes(mode)) {
|
|
168
|
+
return bail(entity, `Invalid mode: ${mode}`);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const editor = this.extensionsRegistry.requestContexts(this, [
|
|
172
|
+
ExtensionContextType.Editor,
|
|
173
|
+
])[0] as EditorService;
|
|
174
|
+
|
|
175
|
+
const connectionId =
|
|
176
|
+
getConnectionIdFromDefinitionEntity(connectionEntity);
|
|
177
|
+
const accessToken = await getAccessToken();
|
|
178
|
+
const authHeaders = { Authorization: `Bearer ${accessToken}` };
|
|
179
|
+
|
|
180
|
+
// generic proxy base (POST)
|
|
181
|
+
const genericBaseUrl = `${editorRuntimeServiceBaseUrl}/v1/external-integrations/generic-proxy/${editor.projectId}/${ExternalIntegrationNames['google-drive']}/${connectionId}`;
|
|
182
|
+
|
|
183
|
+
// ---------- helpers ----------
|
|
184
|
+
const proxy = async <T = any>(
|
|
185
|
+
cfg: ProxyConfig
|
|
186
|
+
): Promise<AxiosResponse<ProxyBody<T>>> => {
|
|
187
|
+
return axios.post<ProxyBody<T>>(genericBaseUrl, cfg, {
|
|
188
|
+
headers: authHeaders,
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// Fetch S3 envelope and return as wrapped object for downstream
|
|
193
|
+
const fetchStored = async (
|
|
194
|
+
env: ProxyStoredEnvelope,
|
|
195
|
+
desired: 'json' | 'text' | 'arraybuffer'
|
|
196
|
+
): Promise<any> => {
|
|
197
|
+
const isBinary = desired === 'arraybuffer';
|
|
198
|
+
const r = await axios.get(env.presignedUrl, {
|
|
199
|
+
responseType: isBinary ? 'arraybuffer' : 'text',
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
const contentType =
|
|
203
|
+
env.contentType ||
|
|
204
|
+
(r.headers?.['content-type'] as string) ||
|
|
205
|
+
(r.headers?.['Content-Type'] as string) ||
|
|
206
|
+
'';
|
|
207
|
+
|
|
208
|
+
let data: any;
|
|
209
|
+
if (desired === 'json') {
|
|
210
|
+
const txt =
|
|
211
|
+
typeof r.data === 'string'
|
|
212
|
+
? r.data
|
|
213
|
+
: new TextDecoder().decode(r.data);
|
|
214
|
+
data = JSON.parse(txt);
|
|
215
|
+
} else {
|
|
216
|
+
data = r.data;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
status: 200, // stored path indicates success; upstream status not preserved
|
|
221
|
+
headers: r.headers as any,
|
|
222
|
+
data,
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// Unified unwrap: either returns wrapped body directly, or resolves the S3 envelope
|
|
227
|
+
const unwrap = async <T = any>(
|
|
228
|
+
res: AxiosResponse<ProxyBody<T>>,
|
|
229
|
+
desired: 'json' | 'text' | 'arraybuffer' = 'json'
|
|
230
|
+
): Promise<ProxyWrapped<T>> => {
|
|
231
|
+
const body = res.data;
|
|
232
|
+
|
|
233
|
+
if (isStoredEnvelopeBody(body)) {
|
|
234
|
+
return (await fetchStored(body, desired)) as ProxyWrapped<T>;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return body as ProxyWrapped<T>;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const toArrayBufferFromProxyData = (payload: any): ArrayBuffer => {
|
|
241
|
+
if (payload instanceof ArrayBuffer) return payload;
|
|
242
|
+
if (payload?.buffer instanceof ArrayBuffer) return payload.buffer;
|
|
243
|
+
if (typeof payload === 'string') {
|
|
244
|
+
// assume base64
|
|
245
|
+
const binary = atob(payload);
|
|
246
|
+
const len = binary.length;
|
|
247
|
+
const bytes = new Uint8Array(len);
|
|
248
|
+
for (let i = 0; i < len; i++) bytes[i] = binary.charCodeAt(i);
|
|
249
|
+
return bytes.buffer;
|
|
250
|
+
}
|
|
251
|
+
if (payload?.type === 'Buffer' && Array.isArray(payload?.data)) {
|
|
252
|
+
return new Uint8Array(payload.data).buffer;
|
|
253
|
+
}
|
|
254
|
+
throw new Error('Unexpected binary payload shape from proxy');
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
const toBase64 = (ab: ArrayBuffer): string => {
|
|
258
|
+
const bytes = new Uint8Array(ab);
|
|
259
|
+
const chunk = 0x8000;
|
|
260
|
+
let binary = '';
|
|
261
|
+
for (let i = 0; i < bytes.length; i += chunk) {
|
|
262
|
+
binary += String.fromCharCode.apply(
|
|
263
|
+
null,
|
|
264
|
+
Array.from(bytes.subarray(i, i + chunk)) as unknown as number[]
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
return btoa(binary);
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const uint8ToUtf8 = (ab: ArrayBuffer): string => {
|
|
271
|
+
return new TextDecoder('utf-8', { fatal: false }).decode(
|
|
272
|
+
new Uint8Array(ab)
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const headerGet = (h: Record<string, any> | undefined, key: string) => {
|
|
277
|
+
if (!h) return '';
|
|
278
|
+
const found =
|
|
279
|
+
h[key] ??
|
|
280
|
+
h[String(key).toLowerCase()] ??
|
|
281
|
+
Object.entries(h).find(
|
|
282
|
+
([k]) => k.toLowerCase() === key.toLowerCase()
|
|
283
|
+
)?.[1];
|
|
284
|
+
return (found as string) || '';
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const isTextual = (ct?: string) => {
|
|
288
|
+
if (!ct) return false;
|
|
289
|
+
const lower = ct.toLowerCase();
|
|
290
|
+
return (
|
|
291
|
+
lower.startsWith('text/') ||
|
|
292
|
+
lower.includes('json') ||
|
|
293
|
+
lower.includes('xml') ||
|
|
294
|
+
lower.includes('javascript') ||
|
|
295
|
+
lower.includes('csv')
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// 1) Metadata (Drive via www.googleapis.com)
|
|
300
|
+
const metaWrapped = await unwrap<FileMetadata>(
|
|
301
|
+
await proxy<FileMetadata>({
|
|
302
|
+
method: 'GET',
|
|
303
|
+
endpoint: `/drive/v3/files/${encodeURIComponent(fileId)}`,
|
|
304
|
+
params: {
|
|
305
|
+
fields: 'id,name,mimeType,size',
|
|
306
|
+
supportsAllDrives: 'true',
|
|
307
|
+
},
|
|
308
|
+
retries: 3,
|
|
309
|
+
}),
|
|
310
|
+
'json'
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
if (!metaWrapped?.data?.id || !metaWrapped?.data?.mimeType) {
|
|
314
|
+
return bail(
|
|
315
|
+
entity,
|
|
316
|
+
`Failed to retrieve file metadata (status=${
|
|
317
|
+
metaWrapped?.status ?? 'n/a'
|
|
318
|
+
})`
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const file = metaWrapped.data;
|
|
323
|
+
const mimeType: string = file.mimeType;
|
|
324
|
+
const title: string | null = file.name ?? null;
|
|
325
|
+
const sizeBytes: number | null = file.size ? Number(file.size) : null;
|
|
326
|
+
|
|
327
|
+
const isDocs =
|
|
328
|
+
mimeType === GoogleDriveMimeType.Document ||
|
|
329
|
+
mimeType === 'application/vnd.google-apps.document';
|
|
330
|
+
const isSheets =
|
|
331
|
+
mimeType === GoogleDriveMimeType.Spreadsheet ||
|
|
332
|
+
mimeType === 'application/vnd.google-apps.spreadsheet';
|
|
333
|
+
const isGoogleNative = mimeType?.startsWith(
|
|
334
|
+
'application/vnd.google-apps.'
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
// Prepare outputs
|
|
338
|
+
let outKind: 'docs' | 'sheets' | 'text' | 'binary';
|
|
339
|
+
let outMime = '';
|
|
340
|
+
let outIsBinary = false;
|
|
341
|
+
let outText: string | null = null;
|
|
342
|
+
let outBase64: string | null = null;
|
|
343
|
+
let outJson: string | null = null;
|
|
344
|
+
|
|
345
|
+
const raw: any = {
|
|
346
|
+
metadata: file,
|
|
347
|
+
modeRequested: mode,
|
|
348
|
+
modeResolved: null as null | string,
|
|
349
|
+
source: null as null | 'drive' | 'docs' | 'sheets',
|
|
350
|
+
exportMimeType: null as null | string,
|
|
351
|
+
note: null as null | string,
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
// 2) Mode routing
|
|
355
|
+
if (mode === 'auto') {
|
|
356
|
+
if (isDocs) {
|
|
357
|
+
const wrapped = await unwrap<any>(
|
|
358
|
+
await proxy<any>({
|
|
359
|
+
method: 'GET',
|
|
360
|
+
baseUrlOverride: 'https://docs.googleapis.com',
|
|
361
|
+
endpoint: `/v1/documents/${encodeURIComponent(fileId)}`,
|
|
362
|
+
params: { includeTabsContent: 'true' },
|
|
363
|
+
retries: 3,
|
|
364
|
+
}),
|
|
365
|
+
'json'
|
|
366
|
+
);
|
|
367
|
+
if (wrapped.status !== 200) {
|
|
368
|
+
return bail(entity, `Docs API failed (status=${wrapped.status})`);
|
|
369
|
+
}
|
|
370
|
+
outKind = 'docs';
|
|
371
|
+
outMime = 'application/json';
|
|
372
|
+
outIsBinary = false;
|
|
373
|
+
outJson = JSON.stringify(wrapped.data);
|
|
374
|
+
raw.modeResolved = 'native';
|
|
375
|
+
raw.source = 'docs';
|
|
376
|
+
} else if (isSheets) {
|
|
377
|
+
const wrapped = await unwrap<any>(
|
|
378
|
+
await proxy<any>({
|
|
379
|
+
method: 'GET',
|
|
380
|
+
baseUrlOverride: 'https://sheets.googleapis.com',
|
|
381
|
+
endpoint: `/v4/spreadsheets/${encodeURIComponent(fileId)}`,
|
|
382
|
+
params: { includeGridData: 'true' },
|
|
383
|
+
retries: 3,
|
|
384
|
+
}),
|
|
385
|
+
'json'
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
if (wrapped.status !== 200) {
|
|
389
|
+
return bail(
|
|
390
|
+
entity,
|
|
391
|
+
`Sheets API failed (status=${wrapped.status})`
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
outKind = 'sheets';
|
|
395
|
+
outMime = 'application/json';
|
|
396
|
+
outIsBinary = false;
|
|
397
|
+
|
|
398
|
+
outJson = JSON.stringify(wrapped.data);
|
|
399
|
+
|
|
400
|
+
raw.modeResolved = 'native';
|
|
401
|
+
raw.source = 'sheets';
|
|
402
|
+
} else {
|
|
403
|
+
const wrapped = await unwrap<any>(
|
|
404
|
+
await proxy<any>({
|
|
405
|
+
method: 'GET',
|
|
406
|
+
endpoint: `/drive/v3/files/${encodeURIComponent(fileId)}`,
|
|
407
|
+
params: { alt: 'media' },
|
|
408
|
+
responseType: 'arraybuffer',
|
|
409
|
+
retries: 3,
|
|
410
|
+
}),
|
|
411
|
+
'arraybuffer'
|
|
412
|
+
);
|
|
413
|
+
if (wrapped.status !== 200) {
|
|
414
|
+
return bail(
|
|
415
|
+
entity,
|
|
416
|
+
`Drive media fetch failed (status=${wrapped.status})`
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
const ct = headerGet(wrapped.headers, 'content-type');
|
|
420
|
+
const buf = toArrayBufferFromProxyData(wrapped.data);
|
|
421
|
+
if (isTextual(ct)) {
|
|
422
|
+
outKind = 'text';
|
|
423
|
+
outMime = ct || 'text/plain';
|
|
424
|
+
outIsBinary = false;
|
|
425
|
+
outText = uint8ToUtf8(buf);
|
|
426
|
+
raw.modeResolved = 'plain-text';
|
|
427
|
+
raw.source = 'drive';
|
|
428
|
+
} else {
|
|
429
|
+
outKind = 'binary';
|
|
430
|
+
outMime = ct || 'application/octet-stream';
|
|
431
|
+
outIsBinary = true;
|
|
432
|
+
outBase64 = toBase64(buf);
|
|
433
|
+
raw.modeResolved = 'binary';
|
|
434
|
+
raw.source = 'drive';
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
} else if (mode === 'native') {
|
|
438
|
+
if (isDocs) {
|
|
439
|
+
const wrapped = await unwrap<any>(
|
|
440
|
+
await proxy<any>({
|
|
441
|
+
method: 'GET',
|
|
442
|
+
baseUrlOverride: 'https://docs.googleapis.com',
|
|
443
|
+
endpoint: `/v1/documents/${encodeURIComponent(fileId)}`,
|
|
444
|
+
params: { includeTabsContent: 'true' },
|
|
445
|
+
retries: 3,
|
|
446
|
+
}),
|
|
447
|
+
'json'
|
|
448
|
+
);
|
|
449
|
+
if (wrapped.status !== 200) {
|
|
450
|
+
return bail(entity, `Docs API failed (status=${wrapped.status})`);
|
|
451
|
+
}
|
|
452
|
+
outKind = 'docs';
|
|
453
|
+
outMime = 'application/json';
|
|
454
|
+
outIsBinary = false;
|
|
455
|
+
outJson = JSON.stringify(wrapped.data);
|
|
456
|
+
raw.modeResolved = 'native';
|
|
457
|
+
raw.source = 'docs';
|
|
458
|
+
} else if (isSheets) {
|
|
459
|
+
const wrapped = await unwrap<any>(
|
|
460
|
+
await proxy<any>({
|
|
461
|
+
method: 'GET',
|
|
462
|
+
baseUrlOverride: 'https://sheets.googleapis.com',
|
|
463
|
+
endpoint: `/v4/spreadsheets/${encodeURIComponent(fileId)}`,
|
|
464
|
+
params: { includeGridData: 'true' },
|
|
465
|
+
retries: 3,
|
|
466
|
+
}),
|
|
467
|
+
'json'
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
if (wrapped.status !== 200) {
|
|
471
|
+
return bail(
|
|
472
|
+
entity,
|
|
473
|
+
`Sheets API failed (status=${wrapped.status})`
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
outKind = 'sheets';
|
|
477
|
+
outMime = 'application/json';
|
|
478
|
+
outIsBinary = false;
|
|
479
|
+
|
|
480
|
+
outJson = JSON.stringify(wrapped.data);
|
|
481
|
+
|
|
482
|
+
raw.modeResolved = 'native';
|
|
483
|
+
raw.source = 'sheets';
|
|
484
|
+
} else {
|
|
485
|
+
return bail(
|
|
486
|
+
entity,
|
|
487
|
+
`mode=native is not supported for mimeType=${mimeType}. Try 'binary' or 'plain-text'.`
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
} else if (mode === 'plain-text') {
|
|
491
|
+
if (isDocs) {
|
|
492
|
+
const wrapped = await unwrap<string>(
|
|
493
|
+
await proxy<string>({
|
|
494
|
+
method: 'GET',
|
|
495
|
+
endpoint: `/drive/v3/files/${encodeURIComponent(
|
|
496
|
+
fileId
|
|
497
|
+
)}/export`,
|
|
498
|
+
params: { mimeType: 'text/plain' },
|
|
499
|
+
responseType: 'text',
|
|
500
|
+
retries: 3,
|
|
501
|
+
}),
|
|
502
|
+
'text'
|
|
503
|
+
);
|
|
504
|
+
if (wrapped.status !== 200) {
|
|
505
|
+
return bail(
|
|
506
|
+
entity,
|
|
507
|
+
`Drive export (text) failed (status=${wrapped.status})`
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
outKind = 'text';
|
|
511
|
+
outMime = 'text/plain';
|
|
512
|
+
outIsBinary = false;
|
|
513
|
+
outText = wrapped.data ?? '';
|
|
514
|
+
raw.modeResolved = 'plain-text';
|
|
515
|
+
raw.source = 'drive';
|
|
516
|
+
} else if (isSheets) {
|
|
517
|
+
const wrapped = await unwrap<string>(
|
|
518
|
+
await proxy<string>({
|
|
519
|
+
method: 'GET',
|
|
520
|
+
endpoint: `/drive/v3/files/${encodeURIComponent(
|
|
521
|
+
fileId
|
|
522
|
+
)}/export`,
|
|
523
|
+
params: { mimeType: 'text/csv' },
|
|
524
|
+
responseType: 'text',
|
|
525
|
+
retries: 3,
|
|
526
|
+
}),
|
|
527
|
+
'text'
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
if (wrapped.status !== 200) {
|
|
531
|
+
return bail(
|
|
532
|
+
entity,
|
|
533
|
+
`Drive export (csv) failed (status=${wrapped.status})`
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
outKind = 'text';
|
|
537
|
+
outMime = 'text/csv';
|
|
538
|
+
outIsBinary = false;
|
|
539
|
+
|
|
540
|
+
outText = wrapped.data ?? '';
|
|
541
|
+
|
|
542
|
+
raw.modeResolved = 'plain-text';
|
|
543
|
+
raw.source = 'drive';
|
|
544
|
+
raw.note = 'Sheets CSV export returns only the first sheet.';
|
|
545
|
+
} else {
|
|
546
|
+
const wrapped = await unwrap<any>(
|
|
547
|
+
await proxy<any>({
|
|
548
|
+
method: 'GET',
|
|
549
|
+
endpoint: `/drive/v3/files/${encodeURIComponent(fileId)}`,
|
|
550
|
+
params: { alt: 'media' },
|
|
551
|
+
responseType: 'arraybuffer',
|
|
552
|
+
retries: 3,
|
|
553
|
+
}),
|
|
554
|
+
'arraybuffer'
|
|
555
|
+
);
|
|
556
|
+
if (wrapped.status !== 200) {
|
|
557
|
+
return bail(
|
|
558
|
+
entity,
|
|
559
|
+
`Drive media fetch failed (status=${wrapped.status})`
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
const ct = headerGet(wrapped.headers, 'content-type');
|
|
563
|
+
if (!isTextual(ct)) {
|
|
564
|
+
return bail(
|
|
565
|
+
entity,
|
|
566
|
+
`mode=plain-text not supported for mimeType=${mimeType} (content-type=${ct}).`
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
const buf = toArrayBufferFromProxyData(wrapped.data);
|
|
570
|
+
outKind = 'text';
|
|
571
|
+
outMime = ct || 'text/plain';
|
|
572
|
+
outIsBinary = false;
|
|
573
|
+
outText = uint8ToUtf8(buf);
|
|
574
|
+
raw.modeResolved = 'plain-text';
|
|
575
|
+
raw.source = 'drive';
|
|
576
|
+
}
|
|
577
|
+
} else if (mode === 'binary') {
|
|
578
|
+
if (isGoogleNative) {
|
|
579
|
+
const exportMime = 'application/pdf';
|
|
580
|
+
const wrapped = await unwrap<any>(
|
|
581
|
+
await proxy<any>({
|
|
582
|
+
method: 'GET',
|
|
583
|
+
endpoint: `/drive/v3/files/${encodeURIComponent(
|
|
584
|
+
fileId
|
|
585
|
+
)}/export`,
|
|
586
|
+
params: { mimeType: exportMime },
|
|
587
|
+
responseType: 'arraybuffer',
|
|
588
|
+
retries: 3,
|
|
589
|
+
}),
|
|
590
|
+
'arraybuffer'
|
|
591
|
+
);
|
|
592
|
+
if (wrapped.status !== 200) {
|
|
593
|
+
return bail(
|
|
594
|
+
entity,
|
|
595
|
+
`Drive export (pdf) failed (status=${wrapped.status})`
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
const buf = toArrayBufferFromProxyData(wrapped.data);
|
|
599
|
+
outKind = 'binary';
|
|
600
|
+
outMime = exportMime;
|
|
601
|
+
outIsBinary = true;
|
|
602
|
+
outBase64 = toBase64(buf);
|
|
603
|
+
raw.modeResolved = 'binary';
|
|
604
|
+
raw.source = 'drive';
|
|
605
|
+
raw.exportMimeType = exportMime;
|
|
606
|
+
} else {
|
|
607
|
+
const wrapped = await unwrap<any>(
|
|
608
|
+
await proxy<any>({
|
|
609
|
+
method: 'GET',
|
|
610
|
+
endpoint: `/drive/v3/files/${encodeURIComponent(fileId)}`,
|
|
611
|
+
params: { alt: 'media' },
|
|
612
|
+
responseType: 'arraybuffer',
|
|
613
|
+
retries: 3,
|
|
614
|
+
}),
|
|
615
|
+
'arraybuffer'
|
|
616
|
+
);
|
|
617
|
+
if (wrapped.status !== 200) {
|
|
618
|
+
return bail(
|
|
619
|
+
entity,
|
|
620
|
+
`Drive media fetch failed (status=${wrapped.status})`
|
|
621
|
+
);
|
|
622
|
+
}
|
|
623
|
+
const ct =
|
|
624
|
+
headerGet(wrapped.headers, 'content-type') ||
|
|
625
|
+
'application/octet-stream';
|
|
626
|
+
const buf = toArrayBufferFromProxyData(wrapped.data);
|
|
627
|
+
outKind = 'binary';
|
|
628
|
+
outMime = ct;
|
|
629
|
+
outIsBinary = true;
|
|
630
|
+
outBase64 = toBase64(buf);
|
|
631
|
+
raw.modeResolved = 'binary';
|
|
632
|
+
raw.source = 'drive';
|
|
633
|
+
}
|
|
634
|
+
} else {
|
|
635
|
+
throw new Error(`Unsupported mode: ${mode}`);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
if (!outMime)
|
|
639
|
+
outMime =
|
|
640
|
+
isDocs || isSheets
|
|
641
|
+
? 'application/json'
|
|
642
|
+
: 'application/octet-stream';
|
|
643
|
+
|
|
644
|
+
const raw_json = JSON.stringify(raw);
|
|
645
|
+
|
|
646
|
+
if (!!outJson && typeof outJson === 'string') {
|
|
647
|
+
const parsed = JSON.parse(outJson);
|
|
648
|
+
outJson = parsed;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
return {
|
|
652
|
+
value: ExecutionTerminationType.Success,
|
|
653
|
+
error: null,
|
|
654
|
+
result: {
|
|
655
|
+
kind: outKind,
|
|
656
|
+
mime: outMime,
|
|
657
|
+
isBinary: outIsBinary,
|
|
658
|
+
title,
|
|
659
|
+
sizeBytes,
|
|
660
|
+
text: outText,
|
|
661
|
+
base64: outBase64,
|
|
662
|
+
json: outJson,
|
|
663
|
+
raw_json,
|
|
664
|
+
},
|
|
665
|
+
};
|
|
666
|
+
} catch (e: any) {
|
|
667
|
+
const msg = String(e?.message || e);
|
|
668
|
+
const hint =
|
|
669
|
+
msg.toLowerCase().includes('insufficient') ||
|
|
670
|
+
msg.toLowerCase().includes('forbidden')
|
|
671
|
+
? ' (Hint: mode=native requires Docs/Sheets read scopes in addition to Drive, and access to the file.)'
|
|
672
|
+
: '';
|
|
673
|
+
Logger.error('[Google Drive] Smart fetch error:', e);
|
|
674
|
+
|
|
675
|
+
return {
|
|
676
|
+
value:
|
|
677
|
+
entity.catchesError || entity.errorCalls.length
|
|
678
|
+
? ExecutionTerminationType.CaughtError
|
|
679
|
+
: ExecutionTerminationType.UnhandledError,
|
|
680
|
+
error: msg + hint,
|
|
681
|
+
result: null,
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/** small helper for uniform error returns */
|
|
689
|
+
function bail(
|
|
690
|
+
entity: OperationState,
|
|
691
|
+
message: string
|
|
692
|
+
): IPrimitiveExecutionResult {
|
|
693
|
+
Logger.log('[Google Drive] Smart fetch error:', message);
|
|
694
|
+
return {
|
|
695
|
+
value:
|
|
696
|
+
entity.catchesError || entity.errorCalls.length
|
|
697
|
+
? ExecutionTerminationType.CaughtError
|
|
698
|
+
: ExecutionTerminationType.UnhandledError,
|
|
699
|
+
error: message,
|
|
700
|
+
result: null,
|
|
701
|
+
};
|
|
702
|
+
}
|