@gepetto/sdk 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -46,7 +46,7 @@ CommonJS: `const { Gepetto } = require('@gepetto/sdk');`
46
46
 
47
47
  ## Tools
48
48
 
49
- The `url` (and `mask`) of every tool is a public http(s) URL of a JPEG, PNG, WebP or HEIC image: upload the photo to your own storage first. The output URL is public too; copy the image if you keep it.
49
+ The `url` of every tool is a public http(s) URL of a JPEG, PNG, WebP or HEIC image: upload the photo to your own storage first. The output URL is public too; copy the image if you keep it.
50
50
 
51
51
  | Method | What it does |
52
52
  | --- | --- |
@@ -63,7 +63,7 @@ The `url` (and `mask`) of every tool is a public http(s) URL of a JPEG, PNG, Web
63
63
  | `surfaces({ url, surface: 'finish', finishId })` | A finish applied |
64
64
  | `upscale({ url, resolution? })` | Enlarged to about 4 (`2k`) or 16 megapixels (`4k`, default) |
65
65
 
66
- A mask is a black image with the zone painted in white, drawn on the photo. Output sizes are in the docs (Images and masks).
66
+ A mask is a black image with the zone painted in white, drawn on the photo. Give its URL, or the image itself in base64: the value of `canvas.toDataURL('image/png')` works as is, so there is nothing to host. Output sizes are in the docs (Images and masks).
67
67
 
68
68
  Every tool takes a second argument:
69
69
 
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Gepetto = exports.GepettoError = exports.VERSION = void 0;
10
10
  exports.verifyWebhook = verifyWebhook;
11
- exports.VERSION = '0.1.2';
11
+ exports.VERSION = '0.1.3';
12
12
  const DEFAULT_BASE_URL = 'https://europe-west1-gepettoai.cloudfunctions.net/v2';
13
13
  /** A render is stopped by the API after 450 s: 10 minutes covers it, retries included. */
14
14
  const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000;
package/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Methods and fields have the names of the API: what the docs say of an endpoint is true of the method.
6
6
  */
7
- export declare const VERSION = "0.1.2";
7
+ export declare const VERSION = "0.1.3";
8
8
  /** Rooms of `GET /rooms`. */
9
9
  export type KnownRoomId = 'bar' | 'bath_room' | 'bedroom' | 'clothing_store' | 'coworking_space' | 'dining_room' | 'dressing' | 'gaming_room' | 'hall' | 'home_office' | 'kitchen' | 'kitchen_living' | 'living_dining' | 'living_room' | 'meeting_room' | 'office' | 'optician' | 'osteopathy_clinic' | 'outdoor_garden' | 'outdoor_piscine' | 'outdoor_snowy_garden' | 'outdoor_terrace' | 'psychologist_office' | 'restaurant' | 'salle_de_sport' | 'shoe_store' | 'teenager_bedroom' | 'toilet';
10
10
  /** Rooms that can be furnished whole, without a mask (mode `auto`). */
@@ -62,6 +62,9 @@ export interface CompletedJob extends Job {
62
62
  }
63
63
  /** A public http(s) URL of a JPEG, PNG, WebP or HEIC image (100 megapixels at most). */
64
64
  export type ImageUrl = string | URL;
