From 41ca649dc0debf4cefde33de95bfbeb06ec214d8 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Fri, 19 Sep 2025 10:53:02 -0700 Subject: [PATCH 1/2] Some little fixes --- api/routes/profile.ts | 1 + api/stately/bulk-queries.ts | 2 +- api/stately/loadouts-queries.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/api/routes/profile.ts b/api/routes/profile.ts index da791fe5..718e0dc5 100644 --- a/api/routes/profile.ts +++ b/api/routes/profile.ts @@ -298,6 +298,7 @@ async function statelyProfile( extra: { syncToken: response.syncToken }, }); } + metrics.increment(response.sync ? `profile.response.sync` : `profile.response.full`, 1); return response; } diff --git a/api/stately/bulk-queries.ts b/api/stately/bulk-queries.ts index e161bb17..2858a099 100644 --- a/api/stately/bulk-queries.ts +++ b/api/stately/bulk-queries.ts @@ -190,7 +190,7 @@ async function exportDataForProfile(platformMembershipId: string): Promise { const prefix = keyPath`/p-${BigInt(platformMembershipId)}/d-${destinyVersion}` + suffix; diff --git a/api/stately/loadouts-queries.ts b/api/stately/loadouts-queries.ts index 9d0fbef1..0a1daab0 100644 --- a/api/stately/loadouts-queries.ts +++ b/api/stately/loadouts-queries.ts @@ -314,8 +314,8 @@ export function statConstraintsToStately(statConstraints: StatConstraint[] | und statHash: c.statHash, minTier: Math.max(0, Math.floor(c.minTier ?? 0)), maxTier: Math.min(Math.ceil(c.maxTier ?? 10), 10), - minStat: Math.max(0, Math.floor(c.minStat ?? 0)), - maxStat: Math.min(Math.ceil(c.maxStat ?? 200), 200), + minStat: Math.max(0, Math.min(Math.floor(c.minStat ?? 0), 200)), + maxStat: Math.max(0, Math.min(Math.ceil(c.maxStat ?? 200), 200)), })) : []; } From 6f48533aecdc2aecdd2b59455b18db684afc3d79 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Fri, 19 Sep 2025 10:59:50 -0700 Subject: [PATCH 2/2] Set up NPM trusted publish, remove CJS export --- .github/workflows/publish.yml | 8 +++++--- api/stately/generated/README.md | 25 +++++++++++++++++++++++++ dim-api-types/LICENSE.md | 21 +++++++++++++++++++++ dim-api-types/README.md | 3 +++ dim-api-types/package.json | 13 ++++++++++--- rollup.config.js | 4 ---- 6 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 api/stately/generated/README.md create mode 100644 dim-api-types/LICENSE.md create mode 100644 dim-api-types/README.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1ac5c273..b7926e43 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,10 @@ on: jobs: build: runs-on: ubuntu-latest + environment: publish + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 with: @@ -43,6 +47,4 @@ jobs: - name: Publish the package to NPM if: steps.check.outputs.changed == 'true' - run: cd dim-api-types && npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # NPM will automatically authenticate with this + run: cd dim-api-types && npm publish --access public --provenance diff --git a/api/stately/generated/README.md b/api/stately/generated/README.md new file mode 100644 index 00000000..1f6e9784 --- /dev/null +++ b/api/stately/generated/README.md @@ -0,0 +1,25 @@ +# Schema Info + +This is an auto-generated README file to help you understand your schema! + +* SchemaID => `8030842688320564` +* Schema Version => `8` +* See schema on the [Stately Console](https://console.stately.cloud/1org/schemas/8030842688320564). + +### Key Path Layout + +| Group | Key Path | Item Type | primary | required | syncable | txn type | +|:------------------|:---------------------|:---------------|:--------|:---------|:---------|:---------| +| `/apps-*` | `/apps-*/app-*` | ApiApp | Yes | Yes | Yes | group | +| `/gs-*` | `/gs-*` | GlobalSettings | Yes | Yes | Yes | group | +| `/loadoutShare-*` | `/loadoutShare-*` | LoadoutShare | Yes | Yes | Yes | group | +| `/member-*` | `/member-*/settings` | Settings | Yes | Yes | Yes | group | +| `/p-*` | `/p-*/d-*/ia-*` | ItemAnnotation | Yes | Yes | Yes | group | +| `/p-*` | `/p-*/d-*/iht-*` | ItemHashTag | Yes | Yes | Yes | group | +| `/p-*` | `/p-*/d-*/loadout-*` | Loadout | Yes | Yes | Yes | group | +| `/p-*` | `/p-*/d-*/search-*` | Search | Yes | Yes | Yes | group | +| `/p-*` | `/p-*/d-*/triumph-*` | Triumph | Yes | Yes | Yes | group | + +### TODO: + +What else should we add here? Let us know! diff --git a/dim-api-types/LICENSE.md b/dim-api-types/LICENSE.md new file mode 100644 index 00000000..10494a5b --- /dev/null +++ b/dim-api-types/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Destiny Item Manager + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/dim-api-types/README.md b/dim-api-types/README.md new file mode 100644 index 00000000..03e149ba --- /dev/null +++ b/dim-api-types/README.md @@ -0,0 +1,3 @@ +# DIM API Types + +This package contains TypeScript types plus some defaults and enums that are useful when using the DIM API. Every request and response type is included, along with sensible defaults for Settings and LoadoutParameters. diff --git a/dim-api-types/package.json b/dim-api-types/package.json index a2e5c4c0..60f18475 100644 --- a/dim-api-types/package.json +++ b/dim-api-types/package.json @@ -1,13 +1,20 @@ { "name": "@destinyitemmanager/dim-api-types", - "version": "1.38.0", + "version": "1.39.0", "description": "TypeScript types for the DIM API", - "main": "./index.cjs", "types": "./index.d.ts", "module": "./index.js", "type": "module", "sideEffects": false, "scripts": {}, + "files": [ + "index.cjs", + "index.d.ts", + "index.js", + "README.md", + "LICENSE.md", + "package.json" + ], "repository": { "type": "git", "url": "https://github.com/DestinyItemManager/dim-api.git" @@ -29,4 +36,4 @@ "typescript": "^4.1.3" }, "dependencies": {} -} +} \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index decc03f7..d05132e1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -24,10 +24,6 @@ export default { ], output: [ - { - file: 'dim-api-types/' + pkg.main, - format: 'cjs', - }, { file: 'dim-api-types/' + pkg.module, format: 'es',