@slopmachine/core 0.1.2 → 0.1.4

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/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  interface SlopImageOptions {
2
2
  bucketId: string;
3
- prompt?: string;
3
+ version?: number;
4
+ resultId?: string;
4
5
  aspectRatio?: string;
5
6
  model?: "gemini" | "gemini-flash" | "gemini-pro" | "imagen";
6
7
  variables?: Record<string, string | number | undefined | null>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  interface SlopImageOptions {
2
2
  bucketId: string;
3
- prompt?: string;
3
+ version?: number;
4
+ resultId?: string;
4
5
  aspectRatio?: string;
5
6
  model?: "gemini" | "gemini-flash" | "gemini-pro" | "imagen";
6
7
  variables?: Record<string, string | number | undefined | null>;
package/dist/index.js CHANGED
@@ -39,27 +39,30 @@ function interpolatePrompt(prompt, variables) {
39
39
  function buildImageUrl(options) {
40
40
  const {
41
41
  bucketId,
42
- prompt,
42
+ version,
43
+ resultId,
43
44
  aspectRatio = "1:1",
44
45
  model,
45
46
  variables = {},
46
47
  baseUrl = "https://us-central1-slopmachine-12bfb.cloudfunctions.net/renderImage"
47
48
  } = options;
48
- const finalPrompt = interpolatePrompt(prompt, variables);
49
- const params = new URLSearchParams({
50
- bucketId,
51
- aspectRatio: String(aspectRatio),
52
- ...model && { model }
53
- });
54
- if (finalPrompt) {
55
- params.set("prompt", finalPrompt);
49
+ const params = new URLSearchParams();
50
+ params.set("bucketId", bucketId);
51
+ if (aspectRatio) {
52
+ params.set("aspectRatio", aspectRatio);
53
+ }
54
+ if (model) {
55
+ params.set("model", model);
56
+ }
57
+ if (version) {
58
+ params.set("version", String(version));
59
+ }
60
+ if (resultId) {
61
+ params.set("resultId", resultId);
62
+ }
63
+ if (Object.keys(variables).length > 0) {
64
+ params.set("variables", JSON.stringify(variables));
56
65
  }
57
- Object.keys(variables).forEach((key) => {
58
- const value = variables[key];
59
- if (value !== void 0 && value !== null) {
60
- params.set(key, String(value));
61
- }
62
- });
63
66
  return `${baseUrl}?${params.toString()}`;
64
67
  }
65
68
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -14,27 +14,30 @@ function interpolatePrompt(prompt, variables) {
14
14
  function buildImageUrl(options) {
15
15
  const {
16
16
  bucketId,
17
- prompt,
17
+ version,
18
+ resultId,
18
19
  aspectRatio = "1:1",
19
20
  model,
20
21
  variables = {},
21
22
  baseUrl = "https://us-central1-slopmachine-12bfb.cloudfunctions.net/renderImage"
22
23
  } = options;
23
- const finalPrompt = interpolatePrompt(prompt, variables);
24
- const params = new URLSearchParams({
25
- bucketId,
26
- aspectRatio: String(aspectRatio),
27
- ...model && { model }
28
- });
29
- if (finalPrompt) {
30
- params.set("prompt", finalPrompt);
24
+ const params = new URLSearchParams();
25
+ params.set("bucketId", bucketId);
26
+ if (aspectRatio) {
27
+ params.set("aspectRatio", aspectRatio);
28
+ }
29
+ if (model) {
30
+ params.set("model", model);
31
+ }
32
+ if (version) {
33
+ params.set("version", String(version));
34
+ }
35
+ if (resultId) {
36
+ params.set("resultId", resultId);
37
+ }
38
+ if (Object.keys(variables).length > 0) {
39
+ params.set("variables", JSON.stringify(variables));
31
40
  }
32
- Object.keys(variables).forEach((key) => {
33
- const value = variables[key];
34
- if (value !== void 0 && value !== null) {
35
- params.set(key, String(value));
36
- }
37
- });
38
41
  return `${baseUrl}?${params.toString()}`;
39
42
  }
40
43
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slopmachine/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export interface SlopImageOptions {
2
2
  bucketId: string;
3
- prompt?: string;
3
+ version?: number;
4
+ resultId?: string;
4
5
  aspectRatio?: string;
5
6
  model?: "gemini" | "gemini-flash" | "gemini-pro" | "imagen";
6
7
  variables?: Record<string, string | number | undefined | null>;
@@ -27,23 +28,29 @@ export function interpolatePrompt(
27
28
  export function buildImageUrl(options: SlopImageOptions): string {
28
29
  const {
29
30
  bucketId,
30
- prompt,
31
+ version,
32
+ resultId,
31
33
  aspectRatio = "1:1",
32
34
  model,
33
35
  variables = {},
34
36
  baseUrl = "https://us-central1-slopmachine-12bfb.cloudfunctions.net/renderImage",
35
37
  } = options;
36
38
 
37
- const finalPrompt = interpolatePrompt(prompt, variables);
39
+ const params = new URLSearchParams();
40
+ params.set("bucketId", bucketId);
38
41
 
39
- const params = new URLSearchParams({
40
- bucketId,
41
- aspectRatio: String(aspectRatio),
42
- ...(model && { model }),
43
- });
42
+ if (aspectRatio) {
43
+ params.set("aspectRatio", aspectRatio);
44
+ }
44
45
 
45
- if (finalPrompt) {
46
- params.set("prompt", finalPrompt);
46
+ if (model) {
47
+ params.set("model", model);
48
+ }
49
+ if (version) {
50
+ params.set("version", String(version));
51
+ }
52
+ if (resultId) {
53
+ params.set("resultId", resultId);
47
54
  }
48
55
 
49
56
  if (Object.keys(variables).length > 0) {