@builder-builder/builder 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,16 @@ import * as v from 'valibot';
2
2
  import { BuilderException } from '../errors/index.js';
3
3
  import { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema } from './schema.js';
4
4
  export function client(options) {
5
- const { url, apiKey } = v.parse(BuilderBuilderClientOptionsSchema, options);
5
+ const { url, apiKey, headers } = v.parse(BuilderBuilderClientOptionsSchema, options);
6
6
  return {
7
7
  builder: {
8
8
  get: async (id) => {
9
9
  const requestUrl = `${url}/api/builder/${id}`;
10
10
  const response = await fetch(requestUrl, {
11
- headers: { 'X-Builder-Builder-Key': apiKey }
11
+ headers: {
12
+ ...headers,
13
+ 'X-Builder-Builder-Key': apiKey
14
+ }
12
15
  });
13
16
  if (!response.ok) {
14
17
  throw new BuilderException({
@@ -2,6 +2,7 @@ import * as v from 'valibot';
2
2
  export declare const BuilderBuilderClientOptionsSchema: v.ObjectSchema<{
3
3
  readonly url: v.StringSchema<undefined>;
4
4
  readonly apiKey: v.StringSchema<undefined>;
5
+ readonly headers: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.StringSchema<undefined>, undefined>, undefined>;
5
6
  }, undefined>;
6
7
  export type BuilderBuilderClientOptions = v.InferOutput<typeof BuilderBuilderClientOptionsSchema>;
7
8
  export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
@@ -3,7 +3,8 @@ import { BuilderReferencesSchema, BuilderSerialisedSchema } from '../entities/in
3
3
  import { BuilderVariantsSchema } from '../instance.js';
4
4
  export const BuilderBuilderClientOptionsSchema = v.object({
5
5
  url: v.string(),
6
- apiKey: v.string()
6
+ apiKey: v.string(),
7
+ headers: v.optional(v.record(v.string(), v.string()))
7
8
  });
8
9
  export const BuilderBuilderGetResponseSchema = v.object({
9
10
  name: v.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder-builder/builder",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=24"