65
+ /** A black image with the zone painted in white, drawn on the photo: a public URL, or the image itself in base64 as
66
+ * a data URL, such as `canvas.toDataURL('image/png')` gives (5 MB at most; a black and white PNG weighs a few KB). */
67
+ export type MaskImage = string | URL;
65
68
  interface Common {
66
69
  /** The photo: a public http(s) URL. */
67
70
  url: ImageUrl;
@@ -76,8 +79,8 @@ export type DeclutterParams = Common & ({
76
79
  keepBathroom?: boolean;
77
80
  keepFireplace?: boolean;
78
81
  } | {
79
- /** A black image with the zone to remove painted in white, drawn on the photo. */
80
- mask: ImageUrl;
82
+ /** The zone to remove, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
83
+ mask: MaskImage;
81
84
  });
82
85
  export type FurnishParams = Common & ({
83
86
  /** Without a mask, the whole room is furnished: the room must have the `auto` mode in `GET /rooms`. */
@@ -85,14 +88,15 @@ export type FurnishParams = Common & ({
85
88
  roomId: OrString<KnownAutoRoomId>;
86
89
  styleId: StyleId;
87
90
  } | {
88
- /** A black image with the zone to furnish painted in white, drawn on the photo. */
89
- mask: ImageUrl;
91
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
92
+ mask: MaskImage;
90
93
  /** The zone furnished as a room (mode `zone` in `GET /rooms`). */
91
94
  roomId: OrString<KnownZoneRoomId>;
92
95
  styleId: StyleId;
93
96
  furnitureId?: undefined;
94
97
  } | {
95
- mask: ImageUrl;
98
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
99
+ mask: MaskImage;
96
100
  /** One piece of furniture in the zone, instead of a room. */
97
101
  furnitureId: FurnitureId;
98
102
  styleId?: StyleId;
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Methods and fields have the names of the API: what the docs say of an endpoint is true of the method.
6
6
  */
7
- export declare const VERSION = "0.1.2";
7
+ export declare const VERSION = "0.1.3";
8
8
  /** Rooms of `GET /rooms`. */
9
9
  export type KnownRoomId = 'bar' | 'bath_room' | 'bedroom' | 'clothing_store' | 'coworking_space' | 'dining_room' | 'dressing' | 'gaming_room' | 'hall' | 'home_office' | 'kitchen' | 'kitchen_living' | 'living_dining' | 'living_room' | 'meeting_room' | 'office' | 'optician' | 'osteopathy_clinic' | 'outdoor_garden' | 'outdoor_piscine' | 'outdoor_snowy_garden' | 'outdoor_terrace' | 'psychologist_office' | 'restaurant' | 'salle_de_sport' | 'shoe_store' | 'teenager_bedroom' | 'toilet';
10
10
  /** Rooms that can be furnished whole, without a mask (mode `auto`). */
@@ -62,6 +62,9 @@ export interface CompletedJob extends Job {
62
62
  }
63
63
  /** A public http(s) URL of a JPEG, PNG, WebP or HEIC image (100 megapixels at most). */
64
64
  export type ImageUrl = string | URL;
65
+ /** A black image with the zone painted in white, drawn on the photo: a public URL, or the image itself in base64 as
66
+ * a data URL, such as `canvas.toDataURL('image/png')` gives (5 MB at most; a black and white PNG weighs a few KB). */
67
+ export type MaskImage = string | URL;
65
68
  interface Common {
66
69
  /** The photo: a public http(s) URL. */
67
70
  url: ImageUrl;
@@ -76,8 +79,8 @@ export type DeclutterParams = Common & ({
76
79
  keepBathroom?: boolean;
77
80
  keepFireplace?: boolean;
78
81
  } | {
79
- /** A black image with the zone to remove painted in white, drawn on the photo. */
80
- mask: ImageUrl;
82
+ /** The zone to remove, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
83
+ mask: MaskImage;
81
84
  });
82
85
  export type FurnishParams = Common & ({
83
86
  /** Without a mask, the whole room is furnished: the room must have the `auto` mode in `GET /rooms`. */
@@ -85,14 +88,15 @@ export type FurnishParams = Common & ({
85
88
  roomId: OrString<KnownAutoRoomId>;
86
89
  styleId: StyleId;
87
90
  } | {
88
- /** A black image with the zone to furnish painted in white, drawn on the photo. */
89
- mask: ImageUrl;
91
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
92
+ mask: MaskImage;
90
93
  /** The zone furnished as a room (mode `zone` in `GET /rooms`). */
91
94
  roomId: OrString<KnownZoneRoomId>;
92
95
  styleId: StyleId;
93
96
  furnitureId?: undefined;
94
97
  } | {
95
- mask: ImageUrl;
98
+ /** The zone to furnish, painted in white on black: a URL, or base64 (`canvas.toDataURL('image/png')`). */
99
+ mask: MaskImage;
96
100
  /** One piece of furniture in the zone, instead of a room. */
97
101
  furnitureId: FurnitureId;
98
102
  styleId?: StyleId;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Methods and fields have the names of the API: what the docs say of an endpoint is true of the method.
6
6
  */
7
- export const VERSION = '0.1.2';
7
+ export const VERSION = '0.1.3';
8
8
  const DEFAULT_BASE_URL = 'https://europe-west1-gepettoai.cloudfunctions.net/v2';
9
9
  /** A render is stopped by the API after 450 s: 10 minutes covers it, retries included. */
10
10
  const DEFAULT_TIMEOUT_MS = 10 * 60 * 1000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gepetto/sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Official TypeScript / JavaScript SDK of the Gepetto API v2: real estate photo editing (enhance, declutter, furnish, sky, restyle, walls and floors, upscale).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",