@ankhorage/contracts 6.0.0 → 7.1.0
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- 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/theme.d.ts +44 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +2 -0
- package/dist/theme.js.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +2 -6
- package/src/contracts.test.ts +40 -0
- package/src/index.ts +1 -1
- package/src/theme.ts +50 -0
- package/src/types.ts +5 -0
- package/dist/nutrition/capture.d.ts +0 -54
- package/dist/nutrition/capture.d.ts.map +0 -1
- package/dist/nutrition/capture.js +0 -8
- package/dist/nutrition/capture.js.map +0 -1
- package/dist/nutrition/common.d.ts +0 -22
- package/dist/nutrition/common.d.ts.map +0 -1
- package/dist/nutrition/common.js +0 -25
- package/dist/nutrition/common.js.map +0 -1
- package/dist/nutrition/index.d.ts +0 -5
- package/dist/nutrition/index.d.ts.map +0 -1
- package/dist/nutrition/index.js +0 -5
- package/dist/nutrition/index.js.map +0 -1
- package/dist/nutrition/products.d.ts +0 -93
- package/dist/nutrition/products.d.ts.map +0 -1
- package/dist/nutrition/products.js +0 -9
- package/dist/nutrition/products.js.map +0 -1
- package/dist/nutrition/review.d.ts +0 -47
- package/dist/nutrition/review.d.ts.map +0 -1
- package/dist/nutrition/review.js +0 -8
- package/dist/nutrition/review.js.map +0 -1
- package/src/nutrition/capture.ts +0 -80
- package/src/nutrition/common.ts +0 -51
- package/src/nutrition/index.ts +0 -4
- package/src/nutrition/nutrition.test.ts +0 -137
- package/src/nutrition/products.ts +0 -134
- package/src/nutrition/review.ts +0 -65
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type { NutritionBarcode, NutritionDataSource, NutritionIsoDateTime, NutritionJsonValue, NutritionProductId, NutritionProductStatus, NutritionSourceConfidence } from './common';
|
|
2
|
-
export type NutritionMeasurementBasis = 'per_100g' | 'per_100ml';
|
|
3
|
-
export interface NutritionFactsPer100g {
|
|
4
|
-
readonly basis?: NutritionMeasurementBasis;
|
|
5
|
-
readonly energyKcal?: number;
|
|
6
|
-
readonly energyKj?: number;
|
|
7
|
-
readonly proteinG?: number;
|
|
8
|
-
readonly carbohydratesG?: number;
|
|
9
|
-
readonly sugarsG?: number;
|
|
10
|
-
readonly fatG?: number;
|
|
11
|
-
readonly saturatedFatG?: number;
|
|
12
|
-
readonly fiberG?: number;
|
|
13
|
-
readonly saltG?: number;
|
|
14
|
-
readonly sodiumG?: number;
|
|
15
|
-
}
|
|
16
|
-
export interface NutritionServing {
|
|
17
|
-
readonly label?: string;
|
|
18
|
-
readonly sizeG?: number;
|
|
19
|
-
readonly sizeMl?: number;
|
|
20
|
-
readonly servingsPerPackage?: number;
|
|
21
|
-
}
|
|
22
|
-
export interface NutritionIngredientStatement {
|
|
23
|
-
readonly text?: string;
|
|
24
|
-
readonly locale?: string;
|
|
25
|
-
readonly rawText?: string;
|
|
26
|
-
}
|
|
27
|
-
export type NutritionAllergenTag = 'celery' | 'cereals_containing_gluten' | 'crustaceans' | 'eggs' | 'fish' | 'lupin' | 'milk' | 'molluscs' | 'mustard' | 'nuts' | 'peanuts' | 'sesame' | 'soybeans' | 'sulphur_dioxide_and_sulphites' | (string & {});
|
|
28
|
-
export interface NutritionStoreObservation {
|
|
29
|
-
readonly countryCode?: string;
|
|
30
|
-
readonly storeChain?: string;
|
|
31
|
-
readonly storeName?: string;
|
|
32
|
-
readonly storeLocationLabel?: string;
|
|
33
|
-
readonly observedAt?: NutritionIsoDateTime;
|
|
34
|
-
}
|
|
35
|
-
export declare const NUTRITION_IMAGE_KINDS: readonly ["front", "nutrition_label", "ingredients", "barcode", "package_back", "other"];
|
|
36
|
-
export type NutritionImageKind = (typeof NUTRITION_IMAGE_KINDS)[number];
|
|
37
|
-
export interface NutritionImageEvidence {
|
|
38
|
-
readonly id?: string;
|
|
39
|
-
readonly kind: NutritionImageKind;
|
|
40
|
-
readonly storageId?: string;
|
|
41
|
-
readonly bucket?: string;
|
|
42
|
-
readonly path?: string;
|
|
43
|
-
readonly publicUrl?: string;
|
|
44
|
-
readonly contentType?: string;
|
|
45
|
-
readonly width?: number;
|
|
46
|
-
readonly height?: number;
|
|
47
|
-
readonly capturedAt?: NutritionIsoDateTime;
|
|
48
|
-
readonly metadata?: Record<string, NutritionJsonValue>;
|
|
49
|
-
}
|
|
50
|
-
export interface NutritionProductSummary {
|
|
51
|
-
readonly id: NutritionProductId;
|
|
52
|
-
readonly primaryBarcode: NutritionBarcode;
|
|
53
|
-
readonly name: string;
|
|
54
|
-
readonly brand?: string;
|
|
55
|
-
readonly quantity?: string;
|
|
56
|
-
readonly status: NutritionProductStatus;
|
|
57
|
-
readonly source: NutritionDataSource;
|
|
58
|
-
readonly sourceConfidence: NutritionSourceConfidence;
|
|
59
|
-
readonly imageUrl?: string;
|
|
60
|
-
readonly updatedAt: NutritionIsoDateTime;
|
|
61
|
-
}
|
|
62
|
-
export interface NutritionProduct {
|
|
63
|
-
readonly id: NutritionProductId;
|
|
64
|
-
readonly primaryBarcode: NutritionBarcode;
|
|
65
|
-
readonly barcodes?: readonly NutritionBarcode[];
|
|
66
|
-
readonly name: string;
|
|
67
|
-
readonly brand?: string;
|
|
68
|
-
readonly quantity?: string;
|
|
69
|
-
readonly packageSizeG?: number;
|
|
70
|
-
readonly packageSizeMl?: number;
|
|
71
|
-
readonly serving?: NutritionServing;
|
|
72
|
-
readonly nutrientsPer100g?: NutritionFactsPer100g;
|
|
73
|
-
readonly ingredients?: NutritionIngredientStatement;
|
|
74
|
-
readonly allergens?: readonly NutritionAllergenTag[];
|
|
75
|
-
readonly traces?: readonly NutritionAllergenTag[];
|
|
76
|
-
readonly stores?: readonly NutritionStoreObservation[];
|
|
77
|
-
readonly images?: readonly NutritionImageEvidence[];
|
|
78
|
-
readonly status: NutritionProductStatus;
|
|
79
|
-
readonly source: NutritionDataSource;
|
|
80
|
-
readonly sourceConfidence: NutritionSourceConfidence;
|
|
81
|
-
readonly sourcePayload?: NutritionJsonValue;
|
|
82
|
-
readonly verifiedByUser?: boolean;
|
|
83
|
-
readonly createdAt: NutritionIsoDateTime;
|
|
84
|
-
readonly updatedAt: NutritionIsoDateTime;
|
|
85
|
-
readonly publishedAt?: NutritionIsoDateTime | null;
|
|
86
|
-
}
|
|
87
|
-
export interface NutritionProductDetail {
|
|
88
|
-
readonly product: NutritionProduct;
|
|
89
|
-
}
|
|
90
|
-
export interface NutritionProductLookupByBarcodeResponse {
|
|
91
|
-
readonly product: NutritionProduct;
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=products.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/nutrition/products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,yBAAyB,GAAG,UAAU,GAAG,WAAW,CAAC;AAEjE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAA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AAW,uCAAuC;IACtD,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/nutrition/products.ts"],"names":[],"mappings":"AAgEA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,OAAO;IACP,iBAAiB;IACjB,aAAa;IACb,SAAS;IACT,cAAc;IACd,OAAO;CACC,CAAC","sourcesContent":["import type {\n NutritionBarcode,\n NutritionDataSource,\n NutritionIsoDateTime,\n NutritionJsonValue,\n NutritionProductId,\n NutritionProductStatus,\n NutritionSourceConfidence,\n} from './common';\n\nexport type NutritionMeasurementBasis = 'per_100g' | 'per_100ml';\n\nexport interface NutritionFactsPer100g {\n readonly basis?: NutritionMeasurementBasis;\n readonly energyKcal?: number;\n readonly energyKj?: number;\n readonly proteinG?: number;\n readonly carbohydratesG?: number;\n readonly sugarsG?: number;\n readonly fatG?: number;\n readonly saturatedFatG?: number;\n readonly fiberG?: number;\n readonly saltG?: number;\n readonly sodiumG?: number;\n}\n\nexport interface NutritionServing {\n readonly label?: string;\n readonly sizeG?: number;\n readonly sizeMl?: number;\n readonly servingsPerPackage?: number;\n}\n\nexport interface NutritionIngredientStatement {\n readonly text?: string;\n readonly locale?: string;\n readonly rawText?: string;\n}\n\nexport type NutritionAllergenTag =\n | 'celery'\n | 'cereals_containing_gluten'\n | 'crustaceans'\n | 'eggs'\n | 'fish'\n | 'lupin'\n | 'milk'\n | 'molluscs'\n | 'mustard'\n | 'nuts'\n | 'peanuts'\n | 'sesame'\n | 'soybeans'\n | 'sulphur_dioxide_and_sulphites'\n | (string & {});\n\nexport interface NutritionStoreObservation {\n readonly countryCode?: string;\n readonly storeChain?: string;\n readonly storeName?: string;\n readonly storeLocationLabel?: string;\n readonly observedAt?: NutritionIsoDateTime;\n}\n\nexport const NUTRITION_IMAGE_KINDS = [\n 'front',\n 'nutrition_label',\n 'ingredients',\n 'barcode',\n 'package_back',\n 'other',\n] as const;\nexport type NutritionImageKind = (typeof NUTRITION_IMAGE_KINDS)[number];\n\nexport interface NutritionImageEvidence {\n readonly id?: string;\n readonly kind: NutritionImageKind;\n readonly storageId?: string;\n readonly bucket?: string;\n readonly path?: string;\n readonly publicUrl?: string;\n readonly contentType?: string;\n readonly width?: number;\n readonly height?: number;\n readonly capturedAt?: NutritionIsoDateTime;\n readonly metadata?: Record<string, NutritionJsonValue>;\n}\n\nexport interface NutritionProductSummary {\n readonly id: NutritionProductId;\n readonly primaryBarcode: NutritionBarcode;\n readonly name: string;\n readonly brand?: string;\n readonly quantity?: string;\n readonly status: NutritionProductStatus;\n readonly source: NutritionDataSource;\n readonly sourceConfidence: NutritionSourceConfidence;\n readonly imageUrl?: string;\n readonly updatedAt: NutritionIsoDateTime;\n}\n\nexport interface NutritionProduct {\n readonly id: NutritionProductId;\n readonly primaryBarcode: NutritionBarcode;\n readonly barcodes?: readonly NutritionBarcode[];\n readonly name: string;\n readonly brand?: string;\n readonly quantity?: string;\n readonly packageSizeG?: number;\n readonly packageSizeMl?: number;\n readonly serving?: NutritionServing;\n readonly nutrientsPer100g?: NutritionFactsPer100g;\n readonly ingredients?: NutritionIngredientStatement;\n readonly allergens?: readonly NutritionAllergenTag[];\n readonly traces?: readonly NutritionAllergenTag[];\n readonly stores?: readonly NutritionStoreObservation[];\n readonly images?: readonly NutritionImageEvidence[];\n readonly status: NutritionProductStatus;\n readonly source: NutritionDataSource;\n readonly sourceConfidence: NutritionSourceConfidence;\n readonly sourcePayload?: NutritionJsonValue;\n readonly verifiedByUser?: boolean;\n readonly createdAt: NutritionIsoDateTime;\n readonly updatedAt: NutritionIsoDateTime;\n readonly publishedAt?: NutritionIsoDateTime | null;\n}\n\nexport interface NutritionProductDetail {\n readonly product: NutritionProduct;\n}\n\nexport interface NutritionProductLookupByBarcodeResponse {\n readonly product: NutritionProduct;\n}\n"]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { NutritionCaptureSubmission, NutritionCaptureSubmissionStatus } from './capture';
|
|
2
|
-
import type { NutritionCaptureSubmissionId, NutritionIsoDateTime, NutritionJsonValue, NutritionProductId, NutritionReviewId, NutritionUserId } from './common';
|
|
3
|
-
import type { NutritionProduct } from './products';
|
|
4
|
-
export declare const NUTRITION_REVIEW_DECISIONS: readonly ["accept", "reject", "merge", "request_changes", "publish"];
|
|
5
|
-
export type NutritionReviewDecision = (typeof NUTRITION_REVIEW_DECISIONS)[number];
|
|
6
|
-
export interface NutritionReviewDecisionRequest {
|
|
7
|
-
readonly decision: NutritionReviewDecision;
|
|
8
|
-
readonly submissionId: NutritionCaptureSubmissionId;
|
|
9
|
-
readonly reviewerId?: NutritionUserId;
|
|
10
|
-
readonly targetProductId?: NutritionProductId;
|
|
11
|
-
readonly productOverride?: Partial<NutritionProduct>;
|
|
12
|
-
readonly note?: string;
|
|
13
|
-
readonly metadata?: Record<string, NutritionJsonValue>;
|
|
14
|
-
}
|
|
15
|
-
export interface NutritionReviewDecisionResponse {
|
|
16
|
-
readonly reviewId: NutritionReviewId;
|
|
17
|
-
readonly submissionId: NutritionCaptureSubmissionId;
|
|
18
|
-
readonly decision: NutritionReviewDecision;
|
|
19
|
-
readonly status: NutritionCaptureSubmissionStatus;
|
|
20
|
-
readonly productId?: NutritionProductId;
|
|
21
|
-
readonly decidedAt: NutritionIsoDateTime;
|
|
22
|
-
}
|
|
23
|
-
export interface NutritionReviewRecord {
|
|
24
|
-
readonly id: NutritionReviewId;
|
|
25
|
-
readonly submissionId: NutritionCaptureSubmissionId;
|
|
26
|
-
readonly reviewerId?: NutritionUserId;
|
|
27
|
-
readonly decision: NutritionReviewDecision;
|
|
28
|
-
readonly previousStatus: NutritionCaptureSubmissionStatus;
|
|
29
|
-
readonly nextStatus: NutritionCaptureSubmissionStatus;
|
|
30
|
-
readonly targetProductId?: NutritionProductId | null;
|
|
31
|
-
readonly note?: string;
|
|
32
|
-
readonly metadata?: Record<string, NutritionJsonValue>;
|
|
33
|
-
readonly createdAt: NutritionIsoDateTime;
|
|
34
|
-
}
|
|
35
|
-
export interface NutritionReviewSubmissionListRequest {
|
|
36
|
-
readonly status?: NutritionCaptureSubmissionStatus;
|
|
37
|
-
readonly barcode?: string;
|
|
38
|
-
readonly store?: string;
|
|
39
|
-
readonly limit?: number;
|
|
40
|
-
readonly offset?: number;
|
|
41
|
-
}
|
|
42
|
-
export interface NutritionReviewSubmissionListResponse {
|
|
43
|
-
readonly submissions: readonly NutritionCaptureSubmission[];
|
|
44
|
-
readonly limit?: number;
|
|
45
|
-
readonly offset?: number;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=review.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/nutrition/review.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,WAAW,CAAC;AAC9F,OAAO,KAAK,EACV,4BAA4B,EAC5B,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,eAAO,MAAM,0BAA0B,sEAM7B,CAAC;AACX,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAElF,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAC3C,QAAQ,CAAC,YAAY,EAAE,4BAA4B,CAAC;IACpD,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC;IACtC,QAAQ,CAAC,eAAe,CAAC,EAAE,kBAAkB,CAAC;IAC9C,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,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,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,WAAW,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAC5D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/dist/nutrition/review.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/nutrition/review.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,iBAAiB;IACjB,SAAS;CACD,CAAC","sourcesContent":["import type { NutritionCaptureSubmission, NutritionCaptureSubmissionStatus } from './capture';\nimport type {\n NutritionCaptureSubmissionId,\n NutritionIsoDateTime,\n NutritionJsonValue,\n NutritionProductId,\n NutritionReviewId,\n NutritionUserId,\n} from './common';\nimport type { NutritionProduct } from './products';\n\nexport const NUTRITION_REVIEW_DECISIONS = [\n 'accept',\n 'reject',\n 'merge',\n 'request_changes',\n 'publish',\n] as const;\nexport type NutritionReviewDecision = (typeof NUTRITION_REVIEW_DECISIONS)[number];\n\nexport interface NutritionReviewDecisionRequest {\n readonly decision: NutritionReviewDecision;\n readonly submissionId: NutritionCaptureSubmissionId;\n readonly reviewerId?: NutritionUserId;\n readonly targetProductId?: NutritionProductId;\n readonly productOverride?: Partial<NutritionProduct>;\n readonly note?: string;\n readonly metadata?: Record<string, NutritionJsonValue>;\n}\n\nexport interface NutritionReviewDecisionResponse {\n readonly reviewId: NutritionReviewId;\n readonly submissionId: NutritionCaptureSubmissionId;\n readonly decision: NutritionReviewDecision;\n readonly status: NutritionCaptureSubmissionStatus;\n readonly productId?: NutritionProductId;\n readonly decidedAt: NutritionIsoDateTime;\n}\n\nexport interface NutritionReviewRecord {\n readonly id: NutritionReviewId;\n readonly submissionId: NutritionCaptureSubmissionId;\n readonly reviewerId?: NutritionUserId;\n readonly decision: NutritionReviewDecision;\n readonly previousStatus: NutritionCaptureSubmissionStatus;\n readonly nextStatus: NutritionCaptureSubmissionStatus;\n readonly targetProductId?: NutritionProductId | null;\n readonly note?: string;\n readonly metadata?: Record<string, NutritionJsonValue>;\n readonly createdAt: NutritionIsoDateTime;\n}\n\nexport interface NutritionReviewSubmissionListRequest {\n readonly status?: NutritionCaptureSubmissionStatus;\n readonly barcode?: string;\n readonly store?: string;\n readonly limit?: number;\n readonly offset?: number;\n}\n\nexport interface NutritionReviewSubmissionListResponse {\n readonly submissions: readonly NutritionCaptureSubmission[];\n readonly limit?: number;\n readonly offset?: number;\n}\n"]}
|
package/src/nutrition/capture.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
NutritionBarcode,
|
|
3
|
-
NutritionCaptureSubmissionId,
|
|
4
|
-
NutritionIsoDateTime,
|
|
5
|
-
NutritionJsonValue,
|
|
6
|
-
NutritionProductId,
|
|
7
|
-
NutritionUserId,
|
|
8
|
-
} from './common';
|
|
9
|
-
import type {
|
|
10
|
-
NutritionFactsPer100g,
|
|
11
|
-
NutritionImageEvidence,
|
|
12
|
-
NutritionIngredientStatement,
|
|
13
|
-
NutritionServing,
|
|
14
|
-
NutritionStoreObservation,
|
|
15
|
-
} from './products';
|
|
16
|
-
|
|
17
|
-
export const NUTRITION_CAPTURE_SUBMISSION_STATUSES = [
|
|
18
|
-
'queued',
|
|
19
|
-
'needs_more_data',
|
|
20
|
-
'accepted',
|
|
21
|
-
'rejected',
|
|
22
|
-
'merged',
|
|
23
|
-
] as const;
|
|
24
|
-
export type NutritionCaptureSubmissionStatus =
|
|
25
|
-
(typeof NUTRITION_CAPTURE_SUBMISSION_STATUSES)[number];
|
|
26
|
-
|
|
27
|
-
export interface NutritionCaptureClientContext {
|
|
28
|
-
readonly userId?: NutritionUserId;
|
|
29
|
-
readonly anonymousDeviceId?: string;
|
|
30
|
-
readonly platform?: 'android' | 'ios' | 'web' | (string & {});
|
|
31
|
-
readonly appVersion?: string;
|
|
32
|
-
readonly locale?: string;
|
|
33
|
-
readonly clientCapturedAt?: NutritionIsoDateTime;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface NutritionProductCaptureDraft {
|
|
37
|
-
readonly barcode: NutritionBarcode;
|
|
38
|
-
readonly name?: string;
|
|
39
|
-
readonly brand?: string;
|
|
40
|
-
readonly quantity?: string;
|
|
41
|
-
readonly packageSizeG?: number;
|
|
42
|
-
readonly packageSizeMl?: number;
|
|
43
|
-
readonly serving?: NutritionServing;
|
|
44
|
-
readonly nutrientsPer100g?: NutritionFactsPer100g;
|
|
45
|
-
readonly ingredients?: NutritionIngredientStatement;
|
|
46
|
-
readonly storeObservation?: NutritionStoreObservation;
|
|
47
|
-
readonly images?: readonly NutritionImageEvidence[];
|
|
48
|
-
readonly rawPayload?: NutritionJsonValue;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface NutritionProductCaptureRequest {
|
|
52
|
-
readonly draft: NutritionProductCaptureDraft;
|
|
53
|
-
readonly client?: NutritionCaptureClientContext;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface NutritionProductCaptureResponse {
|
|
57
|
-
readonly submissionId: NutritionCaptureSubmissionId;
|
|
58
|
-
readonly status: NutritionCaptureSubmissionStatus;
|
|
59
|
-
readonly productId?: NutritionProductId;
|
|
60
|
-
readonly message?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface NutritionProductCorrectionRequest {
|
|
64
|
-
readonly productId: NutritionProductId;
|
|
65
|
-
readonly patch: Partial<NutritionProductCaptureDraft>;
|
|
66
|
-
readonly client?: NutritionCaptureClientContext;
|
|
67
|
-
readonly note?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface NutritionCaptureSubmission {
|
|
71
|
-
readonly id: NutritionCaptureSubmissionId;
|
|
72
|
-
readonly status: NutritionCaptureSubmissionStatus;
|
|
73
|
-
readonly draft: NutritionProductCaptureDraft;
|
|
74
|
-
readonly client?: NutritionCaptureClientContext;
|
|
75
|
-
readonly matchedProductId?: NutritionProductId | null;
|
|
76
|
-
readonly reviewerNote?: string;
|
|
77
|
-
readonly createdAt: NutritionIsoDateTime;
|
|
78
|
-
readonly updatedAt: NutritionIsoDateTime;
|
|
79
|
-
readonly decidedAt?: NutritionIsoDateTime | null;
|
|
80
|
-
}
|
package/src/nutrition/common.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export type NutritionIsoDateTime = string;
|
|
2
|
-
export type NutritionProductId = string;
|
|
3
|
-
export type NutritionCaptureSubmissionId = string;
|
|
4
|
-
export type NutritionReviewId = string;
|
|
5
|
-
export type NutritionUserId = string;
|
|
6
|
-
|
|
7
|
-
export type NutritionJsonValue =
|
|
8
|
-
| boolean
|
|
9
|
-
| number
|
|
10
|
-
| string
|
|
11
|
-
| null
|
|
12
|
-
| readonly NutritionJsonValue[]
|
|
13
|
-
| { readonly [key: string]: NutritionJsonValue };
|
|
14
|
-
|
|
15
|
-
export const NUTRITION_BARCODE_TYPES = [
|
|
16
|
-
'ean_8',
|
|
17
|
-
'ean_13',
|
|
18
|
-
'upc_a',
|
|
19
|
-
'upc_e',
|
|
20
|
-
'gtin_14',
|
|
21
|
-
'unknown',
|
|
22
|
-
] as const;
|
|
23
|
-
export type NutritionBarcodeType = (typeof NUTRITION_BARCODE_TYPES)[number];
|
|
24
|
-
|
|
25
|
-
export interface NutritionBarcode {
|
|
26
|
-
readonly value: string;
|
|
27
|
-
readonly type: NutritionBarcodeType;
|
|
28
|
-
readonly normalizedValue?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const NUTRITION_PRODUCT_STATUSES = [
|
|
32
|
-
'draft',
|
|
33
|
-
'pending_review',
|
|
34
|
-
'published',
|
|
35
|
-
'rejected',
|
|
36
|
-
'archived',
|
|
37
|
-
] as const;
|
|
38
|
-
export type NutritionProductStatus = (typeof NUTRITION_PRODUCT_STATUSES)[number];
|
|
39
|
-
|
|
40
|
-
export const NUTRITION_DATA_SOURCES = [
|
|
41
|
-
'manual_scan',
|
|
42
|
-
'user_correction',
|
|
43
|
-
'open_food_facts',
|
|
44
|
-
'foodrepo_legacy',
|
|
45
|
-
'retailer_import',
|
|
46
|
-
'admin_import',
|
|
47
|
-
] as const;
|
|
48
|
-
export type NutritionDataSource = (typeof NUTRITION_DATA_SOURCES)[number];
|
|
49
|
-
|
|
50
|
-
export const NUTRITION_SOURCE_CONFIDENCE_LEVELS = ['unknown', 'low', 'medium', 'high'] as const;
|
|
51
|
-
export type NutritionSourceConfidence = (typeof NUTRITION_SOURCE_CONFIDENCE_LEVELS)[number];
|
package/src/nutrition/index.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
NUTRITION_BARCODE_TYPES,
|
|
5
|
-
NUTRITION_CAPTURE_SUBMISSION_STATUSES,
|
|
6
|
-
NUTRITION_DATA_SOURCES,
|
|
7
|
-
NUTRITION_PRODUCT_STATUSES,
|
|
8
|
-
NUTRITION_REVIEW_DECISIONS,
|
|
9
|
-
type NutritionCaptureSubmission,
|
|
10
|
-
type NutritionProduct,
|
|
11
|
-
type NutritionProductCaptureRequest,
|
|
12
|
-
type NutritionReviewDecisionRequest,
|
|
13
|
-
} from './index';
|
|
14
|
-
|
|
15
|
-
describe('nutrition contracts', () => {
|
|
16
|
-
it('exports stable literal unions for nutrition workflows', () => {
|
|
17
|
-
expect(NUTRITION_BARCODE_TYPES).toEqual([
|
|
18
|
-
'ean_8',
|
|
19
|
-
'ean_13',
|
|
20
|
-
'upc_a',
|
|
21
|
-
'upc_e',
|
|
22
|
-
'gtin_14',
|
|
23
|
-
'unknown',
|
|
24
|
-
]);
|
|
25
|
-
expect(NUTRITION_PRODUCT_STATUSES).toEqual([
|
|
26
|
-
'draft',
|
|
27
|
-
'pending_review',
|
|
28
|
-
'published',
|
|
29
|
-
'rejected',
|
|
30
|
-
'archived',
|
|
31
|
-
]);
|
|
32
|
-
expect(NUTRITION_DATA_SOURCES).toEqual([
|
|
33
|
-
'manual_scan',
|
|
34
|
-
'user_correction',
|
|
35
|
-
'open_food_facts',
|
|
36
|
-
'foodrepo_legacy',
|
|
37
|
-
'retailer_import',
|
|
38
|
-
'admin_import',
|
|
39
|
-
]);
|
|
40
|
-
expect(NUTRITION_CAPTURE_SUBMISSION_STATUSES).toEqual([
|
|
41
|
-
'queued',
|
|
42
|
-
'needs_more_data',
|
|
43
|
-
'accepted',
|
|
44
|
-
'rejected',
|
|
45
|
-
'merged',
|
|
46
|
-
]);
|
|
47
|
-
expect(NUTRITION_REVIEW_DECISIONS).toEqual([
|
|
48
|
-
'accept',
|
|
49
|
-
'reject',
|
|
50
|
-
'merge',
|
|
51
|
-
'request_changes',
|
|
52
|
-
'publish',
|
|
53
|
-
]);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('serializes a published barcode product', () => {
|
|
57
|
-
const product: NutritionProduct = {
|
|
58
|
-
id: 'product_01',
|
|
59
|
-
primaryBarcode: {
|
|
60
|
-
value: '7612345678901',
|
|
61
|
-
type: 'ean_13',
|
|
62
|
-
normalizedValue: '7612345678901',
|
|
63
|
-
},
|
|
64
|
-
name: 'Example Yogurt Nature',
|
|
65
|
-
brand: 'Example Brand',
|
|
66
|
-
quantity: '250 g',
|
|
67
|
-
packageSizeG: 250,
|
|
68
|
-
serving: { label: '1 cup', sizeG: 250, servingsPerPackage: 1 },
|
|
69
|
-
nutrientsPer100g: {
|
|
70
|
-
basis: 'per_100g',
|
|
71
|
-
energyKcal: 62,
|
|
72
|
-
energyKj: 260,
|
|
73
|
-
proteinG: 11,
|
|
74
|
-
carbohydratesG: 3.8,
|
|
75
|
-
sugarsG: 3.8,
|
|
76
|
-
fatG: 0.2,
|
|
77
|
-
saturatedFatG: 0.1,
|
|
78
|
-
fiberG: 0,
|
|
79
|
-
saltG: 0.1,
|
|
80
|
-
sodiumG: 0.04,
|
|
81
|
-
},
|
|
82
|
-
ingredients: { locale: 'de-CH', text: 'Milk, cultures.' },
|
|
83
|
-
allergens: ['milk'],
|
|
84
|
-
stores: [{ countryCode: 'CH', storeChain: 'Example Store' }],
|
|
85
|
-
images: [{ kind: 'nutrition_label', path: 'labels/7612345678901.jpg' }],
|
|
86
|
-
status: 'published',
|
|
87
|
-
source: 'manual_scan',
|
|
88
|
-
sourceConfidence: 'high',
|
|
89
|
-
verifiedByUser: true,
|
|
90
|
-
createdAt: '2026-06-01T12:00:00.000Z',
|
|
91
|
-
updatedAt: '2026-06-01T12:05:00.000Z',
|
|
92
|
-
publishedAt: '2026-06-01T12:10:00.000Z',
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
expect(JSON.parse(JSON.stringify(product))).toEqual(product);
|
|
96
|
-
expect(product.nutrientsPer100g?.proteinG).toBe(11);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('serializes capture submissions and review decisions', () => {
|
|
100
|
-
const capture: NutritionProductCaptureRequest = {
|
|
101
|
-
draft: {
|
|
102
|
-
barcode: { value: '7612345678901', type: 'ean_13' },
|
|
103
|
-
name: 'Example Yogurt Nature',
|
|
104
|
-
nutrientsPer100g: { energyKcal: 62, proteinG: 11 },
|
|
105
|
-
storeObservation: { countryCode: 'CH', storeChain: 'Example Store' },
|
|
106
|
-
rawPayload: { source: 'manual' },
|
|
107
|
-
},
|
|
108
|
-
client: {
|
|
109
|
-
anonymousDeviceId: 'device-1',
|
|
110
|
-
platform: 'ios',
|
|
111
|
-
appVersion: '0.1.0',
|
|
112
|
-
clientCapturedAt: '2026-06-01T12:00:00.000Z',
|
|
113
|
-
},
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const submission: NutritionCaptureSubmission = {
|
|
117
|
-
id: 'submission_01',
|
|
118
|
-
status: 'queued',
|
|
119
|
-
draft: capture.draft,
|
|
120
|
-
client: capture.client,
|
|
121
|
-
matchedProductId: null,
|
|
122
|
-
createdAt: '2026-06-01T12:00:00.000Z',
|
|
123
|
-
updatedAt: '2026-06-01T12:00:00.000Z',
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const decision: NutritionReviewDecisionRequest = {
|
|
127
|
-
submissionId: submission.id,
|
|
128
|
-
decision: 'accept',
|
|
129
|
-
reviewerId: 'reviewer-1',
|
|
130
|
-
note: 'Readable label.',
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
expect(JSON.parse(JSON.stringify(capture))).toEqual(capture);
|
|
134
|
-
expect(JSON.parse(JSON.stringify(submission))).toEqual(submission);
|
|
135
|
-
expect(decision.decision).toBe('accept');
|
|
136
|
-
});
|
|
137
|
-
});
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
NutritionBarcode,
|
|
3
|
-
NutritionDataSource,
|
|
4
|
-
NutritionIsoDateTime,
|
|
5
|
-
NutritionJsonValue,
|
|
6
|
-
NutritionProductId,
|
|
7
|
-
NutritionProductStatus,
|
|
8
|
-
NutritionSourceConfidence,
|
|
9
|
-
} from './common';
|
|
10
|
-
|
|
11
|
-
export type NutritionMeasurementBasis = 'per_100g' | 'per_100ml';
|
|
12
|
-
|
|
13
|
-
export interface NutritionFactsPer100g {
|
|
14
|
-
readonly basis?: NutritionMeasurementBasis;
|
|
15
|
-
readonly energyKcal?: number;
|
|
16
|
-
readonly energyKj?: number;
|
|
17
|
-
readonly proteinG?: number;
|
|
18
|
-
readonly carbohydratesG?: number;
|
|
19
|
-
readonly sugarsG?: number;
|
|
20
|
-
readonly fatG?: number;
|
|
21
|
-
readonly saturatedFatG?: number;
|
|
22
|
-
readonly fiberG?: number;
|
|
23
|
-
readonly saltG?: number;
|
|
24
|
-
readonly sodiumG?: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface NutritionServing {
|
|
28
|
-
readonly label?: string;
|
|
29
|
-
readonly sizeG?: number;
|
|
30
|
-
readonly sizeMl?: number;
|
|
31
|
-
readonly servingsPerPackage?: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface NutritionIngredientStatement {
|
|
35
|
-
readonly text?: string;
|
|
36
|
-
readonly locale?: string;
|
|
37
|
-
readonly rawText?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export type NutritionAllergenTag =
|
|
41
|
-
| 'celery'
|
|
42
|
-
| 'cereals_containing_gluten'
|
|
43
|
-
| 'crustaceans'
|
|
44
|
-
| 'eggs'
|
|
45
|
-
| 'fish'
|
|
46
|
-
| 'lupin'
|
|
47
|
-
| 'milk'
|
|
48
|
-
| 'molluscs'
|
|
49
|
-
| 'mustard'
|
|
50
|
-
| 'nuts'
|
|
51
|
-
| 'peanuts'
|
|
52
|
-
| 'sesame'
|
|
53
|
-
| 'soybeans'
|
|
54
|
-
| 'sulphur_dioxide_and_sulphites'
|
|
55
|
-
| (string & {});
|
|
56
|
-
|
|
57
|
-
export interface NutritionStoreObservation {
|
|
58
|
-
readonly countryCode?: string;
|
|
59
|
-
readonly storeChain?: string;
|
|
60
|
-
readonly storeName?: string;
|
|
61
|
-
readonly storeLocationLabel?: string;
|
|
62
|
-
readonly observedAt?: NutritionIsoDateTime;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export const NUTRITION_IMAGE_KINDS = [
|
|
66
|
-
'front',
|
|
67
|
-
'nutrition_label',
|
|
68
|
-
'ingredients',
|
|
69
|
-
'barcode',
|
|
70
|
-
'package_back',
|
|
71
|
-
'other',
|
|
72
|
-
] as const;
|
|
73
|
-
export type NutritionImageKind = (typeof NUTRITION_IMAGE_KINDS)[number];
|
|
74
|
-
|
|
75
|
-
export interface NutritionImageEvidence {
|
|
76
|
-
readonly id?: string;
|
|
77
|
-
readonly kind: NutritionImageKind;
|
|
78
|
-
readonly storageId?: string;
|
|
79
|
-
readonly bucket?: string;
|
|
80
|
-
readonly path?: string;
|
|
81
|
-
readonly publicUrl?: string;
|
|
82
|
-
readonly contentType?: string;
|
|
83
|
-
readonly width?: number;
|
|
84
|
-
readonly height?: number;
|
|
85
|
-
readonly capturedAt?: NutritionIsoDateTime;
|
|
86
|
-
readonly metadata?: Record<string, NutritionJsonValue>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface NutritionProductSummary {
|
|
90
|
-
readonly id: NutritionProductId;
|
|
91
|
-
readonly primaryBarcode: NutritionBarcode;
|
|
92
|
-
readonly name: string;
|
|
93
|
-
readonly brand?: string;
|
|
94
|
-
readonly quantity?: string;
|
|
95
|
-
readonly status: NutritionProductStatus;
|
|
96
|
-
readonly source: NutritionDataSource;
|
|
97
|
-
readonly sourceConfidence: NutritionSourceConfidence;
|
|
98
|
-
readonly imageUrl?: string;
|
|
99
|
-
readonly updatedAt: NutritionIsoDateTime;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface NutritionProduct {
|
|
103
|
-
readonly id: NutritionProductId;
|
|
104
|
-
readonly primaryBarcode: NutritionBarcode;
|
|
105
|
-
readonly barcodes?: readonly NutritionBarcode[];
|
|
106
|
-
readonly name: string;
|
|
107
|
-
readonly brand?: string;
|
|
108
|
-
readonly quantity?: string;
|
|
109
|
-
readonly packageSizeG?: number;
|
|
110
|
-
readonly packageSizeMl?: number;
|
|
111
|
-
readonly serving?: NutritionServing;
|
|
112
|
-
readonly nutrientsPer100g?: NutritionFactsPer100g;
|
|
113
|
-
readonly ingredients?: NutritionIngredientStatement;
|
|
114
|
-
readonly allergens?: readonly NutritionAllergenTag[];
|
|
115
|
-
readonly traces?: readonly NutritionAllergenTag[];
|
|
116
|
-
readonly stores?: readonly NutritionStoreObservation[];
|
|
117
|
-
readonly images?: readonly NutritionImageEvidence[];
|
|
118
|
-
readonly status: NutritionProductStatus;
|
|
119
|
-
readonly source: NutritionDataSource;
|
|
120
|
-
readonly sourceConfidence: NutritionSourceConfidence;
|
|
121
|
-
readonly sourcePayload?: NutritionJsonValue;
|
|
122
|
-
readonly verifiedByUser?: boolean;
|
|
123
|
-
readonly createdAt: NutritionIsoDateTime;
|
|
124
|
-
readonly updatedAt: NutritionIsoDateTime;
|
|
125
|
-
readonly publishedAt?: NutritionIsoDateTime | null;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface NutritionProductDetail {
|
|
129
|
-
readonly product: NutritionProduct;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export interface NutritionProductLookupByBarcodeResponse {
|
|
133
|
-
readonly product: NutritionProduct;
|
|
134
|
-
}
|
package/src/nutrition/review.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import type { NutritionCaptureSubmission, NutritionCaptureSubmissionStatus } from './capture';
|
|
2
|
-
import type {
|
|
3
|
-
NutritionCaptureSubmissionId,
|
|
4
|
-
NutritionIsoDateTime,
|
|
5
|
-
NutritionJsonValue,
|
|
6
|
-
NutritionProductId,
|
|
7
|
-
NutritionReviewId,
|
|
8
|
-
NutritionUserId,
|
|
9
|
-
} from './common';
|
|
10
|
-
import type { NutritionProduct } from './products';
|
|
11
|
-
|
|
12
|
-
export const NUTRITION_REVIEW_DECISIONS = [
|
|
13
|
-
'accept',
|
|
14
|
-
'reject',
|
|
15
|
-
'merge',
|
|
16
|
-
'request_changes',
|
|
17
|
-
'publish',
|
|
18
|
-
] as const;
|
|
19
|
-
export type NutritionReviewDecision = (typeof NUTRITION_REVIEW_DECISIONS)[number];
|
|
20
|
-
|
|
21
|
-
export interface NutritionReviewDecisionRequest {
|
|
22
|
-
readonly decision: NutritionReviewDecision;
|
|
23
|
-
readonly submissionId: NutritionCaptureSubmissionId;
|
|
24
|
-
readonly reviewerId?: NutritionUserId;
|
|
25
|
-
readonly targetProductId?: NutritionProductId;
|
|
26
|
-
readonly productOverride?: Partial<NutritionProduct>;
|
|
27
|
-
readonly note?: string;
|
|
28
|
-
readonly metadata?: Record<string, NutritionJsonValue>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface NutritionReviewDecisionResponse {
|
|
32
|
-
readonly reviewId: NutritionReviewId;
|
|
33
|
-
readonly submissionId: NutritionCaptureSubmissionId;
|
|
34
|
-
readonly decision: NutritionReviewDecision;
|
|
35
|
-
readonly status: NutritionCaptureSubmissionStatus;
|
|
36
|
-
readonly productId?: NutritionProductId;
|
|
37
|
-
readonly decidedAt: NutritionIsoDateTime;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface NutritionReviewRecord {
|
|
41
|
-
readonly id: NutritionReviewId;
|
|
42
|
-
readonly submissionId: NutritionCaptureSubmissionId;
|
|
43
|
-
readonly reviewerId?: NutritionUserId;
|
|
44
|
-
readonly decision: NutritionReviewDecision;
|
|
45
|
-
readonly previousStatus: NutritionCaptureSubmissionStatus;
|
|
46
|
-
readonly nextStatus: NutritionCaptureSubmissionStatus;
|
|
47
|
-
readonly targetProductId?: NutritionProductId | null;
|
|
48
|
-
readonly note?: string;
|
|
49
|
-
readonly metadata?: Record<string, NutritionJsonValue>;
|
|
50
|
-
readonly createdAt: NutritionIsoDateTime;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface NutritionReviewSubmissionListRequest {
|
|
54
|
-
readonly status?: NutritionCaptureSubmissionStatus;
|
|
55
|
-
readonly barcode?: string;
|
|
56
|
-
readonly store?: string;
|
|
57
|
-
readonly limit?: number;
|
|
58
|
-
readonly offset?: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface NutritionReviewSubmissionListResponse {
|
|
62
|
-
readonly submissions: readonly NutritionCaptureSubmission[];
|
|
63
|
-
readonly limit?: number;
|
|
64
|
-
readonly offset?: number;
|
|
65
|
-
}
|