@foxtware/mineral 0.1.14 → 0.1.16
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/.creds.yml.sample +34 -0
- package/AGENTS.md +5 -0
- package/_build_scripts/createNewFunction.js +19 -19
- package/api/_example.js +6 -3
- package/api/_tools/log.js +22 -0
- package/api/algolia/docs.md +7 -0
- package/api/asana/asana.constants.js +7 -0
- package/api/asana/asana.utils.js +37 -0
- package/api/asana/asanaGet.js +150 -0
- package/api/asana/docs.md +5 -0
- package/api/athos/docs.md +9 -0
- package/api/bleckmann/bleckmannAsnsGet.js +3 -1
- package/api/clickup/clickup.constants.js +7 -0
- package/api/clickup/clickup.utils.js +36 -0
- package/api/clickup/clickupGet.js +150 -0
- package/api/clickup/docs.md +6 -0
- package/api/discord/discord.constants.js +7 -0
- package/api/discord/discord.utils.js +36 -0
- package/api/discord/discordGet.js +144 -0
- package/api/discord/docs.md +6 -0
- package/api/etsy/_example.get.js +68 -0
- package/api/etsy/etsy.constants.js +33 -0
- package/api/etsy/etsy.utils.js +208 -0
- package/api/etsy/etsyAccessTokenRefresh.js +106 -0
- package/api/etsy/etsyAccessTokenRequest.js +118 -0
- package/api/etsy/etsyAllListingFilesGet.js +69 -0
- package/api/etsy/etsyAllListingsGetActive.js +88 -0
- package/api/etsy/etsyAuthorizationCodeRequest.js +124 -0
- package/api/etsy/etsyBuyerTaxonomyNodePropertiesGet.js +62 -0
- package/api/etsy/etsyBuyerTaxonomyNodesGet.js +58 -0
- package/api/etsy/etsyDraftListingCreate.js +71 -0
- package/api/etsy/etsyFeaturedListingsByShopGet.js +78 -0
- package/api/etsy/etsyGet.js +150 -0
- package/api/etsy/etsyHolidayPreferencesGet.js +65 -0
- package/api/etsy/etsyHolidayPreferencesUpdate.js +75 -0
- package/api/etsy/etsyListingDelete.js +61 -0
- package/api/etsy/etsyListingFileDelete.js +72 -0
- package/api/etsy/etsyListingFileGet.js +73 -0
- package/api/etsy/etsyListingGet.js +62 -0
- package/api/etsy/etsyListingImageDelete.js +72 -0
- package/api/etsy/etsyListingImageGet.js +66 -0
- package/api/etsy/etsyListingImagesGet.js +62 -0
- package/api/etsy/etsyListingInventoryGet.js +62 -0
- package/api/etsy/etsyListingInventoryUpdate.js +99 -0
- package/api/etsy/etsyListingOfferingGet.js +70 -0
- package/api/etsy/etsyListingPersonalizationDelete.js +68 -0
- package/api/etsy/etsyListingPersonalizationGet.js +62 -0
- package/api/etsy/etsyListingPersonalizationUpdate.js +75 -0
- package/api/etsy/etsyListingProductGet.js +64 -0
- package/api/etsy/etsyListingPropertiesGet.js +69 -0
- package/api/etsy/etsyListingPropertyDelete.js +72 -0
- package/api/etsy/etsyListingPropertyGet.js +66 -0
- package/api/etsy/etsyListingPropertyUpdate.js +79 -0
- package/api/etsy/etsyListingTranslationCreate.js +79 -0
- package/api/etsy/etsyListingTranslationGet.js +73 -0
- package/api/etsy/etsyListingTranslationUpdate.js +79 -0
- package/api/etsy/etsyListingUpdate.js +75 -0
- package/api/etsy/etsyListingVariationImagesGet.js +69 -0
- package/api/etsy/etsyListingVideoDelete.js +72 -0
- package/api/etsy/etsyListingVideoGet.js +66 -0
- package/api/etsy/etsyListingVideosGet.js +62 -0
- package/api/etsy/etsyListingsByListingIdsGet.js +63 -0
- package/api/etsy/etsyListingsByShopReceiptGet.js +82 -0
- package/api/etsy/etsyListingsByShopReturnPolicyGet.js +69 -0
- package/api/etsy/etsyListingsInventoryByListingIdsGet.js +63 -0
- package/api/etsy/etsyListingsShippingByListingIdsGet.js +63 -0
- package/api/etsy/etsyMeGet.js +56 -0
- package/api/etsy/etsyOauthRedirectParse.js +201 -0
- package/api/etsy/etsyPaymentAccountLedgerEntryPaymentsGet.js +65 -0
- package/api/etsy/etsyPaymentsGet.js +65 -0
- package/api/etsy/etsyPing.js +51 -0
- package/api/etsy/etsyReceiptShipmentCreate.js +75 -0
- package/api/etsy/etsyReviewsByListingGet.js +76 -0
- package/api/etsy/etsyReviewsByShopGet.js +80 -0
- package/api/etsy/etsySellerTaxonomyNodePropertiesGet.js +62 -0
- package/api/etsy/etsySellerTaxonomyNodesGet.js +58 -0
- package/api/etsy/etsyShippingCarriersGet.js +63 -0
- package/api/etsy/etsyShopGet.js +65 -0
- package/api/etsy/etsyShopListingsActiveGet.js +82 -0
- package/api/etsy/etsyShopListingsGet.js +87 -0
- package/api/etsy/etsyShopPaymentAccountLedgerEntriesGet.js +80 -0
- package/api/etsy/etsyShopPaymentAccountLedgerEntryGet.js +69 -0
- package/api/etsy/etsyShopPaymentByReceiptIdGet.js +69 -0
- package/api/etsy/etsyShopProductionPartnersGet.js +65 -0
- package/api/etsy/etsyShopReadinessStateDefinitionCreate.js +71 -0
- package/api/etsy/etsyShopReadinessStateDefinitionDelete.js +68 -0
- package/api/etsy/etsyShopReadinessStateDefinitionGet.js +69 -0
- package/api/etsy/etsyShopReadinessStateDefinitionUpdate.js +75 -0
- package/api/etsy/etsyShopReadinessStateDefinitionsGet.js +78 -0
- package/api/etsy/etsyShopReceiptGet.js +67 -0
- package/api/etsy/etsyShopReceiptTransactionGet.js +69 -0
- package/api/etsy/etsyShopReceiptTransactionsByListingGet.js +82 -0
- package/api/etsy/etsyShopReceiptTransactionsByReceiptGet.js +69 -0
- package/api/etsy/etsyShopReceiptTransactionsByShopGet.js +78 -0
- package/api/etsy/etsyShopReceiptUpdate.js +75 -0
- package/api/etsy/etsyShopReceiptsGet.js +70 -0
- package/api/etsy/etsyShopReturnPoliciesConsolidate.js +75 -0
- package/api/etsy/etsyShopReturnPolicyCreate.js +71 -0
- package/api/etsy/etsyShopReturnPolicyDelete.js +68 -0
- package/api/etsy/etsyShopReturnPolicyGet.js +69 -0
- package/api/etsy/etsyShopReturnPolicyUpdate.js +75 -0
- package/api/etsy/etsyShopReturnsPoliciesGet.js +70 -0
- package/api/etsy/etsyShopSectionCreate.js +71 -0
- package/api/etsy/etsyShopSectionDelete.js +68 -0
- package/api/etsy/etsyShopSectionGet.js +69 -0
- package/api/etsy/etsyShopSectionListingsGet.js +86 -0
- package/api/etsy/etsyShopSectionUpdate.js +75 -0
- package/api/etsy/etsyShopSectionsGet.js +65 -0
- package/api/etsy/etsyShopShippingProfileCreate.js +71 -0
- package/api/etsy/etsyShopShippingProfileDelete.js +68 -0
- package/api/etsy/etsyShopShippingProfileDestinationCreate.js +75 -0
- package/api/etsy/etsyShopShippingProfileDestinationDelete.js +72 -0
- package/api/etsy/etsyShopShippingProfileDestinationUpdate.js +79 -0
- package/api/etsy/etsyShopShippingProfileDestinationsByShippingProfileGet.js +82 -0
- package/api/etsy/etsyShopShippingProfileGet.js +69 -0
- package/api/etsy/etsyShopShippingProfileUpdate.js +75 -0
- package/api/etsy/etsyShopShippingProfileUpgradeCreate.js +75 -0
- package/api/etsy/etsyShopShippingProfileUpgradeDelete.js +72 -0
- package/api/etsy/etsyShopShippingProfileUpgradeUpdate.js +79 -0
- package/api/etsy/etsyShopShippingProfileUpgradesGet.js +69 -0
- package/api/etsy/etsyShopShippingProfilesGet.js +65 -0
- package/api/etsy/etsyShopUpdate.js +69 -0
- package/api/etsy/etsyShopsGet.js +70 -0
- package/api/etsy/etsyTokenScopes.js +63 -0
- package/api/etsy/etsyUserAddressDelete.js +61 -0
- package/api/etsy/etsyUserAddressGet.js +62 -0
- package/api/etsy/etsyUserAddressesGet.js +70 -0
- package/api/etsy/etsyUserGet.js +62 -0
- package/api/etsy/etsyUserShopsGet.js +62 -0
- package/api/etsy/etsyVariationImagesUpdate.js +75 -0
- package/api/figma/docs.md +6 -0
- package/api/figma/figma.constants.js +7 -0
- package/api/figma/figma.utils.js +36 -0
- package/api/figma/figmaGet.js +107 -0
- package/api/github/githubReposGet.js +3 -1
- package/api/github/githubUserGet.js +3 -1
- package/api/google/docs.md +7 -0
- package/api/google/google.constants.js +9 -0
- package/api/google/google.utils.js +137 -0
- package/api/google/googlecalendarCalendarsGet.js +54 -0
- package/api/google/googlecalendarEventCreate.js +63 -0
- package/api/google/googlecalendarEventDelete.js +55 -0
- package/api/google/googlecalendarEventGet.js +55 -0
- package/api/google/googlecalendarEventsGet.js +65 -0
- package/api/google/googledriveFileDelete.js +53 -0
- package/api/google/googledriveFileGet.js +57 -0
- package/api/google/googledriveFileUpload.js +127 -0
- package/api/google/googledriveFilesGet.js +72 -0
- package/api/google/googlesheetsSpreadsheetGet.js +57 -0
- package/api/google/googlesheetsSpreadsheetSheetAdd.js +150 -0
- package/api/google/googlesheetsSpreadsheetSheetGetData.js +159 -0
- package/api/google/googlesheetsSpreadsheetTrim.js +239 -0
- package/api/gorgias/docs.md +7 -0
- package/api/logiwa/logiwaAuthGet.js +3 -1
- package/api/logiwa/logiwaInventoriesGet.js +3 -1
- package/api/logiwa/logiwaOrdersGet.js +3 -1
- package/api/logiwa/logiwaProductsGet.js +3 -1
- package/api/logiwa/logiwaReportGetInventorySnapshot.js +3 -1
- package/api/logiwa/logiwaReportGetTotalInventory.js +3 -1
- package/api/logiwa/logiwaWebhooksGet.js +3 -1
- package/api/loop/loopAllowlistItemsGet.js +3 -1
- package/api/loop/loopBlocklistItemsGet.js +3 -1
- package/api/loop/loopDestinationsGet.js +3 -1
- package/api/loop/loopReturnsGet.js +3 -1
- package/api/notion/docs.md +6 -0
- package/api/notion/notion.constants.js +9 -0
- package/api/notion/notion.utils.js +44 -0
- package/api/notion/notionGet.js +146 -0
- package/api/peoplevox/_example.js +4 -1
- package/api/peoplevox/peoplevox.sessions.js +29 -0
- package/api/peoplevox/peoplevox.utils.js +4 -38
- package/api/peoplevox/peoplevoxAuthGet.js +3 -1
- package/api/peoplevox/peoplevoxGetSingle.js +4 -2
- package/api/peoplevox/peoplevoxOrderEdit.js +8 -2
- package/api/peoplevox/peoplevoxOrderGet.js +6 -1
- package/api/peoplevox/peoplevoxReportGet.js +6 -2
- package/api/pipe17/docs.md +8 -0
- package/api/pipe17/pipe17.constants.js +47 -0
- package/api/pipe17/pipe17.utils.js +123 -0
- package/api/pipe17/pipe17ArrivalGet.js +78 -0
- package/api/pipe17/pipe17ArrivalUpdate.js +111 -0
- package/api/pipe17/pipe17ArrivalsGet.js +54 -0
- package/api/pipe17/pipe17FulfillmentGet.js +69 -0
- package/api/pipe17/pipe17FulfillmentsGet.js +54 -0
- package/api/pipe17/pipe17Get.js +151 -0
- package/api/pipe17/pipe17InventoryItemGet.js +57 -0
- package/api/pipe17/pipe17InventoryItemsGet.js +54 -0
- package/api/pipe17/pipe17JobCreate.js +95 -0
- package/api/pipe17/pipe17JobGet.js +70 -0
- package/api/pipe17/pipe17JobResultsGet.js +55 -0
- package/api/pipe17/pipe17LocationGet.js +57 -0
- package/api/pipe17/pipe17LocationsGet.js +54 -0
- package/api/pipe17/pipe17OrderGet.js +71 -0
- package/api/pipe17/pipe17OrdersGet.js +54 -0
- package/api/pipe17/pipe17ProductGet.js +57 -0
- package/api/pipe17/pipe17ProductsGet.js +54 -0
- package/api/pipe17/pipe17PurchaseGet.js +57 -0
- package/api/pipe17/pipe17PurchasesGet.js +54 -0
- package/api/pipe17/pipe17ReceiptGet.js +57 -0
- package/api/pipe17/pipe17ReceiptsGet.js +54 -0
- package/api/pipe17/pipe17ReturnGet.js +57 -0
- package/api/pipe17/pipe17ReturnsGet.js +54 -0
- package/api/printify/_example.get.js +67 -0
- package/api/printify/_example.js +59 -0
- package/api/printify/printify.constants.js +8 -0
- package/api/printify/printify.utils.js +41 -0
- package/api/printify/printifyBlueprintGet.js +60 -0
- package/api/printify/printifyBlueprintPrintProviderVariantsGet.js +77 -0
- package/api/printify/printifyBlueprintPrintProvidersGet.js +60 -0
- package/api/printify/printifyBlueprintsGet.js +38 -0
- package/api/printify/printifyGet.js +154 -0
- package/api/printify/printifyImageUpload.js +74 -0
- package/api/printify/printifyOrderCancel.js +70 -0
- package/api/printify/printifyOrderCreate.js +98 -0
- package/api/printify/printifyOrderGet.js +70 -0
- package/api/printify/printifyOrderSubmit.js +70 -0
- package/api/printify/printifyOrdersGet.js +72 -0
- package/api/printify/printifyProductCreate.js +96 -0
- package/api/printify/printifyProductDelete.js +70 -0
- package/api/printify/printifyProductGet.js +79 -0
- package/api/printify/printifyProductUpdate.js +81 -0
- package/api/printify/printifyProductsGet.js +67 -0
- package/api/printify/printifyShippingGet.js +70 -0
- package/api/printify/printifyShopsGet.js +56 -0
- package/api/printify/printifyWebhookCreate.js +84 -0
- package/api/printify/printifyWebhookDelete.js +70 -0
- package/api/printify/printifyWebhookUpdate.js +81 -0
- package/api/printify/printifyWebhooksGet.js +56 -0
- package/api/salesforce/docs.md +6 -0
- package/api/shopify/_example.create.js +2 -2
- package/api/shopify/_example.get.js +17 -4
- package/api/shopify/_example.getsingle.js +4 -1
- package/api/shopify/_example.js +4 -1
- package/api/shopify/_example.mutation.js +4 -1
- package/api/shopify/shopifyAbandonedCheckoutsGet.js +1 -1
- package/api/shopify/shopifyArticlesGet.js +1 -1
- package/api/shopify/shopifyBlogsGet.js +1 -1
- package/api/shopify/shopifyBulkMutationDo.js +5 -6
- package/api/shopify/shopifyBulkOperationsGet.js +1 -1
- package/api/shopify/shopifyCatalogsGet.js +17 -4
- package/api/shopify/shopifyChannelsGet.js +17 -4
- package/api/shopify/shopifyCheckoutAndAccountsConfigurationsGet.js +17 -4
- package/api/shopify/shopifyCollectionGet.js +4 -1
- package/api/shopify/shopifyCollectionsGet.js +17 -4
- package/api/shopify/shopifyCustomerCreate.js +2 -2
- package/api/shopify/shopifyCustomerGet.js +4 -1
- package/api/shopify/shopifyCustomerMarketingConsentUpdateSms.js +84 -0
- package/api/shopify/shopifyCustomersGet.js +18 -5
- package/api/shopify/shopifyDecodeSessionToken.js +2 -2
- package/api/shopify/shopifyDeliveryCustomizationsGet.js +1 -1
- package/api/shopify/shopifyDeliveryProfilesGet.js +17 -4
- package/api/shopify/shopifyDiscountNodesGet.js +1 -1
- package/api/shopify/shopifyDisputesGet.js +1 -1
- package/api/shopify/shopifyDraftOrdersGet.js +1 -1
- package/api/shopify/shopifyEventsGet.js +1 -1
- package/api/shopify/shopifyFilesGet.js +1 -1
- package/api/shopify/shopifyFulfillmentOrdersGet.js +17 -4
- package/api/shopify/shopifyGet.js +1 -1
- package/api/shopify/shopifyGiftCardCreate.js +4 -1
- package/api/shopify/shopifyGiftCardDeactivate.js +4 -1
- package/api/shopify/shopifyGiftCardsGet.js +17 -4
- package/api/shopify/shopifyInventoryItemsGet.js +17 -4
- package/api/shopify/shopifyLocationsGet.js +1 -1
- package/api/shopify/shopifyMarketingEventsGet.js +1 -1
- package/api/shopify/shopifyMarketsGet.js +1 -1
- package/api/shopify/shopifyMenusGet.js +1 -1
- package/api/shopify/shopifyMetafieldDefinitionCreate.js +111 -0
- package/api/shopify/shopifyMetafieldDefinitionsGet.js +18 -4
- package/api/shopify/shopifyMetafieldsDelete.js +78 -0
- package/api/shopify/shopifyMetaobjectDefinitionsGet.js +1 -1
- package/api/shopify/shopifyMetaobjectsGet.js +1 -1
- package/api/shopify/shopifyMutationDo.js +4 -1
- package/api/shopify/shopifyOrderGet.js +4 -1
- package/api/shopify/shopifyOrdersGet.js +3 -1
- package/api/shopify/shopifyPageDelete.js +4 -1
- package/api/shopify/shopifyPageGet.js +4 -1
- package/api/shopify/shopifyPageUpdate.js +5 -1
- package/api/shopify/shopifyPagesGet.js +1 -1
- package/api/shopify/shopifyPaymentCustomizationsGet.js +1 -1
- package/api/shopify/shopifyProductFeedsGet.js +1 -1
- package/api/shopify/shopifyProductGet.js +110 -0
- package/api/shopify/shopifyProductVariantsGet.js +1 -1
- package/api/shopify/shopifyProductsGet.js +17 -4
- package/api/shopify/shopifyPublicationsGet.js +17 -4
- package/api/shopify/shopifySegmentsGet.js +1 -1
- package/api/shopify/shopifyStoreCreditAccountCredit.js +144 -0
- package/api/shopify/shopifyStoreCreditAccountDebit.js +132 -0
- package/api/shopify/shopifyTagsRemoveBulk.js +77 -0
- package/api/shopify/shopifyThemeDelete.js +4 -1
- package/api/shopify/shopifyThemeDuplicate.js +4 -1
- package/api/shopify/shopifyThemeGet.js +2 -2
- package/api/shopify/shopifyThemesGet.js +3 -1
- package/api/shopify/shopifyUrlRedirectsGet.js +1 -1
- package/api/shopify/shopifyWebhookSubscriptionsGet.js +17 -4
- package/api/snowflake/docs.md +8 -0
- package/api/starshipit/starshipitAddressesGet.js +3 -1
- package/api/starshipit/starshipitOrdersListShipped.js +3 -1
- package/api/starshipit/starshipitProductsGet.js +3 -1
- package/api/stripe/_example.js +4 -1
- package/api/stripe/stripeChargesGet.js +3 -1
- package/api/stripe/stripeRefundsGet.js +3 -1
- package/api/stylearcade/stylearcadeDataGet.js +14 -6
- package/api/stylearcade/stylearcadeMetadataGet.js +3 -1
- package/api/tagalys/docs.md +7 -0
- package/api/telnyx/docs.md +6 -0
- package/api/telnyx/telnyx.constants.js +7 -0
- package/api/telnyx/telnyx.utils.js +37 -0
- package/api/telnyx/telnyxAvailablePhoneNumbersGet.js +59 -0
- package/api/telnyx/telnyxBalanceGet.js +51 -0
- package/api/telnyx/telnyxGet.js +151 -0
- package/api/telnyx/telnyxMessageGet.js +59 -0
- package/api/telnyx/telnyxMessageSend.js +65 -0
- package/api/telnyx/telnyxMessagesGet.js +53 -0
- package/api/telnyx/telnyxMessagingProfileCreate.js +62 -0
- package/api/telnyx/telnyxMessagingProfileGet.js +59 -0
- package/api/telnyx/telnyxMessagingProfileUpdate.js +68 -0
- package/api/telnyx/telnyxMessagingProfilesGet.js +53 -0
- package/api/telnyx/telnyxNumberLookupGet.js +61 -0
- package/api/telnyx/telnyxNumberOrderCreate.js +64 -0
- package/api/telnyx/telnyxPhoneNumberGet.js +59 -0
- package/api/telnyx/telnyxPhoneNumberUpdate.js +68 -0
- package/api/telnyx/telnyxPhoneNumbersGet.js +53 -0
- package/api/telnyx/telnyxWebhookDeliveriesGet.js +58 -0
- package/api/threeclicks/threeclicksCollectionsGet.js +3 -1
- package/api/threeclicks/threeclicksPurchaseOrderCreate.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderCreateBulk.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderGet.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderQuantitiesGet.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreate.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderQuantityCreateBulk.js +4 -1
- package/api/threeclicks/threeclicksPurchaseOrderUpdate.js +5 -1
- package/api/threeclicks/threeclicksPurchaseOrdersGet.js +3 -1
- package/api/threeclicks/threeclicksShipmentCreate.js +4 -1
- package/api/threeclicks/threeclicksShipmentGet.js +4 -1
- package/api/threeclicks/threeclicksShipmentOrderAdd.js +5 -1
- package/api/threeclicks/threeclicksShipmentOrderQuantityCreate.js +5 -1
- package/api/threeclicks/threeclicksShipmentQuantityUpdate.js +5 -1
- package/api/threeclicks/threeclicksShipmentStatusUpdate.js +5 -1
- package/api/threeclicks/threeclicksShipmentsGet.js +3 -1
- package/api/threeclicks/threeclicksSignatureCalculate.js +4 -4
- package/api/threeclicks/threeclicksStyleCodesGet.js +4 -1
- package/api/threeclicks/threeclicksStyleColourDelete.js +5 -1
- package/api/threeclicks/threeclicksStyleDelete.js +4 -1
- package/api/threeclicks/threeclicksStylesGet.js +3 -1
- package/api/upstash/upstashDel.js +4 -1
- package/api/upstash/upstashExists.js +4 -1
- package/api/upstash/upstashGet.js +4 -1
- package/api/utils.js +86 -6
- package/api/workable/workableJobsGet.js +3 -1
- package/api/yotpo/yotpoCampaignsGet.js +3 -1
- package/api/yotpo/yotpoCustomersRecentGet.js +3 -1
- package/api/yotpo/yotpoRedemptionOptionsGet.js +3 -1
- package/api/yotpo/yotpoVipTiersGet.js +3 -1
- package/hosting/copyCredsToEnv.js +3 -3
- package/hosting/handlerPaths.js +3 -3
- package/package.json +2 -1
- package/server.js +8 -6
- package/server.utils.js +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const {
|
|
2
|
+
NOTION_API_BASE_URL,
|
|
3
|
+
DEFAULT_NOTION_VERSION,
|
|
4
|
+
} = require('../notion/notion.constants');
|
|
5
|
+
const { resolveCreds, useBaseUrl } = require('../pipelineSteps');
|
|
6
|
+
const {
|
|
7
|
+
FetchClient,
|
|
8
|
+
fetchClientCommonSteps,
|
|
9
|
+
} = require('../utils');
|
|
10
|
+
|
|
11
|
+
const useAuthHeaders = async (state) => {
|
|
12
|
+
const { requestPayload, context } = state;
|
|
13
|
+
const { creds } = context;
|
|
14
|
+
const {
|
|
15
|
+
API_KEY,
|
|
16
|
+
NOTION_VERSION,
|
|
17
|
+
} = creds;
|
|
18
|
+
const notionVersion = NOTION_VERSION ?? DEFAULT_NOTION_VERSION;
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
requestPayload: {
|
|
22
|
+
...requestPayload,
|
|
23
|
+
headers: {
|
|
24
|
+
Authorization: `Bearer ${ API_KEY }`,
|
|
25
|
+
'Notion-Version': notionVersion,
|
|
26
|
+
...requestPayload.headers,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const notionClient = new FetchClient({
|
|
33
|
+
pipeline: [
|
|
34
|
+
resolveCreds,
|
|
35
|
+
useBaseUrl(NOTION_API_BASE_URL),
|
|
36
|
+
useAuthHeaders,
|
|
37
|
+
'fetch',
|
|
38
|
+
fetchClientCommonSteps.exitEarlyOnNotOk,
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
module.exports = {
|
|
43
|
+
notionClient,
|
|
44
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// https://developers.notion.com/reference/get-self
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, Getter } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { notionClient } = require('../notion/notion.utils');
|
|
6
|
+
const { MAX_PER_PAGE } = require('../notion/notion.constants');
|
|
7
|
+
|
|
8
|
+
const argsWarden = new ArgsWarden([
|
|
9
|
+
['credsPayload', credsValidator],
|
|
10
|
+
['url'],
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const digResults = (data, resultsKey) => {
|
|
14
|
+
if (resultsKey) {
|
|
15
|
+
return data?.[resultsKey] ?? [];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (Array.isArray(data)) {
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const arrayEntry = Object.entries(data || {}).find(([, value]) => Array.isArray(value));
|
|
23
|
+
return arrayEntry ? arrayEntry[1] : [];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const notionGetPacket = async (
|
|
27
|
+
credsPayload,
|
|
28
|
+
url,
|
|
29
|
+
{
|
|
30
|
+
params,
|
|
31
|
+
perPage = MAX_PER_PAGE,
|
|
32
|
+
} = {},
|
|
33
|
+
) => {
|
|
34
|
+
return notionClient.fetch({
|
|
35
|
+
requestPayload: {
|
|
36
|
+
url,
|
|
37
|
+
params: {
|
|
38
|
+
page_size: Math.min(perPage, MAX_PER_PAGE),
|
|
39
|
+
...params,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
context: {
|
|
43
|
+
credsPayload,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const notionGetPaginator = async (currentParams, response) => {
|
|
49
|
+
const { args, options } = currentParams;
|
|
50
|
+
|
|
51
|
+
if (!response?.ok) {
|
|
52
|
+
return [true];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const nextCursor = response?.data?.next_cursor;
|
|
56
|
+
if (!nextCursor) {
|
|
57
|
+
return [true];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const { params = {} } = options;
|
|
61
|
+
|
|
62
|
+
return [false, {
|
|
63
|
+
args,
|
|
64
|
+
options: {
|
|
65
|
+
...options,
|
|
66
|
+
params: {
|
|
67
|
+
...params,
|
|
68
|
+
start_cursor: nextCursor,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const notionGet = async (
|
|
75
|
+
returnGetter,
|
|
76
|
+
|
|
77
|
+
credsPayload,
|
|
78
|
+
url,
|
|
79
|
+
{
|
|
80
|
+
params,
|
|
81
|
+
perPage = MAX_PER_PAGE,
|
|
82
|
+
resultsKey,
|
|
83
|
+
...getterOptions
|
|
84
|
+
} = {},
|
|
85
|
+
) => {
|
|
86
|
+
|
|
87
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
88
|
+
credsPayload,
|
|
89
|
+
url,
|
|
90
|
+
});
|
|
91
|
+
if (rejectResponse) {
|
|
92
|
+
return rejectResponse;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const getter = new Getter(
|
|
96
|
+
{
|
|
97
|
+
args: [credsPayload, url],
|
|
98
|
+
options: {
|
|
99
|
+
params,
|
|
100
|
+
perPage,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
func: notionGetPacket,
|
|
105
|
+
digester: (response) => {
|
|
106
|
+
if (!response?.ok) {
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return digResults(response.data, resultsKey);
|
|
111
|
+
},
|
|
112
|
+
paginator: notionGetPaginator,
|
|
113
|
+
...getterOptions,
|
|
114
|
+
},
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
if (returnGetter) {
|
|
118
|
+
return getter;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const data = await getter.run({ returnAll: true });
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
ok: true,
|
|
125
|
+
data,
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const funcApiConfig = {
|
|
130
|
+
argsWarden,
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
module.exports = {
|
|
134
|
+
notionGet: (...args) => notionGet(false, ...args),
|
|
135
|
+
notionGetter: (...args) => notionGet(true, ...args),
|
|
136
|
+
funcApiConfig,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
/*
|
|
140
|
+
curl -X POST "http://localhost:8000/notionGet" \
|
|
141
|
+
-H "Content-Type: application/json" \
|
|
142
|
+
-d '{
|
|
143
|
+
"credsPayload": { "credsPath": "notion" },
|
|
144
|
+
"url": "/users/me"
|
|
145
|
+
}'
|
|
146
|
+
*/
|
|
@@ -12,7 +12,10 @@ const FUNC = async (
|
|
|
12
12
|
salesOrderNumber,
|
|
13
13
|
) => {
|
|
14
14
|
|
|
15
|
-
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
15
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
16
|
+
credsPayload,
|
|
17
|
+
salesOrderNumber,
|
|
18
|
+
});
|
|
16
19
|
if (rejectResponse) {
|
|
17
20
|
return rejectResponse;
|
|
18
21
|
}
|
|
@@ -48,7 +48,36 @@ const setSessionId = async (credsPayload, sessionId) => {
|
|
|
48
48
|
SESSION_IDS.set(CLIENT_ID, sessionId);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
const withPeoplevoxSession = async (fetchPayload, next) => {
|
|
52
|
+
const { context = {} } = fetchPayload;
|
|
53
|
+
const { credsPayload } = context;
|
|
54
|
+
|
|
55
|
+
const sessionIdResponse = await getSessionId(credsPayload);
|
|
56
|
+
|
|
57
|
+
if (!sessionIdResponse.ok) {
|
|
58
|
+
return sessionIdResponse;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const sessionId = sessionIdResponse.data;
|
|
62
|
+
|
|
63
|
+
const response = await next({
|
|
64
|
+
...fetchPayload,
|
|
65
|
+
context: {
|
|
66
|
+
...context,
|
|
67
|
+
sessionId,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (response.ok) {
|
|
72
|
+
await setSessionId(credsPayload, sessionId);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// TODO: Check if it was an auth error, and try another auth method if so
|
|
76
|
+
return response;
|
|
77
|
+
};
|
|
78
|
+
|
|
51
79
|
module.exports = {
|
|
52
80
|
getSessionId,
|
|
53
81
|
setSessionId,
|
|
82
|
+
withPeoplevoxSession,
|
|
54
83
|
};
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
appendUrlToBase,
|
|
7
7
|
logDeep,
|
|
8
8
|
} = require('../utils');
|
|
9
|
-
const {
|
|
9
|
+
const { withPeoplevoxSession } = require('../peoplevox/peoplevox.sessions');
|
|
10
10
|
|
|
11
11
|
const xml2jsBuilder = new xml2js.Builder({
|
|
12
12
|
headless: true,
|
|
@@ -183,45 +183,11 @@ const peoplevoxClient = new FetchClient({
|
|
|
183
183
|
unwrapSingleDetail,
|
|
184
184
|
hoistDetail,
|
|
185
185
|
],
|
|
186
|
+
layers: [
|
|
187
|
+
withPeoplevoxSession,
|
|
188
|
+
],
|
|
186
189
|
});
|
|
187
190
|
|
|
188
|
-
const fetchWithoutAuth = peoplevoxClient.fetch.bind(peoplevoxClient);
|
|
189
|
-
|
|
190
|
-
peoplevoxClient.fetch = async ({
|
|
191
|
-
requestPayload,
|
|
192
|
-
context = {},
|
|
193
|
-
inspect = false,
|
|
194
|
-
}) => {
|
|
195
|
-
const { credsPayload } = context;
|
|
196
|
-
|
|
197
|
-
const sessionIdResponse = await getSessionId(credsPayload);
|
|
198
|
-
|
|
199
|
-
const {
|
|
200
|
-
ok: sessionIdOk,
|
|
201
|
-
data: sessionId,
|
|
202
|
-
} = sessionIdResponse;
|
|
203
|
-
|
|
204
|
-
if (!sessionIdOk) {
|
|
205
|
-
return sessionIdResponse;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const response = await fetchWithoutAuth({
|
|
209
|
-
requestPayload,
|
|
210
|
-
context: {
|
|
211
|
-
...context,
|
|
212
|
-
sessionId,
|
|
213
|
-
},
|
|
214
|
-
inspect,
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
if (response.ok) {
|
|
218
|
-
await setSessionId(credsPayload, sessionId);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// TODO: Check if it was an auth error, and try another auth method if so
|
|
222
|
-
return response;
|
|
223
|
-
};
|
|
224
|
-
|
|
225
191
|
module.exports = {
|
|
226
192
|
peoplevoxClient,
|
|
227
193
|
};
|
|
@@ -9,7 +9,9 @@ const peoplevoxAuthGet = async (
|
|
|
9
9
|
credsPayload,
|
|
10
10
|
) => {
|
|
11
11
|
|
|
12
|
-
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
12
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
13
|
+
credsPayload,
|
|
14
|
+
});
|
|
13
15
|
if (rejectResponse) {
|
|
14
16
|
return rejectResponse;
|
|
15
17
|
}
|
|
@@ -16,7 +16,9 @@ const peoplevoxGetSingle = async (
|
|
|
16
16
|
credsPayload,
|
|
17
17
|
templateName,
|
|
18
18
|
searchParameters = {},
|
|
19
|
-
|
|
19
|
+
{
|
|
20
|
+
fetchClient = peoplevoxClient,
|
|
21
|
+
} = {},
|
|
20
22
|
) => {
|
|
21
23
|
|
|
22
24
|
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
@@ -31,7 +33,7 @@ const peoplevoxGetSingle = async (
|
|
|
31
33
|
const { searchClause, id, idName } = searchParameters;
|
|
32
34
|
const resolvedSearchClause = searchClause || `${ idName }.Equals("${ id }")`;
|
|
33
35
|
|
|
34
|
-
const response = await
|
|
36
|
+
const response = await fetchClient.fetch({
|
|
35
37
|
requestPayload: {
|
|
36
38
|
method: 'post',
|
|
37
39
|
body: {
|
|
@@ -14,9 +14,15 @@ const argsWarden = new ArgsWarden([
|
|
|
14
14
|
const peoplevoxOrderEdit = async (
|
|
15
15
|
credsPayload,
|
|
16
16
|
orderPayload,
|
|
17
|
+
{
|
|
18
|
+
fetchClient = peoplevoxClient,
|
|
19
|
+
} = {},
|
|
17
20
|
) => {
|
|
18
21
|
|
|
19
|
-
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
22
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
credsPayload,
|
|
24
|
+
orderPayload,
|
|
25
|
+
});
|
|
20
26
|
if (rejectResponse) {
|
|
21
27
|
return rejectResponse;
|
|
22
28
|
}
|
|
@@ -36,7 +42,7 @@ const peoplevoxOrderEdit = async (
|
|
|
36
42
|
};
|
|
37
43
|
}
|
|
38
44
|
|
|
39
|
-
return
|
|
45
|
+
return fetchClient.fetch({
|
|
40
46
|
requestPayload: {
|
|
41
47
|
method: 'post',
|
|
42
48
|
body: {
|
|
@@ -10,9 +10,13 @@ const argsWarden = new ArgsWarden([
|
|
|
10
10
|
const peoplevoxOrderGet = async (
|
|
11
11
|
credsPayload,
|
|
12
12
|
salesOrderNumber,
|
|
13
|
+
options = {},
|
|
13
14
|
) => {
|
|
14
15
|
|
|
15
|
-
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
16
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
17
|
+
credsPayload,
|
|
18
|
+
salesOrderNumber,
|
|
19
|
+
});
|
|
16
20
|
if (rejectResponse) {
|
|
17
21
|
return rejectResponse;
|
|
18
22
|
}
|
|
@@ -24,6 +28,7 @@ const peoplevoxOrderGet = async (
|
|
|
24
28
|
id: salesOrderNumber,
|
|
25
29
|
idName: 'SalesOrderNumber',
|
|
26
30
|
},
|
|
31
|
+
options,
|
|
27
32
|
);
|
|
28
33
|
};
|
|
29
34
|
|
|
@@ -16,15 +16,19 @@ const peoplevoxReportGet = async (
|
|
|
16
16
|
filter,
|
|
17
17
|
orderBy,
|
|
18
18
|
columns,
|
|
19
|
+
fetchClient = peoplevoxClient,
|
|
19
20
|
} = {},
|
|
20
21
|
) => {
|
|
21
22
|
|
|
22
|
-
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
23
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
24
|
+
credsPayload,
|
|
25
|
+
reportName,
|
|
26
|
+
});
|
|
23
27
|
if (rejectResponse) {
|
|
24
28
|
return rejectResponse;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
const reportGetResponse = await
|
|
31
|
+
const reportGetResponse = await fetchClient.fetch({
|
|
28
32
|
requestPayload: {
|
|
29
33
|
method: 'post',
|
|
30
34
|
body: {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Pipe17
|
|
2
|
+
|
|
3
|
+
- [API references (Help Center)](https://support.pipe17.com/hc/en-us/articles/43018622147995-Pipe17-API-References)
|
|
4
|
+
- [API documentation](https://apidoc.pipe17.com/)
|
|
5
|
+
- [Custom integration introduction](https://support.pipe17.com/hc/en-us/articles/26518046517403-Introduction-to-building-a-Custom-Integration-to-Pipe17)
|
|
6
|
+
- [Webhooks](https://support.pipe17.com/hc/en-us/articles/7179468225819-Getting-started-with-Pipe17-Webhooks)
|
|
7
|
+
|
|
8
|
+
Versioned REST JSON under `https://api-v3.pipe17.com/api/v3`, authenticated with an organization or integration API key in the `X-Pipe17-Key` header (keys from Settings → API Keys or from a registered custom connector), covering orders, products, inventory, fulfillments, shipments, locations, connectors, and webhooks.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const PIPE17_API_BASE_URL = 'https://api-v3.pipe17.com/api/v3';
|
|
2
|
+
|
|
3
|
+
const PIPE17_API_SANDBOX_BASE_URL = 'https://api-v3.develop.pipe17.com/api/v3';
|
|
4
|
+
|
|
5
|
+
const DEFAULT_PAGE_SIZE = 100;
|
|
6
|
+
|
|
7
|
+
const JOB_TYPES = [
|
|
8
|
+
'report',
|
|
9
|
+
'import',
|
|
10
|
+
'prepare',
|
|
11
|
+
'update',
|
|
12
|
+
'delete',
|
|
13
|
+
'export',
|
|
14
|
+
'automation',
|
|
15
|
+
'sync',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const JOB_SUBTYPES = [
|
|
19
|
+
'inventory',
|
|
20
|
+
'replenishment',
|
|
21
|
+
'oos_sku_on_order',
|
|
22
|
+
'open_orders',
|
|
23
|
+
'purchases',
|
|
24
|
+
'transfers',
|
|
25
|
+
'arrivals',
|
|
26
|
+
'receipts',
|
|
27
|
+
'products',
|
|
28
|
+
'organizations',
|
|
29
|
+
'orders',
|
|
30
|
+
'shipments',
|
|
31
|
+
'fulfillments',
|
|
32
|
+
'locations',
|
|
33
|
+
'shipping_methods',
|
|
34
|
+
'returns',
|
|
35
|
+
'exceptions',
|
|
36
|
+
'lookup_objects',
|
|
37
|
+
'statements',
|
|
38
|
+
'users',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
PIPE17_API_BASE_URL,
|
|
43
|
+
PIPE17_API_SANDBOX_BASE_URL,
|
|
44
|
+
DEFAULT_PAGE_SIZE,
|
|
45
|
+
JOB_TYPES,
|
|
46
|
+
JOB_SUBTYPES,
|
|
47
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const {
|
|
2
|
+
PIPE17_API_BASE_URL,
|
|
3
|
+
} = require('../pipe17/pipe17.constants');
|
|
4
|
+
const { resolveCreds, useBaseUrl } = require('../pipelineSteps');
|
|
5
|
+
const {
|
|
6
|
+
FetchClient,
|
|
7
|
+
fetchClientCommonSteps,
|
|
8
|
+
} = require('../utils');
|
|
9
|
+
|
|
10
|
+
const usePipe17BaseUrl = async (state) => {
|
|
11
|
+
const { creds } = state.context;
|
|
12
|
+
return useBaseUrl(creds.BASE_URL ?? PIPE17_API_BASE_URL)(state);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const useAuthHeaders = async (state) => {
|
|
16
|
+
const { requestPayload, context } = state;
|
|
17
|
+
const { creds } = context;
|
|
18
|
+
const { API_KEY } = creds;
|
|
19
|
+
|
|
20
|
+
if (!API_KEY) {
|
|
21
|
+
return {
|
|
22
|
+
breakChain: true,
|
|
23
|
+
response: {
|
|
24
|
+
ok: false,
|
|
25
|
+
error: {
|
|
26
|
+
code: 'INVALID_CREDS',
|
|
27
|
+
message: 'API_KEY is required.',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
requestPayload: {
|
|
35
|
+
...requestPayload,
|
|
36
|
+
headers: {
|
|
37
|
+
'X-Pipe17-Key': API_KEY,
|
|
38
|
+
Accept: 'application/json',
|
|
39
|
+
...requestPayload.headers,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const interpretPipe17Response = async (state) => {
|
|
46
|
+
const { response } = state;
|
|
47
|
+
|
|
48
|
+
if (!response?.ok) {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const { success, result, errors } = response.data || {};
|
|
53
|
+
|
|
54
|
+
if (success === false) {
|
|
55
|
+
return {
|
|
56
|
+
response: {
|
|
57
|
+
ok: false,
|
|
58
|
+
error: {
|
|
59
|
+
code: 'PIPE17_API_ERROR',
|
|
60
|
+
details: result ?? errors ?? response.data,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
breakChain: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return {};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const pipe17Client = new FetchClient({
|
|
71
|
+
pipeline: [
|
|
72
|
+
resolveCreds,
|
|
73
|
+
usePipe17BaseUrl,
|
|
74
|
+
useAuthHeaders,
|
|
75
|
+
'fetch',
|
|
76
|
+
fetchClientCommonSteps.exitEarlyOnNotOk,
|
|
77
|
+
interpretPipe17Response,
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const pipe17GetSingle = async (
|
|
82
|
+
credsPayload,
|
|
83
|
+
collectionPath,
|
|
84
|
+
id,
|
|
85
|
+
{
|
|
86
|
+
resultKey,
|
|
87
|
+
inspect = false,
|
|
88
|
+
fetchClient = pipe17Client,
|
|
89
|
+
} = {},
|
|
90
|
+
) => {
|
|
91
|
+
|
|
92
|
+
const response = await fetchClient.fetch({
|
|
93
|
+
requestPayload: {
|
|
94
|
+
method: 'get',
|
|
95
|
+
url: `${ collectionPath }/${ id }`,
|
|
96
|
+
},
|
|
97
|
+
context: { credsPayload },
|
|
98
|
+
inspect,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
if (!response.ok) {
|
|
102
|
+
return response;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const resolvedResultKey = resultKey ?? collectionPath.replace(/^\//, '').replace(/s$/, '');
|
|
106
|
+
const entity = response.data?.result?.[resolvedResultKey]
|
|
107
|
+
?? response.data?.[resolvedResultKey];
|
|
108
|
+
|
|
109
|
+
if (entity !== undefined) {
|
|
110
|
+
return {
|
|
111
|
+
...response,
|
|
112
|
+
data: entity,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return response;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
module.exports = {
|
|
120
|
+
pipe17Client,
|
|
121
|
+
interpretPipe17Response,
|
|
122
|
+
pipe17GetSingle,
|
|
123
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// https://apidoc.pipe17.com/#/operations/fetchArrival
|
|
2
|
+
|
|
3
|
+
const { ArgsWarden, objHasAny } = require('../utils');
|
|
4
|
+
const { credsValidator } = require('../validators');
|
|
5
|
+
const { pipe17GetSingle } = require('../pipe17/pipe17.utils');
|
|
6
|
+
|
|
7
|
+
const arrivalIdentifierValidator = (arrivalIdentifier) => {
|
|
8
|
+
return objHasAny(arrivalIdentifier, [
|
|
9
|
+
'arrivalId',
|
|
10
|
+
'extArrivalId',
|
|
11
|
+
'extArrivalApiId',
|
|
12
|
+
'extReferenceId',
|
|
13
|
+
]);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const argsWarden = new ArgsWarden([
|
|
17
|
+
['credsPayload', credsValidator],
|
|
18
|
+
['arrivalIdentifier', arrivalIdentifierValidator],
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
const resolveArrivalId = ({
|
|
22
|
+
arrivalId,
|
|
23
|
+
extArrivalId,
|
|
24
|
+
extArrivalApiId,
|
|
25
|
+
extReferenceId,
|
|
26
|
+
}) => {
|
|
27
|
+
return arrivalId
|
|
28
|
+
|| (extArrivalId ? `ext:${ extArrivalId }` : null)
|
|
29
|
+
|| (extArrivalApiId ? `api:${ extArrivalApiId }` : null)
|
|
30
|
+
|| (extReferenceId ? `ref:${ extReferenceId }` : null);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const pipe17ArrivalGet = async (
|
|
34
|
+
credsPayload,
|
|
35
|
+
arrivalIdentifier,
|
|
36
|
+
{
|
|
37
|
+
inspect = false,
|
|
38
|
+
fetchClient,
|
|
39
|
+
} = {},
|
|
40
|
+
) => {
|
|
41
|
+
|
|
42
|
+
const rejectResponse = await argsWarden.responseIfRejectingArgs({
|
|
43
|
+
credsPayload,
|
|
44
|
+
arrivalIdentifier,
|
|
45
|
+
});
|
|
46
|
+
if (rejectResponse) {
|
|
47
|
+
return rejectResponse;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return pipe17GetSingle(
|
|
51
|
+
credsPayload,
|
|
52
|
+
'/arrivals',
|
|
53
|
+
resolveArrivalId(arrivalIdentifier),
|
|
54
|
+
{
|
|
55
|
+
resultKey: 'arrival',
|
|
56
|
+
inspect,
|
|
57
|
+
fetchClient,
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const funcApiConfig = {
|
|
63
|
+
argsWarden,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
module.exports = {
|
|
67
|
+
pipe17ArrivalGet,
|
|
68
|
+
funcApiConfig,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
curl -X POST "http://localhost:8000/pipe17ArrivalGet" \
|
|
73
|
+
-H "Content-Type: application/json" \
|
|
74
|
+
-d '{
|
|
75
|
+
"credsPayload": { "credsPath": "pipe17" },
|
|
76
|
+
"arrivalIdentifier": { "arrivalId": "d22afa93793be1f1" }
|
|
77
|
+
}'
|
|
78
|
+
*/
|