@builder-builder/builder 0.0.20 → 0.0.22

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.
Files changed (125) hide show
  1. package/README.md +33 -24
  2. package/dist/bb.d.ts +10 -11
  3. package/dist/bb.js +25 -2
  4. package/dist/client/client.d.ts +7 -0
  5. package/dist/client/client.js +19 -0
  6. package/dist/client/index.d.ts +4 -0
  7. package/dist/client/index.js +2 -0
  8. package/dist/client/schema.d.ts +396 -0
  9. package/dist/client/schema.js +13 -0
  10. package/dist/entities/builder/bind.d.ts +1 -1
  11. package/dist/entities/builder/builder.js +1 -1
  12. package/dist/entities/collection/collection.d.ts +689 -1
  13. package/dist/entities/collection/collection.js +5 -2
  14. package/dist/entities/collection/config.d.ts +189 -0
  15. package/dist/entities/collection/config.js +12 -2
  16. package/dist/entities/collection/expectation.d.ts +1 -1
  17. package/dist/entities/collection/index.d.ts +2 -2
  18. package/dist/entities/collection/index.js +2 -2
  19. package/dist/entities/collection/when.d.ts +1 -1
  20. package/dist/entities/component/component.d.ts +61 -7
  21. package/dist/entities/component/component.js +5 -2
  22. package/dist/entities/component/config.d.ts +10 -0
  23. package/dist/entities/component/config.js +19 -2
  24. package/dist/entities/component/field.js +1 -1
  25. package/dist/entities/component/index.d.ts +2 -2
  26. package/dist/entities/component/index.js +2 -2
  27. package/dist/entities/component/when.d.ts +1 -1
  28. package/dist/entities/expectation.d.ts +4 -0
  29. package/dist/entities/expectation.js +3 -1
  30. package/dist/entities/index.d.ts +15 -13
  31. package/dist/entities/index.js +11 -10
  32. package/dist/entities/kind.d.ts +10 -7
  33. package/dist/entities/kind.js +39 -5
  34. package/dist/entities/model/bind.d.ts +1 -1
  35. package/dist/entities/model/methods.d.ts +4 -4
  36. package/dist/entities/model/model.js +1 -1
  37. package/dist/entities/option/index.d.ts +3 -3
  38. package/dist/entities/option/index.js +3 -3
  39. package/dist/entities/option/option.d.ts +85 -7
  40. package/dist/entities/option/option.js +5 -2
  41. package/dist/entities/option/select.d.ts +10 -0
  42. package/dist/entities/option/select.js +12 -1
  43. package/dist/entities/option/toggle.d.ts +7 -0
  44. package/dist/entities/option/toggle.js +12 -1
  45. package/dist/entities/option/when.d.ts +1 -1
  46. package/dist/{paths.d.ts → entities/paths.d.ts} +2 -0
  47. package/dist/{paths.js → entities/paths.js} +3 -0
  48. package/dist/entities/pricing/index.d.ts +1 -1
  49. package/dist/entities/pricing/index.js +1 -1
  50. package/dist/entities/pricing/pricing.js +1 -1
  51. package/dist/entities/pricing/rates.d.ts +5 -0
  52. package/dist/entities/pricing/rates.js +3 -1
  53. package/dist/entities/references.d.ts +723 -6
  54. package/dist/entities/references.js +7 -1
  55. package/dist/entities/serialise.d.ts +48 -42
  56. package/dist/entities/serialise.js +9 -3
  57. package/dist/entities/ui/describe.d.ts +15 -0
  58. package/dist/entities/ui/describe.js +11 -2
  59. package/dist/entities/ui/index.d.ts +4 -4
  60. package/dist/entities/ui/index.js +4 -4
  61. package/dist/entities/ui/input.d.ts +11 -1
  62. package/dist/entities/ui/input.js +4 -2
  63. package/dist/entities/ui/page.d.ts +15 -0
  64. package/dist/entities/ui/page.js +11 -2
  65. package/dist/entities/ui/pages.d.ts +132 -0
  66. package/dist/entities/ui/pages.js +12 -2
  67. package/dist/entities/ui/ui.d.ts +1 -1
  68. package/dist/entities/ui/ui.js +2 -2
  69. package/dist/entities/ui/uis.js +1 -1
  70. package/dist/entities/validated.d.ts +26 -18
  71. package/dist/entities/when.d.ts +4 -3
  72. package/dist/entities/when.js +22 -2
  73. package/dist/environment.d.ts +2 -2
  74. package/dist/{validate → errors}/errors.d.ts +57 -35
  75. package/dist/{validate → errors}/errors.js +40 -5
  76. package/dist/errors/exception.d.ts +5 -0
  77. package/dist/{exception.js → errors/exception.js} +0 -3
  78. package/dist/errors/index.d.ts +4 -0
  79. package/dist/errors/index.js +3 -0
  80. package/dist/index.d.ts +14 -14
  81. package/dist/index.js +3 -2
  82. package/dist/instance.d.ts +7 -7
  83. package/dist/instance.js +4 -4
  84. package/dist/mappers/instance.js +1 -1
  85. package/dist/mappers/order.d.ts +4 -4
  86. package/dist/mappers/order.js +1 -1
  87. package/dist/mappers/price.js +18 -18
  88. package/dist/mappers/render/render.js +1 -1
  89. package/dist/mappers/resolve.d.ts +1 -2
  90. package/dist/mappers/resolve.js +3 -20
  91. package/dist/mappers/variants/option-graph.d.ts +1 -2
  92. package/dist/mappers/variants/option-graph.js +2 -3
  93. package/dist/mappers/variants/variants.d.ts +2 -2
  94. package/dist/mappers/variants/variants.js +1 -1
  95. package/dist/private.d.ts +1 -2
  96. package/dist/private.js +1 -2
  97. package/dist/references.js +1 -1
  98. package/dist/validate/brand.js +1 -2
  99. package/dist/validate/builder.d.ts +2 -3
  100. package/dist/validate/builder.js +2 -3
  101. package/dist/validate/expectations.d.ts +1 -1
  102. package/dist/validate/index.d.ts +4 -2
  103. package/dist/validate/index.js +1 -0
  104. package/dist/validate/instance.d.ts +2 -3
  105. package/dist/validate/instance.js +1 -2
  106. package/dist/validate/model.d.ts +2 -3
  107. package/dist/validate/model.js +39 -44
  108. package/dist/validate/paths.d.ts +2 -3
  109. package/dist/validate/paths.js +1 -1
  110. package/dist/validate/pricing.d.ts +2 -3
  111. package/dist/validate/pricing.js +2 -3
  112. package/dist/validate/resolve.d.ts +1 -1
  113. package/dist/validate/resolve.js +1 -1
  114. package/dist/validate/ui.d.ts +2 -3
  115. package/dist/validate/ui.js +13 -4
  116. package/dist/validate/variants.d.ts +4 -5
  117. package/dist/validate/variants.js +4 -5
  118. package/package.json +17 -5
  119. package/dist/exception.d.ts +0 -13
  120. package/dist/validate/result.d.ts +0 -2
  121. package/dist/validate/result.js +0 -1
  122. /package/dist/{serialisable.d.ts → entities/serialisable.d.ts} +0 -0
  123. /package/dist/{serialisable.js → entities/serialisable.js} +0 -0
  124. /package/dist/{check.d.ts → errors/check.d.ts} +0 -0
  125. /package/dist/{check.js → errors/check.js} +0 -0
