@zitadel/api 0.3.0 → 0.5.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/README.md +17 -3
- package/dist/api-factory-32Zz3s86.mjs +359 -0
- package/dist/api-factory-32Zz3s86.mjs.map +1 -0
- package/dist/api-factory-DbVEEqxe.d.mts +217 -0
- package/dist/api-factory-DbVEEqxe.d.mts.map +1 -0
- package/dist/{fetch-CtYe0OvX.d.mts → fetch-BzLvdm6C.d.mts} +35 -12
- package/dist/fetch-BzLvdm6C.d.mts.map +1 -0
- package/dist/generated/endpoints/zitadelNextGen.d.mts +1 -1
- package/dist/generated/endpoints/zitadelNextGen.mjs +1099 -733
- package/dist/generated/endpoints/zitadelNextGen.mjs.map +1 -1
- package/dist/generated/endpoints/zitadelNextGen.msw.d.mts +1 -1
- package/dist/generated/endpoints/zitadelNextGen.msw.mjs +9 -9
- package/dist/generated/endpoints/zitadelNextGen.msw.mjs.map +1 -1
- package/dist/generated/endpoints/zitadelNextGen.zod.d.mts +1029 -657
- package/dist/generated/endpoints/zitadelNextGen.zod.d.mts.map +1 -1
- package/dist/generated/endpoints/zitadelNextGen.zod.mjs +4801 -4433
- package/dist/generated/endpoints/zitadelNextGen.zod.mjs.map +1 -1
- package/dist/generated/model/index.d.mts +2 -2
- package/dist/generated/model/index.mjs.map +1 -1
- package/dist/generated/operations.d.mts +9 -0
- package/dist/generated/operations.d.mts.map +1 -1
- package/dist/generated/operations.mjs +267 -154
- package/dist/generated/operations.mjs.map +1 -1
- package/dist/{index-DAm3tCA7.d.mts → index-BX80Kl-8.d.mts} +9183 -7757
- package/dist/index-BX80Kl-8.d.mts.map +1 -0
- package/dist/runtime/api-factory.d.mts +2 -51
- package/dist/runtime/api-factory.mjs +3 -62
- package/dist/runtime/auth.mjs +1 -1
- package/dist/runtime/auth.mjs.map +1 -1
- package/dist/runtime/base-url.d.mts +14 -0
- package/dist/runtime/base-url.d.mts.map +1 -1
- package/dist/runtime/base-url.mjs +22 -1
- package/dist/runtime/base-url.mjs.map +1 -1
- package/dist/runtime/config.d.mts +1 -1
- package/dist/runtime/config.mjs +1 -1
- package/dist/runtime/fetch.d.mts +2 -2
- package/dist/runtime/fetch.mjs +42 -17
- package/dist/runtime/fetch.mjs.map +1 -1
- package/dist/runtime/paging.d.mts +118 -0
- package/dist/runtime/paging.d.mts.map +1 -0
- package/dist/runtime/paging.mjs +138 -0
- package/dist/runtime/paging.mjs.map +1 -0
- package/dist/zitadelNextGen-CFrFhq_h.d.mts +1726 -0
- package/dist/zitadelNextGen-CFrFhq_h.d.mts.map +1 -0
- package/package.json +8 -3
- package/src/generated/endpoints/zitadelNextGen.faker.ts +3 -3
- package/src/generated/endpoints/zitadelNextGen.ts +1112 -746
- package/src/generated/endpoints/zitadelNextGen.zod.ts +4816 -4440
- package/src/generated/model/addOrigin201.ts +5 -0
- package/src/generated/model/addOrigin201Kind.ts +3 -0
- package/src/generated/model/addOriginBody.ts +17 -5
- package/src/generated/model/addOriginBodyKind.ts +4 -0
- package/src/generated/model/beginUserPasskeyRegistration201.ts +3 -3
- package/src/generated/model/beginUserPasskeyRegistrationBody.ts +6 -6
- package/src/generated/model/buildRelease200.ts +15 -15
- package/src/generated/model/buildRelease200Metadata.ts +8 -8
- package/src/generated/model/buildRelease200PointersItem.ts +13 -12
- package/src/generated/model/buildRelease200PointersItemKind.ts +3 -3
- package/src/generated/model/buildRelease201.ts +15 -15
- package/src/generated/model/buildRelease201Metadata.ts +8 -8
- package/src/generated/model/buildRelease201PointersItem.ts +13 -12
- package/src/generated/model/buildRelease201PointersItemKind.ts +3 -3
- package/src/generated/model/buildRelease400.ts +1 -3
- package/src/generated/model/buildRelease400DetailsResourcesItem.ts +3 -3
- package/src/generated/model/buildRelease400DetailsResourcesItemKind.ts +3 -3
- package/src/generated/model/buildReleaseBody.ts +19 -16
- package/src/generated/model/buildReleaseBodyBundle.ts +31 -28
- package/src/generated/model/buildReleaseBodyBundleBranding.ts +24 -22
- package/src/generated/model/buildReleaseBodyBundleBrandingLayout.ts +8 -7
- package/src/generated/model/buildReleaseBodyBundleBrandingShape.ts +1 -1
- package/src/generated/model/buildReleaseBodyBundleBrandingTheme.ts +5 -7
- package/src/generated/model/buildReleaseBodyBundleBrandingThemeDark.ts +7 -7
- package/src/generated/model/buildReleaseBodyBundleBrandingThemeDarkPalette.ts +63 -62
- package/src/generated/model/buildReleaseBodyBundleBrandingThemeLight.ts +7 -7
- package/src/generated/model/buildReleaseBodyBundleBrandingThemeLightPalette.ts +63 -62
- package/src/generated/model/buildReleaseBodyBundleBrandingTypography.ts +4 -4
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItem.ts +47 -26
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemAudience.ts +1 -1
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStatus.ts +2 -2
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItem.ts +46 -28
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemActionsItem.ts +9 -7
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemActionsItemKind.ts +2 -2
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemGates.ts +11 -10
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemGatesConfig.ts +1 -1
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemGatesKind.ts +4 -3
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemTransitions.ts +40 -20
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemTransitionsAction.ts +8 -5
- package/src/generated/model/buildReleaseBodyBundleFlowDefinitionsItemStepsItemTransitionsPurpose.ts +7 -8
- package/src/generated/model/buildReleaseBodyBundleIdpsItem.ts +7 -7
- package/src/generated/model/buildReleaseBodyBundleIdpsItemClaimMapping.ts +1 -1
- package/src/generated/model/buildReleaseBodyBundleIdpsItemOidc.ts +7 -7
- package/src/generated/model/buildReleaseBodyBundleIdpsItemOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/buildReleaseBodyBundleIdpsItemProvisioning.ts +1 -1
- package/src/generated/model/buildReleaseBodyBundleIdpsItemVerifiedClaims.ts +1 -1
- package/src/generated/model/buildReleaseBodyBundlePoliciesItem.ts +3 -3
- package/src/generated/model/buildReleaseBodyBundleSchemasItem.ts +23 -22
- package/src/generated/model/buildReleaseParams.ts +3 -1
- package/src/generated/model/completeClaim409.ts +2 -2
- package/src/generated/model/completeClaimBody.ts +1 -1
- package/src/generated/model/createAuthAttempt201.ts +23 -22
- package/src/generated/model/createAuthAttempt201ChallengesItem.ts +9 -7
- package/src/generated/model/createAuthAttempt201ChallengesItemState.ts +1 -1
- package/src/generated/model/createAuthAttempt201CompletedFactorsItem.ts +2 -2
- package/src/generated/model/createAuthAttempt201CompletedFactorsItemPayload.ts +5 -5
- package/src/generated/model/createAuthAttempt201State.ts +2 -2
- package/src/generated/model/createAuthAttemptBody.ts +3 -3
- package/src/generated/model/createAuthAttemptDefault.ts +63 -0
- package/src/generated/model/createBranding201.ts +10 -10
- package/src/generated/model/createBranding201Branding.ts +24 -22
- package/src/generated/model/createBranding201BrandingLayout.ts +8 -7
- package/src/generated/model/createBranding201BrandingShape.ts +1 -1
- package/src/generated/model/createBranding201BrandingTheme.ts +5 -7
- package/src/generated/model/createBranding201BrandingThemeDark.ts +7 -7
- package/src/generated/model/createBranding201BrandingThemeDarkPalette.ts +63 -62
- package/src/generated/model/createBranding201BrandingThemeLight.ts +7 -7
- package/src/generated/model/createBranding201BrandingThemeLightPalette.ts +63 -62
- package/src/generated/model/createBranding201BrandingTypography.ts +4 -4
- package/src/generated/model/createBrandingBody.ts +24 -22
- package/src/generated/model/createBrandingBodyLayout.ts +8 -7
- package/src/generated/model/createBrandingBodyShape.ts +1 -1
- package/src/generated/model/createBrandingBodyTheme.ts +5 -7
- package/src/generated/model/createBrandingBodyThemeDark.ts +7 -7
- package/src/generated/model/createBrandingBodyThemeDarkPalette.ts +63 -62
- package/src/generated/model/createBrandingBodyThemeLight.ts +7 -7
- package/src/generated/model/createBrandingBodyThemeLightPalette.ts +63 -62
- package/src/generated/model/createBrandingBodyTypography.ts +4 -4
- package/src/generated/model/createBrandingParams.ts +3 -1
- package/src/generated/model/createDeployment200.ts +16 -14
- package/src/generated/model/createDeployment200Metadata.ts +1 -1
- package/src/generated/model/createDeployment200Release.ts +15 -15
- package/src/generated/model/createDeployment200ReleaseMetadata.ts +8 -8
- package/src/generated/model/createDeployment200ReleasePointersItem.ts +13 -12
- package/src/generated/model/createDeployment200ReleasePointersItemKind.ts +3 -3
- package/src/generated/model/createDeployment200Status.ts +3 -3
- package/src/generated/model/createDeployment201.ts +16 -14
- package/src/generated/model/createDeployment201Metadata.ts +1 -1
- package/src/generated/model/createDeployment201Release.ts +15 -15
- package/src/generated/model/createDeployment201ReleaseMetadata.ts +8 -8
- package/src/generated/model/createDeployment201ReleasePointersItem.ts +13 -12
- package/src/generated/model/createDeployment201ReleasePointersItemKind.ts +3 -3
- package/src/generated/model/createDeployment201Status.ts +3 -3
- package/src/generated/model/createDeployment409.ts +41 -40
- package/src/generated/model/createDeploymentBody.ts +4 -10
- package/src/generated/model/createDeploymentParams.ts +3 -1
- package/src/generated/model/createFlow201.ts +16 -12
- package/src/generated/model/createFlow201Branding.ts +24 -22
- package/src/generated/model/createFlow201BrandingLayout.ts +8 -7
- package/src/generated/model/createFlow201BrandingShape.ts +1 -1
- package/src/generated/model/createFlow201BrandingTheme.ts +5 -7
- package/src/generated/model/createFlow201BrandingThemeDark.ts +7 -7
- package/src/generated/model/createFlow201BrandingThemeDarkPalette.ts +63 -62
- package/src/generated/model/createFlow201BrandingThemeLight.ts +7 -7
- package/src/generated/model/createFlow201BrandingThemeLightPalette.ts +63 -62
- package/src/generated/model/createFlow201BrandingTypography.ts +4 -4
- package/src/generated/model/createFlow201Step.ts +36 -31
- package/src/generated/model/createFlow201StepActionsItem.ts +3 -3
- package/src/generated/model/createFlow201StepActionsItemKind.ts +1 -1
- package/src/generated/model/createFlow201StepChallenge.ts +4 -3
- package/src/generated/model/createFlow201StepComplete.ts +1 -1
- package/src/generated/model/createFlow201StepFieldsItem.ts +14 -13
- package/src/generated/model/createFlow201StepFieldsItemType.ts +1 -1
- package/src/generated/model/createFlow201StepFieldsItemValidation.ts +2 -2
- package/src/generated/model/createFlow201StepFieldsItemValidationFormat.ts +1 -1
- package/src/generated/model/createFlow201StepGates.ts +10 -8
- package/src/generated/model/createFlow201StepGatesConfig.ts +1 -1
- package/src/generated/model/createFlow201StepGatesKind.ts +4 -3
- package/src/generated/model/createFlow201StepIdentifier.ts +6 -6
- package/src/generated/model/createFlow201StepSsoProvidersItem.ts +1 -1
- package/src/generated/model/createFlow201StepTexts.ts +1 -1
- package/src/generated/model/createFlowBody.ts +7 -2
- package/src/generated/model/createFlowBodyHint.ts +4 -1
- package/src/generated/model/createFlowBodyPurpose.ts +3 -0
- package/src/generated/model/createFlowDefault.ts +9 -0
- package/src/generated/model/createFlowDefinition201.ts +22 -10
- package/src/generated/model/createFlowDefinition201FlowDefinition.ts +47 -26
- package/src/generated/model/createFlowDefinition201FlowDefinitionAudience.ts +1 -1
- package/src/generated/model/createFlowDefinition201FlowDefinitionStatus.ts +2 -2
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItem.ts +46 -28
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemActionsItem.ts +9 -7
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemActionsItemKind.ts +2 -2
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemGates.ts +11 -10
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemGatesConfig.ts +1 -1
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemGatesKind.ts +4 -3
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemTransitions.ts +40 -20
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemTransitionsAction.ts +8 -5
- package/src/generated/model/createFlowDefinition201FlowDefinitionStepsItemTransitionsPurpose.ts +7 -8
- package/src/generated/model/createFlowDefinition201UserSchema.ts +2 -2
- package/src/generated/model/createFlowDefinition201UserSchemaMetadata.ts +2 -1
- package/src/generated/model/createFlowDefinition201UserSchemaSchema.ts +21 -20
- package/src/generated/model/createFlowDefinitionBody.ts +22 -12
- package/src/generated/model/createFlowDefinitionBodyFlowDefinition.ts +47 -26
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionAudience.ts +1 -1
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStatus.ts +2 -2
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItem.ts +46 -28
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemActionsItem.ts +9 -7
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemActionsItemKind.ts +2 -2
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemGates.ts +11 -10
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemGatesConfig.ts +1 -1
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemGatesKind.ts +4 -3
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemTransitions.ts +40 -20
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemTransitionsAction.ts +8 -5
- package/src/generated/model/createFlowDefinitionBodyFlowDefinitionStepsItemTransitionsPurpose.ts +7 -8
- package/src/generated/model/createGrant201.ts +14 -14
- package/src/generated/model/createGrant201ObjectType.ts +1 -1
- package/src/generated/model/createGrant201Relation.ts +1 -1
- package/src/generated/model/createGrant201Team.ts +7 -7
- package/src/generated/model/createGrant201TeamStatus.ts +2 -2
- package/src/generated/model/createGrant201User.ts +5 -5
- package/src/generated/model/createGrant201UserMetadata.ts +10 -11
- package/src/generated/model/createGrant201UserMetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/createGrant201UserMetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/createGrantBody.ts +12 -12
- package/src/generated/model/createGrantBodyRelation.ts +1 -1
- package/src/generated/model/createGrantBodyTeam.ts +3 -3
- package/src/generated/model/createGrantBodyUser.ts +5 -5
- package/src/generated/model/createGrantDefault.ts +9 -0
- package/src/generated/model/createGrantParams.ts +3 -1
- package/src/generated/model/createHandoff200.ts +9 -10
- package/src/generated/model/createIdp200.ts +10 -9
- package/src/generated/model/createIdp200Definition.ts +7 -7
- package/src/generated/model/createIdp200DefinitionClaimMapping.ts +1 -1
- package/src/generated/model/createIdp200DefinitionOidc.ts +7 -7
- package/src/generated/model/createIdp200DefinitionOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/createIdp200DefinitionProvisioning.ts +1 -1
- package/src/generated/model/createIdp200DefinitionVerifiedClaims.ts +1 -1
- package/src/generated/model/createIdp201.ts +10 -9
- package/src/generated/model/createIdp201Definition.ts +7 -7
- package/src/generated/model/createIdp201DefinitionClaimMapping.ts +1 -1
- package/src/generated/model/createIdp201DefinitionOidc.ts +7 -7
- package/src/generated/model/createIdp201DefinitionOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/createIdp201DefinitionProvisioning.ts +1 -1
- package/src/generated/model/createIdp201DefinitionVerifiedClaims.ts +1 -1
- package/src/generated/model/createIdpBody.ts +1 -1
- package/src/generated/model/createIdpBodyIdp.ts +7 -7
- package/src/generated/model/createIdpBodyIdpClaimMapping.ts +1 -1
- package/src/generated/model/createIdpBodyIdpOidc.ts +7 -7
- package/src/generated/model/createIdpBodyIdpOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/createIdpBodyIdpProvisioning.ts +1 -1
- package/src/generated/model/createIdpBodyIdpVerifiedClaims.ts +1 -1
- package/src/generated/model/createIdpParams.ts +3 -1
- package/src/generated/model/createProject201.ts +10 -5
- package/src/generated/model/createProject201OriginsItem.ts +17 -5
- package/src/generated/model/createProject201OriginsItemKind.ts +4 -0
- package/src/generated/model/createProjectBody.ts +5 -6
- package/src/generated/model/createProjectBodyOriginsItem.ts +17 -5
- package/src/generated/model/createProjectBodyOriginsItemKind.ts +4 -0
- package/src/generated/model/createRelease200.ts +15 -15
- package/src/generated/model/createRelease200Metadata.ts +8 -8
- package/src/generated/model/createRelease200PointersItem.ts +13 -12
- package/src/generated/model/createRelease200PointersItemKind.ts +3 -3
- package/src/generated/model/createRelease201.ts +15 -15
- package/src/generated/model/createRelease201Metadata.ts +8 -8
- package/src/generated/model/createRelease201PointersItem.ts +13 -12
- package/src/generated/model/createRelease201PointersItemKind.ts +3 -3
- package/src/generated/model/createReleaseBody.ts +7 -11
- package/src/generated/model/createReleaseBodyPointersItem.ts +8 -8
- package/src/generated/model/createReleaseBodyPointersItemKind.ts +3 -3
- package/src/generated/model/createReleaseParams.ts +3 -1
- package/src/generated/model/createSchema201.ts +1 -1
- package/src/generated/model/createSchemaBody.ts +23 -22
- package/src/generated/model/createSchemaParams.ts +4 -2
- package/src/generated/model/createSession201.ts +8 -8
- package/src/generated/model/createSession201Session.ts +16 -16
- package/src/generated/model/createSession201SessionFactorsItem.ts +2 -2
- package/src/generated/model/createSession201SessionFactorsItemPayload.ts +5 -5
- package/src/generated/model/createSession201SessionState.ts +1 -1
- package/src/generated/model/createSession201SessionUser.ts +5 -5
- package/src/generated/model/createSessionBody.ts +1 -1
- package/src/generated/model/createTeam201.ts +2 -2
- package/src/generated/model/createTeam201Status.ts +2 -2
- package/src/generated/model/createTeamBody.ts +1 -1
- package/src/generated/model/createTeamParams.ts +3 -1
- package/src/generated/model/createUser201.ts +28 -29
- package/src/generated/model/createUser201Metadata.ts +10 -11
- package/src/generated/model/createUser201MetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/createUser201MetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/createUser201TeamsItem.ts +4 -4
- package/src/generated/model/createUserBody.ts +9 -8
- package/src/generated/model/createUserParams.ts +4 -2
- package/src/generated/model/deleteGrantParams.ts +3 -1
- package/src/generated/model/deleteUserByID409.ts +20 -0
- package/src/generated/model/deleteUserByID409Details.ts +12 -0
- package/src/generated/model/deleteUserByIDDefault.ts +9 -0
- package/src/generated/model/deleteVariableParams.ts +3 -1
- package/src/generated/model/evaluatePolicy200.ts +5 -4
- package/src/generated/model/evaluatePolicy200Violations.ts +4 -3
- package/src/generated/model/evaluatePolicyBody.ts +8 -9
- package/src/generated/model/evaluatePolicyParams.ts +3 -1
- package/src/generated/model/exchangeHandoff200.ts +8 -8
- package/src/generated/model/exchangeHandoff200Session.ts +16 -16
- package/src/generated/model/exchangeHandoff200SessionFactorsItem.ts +2 -2
- package/src/generated/model/exchangeHandoff200SessionFactorsItemPayload.ts +5 -5
- package/src/generated/model/exchangeHandoff200SessionState.ts +1 -1
- package/src/generated/model/exchangeHandoff200SessionUser.ts +5 -5
- package/src/generated/model/exchangeHandoffBody.ts +7 -5
- package/src/generated/model/exchangeHandoffParams.ts +3 -1
- package/src/generated/model/finishUserPasskeyRegistrationBody.ts +1 -1
- package/src/generated/model/getAuthAttempt200.ts +23 -22
- package/src/generated/model/getAuthAttempt200ChallengesItem.ts +9 -7
- package/src/generated/model/getAuthAttempt200ChallengesItemState.ts +1 -1
- package/src/generated/model/getAuthAttempt200CompletedFactorsItem.ts +2 -2
- package/src/generated/model/getAuthAttempt200CompletedFactorsItemPayload.ts +5 -5
- package/src/generated/model/getAuthAttempt200State.ts +2 -2
- package/src/generated/model/getBrandingById200.ts +10 -10
- package/src/generated/model/getBrandingById200Branding.ts +24 -22
- package/src/generated/model/getBrandingById200BrandingLayout.ts +8 -7
- package/src/generated/model/getBrandingById200BrandingShape.ts +1 -1
- package/src/generated/model/getBrandingById200BrandingTheme.ts +5 -7
- package/src/generated/model/getBrandingById200BrandingThemeDark.ts +7 -7
- package/src/generated/model/getBrandingById200BrandingThemeDarkPalette.ts +63 -62
- package/src/generated/model/getBrandingById200BrandingThemeLight.ts +7 -7
- package/src/generated/model/getBrandingById200BrandingThemeLightPalette.ts +63 -62
- package/src/generated/model/getBrandingById200BrandingTypography.ts +4 -4
- package/src/generated/model/getClaimStatus200.ts +4 -5
- package/src/generated/model/getClaimStatusParams.ts +1 -1
- package/src/generated/model/getClaimWindow200.ts +6 -6
- package/src/generated/model/getClaimWindowParams.ts +1 -1
- package/src/generated/model/getDeploymentById200.ts +16 -14
- package/src/generated/model/getDeploymentById200Metadata.ts +1 -1
- package/src/generated/model/getDeploymentById200Release.ts +15 -15
- package/src/generated/model/getDeploymentById200ReleaseMetadata.ts +8 -8
- package/src/generated/model/getDeploymentById200ReleasePointersItem.ts +13 -12
- package/src/generated/model/getDeploymentById200ReleasePointersItemKind.ts +3 -3
- package/src/generated/model/getDeploymentById200Status.ts +3 -3
- package/src/generated/model/getDeploymentByIdParams.ts +3 -1
- package/src/generated/model/getDeploymentVariablesParams.ts +3 -1
- package/src/generated/model/getEvent200.ts +1574 -1323
- package/src/generated/model/getEventParams.ts +3 -1
- package/src/generated/model/getFlowDefinition200.ts +22 -10
- package/src/generated/model/getFlowDefinition200FlowDefinition.ts +47 -26
- package/src/generated/model/getFlowDefinition200FlowDefinitionAudience.ts +1 -1
- package/src/generated/model/getFlowDefinition200FlowDefinitionStatus.ts +2 -2
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItem.ts +46 -28
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemActionsItem.ts +9 -7
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemActionsItemKind.ts +2 -2
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemGates.ts +11 -10
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemGatesConfig.ts +1 -1
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemGatesKind.ts +4 -3
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemTransitions.ts +40 -20
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemTransitionsAction.ts +8 -5
- package/src/generated/model/getFlowDefinition200FlowDefinitionStepsItemTransitionsPurpose.ts +7 -8
- package/src/generated/model/getFlowDefinition200UserSchema.ts +2 -2
- package/src/generated/model/getFlowDefinition200UserSchemaMetadata.ts +2 -1
- package/src/generated/model/getFlowDefinition200UserSchemaSchema.ts +21 -20
- package/src/generated/model/getFlowStep200.ts +16 -12
- package/src/generated/model/getFlowStep200Branding.ts +24 -22
- package/src/generated/model/getFlowStep200BrandingLayout.ts +8 -7
- package/src/generated/model/getFlowStep200BrandingShape.ts +1 -1
- package/src/generated/model/getFlowStep200BrandingTheme.ts +5 -7
- package/src/generated/model/getFlowStep200BrandingThemeDark.ts +7 -7
- package/src/generated/model/getFlowStep200BrandingThemeDarkPalette.ts +63 -62
- package/src/generated/model/getFlowStep200BrandingThemeLight.ts +7 -7
- package/src/generated/model/getFlowStep200BrandingThemeLightPalette.ts +63 -62
- package/src/generated/model/getFlowStep200BrandingTypography.ts +4 -4
- package/src/generated/model/getFlowStep200Step.ts +36 -31
- package/src/generated/model/getFlowStep200StepActionsItem.ts +3 -3
- package/src/generated/model/getFlowStep200StepActionsItemKind.ts +1 -1
- package/src/generated/model/getFlowStep200StepChallenge.ts +4 -3
- package/src/generated/model/getFlowStep200StepComplete.ts +1 -1
- package/src/generated/model/getFlowStep200StepFieldsItem.ts +14 -13
- package/src/generated/model/getFlowStep200StepFieldsItemType.ts +1 -1
- package/src/generated/model/getFlowStep200StepFieldsItemValidation.ts +2 -2
- package/src/generated/model/getFlowStep200StepFieldsItemValidationFormat.ts +1 -1
- package/src/generated/model/getFlowStep200StepGates.ts +10 -8
- package/src/generated/model/getFlowStep200StepGatesConfig.ts +1 -1
- package/src/generated/model/getFlowStep200StepGatesKind.ts +4 -3
- package/src/generated/model/getFlowStep200StepIdentifier.ts +6 -6
- package/src/generated/model/getFlowStep200StepSsoProvidersItem.ts +1 -1
- package/src/generated/model/getFlowStep200StepTexts.ts +1 -1
- package/src/generated/model/getFlowStepDefault.ts +27 -0
- package/src/generated/model/getGrant200.ts +14 -14
- package/src/generated/model/getGrant200ObjectType.ts +1 -1
- package/src/generated/model/getGrant200Relation.ts +1 -1
- package/src/generated/model/getGrant200Team.ts +7 -7
- package/src/generated/model/getGrant200TeamStatus.ts +2 -2
- package/src/generated/model/getGrant200User.ts +5 -5
- package/src/generated/model/getGrant200UserMetadata.ts +10 -11
- package/src/generated/model/getGrant200UserMetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/getGrant200UserMetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/getGrantDefault.ts +0 -9
- package/src/generated/model/getGrantExpandItem.ts +8 -5
- package/src/generated/model/getGrantParams.ts +6 -3
- package/src/generated/model/getIdpById200.ts +10 -9
- package/src/generated/model/getIdpById200Definition.ts +7 -7
- package/src/generated/model/getIdpById200DefinitionClaimMapping.ts +1 -1
- package/src/generated/model/getIdpById200DefinitionOidc.ts +7 -7
- package/src/generated/model/getIdpById200DefinitionOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/getIdpById200DefinitionProvisioning.ts +1 -1
- package/src/generated/model/getIdpById200DefinitionVerifiedClaims.ts +1 -1
- package/src/generated/model/getIdpByIdParams.ts +3 -1
- package/src/generated/model/getIdpRevisionById200.ts +10 -9
- package/src/generated/model/getIdpRevisionById200Definition.ts +7 -7
- package/src/generated/model/getIdpRevisionById200DefinitionClaimMapping.ts +1 -1
- package/src/generated/model/getIdpRevisionById200DefinitionOidc.ts +7 -7
- package/src/generated/model/getIdpRevisionById200DefinitionOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/getIdpRevisionById200DefinitionProvisioning.ts +1 -1
- package/src/generated/model/getIdpRevisionById200DefinitionVerifiedClaims.ts +1 -1
- package/src/generated/model/getIdpRevisionByIdParams.ts +3 -1
- package/src/generated/model/getMyPasswordState200.ts +2 -2
- package/src/generated/model/getMySession200.ts +16 -16
- package/src/generated/model/getMySession200FactorsItem.ts +2 -2
- package/src/generated/model/getMySession200FactorsItemPayload.ts +5 -5
- package/src/generated/model/getMySession200State.ts +1 -1
- package/src/generated/model/getMySession200User.ts +5 -5
- package/src/generated/model/getMySessionCsrfToken200.ts +1 -1
- package/src/generated/model/getMyUser200.ts +28 -29
- package/src/generated/model/getMyUser200Metadata.ts +10 -11
- package/src/generated/model/getMyUser200MetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/getMyUser200MetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/getMyUser200TeamsItem.ts +4 -4
- package/src/generated/model/getMyUserSchema200.ts +4 -4
- package/src/generated/model/getMyUserSchema200Metadata.ts +2 -1
- package/src/generated/model/getMyUserSchema200Schema.ts +21 -20
- package/src/generated/model/getPolicy200.ts +3 -3
- package/src/generated/model/getPolicyParams.ts +3 -1
- package/src/generated/model/getPolicyRevision200.ts +3 -3
- package/src/generated/model/getPolicyRevisionParams.ts +3 -1
- package/src/generated/model/getProject200.ts +34 -30
- package/src/generated/model/getReleaseById200.ts +15 -15
- package/src/generated/model/getReleaseById200Metadata.ts +8 -8
- package/src/generated/model/getReleaseById200PointersItem.ts +13 -12
- package/src/generated/model/getReleaseById200PointersItemKind.ts +3 -3
- package/src/generated/model/getReleaseByIdParams.ts +3 -1
- package/src/generated/model/getSchemaById200.ts +4 -4
- package/src/generated/model/getSchemaById200Metadata.ts +2 -1
- package/src/generated/model/getSchemaById200Schema.ts +21 -20
- package/src/generated/model/getSchemaByIdParams.ts +3 -3
- package/src/generated/model/getSession200.ts +16 -16
- package/src/generated/model/getSession200FactorsItem.ts +2 -2
- package/src/generated/model/getSession200FactorsItemPayload.ts +5 -5
- package/src/generated/model/getSession200State.ts +1 -1
- package/src/generated/model/getSession200User.ts +5 -5
- package/src/generated/model/getTeam200.ts +2 -2
- package/src/generated/model/getTeam200Status.ts +2 -2
- package/src/generated/model/getUserByID200.ts +28 -29
- package/src/generated/model/getUserByID200Metadata.ts +10 -11
- package/src/generated/model/getUserByID200MetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/getUserByID200MetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/getUserByID200TeamsItem.ts +4 -4
- package/src/generated/model/getUserByIDParams.ts +4 -3
- package/src/generated/model/getUserPasswordState200.ts +2 -2
- package/src/generated/model/getVariable200.ts +4 -4
- package/src/generated/model/getVariable200Preview.ts +2 -2
- package/src/generated/model/getVariable200Primary.ts +2 -2
- package/src/generated/model/getVariableParams.ts +3 -1
- package/src/generated/model/getVariables200.ts +4 -4
- package/src/generated/model/getVariables200Preview.ts +2 -2
- package/src/generated/model/getVariables200Primary.ts +2 -2
- package/src/generated/model/getVariablesParams.ts +3 -1
- package/src/generated/model/index.ts +2 -0
- package/src/generated/model/initClaim201.ts +3 -3
- package/src/generated/model/initClaim409.ts +2 -2
- package/src/generated/model/issueChallenge201.ts +9 -7
- package/src/generated/model/issueChallenge201State.ts +1 -1
- package/src/generated/model/issueChallengeBody.ts +2 -2
- package/src/generated/model/listBrandingParams.ts +3 -1
- package/src/generated/model/listDeployments200DeploymentsItem.ts +16 -14
- package/src/generated/model/listDeployments200DeploymentsItemMetadata.ts +1 -1
- package/src/generated/model/listDeployments200DeploymentsItemRelease.ts +15 -15
- package/src/generated/model/listDeployments200DeploymentsItemReleaseMetadata.ts +8 -8
- package/src/generated/model/listDeployments200DeploymentsItemReleasePointersItem.ts +13 -12
- package/src/generated/model/listDeployments200DeploymentsItemReleasePointersItemKind.ts +3 -3
- package/src/generated/model/listDeployments200DeploymentsItemStatus.ts +3 -3
- package/src/generated/model/listDeploymentsExpandItem.ts +4 -4
- package/src/generated/model/listDeploymentsParams.ts +3 -1
- package/src/generated/model/listEvents200.ts +1 -1
- package/src/generated/model/listEvents200DataItem.ts +1574 -1323
- package/src/generated/model/listEventsParams.ts +34 -6
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItem.ts +22 -10
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinition.ts +47 -26
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionAudience.ts +1 -1
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStatus.ts +2 -2
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItem.ts +46 -28
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemActionsItem.ts +9 -7
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemActionsItemKind.ts +2 -2
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemGates.ts +11 -10
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemGatesConfig.ts +1 -1
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemGatesKind.ts +4 -3
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemTransitions.ts +40 -20
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemTransitionsAction.ts +8 -5
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemFlowDefinitionStepsItemTransitionsPurpose.ts +7 -8
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemUserSchema.ts +2 -2
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemUserSchemaMetadata.ts +2 -1
- package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemUserSchemaSchema.ts +21 -20
- package/src/generated/model/listFlowDefinitionsExpandItem.ts +2 -2
- package/src/generated/model/listFlowDefinitionsParams.ts +8 -6
- package/src/generated/model/listIdpRevisions200.ts +1 -2
- package/src/generated/model/listIdpRevisions200RevisionsItem.ts +10 -9
- package/src/generated/model/listIdpRevisions200RevisionsItemDefinition.ts +7 -7
- package/src/generated/model/listIdpRevisions200RevisionsItemDefinitionClaimMapping.ts +1 -1
- package/src/generated/model/listIdpRevisions200RevisionsItemDefinitionOidc.ts +7 -7
- package/src/generated/model/listIdpRevisions200RevisionsItemDefinitionOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/listIdpRevisions200RevisionsItemDefinitionProvisioning.ts +1 -1
- package/src/generated/model/listIdpRevisions200RevisionsItemDefinitionVerifiedClaims.ts +1 -1
- package/src/generated/model/listIdpRevisionsParams.ts +3 -1
- package/src/generated/model/listMyIdentityLinks200IdentityLinksItem.ts +2 -2
- package/src/generated/model/listMyProjects200.ts +1 -1
- package/src/generated/model/listMyProjects200ProjectsItem.ts +2 -3
- package/src/generated/model/listMyProjects200ProjectsItemOriginsItem.ts +17 -5
- package/src/generated/model/listMyProjects200ProjectsItemOriginsItemKind.ts +4 -0
- package/src/generated/model/listMyProjects200ProjectsItemPasswordHash.ts +12 -15
- package/src/generated/model/listMyProjects200ProjectsItemPasswordHashAlgorithm.ts +1 -1
- package/src/generated/model/listMyProjects200ProjectsItemPasswordHashParams.ts +15 -18
- package/src/generated/model/listMyProjects200ProjectsItemPasswordHashParamsHash.ts +4 -4
- package/src/generated/model/listMyTeams200TeamsItem.ts +4 -4
- package/src/generated/model/listPolicies200.ts +2 -2
- package/src/generated/model/listPolicies200PoliciesItem.ts +3 -3
- package/src/generated/model/listPoliciesParams.ts +3 -1
- package/src/generated/model/listPolicyRevisions200.ts +1 -1
- package/src/generated/model/listPolicyRevisions200RevisionsItem.ts +3 -3
- package/src/generated/model/listPolicyRevisionsParams.ts +3 -1
- package/src/generated/model/listPreviews200PreviewsItem.ts +4 -5
- package/src/generated/model/listProjectAdmins200AdminsItem.ts +3 -3
- package/src/generated/model/listProjectAdmins200AdminsItemSourcesItem.ts +13 -15
- package/src/generated/model/listProjectAdmins200AdminsItemUser.ts +5 -5
- package/src/generated/model/listReleases200.ts +1 -1
- package/src/generated/model/listReleases200ReleasesItem.ts +4 -4
- package/src/generated/model/listReleases200ReleasesItemMetadata.ts +8 -8
- package/src/generated/model/listReleasesParams.ts +4 -2
- package/src/generated/model/listSchemas200.ts +1 -1
- package/src/generated/model/listSchemas200SchemasItem.ts +4 -4
- package/src/generated/model/listSchemas200SchemasItemMetadata.ts +2 -1
- package/src/generated/model/listSchemas200SchemasItemSchema.ts +21 -20
- package/src/generated/model/listSchemasExpandItem.ts +2 -2
- package/src/generated/model/listSchemasParams.ts +7 -5
- package/src/generated/model/listUserIdentityLinks200IdentityLinksItem.ts +2 -2
- package/src/generated/model/listUserTeams200TeamsItem.ts +4 -4
- package/src/generated/model/patchMyUser200.ts +28 -29
- package/src/generated/model/patchMyUser200Metadata.ts +10 -11
- package/src/generated/model/patchMyUser200MetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/patchMyUser200MetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/patchMyUser200TeamsItem.ts +4 -4
- package/src/generated/model/patchMyUserBody.ts +2 -2
- package/src/generated/model/patchProject200.ts +34 -30
- package/src/generated/model/patchProjectBody.ts +3 -3
- package/src/generated/model/patchProjectBodyPasswordHash.ts +15 -18
- package/src/generated/model/patchProjectBodyPasswordHashAlgorithm.ts +1 -1
- package/src/generated/model/patchProjectBodyPasswordHashParams.ts +15 -18
- package/src/generated/model/patchProjectBodyPasswordHashParamsHash.ts +4 -4
- package/src/generated/model/patchUserByID200.ts +28 -29
- package/src/generated/model/patchUserByID200Metadata.ts +10 -11
- package/src/generated/model/patchUserByID200MetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/patchUserByID200MetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/patchUserByID200TeamsItem.ts +4 -4
- package/src/generated/model/patchUserByIDBody.ts +21 -13
- package/src/generated/model/publishPolicy201.ts +3 -3
- package/src/generated/model/publishPolicyBody.ts +3 -3
- package/src/generated/model/publishPolicyParams.ts +3 -1
- package/src/generated/model/queryGrants200GrantsItem.ts +14 -14
- package/src/generated/model/queryGrants200GrantsItemObjectType.ts +1 -1
- package/src/generated/model/queryGrants200GrantsItemRelation.ts +1 -1
- package/src/generated/model/queryGrants200GrantsItemTeam.ts +7 -7
- package/src/generated/model/queryGrants200GrantsItemTeamStatus.ts +2 -2
- package/src/generated/model/queryGrants200GrantsItemUser.ts +5 -5
- package/src/generated/model/queryGrants200GrantsItemUserMetadata.ts +10 -11
- package/src/generated/model/queryGrants200GrantsItemUserMetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/queryGrants200GrantsItemUserMetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/queryGrantsBody.ts +2 -3
- package/src/generated/model/queryGrantsBodyExpandItem.ts +8 -5
- package/src/generated/model/queryGrantsBodyFilterItem.ts +3 -5
- package/src/generated/model/queryGrantsBodyFilterItemOperation.ts +1 -2
- package/src/generated/model/queryGrantsDefault.ts +0 -9
- package/src/generated/model/queryGrantsParams.ts +3 -1
- package/src/generated/model/queryIdps200.ts +1 -1
- package/src/generated/model/queryIdps200IdpsItem.ts +10 -9
- package/src/generated/model/queryIdps200IdpsItemDefinition.ts +7 -7
- package/src/generated/model/queryIdps200IdpsItemDefinitionClaimMapping.ts +1 -1
- package/src/generated/model/queryIdps200IdpsItemDefinitionOidc.ts +7 -7
- package/src/generated/model/queryIdps200IdpsItemDefinitionOidcStaticAuthorizeParameters.ts +1 -1
- package/src/generated/model/queryIdps200IdpsItemDefinitionProvisioning.ts +1 -1
- package/src/generated/model/queryIdps200IdpsItemDefinitionVerifiedClaims.ts +1 -1
- package/src/generated/model/queryIdpsBody.ts +2 -2
- package/src/generated/model/queryIdpsBodyFilterItem.ts +5 -7
- package/src/generated/model/queryIdpsBodyFilterItemField.ts +2 -2
- package/src/generated/model/queryIdpsBodyFilterItemOperation.ts +1 -2
- package/src/generated/model/queryIdpsBodySorting.ts +2 -2
- package/src/generated/model/queryIdpsBodySortingField.ts +2 -2
- package/src/generated/model/queryIdpsParams.ts +3 -1
- package/src/generated/model/queryProjects200ProjectsItem.ts +2 -3
- package/src/generated/model/queryProjects200ProjectsItemOriginsItem.ts +17 -5
- package/src/generated/model/queryProjects200ProjectsItemOriginsItemKind.ts +4 -0
- package/src/generated/model/queryProjects200ProjectsItemPasswordHash.ts +12 -15
- package/src/generated/model/queryProjects200ProjectsItemPasswordHashAlgorithm.ts +1 -1
- package/src/generated/model/queryProjects200ProjectsItemPasswordHashParams.ts +15 -18
- package/src/generated/model/queryProjects200ProjectsItemPasswordHashParamsHash.ts +4 -4
- package/src/generated/model/queryProjectsBodyFilterItem.ts +3 -5
- package/src/generated/model/queryProjectsBodyFilterItemOperation.ts +1 -2
- package/src/generated/model/querySessions200SessionsItem.ts +16 -16
- package/src/generated/model/querySessions200SessionsItemFactorsItem.ts +2 -2
- package/src/generated/model/querySessions200SessionsItemFactorsItemPayload.ts +5 -5
- package/src/generated/model/querySessions200SessionsItemState.ts +1 -1
- package/src/generated/model/querySessions200SessionsItemUser.ts +5 -5
- package/src/generated/model/querySessionsBodyFilterItem.ts +4 -6
- package/src/generated/model/querySessionsBodyFilterItemField.ts +1 -1
- package/src/generated/model/querySessionsBodyFilterItemOperation.ts +1 -2
- package/src/generated/model/querySessionsBodySorting.ts +2 -3
- package/src/generated/model/querySessionsBodySortingField.ts +2 -3
- package/src/generated/model/querySessionsParams.ts +3 -1
- package/src/generated/model/queryTeams200TeamsItem.ts +2 -2
- package/src/generated/model/queryTeams200TeamsItemStatus.ts +2 -2
- package/src/generated/model/queryTeamsBodyFilterItem.ts +3 -5
- package/src/generated/model/queryTeamsBodyFilterItemOperation.ts +1 -2
- package/src/generated/model/queryTeamsParams.ts +3 -2
- package/src/generated/model/queryUsers200UsersItem.ts +28 -29
- package/src/generated/model/queryUsers200UsersItemMetadata.ts +10 -11
- package/src/generated/model/queryUsers200UsersItemMetadataLifecycleOwnerTeam.ts +11 -12
- package/src/generated/model/queryUsers200UsersItemMetadataLifecycleOwnerTeamStatus.ts +2 -2
- package/src/generated/model/queryUsers200UsersItemTeamsItem.ts +4 -4
- package/src/generated/model/queryUsersBody.ts +2 -2
- package/src/generated/model/queryUsersBodyExpandItem.ts +8 -8
- package/src/generated/model/queryUsersBodyFilterItem.ts +13 -16
- package/src/generated/model/queryUsersBodyFilterItemField.ts +10 -11
- package/src/generated/model/queryUsersBodyFilterItemOperation.ts +1 -2
- package/src/generated/model/queryUsersBodySorting.ts +4 -5
- package/src/generated/model/queryUsersBodySortingField.ts +4 -5
- package/src/generated/model/queryUsersParams.ts +2 -2
- package/src/generated/model/removeOriginBody.ts +2 -2
- package/src/generated/model/revokeRelease200.ts +15 -15
- package/src/generated/model/revokeRelease200Metadata.ts +8 -8
- package/src/generated/model/revokeRelease200PointersItem.ts +13 -12
- package/src/generated/model/revokeRelease200PointersItemKind.ts +3 -3
- package/src/generated/model/revokeReleaseParams.ts +3 -1
- package/src/generated/model/rollbackDeployment200.ts +16 -14
- package/src/generated/model/rollbackDeployment200Metadata.ts +1 -1
- package/src/generated/model/rollbackDeployment200Release.ts +15 -15
- package/src/generated/model/rollbackDeployment200ReleaseMetadata.ts +8 -8
- package/src/generated/model/rollbackDeployment200ReleasePointersItem.ts +13 -12
- package/src/generated/model/rollbackDeployment200ReleasePointersItemKind.ts +3 -3
- package/src/generated/model/rollbackDeployment200Status.ts +3 -3
- package/src/generated/model/rollbackDeployment201.ts +16 -14
- package/src/generated/model/rollbackDeployment201Metadata.ts +1 -1
- package/src/generated/model/rollbackDeployment201Release.ts +15 -15
- package/src/generated/model/rollbackDeployment201ReleaseMetadata.ts +8 -8
- package/src/generated/model/rollbackDeployment201ReleasePointersItem.ts +13 -12
- package/src/generated/model/rollbackDeployment201ReleasePointersItemKind.ts +3 -3
- package/src/generated/model/rollbackDeployment201Status.ts +3 -3
- package/src/generated/model/rollbackDeployment409.ts +41 -40
- package/src/generated/model/rollbackDeploymentParams.ts +3 -1
- package/src/generated/model/setUserPasswordBody.ts +1 -1
- package/src/generated/model/setUserPasswordDefault.ts +63 -0
- package/src/generated/model/submitFlowStep200.ts +16 -12
- package/src/generated/model/submitFlowStep200Branding.ts +24 -22
- package/src/generated/model/submitFlowStep200BrandingLayout.ts +8 -7
- package/src/generated/model/submitFlowStep200BrandingShape.ts +1 -1
- package/src/generated/model/submitFlowStep200BrandingTheme.ts +5 -7
- package/src/generated/model/submitFlowStep200BrandingThemeDark.ts +7 -7
- package/src/generated/model/submitFlowStep200BrandingThemeDarkPalette.ts +63 -62
- package/src/generated/model/submitFlowStep200BrandingThemeLight.ts +7 -7
- package/src/generated/model/submitFlowStep200BrandingThemeLightPalette.ts +63 -62
- package/src/generated/model/submitFlowStep200BrandingTypography.ts +4 -4
- package/src/generated/model/submitFlowStep200Step.ts +36 -31
- package/src/generated/model/submitFlowStep200StepActionsItem.ts +3 -3
- package/src/generated/model/submitFlowStep200StepActionsItemKind.ts +1 -1
- package/src/generated/model/submitFlowStep200StepChallenge.ts +4 -3
- package/src/generated/model/submitFlowStep200StepComplete.ts +1 -1
- package/src/generated/model/submitFlowStep200StepFieldsItem.ts +14 -13
- package/src/generated/model/submitFlowStep200StepFieldsItemType.ts +1 -1
- package/src/generated/model/submitFlowStep200StepFieldsItemValidation.ts +2 -2
- package/src/generated/model/submitFlowStep200StepFieldsItemValidationFormat.ts +1 -1
- package/src/generated/model/submitFlowStep200StepGates.ts +10 -8
- package/src/generated/model/submitFlowStep200StepGatesConfig.ts +1 -1
- package/src/generated/model/submitFlowStep200StepGatesKind.ts +4 -3
- package/src/generated/model/submitFlowStep200StepIdentifier.ts +6 -6
- package/src/generated/model/submitFlowStep200StepSsoProvidersItem.ts +1 -1
- package/src/generated/model/submitFlowStep200StepTexts.ts +1 -1
- package/src/generated/model/submitFlowStep400.ts +16 -12
- package/src/generated/model/submitFlowStep400Branding.ts +24 -22
- package/src/generated/model/submitFlowStep400BrandingLayout.ts +8 -7
- package/src/generated/model/submitFlowStep400BrandingShape.ts +1 -1
- package/src/generated/model/submitFlowStep400BrandingTheme.ts +5 -7
- package/src/generated/model/submitFlowStep400BrandingThemeDark.ts +7 -7
- package/src/generated/model/submitFlowStep400BrandingThemeDarkPalette.ts +63 -62
- package/src/generated/model/submitFlowStep400BrandingThemeLight.ts +7 -7
- package/src/generated/model/submitFlowStep400BrandingThemeLightPalette.ts +63 -62
- package/src/generated/model/submitFlowStep400BrandingTypography.ts +4 -4
- package/src/generated/model/submitFlowStep400Step.ts +36 -31
- package/src/generated/model/submitFlowStep400StepActionsItem.ts +3 -3
- package/src/generated/model/submitFlowStep400StepActionsItemKind.ts +1 -1
- package/src/generated/model/submitFlowStep400StepChallenge.ts +4 -3
- package/src/generated/model/submitFlowStep400StepComplete.ts +1 -1
- package/src/generated/model/submitFlowStep400StepFieldsItem.ts +14 -13
- package/src/generated/model/submitFlowStep400StepFieldsItemType.ts +1 -1
- package/src/generated/model/submitFlowStep400StepFieldsItemValidation.ts +2 -2
- package/src/generated/model/submitFlowStep400StepFieldsItemValidationFormat.ts +1 -1
- package/src/generated/model/submitFlowStep400StepGates.ts +10 -8
- package/src/generated/model/submitFlowStep400StepGatesConfig.ts +1 -1
- package/src/generated/model/submitFlowStep400StepGatesKind.ts +4 -3
- package/src/generated/model/submitFlowStep400StepIdentifier.ts +6 -6
- package/src/generated/model/submitFlowStep400StepSsoProvidersItem.ts +1 -1
- package/src/generated/model/submitFlowStep400StepTexts.ts +1 -1
- package/src/generated/model/submitFlowStepBody.ts +10 -7
- package/src/generated/model/submitFlowStepBodyChallengeResponse.ts +2 -2
- package/src/generated/model/submitFlowStepBodyGateProofs.ts +1 -1
- package/src/generated/model/submitFlowStepDefault.ts +27 -0
- package/src/generated/model/updateTeam200.ts +2 -2
- package/src/generated/model/updateTeam200Status.ts +2 -2
- package/src/generated/model/updateTeamBody.ts +1 -1
- package/src/generated/model/updateVariables200.ts +4 -4
- package/src/generated/model/updateVariables200Preview.ts +2 -2
- package/src/generated/model/updateVariables200Primary.ts +2 -2
- package/src/generated/model/updateVariablesBody.ts +14 -14
- package/src/generated/model/updateVariablesParams.ts +3 -1
- package/src/generated/model/userProperty.ts +5 -8
- package/src/generated/model/userPropertyProperties.ts +2 -2
- package/src/generated/model/userPropertyXUnique.ts +1 -1
- package/src/generated/model/verifyChallengeProof200.ts +23 -22
- package/src/generated/model/verifyChallengeProof200ChallengesItem.ts +9 -7
- package/src/generated/model/verifyChallengeProof200ChallengesItemState.ts +1 -1
- package/src/generated/model/verifyChallengeProof200CompletedFactorsItem.ts +2 -2
- package/src/generated/model/verifyChallengeProof200CompletedFactorsItemPayload.ts +5 -5
- package/src/generated/model/verifyChallengeProof200State.ts +2 -2
- package/src/generated/model/verifyChallengeProofBody.ts +2 -2
- package/src/generated/operations.ts +278 -153
- package/src/generated/paging.ts +128 -0
- package/src/runtime/api-factory.spec.ts +328 -0
- package/src/runtime/api-factory.ts +103 -13
- package/src/runtime/auth.ts +1 -1
- package/src/runtime/base-url.spec.ts +40 -4
- package/src/runtime/base-url.ts +28 -0
- package/src/runtime/fetch.spec.ts +51 -0
- package/src/runtime/fetch.ts +85 -30
- package/src/runtime/paged.spec.ts +115 -0
- package/src/runtime/paged.ts +62 -0
- package/src/runtime/paging.spec.ts +219 -0
- package/src/runtime/paging.ts +177 -0
- package/dist/fetch-CtYe0OvX.d.mts.map +0 -1
- package/dist/index-DAm3tCA7.d.mts.map +0 -1
- package/dist/runtime/api-factory.d.mts.map +0 -1
- package/dist/runtime/api-factory.mjs.map +0 -1
- package/dist/zitadelNextGen-B_VRpP2W.d.mts +0 -1360
- package/dist/zitadelNextGen-B_VRpP2W.d.mts.map +0 -1
|
@@ -1,62 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { t as zitadelNextGen_exports } from "../generated/endpoints/zitadelNextGen.mjs";
|
|
5
|
-
//#region src/runtime/api-factory.ts
|
|
6
|
-
/**
|
|
7
|
-
* Factory for the typed Zitadel client every consumer reaches for.
|
|
8
|
-
*
|
|
9
|
-
* Wraps the orval-generated endpoints in a {@link Proxy} so each
|
|
10
|
-
* generated function sees the right base URL and (optionally) the
|
|
11
|
-
* right bearer token at call time — without the caller having to
|
|
12
|
-
* thread either through every operation, and without exposing the
|
|
13
|
-
* module-globals (`setProxyPath` / `setApiAuthToken`) as part of the
|
|
14
|
-
* public API.
|
|
15
|
-
*
|
|
16
|
-
* Per-instance isolation: multiple clients can coexist in one process
|
|
17
|
-
* (different servers, different tokens). Their Proxy `get` traps set
|
|
18
|
-
* the globals synchronously before invoking the underlying generated
|
|
19
|
-
* function, which reads them at the top of `customFetch` before any
|
|
20
|
-
* `await`. Two clients running interleaved within a single JS turn
|
|
21
|
-
* are safe; two clients running in parallel across awaits could
|
|
22
|
-
* clobber each other — not a pattern any current consumer uses.
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Build a typed Zitadel client pre-bound to a base URL and (optionally)
|
|
26
|
-
* a bearer token. Every method on the returned object mirrors a
|
|
27
|
-
* generated orval function:
|
|
28
|
-
*
|
|
29
|
-
* const client = createZitadelClient({ baseUrl, token });
|
|
30
|
-
* await client.createProject({ origins: [] });
|
|
31
|
-
* await client.createSchema(body, { project_id });
|
|
32
|
-
*/
|
|
33
|
-
function createZitadelClient(opts) {
|
|
34
|
-
let baseUrl = opts.baseUrl;
|
|
35
|
-
while (baseUrl.endsWith("/")) baseUrl = baseUrl.slice(0, -1);
|
|
36
|
-
return new Proxy(zitadelNextGen_exports, { get(target, prop, receiver) {
|
|
37
|
-
const value = Reflect.get(target, prop, receiver);
|
|
38
|
-
if (typeof value !== "function") return value;
|
|
39
|
-
return (...args) => {
|
|
40
|
-
setProxyPath(baseUrl);
|
|
41
|
-
setApiAuthToken(opts.token);
|
|
42
|
-
setRequestPolicy({
|
|
43
|
-
signal: opts.signal,
|
|
44
|
-
timeoutMs: opts.timeoutMs
|
|
45
|
-
});
|
|
46
|
-
return value(...args);
|
|
47
|
-
};
|
|
48
|
-
} });
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Legacy entry point: builds a client with only the base URL set, no
|
|
52
|
-
* token. Components and SDKs that don't carry an auth token (browser
|
|
53
|
-
* flows authenticated by platform cookies) still consume this name.
|
|
54
|
-
* Equivalent to `createZitadelClient({ baseUrl: apiBase })`.
|
|
55
|
-
*/
|
|
56
|
-
function createApi(apiBase) {
|
|
57
|
-
return createZitadelClient({ baseUrl: apiBase });
|
|
58
|
-
}
|
|
59
|
-
//#endregion
|
|
60
|
-
export { createApi, createZitadelClient };
|
|
61
|
-
|
|
62
|
-
//# sourceMappingURL=api-factory.mjs.map
|
|
1
|
+
import "./base-url.mjs";
|
|
2
|
+
import { n as createZitadelClient, r as paging, t as createApi } from "../api-factory-32Zz3s86.mjs";
|
|
3
|
+
export { createApi, createZitadelClient, paging as pagedFunctions };
|
package/dist/runtime/auth.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function setApiAuthToken(token) {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* The CSRF token for the first-party browser surfaces (ADR 053 §5). A
|
|
21
|
-
* state-changing request that the
|
|
21
|
+
* state-changing request that the session cookie authenticates must
|
|
22
22
|
* carry the session's token — `csrf_token` from `GET /sessions/me/csrf` — in the
|
|
23
23
|
* `X-Zitadel-CSRF` header. The app sets it once it has loaded its session;
|
|
24
24
|
* `runtime/fetch.ts` then adds the header to unsafe requests. Unset (every
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.mjs","names":[],"sources":["../../src/runtime/auth.ts"],"sourcesContent":["/**\n * Module-global bearer token used by the orval-generated client's\n * custom fetch. Set once at command boot (the same lifecycle pattern\n * as `base-url.ts`); every generated request reads from here.\n *\n * Keeping the token here means the CLI doesn't have to thread an\n * `Authorization` header through every generated call site; orval's\n * `mutator` wires `runtime/fetch.ts` in, and that file pulls the token\n * from this module.\n */\nlet apiAuthToken: string | undefined;\n\nexport function getApiAuthToken(): string | undefined {\n return apiAuthToken;\n}\n\nexport function setApiAuthToken(token: string | undefined): void {\n apiAuthToken = token;\n}\n\n/**\n * The CSRF token for the first-party browser surfaces (ADR 053 §5). A\n * state-changing request that the
|
|
1
|
+
{"version":3,"file":"auth.mjs","names":[],"sources":["../../src/runtime/auth.ts"],"sourcesContent":["/**\n * Module-global bearer token used by the orval-generated client's\n * custom fetch. Set once at command boot (the same lifecycle pattern\n * as `base-url.ts`); every generated request reads from here.\n *\n * Keeping the token here means the CLI doesn't have to thread an\n * `Authorization` header through every generated call site; orval's\n * `mutator` wires `runtime/fetch.ts` in, and that file pulls the token\n * from this module.\n */\nlet apiAuthToken: string | undefined;\n\nexport function getApiAuthToken(): string | undefined {\n return apiAuthToken;\n}\n\nexport function setApiAuthToken(token: string | undefined): void {\n apiAuthToken = token;\n}\n\n/**\n * The CSRF token for the first-party browser surfaces (ADR 053 §5). A\n * state-changing request that the session cookie authenticates must\n * carry the session's token — `csrf_token` from `GET /sessions/me/csrf` — in the\n * `X-Zitadel-CSRF` header. The app sets it once it has loaded its session;\n * `runtime/fetch.ts` then adds the header to unsafe requests. Unset (every\n * other caller), nothing is added.\n *\n * The token belongs to the server that issued it, so it is stored with that\n * server's origin and only sent there: another client on the same page, with\n * another base URL, never carries it to a different host. The origin defaults\n * to the page's own, which is where a same-origin app's API lives; with no\n * origin to go by (no page, or an unparsable request URL), nothing is sent.\n *\n * Unlike the bearer slot, the app sets this one rather than the client, so it\n * lives on `globalThis` under a {@link Symbol.for} key, like the project slot in\n * `config.ts`: a second copy of this module (an SDK pinning another version)\n * must read the token the app's copy wrote.\n */\nconst CSRF_SLOT = Symbol.for(\"@zitadel/api/auth:csrf\");\n\ninterface CsrfSlot {\n token?: string;\n tokenOrigin?: string;\n onRejected?: () => Promise<string | undefined>;\n handlerOrigin?: string;\n}\n\nfunction csrfSlot(): CsrfSlot {\n const global = globalThis as Record<symbol, CsrfSlot | undefined>;\n const existing = global[CSRF_SLOT];\n if (existing) return existing;\n const slot: CsrfSlot = {};\n global[CSRF_SLOT] = slot;\n return slot;\n}\n\nfunction pageOrigin(): string | undefined {\n return (globalThis as { location?: { origin?: string } }).location?.origin;\n}\n\nexport function getApiCsrfToken(): string | undefined {\n return csrfSlot().token;\n}\n\n/**\n * Stores the session's CSRF token for the server at `origin` (default: the\n * page's own). `undefined` clears it.\n */\nexport function setApiCsrfToken(token: string | undefined, origin = pageOrigin()): void {\n const slot = csrfSlot();\n slot.token = token;\n slot.tokenOrigin = token === undefined ? undefined : origin;\n}\n\n/** The token to send to `origin`, if it was issued there. */\nexport function apiCsrfTokenFor(origin: string | undefined): string | undefined {\n const slot = csrfSlot();\n return origin !== undefined && slot.tokenOrigin === origin ? slot.token : undefined;\n}\n\n/**\n * Registers what to do when a state-changing request to `origin` (default: the\n * page's own) is refused with `403 auth.csrf_invalid`: the token is tied to the\n * session cookie, which another tab can replace by signing in again, or it was\n * never loaded. A refusal from any other host is not this session's business\n * and is left alone.\n *\n * The handler re-checks the session. It returns a fresh token only when the\n * session still belongs to the person the request was made for; `customFetch`\n * then retries the request once with it. Returning `undefined` (someone else,\n * or nobody, is signed in now) leaves the request refused, so a write is never\n * replayed under a session it was not prepared for.\n */\nexport function setApiCsrfRejectionHandler(\n onRejected: (() => Promise<string | undefined>) | undefined,\n origin = pageOrigin(),\n): void {\n const slot = csrfSlot();\n slot.onRejected = onRejected;\n slot.handlerOrigin = onRejected === undefined ? undefined : origin;\n}\n\nexport function getApiCsrfRejectionHandler(): (() => Promise<string | undefined>) | undefined {\n return csrfSlot().onRejected;\n}\n\n/** The rejection handler for a refusal from `origin`, if it was registered for it. */\nexport function apiCsrfRejectionHandlerFor(\n origin: string | undefined,\n): (() => Promise<string | undefined>) | undefined {\n const slot = csrfSlot();\n return origin !== undefined && slot.handlerOrigin === origin ? slot.onRejected : undefined;\n}\n"],"mappings":";;;;;;;;;;;AAUA,IAAI;AAEJ,SAAgB,kBAAsC;CACpD,OAAO;AACT;AAEA,SAAgB,gBAAgB,OAAiC;CAC/D,eAAe;AACjB;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,YAAY,OAAO,IAAI,wBAAwB;AASrD,SAAS,WAAqB;CAC5B,MAAM,SAAS;CACf,MAAM,WAAW,OAAO;CACxB,IAAI,UAAU,OAAO;CACrB,MAAM,OAAiB,CAAC;CACxB,OAAO,aAAa;CACpB,OAAO;AACT;AAEA,SAAS,aAAiC;CACxC,OAAQ,WAAkD,UAAU;AACtE;AAEA,SAAgB,kBAAsC;CACpD,OAAO,SAAS,CAAC,CAAC;AACpB;;;;;AAMA,SAAgB,gBAAgB,OAA2B,SAAS,WAAW,GAAS;CACtF,MAAM,OAAO,SAAS;CACtB,KAAK,QAAQ;CACb,KAAK,cAAc,UAAU,KAAA,IAAY,KAAA,IAAY;AACvD;;AAGA,SAAgB,gBAAgB,QAAgD;CAC9E,MAAM,OAAO,SAAS;CACtB,OAAO,WAAW,KAAA,KAAa,KAAK,gBAAgB,SAAS,KAAK,QAAQ,KAAA;AAC5E;;;;;;;;;;;;;;AAeA,SAAgB,2BACd,YACA,SAAS,WAAW,GACd;CACN,MAAM,OAAO,SAAS;CACtB,KAAK,aAAa;CAClB,KAAK,gBAAgB,eAAe,KAAA,IAAY,KAAA,IAAY;AAC9D;AAEA,SAAgB,6BAA8E;CAC5F,OAAO,SAAS,CAAC,CAAC;AACpB;;AAGA,SAAgB,2BACd,QACiD;CACjD,MAAM,OAAO,SAAS;CACtB,OAAO,WAAW,KAAA,KAAa,KAAK,kBAAkB,SAAS,KAAK,aAAa,KAAA;AACnF"}
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
//#region src/runtime/base-url.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The path the server serves the resource API under (ADR 077). An operation's
|
|
4
|
+
* path in the spec, such as `/users/me`, follows it: `/api/v1/users/me`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const API_PREFIX = "/api/v1";
|
|
2
7
|
export declare function getProxyPath(): string;
|
|
3
8
|
export declare function setProxyPath(path: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* `base`, a server's origin or a same-origin proxy path, with
|
|
11
|
+
* {@link API_PREFIX} after it: the base URL every operation's path follows.
|
|
12
|
+
* Trailing slashes go, and a base that already ends in the prefix, as an
|
|
13
|
+
* origin copied together with it might, keeps one.
|
|
14
|
+
*/
|
|
15
|
+
export declare function apiBaseUrl(base: string): string;
|
|
16
|
+
/** The base URL of the generated operations: the configured proxy path or server URL, then {@link API_PREFIX}. */
|
|
17
|
+
export declare function getApiBaseUrl(): string;
|
|
4
18
|
//#endregion
|
|
5
19
|
//# sourceMappingURL=base-url.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-url.d.mts","names":[],"sources":["../../src/runtime/base-url.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"base-url.d.mts","names":[],"sources":["../../src/runtime/base-url.ts"],"mappings":";;;;;qBAIa;wBAIG;wBAIA,aAAa;;;;;;;wBAUb,WAAW;;wBAYX"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
//#region src/runtime/base-url.ts
|
|
2
|
+
/**
|
|
3
|
+
* The path the server serves the resource API under (ADR 077). An operation's
|
|
4
|
+
* path in the spec, such as `/users/me`, follows it: `/api/v1/users/me`.
|
|
5
|
+
*/
|
|
6
|
+
const API_PREFIX = "/api/v1";
|
|
2
7
|
let proxyPath = "";
|
|
3
8
|
function getProxyPath() {
|
|
4
9
|
return proxyPath;
|
|
@@ -6,7 +11,23 @@ function getProxyPath() {
|
|
|
6
11
|
function setProxyPath(path) {
|
|
7
12
|
proxyPath = path;
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* `base`, a server's origin or a same-origin proxy path, with
|
|
16
|
+
* {@link API_PREFIX} after it: the base URL every operation's path follows.
|
|
17
|
+
* Trailing slashes go, and a base that already ends in the prefix, as an
|
|
18
|
+
* origin copied together with it might, keeps one.
|
|
19
|
+
*/
|
|
20
|
+
function apiBaseUrl(base) {
|
|
21
|
+
let trimmed = base;
|
|
22
|
+
while (trimmed.endsWith("/")) trimmed = trimmed.slice(0, -1);
|
|
23
|
+
if (trimmed.endsWith("/api/v1")) trimmed = trimmed.slice(0, -7);
|
|
24
|
+
return `${trimmed}${API_PREFIX}`;
|
|
25
|
+
}
|
|
26
|
+
/** The base URL of the generated operations: the configured proxy path or server URL, then {@link API_PREFIX}. */
|
|
27
|
+
function getApiBaseUrl() {
|
|
28
|
+
return apiBaseUrl(proxyPath);
|
|
29
|
+
}
|
|
9
30
|
//#endregion
|
|
10
|
-
export { getProxyPath, setProxyPath };
|
|
31
|
+
export { API_PREFIX, apiBaseUrl, getApiBaseUrl, getProxyPath, setProxyPath };
|
|
11
32
|
|
|
12
33
|
//# sourceMappingURL=base-url.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-url.mjs","names":[],"sources":["../../src/runtime/base-url.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"base-url.mjs","names":[],"sources":["../../src/runtime/base-url.ts"],"sourcesContent":["/**\n * The path the server serves the resource API under (ADR 077). An operation's\n * path in the spec, such as `/users/me`, follows it: `/api/v1/users/me`.\n */\nexport const API_PREFIX = \"/api/v1\";\n\nlet proxyPath = \"\";\n\nexport function getProxyPath(): string {\n return proxyPath;\n}\n\nexport function setProxyPath(path: string): void {\n proxyPath = path;\n}\n\n/**\n * `base`, a server's origin or a same-origin proxy path, with\n * {@link API_PREFIX} after it: the base URL every operation's path follows.\n * Trailing slashes go, and a base that already ends in the prefix, as an\n * origin copied together with it might, keeps one.\n */\nexport function apiBaseUrl(base: string): string {\n let trimmed = base;\n while (trimmed.endsWith(\"/\")) {\n trimmed = trimmed.slice(0, -1);\n }\n if (trimmed.endsWith(API_PREFIX)) {\n trimmed = trimmed.slice(0, -API_PREFIX.length);\n }\n return `${trimmed}${API_PREFIX}`;\n}\n\n/** The base URL of the generated operations: the configured proxy path or server URL, then {@link API_PREFIX}. */\nexport function getApiBaseUrl(): string {\n return apiBaseUrl(proxyPath);\n}\n"],"mappings":";;;;;AAIA,MAAa,aAAa;AAE1B,IAAI,YAAY;AAEhB,SAAgB,eAAuB;CACrC,OAAO;AACT;AAEA,SAAgB,aAAa,MAAoB;CAC/C,YAAY;AACd;;;;;;;AAQA,SAAgB,WAAW,MAAsB;CAC/C,IAAI,UAAU;CACd,OAAO,QAAQ,SAAS,GAAG,GACzB,UAAU,QAAQ,MAAM,GAAG,EAAE;CAE/B,IAAI,QAAQ,SAAA,SAAmB,GAC7B,UAAU,QAAQ,MAAM,GAAG,EAAkB;CAE/C,OAAO,GAAG,UAAU;AACtB;;AAGA,SAAgB,gBAAwB;CACtC,OAAO,WAAW,SAAS;AAC7B"}
|
package/dist/runtime/config.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setProxyPath } from "./base-url.mjs";
|
|
2
|
-
import { createZitadelClient } from "
|
|
2
|
+
import { n as createZitadelClient } from "../api-factory-32Zz3s86.mjs";
|
|
3
3
|
//#region src/runtime/config.ts
|
|
4
4
|
/**
|
|
5
5
|
* Slot for the configured project, stored on `globalThis` under a
|
package/dist/runtime/fetch.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { ApiError, CSRF_HEADER, NetworkError, RequestPolicy, apiErrorCode, apiErrorMessage, customFetch, request, setRequestPolicy };
|
|
1
|
+
import { a as RequestPolicy, c as customFetch, i as NetworkErrorReason, l as request, n as CSRF_HEADER, o as apiErrorCode, r as NetworkError, s as apiErrorMessage, t as ApiError, u as setRequestPolicy } from "../fetch-BzLvdm6C.mjs";
|
|
2
|
+
export { ApiError, CSRF_HEADER, NetworkError, NetworkErrorReason, RequestPolicy, apiErrorCode, apiErrorMessage, customFetch, request, setRequestPolicy };
|
package/dist/runtime/fetch.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { API_PREFIX } from "./base-url.mjs";
|
|
1
2
|
import { apiCsrfRejectionHandlerFor, apiCsrfTokenFor, getApiAuthToken } from "./auth.mjs";
|
|
2
3
|
//#region src/runtime/fetch.ts
|
|
3
4
|
/** The header the session-bound CSRF token travels in (ADR 053 §5). */
|
|
@@ -9,6 +10,8 @@ const SAFE_METHODS = /* @__PURE__ */ new Set([
|
|
|
9
10
|
]);
|
|
10
11
|
/** The code the server answers a refused CSRF check with. */
|
|
11
12
|
const CSRF_INVALID = "auth.csrf_invalid";
|
|
13
|
+
/** The code the server answers a path no operation of its version has with (ADR 076). */
|
|
14
|
+
const ROUTE_NOT_FOUND = "req.not_found";
|
|
12
15
|
/**
|
|
13
16
|
* Framework-neutral failure type the orval-generated client throws on
|
|
14
17
|
* any non-2xx response. Carries the HTTP status, the parsed error body
|
|
@@ -40,18 +43,24 @@ var ApiError = class extends Error {
|
|
|
40
43
|
}
|
|
41
44
|
};
|
|
42
45
|
/**
|
|
43
|
-
* Thrown when a request got no response
|
|
44
|
-
* reset, the host did not resolve,
|
|
45
|
-
*
|
|
46
|
-
* response that came back with a
|
|
46
|
+
* Thrown when a request got no usable response: the connection was refused or
|
|
47
|
+
* reset, the host did not resolve, the server accepted the connection but did
|
|
48
|
+
* not answer in time, or it answered with a body that could not be read. The
|
|
49
|
+
* counterpart to {@link ApiError}, which is a response that came back with a
|
|
50
|
+
* failing status.
|
|
47
51
|
*
|
|
48
|
-
* `fetch` only rejects when no response arrived,
|
|
49
|
-
*
|
|
50
|
-
*
|
|
52
|
+
* `fetch` only rejects when no response arrived, and reading the body only
|
|
53
|
+
* when the body broke off or could not be decoded, so this is decided by which
|
|
54
|
+
* of the two rejected, never by how a runtime words the failure. The runtime's
|
|
55
|
+
* own error stays on `cause` for debugging.
|
|
51
56
|
*/
|
|
52
57
|
var NetworkError = class extends Error {
|
|
53
58
|
url;
|
|
54
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* `timeout` when a deadline cut the request off, `unreadable` when a response
|
|
61
|
+
* arrived but its body could not be read (a proxy that labels a decoded body
|
|
62
|
+
* as compressed, say), `unreachable` otherwise.
|
|
63
|
+
*/
|
|
55
64
|
reason;
|
|
56
65
|
constructor(url, reason, message, options) {
|
|
57
66
|
super(message, options);
|
|
@@ -90,6 +99,7 @@ async function customFetch(url, options) {
|
|
|
90
99
|
const policy = requestPolicy;
|
|
91
100
|
const token = getApiAuthToken();
|
|
92
101
|
const headers = new Headers(options.headers);
|
|
102
|
+
if (policy.userAgent !== void 0) headers.set("user-agent", policy.userAgent);
|
|
93
103
|
if (token && !headers.has("authorization")) headers.set("authorization", `Bearer ${token}`);
|
|
94
104
|
const method = (options.method ?? "GET").toUpperCase();
|
|
95
105
|
const unsafe = !SAFE_METHODS.has(method) && !headers.has("X-Zitadel-CSRF");
|
|
@@ -112,7 +122,7 @@ async function customFetch(url, options) {
|
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
124
|
if (!res.ok) {
|
|
115
|
-
const message = `${options.method ?? "GET"} ${url} returned ${res.status}`;
|
|
125
|
+
const message = res.status === 404 && apiErrorCode(parsed) === ROUTE_NOT_FOUND ? `${options.method ?? "GET"} ${url} returned 404 (${ROUTE_NOT_FOUND}): the server has no such operation; a server older than this client does not serve the API under ${API_PREFIX}` : `${options.method ?? "GET"} ${url} returned ${res.status}`;
|
|
116
126
|
throw new ApiError(res.status, url, parsed, message, res.headers.get("x-request-id") || void 0);
|
|
117
127
|
}
|
|
118
128
|
return parsed;
|
|
@@ -148,6 +158,8 @@ function isStream(body) {
|
|
|
148
158
|
* - a deadline fired → {@link NetworkError} with reason `timeout`;
|
|
149
159
|
* - any other abort → the signal's own reason, rethrown untouched, because a
|
|
150
160
|
* cancellation is the caller's decision and the caller knows what it means;
|
|
161
|
+
* - a response arrived but `read` failed → {@link NetworkError} with reason
|
|
162
|
+
* `unreadable`, naming the status that did come back;
|
|
151
163
|
* - anything else → {@link NetworkError} with reason `unreachable`.
|
|
152
164
|
*
|
|
153
165
|
* Exported for the few callers that need the raw {@link Response} (a
|
|
@@ -158,24 +170,37 @@ async function request(url, init, policy = {}, read) {
|
|
|
158
170
|
if (policy.timeoutMs !== void 0) signals.push(AbortSignal.timeout(policy.timeoutMs));
|
|
159
171
|
const signal = signals.length > 0 ? AbortSignal.any(signals) : void 0;
|
|
160
172
|
const method = init.method ?? "GET";
|
|
173
|
+
let res;
|
|
161
174
|
try {
|
|
162
|
-
|
|
175
|
+
res = await fetch(url, {
|
|
163
176
|
...init,
|
|
164
177
|
signal
|
|
165
178
|
});
|
|
179
|
+
} catch (error) {
|
|
180
|
+
throw failure(error, signal, method, url, "unreachable", "got no response");
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
166
183
|
return {
|
|
167
184
|
res,
|
|
168
185
|
rawBody: read ? await read(res) : void 0
|
|
169
186
|
};
|
|
170
187
|
} catch (error) {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
188
|
+
throw failure(error, signal, method, url, "unreadable", `answered ${res.status}, but its body could not be read`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* What {@link request} rejects with when `fetch` or `read` failed: the abort
|
|
193
|
+
* as {@link request} describes it, or else a {@link NetworkError} of `reason`
|
|
194
|
+
* saying `what` happened to the request.
|
|
195
|
+
*/
|
|
196
|
+
function failure(error, signal, method, url, reason, what) {
|
|
197
|
+
if (signal?.aborted) {
|
|
198
|
+
const abort = signal.reason;
|
|
199
|
+
if (abort instanceof DOMException && abort.name === "TimeoutError") return new NetworkError(url, "timeout", `${method} ${url} timed out`, { cause: abort });
|
|
200
|
+
return abort;
|
|
178
201
|
}
|
|
202
|
+
const code = errnoOf(error);
|
|
203
|
+
return new NetworkError(url, reason, `${method} ${url} ${what}${code ? ` (${code})` : ""}`, { cause: error });
|
|
179
204
|
}
|
|
180
205
|
/**
|
|
181
206
|
* The errno a runtime attached to a failed request, if any, for the message.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.mjs","names":[],"sources":["../../src/runtime/fetch.ts"],"sourcesContent":["import { apiCsrfRejectionHandlerFor, apiCsrfTokenFor, getApiAuthToken } from \"./auth\";\n\n/** The header the session-bound CSRF token travels in (ADR 053 §5). */\nexport const CSRF_HEADER = \"X-Zitadel-CSRF\";\n\n// Mirrors the server's list (`httputil.IsSafeMethod` in `internal/httputil`).\nconst SAFE_METHODS = new Set([\"GET\", \"HEAD\", \"OPTIONS\"]);\n\n/** The code the server answers a refused CSRF check with. */\nconst CSRF_INVALID = \"auth.csrf_invalid\";\n\n/**\n * Framework-neutral failure type the orval-generated client throws on\n * any non-2xx response. Carries the HTTP status, the parsed error body\n * (the spec's `{code, message, details?}` envelope when the server\n * returned one), and the request URL — enough for callers to map to\n * their own error taxonomy without re-implementing the fetch layer.\n *\n * Callers that don't care about the distinction can catch `ApiError`\n * generically; callers that do (the CLI's `toZitadelError`) read\n * `status` and decide.\n */\nexport class ApiError extends Error {\n readonly status: number;\n readonly url: string;\n readonly body: unknown;\n /**\n * The server's ID for the request, from its `X-Request-Id` header: the\n * reference that finds the request in the server's logs, to show beside the\n * error. `undefined` when the response carried none, as from a proxy.\n */\n readonly requestId: string | undefined;\n\n constructor(status: number, url: string, body: unknown, message: string, requestId?: string) {\n super(message);\n this.name = \"ApiError\";\n this.status = status;\n this.url = url;\n this.body = body;\n this.requestId = requestId;\n }\n}\n\n/**\n * Thrown when a request got no response at all: the connection was refused or\n * reset, the host did not resolve, or the server accepted the connection but\n * did not answer in time. The counterpart to {@link ApiError}, which is a\n * response that came back with a failing status.\n *\n * `fetch` only rejects when no response arrived, so this is decided by the\n * fact that it rejected, never by how a runtime words the failure. The\n * runtime's own error stays on `cause` for debugging.\n */\nexport class NetworkError extends Error {\n readonly url: string;\n /** `timeout` when a deadline cut the request off, `unreachable` otherwise. */\n readonly reason: \"unreachable\" | \"timeout\";\n\n constructor(\n url: string,\n reason: \"unreachable\" | \"timeout\",\n message: string,\n options?: ErrorOptions,\n ) {\n super(message, options);\n this.name = \"NetworkError\";\n this.url = url;\n this.reason = reason;\n }\n}\n\n/**\n * What every request a client makes is bound by. Set per call by\n * `createZitadelClient`, the same way as the base URL and token, and read at\n * the top of {@link customFetch} before its first `await`.\n */\nexport type RequestPolicy = {\n /** Aborts every request made while it is set; its reason is rethrown as is. */\n signal?: AbortSignal;\n /** Per-request deadline, covering the response body as well as the headers. */\n timeoutMs?: number;\n};\n\nlet requestPolicy: RequestPolicy = {};\n\nexport function setRequestPolicy(policy: RequestPolicy): void {\n requestPolicy = policy;\n}\n\n/**\n * The orval `mutator` for the fetch client. Every generated operation\n * routes its request through this function instead of the global\n * `fetch`. We pin three concerns here so generated call sites stay\n * focused on the shape of one HTTP call:\n *\n * - bearer auth — read from `runtime/auth.ts` and attached automatically;\n * - the CSRF header — the session-bound token from `runtime/auth.ts`, on\n * unsafe methods to the origin it was issued for, when a first-party surface\n * has set one; an unsafe request to that origin refused with\n * `403 auth.csrf_invalid` asks the registered rejection handler for a fresh\n * token and is retried once with it, only if the handler returns one (the\n * session still belongs to the same person);\n * - non-2xx → throw — orval's stock client parses the body regardless\n * of status, so callers would have to inspect every response. Throw\n * `ApiError` on `!res.ok` so failures interrupt control flow;\n * - body parsing — return the parsed JSON typed as `T` (the operation's\n * return type, threaded through by orval), or `undefined` for the\n * spec's `204`/`205`/`304` no-body responses;\n * - no response → throw {@link NetworkError}, or the abort reason when the\n * caller cancelled (see {@link request}).\n */\nexport async function customFetch<T>(url: string, options: RequestInit): Promise<T> {\n // The client sets the policy per call, so it is read before the first await;\n // the retry below runs under the same policy as the first attempt.\n const policy = requestPolicy;\n const token = getApiAuthToken();\n const headers = new Headers(options.headers);\n if (token && !headers.has(\"authorization\")) {\n headers.set(\"authorization\", `Bearer ${token}`);\n }\n const method = (options.method ?? \"GET\").toUpperCase();\n const unsafe = !SAFE_METHODS.has(method) && !headers.has(CSRF_HEADER);\n // The token and the rejection handler belong to one server: a request to\n // any other origin gets neither.\n const target = originOf(url);\n const csrfToken = apiCsrfTokenFor(target);\n if (unsafe && csrfToken) {\n headers.set(CSRF_HEADER, csrfToken);\n }\n\n let { res, rawBody: parsed } = await request(url, { ...options, headers }, policy, readBody);\n\n // The token was stale (the session cookie changed under this page) or never\n // loaded. The app re-checks the session and hands back a fresh token only if\n // it still belongs to the same person; then the request is retried once. A\n // body that can be read only once cannot be sent again, so it is not retried.\n const onRejected = apiCsrfRejectionHandlerFor(target);\n if (\n unsafe &&\n onRejected &&\n res.status === 403 &&\n apiErrorCode(parsed) === CSRF_INVALID &&\n !isStream(options.body)\n ) {\n const fresh = await onRejected().catch(() => undefined);\n if (fresh && fresh !== csrfToken) {\n headers.set(CSRF_HEADER, fresh);\n ({ res, rawBody: parsed } = await request(url, { ...options, headers }, policy, readBody));\n }\n }\n\n if (!res.ok) {\n const message = `${options.method ?? \"GET\"} ${url} returned ${res.status}`;\n throw new ApiError(\n res.status,\n url,\n parsed,\n message,\n res.headers.get(\"x-request-id\") || undefined,\n );\n }\n\n return parsed as T;\n}\n\n/** The parsed body, or `undefined` for the spec's no-body responses. */\nasync function readBody(res: Response): Promise<unknown> {\n if ([204, 205, 304].includes(res.status)) return undefined;\n const rawBody = await res.text();\n return rawBody ? (safeJsonParse(rawBody) as unknown) : undefined;\n}\n\n/** The request's origin, resolved against the page for a relative URL. */\nfunction originOf(url: string): string | undefined {\n try {\n return new URL(url, (globalThis as { location?: { href?: string } }).location?.href).origin;\n } catch {\n return undefined;\n }\n}\n\nfunction isStream(body: RequestInit[\"body\"]): boolean {\n return typeof ReadableStream !== \"undefined\" && body instanceof ReadableStream;\n}\n\n/**\n * `fetch` bound by a {@link RequestPolicy}, with its failures typed.\n *\n * The policy's signal, its deadline and any signal on `init` are combined, and\n * `read` runs under them too, so a server that sends headers and then stalls\n * mid-body is cut off as well. When the request does not complete:\n *\n * - a deadline fired → {@link NetworkError} with reason `timeout`;\n * - any other abort → the signal's own reason, rethrown untouched, because a\n * cancellation is the caller's decision and the caller knows what it means;\n * - anything else → {@link NetworkError} with reason `unreachable`.\n *\n * Exported for the few callers that need the raw {@link Response} (a\n * `Set-Cookie` header the generated client does not expose).\n */\nexport async function request<R = undefined>(\n url: string,\n init: RequestInit,\n policy: RequestPolicy = {},\n read?: (res: Response) => Promise<R>,\n): Promise<{ res: Response; rawBody: R }> {\n const signals = [init.signal, policy.signal].filter((signal) => signal != null);\n if (policy.timeoutMs !== undefined) {\n signals.push(AbortSignal.timeout(policy.timeoutMs));\n }\n const signal = signals.length > 0 ? AbortSignal.any(signals) : undefined;\n const method = init.method ?? \"GET\";\n try {\n const res = await fetch(url, { ...init, signal });\n return { res, rawBody: (read ? await read(res) : undefined) as R };\n } catch (error) {\n if (signal?.aborted) {\n const reason: unknown = signal.reason;\n if (reason instanceof DOMException && reason.name === \"TimeoutError\") {\n throw new NetworkError(url, \"timeout\", `${method} ${url} timed out`, { cause: reason });\n }\n throw reason;\n }\n const code = errnoOf(error);\n throw new NetworkError(\n url,\n \"unreachable\",\n `${method} ${url} got no response${code ? ` (${code})` : \"\"}`,\n { cause: error },\n );\n }\n}\n\n/**\n * The errno a runtime attached to a failed request, if any, for the message.\n * Undici nests it on `cause`, inside an `AggregateError` when it tried more\n * than one address. Only ever used to describe the failure, never to decide\n * that it was one.\n */\nfunction errnoOf(error: unknown): string | undefined {\n let node: unknown = error;\n for (let depth = 0; depth < 4 && typeof node === \"object\" && node !== null; depth += 1) {\n const { code, errors } = node as { code?: unknown; errors?: unknown };\n if (typeof code === \"string\") {\n return code;\n }\n node = Array.isArray(errors) ? errors[0] : (node as { cause?: unknown }).cause;\n }\n return undefined;\n}\n\n/**\n * `JSON.parse` wrapped so a non-JSON body (e.g. an HTML 502 from a\n * proxy) becomes `{ raw: \"<text>\" }` instead of throwing inside\n * `customFetch`. The thrown `ApiError` then carries something useful\n * for the user to see.\n */\nfunction safeJsonParse(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return { raw: text };\n }\n}\n\n/**\n * The `code` of the server's `{code, message, details}` error envelope: from an\n * {@link ApiError}, or from a parsed response body. `undefined` when there is\n * none, e.g. an HTML error page from a proxy.\n */\nexport function apiErrorCode(errorOrBody: unknown): string | undefined {\n const body = errorOrBody instanceof ApiError ? errorOrBody.body : errorOrBody;\n return isRecord(body) && typeof body.code === \"string\" ? body.code : undefined;\n}\n\n/**\n * Extracts the server's `{code, message, details}` envelope from an\n * {@link ApiError} into a display string. Falls back to the fetch layer's\n * `\"METHOD url returned N\"` when the body isn't shaped like an envelope, so\n * transport-level failures (HTML from a proxy, empty 5xx) still say\n * something.\n */\nexport function apiErrorMessage(error: ApiError): string {\n const body = error.body;\n if (!isRecord(body)) {\n return error.message;\n }\n const serverMessage = typeof body.message === \"string\" ? body.message : undefined;\n const detail = pickDetailString(body.details);\n if (!serverMessage) {\n return error.message;\n }\n return detail ? `${serverMessage}: ${detail}` : serverMessage;\n}\n\n/**\n * Reads the innermost human-readable string out of the spec's error\n * `details` field. Handles both `details: \"...\"` and the nested\n * `details: { details: \"...\" }` shape the platform emits for validation\n * failures.\n */\nfunction pickDetailString(details: unknown): string | undefined {\n if (typeof details === \"string\") {\n return details;\n }\n if (isRecord(details)) {\n if (typeof details.details === \"string\") {\n return details.details;\n }\n if (typeof details.message === \"string\") {\n return details.message;\n }\n }\n return undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],"mappings":";;;AAGA,MAAa,cAAc;AAG3B,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAO;CAAQ;AAAS,CAAC;;AAGvD,MAAM,eAAe;;;;;;;;;;;;AAarB,IAAa,WAAb,cAA8B,MAAM;CAClC;CACA;CACA;;;;;;CAMA;CAEA,YAAY,QAAgB,KAAa,MAAe,SAAiB,WAAoB;EAC3F,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,MAAM;EACX,KAAK,OAAO;EACZ,KAAK,YAAY;CACnB;AACF;;;;;;;;;;;AAYA,IAAa,eAAb,cAAkC,MAAM;CACtC;;CAEA;CAEA,YACE,KACA,QACA,SACA,SACA;EACA,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,MAAM;EACX,KAAK,SAAS;CAChB;AACF;AAcA,IAAI,gBAA+B,CAAC;AAEpC,SAAgB,iBA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ent":["import { apiCsrfRejectionHandlerFor, apiCsrfTokenFor, getApiAuthToken } from \"./auth\";\nimport { API_PREFIX } from \"./base-url\";\n\n/** The header the session-bound CSRF token travels in (ADR 053 §5). */\nexport const CSRF_HEADER = \"X-Zitadel-CSRF\";\n\n// Mirrors the server's list (`httputil.IsSafeMethod` in `internal/httputil`).\nconst SAFE_METHODS = new Set([\"GET\", \"HEAD\", \"OPTIONS\"]);\n\n/** The code the server answers a refused CSRF check with. */\nconst CSRF_INVALID = \"auth.csrf_invalid\";\n\n/** The code the server answers a path no operation of its version has with (ADR 076). */\nconst ROUTE_NOT_FOUND = \"req.not_found\";\n\n/**\n * Framework-neutral failure type the orval-generated client throws on\n * any non-2xx response. Carries the HTTP status, the parsed error body\n * (the spec's `{code, message, details?}` envelope when the server\n * returned one), and the request URL — enough for callers to map to\n * their own error taxonomy without re-implementing the fetch layer.\n *\n * Callers that don't care about the distinction can catch `ApiError`\n * generically; callers that do (the CLI's `toZitadelError`) read\n * `status` and decide.\n */\nexport class ApiError extends Error {\n readonly status: number;\n readonly url: string;\n readonly body: unknown;\n /**\n * The server's ID for the request, from its `X-Request-Id` header: the\n * reference that finds the request in the server's logs, to show beside the\n * error. `undefined` when the response carried none, as from a proxy.\n */\n readonly requestId: string | undefined;\n\n constructor(status: number, url: string, body: unknown, message: string, requestId?: string) {\n super(message);\n this.name = \"ApiError\";\n this.status = status;\n this.url = url;\n this.body = body;\n this.requestId = requestId;\n }\n}\n\n/**\n * Thrown when a request got no usable response: the connection was refused or\n * reset, the host did not resolve, the server accepted the connection but did\n * not answer in time, or it answered with a body that could not be read. The\n * counterpart to {@link ApiError}, which is a response that came back with a\n * failing status.\n *\n * `fetch` only rejects when no response arrived, and reading the body only\n * when the body broke off or could not be decoded, so this is decided by which\n * of the two rejected, never by how a runtime words the failure. The runtime's\n * own error stays on `cause` for debugging.\n */\nexport class NetworkError extends Error {\n readonly url: string;\n /**\n * `timeout` when a deadline cut the request off, `unreadable` when a response\n * arrived but its body could not be read (a proxy that labels a decoded body\n * as compressed, say), `unreachable` otherwise.\n */\n readonly reason: NetworkErrorReason;\n\n constructor(url: string, reason: NetworkErrorReason, message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = \"NetworkError\";\n this.url = url;\n this.reason = reason;\n }\n}\n\n/** Why a {@link NetworkError} got no usable response. */\nexport type NetworkErrorReason = \"unreachable\" | \"unreadable\" | \"timeout\";\n\n/**\n * What every request a client makes is bound by. Set per call by\n * `createZitadelClient`, the same way as the base URL and token, and read at\n * the top of {@link customFetch} before its first `await`.\n */\nexport type RequestPolicy = {\n /** Aborts every request made while it is set; its reason is rethrown as is. */\n signal?: AbortSignal;\n /** Per-request deadline, covering the response body as well as the headers. */\n timeoutMs?: number;\n /**\n * Sent as the `User-Agent` of every request made while it is set.\n *\n * @remarks\n * This is one slot for the whole process, and a client identifies itself\n * through it, so two clients that identify differently share it. What keeps\n * them apart is that the slot is written immediately before a call and read\n * synchronously at the top of {@link customFetch}, before its first `await`:\n * no other client can run in between, and the retry below holds the copy it\n * read. Anything that writes the policy and then awaits before dispatching\n * would send one client's agent on another client's request.\n */\n userAgent?: string;\n};\n\nlet requestPolicy: RequestPolicy = {};\n\nexport function setRequestPolicy(policy: RequestPolicy): void {\n requestPolicy = policy;\n}\n\n/**\n * The orval `mutator` for the fetch client. Every generated operation\n * routes its request through this function instead of the global\n * `fetch`. We pin three concerns here so generated call sites stay\n * focused on the shape of one HTTP call:\n *\n * - bearer auth — read from `runtime/auth.ts` and attached automatically;\n * - the CSRF header — the session-bound token from `runtime/auth.ts`, on\n * unsafe methods to the origin it was issued for, when a first-party surface\n * has set one; an unsafe request to that origin refused with\n * `403 auth.csrf_invalid` asks the registered rejection handler for a fresh\n * token and is retried once with it, only if the handler returns one (the\n * session still belongs to the same person);\n * - non-2xx → throw — orval's stock client parses the body regardless\n * of status, so callers would have to inspect every response. Throw\n * `ApiError` on `!res.ok` so failures interrupt control flow;\n * - body parsing — return the parsed JSON typed as `T` (the operation's\n * return type, threaded through by orval), or `undefined` for the\n * spec's `204`/`205`/`304` no-body responses;\n * - no response → throw {@link NetworkError}, or the abort reason when the\n * caller cancelled (see {@link request}).\n */\nexport async function customFetch<T>(url: string, options: RequestInit): Promise<T> {\n // The client sets the policy per call, so it is read before the first await;\n // the retry below runs under the same policy as the first attempt.\n const policy = requestPolicy;\n const token = getApiAuthToken();\n const headers = new Headers(options.headers);\n if (policy.userAgent !== undefined) {\n headers.set(\"user-agent\", policy.userAgent);\n }\n if (token && !headers.has(\"authorization\")) {\n headers.set(\"authorization\", `Bearer ${token}`);\n }\n const method = (options.method ?? \"GET\").toUpperCase();\n const unsafe = !SAFE_METHODS.has(method) && !headers.has(CSRF_HEADER);\n // The token and the rejection handler belong to one server: a request to\n // any other origin gets neither.\n const target = originOf(url);\n const csrfToken = apiCsrfTokenFor(target);\n if (unsafe && csrfToken) {\n headers.set(CSRF_HEADER, csrfToken);\n }\n\n let { res, rawBody: parsed } = await request(url, { ...options, headers }, policy, readBody);\n\n // The token was stale (the session cookie changed under this page) or never\n // loaded. The app re-checks the session and hands back a fresh token only if\n // it still belongs to the same person; then the request is retried once. A\n // body that can be read only once cannot be sent again, so it is not retried.\n const onRejected = apiCsrfRejectionHandlerFor(target);\n if (\n unsafe &&\n onRejected &&\n res.status === 403 &&\n apiErrorCode(parsed) === CSRF_INVALID &&\n !isStream(options.body)\n ) {\n const fresh = await onRejected().catch(() => undefined);\n if (fresh && fresh !== csrfToken) {\n headers.set(CSRF_HEADER, fresh);\n ({ res, rawBody: parsed } = await request(url, { ...options, headers }, policy, readBody));\n }\n }\n\n if (!res.ok) {\n // Every operation this client calls is one the spec has, so a server that\n // knows no such path is another version, most likely one from before the\n // API moved under its prefix.\n const message =\n res.status === 404 && apiErrorCode(parsed) === ROUTE_NOT_FOUND\n ? `${options.method ?? \"GET\"} ${url} returned 404 (${ROUTE_NOT_FOUND}): the server has no such operation; a server older than this client does not serve the API under ${API_PREFIX}`\n : `${options.method ?? \"GET\"} ${url} returned ${res.status}`;\n throw new ApiError(\n res.status,\n url,\n parsed,\n message,\n res.headers.get(\"x-request-id\") || undefined,\n );\n }\n\n // The body is trusted to have the shape the generated types promise; no\n // response is checked here or by the paged functions. Should that change,\n // check it here, against the generated Zod response schemas, so every call\n // is covered.\n return parsed as T;\n}\n\n/** The parsed body, or `undefined` for the spec's no-body responses. */\nasync function readBody(res: Response): Promise<unknown> {\n if ([204, 205, 304].includes(res.status)) return undefined;\n const rawBody = await res.text();\n return rawBody ? (safeJsonParse(rawBody) as unknown) : undefined;\n}\n\n/** The request's origin, resolved against the page for a relative URL. */\nfunction originOf(url: string): string | undefined {\n try {\n return new URL(url, (globalThis as { location?: { href?: string } }).location?.href).origin;\n } catch {\n return undefined;\n }\n}\n\nfunction isStream(body: RequestInit[\"body\"]): boolean {\n return typeof ReadableStream !== \"undefined\" && body instanceof ReadableStream;\n}\n\n/**\n * `fetch` bound by a {@link RequestPolicy}, with its failures typed.\n *\n * The policy's signal, its deadline and any signal on `init` are combined, and\n * `read` runs under them too, so a server that sends headers and then stalls\n * mid-body is cut off as well. When the request does not complete:\n *\n * - a deadline fired → {@link NetworkError} with reason `timeout`;\n * - any other abort → the signal's own reason, rethrown untouched, because a\n * cancellation is the caller's decision and the caller knows what it means;\n * - a response arrived but `read` failed → {@link NetworkError} with reason\n * `unreadable`, naming the status that did come back;\n * - anything else → {@link NetworkError} with reason `unreachable`.\n *\n * Exported for the few callers that need the raw {@link Response} (a\n * `Set-Cookie` header the generated client does not expose).\n */\nexport async function request<R = undefined>(\n url: string,\n init: RequestInit,\n policy: RequestPolicy = {},\n read?: (res: Response) => Promise<R>,\n): Promise<{ res: Response; rawBody: R }> {\n const signals = [init.signal, policy.signal].filter((signal) => signal != null);\n if (policy.timeoutMs !== undefined) {\n signals.push(AbortSignal.timeout(policy.timeoutMs));\n }\n const signal = signals.length > 0 ? AbortSignal.any(signals) : undefined;\n const method = init.method ?? \"GET\";\n let res: Response;\n try {\n res = await fetch(url, { ...init, signal });\n } catch (error) {\n throw failure(error, signal, method, url, \"unreachable\", \"got no response\");\n }\n try {\n return { res, rawBody: (read ? await read(res) : undefined) as R };\n } catch (error) {\n const what = `answered ${res.status}, but its body could not be read`;\n throw failure(error, signal, method, url, \"unreadable\", what);\n }\n}\n\n/**\n * What {@link request} rejects with when `fetch` or `read` failed: the abort\n * as {@link request} describes it, or else a {@link NetworkError} of `reason`\n * saying `what` happened to the request.\n */\nfunction failure(\n error: unknown,\n signal: AbortSignal | undefined,\n method: string,\n url: string,\n reason: \"unreachable\" | \"unreadable\",\n what: string,\n): unknown {\n if (signal?.aborted) {\n const abort: unknown = signal.reason;\n if (abort instanceof DOMException && abort.name === \"TimeoutError\") {\n return new NetworkError(url, \"timeout\", `${method} ${url} timed out`, { cause: abort });\n }\n return abort;\n }\n const code = errnoOf(error);\n return new NetworkError(url, reason, `${method} ${url} ${what}${code ? ` (${code})` : \"\"}`, {\n cause: error,\n });\n}\n\n/**\n * The errno a runtime attached to a failed request, if any, for the message.\n * Undici nests it on `cause`, inside an `AggregateError` when it tried more\n * than one address. Only ever used to describe the failure, never to decide\n * that it was one.\n */\nfunction errnoOf(error: unknown): string | undefined {\n let node: unknown = error;\n for (let depth = 0; depth < 4 && typeof node === \"object\" && node !== null; depth += 1) {\n const { code, errors } = node as { code?: unknown; errors?: unknown };\n if (typeof code === \"string\") {\n return code;\n }\n node = Array.isArray(errors) ? errors[0] : (node as { cause?: unknown }).cause;\n }\n return undefined;\n}\n\n/**\n * `JSON.parse` wrapped so a non-JSON body (e.g. an HTML 502 from a\n * proxy) becomes `{ raw: \"<text>\" }` instead of throwing inside\n * `customFetch`. The thrown `ApiError` then carries something useful\n * for the user to see.\n */\nfunction safeJsonParse(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return { raw: text };\n }\n}\n\n/**\n * The `code` of the server's `{code, message, details}` error envelope: from an\n * {@link ApiError}, or from a parsed response body. `undefined` when there is\n * none, e.g. an HTML error page from a proxy.\n */\nexport function apiErrorCode(errorOrBody: unknown): string | undefined {\n const body = errorOrBody instanceof ApiError ? errorOrBody.body : errorOrBody;\n return isRecord(body) && typeof body.code === \"string\" ? body.code : undefined;\n}\n\n/**\n * Extracts the server's `{code, message, details}` envelope from an\n * {@link ApiError} into a display string. Falls back to the fetch layer's\n * `\"METHOD url returned N\"` when the body isn't shaped like an envelope, so\n * transport-level failures (HTML from a proxy, empty 5xx) still say\n * something.\n */\nexport function apiErrorMessage(error: ApiError): string {\n const body = error.body;\n if (!isRecord(body)) {\n return error.message;\n }\n const serverMessage = typeof body.message === \"string\" ? body.message : undefined;\n const detail = pickDetailString(body.details);\n if (!serverMessage) {\n return error.message;\n }\n return detail ? `${serverMessage}: ${detail}` : serverMessage;\n}\n\n/**\n * Reads the innermost human-readable string out of the spec's error\n * `details` field. Handles both `details: \"...\"` and the nested\n * `details: { details: \"...\" }` shape the platform emits for validation\n * failures.\n */\nfunction pickDetailString(details: unknown): string | undefined {\n if (typeof details === \"string\") {\n return details;\n }\n if (isRecord(details)) {\n if (typeof details.details === \"string\") {\n return details.details;\n }\n if (typeof details.message === \"string\") {\n return details.message;\n }\n }\n return undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],"mappings":";;;;AAIA,MAAa,cAAc;AAG3B,MAAM,+BAAe,IAAI,IAAI;CAAC;CAAO;CAAQ;AAAS,CAAC;;AAGvD,MAAM,eAAe;;AAGrB,MAAM,kBAAkB;;;;;;;;;;;;AAaxB,IAAa,WAAb,cAA8B,MAAM;CAClC;CACA;CACA;;;;;;CAMA;CAEA,YAAY,QAAgB,KAAa,MAAe,SAAiB,WAAoB;EAC3F,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,KAAK,MAAM;EACX,KAAK,OAAO;EACZ,KAAK,YAAY;CACnB;AACF;;;;;;;;;;;;;AAcA,IAAa,eAAb,cAAkC,MAAM;CACtC;;;;;;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AC,SAAS,IAAI,GAChB,OAAO,MAAM;CAEf,MAAM,gBAAgB,OAAO,KAAK,YAAY,WAAW,KAAK,UAAU,KAAA;CACxE,MAAM,SAAS,iBAAiB,KAAK,OAAO;CAC5C,IAAI,CAAC,eACH,OAAO,MAAM;CAEf,OAAO,SAAS,GAAG,cAAc,IAAI,WAAW;AAClD;;;;;;;AAQA,SAAS,iBAAiB,SAAsC;CAC9D,IAAI,OAAO,YAAY,UACrB,OAAO;CAET,IAAI,SAAS,OAAO,GAAG;EACrB,IAAI,OAAO,QAAQ,YAAY,UAC7B,OAAO,QAAQ;EAEjB,IAAI,OAAO,QAAQ,YAAY,UAC7B,OAAO,QAAQ;CAEnB;AAEF;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//#region src/runtime/paging.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Fetches the page a cursor names.
|
|
4
|
+
*
|
|
5
|
+
* @param token - The cursor of the page to fetch, or `undefined` for the first page.
|
|
6
|
+
* @param number - How many pages have been asked for, counting this one, from 1.
|
|
7
|
+
*/
|
|
8
|
+
export type FetchPage<P> = (token: string | undefined, number: number) => Promise<P>;
|
|
9
|
+
/**
|
|
10
|
+
* How to read one page of a list.
|
|
11
|
+
*/
|
|
12
|
+
export type PageReaders<P, T> = {
|
|
13
|
+
/** The items on `page`. */
|
|
14
|
+
readonly items: (page: P) => readonly T[];
|
|
15
|
+
/** The cursor to the page after `page`; none, `null` or an empty string when it is the last. */
|
|
16
|
+
readonly next: (page: P) => string | null | undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* What {@link Paging.collect} gathers from a walk.
|
|
20
|
+
*/
|
|
21
|
+
export type Collected<P, T> = {
|
|
22
|
+
/** The items of every page it read, in order. */
|
|
23
|
+
readonly items: readonly T[];
|
|
24
|
+
/** The cursor to the page after the last one it read, or `null` when none remains. */
|
|
25
|
+
readonly next: string | null;
|
|
26
|
+
/** The last page it read, or `undefined` when the walk yielded none. */
|
|
27
|
+
readonly last: P | undefined;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* A cursor-paged list (ADR 027): a page carries a cursor while more remain,
|
|
31
|
+
* and the request for the next page sends it back.
|
|
32
|
+
*
|
|
33
|
+
* A `Paging` knows how to read a page of one list, and from that how to walk
|
|
34
|
+
* the pages and how to gather them. Build one from readers when the page is
|
|
35
|
+
* typed, or from field names with {@link Paging.byField} when the list is only
|
|
36
|
+
* known at run time.
|
|
37
|
+
*
|
|
38
|
+
* The walk trusts the contract. A server that repeats a cursor, skips one or
|
|
39
|
+
* answers a page in a different shape is an upstream bug to fix in the server,
|
|
40
|
+
* not something the client detects or works around; do not add guards for it.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* const users = new Paging({
|
|
44
|
+
* items: (page: UsersPage) => page.users,
|
|
45
|
+
* next: (page) => page.next_page_token,
|
|
46
|
+
* });
|
|
47
|
+
* const { items } = await users.collect(users.walk(fetchUsers), { all: true });
|
|
48
|
+
*/
|
|
49
|
+
export declare class Paging<P, T = unknown> {
|
|
50
|
+
private readonly readers;
|
|
51
|
+
/**
|
|
52
|
+
* @param readers - How to read a page's items and its cursor.
|
|
53
|
+
*/
|
|
54
|
+
constructor(readers: PageReaders<P, T>);
|
|
55
|
+
/**
|
|
56
|
+
* A paging for a list whose fields are known only by name, such as an
|
|
57
|
+
* operation picked from a table at run time. A page without the items
|
|
58
|
+
* field is not a page of that list.
|
|
59
|
+
*
|
|
60
|
+
* @param items - The name of the field holding a page's items.
|
|
61
|
+
* @param cursor - The name of the field holding the next cursor.
|
|
62
|
+
* @throws TypeError from {@link Paging.items} when the page has no such list.
|
|
63
|
+
* @example
|
|
64
|
+
* Paging.byField("users").items({ users: ["a", "b"] }); // ["a", "b"]
|
|
65
|
+
* Paging.byField("users").next({ next_page_token: "t1" }); // "t1"
|
|
66
|
+
*/
|
|
67
|
+
static byField(items: string, cursor?: string): Paging<unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* The items on `page`.
|
|
70
|
+
*
|
|
71
|
+
* @param page - A page of this list.
|
|
72
|
+
*/
|
|
73
|
+
items(page: P): readonly T[];
|
|
74
|
+
/**
|
|
75
|
+
* The cursor to the page after `page`.
|
|
76
|
+
*
|
|
77
|
+
* @param page - A page of this list.
|
|
78
|
+
* @returns The cursor, or `undefined` when `page` is the last: no cursor,
|
|
79
|
+
* `null` and an empty string all mean the same.
|
|
80
|
+
*/
|
|
81
|
+
next(page: P): string | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Every page, fetched only when the loop asks for the next one, so a caller
|
|
84
|
+
* that stops early never reads the rest. The first page is the one
|
|
85
|
+
* `fetchPage(undefined, 1)` answers.
|
|
86
|
+
*
|
|
87
|
+
* A page's cursor is read before the page is handed out, so a loop that
|
|
88
|
+
* changes the page cannot change where the walk goes.
|
|
89
|
+
*
|
|
90
|
+
* @param fetchPage - Fetches the page a cursor names, and is told which page
|
|
91
|
+
* of the walk it is.
|
|
92
|
+
*/
|
|
93
|
+
walk(fetchPage: FetchPage<P>): AsyncGenerator<P, void, undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* The first page of `pages`, or with `all` every page in order, as one list
|
|
96
|
+
* of their items, with the cursor to the page after the last one read and
|
|
97
|
+
* that last page itself.
|
|
98
|
+
*
|
|
99
|
+
* Without `all` the walk is left after its first page, so no second one is
|
|
100
|
+
* fetched. When the walk ends on a page that still names a next page, that
|
|
101
|
+
* cursor is reported rather than dropped, so a caller can resume from it.
|
|
102
|
+
*
|
|
103
|
+
* The items are gathered into one array rather than concatenated page by
|
|
104
|
+
* page: these lists are unbounded, and a wide drain would otherwise copy
|
|
105
|
+
* every record once per remaining page.
|
|
106
|
+
*
|
|
107
|
+
* @param pages - A walk of this list's pages, from {@link Paging.walk} or a
|
|
108
|
+
* client function's `.pages()`.
|
|
109
|
+
* @param options - `all` reads every page; otherwise only the first.
|
|
110
|
+
*/
|
|
111
|
+
collect(pages: AsyncIterable<P>, { all }: {
|
|
112
|
+
readonly all: boolean;
|
|
113
|
+
}): Promise<Collected<P, T>>;
|
|
114
|
+
private static cursorIn;
|
|
115
|
+
private static listIn;
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
//# sourceMappingURL=paging.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paging.d.mts","names":[],"sources":["../../src/runtime/paging.ts"],"mappings":";;;;;;;YAMY,UAAU,MAAM,2BAA2B,mBAAmB,QAAQ;;;;YAKtE,YAAY,GAAG;;WAEhB,QAAQ,MAAM,eAAe;;WAE7B,OAAO,MAAM;;;;;YAMZ,UAAU,GAAG;;WAEd,gBAAgB;;WAEhB;;WAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;qBAuBJ,OAAO,GAAG;mBACJ;;;;EAKL,YAAA,SAAS,YAAY,GAAG;;;;;;;;;;;;;SAgB7B,QAAQ,eAAe,kBAA6B;;;;;;EAgB3D,MAAM,MAAM,aAAa;;;;;;;;EAWzB,KAAK,MAAM;;;;;;;;;;;;EAeJ,KAAK,WAAW,UAAU,KAAK,eAAe;;;;;;;;;;;;;;;;;;EA6B/C,QACJ,OAAO,cAAc,MACnB;aAAkB;MACnB,QAAQ,UAAU,GAAG;iBAeT;iBAQA"}
|