@antcde/connect-ts 0.4.27-rc.1 → 0.4.27-rc.3

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 (95) hide show
  1. package/README.md +67 -3
  2. package/build/AntConnect.d.ts +2 -0
  3. package/build/AntConnect.d.ts.map +1 -1
  4. package/build/AntConnect.js +2 -0
  5. package/build/AntHttpClient.d.ts +0 -5
  6. package/build/AntHttpClient.d.ts.map +1 -1
  7. package/build/AntHttpClient.js +0 -5
  8. package/build/ai/index.d.ts +5 -0
  9. package/build/ai/index.d.ts.map +1 -0
  10. package/build/ai/index.js +3 -0
  11. package/build/ai/mutationDescriptors.d.ts +3 -0
  12. package/build/ai/mutationDescriptors.d.ts.map +1 -0
  13. package/build/ai/mutationDescriptors.js +207 -0
  14. package/build/ai/mutationTargets.d.ts +21 -0
  15. package/build/ai/mutationTargets.d.ts.map +1 -0
  16. package/build/ai/mutationTargets.js +72 -0
  17. package/build/ai/queryDescriptors.d.ts +3 -0
  18. package/build/ai/queryDescriptors.d.ts.map +1 -0
  19. package/build/ai/queryDescriptors.js +174 -0
  20. package/build/ai/types.d.ts +35 -0
  21. package/build/ai/types.d.ts.map +1 -0
  22. package/build/ai/types.js +1 -0
  23. package/build/comms/client.js +1 -1
  24. package/build/comms/hostAPI.js +1 -1
  25. package/build/comms/models.d.ts +20 -2
  26. package/build/comms/models.d.ts.map +1 -1
  27. package/build/index.d.ts +3 -1
  28. package/build/index.d.ts.map +1 -1
  29. package/build/service-runtime.d.ts +3 -0
  30. package/build/service-runtime.d.ts.map +1 -1
  31. package/build/service-runtime.js +3 -0
  32. package/build/service-types-app.d.ts +1 -1
  33. package/build/service-types-app.d.ts.map +1 -1
  34. package/build/service-types.d.ts +2 -1
  35. package/build/service-types.d.ts.map +1 -1
  36. package/build/services/AiService.d.ts +18 -0
  37. package/build/services/AiService.d.ts.map +1 -0
  38. package/build/services/AiService.js +9 -0
  39. package/build/services/AppService/factory/resourceAccess.d.ts +21 -0
  40. package/build/services/AppService/factory/resourceAccess.d.ts.map +1 -0
  41. package/build/services/AppService/factory/resourceAccess.js +44 -0
  42. package/build/services/AppService/factory/resourceChannels.d.ts +89 -0
  43. package/build/services/AppService/factory/resourceChannels.d.ts.map +1 -0
  44. package/build/services/AppService/factory/resourceChannels.js +19 -0
  45. package/build/services/AppService/factory/resourceCommerce.d.ts +52 -0
  46. package/build/services/AppService/factory/resourceCommerce.d.ts.map +1 -0
  47. package/build/services/AppService/factory/resourceCommerce.js +18 -0
  48. package/build/services/AppService/factory/resourceSnapshot.d.ts +62 -0
  49. package/build/services/AppService/factory/resourceSnapshot.d.ts.map +1 -0
  50. package/build/services/AppService/factory/resourceSnapshot.js +34 -0
  51. package/build/services/AppService/factory/resources.d.ts +154 -0
  52. package/build/services/AppService/factory/resources.d.ts.map +1 -0
  53. package/build/services/AppService/factory/resources.js +40 -0
  54. package/build/services/AppService/index.d.ts +2 -1
  55. package/build/services/AppService/index.d.ts.map +1 -1
  56. package/build/services/AppService/index.js +9 -2
  57. package/build/services/AppService/types/appList.d.ts +28 -0
  58. package/build/services/AppService/types/appList.d.ts.map +1 -1
  59. package/build/services/AppService/types/appManifest.d.ts +46 -0
  60. package/build/services/AppService/types/appManifest.d.ts.map +1 -1
  61. package/build/services/AppService/types/appRequests.d.ts +13 -0
  62. package/build/services/AppService/types/appRequests.d.ts.map +1 -1
  63. package/build/services/AppService/types/resourceEntitlements.d.ts +109 -0
  64. package/build/services/AppService/types/resourceEntitlements.d.ts.map +1 -0
  65. package/build/services/AppService/types/resourceEntitlements.js +1 -0
  66. package/build/services/AppService/types/resourceReleases.d.ts +223 -0
  67. package/build/services/AppService/types/resourceReleases.d.ts.map +1 -0
  68. package/build/services/AppService/types/resourceReleases.js +1 -0
  69. package/build/services/AppService/types/resourceRequests.d.ts +115 -0
  70. package/build/services/AppService/types/resourceRequests.d.ts.map +1 -0
  71. package/build/services/AppService/types/resourceRequests.js +1 -0
  72. package/build/services/AppService/types/sellableResources.d.ts +189 -0
  73. package/build/services/AppService/types/sellableResources.d.ts.map +1 -0
  74. package/build/services/AppService/types/sellableResources.js +1 -0
  75. package/build/services/AppService/types/snapshotPayload.d.ts +146 -0
  76. package/build/services/AppService/types/snapshotPayload.d.ts.map +1 -0
  77. package/build/services/AppService/types/snapshotPayload.js +16 -0
  78. package/build/services/AppService/types/snapshotSources.d.ts +98 -0
  79. package/build/services/AppService/types/snapshotSources.d.ts.map +1 -0
  80. package/build/services/AppService/types/snapshotSources.js +7 -0
  81. package/build/services/AppService/types.d.ts +6 -0
  82. package/build/services/AppService/types.d.ts.map +1 -1
  83. package/build/services/AppService/types.js +6 -0
  84. package/build/services/TokenService.d.ts +0 -1
  85. package/build/services/TokenService.d.ts.map +1 -1
  86. package/build/services/TokenService.js +0 -2
  87. package/build/services/UserService.d.ts +3 -0
  88. package/build/services/UserService.d.ts.map +1 -1
  89. package/build/services/Websockets/StoreEvents.d.ts +14 -1
  90. package/build/services/Websockets/StoreEvents.d.ts.map +1 -1
  91. package/build/services/userPreferences.d.ts +37 -0
  92. package/build/services/userPreferences.d.ts.map +1 -0
  93. package/build/services/userPreferences.js +39 -0
  94. package/package.json +3 -2
  95. package/schemas/app-config.schema.json +79 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userPreferences.d.ts","sourceRoot":"","sources":["../../src/services/userPreferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,wFAAwF;IACxF,OAAO,EAAE,MAAM,CAAA;IACf,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAA;IAChB,EAAE,EAAE,aAAa,CAAA;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,kBAAkB,CAAA;CAC5B;AAcD,eAAO,MAAM,qBAAqB;;;;;;;;;;iBAEhC,CAAA;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAKpC,CAAA;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CAmBlE"}
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ const aiPreferencesSchema = z.object({
3
+ enabled: z.boolean().catch(false),
4
+ baseUrl: z.string().catch(''),
5
+ model: z.string().catch(''),
6
+ endpoint: z.string().catch(''),
7
+ }).catch({ enabled: false, baseUrl: '', model: '', endpoint: '' });
8
+ const devModePreferencesSchema = z.object({
9
+ enabled: z.boolean().catch(false),
10
+ ai: aiPreferencesSchema,
11
+ }).catch({ enabled: false, ai: { enabled: false, baseUrl: '', model: '', endpoint: '' } });
12
+ export const userPreferencesSchema = z.object({
13
+ devMode: devModePreferencesSchema,
14
+ });
15
+ export const defaultUserPreferences = {
16
+ devMode: {
17
+ enabled: false,
18
+ ai: { enabled: false, baseUrl: '', model: '', endpoint: '' },
19
+ },
20
+ };
21
+ export function parseUserPreferences(raw) {
22
+ const result = userPreferencesSchema.safeParse(raw);
23
+ if (!result.success)
24
+ return structuredClone(defaultUserPreferences);
25
+ // Normalize explicitly: zod's catch() output is typed optional under
26
+ // non-strict tsconfigs (the codegen one), so ?? the defaults per field.
27
+ const devMode = result.data.devMode;
28
+ return {
29
+ devMode: {
30
+ enabled: devMode?.enabled ?? false,
31
+ ai: {
32
+ enabled: devMode?.ai?.enabled ?? false,
33
+ baseUrl: devMode?.ai?.baseUrl ?? '',
34
+ model: devMode?.ai?.model ?? '',
35
+ endpoint: devMode?.ai?.endpoint ?? '',
36
+ },
37
+ },
38
+ };
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antcde/connect-ts",
3
- "version": "0.4.27-rc.1",
3
+ "version": "0.4.27-rc.3",
4
4
  "description": "Helper to connect to the ANT api",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -39,7 +39,8 @@
39
39
  "comlink": "^4.4.2",
40
40
  "post-robot": "10.0.46",
41
41
  "qs": "^6.15.3",
42
- "rxjs": "^7.8.2"
42
+ "rxjs": "^7.8.2",
43
+ "zod": "^4.4.3"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@faker-js/faker": "^9.9.0",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://antcde.io/schemas/app-config.schema.json",
4
4
  "title": "ANT App Manifest",
5
- "description": "Shape of app-config.json shipped inside an ANT app's distribution. Read by ant-os and the App Store to discover what an app declares about itself.",
5
+ "description": "Shape of app-config.json shipped inside an ANT app's distribution. Read by ant-os and the App Store to discover what an app declares about itself. Deliberately lenient: no level sets additionalProperties, so an app may ship keys this schema does not know (a field added to the types before the schema catches up, or an app-private extension) without the manifest going invalid. Declared values are still checked — types, enums and the dropdown/options_value rule all hold. Do not re-close it without a reason: unknown keys are tolerated on purpose.",
6
6
  "type": "object",
7
7
  "required": ["version"],
8
8
  "properties": {
@@ -32,13 +32,87 @@
32
32
  "description": "Generic topic pub/sub capabilities keyed by topic name.",
33
33
  "patternProperties": {
34
34
  "^[A-Za-z0-9_-]+$": { "$ref": "#/$defs/topicEntry" }
35
- },
36
- "additionalProperties": false
35
+ }
36
+ }
37
+ }
38
+ },
39
+ "capabilities": {
40
+ "type": "object",
41
+ "description": "What the app can be driven to do via the URL. Consumed by the AI overlay to build per-app tools and by the host to validate app-state snapshots.",
42
+ "properties": {
43
+ "queryParams": {
44
+ "type": "object",
45
+ "description": "Query params the app understands, keyed by param name.",
46
+ "patternProperties": {
47
+ "^[A-Za-z0-9_-]+$": { "$ref": "#/$defs/queryParamEntry" }
48
+ }
49
+ },
50
+ "intents": {
51
+ "type": "array",
52
+ "description": "Named actions the app can be deep-linked into.",
53
+ "items": { "$ref": "#/$defs/intentEntry" }
37
54
  }
38
55
  }
39
56
  }
