@qlik/api 1.50.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-keys.d.ts +3 -3
- package/api-keys.js +3 -3
- package/apps.d.ts +3 -3
- package/apps.js +3 -3
- package/assistants.d.ts +4 -4
- package/assistants.js +26 -8
- package/audits.d.ts +3 -3
- package/audits.js +3 -3
- package/auth-types.d.ts +1 -1
- package/auth-types.js +2 -2
- package/auth.d.ts +2 -2
- package/auth.js +3 -3
- package/automation-connections.d.ts +3 -3
- package/automation-connections.js +3 -3
- package/automation-connectors.d.ts +3 -3
- package/automation-connectors.js +3 -3
- package/automations.d.ts +3 -3
- package/automations.js +3 -3
- package/automl-deployments.d.ts +3 -3
- package/automl-deployments.js +3 -3
- package/automl-predictions.d.ts +3 -3
- package/automl-predictions.js +3 -3
- package/banners.d.ts +4 -0
- package/banners.js +50 -0
- package/brands.d.ts +3 -3
- package/brands.js +3 -3
- package/chunks/{api-keys-DbT9Z1_I.d.ts → api-keys-DS7LkwI8.d.ts} +1 -1
- package/chunks/{apps-C43wozsM.d.ts → apps-B_ut0nyb.d.ts} +1 -1
- package/chunks/{assistants-HRTG4mrK.d.ts → assistants-DZMh4UTc.d.ts} +108 -43
- package/chunks/{audits-CA-bllcf.d.ts → audits-BC_9Nsc3.d.ts} +1 -1
- package/chunks/{auth-BDcdoAcK.d.ts → auth-BYyDvXka.d.ts} +2 -2
- package/chunks/{auth-Dn3pvK1N.js → auth-DVfvT8TD.js} +2 -2
- package/chunks/{auth-functions-BZN9dCw1.js → auth-functions-C27LB1gE.js} +377 -225
- package/chunks/{auth-FQsMkh58.js → auth-sNi1A67-.js} +5 -5
- package/chunks/{auth-types-BK8AvfyD.d.ts → auth-types-CHOUViJI.d.ts} +38 -4
- package/chunks/{automation-connections-BRSXAkab.d.ts → automation-connections-Cyhb0FaN.d.ts} +1 -1
- package/chunks/{automation-connectors-Bx48-M4g.d.ts → automation-connectors-LrawaoDq.d.ts} +1 -1
- package/chunks/{automations-Dugu45RA.d.ts → automations-BYujmPxM.d.ts} +1 -1
- package/chunks/{automl-deployments-Boip7E0T.d.ts → automl-deployments-Bz4hIBQD.d.ts} +1 -1
- package/chunks/{automl-predictions-DdkRNsA7.d.ts → automl-predictions-DnnHn5n_.d.ts} +1 -1
- package/chunks/banners-C8iUbLA2.d.ts +184 -0
- package/chunks/{brands-jxEjeVGK.d.ts → brands-C_VLS_bl.d.ts} +1 -1
- package/chunks/{collections-DFvDeYCC.d.ts → collections-tmWJxgrt.d.ts} +1 -1
- package/chunks/{conditions-DpjEG64S.d.ts → conditions-XN35BSPh.d.ts} +1 -1
- package/chunks/{consumption-CGna485O.d.ts → consumption-DX2Ei4od.d.ts} +1 -1
- package/chunks/{csp-origins-Dm1bcm6D.d.ts → csp-origins-fyrVQMkf.d.ts} +1 -1
- package/chunks/{csrf-token-Dl422Xl8.d.ts → csrf-token-VrKslIAO.d.ts} +1 -1
- package/chunks/{data-alerts-Dsdht3R_.d.ts → data-alerts-Db2z8nxG.d.ts} +1 -1
- package/chunks/{data-assets-BvAuaPP1.d.ts → data-assets-COFtmbYv.d.ts} +1 -1
- package/chunks/{data-connections-DKs7Dj0l.d.ts → data-connections-CZmEfGNG.d.ts} +1 -1
- package/chunks/{data-credentials-Dz7QHnsV.d.ts → data-credentials-BJteSNF-.d.ts} +1 -1
- package/chunks/{data-files-DwaxubSK.d.ts → data-files-E3LDdwu9.d.ts} +1 -1
- package/chunks/{data-qualities-D_epSJNj.d.ts → data-qualities-CDgLWYzn.d.ts} +1 -1
- package/chunks/{data-sets-BCB4zxdl.d.ts → data-sets-DS9oCHyh.d.ts} +1 -1
- package/chunks/{data-sources-C6bpRD99.d.ts → data-sources-CsARydcs.d.ts} +1 -1
- package/chunks/{data-stores-NpZrP7K-.d.ts → data-stores-BrMPbFTB.d.ts} +1 -1
- package/chunks/{dcaas-BjVAcAO6.d.ts → dcaas-BOgO88is.d.ts} +1 -1
- package/chunks/{di-projects-CERxkUMp.d.ts → di-projects-6CTj-fZS.d.ts} +1 -1
- package/chunks/{direct-access-agents-C2TyK9Om.d.ts → direct-access-agents-DqkZJgCw.d.ts} +122 -141
- package/chunks/{dist-BrtkK7jD.js → dist-CdktrY2F.js} +1 -1
- package/chunks/{encryption-Dt4C0z0P.d.ts → encryption-38eI7xaM.d.ts} +1 -1
- package/chunks/{extensions-Pk0ruRJq.d.ts → extensions-BY1bBIwI.d.ts} +1 -1
- package/chunks/{glossaries-D2HtaKNg.d.ts → glossaries-DOGETgAy.d.ts} +13 -1
- package/chunks/{groups-D-PlPew1.d.ts → groups-B5ZSHoU7.d.ts} +1 -1
- package/chunks/{identity-providers-Ok9gc5iT.d.ts → identity-providers-B95UphQ7.d.ts} +1 -1
- package/chunks/{interceptors-rFmTB6_g.d.ts → interceptors-BoGH3CGy.d.ts} +1 -1
- package/chunks/{interceptors-CT9deBo6.js → interceptors-DoQ44M-n.js} +1 -1
- package/chunks/{invoke-fetch-DtTuA_q4.js → invoke-fetch-CSpyWLUQ.js} +5 -5
- package/chunks/{invoke-fetch-Cn50MiSD.js → invoke-fetch-CoW3QRhJ.js} +3 -3
- package/chunks/{items-CkrahlyK.d.ts → items-prd2PJHL.d.ts} +1 -1
- package/chunks/{knowledgebases-pIPPYuHk.d.ts → knowledgebases-BddClrQS.d.ts} +84 -2
- package/chunks/{licenses-BDGenUQ0.d.ts → licenses-DzZh3F70.d.ts} +1 -1
- package/chunks/{lineage-graphs-COYOm9O0.d.ts → lineage-graphs-DH3iZ45F.d.ts} +1 -1
- package/chunks/{ml-D2FKGXFm.d.ts → ml-DZ4QCH4Q.d.ts} +14 -2
- package/chunks/{notes-CFJqzuUp.d.ts → notes-BmZ3kWFF.d.ts} +1 -1
- package/chunks/{notifications-BWMWcQ8e.d.ts → notifications-DpmHo21D.d.ts} +1 -1
- package/chunks/{oauth-clients-DM8IIacl.d.ts → oauth-clients-lKvXqnlf.d.ts} +1 -1
- package/chunks/{oauth-tokens-oGIAStpb.d.ts → oauth-tokens-I1GXV-Pm.d.ts} +1 -1
- package/chunks/{public-runtime-modules-DNHVdCZ6.js → public-runtime-modules-DiFgGaqr.js} +5 -5
- package/chunks/{qix-Dcn0HIU3.js → qix-BpdRtXWA.js} +22 -23
- package/chunks/{qix-DhKyOvuL.d.ts → qix-CYETPFnP.d.ts} +2 -2
- package/chunks/{qix-6XcsO79b.js → qix-DCY6Rh2X.js} +1 -1
- package/chunks/{qix-chunk-entrypoint-DJIP0GL8.js → qix-chunk-entrypoint-C_zIcxOU.js} +24 -29
- package/chunks/{questions-D3rmb5fT.d.ts → questions-DPgcX6l6.d.ts} +1 -1
- package/chunks/{quotas-nRoaBvEh.d.ts → quotas-ja_K_-Na.d.ts} +1 -1
- package/chunks/{reload-tasks-B_fM3dm3.d.ts → reload-tasks-BiMX4_zH.d.ts} +1 -1
- package/chunks/{reloads-BghgP4x5.d.ts → reloads-BhEQHvZ_.d.ts} +1 -1
- package/chunks/{report-templates-BysNWNES.d.ts → report-templates-CC5GHDZP.d.ts} +1 -1
- package/chunks/{reports-HcNch5zc.d.ts → reports-gdDevE7G.d.ts} +1 -1
- package/chunks/{roles-8LE3mqCV.d.ts → roles-CI51tqVy.d.ts} +1 -1
- package/chunks/{sharing-tasks-C9fFGIeY.d.ts → sharing-tasks-BBCqrevS.d.ts} +1 -1
- package/chunks/{spaces-ByIVxNlR.d.ts → spaces-mALfyUk6.d.ts} +1 -1
- package/chunks/{tasks-BwYCg-5D.d.ts → tasks-C5LAAjFh.d.ts} +1 -1
- package/chunks/{temp-contents-Ceko2teM.d.ts → temp-contents-BetQz-oE.d.ts} +1 -1
- package/chunks/{tenants-BLvD3HVW.d.ts → tenants-BxH2KOTB.d.ts} +1 -1
- package/chunks/{themes-85kaWWsU.d.ts → themes-39I0zONl.d.ts} +1 -1
- package/chunks/{transports-BAGpIam_.d.ts → transports-Dw6UqnWY.d.ts} +5 -1
- package/chunks/{ui-config-dinJFzBx.d.ts → ui-config-Dn289HpY.d.ts} +1 -1
- package/chunks/{users-BrgjDU7L.d.ts → users-dL3ip5Hd.d.ts} +25 -46
- package/chunks/{web-integrations-Gy6aaK2p.d.ts → web-integrations-Cl2WklQh.d.ts} +1 -1
- package/chunks/{web-notifications-DoOenzCC.d.ts → web-notifications-B5An9uEB.d.ts} +1 -1
- package/chunks/{webhooks-CfRb9HB1.d.ts → webhooks-CrKlLCv7.d.ts} +82 -76
- package/collections.d.ts +3 -3
- package/collections.js +3 -3
- package/conditions.d.ts +3 -3
- package/conditions.js +3 -3
- package/consumption.d.ts +3 -3
- package/consumption.js +3 -3
- package/csp-origins.d.ts +3 -3
- package/csp-origins.js +3 -3
- package/csrf-token.d.ts +3 -3
- package/csrf-token.js +3 -3
- package/data-alerts.d.ts +3 -3
- package/data-alerts.js +3 -3
- package/data-assets.d.ts +3 -3
- package/data-assets.js +3 -3
- package/data-connections.d.ts +3 -3
- package/data-connections.js +3 -3
- package/data-credentials.d.ts +3 -3
- package/data-credentials.js +3 -3
- package/data-files.d.ts +3 -3
- package/data-files.js +3 -3
- package/data-qualities.d.ts +3 -3
- package/data-qualities.js +3 -3
- package/data-sets.d.ts +3 -3
- package/data-sets.js +3 -3
- package/data-sources.d.ts +3 -3
- package/data-sources.js +3 -3
- package/data-stores.d.ts +3 -3
- package/data-stores.js +3 -3
- package/dcaas.d.ts +3 -3
- package/dcaas.js +3 -3
- package/di-projects.d.ts +3 -3
- package/di-projects.js +3 -3
- package/direct-access-agents.d.ts +4 -4
- package/direct-access-agents.js +54 -81
- package/encryption.d.ts +3 -3
- package/encryption.js +3 -3
- package/extensions.d.ts +3 -3
- package/extensions.js +3 -3
- package/global-types.d.ts +1 -1
- package/global-types.js +1 -1
- package/glossaries.d.ts +3 -3
- package/glossaries.js +3 -3
- package/groups.d.ts +3 -3
- package/groups.js +3 -3
- package/identity-providers.d.ts +3 -3
- package/identity-providers.js +3 -3
- package/index.d.ts +70 -66
- package/index.js +24 -10
- package/interceptors.d.ts +3 -3
- package/interceptors.js +2 -2
- package/invoke-fetch-types.d.ts +1 -1
- package/items.d.ts +3 -3
- package/items.js +3 -3
- package/knowledgebases.d.ts +4 -4
- package/knowledgebases.js +22 -4
- package/licenses.d.ts +3 -3
- package/licenses.js +3 -3
- package/lineage-graphs.d.ts +3 -3
- package/lineage-graphs.js +3 -3
- package/ml.d.ts +3 -3
- package/ml.js +3 -3
- package/notes.d.ts +3 -3
- package/notes.js +3 -3
- package/notifications.d.ts +3 -3
- package/notifications.js +3 -3
- package/oauth-clients.d.ts +3 -3
- package/oauth-clients.js +3 -3
- package/oauth-tokens.d.ts +3 -3
- package/oauth-tokens.js +3 -3
- package/package.json +3 -2
- package/qix.d.ts +3 -3
- package/qix.js +3 -3
- package/questions.d.ts +3 -3
- package/questions.js +3 -3
- package/quotas.d.ts +3 -3
- package/quotas.js +3 -3
- package/reload-tasks.d.ts +3 -3
- package/reload-tasks.js +3 -3
- package/reloads.d.ts +3 -3
- package/reloads.js +3 -3
- package/report-templates.d.ts +3 -3
- package/report-templates.js +3 -3
- package/reports.d.ts +3 -3
- package/reports.js +3 -3
- package/roles.d.ts +3 -3
- package/roles.js +3 -3
- package/sharing-tasks.d.ts +3 -3
- package/sharing-tasks.js +3 -3
- package/spaces.d.ts +3 -3
- package/spaces.js +3 -3
- package/tasks.d.ts +3 -3
- package/tasks.js +3 -3
- package/temp-contents.d.ts +3 -3
- package/temp-contents.js +3 -3
- package/tenants.d.ts +3 -3
- package/tenants.js +3 -3
- package/themes.d.ts +3 -3
- package/themes.js +3 -3
- package/transports.d.ts +3 -3
- package/transports.js +5 -3
- package/ui-config.d.ts +3 -3
- package/ui-config.js +3 -3
- package/users.d.ts +4 -4
- package/users.js +17 -4
- package/web-integrations.d.ts +3 -3
- package/web-integrations.js +3 -3
- package/web-notifications.d.ts +3 -3
- package/web-notifications.js +3 -3
- package/webhooks.d.ts +3 -3
- package/webhooks.js +3 -3
- package/website/assets/navigation.js +1 -1
- package/website/assets/search.js +1 -1
- package/website/functions/assistants.invokeAssistantThread.html +2 -2
- package/website/functions/{direct-access-agents.getDirectAccessAgentConnectorCustomDataTypeMappings.html → assistants.searchAssistant.html} +4 -4
- package/website/functions/assistants.streamAssistantThread.html +2 -2
- package/website/functions/auth.setDefaultHostConfig.html +1 -1
- package/website/functions/banners.clearCache.html +2 -0
- package/website/functions/banners.getBanners.html +3 -0
- package/website/functions/banners.upsertBanners.html +4 -0
- package/website/functions/direct-access-agents.createDirectAccessAgentBenchmark.html +7 -0
- package/website/functions/direct-access-agents.createDirectAccessAgentBenchmarkCancel.html +5 -0
- package/website/functions/{direct-access-agents.getDirectAccessAgentConnectorFilesAllowedPaths.html → direct-access-agents.getDirectAccessAgentBenchmark.html} +3 -3
- package/website/functions/knowledgebases.searchKnowledgebase.html +5 -0
- package/website/functions/transports.patchEmailConfig.html +3 -3
- package/website/functions/users.countUsers.html +3 -4
- package/website/functions/users.countUsersWithoutQuery.html +3 -0
- package/website/functions/users.getUsers.html +5 -14
- package/website/functions/webhooks.getWebhookDeliveries.html +6 -6
- package/website/functions/webhooks.getWebhooks.html +13 -13
- package/website/index.html +1 -1
- package/website/interfaces/auth.AuthAPI.html +1 -1
- package/website/interfaces/index.QlikAPI.html +4 -2
- package/website/interfaces/qix.GenericObject.html +1 -1
- package/website/modules/assistants.html +1 -1
- package/website/modules/banners.html +1 -0
- package/website/modules/direct-access-agents.html +1 -1
- package/website/modules/index.html +1 -1
- package/website/modules/knowledgebases.html +1 -1
- package/website/modules/transports.html +1 -1
- package/website/modules/users.html +1 -1
- package/website/types/assistants.AssistantsAPI.html +19 -14
- package/website/types/assistants.Chunk.html +11 -0
- package/website/types/assistants.CreateAssistantHttpError.html +2 -2
- package/website/types/assistants.CreateAssistantStarterHttpError.html +2 -2
- package/website/types/assistants.CreateAssistantThreadHttpError.html +2 -2
- package/website/types/assistants.CreateAssistantThreadInteractionFeedbackHttpError.html +2 -2
- package/website/types/assistants.CreateAssistantThreadInteractionHttpError.html +2 -2
- package/website/types/assistants.CreateAssistantThreadInteractionReviewHttpError.html +2 -2
- package/website/types/assistants.DeleteAssistantHttpError.html +2 -2
- package/website/types/assistants.DeleteAssistantStarterFollowupHttpError.html +2 -2
- package/website/types/assistants.DeleteAssistantStarterHttpError.html +2 -2
- package/website/types/assistants.DeleteAssistantThreadHttpError.html +2 -2
- package/website/types/assistants.DeleteAssistantThreadInteractionHttpError.html +2 -2
- package/website/types/assistants.ErrorResponseCode.html +1 -11
- package/website/types/assistants.ErrorResponseCodeCopy.html +11 -1
- package/website/types/assistants.GetAssistantFeedbackHttpError.html +2 -2
- package/website/types/assistants.GetAssistantHttpError.html +2 -2
- package/website/types/assistants.GetAssistantSourcesHttpError.html +2 -2
- package/website/types/assistants.GetAssistantStarterHttpError.html +2 -2
- package/website/types/assistants.GetAssistantStartersHttpError.html +2 -2
- package/website/types/assistants.GetAssistantThreadHttpError.html +2 -2
- package/website/types/assistants.GetAssistantThreadInteractionHttpError.html +2 -2
- package/website/types/assistants.GetAssistantThreadInteractionsHttpError.html +2 -2
- package/website/types/assistants.GetAssistantThreadsHttpError.html +2 -2
- package/website/types/assistants.GetAssistantsHttpError.html +2 -2
- package/website/types/assistants.InvokeAssistantThreadHttpError.html +2 -2
- package/website/types/assistants.KbChunkMeta.html +12 -0
- package/website/types/assistants.PatchAssistantHttpError.html +2 -2
- package/website/types/assistants.PatchAssistantThreadHttpError.html +2 -2
- package/website/types/assistants.PatchAssistantThreadInteractionFeedbackHttpError.html +2 -2
- package/website/types/assistants.SearchAssistantHttpError.html +4 -0
- package/website/types/assistants.SearchAssistantHttpResponse.html +4 -0
- package/website/types/assistants.SearchRequest.html +7 -0
- package/website/types/assistants.SearchResponse.html +3 -0
- package/website/types/assistants.StreamAssistantThreadHttpError.html +2 -2
- package/website/types/assistants.UpdateAssistantStarterFollowupHttpError.html +2 -2
- package/website/types/assistants.UpdateAssistantStarterHttpError.html +2 -2
- package/website/types/auth-types.WebSocketAuthParams.html +4 -2
- package/website/types/banners.BannerResponse.html +19 -0
- package/website/types/banners.BannerUpsertDefinition.html +11 -0
- package/website/types/banners.BannersAPI.html +10 -0
- package/website/types/banners.ErrorResponse400.html +3 -0
- package/website/types/banners.ErrorResponse401.html +3 -0
- package/website/types/banners.ErrorResponse403.html +3 -0
- package/website/types/banners.ErrorResponse404.html +3 -0
- package/website/types/banners.ErrorResponse500.html +3 -0
- package/website/types/banners.GetBanners400HttpError.html +4 -0
- package/website/types/banners.GetBanners401HttpError.html +4 -0
- package/website/types/banners.GetBanners403HttpError.html +4 -0
- package/website/types/banners.GetBanners404HttpError.html +4 -0
- package/website/types/banners.GetBanners500HttpError.html +4 -0
- package/website/types/banners.GetBannersHttpError.html +1 -0
- package/website/types/banners.GetBannersHttpResponse.html +4 -0
- package/website/types/banners.UpsertBanners400HttpError.html +4 -0
- package/website/types/banners.UpsertBanners401HttpError.html +4 -0
- package/website/types/banners.UpsertBanners403HttpError.html +4 -0
- package/website/types/banners.UpsertBanners404HttpError.html +4 -0
- package/website/types/banners.UpsertBanners500HttpError.html +4 -0
- package/website/types/banners.UpsertBannersHttpError.html +1 -0
- package/website/types/banners.UpsertBannersHttpResponse.html +4 -0
- package/website/types/direct-access-agents.CancelBenchmarkResponse.html +3 -0
- package/website/types/direct-access-agents.CreateDirectAccessAgentBenchmarkCancelHttpError.html +4 -0
- package/website/types/direct-access-agents.CreateDirectAccessAgentBenchmarkCancelHttpResponse.html +4 -0
- package/website/types/direct-access-agents.CreateDirectAccessAgentBenchmarkHttpError.html +4 -0
- package/website/types/direct-access-agents.CreateDirectAccessAgentBenchmarkHttpResponse.html +4 -0
- package/website/types/direct-access-agents.DirectAccessAgentsAPI.html +41 -48
- package/website/types/direct-access-agents.GetBenchmarkStatusResponse.html +14 -0
- package/website/types/direct-access-agents.GetBenchmarkStatusResults.html +11 -0
- package/website/types/direct-access-agents.GetDirectAccessAgentBenchmarkHttpError.html +4 -0
- package/website/types/{direct-access-agents.GetDirectAccessAgentConnectorCustomDataTypeMappingsHttpResponse.html → direct-access-agents.GetDirectAccessAgentBenchmarkHttpResponse.html} +2 -2
- package/website/types/direct-access-agents.LinkResponseObject.html +3 -0
- package/website/types/direct-access-agents.RunBenchmarkResponse.html +2 -0
- package/website/types/glossaries.TermCreateLinksTo.html +14 -1
- package/website/types/knowledgebases.Chunk.html +11 -0
- package/website/types/knowledgebases.ErrorResponseCodeCopy.html +14 -0
- package/website/types/knowledgebases.ErrorResponseCopy.html +3 -0
- package/website/types/knowledgebases.KbChunkMeta.html +12 -0
- package/website/types/knowledgebases.KnowledgebasesAPI.html +12 -7
- package/website/types/knowledgebases.SearchKnowledgebaseHttpError.html +4 -0
- package/website/types/knowledgebases.SearchKnowledgebaseHttpResponse.html +4 -0
- package/website/types/knowledgebases.SearchRequest.html +7 -0
- package/website/types/knowledgebases.SearchResponse.html +3 -0
- package/website/types/ml.PreprocessedInsightColumn.html +2 -2
- package/website/types/ml.ProfileInsights.html +12 -2
- package/website/types/qix.NativeGenericObjectFunctions.html +1 -1
- package/website/types/qix.RpcObject.html +1 -1
- package/website/types/transports.TransportsAPI.html +3 -3
- package/website/types/users.CountUsersWithoutQueryHttpError.html +4 -0
- package/website/types/users.CountUsersWithoutQueryHttpResponse.html +4 -0
- package/website/types/users.User.html +5 -11
- package/website/types/users.UserPostSchema.html +3 -5
- package/website/types/users.UsersAPI.html +13 -10
- package/website/types/webhooks.Delivery.html +14 -12
- package/website/types/webhooks.Error.html +3 -3
- package/website/types/webhooks.EventType.html +4 -4
- package/website/types/webhooks.Link.html +1 -1
- package/website/types/webhooks.WebhookBase.html +18 -16
- package/website/types/webhooks.WebhookPatch.html +3 -3
- package/website/types/webhooks.WebhookPost.html +1 -1
- package/website/types/webhooks.WebhookResponse.html +1 -1
- package/website/types/webhooks.WebhookResponseBase.html +21 -19
- package/website/variables/index.banners.html +1 -0
- package/website/variables/qix.QIX_SCHEMA_VERSION.html +1 -1
- package/website/functions/direct-access-agents.putDirectAccessAgentConnectorCustomDataTypeMappings.html +0 -6
- package/website/functions/direct-access-agents.putDirectAccessAgentConnectorFilesAllowedPaths.html +0 -6
- package/website/types/direct-access-agents.FileConnectorAllowedPath.html +0 -5
- package/website/types/direct-access-agents.FileConnectorAllowedPathsResponse.html +0 -3
- package/website/types/direct-access-agents.GetDirectAccessAgentConnectorCustomDataTypeMappingsHttpError.html +0 -4
- package/website/types/direct-access-agents.GetDirectAccessAgentConnectorFilesAllowedPathsHttpError.html +0 -4
- package/website/types/direct-access-agents.GetDirectAccessAgentConnectorFilesAllowedPathsHttpResponse.html +0 -4
- package/website/types/direct-access-agents.OdbcCustomDataType.html +0 -11
- package/website/types/direct-access-agents.OdbcCustomDataTypeResponse.html +0 -3
- package/website/types/direct-access-agents.PutDirectAccessAgentConnectorCustomDataTypeMappingsHttpError.html +0 -4
- package/website/types/direct-access-agents.PutDirectAccessAgentConnectorCustomDataTypeMappingsHttpResponse.html +0 -4
- package/website/types/direct-access-agents.PutDirectAccessAgentConnectorFilesAllowedPathsHttpError.html +0 -4
- package/website/types/direct-access-agents.PutDirectAccessAgentConnectorFilesAllowedPathsHttpResponse.html +0 -4
- package/website/types/direct-access-agents.UpdateFileConnectorAllowedPathsRequest.html +0 -2
- package/website/types/direct-access-agents.UpdateOdbcCustomTypeMappingsRequest.html +0 -2
- /package/chunks/{auth-types-BuIzsuoh.js → auth-types-BEj8JjOA.js} +0 -0
- /package/chunks/{global-types-BGMD2sDY.js → global-types-DW_kb7P7.js} +0 -0
- /package/chunks/{invoke-fetch-X0Vi-lbv.d.ts → invoke-fetch-C1Z0RJYU.d.ts} +0 -0
- /package/chunks/{utils-DI6bFnHB.js → utils-UaAiVTcc.js} +0 -0
- /package/chunks/{websocket-errors-BX-whwFJ.js → websocket-errors-CRTDTtBL.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as sortKeys, i as isNode, r as isBrowser, t as cleanFalsyValues } from "./utils-
|
|
2
|
-
import { i as getInterceptors } from "./interceptors-
|
|
3
|
-
import { n as hostConfigCommonProperties, t as authTypesThatCanBeOmitted } from "./auth-types-
|
|
1
|
+
import { a as sortKeys, i as isNode, r as isBrowser, t as cleanFalsyValues } from "./utils-UaAiVTcc.js";
|
|
2
|
+
import { i as getInterceptors } from "./interceptors-DoQ44M-n.js";
|
|
3
|
+
import { n as hostConfigCommonProperties, t as authTypesThatCanBeOmitted } from "./auth-types-BEj8JjOA.js";
|
|
4
4
|
import { customAlphabet, nanoid } from "nanoid";
|
|
5
5
|
|
|
6
6
|
//#region src/platform/platform-functions.ts
|
|
@@ -8,63 +8,46 @@ const getPlatform = async (options = {}) => {
|
|
|
8
8
|
const hc = withResolvedHostConfig(options.hostConfig);
|
|
9
9
|
if (hc.authType === "mock-backend-rest-recorder") return hc.recordGetPlatform();
|
|
10
10
|
if (hc?.authType === "mock-backend") return hc.mockGetPlatform();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
isUnknown: true,
|
|
23
|
-
isAnonymous
|
|
24
|
-
});
|
|
25
|
-
if (!productInfo || status <= 399 && status >= 300) return result({
|
|
26
|
-
isQSE: true,
|
|
27
|
-
isWindows: true,
|
|
28
|
-
isAnonymous
|
|
29
|
-
});
|
|
11
|
+
if (hc?.authType === "noauth") return result({ isUnknown: true });
|
|
12
|
+
let productInfo = isBrowser() ? window.QlikMain?.productInfo?.() : void 0;
|
|
13
|
+
if (!productInfo) {
|
|
14
|
+
const { data, status } = await getProductInfo(options);
|
|
15
|
+
productInfo = data;
|
|
16
|
+
if (status === 404) return result({ isUnknown: true });
|
|
17
|
+
if (!productInfo || status <= 399 && status >= 300) return result({
|
|
18
|
+
isQSE: true,
|
|
19
|
+
isWindows: true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
30
22
|
const deploymentType = (productInfo.composition?.deploymentType || "").toLowerCase();
|
|
31
|
-
const isControlCenter = deploymentType === "controlcenter";
|
|
32
23
|
if (deploymentType === "qliksenseserver") return result({
|
|
33
24
|
isQSE: true,
|
|
34
25
|
isWindows: true,
|
|
35
|
-
isAnonymous,
|
|
36
26
|
meta: extractMeta(productInfo)
|
|
37
27
|
});
|
|
38
28
|
if (deploymentType === "qliksensedesktop") return result({
|
|
39
29
|
isQSD: true,
|
|
40
30
|
isWindows: true,
|
|
41
|
-
isAnonymous,
|
|
42
31
|
meta: extractMeta(productInfo)
|
|
43
32
|
});
|
|
44
33
|
if (deploymentType === "qliksensemobile") return result({
|
|
45
34
|
isQSE: true,
|
|
46
35
|
isWindows: true,
|
|
47
|
-
isAnonymous,
|
|
48
36
|
meta: extractMeta(productInfo)
|
|
49
37
|
});
|
|
50
38
|
if (deploymentType === "cloud-console") return result({
|
|
51
39
|
isCloud: true,
|
|
52
40
|
isCloudConsole: true,
|
|
53
|
-
isAnonymous,
|
|
54
41
|
meta: extractMeta(productInfo)
|
|
55
42
|
});
|
|
56
43
|
if (productInfo.composition?.provider === "fedramp") return result({
|
|
57
44
|
isCloud: true,
|
|
58
45
|
isQCG: true,
|
|
59
|
-
isControlCenter,
|
|
60
|
-
isAnonymous,
|
|
61
46
|
meta: extractMeta(productInfo)
|
|
62
47
|
});
|
|
63
48
|
return result({
|
|
64
49
|
isCloud: true,
|
|
65
50
|
isQCS: true,
|
|
66
|
-
isControlCenter,
|
|
67
|
-
isAnonymous,
|
|
68
51
|
meta: extractMeta(productInfo)
|
|
69
52
|
});
|
|
70
53
|
};
|
|
@@ -134,17 +117,14 @@ const extractMeta = (data) => {
|
|
|
134
117
|
};
|
|
135
118
|
};
|
|
136
119
|
const result = (data) => ({
|
|
137
|
-
isNodeEnv: false,
|
|
138
120
|
isCloud: false,
|
|
139
121
|
isQCS: false,
|
|
140
122
|
isQCG: false,
|
|
141
123
|
isCloudConsole: false,
|
|
142
|
-
isControlCenter: false,
|
|
143
124
|
isWindows: false,
|
|
144
125
|
isQSE: false,
|
|
145
126
|
isQSD: false,
|
|
146
127
|
isUnknown: false,
|
|
147
|
-
isAnonymous: false,
|
|
148
128
|
...data
|
|
149
129
|
});
|
|
150
130
|
|
|
@@ -645,7 +625,7 @@ async function handlePotentialAuthenticationErrorAndRetry$1(hostConfig, fn) {
|
|
|
645
625
|
try {
|
|
646
626
|
return await fn();
|
|
647
627
|
} catch (err) {
|
|
648
|
-
const { retry } = await handleAuthenticationError$
|
|
628
|
+
const { retry } = await handleAuthenticationError$9({
|
|
649
629
|
hostConfig,
|
|
650
630
|
canRetry: true
|
|
651
631
|
});
|
|
@@ -678,14 +658,15 @@ async function getAnonymousAccessToken(hostConfig) {
|
|
|
678
658
|
if (tokens.accessToken) return tokens.accessToken;
|
|
679
659
|
return "";
|
|
680
660
|
}
|
|
681
|
-
async function getRestCallAuthParams$
|
|
661
|
+
async function getRestCallAuthParams$9({ hostConfig }) {
|
|
682
662
|
return {
|
|
683
663
|
headers: { Authorization: `Bearer ${await getAnonymousAccessToken(hostConfig)}` },
|
|
684
664
|
queryParams: {},
|
|
685
665
|
credentials: "omit"
|
|
686
666
|
};
|
|
687
667
|
}
|
|
688
|
-
async function getWebSocketAuthParams$
|
|
668
|
+
async function getWebSocketAuthParams$9({ hostConfig }) {
|
|
669
|
+
if (isNode()) return { headers: { Authorization: `Bearer ${await getAnonymousAccessToken(hostConfig)}` } };
|
|
689
670
|
return { queryParams: { accessToken: await handlePotentialAuthenticationErrorAndRetry$1(hostConfig, async () => {
|
|
690
671
|
return exchangeAccessTokenForTemporaryToken(hostConfig, await getAnonymousAccessToken(hostConfig), "websocket");
|
|
691
672
|
}) } };
|
|
@@ -695,7 +676,7 @@ async function getWebResourceAuthParams$2({ hostConfig }) {
|
|
|
695
676
|
return exchangeAccessTokenForTemporaryToken(hostConfig, await getAnonymousAccessToken(hostConfig), "websocket");
|
|
696
677
|
}) } };
|
|
697
678
|
}
|
|
698
|
-
async function handleAuthenticationError$
|
|
679
|
+
async function handleAuthenticationError$9({ hostConfig }) {
|
|
699
680
|
clearStoredAnonymousTokens(hostConfig);
|
|
700
681
|
return {
|
|
701
682
|
preventDefault: false,
|
|
@@ -705,33 +686,34 @@ async function handleAuthenticationError$8({ hostConfig }) {
|
|
|
705
686
|
var anonymous_default = {
|
|
706
687
|
requiredProps: ["clientId", "accessCode"],
|
|
707
688
|
optionalProps: [],
|
|
708
|
-
getRestCallAuthParams: getRestCallAuthParams$
|
|
709
|
-
getWebSocketAuthParams: getWebSocketAuthParams$
|
|
689
|
+
getRestCallAuthParams: getRestCallAuthParams$9,
|
|
690
|
+
getWebSocketAuthParams: getWebSocketAuthParams$9,
|
|
710
691
|
getWebResourceAuthParams: getWebResourceAuthParams$2,
|
|
711
|
-
handleAuthenticationError: handleAuthenticationError$
|
|
692
|
+
handleAuthenticationError: handleAuthenticationError$9
|
|
712
693
|
};
|
|
713
694
|
|
|
714
695
|
//#endregion
|
|
715
696
|
//#region src/auth/internal/default-auth-modules/apikey.ts
|
|
716
|
-
function getRestCallAuthParams$
|
|
697
|
+
function getRestCallAuthParams$8({ hostConfig }) {
|
|
717
698
|
return Promise.resolve({
|
|
718
699
|
headers: { Authorization: `Bearer ${hostConfig?.apiKey}` },
|
|
719
700
|
queryParams: {},
|
|
720
701
|
credentials: "omit"
|
|
721
702
|
});
|
|
722
703
|
}
|
|
723
|
-
async function getWebSocketAuthParams$
|
|
724
|
-
|
|
704
|
+
async function getWebSocketAuthParams$8({ hostConfig }) {
|
|
705
|
+
if (isBrowser()) throw new Error("Not supported in browser environment");
|
|
706
|
+
return Promise.resolve({ headers: { Authorization: `Bearer ${hostConfig?.apiKey}` } });
|
|
725
707
|
}
|
|
726
|
-
function handleAuthenticationError$
|
|
708
|
+
function handleAuthenticationError$8() {
|
|
727
709
|
return Promise.resolve({});
|
|
728
710
|
}
|
|
729
711
|
var apikey_default = {
|
|
730
712
|
requiredProps: ["apiKey"],
|
|
731
713
|
optionalProps: [],
|
|
732
|
-
getRestCallAuthParams: getRestCallAuthParams$
|
|
733
|
-
getWebSocketAuthParams: getWebSocketAuthParams$
|
|
734
|
-
handleAuthenticationError: handleAuthenticationError$
|
|
714
|
+
getRestCallAuthParams: getRestCallAuthParams$8,
|
|
715
|
+
getWebSocketAuthParams: getWebSocketAuthParams$8,
|
|
716
|
+
handleAuthenticationError: handleAuthenticationError$8
|
|
735
717
|
};
|
|
736
718
|
|
|
737
719
|
//#endregion
|
|
@@ -823,20 +805,6 @@ function applyPathVariables(pathTemplate, pathVariables) {
|
|
|
823
805
|
return result$1;
|
|
824
806
|
}
|
|
825
807
|
/**
|
|
826
|
-
* Builds a unique cache key from the parameters.
|
|
827
|
-
* The key is based on the url of a request (host? + path), query, headers and the hostconfig.
|
|
828
|
-
* Hostconfig is part of the key to ensure that two different hostconfigs don't share the same
|
|
829
|
-
* cache.
|
|
830
|
-
* @private
|
|
831
|
-
*/
|
|
832
|
-
function toCacheKey(url, query, serializedHostConfig, headers) {
|
|
833
|
-
let cacheKey = url;
|
|
834
|
-
if (query !== "") cacheKey = cacheKey.concat(`?${query}`);
|
|
835
|
-
if (headers) cacheKey = cacheKey.concat(`+headers=${JSON.stringify(headers)}`);
|
|
836
|
-
if (serializedHostConfig) cacheKey = cacheKey.concat(`+host-config=${serializedHostConfig}`);
|
|
837
|
-
return cacheKey;
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
808
|
* Join url and query to a complete url
|
|
841
809
|
* @private
|
|
842
810
|
*/
|
|
@@ -844,90 +812,6 @@ function toCompleteUrl(url, query) {
|
|
|
844
812
|
if (query !== "") return `${url}?${query}`;
|
|
845
813
|
return url;
|
|
846
814
|
}
|
|
847
|
-
/**
|
|
848
|
-
* Returns true if it is ok the to use the cached promise from a previous invocation
|
|
849
|
-
* @private
|
|
850
|
-
*/
|
|
851
|
-
function shouldUseCachedResult(options, cacheEntry, defaultMaxCacheTime) {
|
|
852
|
-
if (!cacheEntry || typeof cacheEntry.value === "undefined") return false;
|
|
853
|
-
if (options?.noCache) return false;
|
|
854
|
-
if (options?.useCacheIfAfter) return options.useCacheIfAfter.getTime() <= cacheEntry.lastPulled;
|
|
855
|
-
const age = Date.now() - cacheEntry.lastPulled;
|
|
856
|
-
if (options?.maxCacheAge) return age <= options?.maxCacheAge;
|
|
857
|
-
return age < defaultMaxCacheTime;
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Returns true if it is a cacheable request
|
|
861
|
-
* @private
|
|
862
|
-
*/
|
|
863
|
-
const shouldPopulateCache = (method) => method === "get" || method === "GET";
|
|
864
|
-
/**
|
|
865
|
-
* Clone mutable-objects using JSON.stringify.
|
|
866
|
-
* Strings, Blobs and ReadableStreams are not cloned.
|
|
867
|
-
* @private
|
|
868
|
-
*/
|
|
869
|
-
function clone(value) {
|
|
870
|
-
if (value && (value instanceof Blob || value instanceof Object && value.toString() === "[object Blob]")) return value;
|
|
871
|
-
if (value && value instanceof ReadableStream) return value;
|
|
872
|
-
if (typeof value === "string") return value;
|
|
873
|
-
return JSON.parse(JSON.stringify(value));
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Returns true if the verb might modify things requiring caches to be cleared
|
|
877
|
-
*/
|
|
878
|
-
function isModifyingVerb$1(verb) {
|
|
879
|
-
return !(verb === "get" || verb === "GET");
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Removes query, headers and host-config from the cache key to get a clean URL.
|
|
883
|
-
*/
|
|
884
|
-
function cacheKeyToUrl(cachedUrl) {
|
|
885
|
-
const queryIdx = cachedUrl.indexOf("?");
|
|
886
|
-
if (queryIdx >= 0) return cachedUrl.substring(0, queryIdx);
|
|
887
|
-
const headersIdx = cachedUrl.indexOf("+headers=");
|
|
888
|
-
if (headersIdx >= 0) return cachedUrl.substring(0, headersIdx);
|
|
889
|
-
const hostConfigIdx = cachedUrl.indexOf("+host-config=");
|
|
890
|
-
if (hostConfigIdx >= 0) return cachedUrl.substring(0, hostConfigIdx);
|
|
891
|
-
return cachedUrl;
|
|
892
|
-
}
|
|
893
|
-
/**
|
|
894
|
-
* Clears all cache entries where the modifying URL starts with the cached URL
|
|
895
|
-
* @param cache
|
|
896
|
-
* @param cacheKey
|
|
897
|
-
*/
|
|
898
|
-
function clearRelatedCacheEntries(cache$1, cacheKey) {
|
|
899
|
-
const modifyingUrl = cacheKeyToUrl(cacheKey);
|
|
900
|
-
for (const existingCacheKey in cache$1) {
|
|
901
|
-
const cleanUrl = cacheKeyToUrl(existingCacheKey);
|
|
902
|
-
if (modifyingUrl.startsWith(cleanUrl) || cleanUrl.startsWith(modifyingUrl)) delete cache$1[existingCacheKey];
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Clones the result so that no one can tamper with the cache. Note that the headers object is NOT cloned
|
|
907
|
-
* @private
|
|
908
|
-
*/
|
|
909
|
-
function cloneResultPromise(value) {
|
|
910
|
-
return value.then((resp) => {
|
|
911
|
-
const result$1 = {
|
|
912
|
-
data: clone(resp.data),
|
|
913
|
-
headers: resp.headers,
|
|
914
|
-
status: resp.status
|
|
915
|
-
};
|
|
916
|
-
if (resp.next) result$1.next = resp.next;
|
|
917
|
-
if (resp.prev) result$1.prev = resp.prev;
|
|
918
|
-
return result$1;
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* if the response is any kind of error clear the cached value for that completeUrl
|
|
923
|
-
* @private
|
|
924
|
-
*/
|
|
925
|
-
function clearCacheOnError(cacheEntry, cacheKey, value) {
|
|
926
|
-
return value.catch((error) => {
|
|
927
|
-
delete cacheEntry[cacheKey];
|
|
928
|
-
return Promise.reject(error);
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
815
|
|
|
932
816
|
//#endregion
|
|
933
817
|
//#region src/invoke-fetch/internal/invoke-xhr.ts
|
|
@@ -989,17 +873,197 @@ async function invokeXHR(completeUrl, { method, headers, credentials, keepalive,
|
|
|
989
873
|
}
|
|
990
874
|
|
|
991
875
|
//#endregion
|
|
992
|
-
//#region src/invoke-fetch/internal/
|
|
876
|
+
//#region src/invoke-fetch/internal/response-cache.ts
|
|
877
|
+
const responseCaches = {};
|
|
878
|
+
globalThis.__API_CACHE__DO_NOT_USE_OR_YOU_WILL_BE_FIRED = responseCaches;
|
|
993
879
|
let defaultCacheTime = 1e3 * 60 * 10;
|
|
994
|
-
|
|
995
|
-
|
|
880
|
+
/**
|
|
881
|
+
* The global namespace is used as a fallback if an entry is not found in a specific cache.
|
|
882
|
+
* This cache can be used internally, specifically by BFF interceptors,
|
|
883
|
+
* where we cannot reliably map a response to an API-module.
|
|
884
|
+
*/
|
|
885
|
+
const globalCacheNamespace = ".global";
|
|
886
|
+
/**
|
|
887
|
+
* Gets a cached response-promise from the specified API-namespace (or global cache).
|
|
888
|
+
* A promise is returned if options.noCache is not true, the promise exists and is not too
|
|
889
|
+
* old (based on defaults and cache-options).
|
|
890
|
+
*
|
|
891
|
+
* @param api The cache-namespace of the API.
|
|
892
|
+
* @param props CachingContext
|
|
893
|
+
* @returns The cached response (cloned and ready to use) or undefined.
|
|
894
|
+
*/
|
|
895
|
+
function getFromCache(api, props) {
|
|
896
|
+
if (isForbiddenApiName(api)) throw new Error(`Forbidden api name: ${api}`);
|
|
897
|
+
if (props?.options?.noCache) return;
|
|
898
|
+
const { method, completeUrl, cacheKey } = props;
|
|
899
|
+
const caches = getPossibleCaches(api);
|
|
900
|
+
if (isModifyingOperation(method, completeUrl)) return;
|
|
901
|
+
let entry;
|
|
902
|
+
for (const cache of caches) if (cacheKey in cache) {
|
|
903
|
+
entry = cache[cacheKey];
|
|
904
|
+
if (entry && typeof entry.value !== "undefined" && shouldUseCachedResult(props?.options, entry, defaultCacheTime)) break;
|
|
905
|
+
entry = void 0;
|
|
906
|
+
}
|
|
907
|
+
if (!entry) return;
|
|
908
|
+
entry.lastHit = /* @__PURE__ */ new Date();
|
|
909
|
+
entry.hitCount += 1;
|
|
910
|
+
entry.accessedPaths.add(globalThis.location ? globalThis.location.pathname : "node");
|
|
911
|
+
const value = entry.value;
|
|
912
|
+
return cloneResultPromise(value);
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* Updates the cache of 'api' with the response-promise based on the caching-context.
|
|
916
|
+
* If the promise comes from a modifying operation, related cache entries will be removed.
|
|
917
|
+
* The returned promise is either the original promise (if it isn't cached) or a
|
|
918
|
+
* cloned promise that is safe to use.
|
|
919
|
+
*
|
|
920
|
+
* Note: The original response-promise should not be reused directly, use the returned
|
|
921
|
+
* equivalent instead.
|
|
922
|
+
*
|
|
923
|
+
* @private
|
|
924
|
+
* @param api The cache-namespace of the API.
|
|
925
|
+
* @param props CachingContext
|
|
926
|
+
* @param responsePromise Promise<InvokeFetchResponse>, the thing to cache
|
|
927
|
+
* @returns
|
|
928
|
+
*/
|
|
929
|
+
function updateCache(api, props, responsePromise) {
|
|
930
|
+
if (isForbiddenApiName(api)) throw new Error(`Forbidden api name: ${api}`);
|
|
931
|
+
if (!responseCaches[api]) responseCaches[api] = {};
|
|
932
|
+
const { cacheKey } = props;
|
|
933
|
+
if (isModifyingOperation(props.method, props.completeUrl)) return responsePromise.then((res) => {
|
|
934
|
+
const caches = getPossibleCaches(api);
|
|
935
|
+
for (const cache of caches) clearRelatedCacheEntries(cache, cacheKey);
|
|
936
|
+
return res;
|
|
937
|
+
});
|
|
938
|
+
const cacheNamespace = responseCaches[api];
|
|
939
|
+
const responsePromiseWithCacheClearing = responsePromise.catch((error) => {
|
|
940
|
+
delete cacheNamespace[cacheKey];
|
|
941
|
+
return Promise.reject(error);
|
|
942
|
+
});
|
|
943
|
+
cacheNamespace[cacheKey] = {
|
|
944
|
+
lastPulled: Date.now(),
|
|
945
|
+
value: responsePromiseWithCacheClearing,
|
|
946
|
+
lastHit: null,
|
|
947
|
+
hitCount: 0,
|
|
948
|
+
accessedPaths: /* @__PURE__ */ new Set()
|
|
949
|
+
};
|
|
950
|
+
return cloneResultPromise(responsePromiseWithCacheClearing);
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Returns true if it is ok the to use the cached promise from a previous invocation
|
|
954
|
+
* @private
|
|
955
|
+
*/
|
|
956
|
+
function shouldUseCachedResult(options, cacheEntry, defaultMaxCacheTime) {
|
|
957
|
+
if (options?.noCache) return false;
|
|
958
|
+
if (!cacheEntry || typeof cacheEntry.value === "undefined") return false;
|
|
959
|
+
if (options?.useCacheIfAfter) return options.useCacheIfAfter.getTime() <= cacheEntry.lastPulled;
|
|
960
|
+
const age = Date.now() - cacheEntry.lastPulled;
|
|
961
|
+
if (typeof options?.maxCacheAge === "number") return age <= options?.maxCacheAge;
|
|
962
|
+
return age < defaultMaxCacheTime;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Builds a key used for caching based on a CachingContext
|
|
966
|
+
* @private
|
|
967
|
+
* @param cachingContext
|
|
968
|
+
* @returns a key used for caching
|
|
969
|
+
*/
|
|
970
|
+
function toCacheKey({ url, query, headers, serializedHostConfig }) {
|
|
971
|
+
let cacheKey = url;
|
|
972
|
+
if (query) {
|
|
973
|
+
const queryString = encodeQueryParams(query);
|
|
974
|
+
if (url.includes("?")) cacheKey = cacheKey.concat(`&${queryString}`);
|
|
975
|
+
else cacheKey = cacheKey.concat(`?${queryString}`);
|
|
976
|
+
}
|
|
977
|
+
if (headers) cacheKey = cacheKey.concat(`+headers=${JSON.stringify(headers)}`);
|
|
978
|
+
if (serializedHostConfig && serializedHostConfig !== "{}") cacheKey = cacheKey.concat(`+host-config=${serializedHostConfig}`);
|
|
979
|
+
return cacheKey;
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* Convenience function for getting a list of caches that are OK to use
|
|
983
|
+
* in the context of an API-namespace.
|
|
984
|
+
* @param api
|
|
985
|
+
* @returns
|
|
986
|
+
*/
|
|
987
|
+
function getPossibleCaches(api) {
|
|
988
|
+
const caches = [];
|
|
989
|
+
if (responseCaches[api]) caches.push(responseCaches[api]);
|
|
990
|
+
if (responseCaches[globalCacheNamespace]) caches.push(responseCaches[globalCacheNamespace]);
|
|
991
|
+
return caches;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* @private
|
|
995
|
+
* Clears all cache entries where the modifying URL starts with the cached URL
|
|
996
|
+
* @param cache
|
|
997
|
+
* @param cacheKey
|
|
998
|
+
*/
|
|
999
|
+
function clearRelatedCacheEntries(cache, cacheKey) {
|
|
1000
|
+
const modifyingUrl = cacheKeyToUrl(cacheKey);
|
|
1001
|
+
for (const existingCacheKey in cache) {
|
|
1002
|
+
const cleanUrl = cacheKeyToUrl(existingCacheKey);
|
|
1003
|
+
if (modifyingUrl.startsWith(cleanUrl) || cleanUrl.startsWith(modifyingUrl)) delete cache[existingCacheKey];
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Removes query, headers and host-config from the cache key to get a clean URL.
|
|
1008
|
+
*/
|
|
1009
|
+
function cacheKeyToUrl(cachedUrl) {
|
|
1010
|
+
const queryIdx = cachedUrl.indexOf("?");
|
|
1011
|
+
if (queryIdx >= 0) return cachedUrl.substring(0, queryIdx);
|
|
1012
|
+
const headersIdx = cachedUrl.indexOf("+headers=");
|
|
1013
|
+
if (headersIdx >= 0) return cachedUrl.substring(0, headersIdx);
|
|
1014
|
+
const hostConfigIdx = cachedUrl.indexOf("+host-config=");
|
|
1015
|
+
if (hostConfigIdx >= 0) return cachedUrl.substring(0, hostConfigIdx);
|
|
1016
|
+
return cachedUrl;
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Clone mutable-objects using JSON.stringify.
|
|
1020
|
+
* Strings, Blobs and ReadableStreams are not cloned.
|
|
1021
|
+
* @private
|
|
1022
|
+
*/
|
|
1023
|
+
function clone(value) {
|
|
1024
|
+
if (typeof value === "undefined" || value === null) return value;
|
|
1025
|
+
if (value && (value instanceof Blob || value instanceof Object && value.toString() === "[object Blob]")) return value;
|
|
1026
|
+
if (value && value instanceof ReadableStream) return value;
|
|
1027
|
+
if (typeof value === "string") return value;
|
|
1028
|
+
return JSON.parse(JSON.stringify(value));
|
|
1029
|
+
}
|
|
1030
|
+
/**
|
|
1031
|
+
* Clones the result so that no one can tamper with the cache. Note that the headers object is NOT cloned
|
|
1032
|
+
* @private
|
|
1033
|
+
*/
|
|
1034
|
+
function cloneResultPromise(value) {
|
|
1035
|
+
return value.then((resp) => {
|
|
1036
|
+
const result$1 = {
|
|
1037
|
+
data: clone(resp.data),
|
|
1038
|
+
headers: resp.headers,
|
|
1039
|
+
status: resp.status
|
|
1040
|
+
};
|
|
1041
|
+
if (resp.next) result$1.next = resp.next;
|
|
1042
|
+
if (resp.prev) result$1.prev = resp.prev;
|
|
1043
|
+
return result$1;
|
|
1044
|
+
});
|
|
1045
|
+
}
|
|
996
1046
|
/**
|
|
997
1047
|
* Clears cached responses
|
|
998
1048
|
* @param api the api to clear cache in
|
|
999
1049
|
*/
|
|
1000
1050
|
function clearApiCacheInternal(api) {
|
|
1001
|
-
|
|
1051
|
+
responseCaches[api] = {};
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Returns true if the method might modify things requiring caches to be cleared
|
|
1055
|
+
*/
|
|
1056
|
+
function isModifyingOperation(method, url) {
|
|
1057
|
+
if (method === "get" || method === "GET") return false;
|
|
1058
|
+
if (url.endsWith("/api/v1/licenses/allotments") && (method === "post" || method === "POST")) return false;
|
|
1059
|
+
return true;
|
|
1002
1060
|
}
|
|
1061
|
+
function isForbiddenApiName(api) {
|
|
1062
|
+
return api === "__proto__";
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/invoke-fetch/internal/invoke-fetch-methods.ts
|
|
1003
1067
|
function getErrorMessage(error) {
|
|
1004
1068
|
if (error instanceof Error) {
|
|
1005
1069
|
if (error.cause) {
|
|
@@ -1126,23 +1190,28 @@ async function getInvokeFetchUrlParams({ method, pathTemplate, pathVariables, qu
|
|
|
1126
1190
|
method
|
|
1127
1191
|
});
|
|
1128
1192
|
const url = locationUrl + applyPathVariables(pathTemplate, pathVariables);
|
|
1129
|
-
const
|
|
1193
|
+
const completeUrl = toCompleteUrl(url, encodeQueryParams({
|
|
1130
1194
|
...query,
|
|
1131
1195
|
...authQueryParams
|
|
1132
|
-
});
|
|
1196
|
+
}));
|
|
1197
|
+
const serializedHostConfig = serializeHostConfig$1(options?.hostConfig);
|
|
1133
1198
|
return {
|
|
1134
|
-
completeUrl
|
|
1135
|
-
cacheKey: toCacheKey(url, queryString, serializeHostConfig$1(options?.hostConfig), options?.headers),
|
|
1199
|
+
completeUrl,
|
|
1136
1200
|
authHeaders,
|
|
1137
|
-
credentials
|
|
1201
|
+
credentials,
|
|
1202
|
+
cacheKey: toCacheKey({
|
|
1203
|
+
url,
|
|
1204
|
+
query,
|
|
1205
|
+
headers: options?.headers,
|
|
1206
|
+
serializedHostConfig
|
|
1207
|
+
})
|
|
1138
1208
|
};
|
|
1139
1209
|
}
|
|
1140
1210
|
function invokeFetchWithUrl(api, props) {
|
|
1141
1211
|
return invokeFetchWithUrlAndRetry(api, props, async () => {
|
|
1142
|
-
const {
|
|
1212
|
+
const { authHeaders, credentials } = await getInvokeFetchUrlParams(props);
|
|
1143
1213
|
return invokeFetchWithUrlAndRetry(api, {
|
|
1144
1214
|
...props,
|
|
1145
|
-
cacheKey,
|
|
1146
1215
|
authHeaders,
|
|
1147
1216
|
credentials,
|
|
1148
1217
|
options: {
|
|
@@ -1152,39 +1221,31 @@ function invokeFetchWithUrl(api, props) {
|
|
|
1152
1221
|
}, void 0);
|
|
1153
1222
|
});
|
|
1154
1223
|
}
|
|
1155
|
-
function invokeFetchWithUrlAndRetry(api,
|
|
1156
|
-
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1224
|
+
function invokeFetchWithUrlAndRetry(api, props, performRetry) {
|
|
1225
|
+
const { method, completeUrl, body, options, authHeaders, credentials, cacheKey, contentType, userAgent } = props;
|
|
1226
|
+
const cachingContext = {
|
|
1227
|
+
method,
|
|
1228
|
+
completeUrl,
|
|
1229
|
+
cacheKey,
|
|
1230
|
+
options
|
|
1231
|
+
};
|
|
1232
|
+
const cachedResponse = getFromCache(api, cachingContext);
|
|
1233
|
+
if (cachedResponse) return cachedResponse;
|
|
1165
1234
|
const resultPromiseFromBackend = performActualHttpFetch(method, completeUrl, body, contentType, options, authHeaders, credentials, userAgent);
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
lastPulled: Date.now(),
|
|
1172
|
-
value: resultPromiseAfterCacheClearing,
|
|
1173
|
-
lastHit: null,
|
|
1174
|
-
hitCount: 0,
|
|
1175
|
-
accessedPaths: /* @__PURE__ */ new Set()
|
|
1176
|
-
};
|
|
1177
|
-
}
|
|
1178
|
-
return cloneResultPromise(resultPromiseAfterCacheClearing);
|
|
1235
|
+
const resultAfterAuthenticationCheck = interceptAuthenticationErrors(options?.hostConfig, resultPromiseFromBackend, performRetry);
|
|
1236
|
+
return updateCache(api, cachingContext, addPagingFunctions(api, {
|
|
1237
|
+
...props,
|
|
1238
|
+
value: resultAfterAuthenticationCheck
|
|
1239
|
+
}));
|
|
1179
1240
|
}
|
|
1180
1241
|
/**
|
|
1181
1242
|
* Adds paging functions to the response object if there are paging links present in the response body
|
|
1182
1243
|
*/
|
|
1183
|
-
function addPagingFunctions(api,
|
|
1184
|
-
const serializedHostConfig = serializeHostConfig$1(options?.hostConfig);
|
|
1244
|
+
function addPagingFunctions(api, { method, body, options, authHeaders, credentials, value }) {
|
|
1185
1245
|
return value.then((resp) => {
|
|
1186
1246
|
const dataWithPotentialLinks = resp.data;
|
|
1187
1247
|
if (!dataWithPotentialLinks) return resp;
|
|
1248
|
+
const serializedHostConfig = serializeHostConfig$1(options?.hostConfig);
|
|
1188
1249
|
const prevUrl = dataWithPotentialLinks.links?.prev?.href;
|
|
1189
1250
|
const nextUrl = dataWithPotentialLinks.links?.next?.href;
|
|
1190
1251
|
if (prevUrl) resp.prev = (prevOptions) => invokeFetchWithUrl(api, {
|
|
@@ -1192,18 +1253,26 @@ function addPagingFunctions(api, value, method, body, options, authHeaders, cred
|
|
|
1192
1253
|
completeUrl: prevUrl,
|
|
1193
1254
|
body,
|
|
1194
1255
|
options: prevOptions || options,
|
|
1195
|
-
cacheKey: toCacheKey(prevUrl, "", serializedHostConfig, options?.headers),
|
|
1196
1256
|
authHeaders,
|
|
1197
|
-
credentials
|
|
1257
|
+
credentials,
|
|
1258
|
+
cacheKey: toCacheKey({
|
|
1259
|
+
url: prevUrl,
|
|
1260
|
+
headers: options?.headers,
|
|
1261
|
+
serializedHostConfig
|
|
1262
|
+
})
|
|
1198
1263
|
});
|
|
1199
1264
|
if (nextUrl) resp.next = (nextOptions) => invokeFetchWithUrl(api, {
|
|
1200
1265
|
method,
|
|
1201
1266
|
completeUrl: nextUrl,
|
|
1202
1267
|
body,
|
|
1203
1268
|
options: nextOptions || options,
|
|
1204
|
-
cacheKey: toCacheKey(nextUrl, "", serializedHostConfig, options?.headers),
|
|
1205
1269
|
authHeaders,
|
|
1206
|
-
credentials
|
|
1270
|
+
credentials,
|
|
1271
|
+
cacheKey: toCacheKey({
|
|
1272
|
+
url: nextUrl,
|
|
1273
|
+
headers: options?.headers,
|
|
1274
|
+
serializedHostConfig
|
|
1275
|
+
})
|
|
1207
1276
|
});
|
|
1208
1277
|
return resp;
|
|
1209
1278
|
});
|
|
@@ -1293,14 +1362,14 @@ async function invokeFetchIntercepted(api, props) {
|
|
|
1293
1362
|
if (props?.userAgent) userAgent = props.userAgent;
|
|
1294
1363
|
else if (isBrowser()) userAgent = `${window.navigator.userAgent} ${defaultUserAgent}`;
|
|
1295
1364
|
else userAgent = defaultUserAgent;
|
|
1296
|
-
const { completeUrl,
|
|
1365
|
+
const { completeUrl, authHeaders, credentials, cacheKey } = await getInvokeFetchUrlParams(props);
|
|
1297
1366
|
return invokeFetchWithUrl(api, {
|
|
1298
1367
|
...props,
|
|
1299
1368
|
method: props.method.toUpperCase(),
|
|
1300
1369
|
completeUrl,
|
|
1301
|
-
cacheKey,
|
|
1302
1370
|
authHeaders,
|
|
1303
1371
|
credentials,
|
|
1372
|
+
cacheKey,
|
|
1304
1373
|
userAgent
|
|
1305
1374
|
});
|
|
1306
1375
|
}
|
|
@@ -1453,7 +1522,7 @@ function lookupGlobalGetAccessTokenFn(getAccessToken$1) {
|
|
|
1453
1522
|
function isModifyingVerb(verb) {
|
|
1454
1523
|
return !(verb === "get" || verb === "GET");
|
|
1455
1524
|
}
|
|
1456
|
-
async function getRestCallAuthParams$
|
|
1525
|
+
async function getRestCallAuthParams$7({ hostConfig, method }) {
|
|
1457
1526
|
const headers = {};
|
|
1458
1527
|
if (isModifyingVerb(method)) headers["qlik-csrf-token"] = await getCsrfToken(hostConfig);
|
|
1459
1528
|
if (hostConfig.webIntegrationId) headers["qlik-web-integration-id"] = hostConfig.webIntegrationId;
|
|
@@ -1463,12 +1532,18 @@ async function getRestCallAuthParams$6({ hostConfig, method }) {
|
|
|
1463
1532
|
credentials: internalGetCredentialsForCookieAuth(hostConfig)
|
|
1464
1533
|
};
|
|
1465
1534
|
}
|
|
1466
|
-
async function getWebSocketAuthParams$
|
|
1535
|
+
async function getWebSocketAuthParams$7({ hostConfig }) {
|
|
1536
|
+
if (isNode()) {
|
|
1537
|
+
const headers = {};
|
|
1538
|
+
headers["qlik-csrf-token"] = await getCsrfToken(hostConfig);
|
|
1539
|
+
if (hostConfig.webIntegrationId) headers["qlik-web-integration-id"] = hostConfig.webIntegrationId;
|
|
1540
|
+
return { headers };
|
|
1541
|
+
}
|
|
1467
1542
|
const params = { "qlik-csrf-token": await getCsrfToken(hostConfig, true) };
|
|
1468
1543
|
if (hostConfig.webIntegrationId) params["qlik-web-integration-id"] = hostConfig.webIntegrationId;
|
|
1469
1544
|
return { queryParams: params };
|
|
1470
1545
|
}
|
|
1471
|
-
async function handleAuthenticationError$
|
|
1546
|
+
async function handleAuthenticationError$7({ hostConfig, status }) {
|
|
1472
1547
|
clearCsrfToken(hostConfig);
|
|
1473
1548
|
if (status === 403) return {
|
|
1474
1549
|
preventDefault: false,
|
|
@@ -1488,57 +1563,57 @@ var cookie_default = {
|
|
|
1488
1563
|
"crossSiteCookies",
|
|
1489
1564
|
"anonymousMode"
|
|
1490
1565
|
],
|
|
1491
|
-
getRestCallAuthParams: getRestCallAuthParams$
|
|
1492
|
-
getWebSocketAuthParams: getWebSocketAuthParams$
|
|
1493
|
-
handleAuthenticationError: handleAuthenticationError$
|
|
1566
|
+
getRestCallAuthParams: getRestCallAuthParams$7,
|
|
1567
|
+
getWebSocketAuthParams: getWebSocketAuthParams$7,
|
|
1568
|
+
handleAuthenticationError: handleAuthenticationError$7
|
|
1494
1569
|
};
|
|
1495
1570
|
|
|
1496
1571
|
//#endregion
|
|
1497
1572
|
//#region src/auth/internal/default-auth-modules/noauth.ts
|
|
1498
|
-
function getRestCallAuthParams$
|
|
1573
|
+
function getRestCallAuthParams$6(_props) {
|
|
1499
1574
|
return Promise.resolve({
|
|
1500
1575
|
headers: {},
|
|
1501
1576
|
queryParams: {},
|
|
1502
1577
|
credentials: "same-origin"
|
|
1503
1578
|
});
|
|
1504
1579
|
}
|
|
1505
|
-
function getWebSocketAuthParams$
|
|
1580
|
+
function getWebSocketAuthParams$6(_props) {
|
|
1506
1581
|
return Promise.resolve({ queryParams: {} });
|
|
1507
1582
|
}
|
|
1508
|
-
function handleAuthenticationError$
|
|
1583
|
+
function handleAuthenticationError$6(_props) {
|
|
1509
1584
|
return Promise.resolve({});
|
|
1510
1585
|
}
|
|
1511
1586
|
/** @private */
|
|
1512
1587
|
var noauth_default = {
|
|
1513
1588
|
requiredProps: [],
|
|
1514
1589
|
optionalProps: [],
|
|
1515
|
-
getRestCallAuthParams: getRestCallAuthParams$
|
|
1516
|
-
getWebSocketAuthParams: getWebSocketAuthParams$
|
|
1517
|
-
handleAuthenticationError: handleAuthenticationError$
|
|
1590
|
+
getRestCallAuthParams: getRestCallAuthParams$6,
|
|
1591
|
+
getWebSocketAuthParams: getWebSocketAuthParams$6,
|
|
1592
|
+
handleAuthenticationError: handleAuthenticationError$6
|
|
1518
1593
|
};
|
|
1519
1594
|
|
|
1520
1595
|
//#endregion
|
|
1521
1596
|
//#region src/auth/internal/default-auth-modules/none.ts
|
|
1522
|
-
function getRestCallAuthParams$
|
|
1597
|
+
function getRestCallAuthParams$5() {
|
|
1523
1598
|
return Promise.resolve({
|
|
1524
1599
|
headers: {},
|
|
1525
1600
|
queryParams: {},
|
|
1526
1601
|
credentials: "same-origin"
|
|
1527
1602
|
});
|
|
1528
1603
|
}
|
|
1529
|
-
function getWebSocketAuthParams$
|
|
1604
|
+
function getWebSocketAuthParams$5() {
|
|
1530
1605
|
return Promise.resolve({ queryParams: {} });
|
|
1531
1606
|
}
|
|
1532
|
-
function handleAuthenticationError$
|
|
1607
|
+
function handleAuthenticationError$5() {
|
|
1533
1608
|
return Promise.resolve({});
|
|
1534
1609
|
}
|
|
1535
1610
|
/** @private */
|
|
1536
1611
|
var none_default = {
|
|
1537
1612
|
requiredProps: [],
|
|
1538
1613
|
optionalProps: [],
|
|
1539
|
-
getRestCallAuthParams: getRestCallAuthParams$
|
|
1540
|
-
getWebSocketAuthParams: getWebSocketAuthParams$
|
|
1541
|
-
handleAuthenticationError: handleAuthenticationError$
|
|
1614
|
+
getRestCallAuthParams: getRestCallAuthParams$5,
|
|
1615
|
+
getWebSocketAuthParams: getWebSocketAuthParams$5,
|
|
1616
|
+
handleAuthenticationError: handleAuthenticationError$5
|
|
1542
1617
|
};
|
|
1543
1618
|
|
|
1544
1619
|
//#endregion
|
|
@@ -1584,7 +1659,7 @@ async function handlePotentialAuthenticationErrorAndRetry(hostConfig, fn) {
|
|
|
1584
1659
|
try {
|
|
1585
1660
|
return await fn();
|
|
1586
1661
|
} catch (err) {
|
|
1587
|
-
const { retry } = await handleAuthenticationError$
|
|
1662
|
+
const { retry } = await handleAuthenticationError$4({
|
|
1588
1663
|
hostConfig,
|
|
1589
1664
|
canRetry: true
|
|
1590
1665
|
});
|
|
@@ -1592,14 +1667,15 @@ async function handlePotentialAuthenticationErrorAndRetry(hostConfig, fn) {
|
|
|
1592
1667
|
throw err;
|
|
1593
1668
|
}
|
|
1594
1669
|
}
|
|
1595
|
-
async function getRestCallAuthParams$
|
|
1670
|
+
async function getRestCallAuthParams$4({ hostConfig }) {
|
|
1596
1671
|
return {
|
|
1597
1672
|
headers: { Authorization: `Bearer ${await getOAuthAccessToken(hostConfig)}` },
|
|
1598
1673
|
queryParams: {},
|
|
1599
1674
|
credentials: "omit"
|
|
1600
1675
|
};
|
|
1601
1676
|
}
|
|
1602
|
-
async function getWebSocketAuthParams$
|
|
1677
|
+
async function getWebSocketAuthParams$4({ hostConfig }) {
|
|
1678
|
+
if (isNode()) return { headers: { Authorization: `Bearer ${await getOAuthAccessToken(hostConfig)}` } };
|
|
1603
1679
|
return { queryParams: { accessToken: await handlePotentialAuthenticationErrorAndRetry(hostConfig, async () => {
|
|
1604
1680
|
return exchangeAccessTokenForTemporaryToken(hostConfig, await getOAuthAccessToken(hostConfig), "websocket");
|
|
1605
1681
|
}) } };
|
|
@@ -1609,7 +1685,7 @@ async function getWebResourceAuthParams$1({ hostConfig }) {
|
|
|
1609
1685
|
return exchangeAccessTokenForTemporaryToken(hostConfig, await getOAuthAccessToken(hostConfig), "webresource");
|
|
1610
1686
|
}) } };
|
|
1611
1687
|
}
|
|
1612
|
-
async function handleAuthenticationError$
|
|
1688
|
+
async function handleAuthenticationError$4({ hostConfig }) {
|
|
1613
1689
|
if (hostConfig.getAccessToken) {
|
|
1614
1690
|
clearStoredOauthTokens(hostConfig);
|
|
1615
1691
|
return {
|
|
@@ -1645,21 +1721,21 @@ var oauth_default = {
|
|
|
1645
1721
|
"getAccessToken",
|
|
1646
1722
|
"performInteractiveLogin"
|
|
1647
1723
|
],
|
|
1648
|
-
getRestCallAuthParams: getRestCallAuthParams$
|
|
1649
|
-
getWebSocketAuthParams: getWebSocketAuthParams$
|
|
1724
|
+
getRestCallAuthParams: getRestCallAuthParams$4,
|
|
1725
|
+
getWebSocketAuthParams: getWebSocketAuthParams$4,
|
|
1650
1726
|
getWebResourceAuthParams: getWebResourceAuthParams$1,
|
|
1651
|
-
handleAuthenticationError: handleAuthenticationError$
|
|
1727
|
+
handleAuthenticationError: handleAuthenticationError$4
|
|
1652
1728
|
};
|
|
1653
1729
|
|
|
1654
1730
|
//#endregion
|
|
1655
1731
|
//#region src/auth/internal/default-auth-modules/reference.ts
|
|
1656
|
-
function getRestCallAuthParams$
|
|
1732
|
+
function getRestCallAuthParams$3() {
|
|
1657
1733
|
throw new Error("getRestCallAuthParams should never be called for reference auth module");
|
|
1658
1734
|
}
|
|
1659
|
-
function getWebSocketAuthParams$
|
|
1735
|
+
function getWebSocketAuthParams$3() {
|
|
1660
1736
|
throw new Error("getWebSocketAuthParams should never be called for reference auth module");
|
|
1661
1737
|
}
|
|
1662
|
-
function handleAuthenticationError$
|
|
1738
|
+
function handleAuthenticationError$3() {
|
|
1663
1739
|
throw new Error("handleAuthenticationError should never be called for reference auth module");
|
|
1664
1740
|
}
|
|
1665
1741
|
/**
|
|
@@ -1668,9 +1744,9 @@ function handleAuthenticationError$2() {
|
|
|
1668
1744
|
var reference_default = {
|
|
1669
1745
|
requiredProps: ["reference"],
|
|
1670
1746
|
optionalProps: [],
|
|
1671
|
-
getRestCallAuthParams: getRestCallAuthParams$
|
|
1672
|
-
getWebSocketAuthParams: getWebSocketAuthParams$
|
|
1673
|
-
handleAuthenticationError: handleAuthenticationError$
|
|
1747
|
+
getRestCallAuthParams: getRestCallAuthParams$3,
|
|
1748
|
+
getWebSocketAuthParams: getWebSocketAuthParams$3,
|
|
1749
|
+
handleAuthenticationError: handleAuthenticationError$3
|
|
1674
1750
|
};
|
|
1675
1751
|
|
|
1676
1752
|
//#endregion
|
|
@@ -1697,20 +1773,20 @@ function getXrfKey(hostConfig) {
|
|
|
1697
1773
|
|
|
1698
1774
|
//#endregion
|
|
1699
1775
|
//#region src/auth/internal/default-auth-modules/windows-cookie.ts
|
|
1700
|
-
async function getRestCallAuthParams$
|
|
1776
|
+
async function getRestCallAuthParams$2({ hostConfig }) {
|
|
1701
1777
|
return {
|
|
1702
1778
|
headers: { "X-Qlik-XrfKey": getXrfKey(hostConfig) },
|
|
1703
1779
|
queryParams: { xrfkey: getXrfKey(hostConfig) },
|
|
1704
1780
|
credentials: internalGetCredentialsForCookieAuth(hostConfig)
|
|
1705
1781
|
};
|
|
1706
1782
|
}
|
|
1707
|
-
async function getWebSocketAuthParams$
|
|
1783
|
+
async function getWebSocketAuthParams$2({ hostConfig }) {
|
|
1708
1784
|
return { queryParams: {
|
|
1709
1785
|
xrfkey: getXrfKey(hostConfig),
|
|
1710
1786
|
"qlik-csrf-token": await getCsrfToken(hostConfig, true)
|
|
1711
1787
|
} };
|
|
1712
1788
|
}
|
|
1713
|
-
async function handleAuthenticationError$
|
|
1789
|
+
async function handleAuthenticationError$2({ hostConfig }) {
|
|
1714
1790
|
if (hostConfig.loginUri) {
|
|
1715
1791
|
if (hostConfig.authRedirectUserConfirmation) await hostConfig.authRedirectUserConfirmation();
|
|
1716
1792
|
globalThis.location.replace(hostConfig.loginUri.replace("{location}", encodeURIComponent(globalThis.location.href)));
|
|
@@ -1741,6 +1817,81 @@ var windows_cookie_default = {
|
|
|
1741
1817
|
"crossSiteCookies",
|
|
1742
1818
|
"getAccessToken"
|
|
1743
1819
|
],
|
|
1820
|
+
getRestCallAuthParams: getRestCallAuthParams$2,
|
|
1821
|
+
getWebSocketAuthParams: getWebSocketAuthParams$2,
|
|
1822
|
+
handleAuthenticationError: handleAuthenticationError$2
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
//#endregion
|
|
1826
|
+
//#region src/auth/internal/default-auth-modules/windows-cookie-node.ts
|
|
1827
|
+
const nodeCookieStore = /* @__PURE__ */ new Map();
|
|
1828
|
+
function clearCookieInStore(hostConfig) {
|
|
1829
|
+
const key = serializeHostConfig$1(hostConfig);
|
|
1830
|
+
nodeCookieStore.delete(key);
|
|
1831
|
+
}
|
|
1832
|
+
function setCookieInStore(hostConfig, cookie) {
|
|
1833
|
+
const key = serializeHostConfig$1(hostConfig);
|
|
1834
|
+
nodeCookieStore.set(key, cookie);
|
|
1835
|
+
}
|
|
1836
|
+
function getCookieInStore(hostConfig) {
|
|
1837
|
+
const key = serializeHostConfig$1(hostConfig);
|
|
1838
|
+
return nodeCookieStore.get(key);
|
|
1839
|
+
}
|
|
1840
|
+
async function getCookie(hostConfig) {
|
|
1841
|
+
let cookie = getCookieInStore(hostConfig);
|
|
1842
|
+
if (!cookie) {
|
|
1843
|
+
const token = await resolveTokenIfPresent(hostConfig.getAccessToken);
|
|
1844
|
+
if (!token) throw new Error("Failed to acquire access token");
|
|
1845
|
+
cookie = (await fetch(`${toValidLocationUrl(hostConfig)}/qlik-embed/main.js`, {
|
|
1846
|
+
method: "GET",
|
|
1847
|
+
mode: "cors",
|
|
1848
|
+
credentials: "include",
|
|
1849
|
+
headers: {
|
|
1850
|
+
"Content-Type": "application/json",
|
|
1851
|
+
Authorization: `Bearer ${token}`
|
|
1852
|
+
}
|
|
1853
|
+
})).headers.get("Set-Cookie") || void 0;
|
|
1854
|
+
if (cookie) setCookieInStore(hostConfig, cookie);
|
|
1855
|
+
}
|
|
1856
|
+
if (!cookie) throw new Error("Failed to exchange access token for cookie");
|
|
1857
|
+
return cookie;
|
|
1858
|
+
}
|
|
1859
|
+
async function getRestCallAuthParams$1({ hostConfig }) {
|
|
1860
|
+
return {
|
|
1861
|
+
queryParams: { xrfkey: getXrfKey(hostConfig) },
|
|
1862
|
+
headers: {
|
|
1863
|
+
Cookie: await getCookie(hostConfig),
|
|
1864
|
+
"X-Qlik-XrfKey": getXrfKey(hostConfig)
|
|
1865
|
+
},
|
|
1866
|
+
credentials: internalGetCredentialsForCookieAuth(hostConfig)
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1869
|
+
async function getWebSocketAuthParams$1({ hostConfig }) {
|
|
1870
|
+
return {
|
|
1871
|
+
queryParams: { "qlik-csrf-token": await getCsrfToken(hostConfig, true) },
|
|
1872
|
+
headers: { Cookie: await getCookie(hostConfig) }
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
async function handleAuthenticationError$1({ hostConfig }) {
|
|
1876
|
+
clearCookieInStore(hostConfig);
|
|
1877
|
+
return { retry: true };
|
|
1878
|
+
}
|
|
1879
|
+
/** @private */
|
|
1880
|
+
var windows_cookie_node_default = {
|
|
1881
|
+
requiredProps: [],
|
|
1882
|
+
optionalProps: [
|
|
1883
|
+
"loginUri",
|
|
1884
|
+
"crossSiteCookies",
|
|
1885
|
+
"getAccessToken"
|
|
1886
|
+
],
|
|
1887
|
+
validateHostConfig: (hostConfig) => {
|
|
1888
|
+
if (typeof hostConfig.getAccessToken === "function") return true;
|
|
1889
|
+
if (typeof hostConfig.getAccessToken === "string") {
|
|
1890
|
+
if (!!!globalThis[hostConfig.getAccessToken]) throw new InvalidHostConfigError("The \"getAccessToken\" function name provided does not exist on globalThis.");
|
|
1891
|
+
return true;
|
|
1892
|
+
}
|
|
1893
|
+
throw new InvalidHostConfigError("The \"getAccessToken\" property must be a function or the name of a globally defined function.");
|
|
1894
|
+
},
|
|
1744
1895
|
getRestCallAuthParams: getRestCallAuthParams$1,
|
|
1745
1896
|
getWebSocketAuthParams: getWebSocketAuthParams$1,
|
|
1746
1897
|
handleAuthenticationError: handleAuthenticationError$1
|
|
@@ -1765,7 +1916,8 @@ let authModulesRegistered = false;
|
|
|
1765
1916
|
registerAuthModule("noauth", noauth_default);
|
|
1766
1917
|
registerAuthModule("oauth2", oauth_default);
|
|
1767
1918
|
registerAuthModule("anonymous", anonymous_default);
|
|
1768
|
-
registerAuthModule("windowscookie", windows_cookie_default);
|
|
1919
|
+
if (isBrowser()) registerAuthModule("windowscookie", windows_cookie_default);
|
|
1920
|
+
else registerAuthModule("windowscookie", windows_cookie_node_default);
|
|
1769
1921
|
registerAuthModule("reference", reference_default);
|
|
1770
1922
|
authModulesRegistered = true;
|
|
1771
1923
|
}
|
|
@@ -1983,7 +2135,7 @@ function getRegisteredHostConfig(name) {
|
|
|
1983
2135
|
return registeredHostConfigs.get(name);
|
|
1984
2136
|
}
|
|
1985
2137
|
/**
|
|
1986
|
-
* Sets the default host config that will be used for all api calls that do not
|
|
2138
|
+
* Sets the default host config that will be used for all api calls that do not include a HostConfig
|
|
1987
2139
|
* @private
|
|
1988
2140
|
* @param hostConfig the default HostConfig to use
|
|
1989
2141
|
*/
|
|
@@ -2166,7 +2318,7 @@ function registerAuthModule$1(name, authModule) {
|
|
|
2166
2318
|
registerAuthModule(name, authModule);
|
|
2167
2319
|
}
|
|
2168
2320
|
/**
|
|
2169
|
-
* Sets the default host config that will be used for all api calls that do not
|
|
2321
|
+
* Sets the default host config that will be used for all api calls that do not include a HostConfig
|
|
2170
2322
|
* @param hostConfig the default HostConfig to use
|
|
2171
2323
|
*/
|
|
2172
2324
|
function setDefaultHostConfig$1(hostConfig) {
|