@icanbwell/bwell-sdk-ts 0.1.2 → 0.2.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 +15 -4
- package/dist/__version__.d.ts +4 -0
- package/dist/__version__.js +5 -0
- package/dist/__version__.js.map +1 -0
- package/dist/api/api-provider-factory.d.ts +7 -0
- package/dist/api/api-provider-factory.js +9 -0
- package/dist/api/api-provider-factory.js.map +1 -0
- package/dist/api/base/activity/activity-manager.d.ts +31 -0
- package/dist/api/base/activity/activity-manager.js +2 -0
- package/dist/api/base/activity/activity-manager.js.map +1 -0
- package/dist/api/base/activity/get-tasks-request.d.ts +49 -0
- package/dist/api/base/activity/get-tasks-request.js +36 -0
- package/dist/api/base/activity/get-tasks-request.js.map +1 -0
- package/dist/api/base/activity/index.d.ts +4 -0
- package/dist/api/base/activity/index.js +3 -0
- package/dist/api/base/activity/index.js.map +1 -0
- package/dist/api/base/activity/types.d.ts +3 -0
- package/dist/api/base/activity/types.js +6 -0
- package/dist/api/base/activity/types.js.map +1 -0
- package/dist/api/base/activity/update-task-status-request.d.ts +18 -0
- package/dist/api/base/activity/update-task-status-request.js +16 -0
- package/dist/api/base/activity/update-task-status-request.js.map +1 -0
- package/dist/api/base/api-provider.d.ts +16 -0
- package/dist/api/base/api-provider.js +2 -0
- package/dist/api/base/api-provider.js.map +1 -0
- package/dist/api/base/connection/connection-manager.d.ts +60 -0
- package/dist/api/base/connection/connection-manager.js +2 -0
- package/dist/api/base/connection/connection-manager.js.map +1 -0
- package/dist/api/base/connection/connection-request.d.ts +56 -0
- package/dist/api/base/connection/connection-request.js +71 -0
- package/dist/api/base/connection/connection-request.js.map +1 -0
- package/dist/api/base/connection/index.d.ts +2 -0
- package/dist/api/base/connection/index.js +3 -0
- package/dist/api/base/connection/index.js.map +1 -0
- package/dist/api/base/device/device-manager.d.ts +22 -0
- package/dist/api/base/device/device-manager.js +6 -0
- package/dist/api/base/device/device-manager.js.map +1 -0
- package/dist/api/base/device/device-request.d.ts +62 -0
- package/dist/api/base/device/device-request.js +72 -0
- package/dist/api/base/device/device-request.js.map +1 -0
- package/dist/api/base/device/index.d.ts +2 -0
- package/dist/api/base/device/index.js +2 -0
- package/dist/api/base/device/index.js.map +1 -0
- package/dist/api/base/errors.d.ts +2 -0
- package/dist/api/base/errors.js +2 -0
- package/dist/api/base/errors.js.map +1 -0
- package/dist/api/base/event/event-manager.d.ts +13 -0
- package/dist/api/base/event/event-manager.js +2 -0
- package/dist/api/base/event/event-manager.js.map +1 -0
- package/dist/api/base/event/event-request.d.ts +35 -0
- package/dist/api/base/event/event-request.js +65 -0
- package/dist/api/base/event/event-request.js.map +1 -0
- package/dist/api/base/event/index.d.ts +2 -0
- package/dist/api/base/event/index.js +2 -0
- package/dist/api/base/event/index.js.map +1 -0
- package/dist/api/base/health-data/health-data-request.d.ts +116 -0
- package/dist/api/base/health-data/health-data-request.js +134 -0
- package/dist/api/base/health-data/health-data-request.js.map +1 -0
- package/dist/api/base/health-data/health-manager.d.ts +201 -0
- package/dist/api/base/health-data/health-manager.js +2 -0
- package/dist/api/base/health-data/health-manager.js.map +1 -0
- package/dist/api/base/health-data/index.d.ts +4 -0
- package/dist/api/base/health-data/index.js +4 -0
- package/dist/api/base/health-data/index.js.map +1 -0
- package/dist/api/base/health-data/lab-knowledge-request.d.ts +21 -0
- package/dist/api/base/health-data/lab-knowledge-request.js +28 -0
- package/dist/api/base/health-data/lab-knowledge-request.js.map +1 -0
- package/dist/api/base/health-data/medication-knowledge-request.d.ts +21 -0
- package/dist/api/base/health-data/medication-knowledge-request.js +28 -0
- package/dist/api/base/health-data/medication-knowledge-request.js.map +1 -0
- package/dist/api/base/identity/identity-manager.d.ts +23 -0
- package/dist/api/base/identity/identity-manager.js +2 -0
- package/dist/api/base/identity/identity-manager.js.map +1 -0
- package/dist/api/base/identity/index.d.ts +1 -0
- package/dist/api/base/identity/index.js +2 -0
- package/dist/api/base/identity/index.js.map +1 -0
- package/dist/api/base/index.d.ts +8 -0
- package/dist/api/base/index.js +9 -0
- package/dist/api/base/index.js.map +1 -0
- package/dist/api/base/requests/index.d.ts +2 -0
- package/dist/api/base/requests/index.js +2 -0
- package/dist/api/base/requests/index.js.map +1 -0
- package/dist/api/base/requests/search-date-validation-cases.d.ts +167 -0
- package/dist/api/base/requests/search-date-validation-cases.js +249 -0
- package/dist/api/base/requests/search-date-validation-cases.js.map +1 -0
- package/dist/api/base/requests/search-date.d.ts +27 -0
- package/dist/api/base/requests/search-date.js +117 -0
- package/dist/api/base/requests/search-date.js.map +1 -0
- package/dist/api/base/requests/search-token.d.ts +26 -0
- package/dist/api/base/requests/search-token.js +46 -0
- package/dist/api/base/requests/search-token.js.map +1 -0
- package/dist/api/base/search/index.d.ts +3 -0
- package/dist/api/base/search/index.js +3 -0
- package/dist/api/base/search/index.js.map +1 -0
- package/dist/api/base/search/request-connection-request.d.ts +24 -0
- package/dist/api/base/search/request-connection-request.js +4 -0
- package/dist/api/base/search/request-connection-request.js.map +1 -0
- package/dist/api/base/search/search-manager.d.ts +41 -0
- package/dist/api/base/search/search-manager.js +2 -0
- package/dist/api/base/search/search-manager.js.map +1 -0
- package/dist/api/base/search/search-request.d.ts +84 -0
- package/dist/api/base/search/search-request.js +79 -0
- package/dist/api/base/search/search-request.js.map +1 -0
- package/dist/api/base/user/create-consent-request.d.ts +14 -0
- package/dist/api/base/user/create-consent-request.js +33 -0
- package/dist/api/base/user/create-consent-request.js.map +1 -0
- package/dist/api/base/user/get-consents-request.d.ts +15 -0
- package/dist/api/base/user/get-consents-request.js +16 -0
- package/dist/api/base/user/get-consents-request.js.map +1 -0
- package/dist/api/base/user/index.d.ts +5 -0
- package/dist/api/base/user/index.js +4 -0
- package/dist/api/base/user/index.js.map +1 -0
- package/dist/api/base/user/types.d.ts +9 -0
- package/dist/api/base/user/types.js +18 -0
- package/dist/api/base/user/types.js.map +1 -0
- package/dist/api/base/user/update-profile-request.d.ts +28 -0
- package/dist/api/base/user/update-profile-request.js +21 -0
- package/dist/api/base/user/update-profile-request.js.map +1 -0
- package/dist/api/base/user/user-manager.d.ts +46 -0
- package/dist/api/base/user/user-manager.js +2 -0
- package/dist/api/base/user/user-manager.js.map +1 -0
- package/dist/api/graphql-api/activity/activity-request-factories.d.ts +13 -0
- package/dist/api/graphql-api/activity/activity-request-factories.js +67 -0
- package/dist/api/graphql-api/activity/activity-request-factories.js.map +1 -0
- package/dist/api/graphql-api/activity/graphql-activity-manager.d.ts +14 -0
- package/dist/api/graphql-api/activity/graphql-activity-manager.js +73 -0
- package/dist/api/graphql-api/activity/graphql-activity-manager.js.map +1 -0
- package/dist/api/graphql-api/activity/index.d.ts +1 -0
- package/dist/api/graphql-api/activity/index.js +2 -0
- package/dist/api/graphql-api/activity/index.js.map +1 -0
- package/dist/api/graphql-api/connection/graphql-connection-manager.d.ts +18 -0
- package/dist/api/graphql-api/connection/graphql-connection-manager.js +142 -0
- package/dist/api/graphql-api/connection/graphql-connection-manager.js.map +1 -0
- package/dist/api/graphql-api/connection/graphql-get-member-connections-bwell-response-factory.d.ts +18 -0
- package/dist/api/graphql-api/connection/graphql-get-member-connections-bwell-response-factory.js +41 -0
- package/dist/api/graphql-api/connection/graphql-get-member-connections-bwell-response-factory.js.map +1 -0
- package/dist/api/graphql-api/connection/index.d.ts +2 -0
- package/dist/api/graphql-api/connection/index.js +3 -0
- package/dist/api/graphql-api/connection/index.js.map +1 -0
- package/dist/api/graphql-api/device/device-request-factory.d.ts +9 -0
- package/dist/api/graphql-api/device/device-request-factory.js +16 -0
- package/dist/api/graphql-api/device/device-request-factory.js.map +1 -0
- package/dist/api/graphql-api/device/graphql-device-manager.d.ts +13 -0
- package/dist/api/graphql-api/device/graphql-device-manager.js +74 -0
- package/dist/api/graphql-api/device/graphql-device-manager.js.map +1 -0
- package/dist/api/graphql-api/device/index.d.ts +1 -0
- package/dist/api/graphql-api/device/index.js +2 -0
- package/dist/api/graphql-api/device/index.js.map +1 -0
- package/dist/api/graphql-api/errors/errors.d.ts +38 -0
- package/dist/api/graphql-api/errors/errors.js +95 -0
- package/dist/api/graphql-api/errors/errors.js.map +1 -0
- package/dist/api/graphql-api/errors/index.d.ts +1 -0
- package/dist/api/graphql-api/errors/index.js +2 -0
- package/dist/api/graphql-api/errors/index.js.map +1 -0
- package/dist/api/graphql-api/event/event-request-factory.d.ts +6 -0
- package/dist/api/graphql-api/event/event-request-factory.js +12 -0
- package/dist/api/graphql-api/event/event-request-factory.js.map +1 -0
- package/dist/api/graphql-api/event/graphql-event-manager.d.ts +15 -0
- package/dist/api/graphql-api/event/graphql-event-manager.js +66 -0
- package/dist/api/graphql-api/event/graphql-event-manager.js.map +1 -0
- package/dist/api/graphql-api/event/index.d.ts +1 -0
- package/dist/api/graphql-api/event/index.js +2 -0
- package/dist/api/graphql-api/event/index.js.map +1 -0
- package/dist/api/graphql-api/graphql-api-provider.d.ts +21 -0
- package/dist/api/graphql-api/graphql-api-provider.js +37 -0
- package/dist/api/graphql-api/graphql-api-provider.js.map +1 -0
- package/dist/api/graphql-api/graphql-manager/graphql-manager.d.ts +43 -0
- package/dist/api/graphql-api/graphql-manager/graphql-manager.js +119 -0
- package/dist/api/graphql-api/graphql-manager/graphql-manager.js.map +1 -0
- package/dist/api/graphql-api/graphql-manager/index.d.ts +1 -0
- package/dist/api/graphql-api/graphql-manager/index.js +2 -0
- package/dist/api/graphql-api/graphql-manager/index.js.map +1 -0
- package/dist/api/graphql-api/graphql-sdk/graphql-sdk.d.ts +24 -0
- package/dist/api/graphql-api/graphql-sdk/graphql-sdk.js +45 -0
- package/dist/api/graphql-api/graphql-sdk/graphql-sdk.js.map +1 -0
- package/dist/api/graphql-api/graphql-sdk/index.d.ts +1 -0
- package/dist/api/graphql-api/graphql-sdk/index.js +2 -0
- package/dist/api/graphql-api/graphql-sdk/index.js.map +1 -0
- package/dist/api/graphql-api/healthdata/graphql-health-manager.d.ts +33 -0
- package/dist/api/graphql-api/healthdata/graphql-health-manager.js +406 -0
- package/dist/api/graphql-api/healthdata/graphql-health-manager.js.map +1 -0
- package/dist/api/graphql-api/healthdata/index.d.ts +1 -0
- package/dist/api/graphql-api/healthdata/index.js +2 -0
- package/dist/api/graphql-api/healthdata/index.js.map +1 -0
- package/dist/api/graphql-api/identity/graphql-identity-manager.d.ts +13 -0
- package/dist/api/graphql-api/identity/graphql-identity-manager.js +88 -0
- package/dist/api/graphql-api/identity/graphql-identity-manager.js.map +1 -0
- package/dist/api/graphql-api/identity/index.d.ts +1 -0
- package/dist/api/graphql-api/identity/index.js +2 -0
- package/dist/api/graphql-api/identity/index.js.map +1 -0
- package/dist/api/graphql-api/index.d.ts +1 -0
- package/dist/api/graphql-api/index.js +2 -0
- package/dist/api/graphql-api/index.js.map +1 -0
- package/dist/api/graphql-api/search/connection-search-request-factory.d.ts +7 -0
- package/dist/api/graphql-api/search/connection-search-request-factory.js +22 -0
- package/dist/api/graphql-api/search/connection-search-request-factory.js.map +1 -0
- package/dist/api/graphql-api/search/graphql-search-manager.d.ts +16 -0
- package/dist/api/graphql-api/search/graphql-search-manager.js +113 -0
- package/dist/api/graphql-api/search/graphql-search-manager.js.map +1 -0
- package/dist/api/graphql-api/search/index.d.ts +1 -0
- package/dist/api/graphql-api/search/index.js +2 -0
- package/dist/api/graphql-api/search/index.js.map +1 -0
- package/dist/api/graphql-api/search/provider-search-request-factory.d.ts +7 -0
- package/dist/api/graphql-api/search/provider-search-request-factory.js +22 -0
- package/dist/api/graphql-api/search/provider-search-request-factory.js.map +1 -0
- package/dist/api/graphql-api/search/request-connection-request-factory.d.ts +6 -0
- package/dist/api/graphql-api/search/request-connection-request-factory.js +13 -0
- package/dist/api/graphql-api/search/request-connection-request-factory.js.map +1 -0
- package/dist/api/graphql-api/search/search-request-factory.d.ts +6 -0
- package/dist/api/graphql-api/search/search-request-factory.js +45 -0
- package/dist/api/graphql-api/search/search-request-factory.js.map +1 -0
- package/dist/api/graphql-api/user/create-consent-request-factory.d.ts +6 -0
- package/dist/api/graphql-api/user/create-consent-request-factory.js +40 -0
- package/dist/api/graphql-api/user/create-consent-request-factory.js.map +1 -0
- package/dist/api/graphql-api/user/get-consent-request-factory.d.ts +6 -0
- package/dist/api/graphql-api/user/get-consent-request-factory.js +9 -0
- package/dist/api/graphql-api/user/get-consent-request-factory.js.map +1 -0
- package/dist/api/graphql-api/user/graphql-user-manager.d.ts +18 -0
- package/dist/api/graphql-api/user/graphql-user-manager.js +122 -0
- package/dist/api/graphql-api/user/graphql-user-manager.js.map +1 -0
- package/dist/api/graphql-api/user/index.d.ts +1 -0
- package/dist/api/graphql-api/user/index.js +2 -0
- package/dist/api/graphql-api/user/index.js.map +1 -0
- package/dist/api/graphql-api/user/update-profile-request-factory.d.ts +7 -0
- package/dist/api/graphql-api/user/update-profile-request-factory.js +123 -0
- package/dist/api/graphql-api/user/update-profile-request-factory.js.map +1 -0
- package/dist/api/identity-manager-factory.d.ts +6 -0
- package/dist/api/identity-manager-factory.js +9 -0
- package/dist/api/identity-manager-factory.js.map +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -0
- package/dist/auth/auth-strategy-factory.d.ts +10 -0
- package/dist/auth/auth-strategy-factory.js +15 -0
- package/dist/auth/auth-strategy-factory.js.map +1 -0
- package/dist/auth/auth-strategy.d.ts +9 -0
- package/dist/auth/auth-strategy.js +2 -0
- package/dist/auth/auth-strategy.js.map +1 -0
- package/dist/auth/credentials.d.ts +10 -0
- package/dist/auth/credentials.js +7 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth-strategy.d.ts +11 -0
- package/dist/auth/oauth-strategy.js +52 -0
- package/dist/auth/oauth-strategy.js.map +1 -0
- package/dist/bwell-sdk/bwell-sdk.d.ts +24 -0
- package/dist/bwell-sdk/bwell-sdk.js +147 -0
- package/dist/bwell-sdk/bwell-sdk.js.map +1 -0
- package/dist/bwell-sdk/mocks.d.ts +2 -0
- package/dist/bwell-sdk/mocks.js +5 -0
- package/dist/bwell-sdk/mocks.js.map +1 -0
- package/dist/config/bwell-config.d.ts +12 -0
- package/dist/config/bwell-config.js +14 -0
- package/dist/config/bwell-config.js.map +1 -0
- package/dist/config/config-manager.d.ts +17 -0
- package/dist/config/config-manager.js +64 -0
- package/dist/config/config-manager.js.map +1 -0
- package/dist/config/context.d.ts +6 -0
- package/dist/config/context.js +2 -0
- package/dist/config/context.js.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +6 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/sdk-config.d.ts +44 -0
- package/dist/config/sdk-config.js +173 -0
- package/dist/config/sdk-config.js.map +1 -0
- package/dist/errors/authentication-error.d.ts +4 -0
- package/dist/errors/authentication-error.js +8 -0
- package/dist/errors/authentication-error.js.map +1 -0
- package/dist/errors/bwell-error.d.ts +8 -0
- package/dist/errors/bwell-error.js +13 -0
- package/dist/errors/bwell-error.js.map +1 -0
- package/dist/errors/illegal-argument-error.d.ts +4 -0
- package/dist/errors/illegal-argument-error.js +8 -0
- package/dist/errors/illegal-argument-error.js.map +1 -0
- package/dist/errors/illegal-state-error.d.ts +4 -0
- package/dist/errors/illegal-state-error.js +8 -0
- package/dist/errors/illegal-state-error.js.map +1 -0
- package/dist/errors/index.d.ts +11 -0
- package/dist/errors/index.js +12 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/invalid-client-key-error.d.ts +4 -0
- package/dist/errors/invalid-client-key-error.js +8 -0
- package/dist/errors/invalid-client-key-error.js.map +1 -0
- package/dist/errors/invalid-credentials-type-error.d.ts +6 -0
- package/dist/errors/invalid-credentials-type-error.js +9 -0
- package/dist/errors/invalid-credentials-type-error.js.map +1 -0
- package/dist/errors/invalid-token-error.d.ts +4 -0
- package/dist/errors/invalid-token-error.js +8 -0
- package/dist/errors/invalid-token-error.js.map +1 -0
- package/dist/errors/network-error.d.ts +5 -0
- package/dist/errors/network-error.js +9 -0
- package/dist/errors/network-error.js.map +1 -0
- package/dist/errors/operation-outcome-error.d.ts +6 -0
- package/dist/errors/operation-outcome-error.js +9 -0
- package/dist/errors/operation-outcome-error.js.map +1 -0
- package/dist/errors/unknown-error.d.ts +5 -0
- package/dist/errors/unknown-error.js +9 -0
- package/dist/errors/unknown-error.js.map +1 -0
- package/dist/errors/validation-error.d.ts +5 -0
- package/dist/errors/validation-error.js +9 -0
- package/dist/errors/validation-error.js.map +1 -0
- package/dist/graphql/index.d.ts +17 -0
- package/dist/graphql/index.js +19 -0
- package/dist/graphql/index.js.map +1 -0
- package/dist/graphql/operations/index.d.ts +376 -0
- package/dist/graphql/operations/index.js +1946 -0
- package/dist/graphql/operations/index.js.map +1 -0
- package/dist/graphql/operations/types.d.ts +1350 -0
- package/dist/graphql/operations/types.js +17 -0
- package/dist/graphql/operations/types.js.map +1 -0
- package/dist/graphql/schema.d.ts +3542 -0
- package/dist/graphql/schema.js +273 -0
- package/dist/graphql/schema.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -0
- package/dist/logger/console/console-formatter.d.ts +9 -0
- package/dist/logger/console/console-formatter.js +20 -0
- package/dist/logger/console/console-formatter.js.map +1 -0
- package/dist/logger/console/console-logger-provider.d.ts +8 -0
- package/dist/logger/console/console-logger-provider.js +25 -0
- package/dist/logger/console/console-logger-provider.js.map +1 -0
- package/dist/logger/console/console-logger.d.ts +20 -0
- package/dist/logger/console/console-logger.js +70 -0
- package/dist/logger/console/console-logger.js.map +1 -0
- package/dist/logger/console/index.d.ts +2 -0
- package/dist/logger/console/index.js +3 -0
- package/dist/logger/console/index.js.map +1 -0
- package/dist/logger/index.d.ts +6 -0
- package/dist/logger/index.js +7 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger-formatter.d.ts +20 -0
- package/dist/logger/logger-formatter.js +2 -0
- package/dist/logger/logger-formatter.js.map +1 -0
- package/dist/logger/logger-provider-factory.d.ts +7 -0
- package/dist/logger/logger-provider-factory.js +32 -0
- package/dist/logger/logger-provider-factory.js.map +1 -0
- package/dist/logger/logger-provider.d.ts +7 -0
- package/dist/logger/logger-provider.js +2 -0
- package/dist/logger/logger-provider.js.map +1 -0
- package/dist/logger/logger.d.ts +56 -0
- package/dist/logger/logger.js +2 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/logger/otel/index.d.ts +2 -0
- package/dist/logger/otel/index.js +3 -0
- package/dist/logger/otel/index.js.map +1 -0
- package/dist/logger/otel/otel-logger-provider.d.ts +9 -0
- package/dist/logger/otel/otel-logger-provider.js +28 -0
- package/dist/logger/otel/otel-logger-provider.js.map +1 -0
- package/dist/logger/otel/otel-logger.d.ts +19 -0
- package/dist/logger/otel/otel-logger.js +95 -0
- package/dist/logger/otel/otel-logger.js.map +1 -0
- package/dist/logger/severity.d.ts +41 -0
- package/dist/logger/severity.js +80 -0
- package/dist/logger/severity.js.map +1 -0
- package/dist/models/coding.d.ts +5 -0
- package/dist/models/coding.js +2 -0
- package/dist/models/coding.js.map +1 -0
- package/dist/models/fhir-error.d.ts +9 -0
- package/dist/models/fhir-error.js +2 -0
- package/dist/models/fhir-error.js.map +1 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.js +5 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/operation-outcome.d.ts +14 -0
- package/dist/models/operation-outcome.js +50 -0
- package/dist/models/operation-outcome.js.map +1 -0
- package/dist/models/user.d.ts +4 -0
- package/dist/models/user.js +2 -0
- package/dist/models/user.js.map +1 -0
- package/dist/requests/index.d.ts +3 -0
- package/dist/requests/index.js +4 -0
- package/dist/requests/index.js.map +1 -0
- package/dist/requests/paged-request.d.ts +28 -0
- package/dist/requests/paged-request.js +54 -0
- package/dist/requests/paged-request.js.map +1 -0
- package/dist/requests/request.d.ts +84 -0
- package/dist/requests/request.js +80 -0
- package/dist/requests/request.js.map +1 -0
- package/dist/requests/validator.d.ts +54 -0
- package/dist/requests/validator.js +22 -0
- package/dist/requests/validator.js.map +1 -0
- package/dist/results/bwell-query-result-factory.d.ts +15 -0
- package/dist/results/bwell-query-result-factory.js +2 -0
- package/dist/results/bwell-query-result-factory.js.map +1 -0
- package/dist/results/bwell-query-result.d.ts +12 -0
- package/dist/results/bwell-query-result.js +19 -0
- package/dist/results/bwell-query-result.js.map +1 -0
- package/dist/results/bwell-transaction-result.d.ts +76 -0
- package/dist/results/bwell-transaction-result.js +95 -0
- package/dist/results/bwell-transaction-result.js.map +1 -0
- package/dist/results/index.d.ts +3 -0
- package/dist/results/index.js +4 -0
- package/dist/results/index.js.map +1 -0
- package/dist/telemetry/index.d.ts +2 -0
- package/dist/telemetry/index.js +3 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/open-telemetry-instrumentation.d.ts +3 -0
- package/dist/telemetry/open-telemetry-instrumentation.js +41 -0
- package/dist/telemetry/open-telemetry-instrumentation.js.map +1 -0
- package/dist/telemetry/open-telemetry.d.ts +14 -0
- package/dist/telemetry/open-telemetry.js +87 -0
- package/dist/telemetry/open-telemetry.js.map +1 -0
- package/dist/telemetry/telemetry.d.ts +8 -0
- package/dist/telemetry/telemetry.js +2 -0
- package/dist/telemetry/telemetry.js.map +1 -0
- package/dist/tokens/index.d.ts +2 -0
- package/dist/tokens/index.js +3 -0
- package/dist/tokens/index.js.map +1 -0
- package/dist/tokens/jwt-token-manager.d.ts +32 -0
- package/dist/tokens/jwt-token-manager.js +150 -0
- package/dist/tokens/jwt-token-manager.js.map +1 -0
- package/dist/tokens/token-storage.d.ts +33 -0
- package/dist/tokens/token-storage.js +33 -0
- package/dist/tokens/token-storage.js.map +1 -0
- package/dist/utils/base64.d.ts +12 -0
- package/dist/utils/base64.js +22 -0
- package/dist/utils/base64.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/parsing-utils.d.ts +26 -0
- package/dist/utils/parsing-utils.js +69 -0
- package/dist/utils/parsing-utils.js.map +1 -0
- package/dist/utils/runtime.d.ts +10 -0
- package/dist/utils/runtime.js +50 -0
- package/dist/utils/runtime.js.map +1 -0
- package/dist/utils/string-utils.d.ts +6 -0
- package/dist/utils/string-utils.js +9 -0
- package/dist/utils/string-utils.js.map +1 -0
- package/dist/utils/type-utils.d.ts +51 -0
- package/dist/utils/type-utils.js +58 -0
- package/dist/utils/type-utils.js.map +1 -0
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.js +10 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +42 -8
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ValidationError } from "../errors/index.js";
|
|
2
|
+
import { BWellTransactionResult } from "../results/index.js";
|
|
3
|
+
import { Validator } from "./validator.js";
|
|
4
|
+
/**
|
|
5
|
+
* The Request interface provides a set of methods to be used for serializing,
|
|
6
|
+
* validating, and accessing data Request data
|
|
7
|
+
*/
|
|
8
|
+
export interface Request<T> {
|
|
9
|
+
/**
|
|
10
|
+
* Returns data encapsulated by the Request
|
|
11
|
+
*/
|
|
12
|
+
data(): T;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a BWellTransactionResult describing any validation errors in this
|
|
15
|
+
* request data
|
|
16
|
+
*/
|
|
17
|
+
validate(): BWellTransactionResult<null, ValidationError>;
|
|
18
|
+
/**
|
|
19
|
+
* Method to allow JSON serializers to only serialize the wrapped request data
|
|
20
|
+
* without serializing any of the Request object data
|
|
21
|
+
*
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#description
|
|
23
|
+
*/
|
|
24
|
+
toJSON(): T;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* BaseRequest is the class to be extended when building a request input class
|
|
28
|
+
* which does not require any validation logic. Its `validate` method only
|
|
29
|
+
* returns a success result.
|
|
30
|
+
*
|
|
31
|
+
* I is the input type of the Request class.
|
|
32
|
+
* T is the output type of the request class and is defaulted to I. T should
|
|
33
|
+
* be the result of the trasnformInput method.
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class BaseRequest<I, T = I> implements Request<T> {
|
|
36
|
+
#private;
|
|
37
|
+
constructor(data: I);
|
|
38
|
+
/**
|
|
39
|
+
* Return a success validation result by default;
|
|
40
|
+
*/
|
|
41
|
+
validate(): BWellTransactionResult<null, ValidationError>;
|
|
42
|
+
data(): T;
|
|
43
|
+
toJSON(): T;
|
|
44
|
+
/**
|
|
45
|
+
* Allows classes to transform input data (I) into data of type T. This is
|
|
46
|
+
* useful when defaulting certain parameters or otherwise providing a different
|
|
47
|
+
* public api than what the internal api requries
|
|
48
|
+
*
|
|
49
|
+
* This is the default no-op version of the method that should be overriden
|
|
50
|
+
* when types T and I are not the same or input and output data differ
|
|
51
|
+
*
|
|
52
|
+
* @param {I} input - user provided data to transform to type T
|
|
53
|
+
*/
|
|
54
|
+
protected transformInput(input: I): T;
|
|
55
|
+
protected input(): I;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Class to extend for building request objects that require data validation
|
|
59
|
+
*/
|
|
60
|
+
export declare abstract class ValidationRequest<I, T = I> extends BaseRequest<I, T> {
|
|
61
|
+
/**
|
|
62
|
+
* Validator object that will be used in the `validate` method
|
|
63
|
+
*/
|
|
64
|
+
protected abstract validator: Validator<I>;
|
|
65
|
+
/**
|
|
66
|
+
* Validate the request.
|
|
67
|
+
* @returns a BWellTransactionResult describing any validation errors found
|
|
68
|
+
*/
|
|
69
|
+
validate(): BWellTransactionResult<null, ValidationError>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Interface to implement when bulding classes that transform an abstract request
|
|
73
|
+
* to a provider specific request object like GraphQL
|
|
74
|
+
*/
|
|
75
|
+
export interface RequestFactory<R extends Request<unknown>, Output> {
|
|
76
|
+
/**
|
|
77
|
+
* Takes an abstract Request object and converts it into domain/provider specific
|
|
78
|
+
* request data
|
|
79
|
+
*
|
|
80
|
+
* @param {Request} request - Request object to convert
|
|
81
|
+
* @returns {Output} data to be used by a concrete implementation of an API provider
|
|
82
|
+
*/
|
|
83
|
+
create(request: R): Output;
|
|
84
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _BaseRequest_data, _BaseRequest_input;
|
|
13
|
+
import { ValidationError } from "../errors/index.js";
|
|
14
|
+
import { BWellTransactionResult } from "../results/index.js";
|
|
15
|
+
import { ValidationErrorsCollector } from "./validator.js";
|
|
16
|
+
/**
|
|
17
|
+
* BaseRequest is the class to be extended when building a request input class
|
|
18
|
+
* which does not require any validation logic. Its `validate` method only
|
|
19
|
+
* returns a success result.
|
|
20
|
+
*
|
|
21
|
+
* I is the input type of the Request class.
|
|
22
|
+
* T is the output type of the request class and is defaulted to I. T should
|
|
23
|
+
* be the result of the trasnformInput method.
|
|
24
|
+
*/
|
|
25
|
+
export class BaseRequest {
|
|
26
|
+
constructor(data) {
|
|
27
|
+
_BaseRequest_data.set(this, void 0);
|
|
28
|
+
_BaseRequest_input.set(this, void 0);
|
|
29
|
+
__classPrivateFieldSet(this, _BaseRequest_input, data, "f");
|
|
30
|
+
__classPrivateFieldSet(this, _BaseRequest_data, this.transformInput(data), "f");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Return a success validation result by default;
|
|
34
|
+
*/
|
|
35
|
+
validate() {
|
|
36
|
+
return BWellTransactionResult.success(null);
|
|
37
|
+
}
|
|
38
|
+
data() {
|
|
39
|
+
return __classPrivateFieldGet(this, _BaseRequest_data, "f");
|
|
40
|
+
}
|
|
41
|
+
toJSON() {
|
|
42
|
+
return __classPrivateFieldGet(this, _BaseRequest_data, "f");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Allows classes to transform input data (I) into data of type T. This is
|
|
46
|
+
* useful when defaulting certain parameters or otherwise providing a different
|
|
47
|
+
* public api than what the internal api requries
|
|
48
|
+
*
|
|
49
|
+
* This is the default no-op version of the method that should be overriden
|
|
50
|
+
* when types T and I are not the same or input and output data differ
|
|
51
|
+
*
|
|
52
|
+
* @param {I} input - user provided data to transform to type T
|
|
53
|
+
*/
|
|
54
|
+
transformInput(input) {
|
|
55
|
+
// Force type conversion by default since T is defulted to I
|
|
56
|
+
return input;
|
|
57
|
+
}
|
|
58
|
+
input() {
|
|
59
|
+
return __classPrivateFieldGet(this, _BaseRequest_input, "f");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
_BaseRequest_data = new WeakMap(), _BaseRequest_input = new WeakMap();
|
|
63
|
+
/**
|
|
64
|
+
* Class to extend for building request objects that require data validation
|
|
65
|
+
*/
|
|
66
|
+
export class ValidationRequest extends BaseRequest {
|
|
67
|
+
/**
|
|
68
|
+
* Validate the request.
|
|
69
|
+
* @returns a BWellTransactionResult describing any validation errors found
|
|
70
|
+
*/
|
|
71
|
+
validate() {
|
|
72
|
+
const errorsCollector = new ValidationErrorsCollector();
|
|
73
|
+
this.validator.validate(this.input(), errorsCollector);
|
|
74
|
+
if (errorsCollector.hasErrors()) {
|
|
75
|
+
return BWellTransactionResult.failure(new ValidationError(errorsCollector.errors()));
|
|
76
|
+
}
|
|
77
|
+
return BWellTransactionResult.success(null);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/requests/request.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAa,MAAM,gBAAgB,CAAC;AA2BtE;;;;;;;;GAQG;AACH,MAAM,OAAgB,WAAW;IAI/B,YAAY,IAAO;QAHnB,oCAAS;QACT,qCAAU;QAGR,uBAAA,IAAI,sBAAU,IAAI,MAAA,CAAC;QACnB,uBAAA,IAAI,qBAAS,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAA,CAAC;IACzC,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAEM,IAAI;QACT,OAAO,uBAAA,IAAI,yBAAM,CAAC;IACpB,CAAC;IAEM,MAAM;QACX,OAAO,uBAAA,IAAI,yBAAM,CAAC;IACpB,CAAC;IAED;;;;;;;;;OASG;IACO,cAAc,CAAC,KAAQ;QAC/B,4DAA4D;QAC5D,OAAO,KAAqB,CAAC;IAC/B,CAAC;IAES,KAAK;QACb,OAAO,uBAAA,IAAI,0BAAO,CAAC;IACrB,CAAC;CACF;;AAED;;GAEG;AACH,MAAM,OAAgB,iBAA4B,SAAQ,WAAiB;IAMzE;;;OAGG;IACI,QAAQ;QACb,MAAM,eAAe,GAAG,IAAI,yBAAyB,EAAE,CAAC;QAExD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,eAAe,CAAC,CAAC;QAEvD,IAAI,eAAe,CAAC,SAAS,EAAE,EAAE,CAAC;YAChC,OAAO,sBAAsB,CAAC,OAAO,CACnC,IAAI,eAAe,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAC9C,CAAC;QACJ,CAAC;QAED,OAAO,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator is an interface which only implements a `validate` method which
|
|
3
|
+
* validates some data and collects the validation errors into an error collector
|
|
4
|
+
*/
|
|
5
|
+
export interface Validator<T> {
|
|
6
|
+
/**
|
|
7
|
+
* Validates provided data (T) and collects validation errors into an error
|
|
8
|
+
* collector
|
|
9
|
+
*
|
|
10
|
+
* @param {T} data - data to validate
|
|
11
|
+
* @param {ErrorsCollector} errors - Object to collect validation errors
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Class that validates a string is not blank
|
|
15
|
+
* class TestValidator implements Validator<string> {
|
|
16
|
+
* validate(data: string, errors: ErrorsCollector): void {
|
|
17
|
+
* if (data.length > 0) {
|
|
18
|
+
* return;
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* // Add the error to the errors collector
|
|
22
|
+
* errors.add("string cannot be blank");
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
validate(data: T, errors: ErrorsCollector): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Interface for collecting errors during data validation
|
|
30
|
+
*/
|
|
31
|
+
export interface ErrorsCollector {
|
|
32
|
+
/**
|
|
33
|
+
* Adds a new error to the collection
|
|
34
|
+
*
|
|
35
|
+
* @param {string} error - string describing a validation error
|
|
36
|
+
*/
|
|
37
|
+
add(error: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the collected errors
|
|
40
|
+
*
|
|
41
|
+
* @returns {string[]}
|
|
42
|
+
*/
|
|
43
|
+
errors(): string[];
|
|
44
|
+
/**
|
|
45
|
+
* @returns {boolean} - true if the collector has collected errors
|
|
46
|
+
*/
|
|
47
|
+
hasErrors(): boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare class ValidationErrorsCollector implements ErrorsCollector {
|
|
50
|
+
#private;
|
|
51
|
+
add(error: string): void;
|
|
52
|
+
errors(): string[];
|
|
53
|
+
hasErrors(): boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _ValidationErrorsCollector_errors;
|
|
7
|
+
export class ValidationErrorsCollector {
|
|
8
|
+
constructor() {
|
|
9
|
+
_ValidationErrorsCollector_errors.set(this, []);
|
|
10
|
+
}
|
|
11
|
+
add(error) {
|
|
12
|
+
__classPrivateFieldGet(this, _ValidationErrorsCollector_errors, "f").push(error);
|
|
13
|
+
}
|
|
14
|
+
errors() {
|
|
15
|
+
return __classPrivateFieldGet(this, _ValidationErrorsCollector_errors, "f");
|
|
16
|
+
}
|
|
17
|
+
hasErrors() {
|
|
18
|
+
return __classPrivateFieldGet(this, _ValidationErrorsCollector_errors, "f").length > 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
_ValidationErrorsCollector_errors = new WeakMap();
|
|
22
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/requests/validator.ts"],"names":[],"mappings":";;;;;;AAoDA,MAAM,OAAO,yBAAyB;IAAtC;QACE,4CAAoB,EAAE,EAAC;IAazB,CAAC;IAXQ,GAAG,CAAC,KAAa;QACtB,uBAAA,IAAI,yCAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAEM,MAAM;QACX,OAAO,uBAAA,IAAI,yCAAQ,CAAC;IACtB,CAAC;IAEM,SAAS;QACd,OAAO,uBAAA,IAAI,yCAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BWellQueryResult } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Interface to implement when bulding classes that transform a domain-specific result
|
|
4
|
+
* into a BWellQueryResult
|
|
5
|
+
*/
|
|
6
|
+
export interface BWellQueryResultFactory<I, Output extends BWellQueryResult<unknown>> {
|
|
7
|
+
/**
|
|
8
|
+
* Takes an object representing a domain-specific result and converts it into
|
|
9
|
+
* a BWellQueryResult
|
|
10
|
+
*
|
|
11
|
+
* @param {I} result - Result object to convert
|
|
12
|
+
* @returns {Output} data to be used by a concrete implementation of an API provider
|
|
13
|
+
*/
|
|
14
|
+
create(result: I): Output;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bwell-query-result-factory.js","sourceRoot":"","sources":["../../src/results/bwell-query-result-factory.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type BWellError } from "../errors/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Used when just querying for data.
|
|
4
|
+
* Can have data AND errors
|
|
5
|
+
*/
|
|
6
|
+
export declare class BWellQueryResult<T, E extends BWellError = BWellError> {
|
|
7
|
+
readonly data: T | undefined;
|
|
8
|
+
readonly error?: E;
|
|
9
|
+
constructor(data: T | undefined, error?: E | null);
|
|
10
|
+
hasError(): boolean;
|
|
11
|
+
static error<T, E extends BWellError>(error: E): BWellQueryResult<T, E>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Used when just querying for data.
|
|
3
|
+
* Can have data AND errors
|
|
4
|
+
*/
|
|
5
|
+
export class BWellQueryResult {
|
|
6
|
+
constructor(data, error) {
|
|
7
|
+
this.data = data;
|
|
8
|
+
if (error !== null) {
|
|
9
|
+
this.error = error;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
hasError() {
|
|
13
|
+
return this.error !== undefined;
|
|
14
|
+
}
|
|
15
|
+
static error(error) {
|
|
16
|
+
return new BWellQueryResult(undefined, error);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=bwell-query-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bwell-query-result.js","sourceRoot":"","sources":["../../src/results/bwell-query-result.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAI3B,YAAY,IAAmB,EAAE,KAAgB;QAC/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,CAAC;IACH,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IAClC,CAAC;IAEM,MAAM,CAAC,KAAK,CACjB,KAAQ;QAER,OAAO,IAAI,gBAAgB,CAAO,SAAS,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type BWellError } from "../errors/index.js";
|
|
2
|
+
import { BWellQueryResult } from "./bwell-query-result.js";
|
|
3
|
+
/**
|
|
4
|
+
* Class representing a successful operation whose result can only be a success
|
|
5
|
+
* or a failure.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class BWellTransactionResult<T, E extends BWellError = BWellError> {
|
|
8
|
+
/**
|
|
9
|
+
* Returns true if Result is BWellTransactionSuccess
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
abstract success(): this is BWellTransactionSuccess<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if Result is BWellTransactionFailure
|
|
15
|
+
* @returns {boolean}
|
|
16
|
+
*/
|
|
17
|
+
abstract failure(): this is BWellTransactionFailure<T, E>;
|
|
18
|
+
/**
|
|
19
|
+
* If Result is a BWellTransactionSuccess, returns T.
|
|
20
|
+
* Throws E if Result is BWellTransactionFailure
|
|
21
|
+
*
|
|
22
|
+
* @returns {T}
|
|
23
|
+
* @throws {E}
|
|
24
|
+
*/
|
|
25
|
+
abstract data(): T;
|
|
26
|
+
/**
|
|
27
|
+
* If Result is a BWellTransactionFailure returns E;
|
|
28
|
+
* Throws E if result is BWellTransactionSuccess
|
|
29
|
+
*
|
|
30
|
+
* @returns E
|
|
31
|
+
* @throw T
|
|
32
|
+
*/
|
|
33
|
+
abstract error(): E;
|
|
34
|
+
abstract toQueryResult(): BWellQueryResult<T, E>;
|
|
35
|
+
/**
|
|
36
|
+
* Provides a BWellTransactionSuccess with the given data
|
|
37
|
+
*/
|
|
38
|
+
static success<T>(data: T): BWellTransactionSuccess<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Provides a BWellTransactionFailure with the given error
|
|
41
|
+
*/
|
|
42
|
+
static failure<T, E extends BWellError>(error: E): BWellTransactionFailure<T, E>;
|
|
43
|
+
}
|
|
44
|
+
export declare class BWellTransactionSuccess<T> extends BWellTransactionResult<T, never> {
|
|
45
|
+
#private;
|
|
46
|
+
constructor(data: T);
|
|
47
|
+
data(): T;
|
|
48
|
+
error(): never;
|
|
49
|
+
success(): this is BWellTransactionSuccess<T>;
|
|
50
|
+
failure(): this is BWellTransactionFailure<T, never>;
|
|
51
|
+
toQueryResult(): BWellQueryResult<T, never>;
|
|
52
|
+
}
|
|
53
|
+
export declare class BWellTransactionFailure<T, E extends BWellError = BWellError> extends BWellTransactionResult<T, E> {
|
|
54
|
+
#private;
|
|
55
|
+
constructor(error: E);
|
|
56
|
+
data(): never;
|
|
57
|
+
error(): E;
|
|
58
|
+
success(): this is BWellTransactionSuccess<T>;
|
|
59
|
+
failure(): this is BWellTransactionFailure<T, E>;
|
|
60
|
+
/**
|
|
61
|
+
* Returns a new BWellTransactionFailure cast with <T, E>.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* // A BWellTransactionResult<number> could come back from some function.
|
|
65
|
+
* let result: BWellTransactionResult<number>;
|
|
66
|
+
*
|
|
67
|
+
* if (result.failure()) {
|
|
68
|
+
* // but you need to return a BWellTransactionResult<string>.
|
|
69
|
+
* // Since BWellTransactionFailure does not contain data we can cast the result
|
|
70
|
+
* // into the type we need like this
|
|
71
|
+
* return result.intoFailure<string>();
|
|
72
|
+
* }
|
|
73
|
+
*/
|
|
74
|
+
intoFailure<T>(): BWellTransactionResult<T, E>;
|
|
75
|
+
toQueryResult<T>(): BWellQueryResult<T, E>;
|
|
76
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _BWellTransactionSuccess_data, _BWellTransactionFailure_error;
|
|
13
|
+
import { BWellQueryResult } from "./bwell-query-result.js";
|
|
14
|
+
/**
|
|
15
|
+
* Class representing a successful operation whose result can only be a success
|
|
16
|
+
* or a failure.
|
|
17
|
+
*/
|
|
18
|
+
export class BWellTransactionResult {
|
|
19
|
+
/**
|
|
20
|
+
* Provides a BWellTransactionSuccess with the given data
|
|
21
|
+
*/
|
|
22
|
+
static success(data) {
|
|
23
|
+
return new BWellTransactionSuccess(data);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Provides a BWellTransactionFailure with the given error
|
|
27
|
+
*/
|
|
28
|
+
static failure(error) {
|
|
29
|
+
return new BWellTransactionFailure(error);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class BWellTransactionSuccess extends BWellTransactionResult {
|
|
33
|
+
constructor(data) {
|
|
34
|
+
super();
|
|
35
|
+
_BWellTransactionSuccess_data.set(this, void 0);
|
|
36
|
+
__classPrivateFieldSet(this, _BWellTransactionSuccess_data, data, "f");
|
|
37
|
+
}
|
|
38
|
+
data() {
|
|
39
|
+
return __classPrivateFieldGet(this, _BWellTransactionSuccess_data, "f");
|
|
40
|
+
}
|
|
41
|
+
error() {
|
|
42
|
+
throw __classPrivateFieldGet(this, _BWellTransactionSuccess_data, "f");
|
|
43
|
+
}
|
|
44
|
+
success() {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
failure() {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
toQueryResult() {
|
|
51
|
+
return new BWellQueryResult(this.data());
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_BWellTransactionSuccess_data = new WeakMap();
|
|
55
|
+
export class BWellTransactionFailure extends BWellTransactionResult {
|
|
56
|
+
constructor(error) {
|
|
57
|
+
super();
|
|
58
|
+
_BWellTransactionFailure_error.set(this, void 0);
|
|
59
|
+
__classPrivateFieldSet(this, _BWellTransactionFailure_error, error, "f");
|
|
60
|
+
}
|
|
61
|
+
data() {
|
|
62
|
+
throw __classPrivateFieldGet(this, _BWellTransactionFailure_error, "f");
|
|
63
|
+
}
|
|
64
|
+
error() {
|
|
65
|
+
return __classPrivateFieldGet(this, _BWellTransactionFailure_error, "f");
|
|
66
|
+
}
|
|
67
|
+
success() {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
failure() {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns a new BWellTransactionFailure cast with <T, E>.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // A BWellTransactionResult<number> could come back from some function.
|
|
78
|
+
* let result: BWellTransactionResult<number>;
|
|
79
|
+
*
|
|
80
|
+
* if (result.failure()) {
|
|
81
|
+
* // but you need to return a BWellTransactionResult<string>.
|
|
82
|
+
* // Since BWellTransactionFailure does not contain data we can cast the result
|
|
83
|
+
* // into the type we need like this
|
|
84
|
+
* return result.intoFailure<string>();
|
|
85
|
+
* }
|
|
86
|
+
*/
|
|
87
|
+
intoFailure() {
|
|
88
|
+
return BWellTransactionResult.failure(this.error());
|
|
89
|
+
}
|
|
90
|
+
toQueryResult() {
|
|
91
|
+
return new BWellQueryResult(undefined, this.error());
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
_BWellTransactionFailure_error = new WeakMap();
|
|
95
|
+
//# sourceMappingURL=bwell-transaction-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bwell-transaction-result.js","sourceRoot":"","sources":["../../src/results/bwell-transaction-result.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;GAGG;AACH,MAAM,OAAgB,sBAAsB;IAoC1C;;OAEG;IACI,MAAM,CAAC,OAAO,CAAI,IAAO;QAC9B,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,OAAO,CACnB,KAAQ;QAER,OAAO,IAAI,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,MAAM,OAAO,uBAA2B,SAAQ,sBAG/C;IAGC,YAAY,IAAO;QACjB,KAAK,EAAE,CAAC;QAHV,gDAAS;QAIP,uBAAA,IAAI,iCAAS,IAAI,MAAA,CAAC;IACpB,CAAC;IAEM,IAAI;QACT,OAAO,uBAAA,IAAI,qCAAM,CAAC;IACpB,CAAC;IAEM,KAAK;QACV,MAAM,uBAAA,IAAI,qCAAM,CAAC;IACnB,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;;AAED,MAAM,OAAO,uBAGX,SAAQ,sBAA4B;IAGpC,YAAY,KAAQ;QAClB,KAAK,EAAE,CAAC;QAHV,iDAAU;QAIR,uBAAA,IAAI,kCAAU,KAAK,MAAA,CAAC;IACtB,CAAC;IAEM,IAAI;QACT,MAAM,uBAAA,IAAI,sCAAO,CAAC;IACpB,CAAC;IAEM,KAAK;QACV,OAAO,uBAAA,IAAI,sCAAO,CAAC;IACrB,CAAC;IAEM,OAAO;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;OAaG;IACI,WAAW;QAChB,OAAO,sBAAsB,CAAC,OAAO,CAAO,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;IAEM,aAAa;QAClB,OAAO,IAAI,gBAAgB,CAAC,SAAc,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/results/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FetchInstrumentation } from "@opentelemetry/instrumentation-fetch";
|
|
2
|
+
import { executeForRuntime } from "../utils/index.js";
|
|
3
|
+
const SERVICE_URL_BASE = "https?://api-gateway.[a-zA-Z]+.icanbwell.com";
|
|
4
|
+
const SERVICE_URL_REGEX_STR = `${SERVICE_URL_BASE}/.+`;
|
|
5
|
+
// These regex's will test false for any url that is not a bwell api url
|
|
6
|
+
const IGNORE_URL_REGEX = new RegExp(`^(?!${SERVICE_URL_BASE})`);
|
|
7
|
+
const CORS_URL_REGEX = new RegExp(SERVICE_URL_REGEX_STR);
|
|
8
|
+
export function ignoreUrl(url) {
|
|
9
|
+
// This regex tests that a url DOES NOT match a bwell url
|
|
10
|
+
return IGNORE_URL_REGEX.test(url);
|
|
11
|
+
}
|
|
12
|
+
export function getRuntimeInstrumentation() {
|
|
13
|
+
return executeForRuntime({
|
|
14
|
+
node: () => {
|
|
15
|
+
/**
|
|
16
|
+
* For now we are disabling request instrumentation for Node.js runtimes
|
|
17
|
+
* (UndiciInstrumentation).
|
|
18
|
+
*
|
|
19
|
+
* Below is the implementation needed for instrumenting network requests
|
|
20
|
+
* in a Node.js environment.
|
|
21
|
+
*
|
|
22
|
+
* This uses the `UndiciInstrumentation` class provided by the "@opentelemetry/instrumentation-undici"
|
|
23
|
+
* package
|
|
24
|
+
*
|
|
25
|
+
* return new UndiciInstrumentation({
|
|
26
|
+
* ignoreRequestHook: (req) => {
|
|
27
|
+
* return ignoreUrl(req.origin);
|
|
28
|
+
* },
|
|
29
|
+
* });
|
|
30
|
+
*/
|
|
31
|
+
return null;
|
|
32
|
+
},
|
|
33
|
+
browser: () => {
|
|
34
|
+
return new FetchInstrumentation({
|
|
35
|
+
ignoreUrls: [IGNORE_URL_REGEX],
|
|
36
|
+
propagateTraceHeaderCorsUrls: CORS_URL_REGEX,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=open-telemetry-instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-telemetry-instrumentation.js","sourceRoot":"","sources":["../../src/telemetry/open-telemetry-instrumentation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,gBAAgB,GAAG,8CAA8C,CAAC;AACxE,MAAM,qBAAqB,GAAG,GAAG,gBAAgB,KAAK,CAAC;AAEvD,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,OAAO,gBAAgB,GAAG,CAAC,CAAC;AAChE,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEzD,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,yDAAyD;IACzD,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO,iBAAiB,CAA6B;QACnD,IAAI,EAAE,GAAG,EAAE;YACT;;;;;;;;;;;;;;;eAeG;YAEH,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,IAAI,oBAAoB,CAAC;gBAC9B,UAAU,EAAE,CAAC,gBAAgB,CAAC;gBAC9B,4BAA4B,EAAE,cAAc;aAC7C,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InstrumentationBase } from "@opentelemetry/instrumentation";
|
|
2
|
+
import { Resource } from "@opentelemetry/resources";
|
|
3
|
+
import { LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
4
|
+
import { BasicTracerProvider } from "@opentelemetry/sdk-trace-base";
|
|
5
|
+
import { SdkConfig } from "../config/index.js";
|
|
6
|
+
import { Telemetry } from "./telemetry.js";
|
|
7
|
+
export declare class OpenTelemetry implements Telemetry {
|
|
8
|
+
#private;
|
|
9
|
+
readonly fetchInstrumentation: InstrumentationBase | null;
|
|
10
|
+
constructor(config: SdkConfig);
|
|
11
|
+
loggerProvider(): LoggerProvider;
|
|
12
|
+
resource(): Resource;
|
|
13
|
+
tracerProvider(): BasicTracerProvider;
|
|
14
|
+
}
|