package/README.md CHANGED
@@ -1,38 +1,47 @@
1
- # sv
1
+ # Builder Builder
2
2
 
3
- Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
3
+ ## Setup
4
4
 
5
- ## Creating a project
5
+ ```bash
6
+ npm install
7
+ supabase start
8
+ npm run dev
9
+ ```
6
10
 
7
- If you're seeing this, you've probably already done this step. Congrats!
11
+ ## Deployment environments
8
12
 
9
- ```bash
10
- # create a new project in the current directory
11
- npx sv create
13
+ Where BB runs and which backing services it talks to.
12
14
 
13
- # create a new project in my-app
14
- npx sv create my-app
15
- ```
15
+ | Deployment | Clerk instance | Supabase instance |
16
+ | ----------------- | ---------------- | ----------------------- |
17
+ | local dev | Clerk test | local supabase (docker) |
18
+ | Vercel production | Clerk production | Supabase cloud project |
16
19
 
17
- ## Developing
20
+ ## Builder environments
18
21
 
19
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22
+ Every entity carries an `environment` of `development`, `staging`, or `production`. Same database, different rows. `development` rows are mutable; `staging` and `production` are immutable snapshots written when promoting from `development`.
20
23
 
21
- ```bash
22
- npm run dev
24
+ ## API key scoping
23
25
 
24
- # or start the server and open the app in a new browser tab
25
- npm run dev -- --open
26
- ```
26
+ Each API key is minted in `/settings` with three properties:
27
27
 
