diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml deleted file mode 100644 index 79f62b85..00000000 --- a/.github/workflows/create-releases.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Create releases -on: - schedule: - - cron: '0 5 * * *' # every day at 5am UTC - push: - branches: - - main - -jobs: - release: - name: release - if: github.ref == 'refs/heads/main' && github.repository == 'hyperspell/node-sdk' - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - uses: stainless-api/trigger-release-please@v1 - id: release - with: - repo: ${{ github.event.repository.full_name }} - stainless-api-key: ${{ secrets.STAINLESS_API_KEY }} - - - name: Set up Node - if: ${{ steps.release.outputs.releases_created }} - uses: actions/setup-node@v3 - with: - node-version: '18' - - - name: Install dependencies - if: ${{ steps.release.outputs.releases_created }} - run: | - yarn install - - - name: Publish to NPM - if: ${{ steps.release.outputs.releases_created }} - run: | - bash ./bin/publish-npm - env: - NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }} - diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index f7cfc1b6..00dc207b 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,9 +1,13 @@ -# workflow for re-running publishing to NPM in case it fails for some reason -# you can run this workflow by navigating to https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to NPM in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/hyperspell/node-sdk/actions/workflows/publish-npm.yml name: Publish NPM on: workflow_dispatch: + release: + types: [published] + jobs: publish: name: publish diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 01aed405..293a7b16 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -18,6 +18,5 @@ jobs: run: | bash ./bin/check-release-environment env: - STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} NPM_TOKEN: ${{ secrets.HYPERSPELL_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/api.md b/api.md index 0f6cb222..e1bfb809 100644 --- a/api.md +++ b/api.md @@ -1,3 +1,11 @@ +# Shared + +Types: + +- Apikey +- App +- Collection + # Documents Types: diff --git a/bin/check-release-environment b/bin/check-release-environment index 28c07aa0..9ee7bb7d 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ errors=() -if [ -z "${STAINLESS_API_KEY}" ]; then - errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.") -fi - if [ -z "${NPM_TOKEN}" ]; then errors+=("The HYPERSPELL_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") fi diff --git a/src/index.ts b/src/index.ts index 65d13647..eac9925b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,6 @@ import * as Uploads from './uploads'; import * as API from './resources/index'; import { Auth, AuthUserTokenParams, Token } from './resources/auth'; import { - Collection, CollectionCreateParams, CollectionListParams, CollectionListResponse, @@ -235,6 +234,10 @@ export declare namespace Hyperspell { }; export { Auth as Auth, type Token as Token, type AuthUserTokenParams as AuthUserTokenParams }; + + export type Apikey = API.Apikey; + export type App = API.App; + export type Collection = API.Collection; } export { toFile, fileFromPath } from './uploads'; diff --git a/src/resources/index.ts b/src/resources/index.ts index d6b05f12..b3e58dd1 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,5 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export * from './shared'; export { Auth, type Token, type AuthUserTokenParams } from './auth'; export { CollectionListResponsesCursorPage, diff --git a/src/resources/shared.ts b/src/resources/shared.ts new file mode 100644 index 00000000..aa6598df --- /dev/null +++ b/src/resources/shared.ts @@ -0,0 +1,177 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as DocumentsAPI from './documents'; + +/** + * ApiKeys Base Schema. + */ +export interface Apikey { + app_id: number; + + scopes: Array<'all' | 'ingest' | 'query'>; + + secret: string; + + id?: number | null; + + /** + * Apps Base Schema. + */ + app?: App | null; + + created_at?: string; + + label?: string | null; + + revoked_at?: string | null; +} + +/** + * Apps Base Schema. + */ +export interface App { + name: string; + + slug: string; + + user_id: string; + + id?: number | null; + + api_keys?: Array | null; + + collections?: Array | null; + + created_at?: string; + + integrations?: Array; + + jwt_secret?: string; + + optional_integrations?: Array | null; + + public_key?: string; + + settings?: unknown; +} + +export interface Collection { + app_id: number; + + name: string; + + id?: number | null; + + /** + * Apps Base Schema. + */ + app?: App | null; + + created_at?: string; + + documents?: Array | null; + + documents_count?: number | null; + + owner?: string | null; +} + +export namespace Collection { + export interface Document { + collection_id: number; + + /** + * Structured representation of the document + */ + data: unknown | Array; + + /** + * Summary of the document + */ + summary: string; + + id?: number | null; + + collection?: string; + + created_at?: string | null; + + events?: Array; + + ingested_at?: string | null; + + metadata?: Record; + + /** + * Along with service, uniquely identifies the source document + */ + resource_id?: string; + + sections?: Array; + + sections_count?: number | null; + + source?: 'generic' | 'slack' | 's3' | 'gmail' | 'notion' | 'google_docs' | 'hubspot'; + + status?: 'pending' | 'processing' | 'completed' | 'failed'; + + title?: string | null; + + type?: + | 'generic' + | 'markdown' + | 'chat' + | 'email' + | 'transcript' + | 'legal' + | 'website' + | 'image' + | 'pdf' + | 'audio' + | 'spreadsheet' + | 'archive' + | 'book' + | 'video' + | 'code' + | 'calendar' + | 'json' + | 'presentation' + | 'unsupported' + | 'person' + | 'company' + | 'crm_contact'; + } + + export namespace Document { + export interface Event { + message: string; + + type: 'error' | 'warning' | 'info'; + + time?: string; + } + + export interface Section { + document_id: number; + + /** + * Summary of the section + */ + text: string; + + id?: number | null; + + content?: string | null; + + elements?: Array; + + embedding_e5_large?: Array | null; + + embedding_ts?: string | null; + + metadata?: Record; + + scores?: DocumentsAPI.Scores; + } + } +}