@cravery/core 0.0.64 → 0.0.66

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.
Files changed (37) hide show
  1. package/dist/types/access/index.d.ts +4 -0
  2. package/dist/types/access/index.d.ts.map +1 -0
  3. package/dist/types/access/index.js +20 -0
  4. package/dist/types/access/index.js.map +1 -0
  5. package/dist/types/access/limits.d.ts +5 -0
  6. package/dist/types/access/limits.d.ts.map +1 -0
  7. package/dist/types/access/limits.js +3 -0
  8. package/dist/types/access/limits.js.map +1 -0
  9. package/dist/types/access/operation.d.ts +3 -0
  10. package/dist/types/access/operation.d.ts.map +1 -0
  11. package/dist/types/access/operation.js +12 -0
  12. package/dist/types/access/operation.js.map +1 -0
  13. package/dist/types/access/usage.d.ts +8 -0
  14. package/dist/types/access/usage.d.ts.map +1 -0
  15. package/dist/types/access/usage.js +3 -0
  16. package/dist/types/access/usage.js.map +1 -0
  17. package/dist/types/index.d.ts +1 -0
  18. package/dist/types/index.d.ts.map +1 -1
  19. package/dist/types/index.js +1 -0
  20. package/dist/types/index.js.map +1 -1
  21. package/dist/types/reports/category.d.ts +1 -1
  22. package/dist/types/reports/category.d.ts.map +1 -1
  23. package/dist/types/reports/category.js +4 -2
  24. package/dist/types/reports/category.js.map +1 -1
  25. package/dist/types/reports/target.d.ts +6 -1
  26. package/dist/types/reports/target.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/types/access/index.ts +3 -0
  29. package/src/types/access/limits.ts +6 -0
  30. package/src/types/access/operation.ts +10 -0
  31. package/src/types/access/usage.ts +9 -0
  32. package/src/types/core/pagination.ts +15 -15
  33. package/src/types/index.ts +1 -0
  34. package/src/types/reports/category.ts +4 -2
  35. package/src/types/reports/target.ts +11 -0
  36. package/src/types/users/request.ts +12 -12
  37. package/src/types/users/request_status.ts +7 -7
