@ankhorage/contracts 1.16.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 (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +26 -5
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/nutrition/capture.d.ts +54 -0
  8. package/dist/nutrition/capture.d.ts.map +1 -0
  9. package/dist/nutrition/capture.js +8 -0
  10. package/dist/nutrition/capture.js.map +1 -0
  11. package/dist/nutrition/common.d.ts +22 -0
  12. package/dist/nutrition/common.d.ts.map +1 -0
  13. package/dist/nutrition/common.js +25 -0
  14. package/dist/nutrition/common.js.map +1 -0
  15. package/dist/nutrition/index.d.ts +5 -0
  16. package/dist/nutrition/index.d.ts.map +1 -0
  17. package/dist/nutrition/index.js +5 -0
  18. package/dist/nutrition/index.js.map +1 -0
  19. package/dist/nutrition/products.d.ts +93 -0
  20. package/dist/nutrition/products.d.ts.map +1 -0
  21. package/dist/nutrition/products.js +9 -0
  22. package/dist/nutrition/products.js.map +1 -0
  23. package/dist/nutrition/review.d.ts +47 -0
  24. package/dist/nutrition/review.d.ts.map +1 -0
  25. package/dist/nutrition/review.js +8 -0
  26. package/dist/nutrition/review.js.map +1 -0
  27. package/dist/types.d.ts +10 -0
  28. package/dist/types.d.ts.map +1 -1
  29. package/dist/types.js +3 -0
  30. package/dist/types.js.map +1 -1
  31. package/package.json +5 -1
  32. package/src/index.ts +1 -0
  33. package/src/nutrition/capture.ts +80 -0
  34. package/src/nutrition/common.ts +51 -0
  35. package/src/nutrition/index.ts +4 -0
  36. package/src/nutrition/nutrition.test.ts +137 -0
  37. package/src/nutrition/products.ts +134 -0
  38. package/src/nutrition/review.ts +65 -0
  39. package/src/profile-contract.test.ts +33 -0
  40. package/src/types.ts +13 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 1.16.0
4
10
 
5
11
  ### 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
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,kBAAkB,EAClB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,qCAAqC,0EAMxC,CAAC;AACX,MAAM,MAAM,gCAAgC,GAC1C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AC;CACjD;AAED,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,YAAY,EAAE,4BAA4B,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,gCAAgC,CAAC;IAClD,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACtD,QAAQ,CAAC,MAAM,CAAC,EAAE,6BAA6B,CAAC;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,EAAE,4BAA4B,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,gCAAgC,CAAC;IAClD,QAAQ,CAAC,KAAK,EAAE,4BAA4B,CAAC;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,6BAA6B,CAAC;IAChD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACtD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAClD"}
@@ -0,0 +1,8 @@
1
+ export const NUTRITION_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":["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own',
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,EA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AsB,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,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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,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"]}
package/dist/types.d.ts CHANGED
@@ -111,6 +111,12 @@ export type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];
111
111
  export declare const AUTH_PROFILE_FIELDS: readonly ["email", "username", "phone", "firstName", "lastName", "displayName", "avatarUrl"];
112
112
  export type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];
113
113
  export type AuthProfileField = KnownAuthProfileField | (string & {});
