@voyant-travel/apps 0.3.0 → 0.5.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 (39) hide show
  1. package/dist/api-runtime.d.ts +15 -0
  2. package/dist/api-runtime.js +15 -1
  3. package/dist/app-api-contracts.d.ts +51 -0
  4. package/dist/app-api-contracts.js +50 -0
  5. package/dist/app-api-routes.d.ts +28 -0
  6. package/dist/app-api-routes.js +141 -0
  7. package/dist/app-api-service.d.ts +1263 -0
  8. package/dist/app-api-service.js +244 -0
  9. package/dist/app-api-service.test.d.ts +1 -0
  10. package/dist/app-api-service.test.js +109 -0
  11. package/dist/consent.js +16 -1
  12. package/dist/consent.test.js +24 -0
  13. package/dist/contracts.d.ts +31 -3
  14. package/dist/contracts.js +25 -0
  15. package/dist/extension-resolution.d.ts +72 -0
  16. package/dist/extension-resolution.js +159 -0
  17. package/dist/extension-resolution.test.d.ts +1 -0
  18. package/dist/extension-resolution.test.js +111 -0
  19. package/dist/index.d.ts +8 -1
  20. package/dist/index.js +8 -1
  21. package/dist/installation-service.d.ts +1 -1
  22. package/dist/locale-resolution.d.ts +59 -0
  23. package/dist/locale-resolution.js +113 -0
  24. package/dist/locale-resolution.test.d.ts +1 -0
  25. package/dist/locale-resolution.test.js +48 -0
  26. package/dist/routes.d.ts +9 -0
  27. package/dist/routes.js +43 -2
  28. package/dist/schema.d.ts +237 -0
  29. package/dist/schema.js +27 -0
  30. package/dist/session-token-service.d.ts +47 -0
  31. package/dist/session-token-service.js +127 -0
  32. package/dist/session-token.d.ts +82 -0
  33. package/dist/session-token.js +0 -0
  34. package/dist/session-token.test.d.ts +1 -0
  35. package/dist/session-token.test.js +97 -0
  36. package/dist/voyant.js +87 -1
  37. package/migrations/20260717150000_app_session_tokens.sql +18 -0
  38. package/migrations/meta/_journal.json +8 -1
  39. package/package.json +42 -7
