@ankhorage/contracts 1.15.0 → 1.17.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +26 -5
  3. package/dist/data/apis.d.ts +76 -0
  4. package/dist/data/apis.d.ts.map +1 -0
  5. package/dist/data/apis.js +20 -0
  6. package/dist/data/apis.js.map +1 -0
  7. package/dist/data/index.d.ts +1 -1
  8. package/dist/data/index.d.ts.map +1 -1
  9. package/dist/data/index.js +1 -1
  10. package/dist/data/index.js.map +1 -1
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +1 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/nutrition/capture.d.ts +54 -0
  16. package/dist/nutrition/capture.d.ts.map +1 -0
  17. package/dist/nutrition/capture.js +8 -0
  18. package/dist/nutrition/capture.js.map +1 -0
  19. package/dist/nutrition/common.d.ts +22 -0
  20. package/dist/nutrition/common.d.ts.map +1 -0
  21. package/dist/nutrition/common.js +25 -0
  22. package/dist/nutrition/common.js.map +1 -0
  23. package/dist/nutrition/index.d.ts +5 -0
  24. package/dist/nutrition/index.d.ts.map +1 -0
  25. package/dist/nutrition/index.js +5 -0
  26. package/dist/nutrition/index.js.map +1 -0
  27. package/dist/nutrition/products.d.ts +93 -0
  28. package/dist/nutrition/products.d.ts.map +1 -0
  29. package/dist/nutrition/products.js +9 -0
  30. package/dist/nutrition/products.js.map +1 -0
  31. package/dist/nutrition/review.d.ts +47 -0
  32. package/dist/nutrition/review.d.ts.map +1 -0
  33. package/dist/nutrition/review.js +8 -0
  34. package/dist/nutrition/review.js.map +1 -0
  35. package/dist/types.d.ts +10 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/types.js +3 -0
  38. package/dist/types.js.map +1 -1
  39. package/package.json +5 -1
  40. package/src/contracts.test.ts +0 -49
  41. package/src/data/apis.test.ts +146 -0
  42. package/src/data/apis.ts +105 -0
  43. package/src/data/index.ts +1 -1
  44. package/src/index.ts +1 -0
  45. package/src/nutrition/capture.ts +80 -0
  46. package/src/nutrition/common.ts +51 -0
  47. package/src/nutrition/index.ts +4 -0
  48. package/src/nutrition/nutrition.test.ts +137 -0
  49. package/src/nutrition/products.ts +134 -0
  50. package/src/nutrition/review.ts +65 -0
  51. package/src/profile-contract.test.ts +33 -0
  52. package/src/types.ts +13 -0
  53. package/dist/data/datasets.d.ts +0 -20
  54. package/dist/data/datasets.d.ts.map +0 -1
  55. package/dist/data/datasets.js +0 -2
  56. package/dist/data/datasets.js.map +0 -1
  57. package/src/data/datasets.ts +0 -24
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ankhorage/contracts
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - aab2073: Add profile table metadata to auth profile specs.
8
+
9
+ ## 1.16.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 5105c41: Add API authoring contracts for generated and external APIs with explicit endpoints, generated CRUD presets, and collection-backed resources.
14
+
3
15
  ## 1.15.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -2,22 +2,22 @@
2
2
 
3
3
  Shared public contracts for Ankhorage packages and standalone provider packages.
4
4
 
5
- ## 🎯 What you get
5
+ ## What you get
6
6
 
7
7
  - Strongly typed app structures
8
8
  - Serializable schemas for app manifests and UI definitions
9
9
  - Provider-neutral runtime contracts for auth and database adapters
10
10
  - Clear contracts between systems without depending on framework internals
11
11
 
12
- ## Features
12
+ ## Features
13
13
 
14
14
  - Serializable app, action, theme, infra, and auth config contracts
15
15
  - UI and navigation definitions
16
- - Auth adapter contracts using `signIn`, `signUp`, and `signOut` naming
16
+ - Auth adapter contracts using signIn, signUp, and signOut naming
17
17
  - Database adapter contracts for provider-neutral CRUD-style access
18
18
  - Dedicated subpath exports for focused imports
19
19
 
20
- ## 📦 Usage
20
+ ## Usage
21
21
 
