Skip to content

Commit ef874e0

Browse files
lukas-reiningchenhunghanluizgribeirotoddbaert
authored
feat: implement draft for a Nest.js SDK (#718)
<!-- Please use this template for your pull request. --> <!-- Please use the sections that you need and delete other sections --> ## This PR <!-- add the description of the PR here --> This is a first draft of a Nest.js SDK. Currently it only handles injecting clients and feature flags. I also added a context factory for the FeatureFlag decorators to be able to use request information for the execution context. ### Related Issues <!-- add here the GitHub issue that this PR resolves if applicable --> Fixes #705 ### Notes <!-- any additional notes for this PR --> @toddbaert maybe we can do it as we did with the React SDK, merge this fast and release as experimental to let people experiment and try out? ### Follow-up Tasks <!-- anything that is related to this PR but not done here should be noted under this section --> <!-- if there is a need for a new issue, please link it here --> We will have to see if we want to stick with the injected feature flags being wrapped in an observable. To me this feels the most idiomatic for Nest.js. ### How to test Tests for the current functionality are included. --------- Signed-off-by: Lukas Reining <[email protected]> Co-authored-by: Henry Chen <[email protected]> Co-authored-by: Luiz Guilherme Ribeiro <[email protected]> Co-authored-by: Todd Baert <[email protected]>
1 parent c7098c3 commit ef874e0

16 files changed

+2139
-11
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"packages/nest": "0.0.1-experimental",
23
"packages/react": "0.0.5-experimental",
34
"packages/client": "0.4.8",
45
"packages/server": "1.7.5",

jest.config.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default {
120120
preset: 'ts-jest',
121121
testMatch: ['<rootDir>/packages/server/test/**/*.spec.ts'],
122122
moduleNameMapper: {
123-
'@openfeature/core': '<rootDir>/packages/shared/src'
123+
'@openfeature/core': '<rootDir>/packages/shared/src',
124124
},
125125
},
126126
{
@@ -129,8 +129,8 @@ export default {
129129
preset: 'ts-jest',
130130
testMatch: ['<rootDir>/packages/client/test/**/*.spec.ts'],
131131
moduleNameMapper: {
132-
'@openfeature/core': '<rootDir>/packages/shared/src'
133-
}
132+
'@openfeature/core': '<rootDir>/packages/shared/src',
133+
},
134134
},
135135
{
136136
displayName: 'server-e2e',
@@ -140,7 +140,7 @@ export default {
140140
modulePathIgnorePatterns: ['.*/node-modules/'],
141141
setupFiles: ['<rootDir>/packages/server/e2e/step-definitions/setup.ts'],
142142
moduleNameMapper: {
143-
'@openfeature/core': '<rootDir>/packages/shared/src'
143+
'@openfeature/core': '<rootDir>/packages/shared/src',
144144
},
145145
},
146146
{
@@ -153,7 +153,24 @@ export default {
153153
moduleNameMapper: {
154154
'^uuid$': require.resolve('uuid'),
155155
'^(.*)\\.js$': ['$1', '$1.js'],
156-
'@openfeature/core': '<rootDir>/packages/shared/src'
156+
'@openfeature/core': '<rootDir>/packages/shared/src',
157+
},
158+
},
159+
{
160+
displayName: 'nest',
161+
testEnvironment: 'node',
162+
preset: 'ts-jest',
163+
testMatch: ['<rootDir>/packages/nest/test/**/*.spec.ts'],
164+
moduleNameMapper: {
165+
'@openfeature/core': '<rootDir>/packages/shared/src',
166+
},
167+
transform: {
168+
'^.+\\.ts$': [
169+
'ts-jest',
170+
{
171+
tsconfig: '<rootDir>/packages/nest/tsconfig.spec.json',
172+
},
173+
],
157174
},
158175
},
159176
],

0 commit comments

Comments
 (0)