40
57
  },
41
58
  "$defs": {
59
+ "queryParamEntry": {
60
+ "type": "object",
61
+ "description": "A single query param the app understands.",
62
+ "required": ["type"],
63
+ "properties": {
64
+ "type": {
65
+ "type": "string",
66
+ "enum": ["string", "number", "boolean", "date", "time", "datetime"],
67
+ "description": "Value type. On the URL everything is a string; number/boolean/date/time/datetime are rendering + validation hints."
68
+ },
69
+ "description": {
70
+ "type": "string",
71
+ "description": "What the param does. Surfaced to the AI as tool-parameter help."
72
+ },
73
+ "enum": {
74
+ "type": "array",
75
+ "items": { "type": "string" },
76
+ "description": "Allowed values. Becomes an enum constraint for the AI."
77
+ },
78
+ "multiple": {
79
+ "type": "boolean",
80
+ "default": false,
81
+ "description": "Accept several values (multi-select / CSV on the wire)."
82
+ },
83
+ "required": {
84
+ "type": "boolean",
85
+ "default": false,
86
+ "description": "Whether the param must be supplied to invoke the app."
87
+ },
88
+ "access": {
89
+ "type": "string",
90
+ "enum": ["read", "write", "readwrite"],
91
+ "default": "readwrite",
92
+ "description": "Who may drive the param. 'read' only REFLECTS app state on the URL — the AI and the confirm form show it but never set it. 'write'/'readwrite' are commandable. Defaults to 'readwrite'."
93
+ }
94
+ }
95
+ },
96
+ "intentEntry": {
97
+ "type": "object",
98
+ "description": "A named action the app can be deep-linked into.",
99
+ "required": ["id", "description"],
100
+ "properties": {
101
+ "id": {
102
+ "type": "string",
103
+ "description": "Stable intent identifier."
104
+ },
105
+ "description": {
106
+ "type": "string",
107
+ "description": "What the intent does. Read by the AI to match user requests."
108
+ },
109
+ "params": {
110
+ "type": "array",
111
+ "items": { "type": "string" },
112
+ "description": "Names of queryParams this intent uses."
113
+ }
114
+ }
115
+ },
42
116
  "tableEntry": {
43
117
  "type": "object",
44
118
  "description": "A table the app declares. Columns are created when the app is added to a project.",
@@ -65,8 +139,7 @@
65
139
  "items": { "$ref": "#/$defs/columnEntry" },
66
140
  "minItems": 1
67
141
  }
68
- },
69
- "additionalProperties": false
142
+ }
70
143
  },
71
144
  "columnEntry": {
72
145
  "type": "object",
@@ -127,7 +200,6 @@
127
200
  "description": "Display name for the column in the UI."
128
201
  }
129
202
  },
130
- "additionalProperties": false,
131
203
  "if": {
132
204
  "properties": { "type": { "const": "dropdown" } }
133
205
  },
@@ -164,8 +236,7 @@
164
236
  "$ref": "https://json-schema.org/draft/2020-12/schema",
165
237
  "description": "JSON Schema describing the topic payload shape."
166
238
  }
167
- },
168
- "additionalProperties": false
239
+ }
169
240
  }
170
241
  }
171
242
  }