22
22
  ```ts
23
23
  import type { AppManifest } from '@ankhorage/contracts';
@@ -71,7 +71,28 @@ export function createSupabaseAuthAdapter(): AuthAdapter {
71
71
  }
72
72
  ```
73
73
 
74
- ## 🧠 Why this exists
74
+ ## Profile contract
75
+
76
+ Auth providers own identity records. App-facing profile data should be modeled separately, usually in an app table such as `profiles`.
77
+
78
+ ```ts
79
+ const auth = {
80
+ scope: 'global',
81
+ provider: 'supabase',
82
+ authorization: { kind: 'RBAC', engine: 'native' },
83
+ profile: {
84
+ fields: ['email', 'displayName', 'avatarUrl'],
85
+ table: 'profiles',
86
+ primaryKey: 'authUserId',
87
+ createStrategy: 'trigger',
88
+ updateStrategy: 'api',
89
+ },
90
+ };
91
+ ```
92
+
93
+ Generated infra can use this metadata to create and maintain app profile rows while leaving identity lifecycle changes to the auth provider.
94
+
95
+ ## Why this exists
75
96
 
76
97
  Contracts separates shared data and runtime contracts from implementation details.
77
98
  Standalone packages such as Supabase, Clerk, database providers, or UI/color
@@ -0,0 +1,76 @@
1
+ import type { DbCollectionDefinition } from '../db';
2
+ import type { DataOperationRequest, DataOperationResponse } from './operations';
3
+ import type { DataContractValue } from './values';
4
+ export declare const APP_API_KINDS: readonly ["external", "generated"];
5
+ export type AppApiKind = (typeof APP_API_KINDS)[number];
6
+ export declare const APP_API_GENERATED_PRESETS: readonly ["crud"];
7
+ export type AppApiGeneratedPreset = (typeof APP_API_GENERATED_PRESETS)[number];
8
+ export declare const APP_API_ENDPOINT_METHODS: readonly ["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"];
9
+ export type AppApiEndpointMethod = (typeof APP_API_ENDPOINT_METHODS)[number];
10
+ export declare const APP_API_ENDPOINT_INTENTS: readonly ["create", "custom", "delete", "list", "read", "update"];
11
+ export type AppApiEndpointIntent = (typeof APP_API_ENDPOINT_INTENTS)[number];
12
+ export type AppApiId = string;
13
+ export type AppApiEndpointId = string;
14
+ export type AppApiSeedRecord = Readonly<Record<string, DataContractValue>>;
15
+ export interface AppApiAuthRequirement {
16
+ readonly required?: boolean;
17
+ readonly roles?: readonly string[];
18
+ readonly permissions?: readonly string[];
19
+ readonly policy?: string;
20
+ readonly metadata?: DataContractValue;
21
+ }
22
+ export interface AppApiCollectionResourceDefinition {
23
+ readonly kind: 'collection';
24
+ readonly collection: DbCollectionDefinition;
25
+ readonly seed?: readonly AppApiSeedRecord[];
26
+ readonly metadata?: DataContractValue;
27
+ }
28
+ export type AppApiResourceDefinition = AppApiCollectionResourceDefinition;
29
+ export interface AppApiEndpointDefinition {
30
+ readonly id: AppApiEndpointId;
31
+ readonly label?: string;
32
+ readonly description?: string;
33
+ readonly method: AppApiEndpointMethod;
34
+ /**
35
+ * Path relative to the API base path. Use `/` for the base collection endpoint.
36
+ */
37
+ readonly path: string;
38
+ readonly intent?: AppApiEndpointIntent;
39
+ readonly request?: DataOperationRequest;
40
+ readonly response?: DataOperationResponse;
41
+ readonly auth?: AppApiAuthRequirement;
42
+ readonly metadata?: DataContractValue;
43
+ }
44
+ interface AppApiDefinitionBase {
45
+ readonly id: AppApiId;
46
+ readonly kind: AppApiKind;
47
+ readonly label?: string;
48
+ readonly description?: string;
49
+ readonly basePath: string;
50
+ readonly endpoints: readonly AppApiEndpointDefinition[];
51
+ readonly auth?: AppApiAuthRequirement;
52
+ readonly metadata?: DataContractValue;
53
+ }
54
+ export interface AppGeneratedApiDefinition extends AppApiDefinitionBase {
55
+ readonly kind: 'generated';
56
+ /**
57
+ * Preset used by authoring tools to seed standard endpoints. The resulting
58
+ * serialized API still stores concrete `endpoints[]` so custom endpoints can
59
+ * live next to generated CRUD operations.
60
+ */
61
+ readonly preset?: AppApiGeneratedPreset;
62
+ readonly resource?: AppApiResourceDefinition;
63
+ }
64
+ export interface AppExternalApiDefinition extends AppApiDefinitionBase {
65
+ readonly kind: 'external';
66
+ readonly baseUrl?: string;
67
+ readonly openApiUrl?: string;
68
+ }
69
+ export type AppApiDefinition = AppExternalApiDefinition | AppGeneratedApiDefinition;
70
+ export type AppApiRegistry = Readonly<Record<AppApiId, AppApiDefinition>>;
71
+ export interface AppDataManifest {
72
+ readonly apis?: AppApiRegistry;
73
+ }
74
+ export type AppApiManifest = AppDataManifest;
75
+ export {};
76
+ //# sourceMappingURL=apis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../src/data/apis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD,eAAO,MAAM,aAAa,oCAAqC,CAAC;AAChE,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,yBAAyB,mBAAoB,CAAC;AAC3D,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,uEAQ3B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,eAAO,MAAM,wBAAwB,mEAO3B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,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,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,wBAAwB,EAAE,CAAC;IACxD,QAAQ,CAAC,IAAI,CAAC,EAAE,qBAAqB,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,wBAAwB,CAAC;CAC9C;AAED,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB;IACpE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,GAAG,yBAAyB,CAAC;AAEpF,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;CAChC;AAED,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC"}
@@ -0,0 +1,20 @@
1
+ export const APP_API_KINDS = ['external', 'generated'];
2
+ export const APP_API_GENERATED_PRESETS = ['crud'];
3
+ export const APP_API_ENDPOINT_METHODS = [
4
+ 'DELETE',
5
+ 'GET',
6
+ 'HEAD',
7
+ 'OPTIONS',
8
+ 'PATCH',
9
+ 'POST',
10
+ 'PUT',
11
+ ];
12
+ export const APP_API_ENDPOINT_INTENTS = [
13
+ 'create',
14
+ 'custom',
15
+ 'delete',
16
+ 'list',
17
+ 'read',
18
+ 'update',
19
+ ];
20
+ //# sourceMappingURL=apis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apis.js","sourceRoot":"","sources":["../../src/data/apis.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAU,EAAE,WAAW,CAAU,CAAC;AAGhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,MAAM,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,KAAK;IACL,MAAM;IACN,SAAS;IACT,OAAO;IACP,MAAM;IACN,KAAK;CACG,CAAC;AAGX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,QAAQ;CACA,CAAC","sourcesContent":["import type { DbCollectionDefinition } from '../db';\nimport type { DataOperationRequest, DataOperationResponse } from './operations';\nimport type { DataContractValue } from './values';\n\nexport const APP_API_KINDS = ['external', 'generated'] as const;\nexport type AppApiKind = (typeof APP_API_KINDS)[number];\n\nexport const APP_API_GENERATED_PRESETS = ['crud'] as const;\nexport type AppApiGeneratedPreset = (typeof APP_API_GENERATED_PRESETS)[number];\n\nexport const APP_API_ENDPOINT_METHODS = [\n 'DELETE',\n 'GET',\n 'HEAD',\n 'OPTIONS',\n 'PATCH',\n 'POST',\n 'PUT',\n] as const;\nexport type AppApiEndpointMethod = (typeof APP_API_ENDPOINT_METHODS)[number];\n\nexport const APP_API_ENDPOINT_INTENTS = [\n 'create',\n 'custom',\n 'delete',\n 'list',\n 'read',\n 'update',\n] as const;\nexport type AppApiEndpointIntent = (typeof APP_API_ENDPOINT_INTENTS)[number];\n\nexport type AppApiId = string;\nexport type AppApiEndpointId = string;\nexport type AppApiSeedRecord = Readonly<Record<string, DataContractValue>>;\n\nexport interface AppApiAuthRequirement {\n readonly required?: boolean;\n readonly roles?: readonly string[];\n readonly permissions?: readonly string[];\n readonly policy?: string;\n readonly metadata?: DataContractValue;\n}\n\nexport interface AppApiCollectionResourceDefinition {\n readonly kind: 'collection';\n readonly collection: DbCollectionDefinition;\n readonly seed?: readonly AppApiSeedRecord[];\n readonly metadata?: DataContractValue;\n}\n\nexport type AppApiResourceDefinition = AppApiCollectionResourceDefinition;\n\nexport interface AppApiEndpointDefinition {\n readonly id: AppApiEndpointId;\n readonly label?: string;\n readonly description?: string;\n readonly method: AppApiEndpointMethod;\n /**\n * Path relative to the API base path. Use `/` for the base collection endpoint.\n */\n readonly path: string;\n readonly intent?: AppApiEndpointIntent;\n readonly request?: DataOperationRequest;\n readonly response?: DataOperationResponse;\n readonly auth?: AppApiAuthRequirement;\n readonly metadata?: DataContractValue;\n}\n\ninterface AppApiDefinitionBase {\n readonly id: AppApiId;\n readonly kind: AppApiKind;\n readonly label?: string;\n readonly description?: string;\n readonly basePath: string;\n readonly endpoints: readonly AppApiEndpointDefinition[];\n readonly auth?: AppApiAuthRequirement;\n readonly metadata?: DataContractValue;\n}\n\nexport interface AppGeneratedApiDefinition extends AppApiDefinitionBase {\n readonly kind: 'generated';\n /**\n * Preset used by authoring tools to seed standard endpoints. The resulting\n * serialized API still stores concrete `endpoints[]` so custom endpoints can\n * live next to generated CRUD operations.\n */\n readonly preset?: AppApiGeneratedPreset;\n readonly resource?: AppApiResourceDefinition;\n}\n\nexport interface AppExternalApiDefinition extends AppApiDefinitionBase {\n readonly kind: 'external';\n readonly baseUrl?: string;\n readonly openApiUrl?: string;\n}\n\nexport type AppApiDefinition = AppExternalApiDefinition | AppGeneratedApiDefinition;\n\nexport type AppApiRegistry = Readonly<Record<AppApiId, AppApiDefinition>>;\n\nexport interface AppDataManifest {\n readonly apis?: AppApiRegistry;\n}\n\nexport type AppApiManifest = AppDataManifest;\n"]}
@@ -1,4 +1,4 @@
1
- export * from './datasets';
1
+ export * from './apis';
2
2
  export * from './diagnostics';
