Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ jobs:
outputs:
full_tag: ${{ steps.set_version_tag.outputs.TAG }}
version_tag: ${{ steps.set_version_tag.outputs.VERSION }}
semver: ${{ steps.set_version_tag.outputs.SEMVER }}
service_name: ${{ steps.set_version_tag.outputs.SERVICE }}
service_matrix: ${{ steps.set_version_tag.outputs.SERVICE_MATRIX }}
valid_semver: ${{ steps.set_version_tag.outputs.valid }}
test_run: ${{ steps.set_version_tag.outputs.test_run }}
npm_tag: ${{ steps.set_version_tag.outputs.npm_tag }}
steps:
- name: Extract and Validate Version Tag
id: set_version_tag
run: |
valid=false
test_run=false
npm_tag=latest
ENTIRE_TAG_RE="^(([[:alpha:]\-]+)-)?(.*)$"
VERSION_TAG_RE="^v[\.]?([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+(-[[:alpha:][:digit:]\.]+)*)$"
TAG="${FULL_TAG}"
Expand All @@ -49,6 +52,10 @@ jobs:
if [[ ${version} = "0.0.1" ]] ; then
test_run=true
fi

if [[ -n "${BASH_REMATCH[2]}" ]] ; then
npm_tag=next
fi

if [[ -z "${SERVICE}" ]] ; then
SERVICE_MATRIX="${ALL_SERVICES}"
Expand All @@ -58,10 +65,12 @@ jobs:

echo "TAG=${TAG}" >> $GITHUB_OUTPUT
echo "VERSION=${VERSION_TAG}" >> $GITHUB_OUTPUT
echo "SEMVER=${version}" >> $GITHUB_OUTPUT
echo "SERVICE=${SERVICE}" >> $GITHUB_OUTPUT
echo "SERVICE_MATRIX=${SERVICE_MATRIX}" >> $GITHUB_OUTPUT
echo "valid=${valid}" >> $GITHUB_OUTPUT
echo "test_run=${test_run}" >> $GITHUB_OUTPUT
echo "npm_tag=${npm_tag}" >> $GITHUB_OUTPUT
fi
fi
if [[ "${valid}" = false ]]
Expand Down Expand Up @@ -129,3 +138,25 @@ jobs:
password: ${{secrets.DOCKERHUB_TOKEN}}
repository: ${{env.DOCKER_HUB_PROFILE}}/${{matrix.service}}-service
readme-filepath: Docker/${{matrix.service}}-service.overview.md

build-and-publish-client-js-package:
name: Build and Publish 'frequency-gateway-apis' Package
needs: set_variables
runs-on: ubuntu-latest
if: needs.set_variables.outputs.valid_semver == 'true'
steps:

- name: Build Client API JS Package
id: build-client-api
run: npm run openapi-specs

- name: Version Package
id: version-package
working-directory: openapi-specs
run: npm version ${{ needs.set_variables.outputs.semver }} --no-git-tag-version

