@spotto/contract 1.0.70-alpha.1 → 1.0.70-alpha.10

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 (53) hide show
  1. package/dist/ai/expression/index.d.ts +2 -0
  2. package/dist/ai/expression/index.js +19 -0
  3. package/dist/ai/expression/index.js.map +1 -0
  4. package/dist/ai/expression/request.d.ts +27 -0
  5. package/dist/ai/expression/request.js +3 -0
  6. package/dist/ai/expression/request.js.map +1 -0
  7. package/dist/ai/expression/response.d.ts +23 -0
  8. package/dist/ai/expression/response.js +3 -0
  9. package/dist/ai/expression/response.js.map +1 -0
  10. package/dist/ai/index.d.ts +1 -0
  11. package/dist/ai/index.js +18 -0
  12. package/dist/ai/index.js.map +1 -0
  13. package/dist/assets/[id]/get.d.ts +9 -1
  14. package/dist/assets/[id]/patch/request.d.ts +5 -0
  15. package/dist/assets/get/query.d.ts +11 -4
  16. package/dist/assets/post/request.d.ts +2 -0
  17. package/dist/assets/post/request.js.map +1 -1
  18. package/dist/fields/constants.d.ts +19 -0
  19. package/dist/fields/constants.js +15 -1
  20. package/dist/fields/constants.js.map +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +1 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/integrations/constants.d.ts +1 -0
  25. package/dist/integrations/oneblink/patch/request.d.ts +3 -2
  26. package/dist/integrations/oneblink/token.d.ts +2 -0
  27. package/dist/shared/index.d.ts +1 -0
  28. package/dist/shared/index.js +1 -0
  29. package/dist/shared/index.js.map +1 -1
  30. package/dist/shared/readiness.d.ts +58 -0
  31. package/dist/shared/readiness.js +11 -0
  32. package/dist/shared/readiness.js.map +1 -0
  33. package/dist/types/[id]/get.d.ts +15 -2
  34. package/dist/types/[id]/patch/request.d.ts +13 -2
  35. package/dist/types/post/request.d.ts +15 -2
  36. package/dist/types/post/request.js.map +1 -1
  37. package/dist/users/current.d.ts +7 -0
  38. package/dist/users/home-layout/index.d.ts +3 -0
  39. package/dist/users/home-layout/index.js +20 -0
  40. package/dist/users/home-layout/index.js.map +1 -0
  41. package/dist/users/home-layout/request.d.ts +5 -0
  42. package/dist/users/home-layout/request.js +3 -0
  43. package/dist/users/home-layout/request.js.map +1 -0
  44. package/dist/users/home-layout/response.d.ts +5 -0
  45. package/dist/users/home-layout/response.js +3 -0
  46. package/dist/users/home-layout/response.js.map +1 -0
  47. package/dist/users/home-layout/shared.d.ts +64 -0
  48. package/dist/users/home-layout/shared.js +19 -0
  49. package/dist/users/home-layout/shared.js.map +1 -0
  50. package/dist/users/index.d.ts +1 -0
  51. package/dist/users/index.js +1 -0
  52. package/dist/users/index.js.map +1 -1
  53. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ export * from './request';