28
- ## Building
28
+ | Property | What it controls |
29
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30
+ | **Environment** | Which dataset the key reads from: `development`, `staging`, or `production`. |
31
+ | **Profile** | What the key can do. `read` keys can fetch; `readWrite` keys can also write variants. |
32
+ | **Allowed origins** | Origin patterns (e.g. `https://*.example.com`) the key may be used from. Set this for browser keys; leave empty for server-to-server keys. The two modes are exclusive — a key with allowed origins requires an Origin header that matches, and a key without them rejects any request that has an Origin header. |
29
33
 
30
- To create a production version of your app:
34
+ Keys are scoped to the org they were minted in and never see other orgs' data.
31
35
 
32
- ```bash
33
- npm run build
34
- ```
36
+ | Environment | `GET /api/builder/[id]` returns | `GET /api/builder/[id]/variants` returns |
37
+ | ------------- | ------------------------------- | ---------------------------------------- |
38
+ | `development` | live editable entity | live editable variants |
39
+ | `staging` | staging snapshot | staging snapshot variants |
40
+ | `production` | production snapshot | production snapshot variants |
35
41
 
36
- You can preview the production build with `npm run preview`.
42
+ ## Scripts
37
43
 
38
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
44
+ - `npm run verify` — tests, check, format, lint.
45
+ - `npm run test:integration:local` — integration tests against local Supabase.
46
+ - `npm run db:types:local` — regenerate `database.types.ts` from local schema.
47
+ - `npm run db:reset` — wipe local Supabase, re-diff migrations, regenerate types.
package/dist/bb.d.ts CHANGED
@@ -1,25 +1,24 @@
1
- import type { BuilderComponentVariantsValidated, BuilderInstanceValidated, BuilderModelValidated, BuilderPricingValidated, BuilderReferences, BuilderUIValidated, BuilderValidated } from './entities/index';
1
+ import type { BuilderEntityKind, BuilderInstanceValidated, BuilderModelValidated, BuilderReferences, BuilderValidated, BuilderValidatedMap, BuilderVariantsValidated } from './entities/index';
2
2
  import type { BuilderEnvironment, BuilderEnvironmentResult } from './environment';
3
- import type { BuilderComponentVariants, BuilderInstance, BuilderInstanceInput } from './instance';
3
+ import type { BuilderInstance, BuilderInstanceInput, BuilderVariants } from './instance';
4
4
  import type { BuilderOrder, BuilderRenderResult } from './mappers/index';
5
5
  import type { BuilderVariantsValidationOptions } from './validate/index';
6
6
  export type BBOptions = {
7
7
  readonly references?: BuilderReferences;
8
8
  };