114
+ export declare const AUTH_PROFILE_PRIMARY_KEY_STRATEGIES: readonly ["authUserId"];
115
+ export type AuthProfilePrimaryKeyStrategy = (typeof AUTH_PROFILE_PRIMARY_KEY_STRATEGIES)[number];
116
+ export declare const AUTH_PROFILE_CREATE_STRATEGIES: readonly ["trigger", "api", "app"];
117
+ export type AuthProfileCreateStrategy = (typeof AUTH_PROFILE_CREATE_STRATEGIES)[number];
118
+ export declare const AUTH_PROFILE_UPDATE_STRATEGIES: readonly ["api", "app"];
119
+ export type AuthProfileUpdateStrategy = (typeof AUTH_PROFILE_UPDATE_STRATEGIES)[number];
114
120
  export interface IconSpec {
115
121
  name: string;
116
122
  provider?: string;
@@ -190,6 +196,10 @@ export interface AuthSignUpSpec {
190
196
  }
191
197
  export interface AuthProfileSpec {
192
198
  fields: AuthProfileField[];
199
+ table?: string;
200
+ primaryKey?: AuthProfilePrimaryKeyStrategy;
201
+ createStrategy?: AuthProfileCreateStrategy;
202
+ updateStrategy?: AuthProfileUpdateStrategy;
193
203
  }
194
204
  export interface AuthSpec {
195
205
  scope: AuthScope;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACnG,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,eAAe,CAAC;IACvB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,MAAM,MAAM,UAAU,GAClB,UAAU,GACV,OAAO,GACP,SAAS,GACT,gBAAgB,GAChB,aAAa,GACb,QAAQ,GACR,QAAQ,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QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE;YACZ,aAAa,EAAE,MAAM,CAAC;YACtB,OAAO,EAAE,MAAM,EAAE,CAAC;SACnB,CAAC;QACF,QAAQ,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH"}
package/dist/types.js CHANGED
@@ -43,4 +43,7 @@ export const AUTH_PROFILE_FIELDS = [
43
43
  'displayName',
44
44
  'avatarUrl',
45
45
  ];
46
+ export const AUTH_PROFILE_PRIMARY_KEY_STRATEGIES = ['authUserId'];
47
+ export const AUTH_PROFILE_CREATE_STRATEGIES = ['trigger', 'api', 'app'];
48
+ export const AUTH_PROFILE_UPDATE_STRATEGIES = ['api', 'app'];
46
49
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAsIA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAGpE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,kBAAkB;IAClB,QAAQ;IACR,iBAAiB;IACjB,SAAS;CACD,CAAC;AAGX,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,CAAU,CAAC;AAIxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,UAAU,CAAU,CAAC;AAIxD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,MAAM,CAAU,CAAC;AAGvD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AAG/D,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAQ,CAAU,CAAC;AAInD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAGxF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAC;AAGrD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAGrE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,CAAU,CAAC;AAIpD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAU,CAAC;AAGhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,YAAY,EAAE,qBAAqB,CAAU,CAAC;AAGpF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,GAAG,wBAAwB;IAC3B,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;CACH,CAAC","sourcesContent":["import type { ColorHarmony } from '@ankhorage/color-theory';\n\nimport type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';\nimport type { ComponentDataBindingRegistry } from './bindings';\nimport type { AppDataManifest, DataSourceRegistry } from './data';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n}\n\nexport interface ThemeConfig {\n id: string;\n name: string;\n light: ThemeModeConfig;\n dark: ThemeModeConfig;\n}\n\nexport type ActionType =\n | 'navigate'\n | 'alert'\n | 'console'\n | 'toggleDarkMode'\n | 'setLanguage'\n | 'search'\n | 'filter';\n\nexport interface NavigateAction {\n type: 'navigate';\n payload: {\n route: string;\n params?: Record<string, number | string>;\n };\n}\n\nexport interface AlertAction {\n type: 'alert';\n payload?: {\n message?: string;\n };\n}\n\nexport interface ConsoleAction {\n type: 'console';\n payload?: Record<string, unknown>;\n}\n\nexport interface ToggleDarkModeAction {\n type: 'toggleDarkMode';\n payload?: never;\n}\n\nexport interface SetLanguageAction {\n type: 'setLanguage';\n payload: {\n locale: string;\n };\n}\n\nexport interface SearchAction {\n type: 'search';\n payload: {\n query: string;\n scope?: string;\n };\n}\n\nexport interface FilterAction {\n type: 'filter';\n payload: {\n filterKey: string;\n filterValue: string;\n };\n}\n\nexport type Action =\n | AlertAction\n | ConsoleAction\n | FilterAction\n | NavigateAction\n | SearchAction\n | SetLanguageAction\n | ToggleDarkModeAction;\n\nexport type ManifestValue =\n | string\n | number\n | boolean\n | null\n | readonly ManifestValue[]\n | { readonly [key: string]: ManifestValue };\n\nexport type ComponentEventPayloadValue = ManifestValue;\n\nexport interface ComponentEventDto<\n TType extends string = string,\n TPayload extends object = Record<string, ComponentEventPayloadValue>,\n> {\n readonly type: TType;\n readonly sourceNodeId: string;\n readonly payload: TPayload;\n}\n\nexport type FormSubmitValues = Record<string, ComponentEventPayloadValue>;\n\nexport type FormSubmitEventDto = ComponentEventDto<\n 'form.submit',\n {\n readonly values: FormSubmitValues;\n }\n>;\n\nexport type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;\n\nexport interface CollectionItemPressPayload {\n readonly itemId: string | number;\n readonly item: Record<string, ComponentEventPayloadValue>;\n}\n\nexport type CollectionItemPressEventDto = ComponentEventDto<\n 'collection.itemPress',\n CollectionItemPressPayload\n>;\n\nexport type ComponentEventDtoKind =\n | ButtonPressEventDto['type']\n | CollectionItemPressEventDto['type']\n | FormSubmitEventDto['type'];\n\nexport type KnownComponentEventDto =\n | ButtonPressEventDto\n | CollectionItemPressEventDto\n | FormSubmitEventDto;\n\nexport const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const APP_CATEGORIES = [\n 'books_reading',\n 'business_productivity',\n 'developer_tools',\n 'education_learning',\n 'entertainment_media',\n 'finance_money',\n 'food_drink',\n 'games',\n 'graphics_design',\n 'health_fitness',\n 'kids_family',\n 'lifestyle',\n 'medical',\n 'music_audio',\n 'navigation_travel',\n 'news_magazines',\n 'photo_video',\n 'reference',\n 'shopping_commerce',\n 'social_community',\n 'sports',\n 'utilities_tools',\n 'weather',\n] as const;\nexport type AppCategory = (typeof APP_CATEGORIES)[number];\n\nexport const DEPLOYMENT_TARGETS = ['minikube'] as const;\nexport type KnownDeploymentTarget = (typeof DEPLOYMENT_TARGETS)[number];\nexport type DeploymentTarget = KnownDeploymentTarget | (string & {});\n\nexport const DATABASE_PROVIDERS = ['supabase'] as const;\nexport type KnownDatabaseProvider = (typeof DATABASE_PROVIDERS)[number];\nexport type DatabaseProvider = KnownDatabaseProvider | (string & {});\n\nexport const DATABASE_TIERS = ['dev', 'prod'] as const;\nexport type DatabaseTier = (typeof DATABASE_TIERS)[number];\n\nexport const STORAGE_PROVIDERS = ['auto', 's3', 'r2'] as const;\nexport type StorageProvider = (typeof STORAGE_PROVIDERS)[number];\n\nexport const STATE_PROVIDERS = ['legend'] as const;\nexport type KnownStateProvider = (typeof STATE_PROVIDERS)[number];\nexport type StateProvider = KnownStateProvider | (string & {});\n\nexport const STATE_PERSISTENCE_MODES = ['none', 'local', 'secure', 'database'] as const;\nexport type StatePersistenceMode = (typeof STATE_PERSISTENCE_MODES)[number];\n\nexport const AUTHZ_KINDS = ['RBAC', 'ABAC'] as const;\nexport type AuthzKind = (typeof AUTHZ_KINDS)[number];\n\nexport const AUTHZ_ENGINES = ['cerbos', 'native'] as const;\nexport type AuthzEngine = (typeof AUTHZ_ENGINES)[number];\n\nexport const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;\nexport type AuthScope = (typeof AUTH_SCOPES)[number];\n\nexport const AUTH_PROVIDERS = ['supabase'] as const;\nexport type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];\nexport type AuthProvider = KnownAuthProvider | (string & {});\n\nexport const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;\nexport type AuthSignInIdentifier = AuthIdentifierKind;\n\nexport const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;\nexport type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];\n\nexport const AUTH_PROFILE_FIELDS = [\n ...AUTH_SIGN_IN_IDENTIFIERS,\n 'firstName',\n 'lastName',\n 'displayName',\n 'avatarUrl',\n] as const;\nexport type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];\nexport type AuthProfileField = KnownAuthProfileField | (string & {});\n\nexport interface IconSpec {\n name: string;\n provider?: string;\n size?: number | string;\n color?: string;\n}\n\nexport interface UiNode {\n id: string;\n type: string;\n alias?: string;\n props?: Record<string, unknown>;\n children?: UiNode[];\n style?: Record<string, number | string>;\n}\n\nexport interface ScreenSpec {\n id: string;\n name: string;\n title?: string;\n description?: string;\n root: UiNode;\n}\n\nexport interface NavigatorSpec {\n type: NavigatorType;\n initialRouteName?: string;\n routes: RouteDefinition[];\n options?: Record<string, unknown>;\n}\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n hideInTabBar?: boolean;\n guards?: string[];\n screenId?: string;\n navigator?: NavigatorSpec;\n}\n\nexport type SplashScreenResizeMode = 'contain' | 'cover' | 'native';\n\nexport interface SplashScreenAssetSpec {\n readonly image?: string;\n readonly imageWidth?: number;\n readonly resizeMode?: SplashScreenResizeMode;\n}\n\nexport interface SplashScreenModeSpec extends SplashScreenAssetSpec {\n readonly backgroundColor?: string;\n}\n\nexport interface SplashScreenSpec extends SplashScreenModeSpec {\n readonly dark?: SplashScreenModeSpec;\n}\n\nexport interface DeploymentSpec {\n target: DeploymentTarget;\n monitoring: boolean;\n}\n\nexport interface DatabaseSpec {\n provider: DatabaseProvider;\n tier: DatabaseTier;\n}\n\nexport interface StorageSpec {\n provider: StorageProvider;\n buckets: string[];\n}\n\nexport interface StateSpec {\n readonly provider: StateProvider;\n readonly persistence?: StatePersistenceMode;\n}\n\nexport interface AuthzSpec {\n kind: AuthzKind;\n engine: AuthzEngine;\n}\n\nexport interface AuthSignInSpec {\n identifiers: AuthSignInIdentifier[];\n}\n\nexport interface AuthSignUpSpec {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n signUpPolicy?: AuthSignUpPolicy;\n}\n\nexport interface AuthProfileSpec {\n fields: AuthProfileField[];\n}\n\nexport interface AuthSpec {\n scope: AuthScope;\n provider: AuthProvider;\n authorization: AuthzSpec;\n flow?: AuthFlowConfig;\n signIn?: AuthSignInSpec;\n signUp?: AuthSignUpSpec;\n oauth?: AuthOAuthConfig;\n profile?: AuthProfileSpec;\n}\n\nexport interface NetworkingSpec {\n domain?: string;\n cdn: boolean;\n}\n\nexport interface InfraManifest {\n deployment?: DeploymentSpec;\n auth?: AuthSpec;\n database?: DatabaseSpec;\n storage?: StorageSpec;\n state?: StateSpec;\n networking?: NetworkingSpec;\n plugins: string[];\n pluginsConfig?: Record<string, unknown>;\n}\n\nexport interface AppManifest {\n metadata: {\n name: string;\n slug: string;\n version: string;\n themeId: string;\n created?: string;\n updated?: string;\n };\n themes: ThemeConfig[];\n activeThemeId: string;\n activeThemeMode?: 'dark' | 'light';\n splashScreen?: SplashScreenSpec;\n infra: InfraManifest;\n navigator: NavigatorSpec;\n screens: Record<string, ScreenSpec>;\n data?: AppDataManifest;\n dataSources?: DataSourceRegistry;\n dataBindings?: ComponentDataBindingRegistry;\n settings: {\n apiBaseUrl?: string;\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n authFlow: AuthFlowConfig;\n };\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAsIA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAC;AAGpE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,eAAe;IACf,uBAAuB;IACvB,iBAAiB;IACjB,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,SAAS;IACT,aAAa;IACb,mBAAmB;IACnB,gBAAgB;IAChB,aAAa;IACb,WAAW;IACX,mBAAmB;IACnB,kBAAkB;IAClB,QAAQ;IACR,iBAAiB;I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8B,GAAG,CAAC,KAAK,EAAE,KAAK,CAAU,CAAC","sourcesContent":["import type { ColorHarmony } from '@ankhorage/color-theory';\n\nimport type { AuthFlowConfig, AuthIdentifierKind, AuthOAuthConfig, AuthSignUpField } from './auth';\nimport type { ComponentDataBindingRegistry } from './bindings';\nimport type { AppDataManifest, DataSourceRegistry } from './data';\n\nexport interface ThemeModeConfig {\n primaryColor: string;\n harmony: ColorHarmony;\n}\n\nexport interface ThemeConfig {\n id: string;\n name: string;\n light: ThemeModeConfig;\n dark: ThemeModeConfig;\n}\n\nexport type ActionType =\n | 'navigate'\n | 'alert'\n | 'console'\n | 'toggleDarkMode'\n | 'setLanguage'\n | 'search'\n | 'filter';\n\nexport interface NavigateAction {\n type: 'navigate';\n payload: {\n route: string;\n params?: Record<string, number | string>;\n };\n}\n\nexport interface AlertAction {\n type: 'alert';\n payload?: {\n message?: string;\n };\n}\n\nexport interface ConsoleAction {\n type: 'console';\n payload?: Record<string, unknown>;\n}\n\nexport interface ToggleDarkModeAction {\n type: 'toggleDarkMode';\n payload?: never;\n}\n\nexport interface SetLanguageAction {\n type: 'setLanguage';\n payload: {\n locale: string;\n };\n}\n\nexport interface SearchAction {\n type: 'search';\n payload: {\n query: string;\n scope?: string;\n };\n}\n\nexport interface FilterAction {\n type: 'filter';\n payload: {\n filterKey: string;\n filterValue: string;\n };\n}\n\nexport type Action =\n | AlertAction\n | ConsoleAction\n | FilterAction\n | NavigateAction\n | SearchAction\n | SetLanguageAction\n | ToggleDarkModeAction;\n\nexport type ManifestValue =\n | string\n | number\n | boolean\n | null\n | readonly ManifestValue[]\n | { readonly [key: string]: ManifestValue };\n\nexport type ComponentEventPayloadValue = ManifestValue;\n\nexport interface ComponentEventDto<\n TType extends string = string,\n TPayload extends object = Record<string, ComponentEventPayloadValue>,\n> {\n readonly type: TType;\n readonly sourceNodeId: string;\n readonly payload: TPayload;\n}\n\nexport type FormSubmitValues = Record<string, ComponentEventPayloadValue>;\n\nexport type FormSubmitEventDto = ComponentEventDto<\n 'form.submit',\n {\n readonly values: FormSubmitValues;\n }\n>;\n\nexport type ButtonPressEventDto = ComponentEventDto<'button.press', Record<string, never>>;\n\nexport interface CollectionItemPressPayload {\n readonly itemId: string | number;\n readonly item: Record<string, ComponentEventPayloadValue>;\n}\n\nexport type CollectionItemPressEventDto = ComponentEventDto<\n 'collection.itemPress',\n CollectionItemPressPayload\n>;\n\nexport type ComponentEventDtoKind =\n | ButtonPressEventDto['type']\n | CollectionItemPressEventDto['type']\n | FormSubmitEventDto['type'];\n\nexport type KnownComponentEventDto =\n | ButtonPressEventDto\n | CollectionItemPressEventDto\n | FormSubmitEventDto;\n\nexport const NAVIGATOR_TYPES = ['stack', 'tabs', 'drawer'] as const;\nexport type NavigatorType = (typeof NAVIGATOR_TYPES)[number];\n\nexport const APP_CATEGORIES = [\n 'books_reading',\n 'business_productivity',\n 'developer_tools',\n 'education_learning',\n 'entertainment_media',\n 'finance_money',\n 'food_drink',\n 'games',\n 'graphics_design',\n 'health_fitness',\n 'kids_family',\n 'lifestyle',\n 'medical',\n 'music_audio',\n 'navigation_travel',\n 'news_magazines',\n 'photo_video',\n 'reference',\n 'shopping_commerce',\n 'social_community',\n 'sports',\n 'utilities_tools',\n 'weather',\n] as const;\nexport type AppCategory = (typeof APP_CATEGORIES)[number];\n\nexport const DEPLOYMENT_TARGETS = ['minikube'] as const;\nexport type KnownDeploymentTarget = (typeof DEPLOYMENT_TARGETS)[number];\nexport type DeploymentTarget = KnownDeploymentTarget | (string & {});\n\nexport const DATABASE_PROVIDERS = ['supabase'] as const;\nexport type KnownDatabaseProvider = (typeof DATABASE_PROVIDERS)[number];\nexport type DatabaseProvider = KnownDatabaseProvider | (string & {});\n\nexport const DATABASE_TIERS = ['dev', 'prod'] as const;\nexport type DatabaseTier = (typeof DATABASE_TIERS)[number];\n\nexport const STORAGE_PROVIDERS = ['auto', 's3', 'r2'] as const;\nexport type StorageProvider = (typeof STORAGE_PROVIDERS)[number];\n\nexport const STATE_PROVIDERS = ['legend'] as const;\nexport type KnownStateProvider = (typeof STATE_PROVIDERS)[number];\nexport type StateProvider = KnownStateProvider | (string & {});\n\nexport const STATE_PERSISTENCE_MODES = ['none', 'local', 'secure', 'database'] as const;\nexport type StatePersistenceMode = (typeof STATE_PERSISTENCE_MODES)[number];\n\nexport const AUTHZ_KINDS = ['RBAC', 'ABAC'] as const;\nexport type AuthzKind = (typeof AUTHZ_KINDS)[number];\n\nexport const AUTHZ_ENGINES = ['cerbos', 'native'] as const;\nexport type AuthzEngine = (typeof AUTHZ_ENGINES)[number];\n\nexport const AUTH_SCOPES = ['global', 'none', 'integrated'] as const;\nexport type AuthScope = (typeof AUTH_SCOPES)[number];\n\nexport const AUTH_PROVIDERS = ['supabase'] as const;\nexport type KnownAuthProvider = (typeof AUTH_PROVIDERS)[number];\nexport type AuthProvider = KnownAuthProvider | (string & {});\n\nexport const AUTH_SIGN_IN_IDENTIFIERS = ['email', 'username', 'phone'] as const;\nexport type AuthSignInIdentifier = AuthIdentifierKind;\n\nexport const AUTH_SIGN_UP_POLICIES = ['autoSignIn', 'requireVerification'] as const;\nexport type AuthSignUpPolicy = (typeof AUTH_SIGN_UP_POLICIES)[number];\n\nexport const AUTH_PROFILE_FIELDS = [\n ...AUTH_SIGN_IN_IDENTIFIERS,\n 'firstName',\n 'lastName',\n 'displayName',\n 'avatarUrl',\n] as const;\nexport type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];\nexport type AuthProfileField = KnownAuthProfileField | (string & {});\n\nexport const AUTH_PROFILE_PRIMARY_KEY_STRATEGIES = ['authUserId'] as const;\nexport type AuthProfilePrimaryKeyStrategy = (typeof AUTH_PROFILE_PRIMARY_KEY_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_CREATE_STRATEGIES = ['trigger', 'api', 'app'] as const;\nexport type AuthProfileCreateStrategy = (typeof AUTH_PROFILE_CREATE_STRATEGIES)[number];\n\nexport const AUTH_PROFILE_UPDATE_STRATEGIES = ['api', 'app'] as const;\nexport type AuthProfileUpdateStrategy = (typeof AUTH_PROFILE_UPDATE_STRATEGIES)[number];\n\nexport interface IconSpec {\n name: string;\n provider?: string;\n size?: number | string;\n color?: string;\n}\n\nexport interface UiNode {\n id: string;\n type: string;\n alias?: string;\n props?: Record<string, unknown>;\n children?: UiNode[];\n style?: Record<string, number | string>;\n}\n\nexport interface ScreenSpec {\n id: string;\n name: string;\n title?: string;\n description?: string;\n root: UiNode;\n}\n\nexport interface NavigatorSpec {\n type: NavigatorType;\n initialRouteName?: string;\n routes: RouteDefinition[];\n options?: Record<string, unknown>;\n}\n\nexport interface RouteDefinition {\n name: string;\n path?: string;\n label?: string;\n icon?: IconSpec;\n hideInTabBar?: boolean;\n guards?: string[];\n screenId?: string;\n navigator?: NavigatorSpec;\n}\n\nexport type SplashScreenResizeMode = 'contain' | 'cover' | 'native';\n\nexport interface SplashScreenAssetSpec {\n readonly image?: string;\n readonly imageWidth?: number;\n readonly resizeMode?: SplashScreenResizeMode;\n}\n\nexport interface SplashScreenModeSpec extends SplashScreenAssetSpec {\n readonly backgroundColor?: string;\n}\n\nexport interface SplashScreenSpec extends SplashScreenModeSpec {\n readonly dark?: SplashScreenModeSpec;\n}\n\nexport interface DeploymentSpec {\n target: DeploymentTarget;\n monitoring: boolean;\n}\n\nexport interface DatabaseSpec {\n provider: DatabaseProvider;\n tier: DatabaseTier;\n}\n\nexport interface StorageSpec {\n provider: StorageProvider;\n buckets: string[];\n}\n\nexport interface StateSpec {\n readonly provider: StateProvider;\n readonly persistence?: StatePersistenceMode;\n}\n\nexport interface AuthzSpec {\n kind: AuthzKind;\n engine: AuthzEngine;\n}\n\nexport interface AuthSignInSpec {\n identifiers: AuthSignInIdentifier[];\n}\n\nexport interface AuthSignUpSpec {\n requiredFields: AuthSignUpField[];\n optionalFields?: AuthSignUpField[];\n signUpPolicy?: AuthSignUpPolicy;\n}\n\nexport interface AuthProfileSpec {\n fields: AuthProfileField[];\n table?: string;\n primaryKey?: AuthProfilePrimaryKeyStrategy;\n createStrategy?: AuthProfileCreateStrategy;\n updateStrategy?: AuthProfileUpdateStrategy;\n}\n\nexport interface AuthSpec {\n scope: AuthScope;\n provider: AuthProvider;\n authorization: AuthzSpec;\n flow?: AuthFlowConfig;\n signIn?: AuthSignInSpec;\n signUp?: AuthSignUpSpec;\n oauth?: AuthOAuthConfig;\n profile?: AuthProfileSpec;\n}\n\nexport interface NetworkingSpec {\n domain?: string;\n cdn: boolean;\n}\n\nexport interface InfraManifest {\n deployment?: DeploymentSpec;\n auth?: AuthSpec;\n database?: DatabaseSpec;\n storage?: StorageSpec;\n state?: StateSpec;\n networking?: NetworkingSpec;\n plugins: string[];\n pluginsConfig?: Record<string, unknown>;\n}\n\nexport interface AppManifest {\n metadata: {\n name: string;\n slug: string;\n version: string;\n themeId: string;\n created?: string;\n updated?: string;\n };\n themes: ThemeConfig[];\n activeThemeId: string;\n activeThemeMode?: 'dark' | 'light';\n splashScreen?: SplashScreenSpec;\n infra: InfraManifest;\n navigator: NavigatorSpec;\n screens: Record<string, ScreenSpec>;\n data?: AppDataManifest;\n dataSources?: DataSourceRegistry;\n dataBindings?: ComponentDataBindingRegistry;\n settings: {\n apiBaseUrl?: string;\n localization: {\n defaultLocale: string;\n locales: string[];\n };\n authFlow: AuthFlowConfig;\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/contracts",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "main": "./dist/index.js",
5
5
  "dependencies": {
6
6
  "@ankhorage/color-theory": "^0.0.7"
@@ -33,6 +33,10 @@
33
33
  "types": "./dist/db.d.ts",
34
34
  "default": "./dist/db.js"
35
35
  },
36
+ "./nutrition": {
37
+ "types": "./dist/nutrition/index.d.ts",
38
+ "default": "./dist/nutrition/index.js"
39
+ },
36
40
  "./state": {
37
41
  "types": "./dist/state.d.ts",
38
42
  "default": "./dist/state.js"
package/src/index.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';
@@ -0,0 +1,80 @@
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
+ }
@@ -0,0 +1,51 @@
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];
@@ -0,0 +1,4 @@
1
+ export * from './capture';
2
+ export * from './common';
3
+ export * from './products';
4
+ export * from './review';
@@ -0,0 +1,137 @@
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
+ });
@@ -0,0 +1,134 @@
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
+ }
@@ -0,0 +1,65 @@
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
+ }
@@ -0,0 +1,33 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+
3
+ import {
4
+ AUTH_PROFILE_CREATE_STRATEGIES,
5
+ AUTH_PROFILE_PRIMARY_KEY_STRATEGIES,
6
+ AUTH_PROFILE_UPDATE_STRATEGIES,
7
+ type AuthSpec,
8
+ } from './index';
9
+
10
+ describe('profile contract', () => {
11
+ it('exports profile strategy lists', () => {
12
+ expect(AUTH_PROFILE_PRIMARY_KEY_STRATEGIES).toEqual(['authUserId']);
13
+ expect(AUTH_PROFILE_CREATE_STRATEGIES).toEqual(['trigger', 'api', 'app']);
14
+ expect(AUTH_PROFILE_UPDATE_STRATEGIES).toEqual(['api', 'app']);
15
+ });
16
+
17
+ it('serializes profile settings on an auth spec', () => {
18
+ const auth: AuthSpec = {
19
+ scope: 'global',
20
+ provider: 'supabase',
21
+ authorization: { kind: 'RBAC', engine: 'native' },
22
+ profile: {
23
+ fields: ['email', 'displayName', 'avatarUrl'],
24
+ table: 'profiles',
25
+ primaryKey: 'authUserId',
26
+ createStrategy: 'trigger',
27
+ updateStrategy: 'api',
28
+ },
29
+ };
30
+
31
+ expect(JSON.parse(JSON.stringify(auth))).toEqual(auth);
32
+ });
33
+ });
package/src/types.ts CHANGED
@@ -212,6 +212,15 @@ export const AUTH_PROFILE_FIELDS = [
212
212
  export type KnownAuthProfileField = (typeof AUTH_PROFILE_FIELDS)[number];
213
213
  export type AuthProfileField = KnownAuthProfileField | (string & {});
214
214
 
215
+ export const AUTH_PROFILE_PRIMARY_KEY_STRATEGIES = ['authUserId'] as const;
216
+ export type AuthProfilePrimaryKeyStrategy = (typeof AUTH_PROFILE_PRIMARY_KEY_STRATEGIES)[number];
217
+
218
+ export const AUTH_PROFILE_CREATE_STRATEGIES = ['trigger', 'api', 'app'] as const;
219
+ export type AuthProfileCreateStrategy = (typeof AUTH_PROFILE_CREATE_STRATEGIES)[number];
220
+
221
+ export const AUTH_PROFILE_UPDATE_STRATEGIES = ['api', 'app'] as const;
222
+ export type AuthProfileUpdateStrategy = (typeof AUTH_PROFILE_UPDATE_STRATEGIES)[number];
223
+
215
224
  export interface IconSpec {
216
225
  name: string;
217
226
  provider?: string;
@@ -307,6 +316,10 @@ export interface AuthSignUpSpec {
307
316
 
308
317
  export interface AuthProfileSpec {
309
318
  fields: AuthProfileField[];
319
+ table?: string;
320
+ primaryKey?: AuthProfilePrimaryKeyStrategy;
321
+ createStrategy?: AuthProfileCreateStrategy;
322
+ updateStrategy?: AuthProfileUpdateStrategy;
310
323
  }
311
324
 
312
325
  export interface AuthSpec {