2
+ export * from './response';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./request"), exports);
18
+ __exportStar(require("./response"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai/expression/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAAyB;AACzB,6CAA0B"}
@@ -0,0 +1,27 @@
1
+ import { FieldDataType, FieldInputType, FieldSource } from '../../fields';
2
+ export declare type AiExpressionMode = 'readinessRule' | 'computedField';
3
+ export declare type AiExpressionProvider = 'openai' | 'anthropic';
4
+ /**
5
+ * A field the AI may reference, supplied inline by the client (which already
6
+ * holds the type's resolved fields). A trimmed view of `GetFieldResponse` — the
7
+ * server builds the preamble + validates against this, so the client never has
8
+ * to round-trip the schema.
9
+ */
10
+ export interface AiExpressionField {
11
+ name: string;
12
+ dataType: FieldDataType;
13
+ inputType?: FieldInputType;
14
+ options?: string[];
15
+ label?: string;
16
+ source?: FieldSource;
17
+ }
18
+ export interface PostAiExpressionRequest {
19
+ /** Plain-language description of the rule / calculation. */
20
+ prompt: string;
21
+ /** Which kind of expression to produce. */
22
+ mode: AiExpressionMode;
23
+ /** The fields the expression may reference (the type's resolved fields). */
24
+ fields: AiExpressionField[];
25
+ /** Required for `computedField`: the field being computed (excluded from refs). */
26
+ fieldName?: string;
27
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/ai/expression/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ export interface PostAiExpressionResponse {
2
+ /** true when a usable expression was produced (and validated, for readiness). */
3
+ ok: boolean;
4
+ /** The generated excelexp expression, or null when declined / unbuildable. */
5
+ expression: string | null;
6
+ /**
7
+ * readinessRule: the display text shown when the rule fires — house-style, with
8
+ * `{FieldName}` placeholders. null for computedField, and null on a decline.
9
+ */
10
+ message: string | null;
11
+ /**
12
+ * readinessRule severity, set ONLY from explicit severity words in the prompt:
13
+ * 1 = amber, 2 = red. null when the prompt stated no severity (the author picks)
14
+ * or for computedField.
15
+ */
16
+ level: 1 | 2 | null;
17
+ /** Author-facing explanation/caveat: why it declined, or a one-line caveat. */
18
+ note: string | null;
19
+ /** Server-side compiler findings (empty when the expression compiles cleanly). */
20
+ warnings: string[];
21
+ /** The model that answered. */
22
+ model: string;
23
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/ai/expression/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './expression';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./expression"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA4B"}
@@ -1,7 +1,7 @@
1
1
  import { type Point } from 'geojson';
2
2
  import { IEmbeddedLabel } from '../../labels';
3
3
  import { LocationStatus, LocationType } from '../../locations/constants';
4
- import { IEntityMeta, IEmbeddedEntity } from '../../shared';
4
+ import { IEntityMeta, IEmbeddedEntity, IReadiness } from '../../shared';
5
5
  import { IAssetTelemetry } from '../../telemetry';
6
6
  import { IFieldValue } from '../../types';
7
7
  export interface ILastLocation {
@@ -74,4 +74,12 @@ export interface GetAssetResponse {
74
74
  homeLocationPath?: string;
75
75
  readers?: IEmbeddedEntity[];
76
76
  manifestIds?: string[];
77
+ typeKit?: boolean;
78
+ groupParentId?: string;
79
+ groupAncestors?: string[];
80
+ groupMember?: boolean;
81
+ groupChildCount?: number;
82
+ groupSatisfiesKit?: boolean;
83
+ readiness?: IReadiness;
84
+ timeSensitive?: boolean;
77
85
  }
@@ -8,4 +8,9 @@ export interface UpdateAssetRequest {
8
8
  fieldValues?: IFieldValueWithConstraints[];
9
9
  homeLocationId?: string;
10
10
  manifestIds?: string[];
11
+ /**
12
+ * Kit membership (G2G M2): a kit id joins/moves the asset under that kit,
13
+ * `null` leaves its current kit, omitted leaves membership unchanged.
14
+ */
15
+ groupParentId?: string | null;
11
16
  }
@@ -1,8 +1,8 @@
1
- import { DateCondition, SearchableSortFields, SortOrders } from '../../shared';
1
+ import { DateCondition, ReadinessState, SearchableSortFields, SortOrders } from '../../shared';
2
2
  import { LocationStatus } from '../../locations/constants';
3
3
  export declare type AssetSearchField = 'name' | 'tagIds';
4
- export declare type AssetEmbedField = 'meta' | 'tagIds' | 'candidateLocations' | 'telemetry' | 'readers';
5
- export declare type AssetSortField = SearchableSortFields | 'battery';
4
+ export declare type AssetEmbedField = 'meta' | 'tagIds' | 'candidateLocations' | 'telemetry' | 'readers' | 'readiness';
5
+ export declare type AssetSortField = SearchableSortFields | 'battery' | 'ready';
6
6
  export declare type AssetBatteryStatus = 'critical' | 'low' | 'ok';
7
7
  declare type _CustomFieldsAssetFilterBase = {
8
8
  id: string;
@@ -17,13 +17,17 @@ export declare type CustomFieldsAssetFilterNumberRange = _CustomFieldsAssetFilte
17
17
  from: number;
18
18
  to: number;
19
19
  };
20
- export declare type CustomFieldsAssetFilter = CustomFieldsAssetFilterValue | CustomFieldsAssetFilterDateCondition | CustomFieldsAssetFilterNumberRange;
20
+ export declare type CustomFieldsAssetFilterBoolean = _CustomFieldsAssetFilterBase & {
21
+ value: boolean;
22
+ };
23
+ export declare type CustomFieldsAssetFilter = CustomFieldsAssetFilterValue | CustomFieldsAssetFilterDateCondition | CustomFieldsAssetFilterNumberRange | CustomFieldsAssetFilterBoolean;
21
24
  export declare type CustomFieldValues = {
22
25
  values?: Array<CustomFieldsAssetFilterValue>;
23
26
  integerRanges?: Array<CustomFieldsAssetFilterNumberRange>;
24
27
  decimalRanges?: Array<CustomFieldsAssetFilterNumberRange>;
25
28
  dateConditions?: Array<CustomFieldsAssetFilterDateCondition>;
26
29
  dateTimeConditions?: Array<CustomFieldsAssetFilterDateCondition>;
30
+ booleanValues?: Array<CustomFieldsAssetFilterBoolean>;
27
31
  };
28
32
  export interface AssetFilters {
29
33
  labels?: string[];
@@ -50,6 +54,9 @@ export interface AssetFilters {
50
54
  supportsWith?: boolean;
51
55
  withAsset?: boolean;
52
56
  dispatched?: boolean;
57
+ timeSensitive?: boolean;
58
+ ready?: ReadinessState[];
59
+ hasReadyIssues?: boolean;
53
60
  createdAt?: DateCondition[];
54
61
  updatedAt?: DateCondition[];
55
62
  lastSeen?: DateCondition[];
@@ -8,6 +8,8 @@ export interface PostAssetRequest {
8
8
  fieldValues?: IFieldValueWithConstraints[];
9
9
  homeLocationId?: string;
10
10
  manifestIds?: string[];
11
+ /** Join a kit at creation — the direct parent kit's id (G2G M2). */
12
+ groupParentId?: string;
11
13
  }
12
14
  export declare type PostAssetsRequest = PostAssetRequest[];
13
15
  export declare const testPostAssetRequest: PostAssetRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/assets/post/request.ts"],"names":[],"mappings":";;;AAeA,QAAQ;AACK,QAAA,oBAAoB,GAAqB;IACpD,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,OAAO;CAChB,CAAA"}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/assets/post/request.ts"],"names":[],"mappings":";;;AAiBA,QAAQ;AACK,QAAA,oBAAoB,GAAqB;IACpD,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,OAAO;CAChB,CAAA"}
@@ -2,3 +2,22 @@ export declare type FieldDataType = 'STRING' | 'INTEGER' | 'DECIMAL' | 'BOOLEAN'
2
2
  export declare const FIELD_DATA_TYPES: FieldDataType[];
3
3
  export declare type FieldInputType = 'SINGLELINE' | 'MULTILINE' | 'LINK' | 'RICHTEXT' | 'DROPDOWN' | 'RADIO' | 'CHECKBOXES' | 'DATE' | 'DATETIME' | 'INTEGER' | 'DECIMAL' | 'SWITCH';
4
4
  export declare const FIELD_INPUT_TYPES: FieldInputType[];
5
+ export declare type FieldSource = 'INPUT' | 'COMPUTED' | 'AGGREGATED';
6
+ export declare const FIELD_SOURCES: FieldSource[];
7
+ export declare type AggregateFunction = 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'COUNT';
8
+ export declare const AGGREGATE_FUNCTIONS: AggregateFunction[];
9
+ /**
10
+ * A per-type field-binding delta, layered onto the inherited field identity
11
+ * (`fieldsAll = parent.fieldsAll ⊕ fields`). Omitted `source` on an override =
12
+ * inherit; explicit `INPUT` = reset to user-entered.
13
+ * - `expression` — COMPUTED: excelexp over the asset's other fields.
14
+ * - `visibleWhen` — conditional visibility (client-render only).
15
+ * - `function` — AGGREGATED (M2 — kits): the same field is reduced across
16
+ * a kit's direct members.
17
+ */
18
+ export interface IFieldBindingDelta {
19
+ source?: FieldSource;
20
+ expression?: string;
21
+ visibleWhen?: string;
22
+ function?: AggregateFunction;
23
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FIELD_INPUT_TYPES = exports.FIELD_DATA_TYPES = void 0;
3
+ exports.AGGREGATE_FUNCTIONS = exports.FIELD_SOURCES = exports.FIELD_INPUT_TYPES = exports.FIELD_DATA_TYPES = void 0;
4
4
  const dataTypes = {
5
5
  STRING: null,
6
6
  INTEGER: null,
@@ -25,4 +25,18 @@ const inputTypes = {
25
25
  SWITCH: null,
26
26
  };
27
27
  exports.FIELD_INPUT_TYPES = Object.keys(inputTypes);
28
+ const fieldSources = {
29
+ INPUT: null,
30
+ COMPUTED: null,
31
+ AGGREGATED: null,
32
+ };
33
+ exports.FIELD_SOURCES = Object.keys(fieldSources);
34
+ const aggregateFunctions = {
35
+ SUM: null,
36
+ AVG: null,
37
+ MIN: null,
38
+ MAX: null,
39
+ COUNT: null,
40
+ };
41
+ exports.AGGREGATE_FUNCTIONS = Object.keys(aggregateFunctions);
28
42
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/fields/constants.ts"],"names":[],"mappings":";;;AAQA,MAAM,SAAS,GAAqC;IAClD,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAoB,CAAA;AAgBzE,MAAM,UAAU,GAAsC;IACpD,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;CACb,CAAA;AAEY,QAAA,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAqB,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/fields/constants.ts"],"names":[],"mappings":";;;AAQA,MAAM,SAAS,GAAqC;IAClD,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;CACf,CAAA;AAEY,QAAA,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAoB,CAAA;AAgBzE,MAAM,UAAU,GAAsC;IACpD,UAAU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;CACb,CAAA;AAEY,QAAA,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAqB,CAAA;AAS5E,MAAM,YAAY,GAAmC;IACnD,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,UAAU,EAAE,IAAI;CACjB,CAAA;AAEY,QAAA,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAkB,CAAA;AAIvE,MAAM,kBAAkB,GAAyC;IAC/D,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,IAAI;IACT,KAAK,EAAE,IAAI;CACZ,CAAA;AAEY,QAAA,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAC5C,kBAAkB,CACI,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './shared';
2
+ export * from './ai';
2
3
  export * from './events';
3
4
  export * from './integrations';
4
5
  export * from './labels';
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./shared"), exports);
18
+ __exportStar(require("./ai"), exports);
18
19
  __exportStar(require("./events"), exports);
19
20
  __exportStar(require("./integrations"), exports);
20
21
  __exportStar(require("./labels"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,2CAAwB;AACxB,iDAA8B;AAC9B,2CAAwB;AACxB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,4CAAyB;AACzB,wCAAqB;AACrB,0CAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,uCAAoB;AACpB,2CAAwB;AACxB,iDAA8B;AAC9B,2CAAwB;AACxB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,4CAAyB;AACzB,0CAAuB;AACvB,yCAAsB;AACtB,8CAA2B;AAC3B,0CAAuB;AACvB,8CAA2B;AAC3B,0CAAuB;AACvB,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,8CAA2B;AAC3B,2CAAwB;AACxB,4CAAyB;AACzB,wCAAqB;AACrB,0CAAuB"}
@@ -27,6 +27,7 @@ export declare enum IntegrationType {
27
27
  export declare type OneBlinkIntegrationDetails = {
28
28
  enabled: true;
29
29
  accessKey: string;
30
+ formsAppId?: number;
30
31
  } | {
31
32
  enabled: false;
32
33
  };
@@ -1,7 +1,8 @@
1
1
  export declare type UpdateOneBlinkSettingsRequest = {
2
2
  enabled: true;
3
- accessKey: string;
4
- secretKey: string;
3
+ accessKey?: string;
4
+ secretKey?: string;
5
+ formsAppId?: number;
5
6
  } | {
6
7
  enabled: false;
7
8
  };
@@ -1,4 +1,6 @@
1
1
  export interface GetOneBlinkTokenResponse {
2
2
  token: string;
3
3
  expiration: string;
4
+ /** The org's OneBlink Forms App id, if configured. */
5
+ formsAppId?: number;
4
6
  }
@@ -9,3 +9,4 @@ export * from './sort';
9
9
  export * from './timezone';
10
10
  export * from './timestamp';
11
11
  export * from './relative-date';
12
+ export * from './readiness';
@@ -25,4 +25,5 @@ __exportStar(require("./sort"), exports);
25
25
  __exportStar(require("./timezone"), exports);
26
26
  __exportStar(require("./timestamp"), exports);
27
27
  __exportStar(require("./relative-date"), exports);
28
+ __exportStar(require("./readiness"), exports);
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,2CAAwB;AACxB,0CAAuB;AACvB,2CAAwB;AACxB,4CAAyB;AACzB,yCAAsB;AACtB,0CAAuB;AACvB,yCAAsB;AACtB,6CAA0B;AAC1B,8CAA2B;AAC3B,kDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,2CAAwB;AACxB,0CAAuB;AACvB,2CAAwB;AACxB,4CAAyB;AACzB,yCAAsB;AACtB,0CAAuB;AACvB,yCAAsB;AACtB,6CAA0B;AAC1B,8CAA2B;AAC3B,kDAA+B;AAC/B,8CAA2B"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Good-to-Go (G2G) asset readiness — shared API contract shapes.
3
+ *
4
+ * Readiness rules are authored on types (and inherited like fields), evaluated
5
+ * against an asset's field values by the excelexp engine. A rule whose
6
+ * expression evaluates TRUE raises an issue at its level; an asset's overall
7
+ * `ready` is the worst level among its issues.
8
+ */
9
+ /** Readiness severity: 1 = amber (warning), 2 = red (blocking). */
10
+ export declare type ReadinessLevel = 1 | 2;
11
+ /** Overall readiness: 0 = ready (green), else the worst issue level. */
12
+ export declare type ReadinessState = 0 | ReadinessLevel;
13
+ /**
14
+ * An authored readiness rule on a type. `expression` is an excelexp boolean;
15
+ * when it evaluates TRUE the issue fires at `level` with `message` rendered as
16
+ * a `{FieldName}` template.
17
+ */
18
+ export interface IReadinessRule {
19
+ level: ReadinessLevel;
20
+ expression: string;
21
+ message: string;
22
+ }
23
+ /**
24
+ * A resolved rule (own + inherited), carrying the path of the type that
25
+ * authored it — mirrors how `IFieldDefinitionAll` carries `typePath`.
26
+ */
27
+ export interface IReadinessRuleAll extends IReadinessRule {
28
+ /** Id of the type that authored the rule. */
29
+ typeId: string;
30
+ typePath: string;
31
+ }
32
+ /** A fired readiness issue on an asset. */
33
+ export interface IReadinessIssue {
34
+ /** The type that authored the fired rule. */
35
+ typeId: string;
36
+ /**
37
+ * The asset the issue came from: the asset itself for a leaf, or a member
38
+ * for a kit (kit issues are materialized copies of member issues).
39
+ */
40
+ assetId: string;
41
+ assetName: string;
42
+ level: ReadinessLevel;
43
+ /** Rendered message (the rule's `message` template with field values). */
44
+ reason: string;
45
+ /**
46
+ * Referenced DATE / number fields that had no value, causing the rule to
47
+ * fail closed. Present only when the issue fired on missing data.
48
+ */
49
+ missingFields?: string[];
50
+ }
51
+ /** Stored/returned readiness for an asset. */
52
+ export interface IReadiness {
53
+ /** Worst level among `readyIssues`; 0 = ready (green). */
54
+ ready: ReadinessState;
55
+ readyIssues: IReadinessIssue[];
56
+ /** Epoch ms of the evaluation that produced this result. */
57
+ evaluatedAt?: number;
58
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * Good-to-Go (G2G) asset readiness — shared API contract shapes.
4
+ *
5
+ * Readiness rules are authored on types (and inherited like fields), evaluated
6
+ * against an asset's field values by the excelexp engine. A rule whose
7
+ * expression evaluates TRUE raises an issue at its level; an asset's overall
8
+ * `ready` is the worst level among its issues.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ //# sourceMappingURL=readiness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readiness.js","sourceRoot":"","sources":["../../src/shared/readiness.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
@@ -1,5 +1,6 @@
1
1
  import { GetFieldResponse } from '../../fields/[id]/get';
2
- import { IEmbeddedEntity } from '../../shared';
2
+ import { IFieldBindingDelta } from '../../fields';
3
+ import { IEmbeddedEntity, IReadinessRule, IReadinessRuleAll } from '../../shared';
3
4
  export interface IFieldValue {
4
5
  id: string;
5
6
  name: string;
@@ -9,8 +10,16 @@ export interface IFieldValue {
9
10
  valueBoolean?: boolean;
10
11
  valueDate?: string;
11
12
  valueDateTime?: Date;
13
+ /** True when the value was derived by a COMPUTED/AGGREGATED binding (read-only). */
14
+ computed?: boolean;
12
15
  }
13
- export interface IFieldDefinitionAll extends GetFieldResponse {
16
+ /**
17
+ * A resolved field on a type (own + inherited), carrying its authoring
18
+ * `typePath` and any binding delta (`source`/`expression`/`visibleWhen`). The
19
+ * server-computed metadata (`referencedFields`/`timeSensitive`) is internal and
20
+ * not surfaced here.
21
+ */
22
+ export interface IFieldDefinitionAll extends GetFieldResponse, IFieldBindingDelta {
14
23
  typePath: string;
15
24
  }
16
25
  export interface IFieldValueAll extends IFieldValue {
@@ -36,4 +45,8 @@ export interface GetTypeResponse {
36
45
  manifestId?: string;
37
46
  manifestIds?: string[];
38
47
  supportsStocktake?: boolean;
48
+ /** Assets of this type are kits (containers) — G2G M2. */
49
+ typeKit?: boolean;
50
+ readinessRules?: IReadinessRule[];
51
+ readinessRulesAll?: IReadinessRuleAll[];
39
52
  }
@@ -1,13 +1,24 @@
1
- import { IEmbeddedEntityWithIdOrName, IFieldValueWithConstraints } from '../../post';
1
+ import { IEmbeddedEntityWithIdOrName, IFieldBinding, IFieldValueWithConstraints } from '../../post';
2
+ import { IReadinessRule, IReadinessRuleAll } from '../../../shared';
2
3
  export interface UpdateTypeRequest {
3
4
  name?: string;
4
5
  parent?: string;
5
6
  fullNameTemplate?: string | null;
6
7
  description?: string;
7
8
  path?: string;
8
- fields?: IEmbeddedEntityWithIdOrName[];
9
+ fields?: IFieldBinding[];
9
10
  typeFields?: IEmbeddedEntityWithIdOrName[];
10
11
  typeFieldValues?: IFieldValueWithConstraints[];
11
12
  manifestIds?: string[];
12
13
  supportsStocktake?: boolean;
14
+ /** Assets of this type are kits (containers) — G2G M2. */
15
+ typeKit?: boolean;
16
+ readinessRules?: IReadinessRule[];
17
+ /**
18
+ * Server-derived, read-only projection (own + inherited rules) returned by
19
+ * GET. Tolerated on input only so a GET → edit → PATCH round-trip of the whole
20
+ * type doesn't 400; the server strips it and re-derives it from stored state +
21
+ * parent (prepareUpdate), so it never affects what is stored.
22
+ */
23
+ readinessRulesAll?: IReadinessRuleAll[];
13
24
  }
@@ -1,3 +1,5 @@
1
+ import { IReadinessRule } from '../../shared';
2
+ import { IFieldBindingDelta } from '../../fields';
1
3
  export declare type IEmbeddedEntityWithIdOrName = {
2
4
  id: string;
3
5
  name?: never;
@@ -8,6 +10,12 @@ export declare type IEmbeddedEntityWithIdOrName = {
8
10
  id: string;
9
11
  name: string;
10
12
  };
13
+ /**
14
+ * A type's authored field binding: the field reference (`id`/`name`) plus an
15
+ * optional source/visibility delta (§5 / §1.4). A bare `{ id }` is an INPUT
16
+ * binding, exactly as before.
17
+ */
18
+ export declare type IFieldBinding = IEmbeddedEntityWithIdOrName & IFieldBindingDelta;
11
19
  declare type ValueStringOnly = {
12
20
  valueString: string;
13
21
  valueInteger?: never;
@@ -66,18 +74,23 @@ declare type IdOrName = {
66
74
  id: string;
67
75
  name: string;
68
76
  };
69
- export declare type IFieldValueWithConstraints = IdOrName & (ValueStringOnly | ValueIntegerOnly | ValueDecimalOnly | ValueBooleanOnly | ValueDateOnly | ValueDateTimeOnly);
77
+ export declare type IFieldValueWithConstraints = IdOrName & {
78
+ computed?: boolean;
79
+ } & (ValueStringOnly | ValueIntegerOnly | ValueDecimalOnly | ValueBooleanOnly | ValueDateOnly | ValueDateTimeOnly);
70
80
  export interface PostTypeRequest {
71
81
  name: string;
72
82
  parent?: string;
73
83
  fullNameTemplate?: string | null;
74
84
  description?: string;
75
85
  path?: string;
76
- fields?: IEmbeddedEntityWithIdOrName[];
86
+ fields?: IFieldBinding[];
77
87
  typeFields?: IEmbeddedEntityWithIdOrName[];
78
88
  typeFieldValues?: IFieldValueWithConstraints[];
79
89
  manifestIds?: string[];
80
90
  supportsStocktake?: boolean;
91
+ /** Assets of this type are kits (containers) — G2G M2. */
92
+ typeKit?: boolean;
93
+ readinessRules?: IReadinessRule[];
81
94
  }
82
95
  export declare type PostTypesRequest = PostTypeRequest[];
83
96
  export declare const testPostTypeRequest: PostTypeRequest;
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/types/post/request.ts"],"names":[],"mappings":";;;AAuFA,QAAQ;AACK,QAAA,mBAAmB,GAAoB;IAClD,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,gBAAgB,EAAE,OAAO;IACzB,MAAM,EAAE;QACN;YACE,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,QAAQ;SACf;KACF;IACD,eAAe,EAAE;QACf;YACE,gBAAgB;YAChB,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,IAAI;YAClB,oBAAoB;SACrB;KACF;IACD,iBAAiB,EAAE,IAAI;CACxB,CAAA"}
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/types/post/request.ts"],"names":[],"mappings":";;;AAyGA,QAAQ;AACK,QAAA,mBAAmB,GAAoB;IAClD,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,gBAAgB,EAAE,OAAO;IACzB,MAAM,EAAE;QACN;YACE,EAAE,EAAE,QAAQ;YACZ,IAAI,EAAE,QAAQ;SACf;KACF;IACD,eAAe,EAAE;QACf;YACE,gBAAgB;YAChB,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,IAAI;YAClB,oBAAoB;SACrB;KACF;IACD,iBAAiB,EAAE,IAAI;CACxB,CAAA"}
@@ -2,6 +2,7 @@ import { IEntityMeta, IEmbeddedEntity } from '../shared';
2
2
  import { Preferences } from '../organisations/constants';
3
3
  import { Integrations } from '../integrations/constants';
4
4
  import { System } from '../system';
5
+ import { HomeLayout } from './home-layout';
5
6
  export interface EmbeddedRole extends IEmbeddedEntity {
6
7
  permissions: string[];
7
8
  }
@@ -28,6 +29,12 @@ export interface CurrentUserResponse {
28
29
  * - `undefined` — legacy native user (non-SSO org, or pre-SSO).
29
30
  */
30
31
  authProvider?: 'sso' | 'native';
32
+ /**
33
+ * Personal Home-screen layout (widget arrangement). Persisted on the user doc
34
+ * and written via `POST /users/current/home-layout`. `undefined` until the
35
+ * user customises — the client then renders its built-in default layout.
36
+ */
37
+ homeLayout?: HomeLayout;
31
38
  }
32
39
  export interface CurrentUserPublicResponse {
33
40
  id: string;
@@ -0,0 +1,3 @@
1
+ export * from './shared';
2
+ export * from './request';
3
+ export * from './response';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./shared"), exports);
18
+ __exportStar(require("./request"), exports);
19
+ __exportStar(require("./response"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/users/home-layout/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,4CAAyB;AACzB,6CAA0B"}
@@ -0,0 +1,5 @@
1
+ import { HomeLayout } from './shared';
2
+ /** Body for `POST /users/current/home-layout` — replaces the caller's home layout. */
3
+ export interface UpdateHomeLayoutRequest {
4
+ homeLayout: HomeLayout;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/users/home-layout/request.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { HomeLayout } from './shared';
2
+ /** Response for `POST /users/current/home-layout` — echoes the saved layout. */
3
+ export interface UpdateHomeLayoutResponse {
4
+ homeLayout: HomeLayout;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/users/home-layout/response.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Per-user Home screen layout — a personal, server-persisted arrangement of
3
+ * Home widgets. Stored directly on the user document (like `homeLocationId`),
4
+ * returned on `GET /users/current`, and written via
5
+ * `POST /users/current/home-layout`.
6
+ *
7
+ * A layout is a flat, ordered list of widgets, each pinned to a rect on a
8
+ * 4-column grid (`gridPos`). The widget `type` is a closed union (below): adding
9
+ * a new kind is a contract change + republish + client bump. Per-widget `config`
10
+ * is left opaque and carries widget *behaviour* only (a saved-view id, an action
11
+ * id, a heading's text) — never geometry — so a widget can evolve without a
12
+ * contract change while the API still validates the structural parts.
13
+ *
14
+ * `version` discriminates stored layouts so the client can detect and
15
+ * reset/migrate an older one on read.
16
+ */
17
+ /**
18
+ * The kinds of Home widget. Closed set — adding one is a contract change.
19
+ * - `tile-link` — a link card (a saved view or a nav destination); may show a live count.
20
+ * - `summary-list` — top-N rows of a saved view's results.
21
+ * - `recent-activity` — the account's latest activity feed.
22
+ * - `recent-assets` / `recent-locations` — most-recently-updated entities.
23
+ * - `needs-attention` — assets flagged not-ready / partially-ready.
24
+ * - `kit-spotlight` — kit readiness summary.
25
+ * - `hero` — the fleet-readiness hero (overview + inline needs-attention legend).
26
+ * - `heading` — a text heading to label a run of widgets (heading text lives in `config`).
27
+ *
28
+ * `hero` and `heading` are full-width structural widgets: the client renders them
29
+ * spanning the whole row at every breakpoint. As with all widgets, width is
30
+ * expressed through `gridPos.w`, not enforced by the API.
31
+ */
32
+ export declare type HomeWidgetType = 'tile-link' | 'summary-list' | 'recent-activity' | 'recent-assets' | 'recent-locations' | 'needs-attention' | 'kit-spotlight' | 'hero' | 'heading';
33
+ /**
34
+ * A widget's cell on the Home grid: top-left position (`x`/`y`) and size
35
+ * (`w`/`h`), in grid units. The grid is 4 columns wide, so `x + w <= 4`, and
36
+ * `h` is a whole number of row-units. Below the desktop breakpoint the client
37
+ * collapses to a single column, so `x`/`w` only bind on wide viewports.
38
+ */
39
+ export interface HomeWidgetGridPos {
40
+ /** Column of the top-left corner (0-based; `x + w <= 4`). */
41
+ x: number;
42
+ /** Row of the top-left corner (0-based), in row-units. */
43
+ y: number;
44
+ /** Width in columns (1–4). */
45
+ w: number;
46
+ /** Height in row-units (>= 1). */
47
+ h: number;
48
+ }
49
+ export interface HomeWidget {
50
+ /** Stable client-generated id (ulid) — the reorder / remove key. */
51
+ id: string;
52
+ /** Widget kind (closed union). The client registry maps it to a renderer + config shape. */
53
+ type: HomeWidgetType;
54
+ /** Position + size on the 4-column grid. */
55
+ gridPos: HomeWidgetGridPos;
56
+ /** Widget-specific *behaviour* config (e.g. a saved-view id, a heading's text). Opaque to the API; never geometry. */
57
+ config?: Record<string, unknown>;
58
+ }
59
+ export interface HomeLayout {
60
+ /** Layout schema version, so the client can detect + migrate/reset older stored layouts. */
61
+ version: number;
62
+ /** Flat, ordered widget list; geometry lives on each widget's `gridPos`. */
63
+ widgets: HomeWidget[];
64
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Per-user Home screen layout — a personal, server-persisted arrangement of
4
+ * Home widgets. Stored directly on the user document (like `homeLocationId`),
5
+ * returned on `GET /users/current`, and written via
6
+ * `POST /users/current/home-layout`.
7
+ *
8
+ * A layout is a flat, ordered list of widgets, each pinned to a rect on a
9
+ * 4-column grid (`gridPos`). The widget `type` is a closed union (below): adding
10
+ * a new kind is a contract change + republish + client bump. Per-widget `config`
11
+ * is left opaque and carries widget *behaviour* only (a saved-view id, an action
12
+ * id, a heading's text) — never geometry — so a widget can evolve without a
13
+ * contract change while the API still validates the structural parts.
14
+ *
15
+ * `version` discriminates stored layouts so the client can detect and
16
+ * reset/migrate an older one on read.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/users/home-layout/shared.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -1,5 +1,6 @@
1
1
  export * from './constants';
2
2
  export * from './current';
3
+ export * from './home-layout';
3
4
  export * from './post';
4
5
  export * from './get';
5
6
  export * from './[id]';
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./constants"), exports);
18
18
  __exportStar(require("./current"), exports);
19
+ __exportStar(require("./home-layout"), exports);
19
20
  __exportStar(require("./post"), exports);
20
21
  __exportStar(require("./get"), exports);
21
22
  __exportStar(require("./[id]"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/users/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,4CAAyB;AACzB,yCAAsB;AACtB,wCAAqB;AACrB,yCAAsB;AACtB,4CAAyB;AACzB,mDAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/users/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,4CAAyB;AACzB,gDAA6B;AAC7B,yCAAsB;AACtB,wCAAqB;AACrB,yCAAsB;AACtB,4CAAyB;AACzB,mDAAgC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotto/contract",
3
3
  "license": "ISC",
4
- "version": "1.0.70-alpha.1",
4
+ "version": "1.0.70-alpha.10",
5
5
  "description": "Spotto's API Contract type definitions",
6
6
  "main": "./dist/index.js",
7
7
  "files": [
@@ -18,5 +18,5 @@
18
18
  "@types/geojson": "^7946.0.11",
19
19
  "shx": "^0.3.4"
20
20
  },
21
- "gitHead": "f9ca7e502cb0a991ebbc204eb54b166d64f2a307"
21
+ "gitHead": "401c779540b38f2313d405a9ce34f7ce0054418f"
22
22
  }