9
+ export type BuilderEntityValidators<Env extends BuilderEnvironment> = {
10
+ readonly [Kind in BuilderEntityKind]: (input: unknown) => BuilderEnvironmentResult<BuilderValidatedMap[Kind], Env>;
11
+ };
9
12
  export type BB<Env extends BuilderEnvironment = 'production'> = {
10
- readonly validate: {
11
- builder(input: unknown): BuilderEnvironmentResult<BuilderValidated, Env>;
12
- model(input: unknown): BuilderEnvironmentResult<BuilderModelValidated, Env>;
13
- pricing(input: unknown): BuilderEnvironmentResult<BuilderPricingValidated, Env>;
14
- ui(input: unknown): BuilderEnvironmentResult<BuilderUIValidated, Env>;
13
+ readonly validate: BuilderEntityValidators<Env> & {
15
14
  instance(model: BuilderModelValidated, instance: BuilderInstance): BuilderEnvironmentResult<BuilderInstanceValidated, Env>;
16
- variants(model: BuilderModelValidated, input: unknown, options?: BuilderVariantsValidationOptions): BuilderEnvironmentResult<BuilderComponentVariantsValidated, Env>;
15
+ variants(model: BuilderModelValidated, input: unknown, options?: BuilderVariantsValidationOptions): BuilderEnvironmentResult<BuilderVariantsValidated, Env>;
17
16
  };
18
17
  instance(entity: BuilderValidated | BuilderModelValidated, partial?: BuilderInstanceInput): BuilderInstance;
19
18
  render(builder: BuilderValidated, instance: BuilderInstanceValidated): BuilderRenderResult;
20
- order(model: BuilderModelValidated, instance: BuilderInstanceValidated, variants: BuilderComponentVariantsValidated): BuilderOrder;
21
- price(pricing: BuilderPricingValidated, order: BuilderOrder): number | null;
22
- variants(entity: BuilderValidated | BuilderModelValidated): BuilderComponentVariants;
19
+ order(model: BuilderModelValidated, instance: BuilderInstanceValidated, variants: BuilderVariantsValidated): BuilderOrder;
20
+ price(pricing: BuilderValidatedMap['pricing'], order: BuilderOrder): number | null;
21
+ variants(entity: BuilderValidated | BuilderModelValidated): BuilderVariants;
23
22
  };
24
23
  export declare const bb: typeof bbProduction & {
25
24
  development: typeof bbDevelopment;
package/dist/bb.js CHANGED
@@ -1,4 +1,5 @@
1
- import { BuilderException } from './exception.js';
1
+ import { validateBoolean, validateCollectionConfig, validateCollectionSelectMap, validateCollectionWhen, validateComponentConfig, validateComponentSelectMap, validateComponentWhen, validateExpectations, validateNumber, validateOptionSelectMap, validateOptionWhen, validatePath, validatePaths, validatePricingRates, validateSelect, validateString, validateToggle, validateUIDescribe, validateUIInput, validateUIItems, validateUIPage, validateUIPages } from './entities/index.js';
2
+ import { BuilderException } from './errors/index.js';
2
3
  import { createInstance, createVariants, order, price, render } from './mappers/index.js';
3
4
  import { assertValidated, validateBuilder, validateInstance, validateModel, validatePricing, validateUI, validateVariants } from './validate/index.js';
4
5
  export const bb = Object.assign(bbProduction, {
@@ -17,8 +18,30 @@ function bbFactory(environment, references = []) {
17
18
  validate: {
18
19
  builder: (input) => throwInProd(validateBuilder(input, references)),
19
20
  model: (input) => throwInProd(validateModel(input, references)),
20
- pricing: (input) => throwInProd(validatePricing(input, references)),
21
+ select: (input) => throwInProd(validateSelect(input, references)),
22
+ toggle: (input) => throwInProd(validateToggle(input, references)),
23
+ optionSelectMap: (input) => throwInProd(validateOptionSelectMap(input, references)),
24
+ optionWhen: (input) => throwInProd(validateOptionWhen(input, references)),
25
+ componentConfig: (input) => throwInProd(validateComponentConfig(input, references)),
26
+ componentSelectMap: (input) => throwInProd(validateComponentSelectMap(input, references)),
27
+ componentWhen: (input) => throwInProd(validateComponentWhen(input, references)),
28
+ collectionConfig: (input) => throwInProd(validateCollectionConfig(input, references)),
29
+ collectionSelectMap: (input) => throwInProd(validateCollectionSelectMap(input, references)),
30
+ collectionWhen: (input) => throwInProd(validateCollectionWhen(input, references)),
21
31
  ui: (input) => throwInProd(validateUI(input, references)),
32
+ uiDescribe: (input) => throwInProd(validateUIDescribe(input, references)),
33
+ uiItems: (input) => throwInProd(validateUIItems(input, references)),
34
+ uiPage: (input) => throwInProd(validateUIPage(input, references)),
35
+ uiPages: (input) => throwInProd(validateUIPages(input, references)),
36
+ uiInput: (input) => throwInProd(validateUIInput(input, references)),
37
+ pricing: (input) => throwInProd(validatePricing(input, references)),
38
+ pricingRates: (input) => throwInProd(validatePricingRates(input, references)),
39
+ expectations: (input) => throwInProd(validateExpectations(input, references)),
40
+ paths: (input) => throwInProd(validatePaths(input, references)),
41
+ path: (input) => throwInProd(validatePath(input, references)),
42
+ number: (input) => throwInProd(validateNumber(input, references)),
43
+ string: (input) => throwInProd(validateString(input, references)),
44
+ boolean: (input) => throwInProd(validateBoolean(input, references)),
22
45
  instance: (model, instance) => throwInProd(validateInstance(model, instance)),
23
46
  variants: (model, input, variantOptions) => throwInProd(validateVariants(model, input, variantOptions))
24
47
  },
@@ -0,0 +1,7 @@
1
+ import type { BuilderBuilderClientOptions, BuilderBuilderGetResponse } from './schema.js';
2
+ export type BuilderBuilderClient = {
3
+ builder: {
4
+ get(id: string): Promise<BuilderBuilderGetResponse>;
5
+ };
6
+ };
7
+ export declare function client(options: BuilderBuilderClientOptions): BuilderBuilderClient;
@@ -0,0 +1,19 @@
1
+ import * as v from 'valibot';
2
+ import { BuilderException } from '../errors/index.js';
3
+ import { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema } from './schema.js';
4
+ export function client(options) {
5
+ const { url, apiKey } = v.parse(BuilderBuilderClientOptionsSchema, options);
6
+ return {
7
+ builder: {
8
+ get: async (id) => {
9
+ const response = await fetch(`${url}/api/builder/${id}`, {
10
+ headers: { 'X-Builder-Builder-Key': apiKey }
11
+ });
12
+ if (!response.ok) {
13
+ throw new BuilderException([]);
14
+ }
15
+ return v.parse(BuilderBuilderGetResponseSchema, await response.json());
16
+ }
17
+ }
18
+ };
19
+ }
@@ -0,0 +1,4 @@
1
+ export type { BuilderBuilderClientOptions, BuilderBuilderGetResponse } from './schema.js';
2
+ export type { BuilderBuilderClient } from './client.js';
3
+ export { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema } from './schema.js';
4
+ export { client } from './client.js';
@@ -0,0 +1,2 @@
1
+ export { BuilderBuilderClientOptionsSchema, BuilderBuilderGetResponseSchema } from './schema.js';
2
+ export { client } from './client.js';
@@ -0,0 +1,396 @@
1
+ import * as v from 'valibot';
2
+ export declare const BuilderBuilderClientOptionsSchema: v.ObjectSchema<{
3
+ readonly url: v.StringSchema<undefined>;
4
+ readonly apiKey: v.StringSchema<undefined>;
5
+ }, undefined>;
6
+ export type BuilderBuilderClientOptions = v.InferOutput<typeof BuilderBuilderClientOptionsSchema>;
7
+ export declare const BuilderBuilderGetResponseSchema: v.ObjectSchema<{
8
+ readonly name: v.StringSchema<undefined>;
9
+ readonly serialised: v.GenericSchema<import("../index.js").BuilderSerialised>;
10
+ readonly references: v.ArraySchema<v.ObjectSchema<{
11
+ readonly id: v.StringSchema<undefined>;
12
+ readonly serialised: v.GenericSchema<string | number | boolean | readonly (string | number)[] | readonly (readonly (string | number)[])[] | import("../index.js").BuilderSerialised | import("../index.js").BuilderModelSerialised | Readonly<{
13
+ type: "select";
14
+ readonly options: readonly [string, ...string[]];
15
+ defaultValue: string | null;
16
+ isOptional: boolean;
17
+ optionLabels: {
18
+ [x: string]: string;
19
+ };
20
+ tags?: readonly string[] | undefined;
21
+ }> | Readonly<{
22
+ type: "toggle";
23
+ valueType: "string" | "number" | "boolean";
24
+ defaultValue: string | number | boolean | null;
25
+ isOptional: boolean;
26
+ tags?: readonly string[] | undefined;
27
+ }> | import("../index.js").BuilderMatchSelectMap<Readonly<{
28
+ type: "parameter";
29
+ id: string;
30
+ name: string;
31
+ }> | Readonly<Readonly<{
32
+ type: "select";
33
+ readonly options: readonly [string, ...string[]];
34
+ defaultValue: string | null;
35
+ isOptional: boolean;
36
+ optionLabels: {
37
+ [x: string]: string;
38
+ };
39
+ tags?: readonly string[] | undefined;
40
+ }>> | Readonly<Readonly<{
41
+ type: "toggle";
42
+ valueType: "string" | "number" | "boolean";
43
+ defaultValue: string | number | boolean | null;
44
+ isOptional: boolean;
45
+ tags?: readonly string[] | undefined;
46
+ }>>> | import("../index.js").BuilderWhenSerialised<Readonly<Readonly<{
47
+ type: "select";
48
+ readonly options: readonly [string, ...string[]];
49
+ defaultValue: string | null;
50
+ isOptional: boolean;
51
+ optionLabels: {
52
+ [x: string]: string;
53
+ };
54
+ tags?: readonly string[] | undefined;
55
+ }>> | Readonly<Readonly<{
56
+ type: "toggle";
57
+ valueType: "string" | "number" | "boolean";
58
+ defaultValue: string | number | boolean | null;
59
+ isOptional: boolean;
60
+ tags?: readonly string[] | undefined;
61
+ }>>> | Readonly<{
62
+ fields: Readonly<{
63
+ type: "parameter";
64
+ id: string;
65
+ name: string;
66
+ }> | Readonly<{
67
+ type: "ref";
68
+ id: string;
69
+ }> | readonly Readonly<{
70
+ type: "component-field";
71
+ name: string;
72
+ valueType: "string" | "number" | "boolean";
73
+ isOptional: boolean;
74
+ tags?: readonly string[] | undefined;
75
+ }>[];
76
+ tags?: readonly string[] | undefined;
77
+ }> | import("../index.js").BuilderMatchSelectMap<Readonly<{
78
+ type: "parameter";
79
+ id: string;
80
+ name: string;
81
+ }> | Readonly<{
82
+ fields: Readonly<{
83
+ type: "parameter";
84
+ id: string;
85
+ name: string;
86
+ }> | Readonly<{
87
+ type: "ref";
88
+ id: string;
89
+ }> | readonly Readonly<{
90
+ type: "component-field";
91
+ name: string;
92
+ valueType: "string" | "number" | "boolean";
93
+ isOptional: boolean;
94
+ tags?: readonly string[] | undefined;
95
+ }>[];
96
+ tags?: readonly string[] | undefined;
97
+ }>> | import("../index.js").BuilderWhenSerialised<Readonly<{
98
+ fields: Readonly<{
99
+ type: "parameter";
100
+ id: string;
101
+ name: string;
102
+ }> | Readonly<{
103
+ type: "ref";
104
+ id: string;
105
+ }> | readonly Readonly<{
106
+ type: "component-field";
107
+ name: string;
108
+ valueType: "string" | "number" | "boolean";
109
+ isOptional: boolean;
110
+ tags?: readonly string[] | undefined;
111
+ }>[];
112
+ tags?: readonly string[] | undefined;
113
+ }>> | Readonly<{
114
+ model: Readonly<{
115
+ type: "parameter";
116
+ id: string;
117
+ name: string;
118
+ }> | Readonly<{
119
+ type: "ref";
120
+ id: string;
121
+ }> | import("../index.js").BuilderModelSerialised;
122
+ min: number | Readonly<{
123
+ type: "parameter";
124
+ id: string;
125
+ name: string;
126
+ }> | Readonly<{
127
+ type: "ref";
128
+ id: string;
129
+ }>;
130
+ max: number | Readonly<{
131
+ type: "parameter";
132
+ id: string;
133
+ name: string;
134
+ }> | Readonly<{
135
+ type: "ref";
136
+ id: string;
137
+ }>;
138
+ tags?: readonly string[] | undefined;
139
+ }> | import("../index.js").BuilderMatchSelectMap<Readonly<{
140
+ type: "parameter";
141
+ id: string;
142
+ name: string;
143
+ }> | Readonly<{
144
+ model: Readonly<{
145
+ type: "parameter";
146
+ id: string;
147
+ name: string;
148
+ }> | Readonly<{
149
+ type: "ref";
150
+ id: string;
151
+ }> | import("../index.js").BuilderModelSerialised;
152
+ min: number | Readonly<{
153
+ type: "parameter";
154
+ id: string;
155
+ name: string;
156
+ }> | Readonly<{
157
+ type: "ref";
158
+ id: string;
159
+ }>;
160
+ max: number | Readonly<{
161
+ type: "parameter";
162
+ id: string;
163
+ name: string;
164
+ }> | Readonly<{
165
+ type: "ref";
166
+ id: string;
167
+ }>;
168
+ tags?: readonly string[] | undefined;
169
+ }>> | import("../index.js").BuilderWhenSerialised<Readonly<{
170
+ model: Readonly<{
171
+ type: "parameter";
172
+ id: string;
173
+ name: string;
174
+ }> | Readonly<{
175
+ type: "ref";
176
+ id: string;
177
+ }> | import("../index.js").BuilderModelSerialised;
178
+ min: number | Readonly<{
179
+ type: "parameter";
180
+ id: string;
181
+ name: string;
182
+ }> | Readonly<{
183
+ type: "ref";
184
+ id: string;
185
+ }>;
186
+ max: number | Readonly<{
187
+ type: "parameter";
188
+ id: string;
189
+ name: string;
190
+ }> | Readonly<{
191
+ type: "ref";
192
+ id: string;
193
+ }>;
194
+ tags?: readonly string[] | undefined;
195
+ }>> | import("../index.js").BuilderUISerialised | Readonly<{
196
+ type: "input";
197
+ path: readonly (string | number)[] | Readonly<{
198
+ type: "parameter";
199
+ id: string;
200
+ name: string;
201
+ }> | Readonly<{
202
+ type: "ref";
203
+ id: string;
204
+ }>;
205
+ displayName?: string | Readonly<{
206
+ type: "parameter";
207
+ id: string;
208
+ name: string;
209
+ }> | Readonly<{
210
+ type: "ref";
211
+ id: string;
212
+ }> | undefined;
213
+ kind?: string | Readonly<{
214
+ type: "parameter";
215
+ id: string;
216
+ name: string;
217
+ }> | Readonly<{
218
+ type: "ref";
219
+ id: string;
220
+ }> | undefined;
221
+ metadata?: Readonly<{
222
+ type: "parameter";
223
+ id: string;
224
+ name: string;
225
+ }> | Readonly<{
226
+ type: "ref";
227
+ id: string;
228
+ }> | Readonly<{
229
+ [x: string]: unknown;
230
+ }> | undefined;
231
+ tags?: readonly string[] | undefined;
232
+ }> | Readonly<{
233
+ type: "page";
234
+ label: string | Readonly<{
235
+ type: "parameter";
236
+ id: string;
237
+ name: string;
238
+ }> | Readonly<{
239
+ type: "ref";
240
+ id: string;
241
+ }>;
242
+ inputs: Readonly<{
243
+ type: "parameter";
244
+ id: string;
245
+ name: string;
246
+ }> | Readonly<{
247
+ type: "ref";
248
+ id: string;
249
+ }> | readonly (Readonly<{
250
+ type: "parameter";
251
+ id: string;
252
+ name: string;
253
+ }> | Readonly<{
254
+ type: "ref";
255
+ id: string;
256
+ }> | Readonly<{
257
+ type: "input";
258
+ path: readonly (string | number)[] | Readonly<{
259
+ type: "parameter";
260
+ id: string;
261
+ name: string;
262
+ }> | Readonly<{
263
+ type: "ref";
264
+ id: string;
265
+ }>;
266
+ displayName?: string | Readonly<{
267
+ type: "parameter";
268
+ id: string;
269
+ name: string;
270
+ }> | Readonly<{
271
+ type: "ref";
272
+ id: string;
273
+ }> | undefined;
274
+ kind?: string | Readonly<{
275
+ type: "parameter";
276
+ id: string;
277
+ name: string;
278
+ }> | Readonly<{
279
+ type: "ref";
280
+ id: string;
281
+ }> | undefined;
282
+ metadata?: Readonly<{
283
+ type: "parameter";
284
+ id: string;
285
+ name: string;
286
+ }> | Readonly<{
287
+ type: "ref";
288
+ id: string;
289
+ }> | Readonly<{
290
+ [x: string]: unknown;
291
+ }> | undefined;
292
+ tags?: readonly string[] | undefined;
293
+ }>)[];
294
+ tags?: readonly string[] | undefined;
295
+ }> | Readonly<{
296
+ type: "describe";
297
+ label: string | Readonly<{
298
+ type: "parameter";
299
+ id: string;
300
+ name: string;
301
+ }> | Readonly<{
302
+ type: "ref";
303
+ id: string;
304
+ }>;
305
+ inputs: Readonly<{
306
+ type: "parameter";
307
+ id: string;
308
+ name: string;
309
+ }> | Readonly<{
310
+ type: "ref";
311
+ id: string;
312
+ }> | readonly (Readonly<{
313
+ type: "parameter";
314
+ id: string;
315
+ name: string;
316
+ }> | Readonly<{
317
+ type: "ref";
318
+ id: string;
319
+ }> | Readonly<{
320
+ type: "input";
321
+ path: readonly (string | number)[] | Readonly<{
322
+ type: "parameter";
323
+ id: string;
324
+ name: string;
325
+ }> | Readonly<{
326
+ type: "ref";
327
+ id: string;
328
+ }>;
329
+ displayName?: string | Readonly<{
330
+ type: "parameter";
331
+ id: string;
332
+ name: string;
333
+ }> | Readonly<{
334
+ type: "ref";
335
+ id: string;
336
+ }> | undefined;
337
+ kind?: string | Readonly<{
338
+ type: "parameter";
339
+ id: string;
340
+ name: string;
341
+ }> | Readonly<{
342
+ type: "ref";
343
+ id: string;
344
+ }> | undefined;
345
+ metadata?: Readonly<{
346
+ type: "parameter";
347
+ id: string;
348
+ name: string;
349
+ }> | Readonly<{
350
+ type: "ref";
351
+ id: string;
352
+ }> | Readonly<{
353
+ [x: string]: unknown;
354
+ }> | undefined;
355
+ tags?: readonly string[] | undefined;
356
+ }>)[];
357
+ tags?: readonly string[] | undefined;
358
+ }> | import("../index.js").BuilderUIPagesSerialised | readonly (Readonly<{
359
+ type: "parameter";
360
+ id: string;
361
+ name: string;
362
+ }> | Readonly<{
363
+ type: "ref";
364
+ id: string;
365
+ }> | import("../entities/index.js").BuilderUIItemSerialised)[] | import("../index.js").BuilderPricingSerialised | import("../entities/index.js").BuilderRates | readonly Readonly<{
366
+ name: string;
367
+ kind: "option" | "component" | "collection";
368
+ }>[]>;
369
+ }, undefined>, undefined>;
370
+ readonly variants: v.SchemaWithPipe<readonly [v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
371
+ readonly instance: v.GenericSchema<import("../instance.js").BuilderInstance>;
372
+ readonly details: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.NullableSchema<v.UnionSchema<[v.StringSchema<undefined>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>, undefined>;
373
+ readonly tags: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.ReadonlyAction<string[]>]>, undefined>;
374
+ }, undefined>, v.ReadonlyAction<{
375
+ instance: import("../instance.js").BuilderInstance;
376
+ details?: {
377
+ [x: string]: string | number | boolean | null;
378
+ } | undefined;
379
+ tags?: readonly string[] | undefined;
380
+ }>]>, undefined>, v.ReadonlyAction<Readonly<{
381
+ instance: import("../instance.js").BuilderInstance;
382
+ details?: {
383
+ [x: string]: string | number | boolean | null;
384
+ } | undefined;
385
+ tags?: readonly string[] | undefined;
386
+ }>[]>]>, undefined>, v.ReadonlyAction<{
387
+ readonly [x: string]: readonly Readonly<{
388
+ instance: import("../instance.js").BuilderInstance;
389
+ details?: {
390
+ [x: string]: string | number | boolean | null;
391
+ } | undefined;
392
+ tags?: readonly string[] | undefined;
393
+ }>[];
394
+ }>]>;
395
+ }, undefined>;
396
+ export type BuilderBuilderGetResponse = v.InferOutput<typeof BuilderBuilderGetResponseSchema>;
@@ -0,0 +1,13 @@
1
+ import * as v from 'valibot';
2
+ import { BuilderReferencesSchema, BuilderSerialisedSchema } from '../entities/index.js';
3
+ import { BuilderVariantsSchema } from '../instance.js';
4
+ export const BuilderBuilderClientOptionsSchema = v.object({
5
+ url: v.string(),
6
+ apiKey: v.string()
7
+ });
8
+ export const BuilderBuilderGetResponseSchema = v.object({
9
+ name: v.string(),
10
+ serialised: BuilderSerialisedSchema,
11
+ references: BuilderReferencesSchema,
12
+ variants: BuilderVariantsSchema
13
+ });
@@ -1,4 +1,4 @@
1
- import type { BuilderEntitySerialised } from '../kind';
2
1
  import type { BuilderRefSerialised } from '../../references';
2
+ import type { BuilderEntitySerialised } from '../kind';
3
3
  export type BuilderBindings = Readonly<Record<string, unknown>>;
4
4
  export type BuilderBindingsSerialised = Readonly<Record<string, BuilderEntitySerialised | BuilderRefSerialised>>;
@@ -1,8 +1,8 @@
1
1
  import * as v from 'valibot';
2
2
  import { BuilderRefSerialisedSchema } from '../../references.js';
3
- import { serialisable } from '../../serialisable.js';
4
3
  import { BuilderModel, BuilderModelSerialisedSchema } from '../model/index.js';
5
4
  import { BuilderPricing, BuilderPricingSerialisedSchema } from '../pricing/index.js';
5
+ import { serialisable } from '../serialisable.js';
6
6
  import { BuilderTagsSchema } from '../tags.js';
7
7
  import { BuilderUI, BuilderUISerialisedSchema } from '../ui/index.js';
8
8
  export class Builder {