Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: automate-docs #513

Merged
merged 5 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: codecov
add codecov, fix up tsconfigs, and add extenssions to mock-api-v2 for
node16+ support
  • Loading branch information
ryanbas21 committed Dec 12, 2024
commit 8456a8f4e5a0d2da337008bd330923bc5451d87c
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
pnpm-lock.yaml
packages/*/docs
packages/*/coverage

7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ jobs:
- run: git branch --track develop origin/develop

- run: pnpm exec nx-cloud record -- nx format:check --verbose
- run: pnpm exec nx affected -t build lint test e2e-ci --verbose
- run: pnpm exec nx affected -t build lint test docs e2e-ci --verbose

- uses: codecov/codecov-action@v5
with:
files: ./packages/**/coverage/*.xml
token: ${{ secrets.CODECOV_TOKEN }}

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- uses: codecov/codecov-action@v5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after we publish everything, we can try to upload a coverage report. doing this after because by this point we should have

A) run tests, and builds
B) I don't want uploading coverage to affect the publish or versioning, etc

with:
files: ./packages/**/coverage/*.xml
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ e2e/token-vault-app/public/assets/
bundles/
docs/
coverage/
packages/**/coverage/
node_modules/
samples/_static/js/*.js*
tests/**/app/index.js*
Expand Down
3 changes: 2 additions & 1 deletion e2e/mock-api-v2/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ LICENSE
.env*
.bin
dist
.eslintignore
.eslintignore
coverage
13 changes: 13 additions & 0 deletions e2e/mock-api-v2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "mock-api",
"version": "0.0.0",
"private": true,
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.js",
"exports": "./dist/index.js",
"keywords": [],
"author": "",
"type": "module",
"license": "ISC"
}
7 changes: 2 additions & 5 deletions e2e/mock-api-v2/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"options": {
"platform": "node",
"outputPath": "e2e/mock-api-v2/dist",
"format": ["cjs"],
"bundle": false,
"format": ["esm"],
"bundle": true,
"main": "e2e/mock-api-v2/src/main.ts",
"tsConfig": "e2e/mock-api-v2/tsconfig.app.json",
"assets": ["e2e/mock-api-v2/src/assets"],
Expand Down Expand Up @@ -69,9 +69,6 @@
"{projectRoot}/{options.coverage.reportsDirectory}",
"{workspaceRoot}/coverage/e2e/mock-api-v2"
],
"options": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've defined this all in the vite config.

"coverage.reportsDirectory": "../../coverage/e2e/mock-api-v2"
},
"configurations": {
"watch": {
"watch": true
Expand Down
8 changes: 4 additions & 4 deletions e2e/mock-api-v2/src/endpoints/custom-html.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { Api, ApiResponse } from 'effect-http';
import {
DavinciAuthorizeHeaders,
DavinciAuthorizeResponseHeaders,
} from '../schemas/authorize.schema';
} from '../schemas/authorize.schema.js';
import {
PingOneCustomHtmlRequestBody,
PingOneRequestQuery,
} from '../schemas/custom-html-template/custom-html-template-request.schema';
} from '../schemas/custom-html-template/custom-html-template-request.schema.js';
import {
PingOneCustomHtmlResponseBody,
PingOneCustomHtmlResponseErrorBody,
PingOnePathParams,
} from '../schemas/custom-html-template/custom-html-template-response.schema';
import { SuccessResponseRedirect } from '../schemas/return-success-response-redirect.schema';
} from '../schemas/custom-html-template/custom-html-template-response.schema.js';
import { SuccessResponseRedirect } from '../schemas/return-success-response-redirect.schema.js';

const customHtmlEndPoint = Api.addEndpoint(
pipe(
Expand Down
6 changes: 3 additions & 3 deletions e2e/mock-api-v2/src/endpoints/davinci-authorize.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
DavinciAuthorizeHeaders,
DavinciAuthorizeQuery,
DavinciAuthorizeResponseHeaders,
} from '../schemas/authorize.schema';
import { PingOneCustomHtmlResponseBody } from '../schemas/custom-html-template/custom-html-template-response.schema';
import { SuccessResponseRedirect } from '../schemas/return-success-response-redirect.schema';
} from '../schemas/authorize.schema.js';
import { PingOneCustomHtmlResponseBody } from '../schemas/custom-html-template/custom-html-template-response.schema.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updating tsconfigs made this a change, its all just adding extensions to files.

import { SuccessResponseRedirect } from '../schemas/return-success-response-redirect.schema.js';

