@purpleschool/multisite 0.0.6 → 0.0.7
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/api/controller/http/image-editor.ts +0 -1
- package/api/controller/http/image-generation.ts +0 -1
- package/api/routes.ts +0 -2
- package/build/api/controller/http/image-editor.d.ts +0 -1
- package/build/api/controller/http/image-editor.d.ts.map +1 -1
- package/build/api/controller/http/image-editor.js +0 -1
- package/build/api/controller/http/image-generation.d.ts +0 -1
- package/build/api/controller/http/image-generation.d.ts.map +1 -1
- package/build/api/controller/http/image-generation.js +0 -1
- package/build/api/routes.d.ts +0 -2
- package/build/api/routes.d.ts.map +1 -1
- package/build/api/routes.js +0 -2
- package/build/helpers/image-editor/calculate-image-editor-price.helper.d.ts +7 -0
- package/build/helpers/image-editor/calculate-image-editor-price.helper.d.ts.map +1 -0
- package/build/helpers/image-editor/calculate-image-editor-price.helper.js +13 -0
- package/build/helpers/image-editor/index.d.ts +2 -0
- package/build/helpers/image-editor/index.d.ts.map +1 -0
- package/build/helpers/image-editor/index.js +17 -0
- package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts +8 -0
- package/build/helpers/image-generation/calculate-image-generation-price.helper.d.ts.map +1 -0
- package/build/helpers/image-generation/calculate-image-generation-price.helper.js +16 -0
- package/build/helpers/image-generation/index.d.ts +2 -0
- package/build/helpers/image-generation/index.d.ts.map +1 -0
- package/build/helpers/image-generation/index.js +17 -0
- package/build/helpers/index.d.ts +3 -0
- package/build/helpers/index.d.ts.map +1 -0
- package/build/helpers/index.js +18 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/queries/image-editor/index.d.ts +0 -1
- package/build/queries/image-editor/index.d.ts.map +1 -1
- package/build/queries/image-editor/index.js +0 -1
- package/build/queries/image-generation/index.d.ts +0 -1
- package/build/queries/image-generation/index.d.ts.map +1 -1
- package/build/queries/image-generation/index.js +0 -1
- package/helpers/image-editor/calculate-image-editor-price.helper.ts +23 -0
- package/helpers/image-editor/index.ts +1 -0
- package/helpers/image-generation/calculate-image-generation-price.helper.ts +29 -0
- package/helpers/image-generation/index.ts +1 -0
- package/helpers/index.ts +2 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/queries/image-editor/index.ts +0 -1
- package/queries/image-generation/index.ts +0 -1
- package/build/queries/image-editor/get-image-editor-price.command.d.ts +0 -53
- package/build/queries/image-editor/get-image-editor-price.command.d.ts.map +0 -1
- package/build/queries/image-editor/get-image-editor-price.command.js +0 -17
- package/build/queries/image-generation/get-image-generation-price.command.d.ts +0 -44
- package/build/queries/image-generation/get-image-generation-price.command.d.ts.map +0 -1
- package/build/queries/image-generation/get-image-generation-price.command.js +0 -19
- package/queries/image-editor/get-image-editor-price.command.ts +0 -17
- package/queries/image-generation/get-image-generation-price.command.ts +0 -19
package/api/routes.ts
CHANGED
|
@@ -49,7 +49,6 @@ export const REST_API = {
|
|
|
49
49
|
},
|
|
50
50
|
IMAGE_GENERATION_PUBLIC: {
|
|
51
51
|
CONFIG: `${ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.CONFIG}`,
|
|
52
|
-
PRICE: `${ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.PRICE}`,
|
|
53
52
|
EXECUTE: `${ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.EXECUTE}`,
|
|
54
53
|
LIST_JOBS: `${ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.GET_JOBS}`,
|
|
55
54
|
GET_JOB: (uuid: string) =>
|
|
@@ -120,7 +119,6 @@ export const REST_API = {
|
|
|
120
119
|
},
|
|
121
120
|
IMAGE_EDITOR_PUBLIC: {
|
|
122
121
|
CONFIG: `${ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.CONFIG}`,
|
|
123
|
-
PRICE: `${ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.PRICE}`,
|
|
124
122
|
EXECUTE: `${ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.EXECUTE}`,
|
|
125
123
|
LIST_JOBS: `${ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.GET_JOBS}`,
|
|
126
124
|
GET_JOB: (uuid: string) =>
|
|
@@ -2,7 +2,6 @@ export declare const IMAGE_EDITOR_PRIVATE_CONTROLLER: "image-editor/private";
|
|
|
2
2
|
export declare const IMAGE_EDITOR_PUBLIC_CONTROLLER: "image-editor/public";
|
|
3
3
|
export declare const IMAGE_EDITOR_ROUTES: {
|
|
4
4
|
readonly CONFIG: "config";
|
|
5
|
-
readonly PRICE: "price";
|
|
6
5
|
readonly EXECUTE: "execute";
|
|
7
6
|
readonly GET_JOBS: "jobs";
|
|
8
7
|
readonly GET_JOB: (uuid: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-editor.d.ts","sourceRoot":"","sources":["../../../../api/controller/http/image-editor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,EAAG,sBAA+B,CAAC;AAC/E,eAAO,MAAM,8BAA8B,EAAG,qBAA8B,CAAC;AAE7E,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"image-editor.d.ts","sourceRoot":"","sources":["../../../../api/controller/http/image-editor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,+BAA+B,EAAG,sBAA+B,CAAC;AAC/E,eAAO,MAAM,8BAA8B,EAAG,qBAA8B,CAAC;AAE7E,eAAO,MAAM,mBAAmB;;;;6BAIZ,MAAM;4BACP,MAAM;kCACA,MAAM;4BACZ,MAAM;;2BAEP,MAAM;CACd,CAAC"}
|
|
@@ -5,7 +5,6 @@ exports.IMAGE_EDITOR_PRIVATE_CONTROLLER = 'image-editor/private';
|
|
|
5
5
|
exports.IMAGE_EDITOR_PUBLIC_CONTROLLER = 'image-editor/public';
|
|
6
6
|
exports.IMAGE_EDITOR_ROUTES = {
|
|
7
7
|
CONFIG: 'config',
|
|
8
|
-
PRICE: 'price',
|
|
9
8
|
EXECUTE: 'execute',
|
|
10
9
|
GET_JOBS: 'jobs',
|
|
11
10
|
GET_JOB: (uuid) => `jobs/${uuid}`,
|
|
@@ -2,7 +2,6 @@ export declare const IMAGE_GENERATION_PRIVATE_CONTROLLER: "image-generation/priv
|
|
|
2
2
|
export declare const IMAGE_GENERATION_PUBLIC_CONTROLLER: "image-generation/public";
|
|
3
3
|
export declare const IMAGE_GENERATION_ROUTES: {
|
|
4
4
|
readonly CONFIG: "config";
|
|
5
|
-
readonly PRICE: "price";
|
|
6
5
|
readonly EXECUTE: "execute";
|
|
7
6
|
readonly GET_JOBS: "jobs";
|
|
8
7
|
readonly GET_JOB: (uuid: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-generation.d.ts","sourceRoot":"","sources":["../../../../api/controller/http/image-generation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,EAAG,0BAAmC,CAAC;AACvF,eAAO,MAAM,kCAAkC,EAAG,yBAAkC,CAAC;AAErF,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"image-generation.d.ts","sourceRoot":"","sources":["../../../../api/controller/http/image-generation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,EAAG,0BAAmC,CAAC;AACvF,eAAO,MAAM,kCAAkC,EAAG,yBAAkC,CAAC;AAErF,eAAO,MAAM,uBAAuB;;;;6BAIhB,MAAM;4BACP,MAAM;kCACA,MAAM;4BACZ,MAAM;;2BAEP,MAAM;CACd,CAAC"}
|
|
@@ -5,7 +5,6 @@ exports.IMAGE_GENERATION_PRIVATE_CONTROLLER = 'image-generation/private';
|
|
|
5
5
|
exports.IMAGE_GENERATION_PUBLIC_CONTROLLER = 'image-generation/public';
|
|
6
6
|
exports.IMAGE_GENERATION_ROUTES = {
|
|
7
7
|
CONFIG: 'config',
|
|
8
|
-
PRICE: 'price',
|
|
9
8
|
EXECUTE: 'execute',
|
|
10
9
|
GET_JOBS: 'jobs',
|
|
11
10
|
GET_JOB: (uuid) => `jobs/${uuid}`,
|
package/build/api/routes.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ export declare const REST_API: {
|
|
|
43
43
|
};
|
|
44
44
|
readonly IMAGE_GENERATION_PUBLIC: {
|
|
45
45
|
readonly CONFIG: "/api/image-generation/public/config";
|
|
46
|
-
readonly PRICE: "/api/image-generation/public/price";
|
|
47
46
|
readonly EXECUTE: "/api/image-generation/public/execute";
|
|
48
47
|
readonly LIST_JOBS: "/api/image-generation/public/jobs";
|
|
49
48
|
readonly GET_JOB: (uuid: string) => string;
|
|
@@ -94,7 +93,6 @@ export declare const REST_API: {
|
|
|
94
93
|
};
|
|
95
94
|
readonly IMAGE_EDITOR_PUBLIC: {
|
|
96
95
|
readonly CONFIG: "/api/image-editor/public/config";
|
|
97
|
-
readonly PRICE: "/api/image-editor/public/price";
|
|
98
96
|
readonly EXECUTE: "/api/image-editor/public/execute";
|
|
99
97
|
readonly LIST_JOBS: "/api/image-editor/public/jobs";
|
|
100
98
|
readonly GET_JOB: (uuid: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../api/routes.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,EAAG,MAAe,CAAC;AAEpC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA2BD,MAAM;;;;;;;6BAQN,MAAM;;;;;;kCAOD,MAAM
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../api/routes.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,EAAG,MAAe,CAAC;AAEpC,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA2BD,MAAM;;;;;;;6BAQN,MAAM;;;;;;kCAOD,MAAM;;;;;;iCAOP,MAAM;gCAEP,MAAM;sCAEA,MAAM;gCAEZ,MAAM;;+BAGP,MAAM;;;;;;iCAOJ,MAAM;gCAEP,MAAM;sCAEA,MAAM;gCAEZ,MAAM;;+BAGP,MAAM;;;;;;;iCAQJ,MAAM;+BAER,MAAM;sCAEC,MAAM;gCAEZ,MAAM;gCAEN,MAAM;;;;;;;;iCASL,MAAM;+BAER,MAAM;sCAEC,MAAM;gCAEZ,MAAM;gCAEN,MAAM;;;;;;;;;;;iCAYL,MAAM;gCAEP,MAAM;sCAEA,MAAM;gCAEZ,MAAM;;+BAGP,MAAM;;;;;;iCAOJ,MAAM;gCAEP,MAAM;sCAEA,MAAM;gCAEZ,MAAM;;+BAGP,MAAM;;;;;6BAMR,MAAM;;;;;6BAKN,MAAM;;;;;;;;sCAQG,MAAM;wCAEJ,MAAM;;gCAGd,MAAM;gCAEN,MAAM;iDAEW,MAAM;;;;sCAKjB,MAAM;;gCAGZ,MAAM;gCAEN,MAAM;;CAGnB,CAAC"}
|
package/build/api/routes.js
CHANGED
|
@@ -80,7 +80,6 @@ exports.REST_API = {
|
|
|
80
80
|
},
|
|
81
81
|
IMAGE_GENERATION_PUBLIC: {
|
|
82
82
|
CONFIG: `${exports.ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.CONFIG}`,
|
|
83
|
-
PRICE: `${exports.ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.PRICE}`,
|
|
84
83
|
EXECUTE: `${exports.ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.EXECUTE}`,
|
|
85
84
|
LIST_JOBS: `${exports.ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.GET_JOBS}`,
|
|
86
85
|
GET_JOB: (uuid) => `${exports.ROOT}/${CONTROLLERS.IMAGE_GENERATION_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_GENERATION_ROUTES.GET_JOB(uuid)}`,
|
|
@@ -131,7 +130,6 @@ exports.REST_API = {
|
|
|
131
130
|
},
|
|
132
131
|
IMAGE_EDITOR_PUBLIC: {
|
|
133
132
|
CONFIG: `${exports.ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.CONFIG}`,
|
|
134
|
-
PRICE: `${exports.ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.PRICE}`,
|
|
135
133
|
EXECUTE: `${exports.ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.EXECUTE}`,
|
|
136
134
|
LIST_JOBS: `${exports.ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.GET_JOBS}`,
|
|
137
135
|
GET_JOB: (uuid) => `${exports.ROOT}/${CONTROLLERS.IMAGE_EDITOR_PUBLIC_CONTROLLER}/${CONTROLLERS.IMAGE_EDITOR_ROUTES.GET_JOB(uuid)}`,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ImageEditorPricingRules } from '../../models';
|
|
2
|
+
export declare function calculateImageEditorPrice({ basePrice, userHasActiveSubscriptionOrProduct, rules, }: {
|
|
3
|
+
basePrice: number;
|
|
4
|
+
userHasActiveSubscriptionOrProduct: boolean;
|
|
5
|
+
rules: ImageEditorPricingRules;
|
|
6
|
+
}): number;
|
|
7
|
+
//# sourceMappingURL=calculate-image-editor-price.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-image-editor-price.helper.d.ts","sourceRoot":"","sources":["../../../helpers/image-editor/calculate-image-editor-price.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,wBAAgB,yBAAyB,CAAC,EACtC,SAAS,EACT,kCAAkC,EAClC,KAAK,GACR,EAAE;IACC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC,EAAE,OAAO,CAAC;IAC5C,KAAK,EAAE,uBAAuB,CAAC;CAClC,GAAG,MAAM,CAYT"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateImageEditorPrice = calculateImageEditorPrice;
|
|
4
|
+
function calculateImageEditorPrice({ basePrice, userHasActiveSubscriptionOrProduct, rules, }) {
|
|
5
|
+
let price = basePrice;
|
|
6
|
+
for (const rule of rules !== null && rules !== void 0 ? rules : []) {
|
|
7
|
+
const condition = rule.condition;
|
|
8
|
+
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
9
|
+
price += rule.value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return price;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../helpers/image-editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./calculate-image-editor-price.helper"), exports);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ImageGenerationJobParams, ImageGenerationPricingRules } from '../../models';
|
|
2
|
+
export declare function calculateImageGenerationPrice({ basePrice, params, userHasActiveSubscriptionOrProduct, rules, }: {
|
|
3
|
+
basePrice: number;
|
|
4
|
+
params: Pick<ImageGenerationJobParams, 'resolution'>;
|
|
5
|
+
userHasActiveSubscriptionOrProduct: boolean;
|
|
6
|
+
rules: ImageGenerationPricingRules;
|
|
7
|
+
}): number;
|
|
8
|
+
//# sourceMappingURL=calculate-image-generation-price.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculate-image-generation-price.helper.d.ts","sourceRoot":"","sources":["../../../helpers/image-generation/calculate-image-generation-price.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAErF,wBAAgB,6BAA6B,CAAC,EAC1C,SAAS,EACT,MAAM,EACN,kCAAkC,EAClC,KAAK,GACR,EAAE;IACC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,YAAY,CAAC,CAAC;IACrD,kCAAkC,EAAE,OAAO,CAAC;IAC5C,KAAK,EAAE,2BAA2B,CAAC;CACtC,GAAG,MAAM,CAgBT"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.calculateImageGenerationPrice = calculateImageGenerationPrice;
|
|
4
|
+
function calculateImageGenerationPrice({ basePrice, params, userHasActiveSubscriptionOrProduct, rules, }) {
|
|
5
|
+
let price = basePrice;
|
|
6
|
+
for (const rule of rules !== null && rules !== void 0 ? rules : []) {
|
|
7
|
+
const condition = rule.condition;
|
|
8
|
+
if (condition.resolution && condition.resolution === params.resolution) {
|
|
9
|
+
price += rule.value;
|
|
10
|
+
}
|
|
11
|
+
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
12
|
+
price += rule.value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return price;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../helpers/image-generation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./calculate-image-generation-price.helper"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./image-generation"), exports);
|
|
18
|
+
__exportStar(require("./image-editor"), exports);
|
package/build/index.d.ts
CHANGED
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-editor/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC"}
|
|
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./get-image-editor-config.command"), exports);
|
|
18
18
|
__exportStar(require("./get-image-editor-job.command"), exports);
|
|
19
19
|
__exportStar(require("./find-image-editor-jobs.command"), exports);
|
|
20
|
-
__exportStar(require("./get-image-editor-price.command"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-generation/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../queries/image-generation/index.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC"}
|
|
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./get-image-generation-config.command"), exports);
|
|
18
18
|
__exportStar(require("./get-image-generation-job.command"), exports);
|
|
19
19
|
__exportStar(require("./find-image-generation-jobs.command"), exports);
|
|
20
|
-
__exportStar(require("./get-image-generation-price.command"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ImageEditorPricingRules } from '../../models';
|
|
2
|
+
|
|
3
|
+
export function calculateImageEditorPrice({
|
|
4
|
+
basePrice,
|
|
5
|
+
userHasActiveSubscriptionOrProduct,
|
|
6
|
+
rules,
|
|
7
|
+
}: {
|
|
8
|
+
basePrice: number;
|
|
9
|
+
userHasActiveSubscriptionOrProduct: boolean;
|
|
10
|
+
rules: ImageEditorPricingRules;
|
|
11
|
+
}): number {
|
|
12
|
+
let price = basePrice;
|
|
13
|
+
|
|
14
|
+
for (const rule of rules ?? []) {
|
|
15
|
+
const condition = rule.condition;
|
|
16
|
+
|
|
17
|
+
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
18
|
+
price += rule.value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return price;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-image-editor-price.helper';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ImageGenerationJobParams, ImageGenerationPricingRules } from '../../models';
|
|
2
|
+
|
|
3
|
+
export function calculateImageGenerationPrice({
|
|
4
|
+
basePrice,
|
|
5
|
+
params,
|
|
6
|
+
userHasActiveSubscriptionOrProduct,
|
|
7
|
+
rules,
|
|
8
|
+
}: {
|
|
9
|
+
basePrice: number;
|
|
10
|
+
params: Pick<ImageGenerationJobParams, 'resolution'>;
|
|
11
|
+
userHasActiveSubscriptionOrProduct: boolean;
|
|
12
|
+
rules: ImageGenerationPricingRules;
|
|
13
|
+
}): number {
|
|
14
|
+
let price = basePrice;
|
|
15
|
+
|
|
16
|
+
for (const rule of rules ?? []) {
|
|
17
|
+
const condition = rule.condition;
|
|
18
|
+
|
|
19
|
+
if (condition.resolution && condition.resolution === params.resolution) {
|
|
20
|
+
price += rule.value;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (condition.withoutSub && userHasActiveSubscriptionOrProduct === false) {
|
|
24
|
+
price += rule.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return price;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-image-generation-price.helper';
|
package/helpers/index.ts
ADDED
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare namespace GetImageEditorPriceCommand {
|
|
3
|
-
const RequestSchema: z.ZodObject<{
|
|
4
|
-
modelId: z.ZodString;
|
|
5
|
-
params: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
6
|
-
imageUrls: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
7
|
-
systemPromptId: z.ZodOptional<z.ZodString>;
|
|
8
|
-
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
imageUrls: string[];
|
|
11
|
-
aspectRatio?: string | undefined;
|
|
12
|
-
systemPromptId?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
aspectRatio?: string | undefined;
|
|
15
|
-
imageUrls?: string[] | undefined;
|
|
16
|
-
systemPromptId?: string | undefined;
|
|
17
|
-
}>>>;
|
|
18
|
-
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
params: {
|
|
20
|
-
imageUrls: string[];
|
|
21
|
-
aspectRatio?: string | undefined;
|
|
22
|
-
systemPromptId?: string | undefined;
|
|
23
|
-
};
|
|
24
|
-
modelId: string;
|
|
25
|
-
}, {
|
|
26
|
-
modelId: string;
|
|
27
|
-
params?: {
|
|
28
|
-
aspectRatio?: string | undefined;
|
|
29
|
-
imageUrls?: string[] | undefined;
|
|
30
|
-
systemPromptId?: string | undefined;
|
|
31
|
-
} | undefined;
|
|
32
|
-
}>;
|
|
33
|
-
type Request = z.infer<typeof RequestSchema>;
|
|
34
|
-
const ResponseSchema: z.ZodObject<{
|
|
35
|
-
data: z.ZodObject<{
|
|
36
|
-
price: z.ZodNumber;
|
|
37
|
-
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
price: number;
|
|
39
|
-
}, {
|
|
40
|
-
price: number;
|
|
41
|
-
}>;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
data: {
|
|
44
|
-
price: number;
|
|
45
|
-
};
|
|
46
|
-
}, {
|
|
47
|
-
data: {
|
|
48
|
-
price: number;
|
|
49
|
-
};
|
|
50
|
-
}>;
|
|
51
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=get-image-editor-price.command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-image-editor-price.command.d.ts","sourceRoot":"","sources":["../../../queries/image-editor/get-image-editor-price.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,yBAAiB,0BAA0B,CAAC;IACjC,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAGxB,CAAC;IACH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetImageEditorPriceCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const models_1 = require("../../models");
|
|
6
|
-
var GetImageEditorPriceCommand;
|
|
7
|
-
(function (GetImageEditorPriceCommand) {
|
|
8
|
-
GetImageEditorPriceCommand.RequestSchema = zod_1.z.object({
|
|
9
|
-
modelId: zod_1.z.string().uuid(),
|
|
10
|
-
params: models_1.ImageEditorJobRequestParamsSchema.optional().default({ imageUrls: [] }),
|
|
11
|
-
});
|
|
12
|
-
GetImageEditorPriceCommand.ResponseSchema = zod_1.z.object({
|
|
13
|
-
data: zod_1.z.object({
|
|
14
|
-
price: zod_1.z.number().int().nonnegative(),
|
|
15
|
-
}),
|
|
16
|
-
});
|
|
17
|
-
})(GetImageEditorPriceCommand || (exports.GetImageEditorPriceCommand = GetImageEditorPriceCommand = {}));
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
|
|
3
|
-
export declare namespace GetImageGenerationPriceCommand {
|
|
4
|
-
const RequestSchema: z.ZodObject<{
|
|
5
|
-
modelId: z.ZodString;
|
|
6
|
-
params: z.ZodObject<{
|
|
7
|
-
resolution: z.ZodOptional<z.ZodNativeEnum<typeof IMAGE_GENERATION_RESOLUTION>>;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
9
|
-
resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
|
|
10
|
-
}, {
|
|
11
|
-
resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
|
|
12
|
-
}>;
|
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
params: {
|
|
15
|
-
resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
|
|
16
|
-
};
|
|
17
|
-
modelId: string;
|
|
18
|
-
}, {
|
|
19
|
-
params: {
|
|
20
|
-
resolution?: IMAGE_GENERATION_RESOLUTION | undefined;
|
|
21
|
-
};
|
|
22
|
-
modelId: string;
|
|
23
|
-
}>;
|
|
24
|
-
type Request = z.infer<typeof RequestSchema>;
|
|
25
|
-
const ResponseSchema: z.ZodObject<{
|
|
26
|
-
data: z.ZodObject<{
|
|
27
|
-
price: z.ZodNumber;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
price: number;
|
|
30
|
-
}, {
|
|
31
|
-
price: number;
|
|
32
|
-
}>;
|
|
33
|
-
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
data: {
|
|
35
|
-
price: number;
|
|
36
|
-
};
|
|
37
|
-
}, {
|
|
38
|
-
data: {
|
|
39
|
-
price: number;
|
|
40
|
-
};
|
|
41
|
-
}>;
|
|
42
|
-
type Response = z.infer<typeof ResponseSchema>;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=get-image-generation-price.command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-image-generation-price.command.d.ts","sourceRoot":"","sources":["../../../queries/image-generation/get-image-generation-price.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,yBAAiB,8BAA8B,CAAC;IACrC,MAAM,aAAa;;;;;;;;;;;;;;;;;;;MAKxB,CAAC;IACH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IACH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetImageGenerationPriceCommand = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
6
|
-
var GetImageGenerationPriceCommand;
|
|
7
|
-
(function (GetImageGenerationPriceCommand) {
|
|
8
|
-
GetImageGenerationPriceCommand.RequestSchema = zod_1.z.object({
|
|
9
|
-
modelId: zod_1.z.string().uuid(),
|
|
10
|
-
params: zod_1.z.object({
|
|
11
|
-
resolution: zod_1.z.nativeEnum(constants_1.IMAGE_GENERATION_RESOLUTION).optional(),
|
|
12
|
-
}),
|
|
13
|
-
});
|
|
14
|
-
GetImageGenerationPriceCommand.ResponseSchema = zod_1.z.object({
|
|
15
|
-
data: zod_1.z.object({
|
|
16
|
-
price: zod_1.z.number().int().nonnegative(),
|
|
17
|
-
}),
|
|
18
|
-
});
|
|
19
|
-
})(GetImageGenerationPriceCommand || (exports.GetImageGenerationPriceCommand = GetImageGenerationPriceCommand = {}));
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ImageEditorJobRequestParamsSchema } from '../../models';
|
|
3
|
-
|
|
4
|
-
export namespace GetImageEditorPriceCommand {
|
|
5
|
-
export const RequestSchema = z.object({
|
|
6
|
-
modelId: z.string().uuid(),
|
|
7
|
-
params: ImageEditorJobRequestParamsSchema.optional().default({ imageUrls: [] }),
|
|
8
|
-
});
|
|
9
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
-
|
|
11
|
-
export const ResponseSchema = z.object({
|
|
12
|
-
data: z.object({
|
|
13
|
-
price: z.number().int().nonnegative(),
|
|
14
|
-
}),
|
|
15
|
-
});
|
|
16
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
17
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { IMAGE_GENERATION_RESOLUTION } from '../../constants';
|
|
3
|
-
|
|
4
|
-
export namespace GetImageGenerationPriceCommand {
|
|
5
|
-
export const RequestSchema = z.object({
|
|
6
|
-
modelId: z.string().uuid(),
|
|
7
|
-
params: z.object({
|
|
8
|
-
resolution: z.nativeEnum(IMAGE_GENERATION_RESOLUTION).optional(),
|
|
9
|
-
}),
|
|
10
|
-
});
|
|
11
|
-
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
-
|
|
13
|
-
export const ResponseSchema = z.object({
|
|
14
|
-
data: z.object({
|
|
15
|
-
price: z.number().int().nonnegative(),
|
|
16
|
-
}),
|
|
17
|
-
});
|
|
18
|
-
export type Response = z.infer<typeof ResponseSchema>;
|
|
19
|
-
}
|