3
3
  export * from './endpoints';
4
4
  export * from './ids';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- export * from './datasets';
1
+ export * from './apis';
2
2
  export * from './diagnostics';
3
3
  export * from './endpoints';
4
4
  export * from './ids';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC","sourcesContent":["export * from './datasets';\nexport * from './diagnostics';\nexport * from './endpoints';\nexport * from './ids';\nexport * from './operations';\nexport * from './refs';\nexport * from './schemas';\nexport * from './sources';\nexport * from './values';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC","sourcesContent":["export * from './apis';\nexport * from './diagnostics';\nexport * from './endpoints';\nexport * from './ids';\nexport * from './operations';\nexport * from './refs';\nexport * from './schemas';\nexport * from './sources';\nexport * from './values';\n"]}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './auth';
2
2
  export * from './bindings';
3
3
  export * from './data';
4
4
  export * from './db';
5
+ export * from './nutrition';
5
6
  export * from './state';
6
7
  export * from './storage';
7
8
  export * from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export * from './auth';
2
2
  export * from './bindings';
3
3
  export * from './data';
4
4
  export * from './db';
5
+ export * from './nutrition';
5
6
  export * from './state';
6
7
  export * from './storage';
7
8
  export * from './types';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC","sourcesContent":["export * from './auth';\nexport * from './bindings';\nexport * from './data';\nexport * from './db';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\nexport * from './ui';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC","sourcesContent":["export * from './auth';\nexport * from './bindings';\nexport * from './data';\nexport * from './db';\nexport * from './nutrition';\nexport * from './state';\nexport * from './storage';\nexport * from './types';\nexport * from './ui';\n"]}
