bleam 0.0.11 → 0.0.12
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.
- package/dist/ai.cjs +2314 -2173
- package/dist/ai.d.cts +227 -322
- package/dist/ai.d.ts +227 -322
- package/dist/ai.js +2309 -2159
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/{files-Ds1wT8C2.js → files-BXVkPrPN.js} +6 -1
- package/dist/{files-Bo7h9fik.cjs → files-DxaQ-Nv0.cjs} +11 -0
- package/dist/files.cjs +1 -1
- package/dist/files.d.cts +1 -1
- package/dist/files.d.ts +1 -1
- package/dist/files.js +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/schema-B5BfdswF.js +226 -0
- package/dist/schema-BnVZOXfu.cjs +286 -0
- package/dist/schema-D5eImHxu.d.cts +125 -0
- package/dist/schema-SSjokbtw.d.ts +125 -0
- package/dist/schema.cjs +10 -2
- package/dist/schema.d.cts +2 -2
- package/dist/schema.d.ts +2 -2
- package/dist/schema.js +2 -2
- package/dist/state-Dh3HLixb.js +874 -0
- package/dist/state-LssDgpff.cjs +973 -0
- package/dist/state.cjs +16 -12
- package/dist/state.d.cts +144 -140
- package/dist/state.d.ts +145 -140
- package/dist/state.js +3 -3
- package/dist/{ui-CHc4xEs_.d.ts → ui-D7bRLYee.d.ts} +7 -7
- package/dist/ui.d.ts +1 -1
- package/dist/window.d.ts +1 -1
- package/package.json +3 -1
- package/templates/foundation-models/app/index.tsx +77 -15
- package/templates/image-generation/app/index.tsx +2 -2
- package/templates/native/ios/Bleam.xcodeproj/project.pbxproj +46 -46
- package/templates/native/ios/Podfile.lock +173 -173
- package/templates/native/modules/bleam-runtime/ios/AIModule.swift +35 -357
- package/templates/text-generation/app/index.tsx +81 -50
- package/templates/updates/README.md +1 -1
- package/dist/schema-Bo5Jvqus.js +0 -90
- package/dist/schema-CYh6n8GS.d.ts +0 -58
- package/dist/schema-oeOrd3i1.d.cts +0 -58
- package/dist/schema-rQ13mrpD.cjs +0 -102
- package/dist/state-Bx0VlTlO.cjs +0 -852
- package/dist/state-CAwe-Vw1.js +0 -767
- /package/dist/{config-Cms0rvqg.d.ts → config-COcRnn5a.d.cts} +0 -0
- /package/dist/{config-CufOVJV3.d.cts → config-Chi-flpJ.d.ts} +0 -0
- /package/dist/{files-4ZEoAWiv.d.ts → files-DwA7pzr3.d.cts} +0 -0
- /package/dist/{files-Dt5mbzLq.d.cts → files-VrkQlKIT.d.ts} +0 -0
package/dist/schema-Bo5Jvqus.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
//#region src/schema.ts
|
|
2
|
-
var SchemaError = class extends Error {
|
|
3
|
-
constructor(issues) {
|
|
4
|
-
super(issues.map((issue) => issue.message).join("\n"));
|
|
5
|
-
this.issues = issues;
|
|
6
|
-
this.name = "SchemaError";
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
function tokenMatches(token, value) {
|
|
10
|
-
return typeof value === token;
|
|
11
|
-
}
|
|
12
|
-
function issueFor(key, expected) {
|
|
13
|
-
return {
|
|
14
|
-
message: `Expected ${key} to be ${expected}`,
|
|
15
|
-
path: [key]
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
function parseShape(shape, value) {
|
|
19
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return { issues: [{ message: "Expected object" }] };
|
|
20
|
-
const input = value;
|
|
21
|
-
const output = {};
|
|
22
|
-
const issues = [];
|
|
23
|
-
for (const [key, field] of Object.entries(shape)) {
|
|
24
|
-
const inputValue = input[key];
|
|
25
|
-
if (typeof field === "function") {
|
|
26
|
-
const defaultValue = field();
|
|
27
|
-
const expected = typeof defaultValue;
|
|
28
|
-
if (inputValue === void 0) {
|
|
29
|
-
output[key] = defaultValue;
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (tokenMatches(expected, inputValue)) {
|
|
33
|
-
output[key] = inputValue;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
issues.push(issueFor(key, expected));
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
if (inputValue === void 0) continue;
|
|
40
|
-
if (tokenMatches(field, inputValue)) {
|
|
41
|
-
output[key] = inputValue;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
issues.push(issueFor(key, field));
|
|
45
|
-
}
|
|
46
|
-
if (issues.length > 0) return { issues };
|
|
47
|
-
return { value: output };
|
|
48
|
-
}
|
|
49
|
-
function createSchema(validate, jsonSchema) {
|
|
50
|
-
return {
|
|
51
|
-
"~standard": {
|
|
52
|
-
version: 1,
|
|
53
|
-
vendor: "bleam",
|
|
54
|
-
validate
|
|
55
|
-
},
|
|
56
|
-
parse(value) {
|
|
57
|
-
const result = validate(value);
|
|
58
|
-
if (result.issues !== void 0) throw new SchemaError(result.issues);
|
|
59
|
-
return result.value;
|
|
60
|
-
},
|
|
61
|
-
safeParse: validate,
|
|
62
|
-
toJSONSchema: jsonSchema,
|
|
63
|
-
transform(transform) {
|
|
64
|
-
return createSchema((value) => {
|
|
65
|
-
const result = validate(value);
|
|
66
|
-
if (result.issues !== void 0) return result;
|
|
67
|
-
return { value: transform(result.value) };
|
|
68
|
-
}, jsonSchema);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function schema(shape) {
|
|
73
|
-
return createSchema((value) => parseShape(shape, value), () => {
|
|
74
|
-
const properties = {};
|
|
75
|
-
const required = [];
|
|
76
|
-
for (const [key, field] of Object.entries(shape)) {
|
|
77
|
-
if (typeof field === "function") properties[key] = { type: typeof field() };
|
|
78
|
-
else properties[key] = { type: field };
|
|
79
|
-
required.push(key);
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
type: "object",
|
|
83
|
-
properties,
|
|
84
|
-
required
|
|
85
|
-
};
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
//#endregion
|
|
90
|
-
export { schema as n, SchemaError as t };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
//#region src/schema.d.ts
|
|
2
|
-
type FieldValue = string | number | boolean;
|
|
3
|
-
type FieldToken = 'string' | 'number' | 'boolean';
|
|
4
|
-
type FieldDefault<T extends FieldValue = FieldValue> = () => T;
|
|
5
|
-
type FieldSchema = FieldToken | FieldDefault;
|
|
6
|
-
type SchemaShape = Record<string, FieldSchema>;
|
|
7
|
-
interface SchemaIssue {
|
|
8
|
-
message: string;
|
|
9
|
-
path?: ReadonlyArray<PropertyKey | {
|
|
10
|
-
key: PropertyKey;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
type SchemaResult<Output> = {
|
|
14
|
-
value: Output;
|
|
15
|
-
issues?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
issues: ReadonlyArray<SchemaIssue>;
|
|
18
|
-
};
|
|
19
|
-
interface StandardSchema<Input = unknown, Output = Input> {
|
|
20
|
-
readonly '~standard': {
|
|
21
|
-
readonly version: 1;
|
|
22
|
-
readonly vendor: string;
|
|
23
|
-
readonly validate: (value: unknown) => SchemaResult<Output>;
|
|
24
|
-
readonly types?: {
|
|
25
|
-
readonly input: Input;
|
|
26
|
-
readonly output: Output;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
type TokenValue<T extends FieldToken> = T extends 'string' ? string : T extends 'number' ? number : boolean;
|
|
31
|
-
type DefaultValue<T> = T extends (() => infer Value) ? Value extends FieldValue ? Value : never : never;
|
|
32
|
-
type TokenKeys<Shape extends SchemaShape> = { [Key in keyof Shape]: Shape[Key] extends FieldToken ? Key : never }[keyof Shape];
|
|
33
|
-
type DefaultKeys<Shape extends SchemaShape> = { [Key in keyof Shape]: Shape[Key] extends FieldDefault ? Key : never }[keyof Shape];
|
|
34
|
-
type FieldInput<Field extends FieldSchema> = Field extends FieldToken ? TokenValue<Field> : Field extends FieldDefault ? DefaultValue<Field> : never;
|
|
35
|
-
type SchemaInput<Shape extends SchemaShape> = { [Key in keyof Shape]?: FieldInput<Shape[Key]> };
|
|
36
|
-
type SchemaOutput<Shape extends SchemaShape> = { [Key in TokenKeys<Shape>]?: Shape[Key] extends FieldToken ? TokenValue<Shape[Key]> : never } & { [Key in DefaultKeys<Shape>]: Shape[Key] extends FieldDefault ? DefaultValue<Shape[Key]> : never };
|
|
37
|
-
type InferInput<Value$1 extends StandardSchema> = NonNullable<Value$1['~standard']['types']>['input'];
|
|
38
|
-
type InferOutput<Value$1 extends StandardSchema> = NonNullable<Value$1['~standard']['types']>['output'];
|
|
39
|
-
declare class SchemaError extends Error {
|
|
40
|
-
readonly issues: ReadonlyArray<SchemaIssue>;
|
|
41
|
-
constructor(issues: ReadonlyArray<SchemaIssue>);
|
|
42
|
-
}
|
|
43
|
-
interface BleamSchema<Input, Output> extends StandardSchema<Input, Output> {
|
|
44
|
-
parse(value: unknown): Output;
|
|
45
|
-
safeParse(value: unknown): SchemaResult<Output>;
|
|
46
|
-
toJSONSchema(): SchemaJSONSchema;
|
|
47
|
-
transform<NextOutput>(transform: (value: Output) => NextOutput): BleamSchema<Input, NextOutput>;
|
|
48
|
-
}
|
|
49
|
-
type SchemaJSONSchema = {
|
|
50
|
-
type: 'object';
|
|
51
|
-
properties: Record<string, {
|
|
52
|
-
type: FieldToken;
|
|
53
|
-
}>;
|
|
54
|
-
required: string[];
|
|
55
|
-
};
|
|
56
|
-
declare function schema<Shape extends SchemaShape>(shape: Shape): BleamSchema<SchemaInput<Shape>, SchemaOutput<Shape>>;
|
|
57
|
-
//#endregion
|
|
58
|
-
export { FieldValue as a, SchemaError as c, SchemaJSONSchema as d, SchemaOutput as f, schema as g, StandardSchema as h, FieldToken as i, SchemaInput as l, SchemaShape as m, FieldDefault as n, InferInput as o, SchemaResult as p, FieldSchema as r, InferOutput as s, BleamSchema as t, SchemaIssue as u };
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
//#region src/schema.d.ts
|
|
2
|
-
type FieldValue = string | number | boolean;
|
|
3
|
-
type FieldToken = 'string' | 'number' | 'boolean';
|
|
4
|
-
type FieldDefault<T extends FieldValue = FieldValue> = () => T;
|
|
5
|
-
type FieldSchema = FieldToken | FieldDefault;
|
|
6
|
-
type SchemaShape = Record<string, FieldSchema>;
|
|
7
|
-
interface SchemaIssue {
|
|
8
|
-
message: string;
|
|
9
|
-
path?: ReadonlyArray<PropertyKey | {
|
|
10
|
-
key: PropertyKey;
|
|
11
|
-
}>;
|
|
12
|
-
}
|
|
13
|
-
type SchemaResult<Output> = {
|
|
14
|
-
value: Output;
|
|
15
|
-
issues?: undefined;
|
|
16
|
-
} | {
|
|
17
|
-
issues: ReadonlyArray<SchemaIssue>;
|
|
18
|
-
};
|
|
19
|
-
interface StandardSchema<Input = unknown, Output = Input> {
|
|
20
|
-
readonly '~standard': {
|
|
21
|
-
readonly version: 1;
|
|
22
|
-
readonly vendor: string;
|
|
23
|
-
readonly validate: (value: unknown) => SchemaResult<Output>;
|
|
24
|
-
readonly types?: {
|
|
25
|
-
readonly input: Input;
|
|
26
|
-
readonly output: Output;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
type TokenValue<T extends FieldToken> = T extends 'string' ? string : T extends 'number' ? number : boolean;
|
|
31
|
-
type DefaultValue<T> = T extends (() => infer Value) ? Value extends FieldValue ? Value : never : never;
|
|
32
|
-
type TokenKeys<Shape extends SchemaShape> = { [Key in keyof Shape]: Shape[Key] extends FieldToken ? Key : never }[keyof Shape];
|
|
33
|
-
type DefaultKeys<Shape extends SchemaShape> = { [Key in keyof Shape]: Shape[Key] extends FieldDefault ? Key : never }[keyof Shape];
|
|
34
|
-
type FieldInput<Field extends FieldSchema> = Field extends FieldToken ? TokenValue<Field> : Field extends FieldDefault ? DefaultValue<Field> : never;
|
|
35
|
-
type SchemaInput<Shape extends SchemaShape> = { [Key in keyof Shape]?: FieldInput<Shape[Key]> };
|
|
36
|
-
type SchemaOutput<Shape extends SchemaShape> = { [Key in TokenKeys<Shape>]?: Shape[Key] extends FieldToken ? TokenValue<Shape[Key]> : never } & { [Key in DefaultKeys<Shape>]: Shape[Key] extends FieldDefault ? DefaultValue<Shape[Key]> : never };
|
|
37
|
-
type InferInput<Value$1 extends StandardSchema> = NonNullable<Value$1['~standard']['types']>['input'];
|
|
38
|
-
type InferOutput<Value$1 extends StandardSchema> = NonNullable<Value$1['~standard']['types']>['output'];
|
|
39
|
-
declare class SchemaError extends Error {
|
|
40
|
-
readonly issues: ReadonlyArray<SchemaIssue>;
|
|
41
|
-
constructor(issues: ReadonlyArray<SchemaIssue>);
|
|
42
|
-
}
|
|
43
|
-
interface BleamSchema<Input, Output> extends StandardSchema<Input, Output> {
|
|
44
|
-
parse(value: unknown): Output;
|
|
45
|
-
safeParse(value: unknown): SchemaResult<Output>;
|
|
46
|
-
toJSONSchema(): SchemaJSONSchema;
|
|
47
|
-
transform<NextOutput>(transform: (value: Output) => NextOutput): BleamSchema<Input, NextOutput>;
|
|
48
|
-
}
|
|
49
|
-
type SchemaJSONSchema = {
|
|
50
|
-
type: 'object';
|
|
51
|
-
properties: Record<string, {
|
|
52
|
-
type: FieldToken;
|
|
53
|
-
}>;
|
|
54
|
-
required: string[];
|
|
55
|
-
};
|
|
56
|
-
declare function schema<Shape extends SchemaShape>(shape: Shape): BleamSchema<SchemaInput<Shape>, SchemaOutput<Shape>>;
|
|
57
|
-
//#endregion
|
|
58
|
-
export { FieldValue as a, SchemaError as c, SchemaJSONSchema as d, SchemaOutput as f, schema as g, StandardSchema as h, FieldToken as i, SchemaInput as l, SchemaShape as m, FieldDefault as n, InferInput as o, SchemaResult as p, FieldSchema as r, InferOutput as s, BleamSchema as t, SchemaIssue as u };
|
package/dist/schema-rQ13mrpD.cjs
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/schema.ts
|
|
3
|
-
var SchemaError = class extends Error {
|
|
4
|
-
constructor(issues) {
|
|
5
|
-
super(issues.map((issue) => issue.message).join("\n"));
|
|
6
|
-
this.issues = issues;
|
|
7
|
-
this.name = "SchemaError";
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
function tokenMatches(token, value) {
|
|
11
|
-
return typeof value === token;
|
|
12
|
-
}
|
|
13
|
-
function issueFor(key, expected) {
|
|
14
|
-
return {
|
|
15
|
-
message: `Expected ${key} to be ${expected}`,
|
|
16
|
-
path: [key]
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function parseShape(shape, value) {
|
|
20
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) return { issues: [{ message: "Expected object" }] };
|
|
21
|
-
const input = value;
|
|
22
|
-
const output = {};
|
|
23
|
-
const issues = [];
|
|
24
|
-
for (const [key, field] of Object.entries(shape)) {
|
|
25
|
-
const inputValue = input[key];
|
|
26
|
-
if (typeof field === "function") {
|
|
27
|
-
const defaultValue = field();
|
|
28
|
-
const expected = typeof defaultValue;
|
|
29
|
-
if (inputValue === void 0) {
|
|
30
|
-
output[key] = defaultValue;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (tokenMatches(expected, inputValue)) {
|
|
34
|
-
output[key] = inputValue;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
issues.push(issueFor(key, expected));
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (inputValue === void 0) continue;
|
|
41
|
-
if (tokenMatches(field, inputValue)) {
|
|
42
|
-
output[key] = inputValue;
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
issues.push(issueFor(key, field));
|
|
46
|
-
}
|
|
47
|
-
if (issues.length > 0) return { issues };
|
|
48
|
-
return { value: output };
|
|
49
|
-
}
|
|
50
|
-
function createSchema(validate, jsonSchema) {
|
|
51
|
-
return {
|
|
52
|
-
"~standard": {
|
|
53
|
-
version: 1,
|
|
54
|
-
vendor: "bleam",
|
|
55
|
-
validate
|
|
56
|
-
},
|
|
57
|
-
parse(value) {
|
|
58
|
-
const result = validate(value);
|
|
59
|
-
if (result.issues !== void 0) throw new SchemaError(result.issues);
|
|
60
|
-
return result.value;
|
|
61
|
-
},
|
|
62
|
-
safeParse: validate,
|
|
63
|
-
toJSONSchema: jsonSchema,
|
|
64
|
-
transform(transform) {
|
|
65
|
-
return createSchema((value) => {
|
|
66
|
-
const result = validate(value);
|
|
67
|
-
if (result.issues !== void 0) return result;
|
|
68
|
-
return { value: transform(result.value) };
|
|
69
|
-
}, jsonSchema);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
function schema(shape) {
|
|
74
|
-
return createSchema((value) => parseShape(shape, value), () => {
|
|
75
|
-
const properties = {};
|
|
76
|
-
const required = [];
|
|
77
|
-
for (const [key, field] of Object.entries(shape)) {
|
|
78
|
-
if (typeof field === "function") properties[key] = { type: typeof field() };
|
|
79
|
-
else properties[key] = { type: field };
|
|
80
|
-
required.push(key);
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
type: "object",
|
|
84
|
-
properties,
|
|
85
|
-
required
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
//#endregion
|
|
91
|
-
Object.defineProperty(exports, 'SchemaError', {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () {
|
|
94
|
-
return SchemaError;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(exports, 'schema', {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
get: function () {
|
|
100
|
-
return schema;
|
|
101
|
-
}
|
|
102
|
-
});
|