@cravery/core 0.0.5 → 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/dist/config/index.d.ts +1 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/subscription.d.ts +2 -0
- package/dist/config/subscription.d.ts.map +1 -0
- package/dist/config/subscription.js +5 -0
- package/dist/config/subscription.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/ai/cost.d.ts.map +1 -1
- package/dist/lib/ai/cost.js +10 -1
- package/dist/lib/ai/cost.js.map +1 -1
- package/dist/lib/ai/embedding.d.ts.map +1 -1
- package/dist/lib/ai/embedding.js +6 -1
- package/dist/lib/ai/embedding.js.map +1 -1
- package/dist/lib/errors/index.d.ts +31 -0
- package/dist/lib/errors/index.d.ts.map +1 -0
- package/dist/lib/errors/index.js +70 -0
- package/dist/lib/errors/index.js.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/repository/factory.d.ts +9 -0
- package/dist/lib/repository/factory.d.ts.map +1 -0
- package/dist/lib/repository/factory.js +16 -0
- package/dist/lib/repository/factory.js.map +1 -0
- package/dist/lib/repository/index.d.ts +1 -0
- package/dist/lib/repository/index.d.ts.map +1 -1
- package/dist/lib/repository/index.js +1 -0
- package/dist/lib/repository/index.js.map +1 -1
- package/dist/lib/repository/profile.repository.d.ts +1 -1
- package/dist/lib/repository/profile.repository.d.ts.map +1 -1
- package/dist/lib/repository/profile.repository.js +1 -1
- package/dist/lib/repository/profile.repository.js.map +1 -1
- package/dist/lib/repository/user.repository.d.ts +1 -1
- package/dist/lib/repository/user.repository.d.ts.map +1 -1
- package/dist/lib/repository/user.repository.js +1 -1
- package/dist/lib/repository/user.repository.js.map +1 -1
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +16 -0
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/utils/index.d.ts +2 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +18 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/sanitize.d.ts +20 -0
- package/dist/lib/utils/sanitize.d.ts.map +1 -0
- package/dist/lib/utils/sanitize.js +40 -0
- package/dist/lib/utils/sanitize.js.map +1 -0
- package/dist/types/ai/filters.js +1 -1
- package/dist/types/ai/filters.js.map +1 -1
- package/dist/types/ai/recipe.js +5 -5
- package/dist/types/ai/recipe.js.map +1 -1
- package/dist/types/ai/translation.js +3 -3
- package/dist/types/ai/translation.js.map +1 -1
- package/dist/types/enums/allergen.d.ts +19 -0
- package/dist/types/enums/allergen.d.ts.map +1 -0
- package/dist/types/enums/allergen.js +21 -0
- package/dist/types/enums/allergen.js.map +1 -0
- package/dist/types/enums/cuisine.d.ts +39 -0
- package/dist/types/enums/cuisine.d.ts.map +1 -0
- package/dist/types/enums/cuisine.js +41 -0
- package/dist/types/enums/cuisine.js.map +1 -0
- package/dist/types/enums/dietary_tag.d.ts +21 -0
- package/dist/types/enums/dietary_tag.d.ts.map +1 -0
- package/dist/types/enums/dietary_tag.js +23 -0
- package/dist/types/enums/dietary_tag.js.map +1 -0
- package/dist/types/enums/difficulty.d.ts +10 -0
- package/dist/types/enums/difficulty.d.ts.map +1 -0
- package/dist/types/enums/difficulty.js +12 -0
- package/dist/types/enums/difficulty.js.map +1 -0
- package/dist/types/enums/image_type.d.ts +8 -0
- package/dist/types/enums/image_type.d.ts.map +1 -0
- package/dist/types/enums/image_type.js +7 -0
- package/dist/types/enums/image_type.js.map +1 -0
- package/dist/types/enums/index.d.ts +22 -0
- package/dist/types/enums/index.d.ts.map +1 -0
- package/dist/types/enums/index.js +38 -0
- package/dist/types/enums/index.js.map +1 -0
- package/dist/types/enums/locale.d.ts +11 -0
- package/dist/types/enums/locale.d.ts.map +1 -0
- package/dist/types/enums/locale.js +7 -0
- package/dist/types/enums/locale.js.map +1 -0
- package/dist/types/enums/meal_type.d.ts +14 -0
- package/dist/types/enums/meal_type.d.ts.map +1 -0
- package/dist/types/enums/meal_type.js +16 -0
- package/dist/types/enums/meal_type.js.map +1 -0
- package/dist/types/enums/moderation_status.d.ts +9 -0
- package/dist/types/enums/moderation_status.d.ts.map +1 -0
- package/dist/types/enums/moderation_status.js +11 -0
- package/dist/types/enums/moderation_status.js.map +1 -0
- package/dist/types/enums/priority.d.ts +9 -0
- package/dist/types/enums/priority.d.ts.map +1 -0
- package/dist/types/enums/priority.js +7 -0
- package/dist/types/enums/priority.js.map +1 -0
- package/dist/types/enums/profile_status.d.ts +10 -0
- package/dist/types/enums/profile_status.d.ts.map +1 -0
- package/dist/types/enums/profile_status.js +12 -0
- package/dist/types/enums/profile_status.js.map +1 -0
- package/dist/types/enums/recipe_source.d.ts +10 -0
- package/dist/types/enums/recipe_source.d.ts.map +1 -0
- package/dist/types/enums/recipe_source.js +7 -0
- package/dist/types/enums/recipe_source.js.map +1 -0
- package/dist/types/enums/recipe_status.d.ts +13 -0
- package/dist/types/enums/recipe_status.d.ts.map +1 -0
- package/dist/types/enums/recipe_status.js +15 -0
- package/dist/types/enums/recipe_status.js.map +1 -0
- package/dist/types/enums/role.d.ts +11 -0
- package/dist/types/enums/role.d.ts.map +1 -0
- package/dist/types/enums/role.js +13 -0
- package/dist/types/enums/role.js.map +1 -0
- package/dist/types/enums/severity.d.ts +9 -0
- package/dist/types/enums/severity.d.ts.map +1 -0
- package/dist/types/enums/severity.js +7 -0
- package/dist/types/enums/severity.js.map +1 -0
- package/dist/types/enums/spiciness.d.ts +10 -0
- package/dist/types/enums/spiciness.d.ts.map +1 -0
- package/dist/types/enums/spiciness.js +7 -0
- package/dist/types/enums/spiciness.js.map +1 -0
- package/dist/types/enums/status.d.ts +11 -0
- package/dist/types/enums/status.d.ts.map +1 -0
- package/dist/types/enums/status.js +13 -0
- package/dist/types/enums/status.js.map +1 -0
- package/dist/types/enums/subscription_tier.d.ts +8 -0
- package/dist/types/enums/subscription_tier.d.ts.map +1 -0
- package/dist/types/enums/subscription_tier.js +6 -0
- package/dist/types/enums/subscription_tier.js.map +1 -0
- package/dist/types/enums/suggestion_category.d.ts +11 -0
- package/dist/types/enums/suggestion_category.d.ts.map +1 -0
- package/dist/types/enums/suggestion_category.js +13 -0
- package/dist/types/enums/suggestion_category.js.map +1 -0
- package/dist/types/enums/temperature_unit.d.ts +8 -0
- package/dist/types/enums/temperature_unit.d.ts.map +1 -0
- package/dist/types/enums/temperature_unit.js +7 -0
- package/dist/types/enums/temperature_unit.js.map +1 -0
- package/dist/types/enums/unit.d.ts +43 -0
- package/dist/types/enums/unit.d.ts.map +1 -0
- package/dist/types/enums/unit.js +53 -0
- package/dist/types/enums/unit.js.map +1 -0
- package/dist/types/enums/url_type.d.ts +13 -0
- package/dist/types/enums/url_type.d.ts.map +1 -0
- package/dist/types/enums/url_type.js +15 -0
- package/dist/types/enums/url_type.js.map +1 -0
- package/dist/types/enums/user_status.d.ts +10 -0
- package/dist/types/enums/user_status.d.ts.map +1 -0
- package/dist/types/enums/user_status.js +12 -0
- package/dist/types/enums/user_status.js.map +1 -0
- package/dist/types/iam/index.d.ts +4 -0
- package/dist/types/iam/index.d.ts.map +1 -0
- package/dist/types/iam/index.js +20 -0
- package/dist/types/iam/index.js.map +1 -0
- package/dist/types/iam/profile.d.ts +30 -0
- package/dist/types/iam/profile.d.ts.map +1 -0
- package/dist/types/iam/profile.js +26 -0
- package/dist/types/iam/profile.js.map +1 -0
- package/dist/types/iam/subscription.d.ts +43 -0
- package/dist/types/iam/subscription.d.ts.map +1 -0
- package/dist/types/iam/subscription.js +22 -0
- package/dist/types/iam/subscription.js.map +1 -0
- package/dist/types/iam/user.d.ts +27 -0
- package/dist/types/iam/user.d.ts.map +1 -0
- package/dist/types/iam/user.js +18 -0
- package/dist/types/iam/user.js.map +1 -0
- package/dist/types/index.d.ts +2 -8
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -8
- package/dist/types/index.js.map +1 -1
- package/dist/types/moderation.js +1 -1
- package/dist/types/moderation.js.map +1 -1
- package/dist/types/recipe/equipment.d.ts +20 -0
- package/dist/types/recipe/equipment.d.ts.map +1 -0
- package/dist/types/recipe/equipment.js +16 -0
- package/dist/types/recipe/equipment.js.map +1 -0
- package/dist/types/recipe/index.d.ts +7 -0
- package/dist/types/recipe/index.d.ts.map +1 -0
- package/dist/types/recipe/index.js +23 -0
- package/dist/types/recipe/index.js.map +1 -0
- package/dist/types/recipe/ingredient.d.ts +209 -0
- package/dist/types/recipe/ingredient.d.ts.map +1 -0
- package/dist/types/recipe/ingredient.js +33 -0
- package/dist/types/recipe/ingredient.js.map +1 -0
- package/dist/types/recipe/instruction.d.ts +32 -0
- package/dist/types/recipe/instruction.d.ts.map +1 -0
- package/dist/types/recipe/instruction.js +16 -0
- package/dist/types/recipe/instruction.js.map +1 -0
- package/dist/types/recipe/nutrition.d.ts +18 -0
- package/dist/types/recipe/nutrition.d.ts.map +1 -0
- package/dist/types/recipe/nutrition.js +20 -0
- package/dist/types/recipe/nutrition.js.map +1 -0
- package/dist/types/recipe/recipe.d.ts +453 -0
- package/dist/types/recipe/recipe.d.ts.map +1 -0
- package/dist/types/recipe/recipe.js +82 -0
- package/dist/types/recipe/recipe.js.map +1 -0
- package/dist/types/recipe/temperature.d.ts +10 -0
- package/dist/types/recipe/temperature.d.ts.map +1 -0
- package/dist/types/recipe/temperature.js +10 -0
- package/dist/types/recipe/temperature.js.map +1 -0
- package/dist/types/response.d.ts +16 -0
- package/dist/types/response.d.ts.map +1 -0
- package/dist/types/response.js +14 -0
- package/dist/types/response.js.map +1 -0
- package/dist/types/settings.js +6 -6
- package/dist/types/settings.js.map +1 -1
- package/package.json +28 -1
- package/src/config/index.ts +1 -0
- package/src/config/subscription.ts +1 -0
- package/src/index.ts +1 -1
- package/src/lib/ai/cost.ts +10 -1
- package/src/lib/ai/embedding.ts +6 -1
- package/src/lib/errors/index.ts +79 -0
- package/src/lib/iam.ts +1 -1
- package/src/lib/index.ts +2 -0
- package/src/lib/repository/factory.ts +14 -0
- package/src/lib/repository/index.ts +1 -0
- package/src/lib/repository/profile.repository.ts +2 -2
- package/src/lib/repository/user.repository.ts +2 -2
- package/src/lib/storage.ts +18 -0
- package/src/lib/utils/index.ts +1 -0
- package/src/lib/utils/sanitize.ts +38 -0
- package/src/types/ai/filters.ts +1 -1
- package/src/types/ai/recipe.ts +5 -5
- package/src/types/ai/translation.ts +3 -3
- package/src/{enums → types/enums}/recipe_status.ts +3 -0
- package/src/types/iam/index.ts +3 -0
- package/src/types/{profile.ts → iam/profile.ts} +1 -1
- package/src/types/iam/subscription.ts +23 -0
- package/src/types/{user.ts → iam/user.ts} +2 -1
- package/src/types/index.ts +2 -8
- package/src/types/moderation.ts +2 -2
- package/src/types/{equipment.ts → recipe/equipment.ts} +1 -1
- package/src/types/recipe/index.ts +6 -0
- package/src/types/{ingredient.ts → recipe/ingredient.ts} +1 -1
- package/src/types/{recipe.ts → recipe/recipe.ts} +7 -7
- package/src/types/response.ts +30 -0
- package/src/types/settings.ts +7 -7
- package/src/types/subscription.ts +0 -13
- /package/src/{enums → types/enums}/allergen.ts +0 -0
- /package/src/{enums → types/enums}/cuisine.ts +0 -0
- /package/src/{enums → types/enums}/dietary_tag.ts +0 -0
- /package/src/{enums → types/enums}/difficulty.ts +0 -0
- /package/src/{enums → types/enums}/image_type.ts +0 -0
- /package/src/{enums → types/enums}/index.ts +0 -0
- /package/src/{enums → types/enums}/locale.ts +0 -0
- /package/src/{enums → types/enums}/meal_type.ts +0 -0
- /package/src/{enums → types/enums}/moderation_status.ts +0 -0
- /package/src/{enums → types/enums}/priority.ts +0 -0
- /package/src/{enums → types/enums}/profile_status.ts +0 -0
- /package/src/{enums → types/enums}/recipe_source.ts +0 -0
- /package/src/{enums → types/enums}/role.ts +0 -0
- /package/src/{enums → types/enums}/severity.ts +0 -0
- /package/src/{enums → types/enums}/spiciness.ts +0 -0
- /package/src/{enums → types/enums}/status.ts +0 -0
- /package/src/{enums → types/enums}/subscription_tier.ts +0 -0
- /package/src/{enums → types/enums}/suggestion_category.ts +0 -0
- /package/src/{enums → types/enums}/temperature_unit.ts +0 -0
- /package/src/{enums → types/enums}/unit.ts +0 -0
- /package/src/{enums → types/enums}/url_type.ts +0 -0
- /package/src/{enums → types/enums}/user_status.ts +0 -0
- /package/src/types/{instruction.ts → recipe/instruction.ts} +0 -0
- /package/src/types/{nutrition.ts → recipe/nutrition.ts} +0 -0
- /package/src/types/{temperature.ts → recipe/temperature.ts} +0 -0
package/dist/config/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ai"), exports);
|
|
18
18
|
__exportStar(require("./collections"), exports);
|
|
19
19
|
__exportStar(require("./common"), exports);
|
|
20
|
+
__exportStar(require("./subscription"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,gDAA8B;AAC9B,2CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,gDAA8B;AAC9B,2CAAyB;AACzB,iDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/config/subscription.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/config/subscription.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./config"), exports);
|
|
18
|
-
__exportStar(require("./enums"), exports);
|
|
18
|
+
__exportStar(require("./types/enums"), exports);
|
|
19
19
|
__exportStar(require("./lib"), exports);
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gDAA8B;AAC9B,wCAAsB;AACtB,0CAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../../src/lib/ai/cost.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,UAAU,eAAgB,SAAQ,SAAS;IACzC,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,UAAW,SAAQ,SAAS;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAe,SAAQ,SAAS;IACxC,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,UAAU,GAAG,cAAc,CAAC;AAEpE,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,
|
|
1
|
+
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../../../src/lib/ai/cost.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,UAAU,SAAS;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,UAAU,eAAgB,SAAQ,SAAS;IACzC,IAAI,EAAE,YAAY,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,UAAW,SAAQ,SAAS;IACpC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,cAAe,SAAQ,SAAS;IACxC,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,UAAU,GAAG,cAAc,CAAC;AAEpE,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,MAsD3C,CAAC"}
|
package/dist/lib/ai/cost.js
CHANGED
|
@@ -38,7 +38,16 @@ const logAIUsage = (usage) => {
|
|
|
38
38
|
for (const [key, value] of Object.entries(metrics)) {
|
|
39
39
|
updates[`${base}/models/${model.id}/${key}`] = database_1.ServerValue.increment(value);
|
|
40
40
|
}
|
|
41
|
-
db.ref()
|
|
41
|
+
db.ref()
|
|
42
|
+
.update(updates)
|
|
43
|
+
.catch((error) => {
|
|
44
|
+
console.error("[AI Usage] Failed to log usage:", {
|
|
45
|
+
flowName,
|
|
46
|
+
model: model.id,
|
|
47
|
+
cost,
|
|
48
|
+
error: error instanceof Error ? error.message : String(error),
|
|
49
|
+
});
|
|
50
|
+
});
|
|
42
51
|
return cost;
|
|
43
52
|
};
|
|
44
53
|
exports.logAIUsage = logAIUsage;
|
package/dist/lib/ai/cost.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.js","sourceRoot":"","sources":["../../../src/lib/ai/cost.ts"],"names":[],"mappings":";;;AAAA,sDAAmE;AA0B5D,MAAM,UAAU,GAAG,CAAC,KAAc,EAAU,EAAE;IACnD,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAElC,IAAI,IAAY,CAAC;IACjB,IAAI,OAA+B,CAAC;IAEpC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,YAAY;YACf,IAAI;gBACF,CAAC,KAAK,CAAC,WAAW,GAAG,OAA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,iCAAiC,EAAE;YAC/C,QAAQ;YACR,KAAK,EAAE,KAAK,CAAC,EAAE;YACf,IAAI;YACJ,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAtDW,QAAA,UAAU,cAsDrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../src/lib/ai/embedding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../src/lib/ai/embedding.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,iBAAiB,GAAU,MAAM,MAAM,EAAE,UAAU,MAAM,sBAmBrE,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,OAAO,MAAM,EACb,MAAM,MAAM,EACZ,WAAW,MAAM,EACjB,cAAa,MAAoB,kBAYlC,CAAC;AAEF,eAAO,MAAM,gBAAgB,kCAS3B,CAAC"}
|
package/dist/lib/ai/embedding.js
CHANGED
|
@@ -7,10 +7,15 @@ const firebase_2 = require("../firebase");
|
|
|
7
7
|
const genkit_1 = require("./genkit");
|
|
8
8
|
const cost_1 = require("./cost");
|
|
9
9
|
const ai_1 = require("../../config/ai");
|
|
10
|
+
const errors_1 = require("../errors");
|
|
10
11
|
const generateEmbedding = async (text, flowName) => {
|
|
11
12
|
var _a;
|
|
12
13
|
if (text.length < 1 || text.length > 7500) {
|
|
13
|
-
throw new
|
|
14
|
+
throw new errors_1.ValidationError("Text must be between 1 and 7500 characters", {
|
|
15
|
+
length: text.length,
|
|
16
|
+
minLength: 1,
|
|
17
|
+
maxLength: 7500,
|
|
18
|
+
});
|
|
14
19
|
}
|
|
15
20
|
const response = await genkit_1.ai.embed({
|
|
16
21
|
embedder: genkit_1.geminiEmbedding001,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.js","sourceRoot":"","sources":["../../../src/lib/ai/embedding.ts"],"names":[],"mappings":";;;AAAA,wDAAsD;AACtD,kDAA+D;AAC/D,0CAAwC;AACxC,qCAAkD;AAClD,iCAAoC;AACpC,wCAA4C;AAErC,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAY,EAAE,QAAgB,EAAE,EAAE;;IACxE,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;QAC1C,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"embedding.js","sourceRoot":"","sources":["../../../src/lib/ai/embedding.ts"],"names":[],"mappings":";;;AAAA,wDAAsD;AACtD,kDAA+D;AAC/D,0CAAwC;AACxC,qCAAkD;AAClD,iCAAoC;AACpC,wCAA4C;AAC5C,sCAA4C;AAErC,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAY,EAAE,QAAgB,EAAE,EAAE;;IACxE,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;QAC1C,MAAM,IAAI,wBAAe,CAAC,4CAA4C,EAAE;YACtE,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,WAAE,CAAC,KAAK,CAAC;QAC9B,QAAQ,EAAE,2BAAkB;QAC5B,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;IACH,IAAA,iBAAU,EAAC;QACT,IAAI,EAAE,WAAW;QACjB,QAAQ;QACR,KAAK,EAAE,cAAS,CAAC,kBAAkB;QACnC,UAAU,EAAE,IAAI,CAAC,MAAM;KACxB,CAAC,CAAC;IACH,OAAO,MAAA,QAAQ,CAAC,CAAC,CAAC,0CAAE,SAAS,CAAC;AAChC,CAAC,CAAC;AAnBW,QAAA,iBAAiB,qBAmB5B;AAEK,MAAM,cAAc,GAAG,KAAK,EACjC,UAAkB,EAClB,KAAa,EACb,IAAY,EACZ,QAAiB,EACjB,cAAsB,WAAW,EACjC,EAAE;IACF,MAAM,SAAS,GAAG,MAAM,IAAA,yBAAiB,EACvC,IAAI,EACJ,QAAQ,IAAI,GAAG,UAAU,YAAY,CACtC,CAAC;IACF,MAAM,oBAAS;SACZ,UAAU,CAAC,UAAU,CAAC;SACtB,GAAG,CAAC,KAAK,CAAC;SACV,MAAM,CAAC;QACN,CAAC,WAAW,CAAC,EAAE,sBAAU,CAAC,MAAM,CAAC,SAAS,CAAC;KAC5C,CAAC,CAAC;AACP,CAAC,CAAC;AAjBW,QAAA,cAAc,kBAiBzB;AAEW,QAAA,gBAAgB,GAAG,IAAA,mCAAwB,EAAC,WAAE,EAAE;IAC3D,IAAI,EAAE,kBAAkB;IACxB,SAAS,EAAT,oBAAS;IACT,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,aAAa;IAC3B,WAAW,EAAE,gBAAgB;IAC7B,QAAQ,EAAE,2BAAkB;IAC5B,eAAe,EAAE,QAAQ;IACzB,mBAAmB,EAAE,UAAU;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const APP_ERROR_CODE_VALUES: readonly ["BAD_REQUEST", "UNAUTHORIZED", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "VALIDATION_ERROR", "INTERNAL_ERROR"];
|
|
2
|
+
export type AppErrorCode = (typeof APP_ERROR_CODE_VALUES)[number];
|
|
3
|
+
export declare class AppError extends Error {
|
|
4
|
+
readonly code: AppErrorCode;
|
|
5
|
+
readonly statusCode: number;
|
|
6
|
+
readonly context?: Record<string, unknown>;
|
|
7
|
+
constructor(code: AppErrorCode, message: string, statusCode?: number, context?: Record<string, unknown>);
|
|
8
|
+
toJSON(): {
|
|
9
|
+
name: string;
|
|
10
|
+
code: "BAD_REQUEST" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "VALIDATION_ERROR" | "INTERNAL_ERROR";
|
|
11
|
+
message: string;
|
|
12
|
+
statusCode: number;
|
|
13
|
+
context: Record<string, unknown> | undefined;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare class ValidationError extends AppError {
|
|
17
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
18
|
+
}
|
|
19
|
+
export declare class NotFoundError extends AppError {
|
|
20
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
21
|
+
}
|
|
22
|
+
export declare class UnauthorizedError extends AppError {
|
|
23
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
24
|
+
}
|
|
25
|
+
export declare class ForbiddenError extends AppError {
|
|
26
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
27
|
+
}
|
|
28
|
+
export declare class ConflictError extends AppError {
|
|
29
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/errors/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,sHAQxB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElE,qBAAa,QAAS,SAAQ,KAAK;IACjC,SAAgB,IAAI,EAAE,YAAY,CAAC;IACnC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAGhD,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,MAAM,EACf,UAAU,GAAE,MAAY,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAanC,MAAM;;;;;;;CASP;AAED,qBAAa,eAAgB,SAAQ,QAAQ;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,iBAAkB,SAAQ,QAAQ;gBACjC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,cAAe,SAAQ,QAAQ;gBAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D;AAED,qBAAa,aAAc,SAAQ,QAAQ;gBAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI/D"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConflictError = exports.ForbiddenError = exports.UnauthorizedError = exports.NotFoundError = exports.ValidationError = exports.AppError = exports.APP_ERROR_CODE_VALUES = void 0;
|
|
4
|
+
exports.APP_ERROR_CODE_VALUES = [
|
|
5
|
+
"BAD_REQUEST",
|
|
6
|
+
"UNAUTHORIZED",
|
|
7
|
+
"FORBIDDEN",
|
|
8
|
+
"NOT_FOUND",
|
|
9
|
+
"CONFLICT",
|
|
10
|
+
"VALIDATION_ERROR",
|
|
11
|
+
"INTERNAL_ERROR",
|
|
12
|
+
];
|
|
13
|
+
class AppError extends Error {
|
|
14
|
+
constructor(code, message, statusCode = 500, context) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = "AppError";
|
|
17
|
+
this.code = code;
|
|
18
|
+
this.statusCode = statusCode;
|
|
19
|
+
this.context = context;
|
|
20
|
+
if (Error.captureStackTrace) {
|
|
21
|
+
Error.captureStackTrace(this, AppError);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
toJSON() {
|
|
25
|
+
return {
|
|
26
|
+
name: this.name,
|
|
27
|
+
code: this.code,
|
|
28
|
+
message: this.message,
|
|
29
|
+
statusCode: this.statusCode,
|
|
30
|
+
context: this.context,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AppError = AppError;
|
|
35
|
+
class ValidationError extends AppError {
|
|
36
|
+
constructor(message, context) {
|
|
37
|
+
super("VALIDATION_ERROR", message, 400, context);
|
|
38
|
+
this.name = "ValidationError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.ValidationError = ValidationError;
|
|
42
|
+
class NotFoundError extends AppError {
|
|
43
|
+
constructor(message, context) {
|
|
44
|
+
super("NOT_FOUND", message, 404, context);
|
|
45
|
+
this.name = "NotFoundError";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.NotFoundError = NotFoundError;
|
|
49
|
+
class UnauthorizedError extends AppError {
|
|
50
|
+
constructor(message, context) {
|
|
51
|
+
super("UNAUTHORIZED", message, 401, context);
|
|
52
|
+
this.name = "UnauthorizedError";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
56
|
+
class ForbiddenError extends AppError {
|
|
57
|
+
constructor(message, context) {
|
|
58
|
+
super("FORBIDDEN", message, 403, context);
|
|
59
|
+
this.name = "ForbiddenError";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.ForbiddenError = ForbiddenError;
|
|
63
|
+
class ConflictError extends AppError {
|
|
64
|
+
constructor(message, context) {
|
|
65
|
+
super("CONFLICT", message, 409, context);
|
|
66
|
+
this.name = "ConflictError";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.ConflictError = ConflictError;
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/errors/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACnC,aAAa;IACb,cAAc;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,kBAAkB;IAClB,gBAAgB;CACR,CAAC;AAIX,MAAa,QAAS,SAAQ,KAAK;IAKjC,YACE,IAAkB,EAClB,OAAe,EACf,aAAqB,GAAG,EACxB,OAAiC;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF;AA/BD,4BA+BC;AAED,MAAa,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,kBAAkB,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,aAAc,SAAQ,QAAQ;IACzC,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC;AAED,MAAa,iBAAkB,SAAQ,QAAQ;IAC7C,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAED,MAAa,cAAe,SAAQ,QAAQ;IAC1C,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AAED,MAAa,aAAc,SAAQ,QAAQ;IACzC,YAAY,OAAe,EAAE,OAAiC;QAC5D,KAAK,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC"}
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/lib/index.js
CHANGED
|
@@ -16,8 +16,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ai"), exports);
|
|
18
18
|
__exportStar(require("./api"), exports);
|
|
19
|
+
__exportStar(require("./errors"), exports);
|
|
19
20
|
__exportStar(require("./firebase"), exports);
|
|
20
21
|
__exportStar(require("./iam"), exports);
|
|
21
22
|
__exportStar(require("./repository"), exports);
|
|
22
23
|
__exportStar(require("./storage"), exports);
|
|
24
|
+
__exportStar(require("./utils"), exports);
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,wCAAsB;AACtB,6CAA2B;AAC3B,wCAAsB;AACtB,+CAA6B;AAC7B,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,wCAAsB;AACtB,2CAAyB;AACzB,6CAA2B;AAC3B,wCAAsB;AACtB,+CAA6B;AAC7B,4CAA0B;AAC1B,0CAAwB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UserRepository } from "./user.repository";
|
|
2
|
+
import { ProfileRepository } from "./profile.repository";
|
|
3
|
+
import { SettingsRepository } from "./settings.repository";
|
|
4
|
+
export declare const repositories: {
|
|
5
|
+
user: () => UserRepository;
|
|
6
|
+
profile: () => ProfileRepository;
|
|
7
|
+
settings: () => SettingsRepository;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/lib/repository/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAM3D,eAAO,MAAM,YAAY;;;;CAIxB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.repositories = void 0;
|
|
4
|
+
const firebase_1 = require("../firebase");
|
|
5
|
+
const user_repository_1 = require("./user.repository");
|
|
6
|
+
const profile_repository_1 = require("./profile.repository");
|
|
7
|
+
const settings_repository_1 = require("./settings.repository");
|
|
8
|
+
let userRepo = null;
|
|
9
|
+
let profileRepo = null;
|
|
10
|
+
let settingsRepo = null;
|
|
11
|
+
exports.repositories = {
|
|
12
|
+
user: () => (userRepo !== null && userRepo !== void 0 ? userRepo : (userRepo = new user_repository_1.UserRepository(firebase_1.firestore))),
|
|
13
|
+
profile: () => (profileRepo !== null && profileRepo !== void 0 ? profileRepo : (profileRepo = new profile_repository_1.ProfileRepository(firebase_1.firestore))),
|
|
14
|
+
settings: () => (settingsRepo !== null && settingsRepo !== void 0 ? settingsRepo : (settingsRepo = new settings_repository_1.SettingsRepository(firebase_1.firestore))),
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../src/lib/repository/factory.ts"],"names":[],"mappings":";;;AAAA,0CAAwC;AACxC,uDAAmD;AACnD,6DAAyD;AACzD,+DAA2D;AAE3D,IAAI,QAAQ,GAA0B,IAAI,CAAC;AAC3C,IAAI,WAAW,GAA6B,IAAI,CAAC;AACjD,IAAI,YAAY,GAA8B,IAAI,CAAC;AAEtC,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,IAAR,QAAQ,GAAK,IAAI,gCAAc,CAAC,oBAAS,CAAC,EAAC;IACxD,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,IAAX,WAAW,GAAK,IAAI,sCAAiB,CAAC,oBAAS,CAAC,EAAC;IACjE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,YAAY,aAAZ,YAAY,cAAZ,YAAY,IAAZ,YAAY,GAAK,IAAI,wCAAkB,CAAC,oBAAS,CAAC,EAAC;CACrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/repository/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/repository/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./errors"), exports);
|
|
18
|
+
__exportStar(require("./factory"), exports);
|
|
18
19
|
__exportStar(require("./firestore.repository"), exports);
|
|
19
20
|
__exportStar(require("./rtdb.repository"), exports);
|
|
20
21
|
__exportStar(require("./user.repository"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/repository/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yDAAuC;AACvC,oDAAkC;AAClC,oDAAkC;AAClC,uDAAqC;AACrC,wDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/repository/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,yDAAuC;AACvC,oDAAkC;AAClC,oDAAkC;AAClC,uDAAqC;AACrC,wDAAsC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Firestore } from "firebase-admin/firestore";
|
|
2
2
|
import { FirestoreRepository } from "./firestore.repository";
|
|
3
|
-
import type { Profile } from "../../types/profile";
|
|
3
|
+
import type { Profile } from "../../types/iam/profile";
|
|
4
4
|
export declare class ProfileRepository extends FirestoreRepository<Profile> {
|
|
5
5
|
constructor(firestore: Firestore);
|
|
6
6
|
protected validate(data: Partial<Profile>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.repository.d.ts","sourceRoot":"","sources":["../../../src/lib/repository/profile.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"profile.repository.d.ts","sourceRoot":"","sources":["../../../src/lib/repository/profile.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKvD,qBAAa,iBAAkB,SAAQ,mBAAmB,CAAC,OAAO,CAAC;gBACrD,SAAS,EAAE,SAAS;IAQhC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;IAW1C,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAQrD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAIrD,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GACxB,OAAO,CAAC,OAAO,CAAC;IAIb,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAIrD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProfileRepository = void 0;
|
|
4
4
|
const firestore_repository_1 = require("./firestore.repository");
|
|
5
|
-
const profile_1 = require("../../types/profile");
|
|
5
|
+
const profile_1 = require("../../types/iam/profile");
|
|
6
6
|
const collections_1 = require("../../config/collections");
|
|
7
7
|
const errors_1 = require("./errors");
|
|
8
8
|
class ProfileRepository extends firestore_repository_1.FirestoreRepository {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.repository.js","sourceRoot":"","sources":["../../../src/lib/repository/profile.repository.ts"],"names":[],"mappings":";;;AACA,iEAA6D;AAE7D,
|
|
1
|
+
{"version":3,"file":"profile.repository.js","sourceRoot":"","sources":["../../../src/lib/repository/profile.repository.ts"],"names":[],"mappings":";;;AACA,iEAA6D;AAE7D,qDAAwD;AACxD,0DAAuD;AACvD,qCAAgE;AAEhE,MAAa,iBAAkB,SAAQ,0CAA4B;IACjE,YAAY,SAA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
|
|
|
1
1
|
import { Firestore } from "firebase-admin/firestore";
|
|
2
2
|
import { FirestoreRepository } from "./firestore.repository";
|
|
3
|
-
import type { User } from "../../types/user";
|
|
3
|
+
import type { User } from "../../types/iam/user";
|
|
4
4
|
export declare class UserRepository extends FirestoreRepository<User> {
|
|
5
5
|
constructor(firestore: Firestore);
|
|
6
6
|
protected validate(data: Partial<User>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.repository.d.ts","sourceRoot":"","sources":["../../../src/lib/repository/user.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"user.repository.d.ts","sourceRoot":"","sources":["../../../src/lib/repository/user.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAKjD,qBAAa,cAAe,SAAQ,mBAAmB,CAAC,IAAI,CAAC;gBAC/C,SAAS,EAAE,SAAS;IAQhC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAWvC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAQhD,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhE,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAInD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserRepository = void 0;
|
|
4
4
|
const firestore_repository_1 = require("./firestore.repository");
|
|
5
|
-
const user_1 = require("../../types/user");
|
|
5
|
+
const user_1 = require("../../types/iam/user");
|
|
6
6
|
const collections_1 = require("../../config/collections");
|
|
7
7
|
const errors_1 = require("./errors");
|
|
8
8
|
class UserRepository extends firestore_repository_1.FirestoreRepository {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.repository.js","sourceRoot":"","sources":["../../../src/lib/repository/user.repository.ts"],"names":[],"mappings":";;;AACA,iEAA6D;AAE7D
|
|
1
|
+
{"version":3,"file":"user.repository.js","sourceRoot":"","sources":["../../../src/lib/repository/user.repository.ts"],"names":[],"mappings":";;;AACA,iEAA6D;AAE7D,+CAAkD;AAClD,0DAAuD;AACvD,qCAAgE;AAEhE,MAAa,cAAe,SAAQ,0CAAyB;IAC3D,YAAY,SAAoB;QAC9B,KAAK,CAAC,SAAS,EAAE,yBAAW,CAAC,KAAK,EAAE;YAClC,gBAAgB,EAAE,IAAI;YACtB,gBAAgB,EAAE,IAAI;YACtB,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC;IACL,CAAC;IAES,QAAQ,CAAC,IAAmB;QACpC,MAAM,MAAM,GAAG,iBAAU,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,wBAAe,CACvB,4BAAmB,CAAC,gBAAgB,EACpC,wBAAwB,EACxB,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAChC,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;;QAC7B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAClC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAC5C,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;QACF,OAAO,MAAA,OAAO,CAAC,CAAC,CAAC,mCAAI,IAAI,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAW,EAAE,IAAsB;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,IAAI,KAAK,IAAI,CAAC;IACvB,CAAC;CACF;AApCD,wCAoCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/lib/storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/lib/storage.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAiBD,eAAO,MAAM,oBAAoB,GAC/B,YAAY,MAAM,EAClB,MAAM,MAAM,EACZ,cAAa,MAAoB,KAChC,OAAO,CAAC,iBAAiB,CAgC3B,CAAC"}
|
package/dist/lib/storage.js
CHANGED
|
@@ -2,7 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uploadImageToStorage = void 0;
|
|
4
4
|
const storage_1 = require("firebase-admin/storage");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
function validateStoragePath(path) {
|
|
7
|
+
if (!path || path.length === 0) {
|
|
8
|
+
throw new errors_1.ValidationError("Storage path cannot be empty");
|
|
9
|
+
}
|
|
10
|
+
if (path.includes("..")) {
|
|
11
|
+
throw new errors_1.ValidationError("Storage path cannot contain '..'", { path });
|
|
12
|
+
}
|
|
13
|
+
if (path.startsWith("/")) {
|
|
14
|
+
throw new errors_1.ValidationError("Storage path cannot start with '/'", { path });
|
|
15
|
+
}
|
|
16
|
+
if (path.includes("//")) {
|
|
17
|
+
throw new errors_1.ValidationError("Storage path cannot contain '//'", { path });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
5
20
|
const uploadImageToStorage = async (base64Data, path, contentType = "image/png") => {
|
|
21
|
+
validateStoragePath(path);
|
|
6
22
|
try {
|
|
7
23
|
const bucket = (0, storage_1.getStorage)().bucket();
|
|
8
24
|
const buffer = Buffer.from(base64Data, "base64");
|
package/dist/lib/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/lib/storage.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/lib/storage.ts"],"names":[],"mappings":";;;AAAA,oDAAoD;AACpD,qCAA2C;AAO3C,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,wBAAe,CAAC,8BAA8B,CAAC,CAAC;IAC5D,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,wBAAe,CAAC,kCAAkC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1E,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,wBAAe,CAAC,oCAAoC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,wBAAe,CAAC,kCAAkC,EAAE,EAAE,IAAI,EAAE,CAAC,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|
|
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("./sanitize"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Removes HTML tags and script content from a string.
|
|
4
|
+
* Use for text fields that should not contain HTML (descriptions, bios, etc.)
|
|
5
|
+
*/
|
|
6
|
+
export declare function sanitizeText(text: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Zod string schema that sanitizes HTML on transformation.
|
|
9
|
+
* Use in schemas where text input needs to be cleaned.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const BioSchema = sanitizedString(z.string().max(280));
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizedString<T extends z.ZodString>(schema: T): z.ZodPipe<T, z.ZodTransform<string, z.core.output<T>>>;
|
|
15
|
+
/**
|
|
16
|
+
* Escapes HTML special characters to prevent XSS.
|
|
17
|
+
* Use when HTML needs to be displayed as text.
|
|
18
|
+
*/
|
|
19
|
+
export declare function escapeHtml(text: string): string;
|
|
20
|
+
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKjD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,0DAE/D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS/C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sanitizeText = sanitizeText;
|
|
4
|
+
exports.sanitizedString = sanitizedString;
|
|
5
|
+
exports.escapeHtml = escapeHtml;
|
|
6
|
+
/**
|
|
7
|
+
* Removes HTML tags and script content from a string.
|
|
8
|
+
* Use for text fields that should not contain HTML (descriptions, bios, etc.)
|
|
9
|
+
*/
|
|
10
|
+
function sanitizeText(text) {
|
|
11
|
+
return text
|
|
12
|
+
.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "")
|
|
13
|
+
.replace(/<[^>]*>/g, "")
|
|
14
|
+
.trim();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a Zod string schema that sanitizes HTML on transformation.
|
|
18
|
+
* Use in schemas where text input needs to be cleaned.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* const BioSchema = sanitizedString(z.string().max(280));
|
|
22
|
+
*/
|
|
23
|
+
function sanitizedString(schema) {
|
|
24
|
+
return schema.transform(sanitizeText);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Escapes HTML special characters to prevent XSS.
|
|
28
|
+
* Use when HTML needs to be displayed as text.
|
|
29
|
+
*/
|
|
30
|
+
function escapeHtml(text) {
|
|
31
|
+
const htmlEscapes = {
|
|
32
|
+
"&": "&",
|
|
33
|
+
"<": "<",
|
|
34
|
+
">": ">",
|
|
35
|
+
'"': """,
|
|
36
|
+
"'": "'",
|
|
37
|
+
};
|
|
38
|
+
return text.replace(/[&<>"']/g, (char) => htmlEscapes[char]);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=sanitize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../../../src/lib/utils/sanitize.ts"],"names":[],"mappings":";;AAMA,oCAKC;AASD,0CAEC;AAMD,gCASC;AAnCD;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI;SACR,OAAO,CAAC,qDAAqD,EAAE,EAAE,CAAC;SAClE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,IAAI,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAwB,MAAS;IAC9D,OAAO,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,MAAM,WAAW,GAA2B;QAC1C,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,QAAQ;QACb,GAAG,EAAE,OAAO;KACb,CAAC;IACF,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"}
|
package/dist/types/ai/filters.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RecipeFiltersSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const enums_1 = require("
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
6
|
exports.RecipeFiltersSchema = zod_1.z.object({
|
|
7
7
|
cuisines: zod_1.z.array(enums_1.CuisineSchema).optional(),
|
|
8
8
|
dietaryTags: zod_1.z.array(enums_1.DietaryTagSchema).optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../src/types/ai/filters.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../src/types/ai/filters.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAMkB;AAEL,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,qBAAa,CAAC,CAAC,QAAQ,EAAE;IAC3C,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,wBAAgB,CAAC,CAAC,QAAQ,EAAE;IACjD,UAAU,EAAE,wBAAgB,CAAC,QAAQ,EAAE;IACvC,kBAAkB,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAClD,kBAAkB,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAClD,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,sBAAc,CAAC,CAAC,QAAQ,EAAE;IAC7C,SAAS,EAAE,uBAAe,CAAC,QAAQ,EAAE;IACrC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACvD,CAAC,CAAC"}
|
package/dist/types/ai/recipe.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AIRecipeSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const enums_1 = require("
|
|
6
|
-
const equipment_1 = require("../equipment");
|
|
7
|
-
const ingredient_1 = require("../ingredient");
|
|
8
|
-
const instruction_1 = require("../instruction");
|
|
9
|
-
const nutrition_1 = require("../nutrition");
|
|
5
|
+
const enums_1 = require("../enums");
|
|
6
|
+
const equipment_1 = require("../recipe/equipment");
|
|
7
|
+
const ingredient_1 = require("../recipe/ingredient");
|
|
8
|
+
const instruction_1 = require("../recipe/instruction");
|
|
9
|
+
const nutrition_1 = require("../recipe/nutrition");
|
|
10
10
|
exports.AIRecipeSchema = zod_1.z.object({
|
|
11
11
|
allergens: zod_1.z.array(enums_1.AllergenSchema),
|
|
12
12
|
confidence: zod_1.z.number().min(0).max(1),
|