@@ -0,0 +1,54 @@
1
+ import type { NutritionBarcode, NutritionCaptureSubmissionId, NutritionIsoDateTime, NutritionJsonValue, NutritionProductId, NutritionUserId } from './common';
2
+ import type { NutritionFactsPer100g, NutritionImageEvidence, NutritionIngredientStatement, NutritionServing, NutritionStoreObservation } from './products';
3
+ export declare const NUTRITION_CAPTURE_SUBMISSION_STATUSES: readonly ["queued", "needs_more_data", "accepted", "rejected", "merged"];
4
+ export type NutritionCaptureSubmissionStatus = (typeof NUTRITION_CAPTURE_SUBMISSION_STATUSES)[number];
5
+ export interface NutritionCaptureClientContext {
6
+ readonly userId?: NutritionUserId;
7
+ readonly anonymousDeviceId?: string;
8
+ readonly platform?: 'android' | 'ios' | 'web' | (string & {});
9
+ readonly appVersion?: string;
10
+ readonly locale?: string;
11
+ readonly clientCapturedAt?: NutritionIsoDateTime;
12
+ }
13
+ export interface NutritionProductCaptureDraft {
14
+ readonly barcode: NutritionBarcode;
15
+ readonly name?: string;
16
+ readonly brand?: string;
17
+ readonly quantity?: string;
18
+ readonly packageSizeG?: number;
19
+ readonly packageSizeMl?: number;
20
+ readonly serving?: NutritionServing;
21
+ readonly nutrientsPer100g?: NutritionFactsPer100g;
22
+ readonly ingredients?: NutritionIngredientStatement;
23
+ readonly storeObservation?: NutritionStoreObservation;
24
+ readonly images?: readonly NutritionImageEvidence[];
25
+ readonly rawPayload?: NutritionJsonValue;
26
+ }
27
+ export interface NutritionProductCaptureRequest {
28
+ readonly draft: NutritionProductCaptureDraft;
29
+ readonly client?: NutritionCaptureClientContext;
30
+ }
31
+ export interface NutritionProductCaptureResponse {
32
+ readonly submissionId: NutritionCaptureSubmissionId;
33
+ readonly status: NutritionCaptureSubmissionStatus;
34
+ readonly productId?: NutritionProductId;
35
+ readonly message?: string;
36
+ }
37
+ export interface NutritionProductCorrectionRequest {
38
+ readonly productId: NutritionProductId;
39
+ readonly patch: Partial<NutritionProductCaptureDraft>;
40
+ readonly client?: NutritionCaptureClientContext;
41
+ readonly note?: string;
42
+ }
43
+ export interface NutritionCaptureSubmission {
44
+ readonly id: NutritionCaptureSubmissionId;
45
+ readonly status: NutritionCaptureSubmissionStatus;
46
+ readonly draft: NutritionProductCaptureDraft;
47
+ readonly client?: NutritionCaptureClientContext;
48
+ readonly matchedProductId?: NutritionProductId | null;
49
+ readonly reviewerNote?: string;
50
+ readonly createdAt: NutritionIsoDateTime;
51
+ readonly updatedAt: NutritionIsoDateTime;
52
+ readonly decidedAt?: NutritionIsoDateTime | null;
53
+ }
54
+ //# sourceMappingURL=capture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/nutrition/capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,4BAA4B,EAC5B,oBAAoB,EACpB,kBAAkB,EAClB,kBA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UTRITION_CAPTURE_SUBMISSION_STATUSES = [
2
+ 'queued',
3
+ 'needs_more_data',
4
+ 'accepted',
5
+ 'rejected',
6
+ 'merged',
7
+ ];
8
+ //# sourceMappingURL=capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture.js","sourceRoot":"","sources":["../../src/nutrition/capture.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,QAAQ;IACR,iBAAiB;IACjB,UAAU;IACV,UAAU;IACV,QAAQ;CACA,CAAC","sourcesContent":["import type {\n NutritionBarcode,\n NutritionCaptureSubmissionId,\n NutritionIsoDateTime,\n NutritionJsonValue,\n NutritionProductId,\n NutritionUserId,\n} from './common';\nimport type {\n NutritionFactsPer100g,\n NutritionImageEvidence,\n NutritionIngredientStatement,\n NutritionServing,\n NutritionStoreObservation,\n} from './products';\n\nexport const NUTRITION_CAPTURE_SUBMISSION_STATUSES = [\n 'queued',\n 'needs_more_data',\n 'accepted',\n 'rejected',\n 'merged',\n] as const;\nexport type NutritionCaptureSubmissionStatus =\n (typeof NUTRITION_CAPTURE_SUBMISSION_STATUSES)[number];\n\nexport interface NutritionCaptureClientContext {\n readonly userId?: NutritionUserId;\n readonly anonymousDeviceId?: string;\n readonly platform?: 'android' | 'ios' | 'web' | (string & {});\n readonly appVersion?: string;\n readonly locale?: string;\n readonly clientCapturedAt?: NutritionIsoDateTime;\n}\n\nexport interface NutritionProductCaptureDraft {\n readonly barcode: 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 storeObservation?: NutritionStoreObservation;\n readonly images?: readonly NutritionImageEvidence[];\n readonly rawPayload?: NutritionJsonValue;\n}\n\nexport interface NutritionProductCaptureRequest {\n readonly draft: NutritionProductCaptureDraft;\n readonly client?: NutritionCaptureClientContext;\n}\n\nexport interface NutritionProductCaptureResponse {\n readonly submissionId: NutritionCaptureSubmissionId;\n readonly status: NutritionCaptureSubmissionStatus;\n readonly productId?: NutritionProductId;\n readonly message?: string;\n}\n\nexport interface NutritionProductCorrectionRequest {\n readonly productId: NutritionProductId;\n readonly patch: Partial<NutritionProductCaptureDraft>;\n readonly client?: NutritionCaptureClientContext;\n readonly note?: string;\n}\n\nexport interface NutritionCaptureSubmission {\n readonly id: NutritionCaptureSubmissionId;\n readonly status: NutritionCaptureSubmissionStatus;\n readonly draft: NutritionProductCaptureDraft;\n readonly client?: NutritionCaptureClientContext;\n readonly matchedProductId?: NutritionProductId | null;\n readonly reviewerNote?: string;\n readonly createdAt: NutritionIsoDateTime;\n readonly updatedAt: NutritionIsoDateTime;\n readonly decidedAt?: NutritionIsoDateTime | null;\n}\n"]}
@@ -0,0 +1,22 @@
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
+ export type NutritionJsonValue = boolean | number | string | null | readonly NutritionJsonValue[] | {
7
+ readonly [key: string]: NutritionJsonValue;
8
+ };
9
+ export declare const NUTRITION_BARCODE_TYPES: readonly ["ean_8", "ean_13", "upc_a", "upc_e", "gtin_14", "unknown"];
10
+ export type NutritionBarcodeType = (typeof NUTRITION_BARCODE_TYPES)[number];
11
+ export interface NutritionBarcode {
12
+ readonly value: string;
13
+ readonly type: NutritionBarcodeType;
14
+ readonly normalizedValue?: string;
15
+ }
16
+ export declare const NUTRITION_PRODUCT_STATUSES: readonly ["draft", "pending_review", "published", "rejected", "archived"];
17
+ export type NutritionProductStatus = (typeof NUTRITION_PRODUCT_STATUSES)[number];
18
+ export declare const NUTRITION_DATA_SOURCES: readonly ["manual_scan", "user_correction", "open_food_facts", "foodrepo_legacy", "retailer_import", "admin_import"];
19
+ export type NutritionDataSource = (typeof NUTRITION_DATA_SOURCES)[number];
20
+ export declare const NUTRITION_SOURCE_CONFIDENCE_LEVELS: readonly ["unknown", "low", "medium", "high"];
21
+ export type NutritionSourceConfidence = (typeof NUTRITION_SOURCE_CONFIDENCE_LEVELS)[number];
22
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/nutrition/common.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAC1C,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACxC,MAAM,MAAM,4BAA4B,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACvC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC;AAErC,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,MAAM,GACN,MAAM,GACN,IAAI,GACJ,SAAS,kBAAkB,EAAE,GAC7B;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAAA;CAAE,CAAC;AAEnD,eAAO,MAAM,uBAAuB,sEAO1B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,0BAA0B,2EAM7B,CAAC;AACX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,eAAO,MAAM,sBAAsB,sHAOzB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,eAAO,MAAM,kCAAkC,+CAAgD,CAAC;AAChG,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ export const NUTRITION_BARCODE_TYPES = [
2
+ 'ean_8',
3
+ 'ean_13',
4
+ 'upc_a',
5
+ 'upc_e',
6
+ 'gtin_14',
7
+ 'unknown',
8
+ ];
9
+ export const NUTRITION_PRODUCT_STATUSES = [
10
+ 'draft',
11
+ 'pending_review',
12
+ 'published',
13
+ 'rejected',
14
+ 'archived',
15
+ ];
16
+ export const NUTRITION_DATA_SOURCES = [
17
+ 'manual_scan',
18
+ 'user_correction',
19
+ 'open_food_facts',
20
+ 'foodrepo_legacy',
21
+ 'retailer_import',
22
+ 'admin_import',
23
+ ];
24
+ export const NUTRITION_SOURCE_CONFIDENCE_LEVELS = ['unknown', 'low', 'medium', 'high'];
25
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/nutrition/common.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,SAAS;IACT,SAAS;CACD,CAAC;AASX,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,OAAO;IACP,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,UAAU;CACF,CAAC;AAGX,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,aAAa;IACb,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,cAAc;CACN,CAAC;AAGX,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC","sourcesContent":["export type NutritionIsoDateTime = string;\nexport type NutritionProductId = string;\nexport type NutritionCaptureSubmissionId = string;\nexport type NutritionReviewId = string;\nexport type NutritionUserId = string;\n\nexport type NutritionJsonValue =\n | boolean\n | number\n | string\n | null\n | readonly NutritionJsonValue[]\n | { readonly [key: string]: NutritionJsonValue };\n\nexport const NUTRITION_BARCODE_TYPES = [\n 'ean_8',\n 'ean_13',\n 'upc_a',\n 'upc_e',\n 'gtin_14',\n 'unknown',\n] as const;\nexport type NutritionBarcodeType = (typeof NUTRITION_BARCODE_TYPES)[number];\n\nexport interface NutritionBarcode {\n readonly value: string;\n readonly type: NutritionBarcodeType;\n readonly normalizedValue?: string;\n}\n\nexport const NUTRITION_PRODUCT_STATUSES = [\n 'draft',\n 'pending_review',\n 'published',\n 'rejected',\n 'archived',\n] as const;\nexport type NutritionProductStatus = (typeof NUTRITION_PRODUCT_STATUSES)[number];\n\nexport const NUTRITION_DATA_SOURCES = [\n 'manual_scan',\n 'user_correction',\n 'open_food_facts',\n 'foodrepo_legacy',\n 'retailer_import',\n 'admin_import',\n] as const;\nexport type NutritionDataSource = (typeof NUTRITION_DATA_SOURCES)[number];\n\nexport const NUTRITION_SOURCE_CONFIDENCE_LEVELS = ['unknown', 'low', 'medium', 'high'] as const;\nexport type NutritionSourceConfidence = (typeof NUTRITION_SOURCE_CONFIDENCE_LEVELS)[number];\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './capture';
2
+ export * from './common';
3
+ export * from './products';
4
+ export * from './review';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nutrition/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from './capture';
2
+ export * from './common';
3
+ export * from './products';
4
+ export * from './review';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nutrition/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC","sourcesContent":["export * from './capture';\nexport * from './common';\nexport * from './products';\nexport * from './review';\n"]}
@@ -0,0 +1,93 @@
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
@@ -0,0 +1 @@
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,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAA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AQ,CAAC,SAAS,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACrD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,yBAAyB,EAAE,CAAC;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;IACrD,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAC5C,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC"}
@@ -0,0 +1,9 @@
1
+ export const NUTRITION_IMAGE_KINDS = [
2
+ 'front',
3
+ 'nutrition_label',
4
+ 'ingredients',
5
+ 'barcode',
6
+ 'package_back',
7
+ 'other',
8
+ ];
9
+ //# sourceMappingURL=products.js.map
@@ -0,0 +1 @@
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"]}
@@ -0,0 +1,47 @@
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
@@ -0,0 +1 @@
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,UA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,gCAAgC,CAAC;IACtD,QAAQ,CAAC,eAAe,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACvD,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;CAC1C;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE,gCAAgC,CAAC;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,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"}
@@ -0,0 +1,8 @@
1
+ export const NUTRITION_REVIEW_DECISIONS = [
2
+ 'accept',
3
+ 'reject',
4
+ 'merge',
5
+ 'request_changes',
6
+ 'publish',
7
+ ];
8
+ //# sourceMappingURL=review.js.map
@@ -0,0 +1 @@
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"]}