package/dist/voyant.js CHANGED
@@ -1,4 +1,5 @@
1
- import { defineModule } from "@voyant-travel/core/project";
1
+ import { defineModule, requirePort } from "@voyant-travel/core/project";
2
+ import { customFieldValueLifecycleRuntimePort, customFieldValueOperationsRuntimePort, } from "@voyant-travel/core/runtime-port";
2
3
  const appInstallationLifecyclePayloadSchema = {
3
4
  type: "object",
4
5
  additionalProperties: false,
@@ -13,6 +14,16 @@ export const appsVoyantModule = defineModule({
13
14
  id: "@voyant-travel/apps",
14
15
  packageName: "@voyant-travel/apps",
15
16
  localId: "apps",
17
+ runtimePorts: [
18
+ requirePort(customFieldValueLifecycleRuntimePort, {
19
+ optional: true,
20
+ cardinality: "many",
21
+ }),
22
+ requirePort(customFieldValueOperationsRuntimePort, {
23
+ optional: true,
24
+ cardinality: "many",
25
+ }),
26
+ ],
16
27
  api: [
17
28
  {
18
29
  id: "@voyant-travel/apps#api.admin",
@@ -82,6 +93,81 @@ export const appsVoyantModule = defineModule({
82
93
  ],
83
94
  access: {
84
95
  resources: [
96
+ {
97
+ id: "@voyant-travel/apps#access.app-installation",
98
+ resource: "app-installation",
99
+ label: "App installation",
100
+ description: "Read the calling app installation and grant state.",
101
+ remoteSafe: true,
102
+ actions: [{ action: "read", label: "Read installation", description: "Read self." }],
103
+ },
104
+ {
105
+ id: "@voyant-travel/apps#access.custom-field-definitions",
106
+ resource: "custom-field-definitions",
107
+ label: "Own custom-field definitions",
108
+ description: "Read and write custom-field definitions owned by the app.",
109
+ remoteSafe: true,
110
+ actions: ["read", "write"],
111
+ wildcard: "explicit-resource",
112
+ },
113
+ {
114
+ id: "@voyant-travel/apps#access.custom-field-values",
115
+ resource: "custom-field-values",
116
+ label: "Own custom-field values",
117
+ description: "Read and write app-owned custom-field values by target.",
118
+ remoteSafe: true,
119
+ actions: ["read", "write", "booking", "person", "organization", "invoice"],
120
+ wildcard: "explicit-resource",
121
+ },
122
+ {
123
+ id: "@voyant-travel/apps#access.webhooks",
124
+ resource: "webhooks",
125
+ label: "App webhooks",
126
+ description: "Read webhook health and request replay.",
127
+ remoteSafe: true,
128
+ actions: [
129
+ "read",
130
+ { action: "replay", label: "Replay webhooks", description: "Replay deliveries." },
131
+ ],
132
+ },
133
+ {
134
+ id: "@voyant-travel/apps#access.app-audit",
135
+ resource: "app-audit",
136
+ label: "App audit history",
137
+ description: "Read audit history owned by the app.",
138
+ remoteSafe: true,
139
+ actions: ["read"],
140
+ },
141
+ {
142
+ id: "@voyant-travel/apps#access.online-token",
143
+ resource: "online-token",
144
+ label: "Online token exchange",
145
+ description: "Exchange admin session context for online app access.",
146
+ remoteSafe: true,
147
+ actions: [{ action: "exchange", wildcard: "explicit" }],
148
+ },
149
+ {
150
+ id: "@voyant-travel/apps#access.finance-documents",
151
+ resource: "finance-documents",
152
+ label: "Finance documents",
153
+ description: "Read finance documents visible to remote accounting apps.",
154
+ remoteSafe: true,
155
+ actions: ["read"],
156
+ wildcard: "explicit-resource",
157
+ },
158
+ {
159
+ id: "@voyant-travel/apps#access.finance-actions",
160
+ resource: "finance-actions",
161
+ label: "Finance actions",
162
+ description: "Request approved finance document actions.",
163
+ remoteSafe: true,
164
+ actions: [
165
+ { action: "issue", sensitive: true, wildcard: "explicit" },
166
+ { action: "retry", sensitive: true, wildcard: "explicit" },
167
+ { action: "reconcile", sensitive: true, wildcard: "explicit" },
168
+ ],
169
+ wildcard: "explicit-resource",
170
+ },
85
171
  {
86
172
  id: "@voyant-travel/apps#access.apps",
87
173
  resource: "apps",
@@ -0,0 +1,18 @@
1
+ CREATE TABLE "app_session_tokens" (
2
+ "id" text PRIMARY KEY NOT NULL,
3
+ "installation_id" text NOT NULL,
4
+ "app_id" text NOT NULL,
5
+ "deployment_id" text NOT NULL,
6
+ "jti" text NOT NULL,
7
+ "viewer_id" text NOT NULL,
8
+ "entity_type" text,
9
+ "entity_id" text,
10
+ "slot" text,
11
+ "issued_at" timestamp with time zone DEFAULT now() NOT NULL,
12
+ "expires_at" timestamp with time zone NOT NULL,
13
+ "consumed_at" timestamp with time zone,
14
+ "consumed_by_actor_id" text
15
+ );--> statement-breakpoint
16
+ ALTER TABLE "app_session_tokens" ADD CONSTRAINT "app_session_tokens_installation_id_app_installations_id_fk" FOREIGN KEY ("installation_id") REFERENCES "public"."app_installations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
17
+ CREATE UNIQUE INDEX "uidx_app_session_tokens_jti" ON "app_session_tokens" USING btree ("jti");--> statement-breakpoint
18
+ CREATE INDEX "idx_app_session_tokens_installation" ON "app_session_tokens" USING btree ("installation_id","expires_at");
@@ -29,6 +29,13 @@
29
29
  "when": 1784298600000,
30
30
  "tag": "20260717143000_app_oauth_authorization",
31
31
  "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1784300400000,
37
+ "tag": "20260717150000_app_session_tokens",
38
+ "breakpoints": true
32
39
  }
33
40
  ]
34
- }
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyant-travel/apps",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -14,6 +14,21 @@
14
14
  "import": "./dist/access-boundary.js",
15
15
  "default": "./dist/access-boundary.js"
16
16
  },
17
+ "./app-api-contracts": {
18
+ "types": "./dist/app-api-contracts.d.ts",
19
+ "import": "./dist/app-api-contracts.js",
20
+ "default": "./dist/app-api-contracts.js"
21
+ },
22
+ "./app-api-routes": {
23
+ "types": "./dist/app-api-routes.d.ts",
24
+ "import": "./dist/app-api-routes.js",
25
+ "default": "./dist/app-api-routes.js"
26
+ },
27
+ "./app-api-service": {
28
+ "types": "./dist/app-api-service.d.ts",
29
+ "import": "./dist/app-api-service.js",
30
+ "default": "./dist/app-api-service.js"
31
+ },
17
32
  "./api-runtime": {
18
33
  "types": "./dist/api-runtime.d.ts",
19
34
  "import": "./dist/api-runtime.js",
@@ -34,11 +49,21 @@
34
49
  "import": "./dist/consent.js",
35
50
  "default": "./dist/consent.js"
36
51
  },
52
+ "./extension-resolution": {
53
+ "types": "./dist/extension-resolution.d.ts",
54
+ "import": "./dist/extension-resolution.js",
55
+ "default": "./dist/extension-resolution.js"
56
+ },
37
57
  "./ingestion": {
38
58
  "types": "./dist/ingestion.d.ts",
39
59
  "import": "./dist/ingestion.js",
40
60
  "default": "./dist/ingestion.js"
41
61
  },
62
+ "./locale-resolution": {
63
+ "types": "./dist/locale-resolution.d.ts",
64
+ "import": "./dist/locale-resolution.js",
65
+ "default": "./dist/locale-resolution.js"
66
+ },
42
67
  "./installation-service": {
43
68
  "types": "./dist/installation-service.d.ts",
44
69
  "import": "./dist/installation-service.js",
@@ -69,6 +94,16 @@
69
94
  "import": "./dist/service.js",
70
95
  "default": "./dist/service.js"
71
96
  },
97
+ "./session-token": {
98
+ "types": "./dist/session-token.d.ts",
99
+ "import": "./dist/session-token.js",
100
+ "default": "./dist/session-token.js"
101
+ },
102
+ "./session-token-service": {
103
+ "types": "./dist/session-token-service.d.ts",
104
+ "import": "./dist/session-token-service.js",
105
+ "default": "./dist/session-token-service.js"
106
+ },
72
107
  "./voyant": {
73
108
  "types": "./dist/voyant.d.ts",
74
109
  "import": "./dist/voyant.js",
@@ -80,14 +115,14 @@
80
115
  "drizzle-orm": "^0.45.2",
81
116
  "hono": "^4.12.27",
82
117
  "zod": "^4.4.3",
83
- "@voyant-travel/admin": "^0.126.2",
84
- "@voyant-travel/core": "^0.125.1",
85
- "@voyant-travel/admin-extension-sdk": "^0.1.1",
118
+ "@voyant-travel/admin": "^0.127.0",
119
+ "@voyant-travel/admin-extension-sdk": "^0.2.0",
120
+ "@voyant-travel/core": "^0.125.2",
86
121
  "@voyant-travel/custom-fields": "^0.2.1",
87
122
  "@voyant-travel/db": "^0.114.10",
88
- "@voyant-travel/types": "^0.109.3",
89
- "@voyant-travel/webhook-delivery": "^0.4.0",
90
- "@voyant-travel/hono": "^0.128.2"
123
+ "@voyant-travel/hono": "^0.128.3",
124
+ "@voyant-travel/types": "^0.109.4",
125
+ "@voyant-travel/webhook-delivery": "^0.4.0"
91
126
  },
92
127
  "devDependencies": {
93
128
  "@types/node": "^25.5.2",