- name: Publish Package
id: publish-openapi-specs-rc
if: needs.set_variables.outputs.test_run != 'true'
working-directory: openapi-specs
run: npm publish --tag ${{ needs.set_variables.outputs.npm_tag }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,8 @@ CLAUDE.local.md
.clinic

.DS_Store

# Generated files for API package
openapi-specs/src/index.ts
openapi-specs/src/modules
openapi-specs/dist
484 changes: 242 additions & 242 deletions docs/account-worker/index.html

Large diffs are not rendered by default.

952 changes: 474 additions & 478 deletions docs/account/index.html

Large diffs are not rendered by default.

694 changes: 347 additions & 347 deletions docs/account/webhooks.html

Large diffs are not rendered by default.

484 changes: 242 additions & 242 deletions docs/content-publishing-worker/index.html

Large diffs are not rendered by default.

838 changes: 419 additions & 419 deletions docs/content-publishing/index.html

Large diffs are not rendered by default.

770 changes: 385 additions & 385 deletions docs/content-watcher/index.html

Large diffs are not rendered by default.

664 changes: 332 additions & 332 deletions docs/content-watcher/webhooks.html

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion libs/health-check/src/health-check.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ export class HealthCheckService {
// If not found in Redis, query the blockchain directly
try {
const latestHeader = await this.blockchainService.getLatestHeader();
await this.redis.setex('latestHeader', this.blockchainService.blockTimeMs / MILLISECONDS_PER_SECOND, JSON.stringify(latestHeader));
await this.redis.setex(
'latestHeader',
this.blockchainService.blockTimeMs / MILLISECONDS_PER_SECOND,
JSON.stringify(latestHeader),
);
return latestHeader;
} catch (err) {
this.logger.error('Failed to fetch latest block header from blockchain:', err);
Expand Down
2 changes: 2 additions & 0 deletions openapi-specs/account-webhooks.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ components:
- RETIRE_MSA
- ADD_PUBLIC_KEY_AGREEMENT
- REVOKE_DELEGATION
- ICS_PUBLISH
x-enum-varnames:
- CHANGE_HANDLE
- CREATE_HANDLE
Expand All @@ -49,6 +50,7 @@ components:
- RETIRE_MSA
- ADD_PUBLIC_KEY_AGREEMENT
- REVOKE_DELEGATION
- ICS_PUBLISH

TxWebhookRspBase:
type: object
Expand Down
101 changes: 22 additions & 79 deletions openapi-specs/account.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@
]
}
},
"/v2/delegations/{msaId}": {
"/v3/delegations/{msaId}": {
"get": {
"operationId": "DelegationsControllerV2_getDelegation_v2",
"operationId": "DelegationsControllerV3_getDelegation_v3",
"parameters": [
{
"name": "msaId",
Expand All @@ -254,21 +254,21 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DelegationResponseV2"
"$ref": "#/components/schemas/DelegationResponse"
}
}
}
}
},
"summary": "Get all delegation information associated with an MSA Id",
"tags": [
"v2/delegations"
"v3/delegations"
]
}
},
"/v2/delegations/{msaId}/{providerId}": {
"/v3/delegations/{msaId}/{providerId}": {
"get": {
"operationId": "DelegationsControllerV2_getProviderDelegation_v2",
"operationId": "DelegationsControllerV3_getProviderDelegation_v3",
"parameters": [
{
"name": "msaId",
Expand All @@ -291,39 +291,6 @@
}
}
],
"responses": {
"200": {
"description": "Found delegation information",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DelegationResponseV2"
}
}
}
}
},
"summary": "Get an MSA's delegation information for a specific provider",
"tags": [
"v2/delegations"
]
}
},
"/v1/delegation/{msaId}": {
"get": {
"operationId": "DelegationControllerV1_getDelegation_v1",
"parameters": [
{
"name": "msaId",
"required": true,
"in": "path",
"description": "Msa Id of requested account",
"schema": {
"example": "2",
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Found delegation information",
Expand All @@ -336,15 +303,15 @@
}
}
},
"summary": "Get the delegation information associated with an MSA Id",
"summary": "Get an MSA's delegation information for a specific provider",
"tags": [
"v1/delegation"
"v3/delegations"
]
}
},
"/v1/delegation/revokeDelegation/{accountId}/{providerId}": {
"/v3/delegations/revokeDelegation/{accountId}/{providerId}": {
"get": {
"operationId": "DelegationControllerV1_getRevokeDelegationPayload_v1",
"operationId": "DelegationsControllerV3_getRevokeDelegationPayload_v3",
"parameters": [
{
"name": "accountId",
Expand Down Expand Up @@ -381,13 +348,13 @@
},
"summary": "Get a properly encoded RevokeDelegationPayload that can be signed",
"tags": [
"v1/delegation"
"v3/delegations"
]
}
},
"/v1/delegation/revokeDelegation": {
"/v3/delegations/revokeDelegation": {
"post": {
"operationId": "DelegationControllerV1_postRevokeDelegation_v1",
"operationId": "DelegationsControllerV3_postRevokeDelegation_v3",
"parameters": [],
"requestBody": {
"required": true,
Expand All @@ -413,7 +380,7 @@
},
"summary": "Request to revoke a delegation",
"tags": [
"v1/delegation"
"v3/delegations"
]
}
},
Expand Down Expand Up @@ -1132,18 +1099,18 @@
"referenceId"
]
},
"SchemaDelegation": {
"IntentDelegation": {
"type": "object",
"properties": {
"schemaId": {
"intentId": {
"type": "number"
},
"revokedAtBlock": {
"type": "number"
}
},
"required": [
"schemaId"
"intentId"
]
},
"Delegation": {
Expand All @@ -1152,10 +1119,10 @@
"providerId": {
"type": "string"
},
"schemaDelegations": {
"delegatedIntents": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SchemaDelegation"
"$ref": "#/components/schemas/IntentDelegation"
}
},
"revokedAtBlock": {
Expand All @@ -1164,10 +1131,10 @@
},
"required": [
"providerId",
"schemaDelegations"
"delegatedIntents"
]
},
"DelegationResponseV2": {
"DelegationResponse": {
"type": "object",
"properties": {
"msaId": {
Expand All @@ -1185,29 +1152,6 @@
"delegations"
]
},
"u32": {
"type": "object",
"properties": {}
},
"DelegationResponse": {
"type": "object",
"properties": {
"providerId": {
"type": "string"
},
"schemaPermissions": {
"type": "object"
},
"revokedAt": {
"$ref": "#/components/schemas/u32"
}
},
"required": [
"providerId",
"schemaPermissions",
"revokedAt"
]
},
"RevokeDelegationPayloadResponseDto": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1610,8 +1554,7 @@
{
"name": "delegations",
"tags": [
"v1/delegation",
"v2/delegations"
"v3/delegations"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions openapi-specs/content-watcher.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@
"ChainWatchOptionsDto": {
"type": "object",
"properties": {
"schemaIds": {
"description": "Specific schema ids to watch for",
"intentIds": {
"description": "Specific Intent ids to watch for",
"example": [
1,
19
Expand Down
28 changes: 28 additions & 0 deletions openapi-specs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@projectlibertylabs/frequency-gateway-apis",
"version": "0.0.0",
"private": false,
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./*": {
"types": "./dist/modules/*.d.ts",
"import": "./dist/modules/*.js",
"require": "./dist/modules/*.cjs"
},
"./types": "./dist/types/index.d.ts",
"./types/*": "./dist/types/*.d.ts"
},
"files": ["dist"],
"sideEffects": false,
"dependencies": {
"openapi-types": "12.1.3"
}
}
15 changes: 15 additions & 0 deletions openapi-specs/src/runtime/find-package-root.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import path from "node:path";
import { existsSync } from "node:fs";

export function findPackageRoot(startDir: string): string {
let dir = startDir;
while (true) {
const candidate = path.join(dir, "package.json");
if (existsSync(candidate)) return dir;

const parent = path.dirname(dir);
if (parent === dir) break; // reached filesystem root
dir = parent;
}
throw new Error("Could not locate package.json to determine package root.");
}
13 changes: 13 additions & 0 deletions openapi-specs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"declaration": true,
"declarationMap": true,
"skipLibCheck": true,
"incremental": false,
},
"include": ["src"]
}
Loading
Loading