Skip to content

Commit 0d54b34

Browse files
ancheetahryanbas21
authored andcommitted
feat(sdk-utilities,logger,oidc,sdk-request-middleware,sdk-types): added-packages
Ported over logger, oidc, and abstracted request middleware into own packages. As a result we created a shared types and and a utilities directory. Updated davinci-client to use these packages. Added copyright Co-authored-by: AJ Ancheta <ajancheta@pingidentity.com> Co-authored-by: Justin Lowery <justin.lowery@pingidentity.com>
1 parent ece3602 commit 0d54b34

File tree

101 files changed

+3260
-278
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+3260
-278
lines changed

.changeset/config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
],
99
"commit": false,
1010
"fixed": [["@forgerock/*"]],
11-
"privatePackages": false,
1211
"linked": [],
1312
"access": "public",
1413
"baseBranch": "main",
@@ -17,6 +16,7 @@
1716
"@forgerock/device-client",
1817
"@forgerock/davinci-app",
1918
"@forgerock/davinci-suites",
20-
"@forgerock/mock-api-v2"
19+
"@forgerock/mock-api-v2",
20+
"@forgerock/local-release-tool"
2121
]
2222
}

.changeset/new-otters-warn.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@forgerock/sdk-request-middleware': minor
3+
'@forgerock/davinci-client': minor
4+
'@forgerock/sdk-logger': minor
5+
'@forgerock/sdk-utilities': minor
6+
'@forgerock/sdk-oidc': minor
7+
---
8+
9+
created effects type packages, logger, oidc, and request middleware

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ packages/**/coverage/
1818
node_modules/
1919
tests/**/app/index.js*
2020
tests/**/ie11/ie-bundle.js*
21+
# Out-TSC directories (TypeScript output)
22+
**/out-tsc/*
23+
out-tsc/
24+
**/out-tsc
25+
**/*.out-tsc
2126
.swc
2227
.vite
2328

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# ForgeRock Javascript SDK Changelogs
22

33
[ForgeRock DaVinci Client package](./packages/davinci-client/CHANGELOG.md)
4+
[ForgeRock SDK Utilities package](./packages/sdk-utilities/CHANGELOG.md)

e2e/davinci-app/main.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import './style.css';
88

99
import { Config, FRUser, TokenManager } from '@forgerock/javascript-sdk';
1010
import { davinci } from '@forgerock/davinci-client';
11-
1211
import type { DaVinciConfig, RequestMiddleware } from '@forgerock/davinci-client/types';
1312

1413
import textComponent from './components/text.js';
@@ -27,7 +26,7 @@ const searchParams = new URLSearchParams(qs);
2726
const config: DaVinciConfig =
2827
serverConfigs[searchParams.get('clientId') || '724ec718-c41c-4d51-98b0-84a583f450f9'];
2928

30-
const requestMiddleware: RequestMiddleware[] = [
29+
const requestMiddleware: RequestMiddleware<'DAVINCI_NEXT' | 'DAVINCI_START'>[] = [
3130
(fetchArgs, action, next) => {
3231
if (action.type === 'DAVINCI_START') {
3332
fetchArgs.url.searchParams.set('start', 'true');
@@ -55,7 +54,9 @@ const urlParams = new URLSearchParams(window.location.search);
5554
if (continueToken) {
5655
resumed = await davinciClient.resume({ continueToken });
5756
} else {
58-
await Config.setAsync(config);
57+
// the current davinci-config has a slightly
58+
// different middleware type than the old legacy config
59+
await Config.setAsync(config as any);
5960
}
6061
function renderComplete() {
6162
const clientInfo = davinciClient.getClient();

e2e/davinci-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"private": true,
77
"nx": {
8-
"tags": ["scope:app"]
8+
"tags": ["scope:e2e"]
99
},
1010
"scripts": {
1111
"build": "pnpm nx nxBuild",

eslint.config.mjs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ const compat = new FlatCompat({
1515

1616
export default [
1717
{
18-
ignores: ['**/dist', '**/vite.config.*.timestamp*', '**/vitest.config.*.timestamp*'],
18+
ignores: [
19+
'**/dist',
20+
'**/vite.config.*.timestamp*',
21+
'**/vitest.config.*.timestamp*',
22+
'**/out-tsc',
23+
],
1924
},
2025
...compat.extends('plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'),
2126
{
@@ -57,6 +62,7 @@ export default [
5762
{
5863
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
5964
rules: {
65+
'import/extensions': [2, 'ignorePackages'],
6066
'@nx/enforce-module-boundaries': [
6167
'warn',
6268
{
@@ -65,14 +71,30 @@ export default [
6571
depConstraints: [
6672
{
6773
sourceTag: 'scope:e2e',
68-
onlyDependOnLibsWithTags: ['scope:app'],
74+
onlyDependOnLibsWithTags: ['scope:package'],
6975
},
7076
{
7177
sourceTag: 'scope:package',
72-
onlyDependOnLibsWithTags: [],
78+
onlyDependOnLibsWithTags: [
79+
'scope:sdk-utilities',
80+
'scope:sdk-effects',
81+
'scope:sdk-types',
82+
],
83+
},
84+
{
85+
sourceTag: 'scope:sdk-utilities',
86+
onlyDependOnLibsWithTags: ['scope:sdk-types'],
87+
},
88+
{
89+
sourceTag: 'scope:sdk-effects',
90+
onlyDependOnLibsWithTags: ['scope:sdk-utilities', 'scope:sdk-types'],
91+
},
92+
{
93+
sourceTag: 'scope:sdk-config',
94+
onlyDependOnLibsWithTags: ['scope:sdk-utilities', 'scope:sdk-types'],
7395
},
7496
{
75-
sourceTag: 'scope:types',
97+
sourceTag: 'scope:sdk-types',
7698
onlyDependOnLibsWithTags: [],
7799
},
78100
],
@@ -133,7 +155,7 @@ export default [
133155
},
134156
},
135157
{
136-
ignores: ['dist/*', '**/**/tsconfig.spec.vitest-temp.json'],
158+
ignores: ['**/*.md', 'dist/*', '**/**/tsconfig.spec.vitest-temp.json'],
137159
},
138160
packageJson.configs.recommended,
139161
{

nx.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"!{projectRoot}/test-setup.[jt]s",
2626
"noEslintConfig",
2727
"noMarkdown",
28-
"workspaceRootIgnores"
28+
"workspaceRootIgnores",
29+
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)"
2930
],
3031
"noMarkdown": ["!{projectRoot}/*.md", "!{projectRoot}/**/*.md"],
3132
"noTests": [
@@ -69,7 +70,7 @@
6970
},
7071
"test": {
7172
"inputs": ["default", "^default", "noMarkdown", "^noMarkdown"],
72-
"dependsOn": ["^test"],
73+
"dependsOn": ["^test", "^build", "^build", "^build", "^build"],
7374
"outputs": ["{projectRoot}/coverage"],
7475
"cache": true
7576
},
@@ -152,6 +153,20 @@
152153
"typecheckTargetName": "typecheck"
153154
},
154155
"include": ["packages/**/**/*", "e2e/**/**/*"]
156+
},
157+
{
158+
"plugin": "@nx/vite/plugin",
159+
"options": {
160+
"buildTargetName": "vite:build",
161+
"testTargetName": "vite:test",
162+
"serveTargetName": "vite:serve",
163+
"devTargetName": "vite:dev",
164+
"previewTargetName": "vite:preview",
165+
"serveStaticTargetName": "vite:serve-static",
166+
"typecheckTargetName": "vite:typecheck",
167+
"buildDepsTargetName": "vite:build-deps",
168+
"watchDepsTargetName": "vite:watch-deps"
169+
}
155170
}
156171
],
157172
"parallel": 1,
@@ -161,7 +176,6 @@
161176
},
162177
"generators": {
163178
"@nx/js:library": {
164-
"publishable": true,
165179
"outDir": "{projectRoot}/dist",
166180
"bundler": "tsc",
167181
"linter": "eslint",

package.json

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
11
{
22
"name": "ping-javascript-sdk",
3+
"version": "0.0.0",
34
"private": true,
45
"description": "Ping JavaScript SDK",
5-
"packageManager": "pnpm@9.15.9+sha512.68046141893c66fad01c079231128e9afb89ef87e2691d69e4d40eee228988295fd4682181bae55b58418c3a253bde65a505ec7c5f9403ece5cc3cd37dcf2531",
6-
"engines": {
7-
"node": "^20 || ^22",
8-
"pnpm": "9.15.9"
6+
"homepage": "https://github.com/ForgeRock/ping-javascript-sdk#readme",
7+
"bugs": {
8+
"url": "https://github.com/ForgeRock/ping-javascript-sdk/issues"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/ForgeRock/ping-javascript-sdk.git"
913
},
14+
"author": "ForgeRock",
1015
"scripts": {
1116
"build": "nx affected --target=build",
12-
"clean": "shx rm -rf ./{coverage,dist,docs,node_modules,tmp}/ ./{packages,e2e}/*/{dist,node_modules}/ && git clean -fX -e \"!.env*,nx-cloud.env\"",
17+
"changeset": "changeset",
1318
"ci:release": "pnpm publish -r --no-git-checks && changeset tag",
1419
"ci:version": "changeset version && pnpm install --no-frozen-lockfile && pnpm format",
15-
"changeset": "changeset",
20+
"circular-dep-check": "madge --circular .",
21+
"clean": "shx rm -rf ./{coverage,dist,docs,node_modules,tmp}/ ./{packages,e2e}/*/{dist,node_modules}/ && git clean -fX -e \"!.env*,nx-cloud.env\"",
1622
"commit": "git cz",
23+
"commitlint": "commitlint --edit",
1724
"create-package": "nx g @nx/js:library",
1825
"docs": "nx affected --target=typedoc",
1926
"format": "pnpm nx format:write",
2027
"lint": "nx affected --target=lint",
28+
"local-release": "pnpm ts-node tools/release/release.ts",
2129
"nx": "nx",
2230
"preinstall": "npx only-allow pnpm",
2331
"prepare": "node .husky/install.mjs",
2432
"serve": "nx serve",
2533
"test": "CI=true nx affected:test",
2634
"test:e2e": "CI=true nx affected:e2e",
27-
"watch": "nx watch-deps",
2835
"verdaccio": "nx local-registry",
29-
"commitlint": "commitlint --edit"
36+
"watch": "nx watch-deps"
3037
},
3138
"lint-staged": {
3239
"*": [
@@ -36,22 +43,19 @@
3643
"git add"
3744
]
3845
},
39-
"repository": {
40-
"type": "git",
41-
"url": "https://github.com/ForgeRock/ping-javascript-sdk.git"
42-
},
43-
"author": "ForgeRock",
44-
"bugs": {
45-
"url": "https://github.com/ForgeRock/ping-javascript-sdk/issues"
46+
"config": {
47+
"commitizen": {
48+
"path": "./node_modules/cz-conventional-changelog"
49+
}
4650
},
47-
"homepage": "https://github.com/ForgeRock/ping-javascript-sdk#readme",
4851
"devDependencies": {
4952
"@changesets/changelog-github": "^0.5.0",
5053
"@changesets/cli": "^2.27.9",
5154
"@codecov/vite-plugin": "1.9.0",
5255
"@commitlint/cli": "^19.1.0",
5356
"@commitlint/config-conventional": "^19.1.0",
5457
"@commitlint/prompt": "^19.1.0",
58+
"@effect/cli": "0.59.10",
5559
"@effect/language-service": "^0.2.0",
5660
"@effect/platform": "^0.58.27",
5761
"@effect/platform-node": "^0.53.26",
@@ -80,11 +84,12 @@
8084
"@types/node": "22.14.1",
8185
"@typescript-eslint/typescript-estree": "8.23.0",
8286
"@typescript-eslint/utils": "^8.13.0",
83-
"@vitest/coverage-v8": "3.0.4",
87+
"@vitest/coverage-v8": "^3.0.5",
8488
"@vitest/ui": "3.0.4",
8589
"conventional-changelog-conventionalcommits": "^8.0.0",
8690
"cz-conventional-changelog": "^3.3.0",
8791
"cz-git": "^1.6.1",
92+
"effect": "^3.12.7",
8893
"eslint": "^9.8.0",
8994
"eslint-config-prettier": "10.1.2",
9095
"eslint-plugin-import": "2.31.0",
@@ -97,6 +102,7 @@
97102
"jsdom": "26.1.0",
98103
"jsonc-eslint-parser": "^2.1.0",
99104
"lint-staged": "^15.0.0",
105+
"madge": "8.0.0",
100106
"npm-cli-login": "^1.0.0",
101107
"nx": "20.5.0",
102108
"playwright": "^1.47.2",
@@ -119,10 +125,10 @@
119125
"vitest": "3.0.5",
120126
"vitest-canvas-mock": "^0.3.3"
121127
},
122-
"config": {
123-
"commitizen": {
124-
"path": "./node_modules/cz-conventional-changelog"
125-
}
128+
"packageManager": "pnpm@9.15.9+sha512.68046141893c66fad01c079231128e9afb89ef87e2691d69e4d40eee228988295fd4682181bae55b58418c3a253bde65a505ec7c5f9403ece5cc3cd37dcf2531",
129+
"engines": {
130+
"node": "^20 || ^22",
131+
"pnpm": "9.15.9"
126132
},
127133
"nx": {
128134
"includedScripts": []

packages/davinci-client/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"test:watch": "pnpm nx nxTest --watch"
2323
},
2424
"dependencies": {
25-
"@forgerock/javascript-sdk": "4.7.0",
25+
"@forgerock/sdk-oidc": "workspace:*",
26+
"@forgerock/sdk-request-middleware": "workspace:*",
27+
"@forgerock/sdk-types": "workspace:*",
2628
"@reduxjs/toolkit": "catalog:",
2729
"immer": "catalog:"
2830
},

0 commit comments

Comments
 (0)