@@ -0,0 +1,4 @@
1
+ export * from "./limits";
2
+ export * from "./operation";
3
+ export * from "./usage";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/access/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,20 @@
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("./limits"), exports);
18
+ __exportStar(require("./operation"), exports);
19
+ __exportStar(require("./usage"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/access/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB"}
@@ -0,0 +1,5 @@
1
+ import { SubscriptionTier } from "../subscriptions";
2
+ import { Operation } from "./operation";
3
+ export type TierLimits = Record<SubscriptionTier, number>;
4
+ export type LimitsConfig = Record<Operation, TierLimits>;
5
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../../../src/types/access/limits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.js","sourceRoot":"","sources":["../../../src/types/access/limits.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export declare const OPERATION_VALUES: readonly ["recipeFromUrl", "recipeFromImage", "recipeFromText", "scanIngredients", "scanEquipment", "mealPlan"];
2
+ export type Operation = (typeof OPERATION_VALUES)[number];
3
+ //# sourceMappingURL=operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../src/types/access/operation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,iHAOnB,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OPERATION_VALUES = void 0;
4
+ exports.OPERATION_VALUES = [
5
+ "recipeFromUrl",
6
+ "recipeFromImage",
7
+ "recipeFromText",
8
+ "scanIngredients",
9
+ "scanEquipment",
10
+ "mealPlan",
11
+ ];
12
+ //# sourceMappingURL=operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../src/types/access/operation.ts"],"names":[],"mappings":";;;AAAa,QAAA,gBAAgB,GAAG;IAC9B,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,eAAe;IACf,UAAU;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Timestamp } from "../core";
2
+ import { Operation } from "./operation";
3
+ export type UsageCounts = Partial<Record<Operation, number>>;
4
+ export interface UsagePeriod {
5
+ counts: UsageCounts;
6
+ updatedAt: Timestamp;
7
+ }
8
+ //# sourceMappingURL=usage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/types/access/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;CACtB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=usage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/types/access/usage.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ export * from "./access";
1
2
  export * from "./core";
2
3
  export * from "./equipment";
3
4
  export * from "./ingredients";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./access"), exports);
17
18
  __exportStar(require("./core"), exports);
18
19
  __exportStar(require("./equipment"), exports);
19
20
  __exportStar(require("./ingredients"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA2B;AAC3B,kDAAgC;AAChC,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,yCAAuB;AACvB,8CAA4B;AAC5B,gDAA8B;AAC9B,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA2B;AAC3B,kDAAgC;AAChC,0CAAwB"}
@@ -1,3 +1,3 @@
1
- export declare const REPORT_CATEGORY_VALUES: readonly ["spam", "harassment", "inappropriate", "copyright", "misinformation", "other"];
1
+ export declare const REPORT_CATEGORY_VALUES: readonly ["copyright", "harassment", "inappropriate", "low_confidence", "misinformation", "not_recipe", "other", "spam"];
2
2
  export type ReportCategory = (typeof REPORT_CATEGORY_VALUES)[number];
3
3
  //# sourceMappingURL=category.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"category.d.ts","sourceRoot":"","sources":["../../../src/types/reports/category.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,0FAOzB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"category.d.ts","sourceRoot":"","sources":["../../../src/types/reports/category.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,0HASzB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -2,11 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.REPORT_CATEGORY_VALUES = void 0;
4
4
  exports.REPORT_CATEGORY_VALUES = [
5
- "spam",
5
+ "copyright",
6
6
  "harassment",
7
7
  "inappropriate",
8
- "copyright",
8
+ "low_confidence",
9
9
  "misinformation",
10
+ "not_recipe",
10
11
  "other",
12
+ "spam",
11
13
  ];
12
14
  //# sourceMappingURL=category.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"category.js","sourceRoot":"","sources":["../../../src/types/reports/category.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,YAAY;IACZ,eAAe;IACf,WAAW;IACX,gBAAgB;IAChB,OAAO;CACC,CAAC"}
1
+ {"version":3,"file":"category.js","sourceRoot":"","sources":["../../../src/types/reports/category.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;IACpC,WAAW;IACX,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,YAAY;IACZ,OAAO;IACP,MAAM;CACE,CAAC"}
@@ -2,6 +2,11 @@ export interface AiTarget {
2
2
  type: "ai";
3
3
  recipeId: string;
4
4
  }
5
+ export interface ExtractionTarget {
6
+ type: "extraction";
7
+ sourceType: "cobalt" | "image" | "pdf" | "text" | "tiktok" | "video" | "website";
8
+ sourceUrl?: string;
9
+ }
5
10
  export interface ImageTarget {
6
11
  type: "image";
7
12
  imageId: string;
@@ -16,5 +21,5 @@ export interface RecipeTarget {
16
21
  type: "recipe";
17
22
  recipeId: string;
18
23
  }
19
- export type ReportTarget = AiTarget | ImageTarget | ProfileTarget | RecipeTarget;
24
+ export type ReportTarget = AiTarget | ExtractionTarget | ImageTarget | ProfileTarget | RecipeTarget;
20
25
  //# sourceMappingURL=target.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../src/types/reports/target.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,WAAW,GACX,aAAa,GACb,YAAY,CAAC"}
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../src/types/reports/target.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IACjF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GACpB,QAAQ,GACR,gBAAgB,GAChB,WAAW,GACX,aAAa,GACb,YAAY,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cravery/core",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "description": "Clean architecture foundation for Cravery",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,3 @@
1
+ export * from "./limits";
2
+ export * from "./operation";
3
+ export * from "./usage";
@@ -0,0 +1,6 @@
1
+ import { SubscriptionTier } from "../subscriptions";
2
+ import { Operation } from "./operation";
3
+
4
+ export type TierLimits = Record<SubscriptionTier, number>;
5
+
6
+ export type LimitsConfig = Record<Operation, TierLimits>;
@@ -0,0 +1,10 @@
1
+ export const OPERATION_VALUES = [
2
+ "recipeFromUrl",
3
+ "recipeFromImage",
4
+ "recipeFromText",
5
+ "scanIngredients",
6
+ "scanEquipment",
7
+ "mealPlan",
8
+ ] as const;
9
+
10
+ export type Operation = (typeof OPERATION_VALUES)[number];
@@ -0,0 +1,9 @@
1
+ import { Timestamp } from "../core";
2
+ import { Operation } from "./operation";
3
+
4
+ export type UsageCounts = Partial<Record<Operation, number>>;
5
+
6
+ export interface UsagePeriod {
7
+ counts: UsageCounts;
8
+ updatedAt: Timestamp;
9
+ }
@@ -1,15 +1,15 @@
1
- export type PaginationDirection = "forward" | "backward";
2
-
3
- export interface PaginationParams {
4
- limit?: number;
5
- cursor?: string;
6
- direction?: PaginationDirection;
7
- }
8
-
9
- export interface PaginatedResult<T> {
10
- data: T[];
11
- startCursor: string | null;
12
- endCursor: string | null;
13
- hasNextPage: boolean;
14
- hasPreviousPage: boolean;
15
- }
1
+ export type PaginationDirection = "forward" | "backward";
2
+
3
+ export interface PaginationParams {
4
+ limit?: number;
5
+ cursor?: string;
6
+ direction?: PaginationDirection;
7
+ }
8
+
9
+ export interface PaginatedResult<T> {
10
+ data: T[];
11
+ startCursor: string | null;
12
+ endCursor: string | null;
13
+ hasNextPage: boolean;
14
+ hasPreviousPage: boolean;
15
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./access";
1
2
  export * from "./core";
2
3
  export * from "./equipment";
3
4
  export * from "./ingredients";
@@ -1,9 +1,11 @@
1
1
  export const REPORT_CATEGORY_VALUES = [
2
- "spam",
2
+ "copyright",
3
3
  "harassment",
4
4
  "inappropriate",
5
- "copyright",
5
+ "low_confidence",
6
6
  "misinformation",
7
+ "not_recipe",
7
8
  "other",
9
+ "spam",
8
10
  ] as const;
9
11
  export type ReportCategory = (typeof REPORT_CATEGORY_VALUES)[number];
@@ -2,22 +2,33 @@ export interface AiTarget {
2
2
  type: "ai";
3
3
  recipeId: string;
4
4
  }
5
+
6
+ export interface ExtractionTarget {
7
+ type: "extraction";
8
+ sourceType: "cobalt" | "image" | "pdf" | "text" | "tiktok" | "video" | "website";
9
+ sourceUrl?: string;
10
+ }
11
+
5
12
  export interface ImageTarget {
6
13
  type: "image";
7
14
  imageId: string;
8
15
  parentType: "recipe" | "profile";
9
16
  parentId: string;
10
17
  }
18
+
11
19
  export interface ProfileTarget {
12
20
  type: "profile";
13
21
  profileId: string;
14
22
  }
23
+
15
24
  export interface RecipeTarget {
16
25
  type: "recipe";
17
26
  recipeId: string;
18
27
  }
28
+
19
29
  export type ReportTarget =
20
30
  | AiTarget
31
+ | ExtractionTarget
21
32
  | ImageTarget
22
33
  | ProfileTarget
23
34
  | RecipeTarget;
@@ -1,12 +1,12 @@
1
- import { EntityBase, Locale } from "../core";
2
- import { RequestStatus } from "./request_status";
3
-
4
- export interface Request extends EntityBase {
5
- status: RequestStatus;
6
- locale: Locale;
7
- url?: string;
8
- images?: string[];
9
- text?: string;
10
- recipeId?: string;
11
- error?: string;
12
- }
1
+ import { EntityBase, Locale } from "../core";
2
+ import { RequestStatus } from "./request_status";
3
+
4
+ export interface Request extends EntityBase {
5
+ status: RequestStatus;
6
+ locale: Locale;
7
+ url?: string;
8
+ images?: string[];
9
+ text?: string;
10
+ recipeId?: string;
11
+ error?: string;
12
+ }
@@ -1,7 +1,7 @@
1
- export const REQUEST_STATUS_VALUES = [
2
- "pending",
3
- "processing",
4
- "done",
5
- "failed",
6
- ] as const;
7
- export type RequestStatus = (typeof REQUEST_STATUS_VALUES)[number];
1
+ export const REQUEST_STATUS_VALUES = [
2
+ "pending",
3
+ "processing",
4
+ "done",
5
+ "failed",
6
+ ] as const;
7
+ export type RequestStatus = (typeof REQUEST_STATUS_VALUES)[number];