Skip to content

Commit

Permalink
Merge pull request #20 from supabase/chore/client-info
Browse files Browse the repository at this point in the history
chore: adds X-Client-Info header
  • Loading branch information
inian committed Aug 24, 2021
2 parents 679a154 + 6f2b18e commit f650e1a
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"plugins": [
[
"semantic-release-plugin-update-version-in-files",
{
"files": [
"src/lib/version.ts",
"dist/main/lib/version.js",
"dist/main/lib/version.d.ts",
"dist/module/lib/version.js",
"dist/module/lib/version.d.ts"
],
"placeholder": "0.0.0"
}
],
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
"@semantic-release/npm"
]
}
113 changes: 113 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@supabase/storage-js",
"version": "1.0.0",
"version": "0.0.0",
"description": "Isomorphic storage client for Supabase.",
"keywords": [
"javascript",
Expand All @@ -23,7 +23,7 @@
"scripts": {
"clean": "rimraf dist docs",
"format": "prettier --write \"{src,test}/**/*.ts\"",
"build": "run-s clean format build:*",
"build": "genversion src/lib/version.ts --es6 && run-s clean format build:*",
"build:main": "tsc -p tsconfig.json",
"build:module": "tsc -p tsconfig.module.json",
"build:umd": "webpack",
Expand All @@ -40,12 +40,14 @@
},
"devDependencies": {
"@types/jest": "^26.0.13",
"genversion": "^3.0.1",
"husky": "^4.3.0",
"jest": "^26.4.1",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"pretty-quick": "^3.1.0",
"rimraf": "^3.0.2",
"semantic-release-plugin-update-version-in-files": "^1.1.0",
"ts-jest": "^26.3.0",
"ts-loader": "^8.0.11",
"typedoc": "^0.19.1",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/StorageBucketApi.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { get, post, put, remove } from './fetch'
import { Bucket } from './types'
import { DEFAULT_HEADERS } from './constants'

export class StorageBucketApi {
protected url: string
protected headers: { [key: string]: string }

constructor(url: string, headers: { [key: string]: string } = {}) {
this.url = url
this.headers = headers
this.headers = { ...DEFAULT_HEADERS, ...headers }
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { version } from './version'
export const DEFAULT_HEADERS = { 'X-Client-Info': `storage-js/${version}` }
1 change: 1 addition & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './StorageBucketApi'
export * from './StorageFileApi'
export * from './types'
export * from './constants'
2 changes: 2 additions & 0 deletions src/lib/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// generated by genversion
export const version = '0.0.0'

0 comments on commit f650e1a

Please sign in to comment.