@pocketprep/types 1.19.42 → 1.19.44
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/.github/scripts/pick-version.js +14 -0
- package/.github/workflows/npm-publish.yml +38 -1
- package/API/StudyStats.d.ts +21 -0
- package/API/index.d.ts +1 -0
- package/README.md +7 -0
- package/Study/Cloud.d.ts +29 -12
- package/package.json +4 -2
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Usage: node pick-version.js <version on npm> <version in package.json>
|
|
2
|
+
// Publishes the package.json version only when a PR raised its major or minor; otherwise bumps npm's patch.
|
|
3
|
+
const [ published, requested ] = process.argv.slice(2).map(version => version.split('.').map(Number))
|
|
4
|
+
|
|
5
|
+
const raisesMajor = requested[0] > published[0]
|
|
6
|
+
const raisesMinor = requested[0] === published[0] && requested[1] > published[1]
|
|
7
|
+
|
|
8
|
+
if (raisesMajor || raisesMinor) {
|
|
9
|
+
// respect the major/minor version bump that's already been committed
|
|
10
|
+
console.log(requested.join('.'))
|
|
11
|
+
} else {
|
|
12
|
+
// just bump the patch version
|
|
13
|
+
console.log([ published[0], published[1], published[2] + 1 ].join('.'))
|
|
14
|
+
}
|
|
@@ -7,18 +7,55 @@ on:
|
|
|
7
7
|
push:
|
|
8
8
|
branches:
|
|
9
9
|
- master
|
|
10
|
+
# Only changes that reach consumers should publish; README/CI-only merges would otherwise ship an identical patch
|
|
11
|
+
paths:
|
|
12
|
+
- '**.ts'
|
|
13
|
+
- index.js
|
|
14
|
+
- package.json
|
|
15
|
+
workflow_dispatch:
|
|
16
|
+
|
|
17
|
+
# Back-to-back merges must take turns, or both runs would pick the same patch version
|
|
18
|
+
concurrency:
|
|
19
|
+
group: npm-publish
|
|
20
|
+
cancel-in-progress: false
|
|
10
21
|
|
|
11
22
|
jobs:
|
|
12
23
|
build-and-publish:
|
|
13
24
|
runs-on: ubuntu-latest
|
|
25
|
+
permissions:
|
|
26
|
+
contents: write
|
|
14
27
|
steps:
|
|
28
|
+
# Check out the tip of master rather than the triggering commit, so a queued run
|
|
29
|
+
# sees the version commit pushed by the run before it
|
|
15
30
|
- uses: actions/checkout@v2
|
|
31
|
+
with:
|
|
32
|
+
ref: master
|
|
16
33
|
- uses: actions/setup-node@v2
|
|
17
34
|
with:
|
|
18
35
|
node-version: 24.22.1
|
|
19
36
|
registry-url: https://registry.npmjs.org/
|
|
20
37
|
- run: npm ci
|
|
21
38
|
- run: npm run lint
|
|
39
|
+
- name: Pick version
|
|
40
|
+
id: version
|
|
41
|
+
run: |
|
|
42
|
+
published=$(npm view @pocketprep/types version)
|
|
43
|
+
requested=$(node -p "require('./package.json').version")
|
|
44
|
+
version=$(node .github/scripts/pick-version.js "$published" "$requested")
|
|
45
|
+
echo "npm has $published, package.json has $requested, publishing $version"
|
|
46
|
+
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
47
|
+
- name: Commit version
|
|
48
|
+
run: |
|
|
49
|
+
npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
|
|
50
|
+
if git diff --quiet -- package.json package-lock.json; then
|
|
51
|
+
exit 0
|
|
52
|
+
fi
|
|
53
|
+
git config user.name "github-actions[bot]"
|
|
54
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
55
|
+
git add package.json package-lock.json
|
|
56
|
+
git commit -m "v${{ steps.version.outputs.version }}"
|
|
57
|
+
git push origin master
|
|
58
|
+
# Publish after the push so a rejected push leaves nothing on npm, and a rerun starts clean
|
|
22
59
|
- run: npm publish
|
|
23
60
|
env:
|
|
24
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
61
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TMockExamStudyStats, TStudyStats } from '../Study/Cloud'
|
|
2
|
+
|
|
3
|
+
export interface FetchStudyStatsParams {
|
|
4
|
+
examMetadataId: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The caller's study stats for one exam version. The same shape the Parse server returns under
|
|
9
|
+
* `studyStats` from `fetchUserData-v2` and `recordQuiz-v2`, so a client renders either source
|
|
10
|
+
* with one code path.
|
|
11
|
+
*/
|
|
12
|
+
export interface FetchStudyStatsResponse {
|
|
13
|
+
studyStats: {
|
|
14
|
+
standard: Omit<TStudyStats, 'examCommunityAverage'>
|
|
15
|
+
mockExam?: {
|
|
16
|
+
overall: TMockExamStudyStats
|
|
17
|
+
byMockExamId: { [mockExamId: string]: TMockExamStudyStats }
|
|
18
|
+
}
|
|
19
|
+
combined: Omit<TStudyStats, 'examCommunityAverage'>
|
|
20
|
+
}
|
|
21
|
+
}
|
package/API/index.d.ts
CHANGED
package/README.md
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
# Pocket Prep Types
|
|
2
2
|
One repo, under TypeScript, with reuse and strict typing for all.
|
|
3
|
+
|
|
4
|
+
## Versioning
|
|
5
|
+
Don't bump the version for routine changes. Merging to `master` publishes to npm with the next patch version and
|
|
6
|
+
commits that version back to `master`.
|
|
7
|
+
|
|
8
|
+
For a minor or major release, run `npm run minor` or `npm run major` in your PR. The publish workflow uses that
|
|
9
|
+
version as written.
|
package/Study/Cloud.d.ts
CHANGED
|
@@ -433,7 +433,7 @@ export type fetchSerialQuestionInfoLib = (params: { compositeKey: string }) => {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
export type fetchSerialQuestionInfoLibV2 = (params: {
|
|
436
|
+
export type fetchSerialQuestionInfoLibV2 = (params: {
|
|
437
437
|
compositeKey?: string
|
|
438
438
|
examMetadataId?: string
|
|
439
439
|
}) => {
|
|
@@ -543,7 +543,7 @@ export type resetUserExamProgress = (params: { appId: string }) => (
|
|
|
543
543
|
UserExamMetadata | TEUserAppMetadata | undefined
|
|
544
544
|
)
|
|
545
545
|
|
|
546
|
-
export type resetQuizProgress = (params: {
|
|
546
|
+
export type resetQuizProgress = (params: {
|
|
547
547
|
examGuid: string
|
|
548
548
|
examMetadataId?: string
|
|
549
549
|
}) => UserExamMetadata | undefined
|
|
@@ -691,14 +691,14 @@ export type fetchMockExams = () => MockExam[]
|
|
|
691
691
|
|
|
692
692
|
export type fetchMockExamQuestions = (params: { mockExamId: string }) => ExamData[]
|
|
693
693
|
|
|
694
|
-
export type fetchMockExamQuestionsV2 = (params: {
|
|
694
|
+
export type fetchMockExamQuestionsV2 = (params: {
|
|
695
695
|
mockExamId: string
|
|
696
696
|
includeMatrixQuestions?: boolean
|
|
697
697
|
includeMPMCQuestions?: boolean
|
|
698
698
|
includeBuildListQuestions?: boolean
|
|
699
699
|
}) => Question[]
|
|
700
700
|
|
|
701
|
-
export type fetchMockExamQuestionsV3 = (params: {
|
|
701
|
+
export type fetchMockExamQuestionsV3 = (params: {
|
|
702
702
|
mockExamId: string
|
|
703
703
|
includeMatrixQuestions?: boolean
|
|
704
704
|
includeMPMCQuestions?: boolean
|
|
@@ -792,7 +792,7 @@ export type fetchReferralInfo = (params: { bundleId: string }) => {
|
|
|
792
792
|
code: string
|
|
793
793
|
}
|
|
794
794
|
|
|
795
|
-
export type fetchPrebuiltQuizQuestions = (params: {
|
|
795
|
+
export type fetchPrebuiltQuizQuestions = (params: {
|
|
796
796
|
prebuiltQuizId: string
|
|
797
797
|
includeMPMCQuestions?: boolean
|
|
798
798
|
includeBuildListQuestions?: boolean
|
|
@@ -864,7 +864,7 @@ export type fetchUserExamMetadata = () => Promise<UserExamMetadataJSON[]>
|
|
|
864
864
|
|
|
865
865
|
export type deleteUserExamData = (params: { examGuid: string }) => Promise<void>
|
|
866
866
|
|
|
867
|
-
export type fetchRecallQuizQuestions = (params: {
|
|
867
|
+
export type fetchRecallQuizQuestions = (params: {
|
|
868
868
|
examMetadataId: string
|
|
869
869
|
includeMPMCQuestions?: boolean
|
|
870
870
|
includeBuildListQuestions?: boolean
|
|
@@ -878,19 +878,36 @@ export type upsertUserExamBackground = (params: {
|
|
|
878
878
|
hasTakenExam?: boolean
|
|
879
879
|
}) => UserExamBackgroundJSON
|
|
880
880
|
|
|
881
|
-
export type fetchConceptQuizQuestions = (params: {
|
|
881
|
+
export type fetchConceptQuizQuestions = (params: {
|
|
882
882
|
conceptQuizId: string
|
|
883
883
|
questionCount: number
|
|
884
884
|
}) => QuestionJSON[]
|
|
885
885
|
|
|
886
|
+
export type TSelectableConcept = {
|
|
887
|
+
conceptQuizId: string
|
|
888
|
+
concept: string
|
|
889
|
+
serials: string[]
|
|
890
|
+
}
|
|
891
|
+
|
|
886
892
|
export type fetchBYOConcepts = (params: {
|
|
887
893
|
examMetadataId: string
|
|
888
894
|
}) => {
|
|
889
|
-
concepts:
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
895
|
+
concepts: TSelectableConcept[]
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
export type TWeakestConcept = {
|
|
899
|
+
conceptQuizId: string
|
|
900
|
+
concept: string
|
|
901
|
+
totalAnswersCount: number
|
|
902
|
+
totalCorrectAnswersCount: number
|
|
903
|
+
averageScore: number
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
export type fetchWeakestConcepts = (params: {
|
|
907
|
+
examMetadataId: string
|
|
908
|
+
}) => {
|
|
909
|
+
examHasConcepts: boolean
|
|
910
|
+
weakestConcepts: TWeakestConcept[]
|
|
894
911
|
}
|
|
895
912
|
|
|
896
913
|
export type fetchReadinessReportDetails = (params: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pocketprep/types",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.44",
|
|
4
4
|
"description": "Pocket Prep type declarations",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"lint": "eslint '**/*.ts'",
|
|
20
20
|
"types-copy": "pwd | pbcopy",
|
|
21
|
-
"patch": "npm version patch --no-git-tag-version"
|
|
21
|
+
"patch": "npm version patch --no-git-tag-version",
|
|
22
|
+
"minor": "npm version minor --no-git-tag-version",
|
|
23
|
+
"major": "npm version major --no-git-tag-version"
|
|
22
24
|
},
|
|
23
25
|
"homepage": "https://github.com/Pocket-Prep/types#readme",
|
|
24
26
|
"dependencies": {
|