Skip to content

Commit cf00c77

Browse files
authored
Merge pull request #1558 from SciCatProject/master
Release 11-12-2024
2 parents faaf0ca + 097dba8 commit cf00c77

18 files changed

+1420
-673
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,5 @@ ES_PASSWORD="duo-password"
7878
ES_REFRESH=<"wait_for"|"false">
7979

8080
LOGGERS_CONFIG_FILE="loggers.json"
81+
DATASET_TYPES_FILE="datasetTypes.json"
8182
PROPOSAL_TYPES_FILE="proposalTypes.json"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"generatorName": "typescript-angular",
3-
"npmName": "@scicatproject/scicat-sdk-ts",
3+
"npmName": "@scicatproject/scicat-sdk-ts-angular",
44
"ngVersion": "16.2.12",
55
"withInterfaces": true
66
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"generatorName": "typescript-fetch",
3+
"npmName": "@scicatproject/scicat-sdk-ts-fetch",
4+
"supportsES6": true
5+
}

.github/workflows/release-and-publish-sdk.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,9 @@ jobs:
152152
--git-repo-id scicat-backend-next \
153153
--git-user-id SciCatProject \
154154
-o ./sdk/${{ matrix.generator }} $(
155-
if [ "${{ matrix.generator }}" == "typescript-angular" ]; then
155+
if [ "${{ matrix.generator }}" == "typescript-angular" ] || [ "${{ matrix.generator }}" == "typescript-fetch" ]; then
156156
echo "--additional-properties=npmVersion=${{ needs.build-release.outputs.new_tag}}";
157-
elif [ "${{ matrix.generator }}" == "python" ]; then
158-
echo "--additional-properties=packageVersion=${{ needs.build-release.outputs.new_tag}}";
159-
elif [ "${{ matrix.generator }}" == "python-pydantic-v1" ]; then
157+
elif [ "${{ matrix.generator }}" == "python" ] || [ "${{ matrix.generator }}" == "python-pydantic-v1" ]; then
160158
echo "--additional-properties=packageVersion=${{ needs.build-release.outputs.new_tag}}";
161159
fi
162160
)
@@ -169,9 +167,12 @@ jobs:
169167
npm-publish:
170168
needs: generate-upload-sdk
171169
runs-on: ubuntu-latest
170+
strategy:
171+
matrix:
172+
sdk_type: [typescript-angular, typescript-fetch]
172173
environment:
173-
name: npm-sdk-package
174-
url: https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts
174+
name: ${{ matrix.sdk_type }}-sdk-package
175+
url: ${{ matrix.sdk_type == 'typescript-angular' && 'https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts-angular' || 'https://www.npmjs.com/package/@scicatproject/scicat-sdk-ts-fetch' }}
175176

176177
steps:
177178
- name: Checkout repository
@@ -183,19 +184,22 @@ jobs:
183184
node-version: ${{ env.NODE_VERSION }}
184185
registry-url: "https://registry.npmjs.org/"
185186

186-
- name: Download TypeScript Angular SDK Artifact
187+
- name: Download TypeScript SDK Artifact
187188
uses: actions/download-artifact@v4
188189
with:
189-
name: sdk-typescript-angular-${{github.sha}}
190+
name: sdk-${{ matrix.sdk_type }}-${{ github.sha }}
190191
path: ./sdk
191192

192193
- name: Publish package
193194
run: |
194195
npm install
195196
npm run build
196-
cd dist
197+
if [ "${{ matrix.sdk_type }}" == "typescript-angular" ]; then
198+
# publish dist folder for typescript-angular
199+
cd dist
200+
fi
197201
npm publish --access public
198-
working-directory: ./sdk/typescript-angular/
202+
working-directory: ./sdk/${{ matrix.sdk_type }}/
199203
env:
200204
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
201205

@@ -223,7 +227,7 @@ jobs:
223227
- name: Download Python SDK Artifact
224228
uses: actions/download-artifact@v4
225229
with:
226-
name: sdk-${{ matrix.sdk_type }}-${{github.sha}}
230+
name: sdk-${{ matrix.sdk_type }}-${{ github.sha }}
227231
path: ./sdk
228232

229233
- name: Install dependencies

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ jobs:
173173
run: |
174174
cp CI/ESS/docker-compose.api.yaml docker-compose.yaml
175175
cp functionalAccounts.json.test functionalAccounts.json
176+
cp datasetTypes.example.json datasetTypes.json
176177
cp proposalTypes.example.json proposalTypes.json
177178
docker compose up --build -d
178179
npm run test:api

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/dist
33
/node_modules
44
functionalAccounts.json
5+
datasetTypes.json
56
proposalTypes.json
67
loggers.json
78

datasetTypes.example.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"Custom": "custom"
3+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
async up(db, client) {
3+
await db.collection("Dataset").updateMany({}, [
4+
{
5+
$set: {
6+
principalInvestigators: ["$principalInvestigator"],
7+
},
8+
},
9+
]);
10+
11+
await db
12+
.collection("Dataset")
13+
.updateMany({}, { $unset: { principalInvestigator: "" } });
14+
},
15+
16+
async down(db, client) {
17+
await db.collection("Dataset").updateMany({}, [
18+
{
19+
$set: {
20+
principalInvestigator: {
21+
$arrayElemAt: ["$principalInvestigators", 0],
22+
},
23+
},
24+
},
25+
]);
26+
27+
await db
28+
.collection("Dataset")
29+
.updateMany({}, { $unset: { principalInvestigators: "" } });
30+
},
31+
};

0 commit comments

Comments
 (0)