const davinciAuthorize = Api.addEndpoint(
pipe(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Schema } from '@effect/schema';
import { pipe } from 'effect';
import { Api } from 'effect-http';
import { openIdConfigurationResponseSchema } from '../schemas/open-id-configuration/open-id-configuration-response.schema';
import { openIdConfigurationResponseSchema } from '../schemas/open-id-configuration/open-id-configuration-response.schema.js';

const openidConfiguration = Api.addEndpoint(
pipe(
Expand Down
2 changes: 1 addition & 1 deletion e2e/mock-api-v2/src/endpoints/token.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Schema } from '@effect/schema';
import { pipe } from 'effect';
import { Api } from 'effect-http';

import { TokenResponseBody } from '../schemas/token/token.schema';
import { TokenResponseBody } from '../schemas/token/token.schema.js';

const pingOneToken = Api.addEndpoint(
pipe(
Expand Down
2 changes: 1 addition & 1 deletion e2e/mock-api-v2/src/endpoints/userinfo.endpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Schema } from '@effect/schema';
import { pipe } from 'effect';
import { Api, ApiResponse, Security } from 'effect-http';

import { UserInfoSchema } from '../schemas/userinfo/userinfo.schema';
import { UserInfoSchema } from '../schemas/userinfo/userinfo.schema.js';

const userInfo = Api.addEndpoint(
pipe(
Expand Down
2 changes: 1 addition & 1 deletion e2e/mock-api-v2/src/example-server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RouterBuilder, Middlewares, ExampleServer } from 'effect-http';
import { NodeRuntime } from '@effect/platform-node';
import { NodeServer } from 'effect-http-node';
import { apiSpec } from './spec';
import { apiSpec } from './spec.js';

const app = ExampleServer.make(apiSpec).pipe(RouterBuilder.build, Middlewares.errorLog);

Expand Down
6 changes: 3 additions & 3 deletions e2e/mock-api-v2/src/handlers/authorize.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { toCookieHeader } from '@effect/platform/Cookies';
import { Effect } from 'effect';
import { RouterBuilder } from 'effect-http';

import { Authorize } from '../services/authorize.service';
import { CookieService } from '../services/cookie.service';
import { apiSpec } from '../spec';
import { Authorize } from '../services/authorize.service.js';
import { CookieService } from '../services/cookie.service.js';
import { apiSpec } from '../spec.js';

const authorizeHandler = RouterBuilder.handler(apiSpec, 'DavinciAuthorize', ({ headers, query }) =>
Effect.gen(function* () {
Expand Down
6 changes: 3 additions & 3 deletions e2e/mock-api-v2/src/handlers/custom-html-template.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { toCookieHeader } from '@effect/platform/Cookies';
import { Effect } from 'effect';
import { RouterBuilder } from 'effect-http';

import { CookieService } from '../services/cookie.service';
import { CustomHtmlTemplate } from '../services/custom-html-template.service';
import { apiSpec } from '../spec';
import { CookieService } from '../services/cookie.service.js';
import { CustomHtmlTemplate } from '../services/custom-html-template.service.js';
import { apiSpec } from '../spec.js';

const customHtmlHandler = RouterBuilder.handler(
apiSpec,
Expand Down
4 changes: 2 additions & 2 deletions e2e/mock-api-v2/src/handlers/open-id-configuration.handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Effect } from 'effect';
import { RouterBuilder } from 'effect-http';
import { apiSpec } from '../spec';
import { openidConfigurationResponse } from '../responses/open-id-configuration';
import { apiSpec } from '../spec.js';
import { openidConfigurationResponse } from '../responses/open-id-configuration.js';

const openidConfiguration = RouterBuilder.handler(apiSpec, 'openidConfiguration', () =>
// eslint-disable-next-line require-yield
Expand Down
4 changes: 2 additions & 2 deletions e2e/mock-api-v2/src/handlers/token.handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Effect } from 'effect';
import { RouterBuilder } from 'effect-http';
import { apiSpec } from '../spec';
import { Tokens } from '../services/tokens.service';
import { apiSpec } from '../spec.js';
import { Tokens } from '../services/tokens.service.js';

const tokenHandler = RouterBuilder.handler(apiSpec, 'PingOneToken', () =>
Effect.gen(function* () {
Expand Down
4 changes: 2 additions & 2 deletions e2e/mock-api-v2/src/handlers/userinfo.handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Effect } from 'effect';
import { RouterBuilder } from 'effect-http';
import { apiSpec } from '../spec';
import { UserInfo } from '../services/userinfo.service';
import { apiSpec } from '../spec.js';
import { UserInfo } from '../services/userinfo.service.js';

const userInfoHandler = RouterBuilder.handler(apiSpec, 'UserInfo', (request, security) =>
Effect.gen(function* () {
Expand Down
6 changes: 3 additions & 3 deletions e2e/mock-api-v2/src/helpers/cookie.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Cookies } from '@effect/platform';
import { Effect, Option, pipe } from 'effect';

import { ResponseMapKeys, responseMap } from '../responses';
import { returnSuccessResponseRedirect } from '../responses/return-success-redirect';
import { ResponseMapKeys, responseMap } from '../responses/index.js';
import { returnSuccessResponseRedirect } from '../responses/return-success-redirect.js';

import { HeaderTypes } from '../types';
import { HeaderTypes } from '../types/index.js';

/**
*
Expand Down
4 changes: 2 additions & 2 deletions e2e/mock-api-v2/src/helpers/match.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Schema } from '@effect/schema';
import { Effect, Match } from 'effect';

import { InvalidUsernamePassword, InvalidProtectNode } from '../errors';
import { PingOneCustomHtmlRequestBody } from '../schemas/custom-html-template/custom-html-template-request.schema';
import { InvalidUsernamePassword, InvalidProtectNode } from '../errors/index.js';
import { PingOneCustomHtmlRequestBody } from '../schemas/custom-html-template/custom-html-template-request.schema.js';

type PingRequestData = Schema.Schema.Type<
typeof PingOneCustomHtmlRequestBody
Expand Down
12 changes: 8 additions & 4 deletions e2e/mock-api-v2/src/helpers/test/cookie.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { it, expect } from '@effect/vitest';
import { getElementFromCookie, incrementCookieHeader, parseCookieHeaderForIndex } from '../cookie';
import { HeaderTypes } from '../../types';
import {
getElementFromCookie,
incrementCookieHeader,
parseCookieHeaderForIndex,
} from '../cookie.js';
import { HeaderTypes } from '../../types/index.js';
import { Effect, Exit } from 'effect';
import { responseMap } from '../../responses';
import { returnSuccessResponseRedirect } from '../../responses/return-success-redirect';
import { responseMap } from '../../responses/index.js';
import { returnSuccessResponseRedirect } from '../../responses/return-success-redirect.js';

it.effect('should parse a cookie header for an index value', () =>
Effect.gen(function* () {
Expand Down
2 changes: 1 addition & 1 deletion e2e/mock-api-v2/src/helpers/test/match.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { it, expect } from '@effect/vitest';
import { PingRequestData, validator } from '../match';
import { PingRequestData, validator } from '../match.js';
import { Effect, Exit } from 'effect';

it.effect('match validation function passes username password validation', () =>
Expand Down
24 changes: 12 additions & 12 deletions e2e/mock-api-v2/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import { Config, Effect, Layer, pipe } from 'effect';
import { RouterBuilder, Middlewares } from 'effect-http';
import { NodeRuntime } from '@effect/platform-node';
import { NodeServer } from 'effect-http-node';
import { apiSpec } from './spec';
import { apiSpec } from './spec.js';

import { authorizeHandler } from './handlers/authorize.handler';
import { customHtmlHandler } from './handlers/custom-html-template.handler';
import { openidConfiguration } from './handlers/open-id-configuration.handler';
import { tokenHandler } from './handlers/token.handler';
import { userInfoHandler } from './handlers/userinfo.handler';
import { authorizeHandler } from './handlers/authorize.handler.js';
import { customHtmlHandler } from './handlers/custom-html-template.handler.js';
import { openidConfiguration } from './handlers/open-id-configuration.handler.js';
import { tokenHandler } from './handlers/token.handler.js';
import { userInfoHandler } from './handlers/userinfo.handler.js';

import { authorizeMock } from './services/authorize.service';
import { CookieService, cookieServiceTest } from './services/cookie.service';
import { mockCustomHtmlTemplate } from './services/custom-html-template.service';
import { mockRequest } from './services/request.service';
import { mockTokens } from './services/tokens.service';
import { UserInfo, userInfoMock } from './services/userinfo.service';
import { authorizeMock } from './services/authorize.service.js';
import { CookieService, cookieServiceTest } from './services/cookie.service.js';
import { mockCustomHtmlTemplate } from './services/custom-html-template.service.js';
import { mockRequest } from './services/request.service.js';
import { mockTokens } from './services/tokens.service.js';
import { UserInfo, userInfoMock } from './services/userinfo.service.js';

const app = RouterBuilder.make(apiSpec).pipe(
RouterBuilder.handle('HealthCheck', () => Effect.succeed('Healthy!')),
Expand Down
6 changes: 3 additions & 3 deletions e2e/mock-api-v2/src/responses/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Array } from 'effect';
import { UsernamePassword } from './username-password';
import { PingProtectNode } from './custom-html-template/ping-protect-node';
import { InvalidUsernamePassword } from './invalid-username-password';
import { UsernamePassword } from './username-password.js';
import { PingProtectNode } from './custom-html-template/ping-protect-node.js';
import { InvalidUsernamePassword } from './invalid-username-password.js';

type ResponseMapKeys = keyof typeof responseMap;
const responseMap = {
Expand Down
2 changes: 1 addition & 1 deletion e2e/mock-api-v2/src/schemas/userinfo/userinfo.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ interface UserInfo extends Schema.Schema.Type<typeof _UserInfoSchema> {}

const UserInfoSchema: Schema.Schema<UserInfo, UserInfo> = _UserInfoSchema;

export { UserInfoSchema };
export { UserInfoSchema, UserInfo };
8 changes: 4 additions & 4 deletions e2e/mock-api-v2/src/services/authorize.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Schema } from '@effect/schema';
import { Context, Effect, Layer, pipe } from 'effect';
import { HttpError } from 'effect-http';

import { getFirstElementAndRespond } from './mock-env-helpers';
import { Request } from './request.service';
import { PingOneCustomHtmlResponseBody } from '../schemas/custom-html-template/custom-html-template-response.schema';
import { getFirstElementAndRespond } from './mock-env-helpers/index.js';
import { Request } from './request.service.js';
import { PingOneCustomHtmlResponseBody } from '../schemas/custom-html-template/custom-html-template-response.schema.js';

import { HeaderTypes, QueryTypes } from '../types';
import { HeaderTypes, QueryTypes } from '../types/index.js';

type AuthorizeResponseBody = Schema.Schema.Type<typeof PingOneCustomHtmlResponseBody>;

Expand Down
4 changes: 2 additions & 2 deletions e2e/mock-api-v2/src/services/cookie.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as Cookies from '@effect/platform/Cookies';
import { Effect, Context, Either } from 'effect';

import { incrementCookieHeader } from '../helpers/cookie';
import { HeaderTypes } from '../types';
import { incrementCookieHeader } from '../helpers/cookie.js';
import { HeaderTypes } from '../types/index.js';

/*
* Define the interface for the Cookie Service
Expand Down
11 changes: 8 additions & 3 deletions e2e/mock-api-v2/src/services/custom-html-template.service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { Context, Effect, Layer } from 'effect';
import { HttpError } from 'effect-http';
import { Request } from './request.service';
import { Request } from './request.service.js';

import { CustomHtmlRequestBody, CustomHtmlResponseBody, HeaderTypes, QueryTypes } from '../types';
import { validateCustomHtmlRequest } from './mock-env-helpers';
import {
CustomHtmlRequestBody,
CustomHtmlResponseBody,
HeaderTypes,
QueryTypes,
} from '../types/index.js';
import { validateCustomHtmlRequest } from './mock-env-helpers/index.js';

class CustomHtmlTemplate extends Context.Tag('@services/CustomHtmlTemplate')<
CustomHtmlTemplate,
Expand Down
10 changes: 5 additions & 5 deletions e2e/mock-api-v2/src/services/mock-env-helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Schema } from '@effect/schema';
import { Array, Effect, Option, pipe } from 'effect';

import { UnableToFindNextStep } from '../../errors';
import { PingOneCustomHtmlRequestBody } from '../../schemas/custom-html-template/custom-html-template-request.schema';
import { ResponseMapKeys, responseMap } from '../../responses';
import { UnableToFindNextStep } from '../../errors/index.js';
import { PingOneCustomHtmlRequestBody } from '../../schemas/custom-html-template/custom-html-template-request.schema.js';
import { ResponseMapKeys, responseMap } from '../../responses/index.js';

import { CustomHtmlRequestBody, QueryTypes } from '../../types';
import { validator } from '../../helpers/match';
import { CustomHtmlRequestBody, QueryTypes } from '../../types/index.js';
import { validator } from '../../helpers/match.js';

type DavinciFormData = Schema.Schema.Type<
typeof PingOneCustomHtmlRequestBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
getNextStep,
mapDataToValue,
validateCustomHtmlRequest,
} from '..';
import { CustomHtmlRequestBody, QueryTypes } from '../../../types';
import { PingProtectNode } from '../../../responses/custom-html-template/ping-protect-node';
import { UsernamePassword } from '../../../responses/username-password';
} from '../index.js';
import { CustomHtmlRequestBody, QueryTypes } from '../../../types/index.js';
import { PingProtectNode } from '../../../responses/custom-html-template/ping-protect-node.js';
import { UsernamePassword } from '../../../responses/username-password.js';

it('should map data to value in a DavinciFormData', () => {
const data = Option.some({
Expand Down
6 changes: 3 additions & 3 deletions e2e/mock-api-v2/src/services/request.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Effect, Context, pipe, Layer } from 'effect';
import { HttpError } from 'effect-http';

import { getElementFromCookie } from '../helpers/cookie';
import { getNextStep } from './mock-env-helpers';
import { getElementFromCookie } from '../helpers/cookie.js';
import { getNextStep } from './mock-env-helpers/index.js';

import { HeaderTypes, QueryTypes } from '../types';
import { HeaderTypes, QueryTypes } from '../types/index.js';

type Init<Headers extends HeaderTypes, Query extends QueryTypes, Body = null> = {
headers: Headers;
Expand Down
Loading
Loading