@apollo/client-ai-apps 0.1.1 → 0.2.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.
- package/.github/workflows/release.yaml +16 -16
- package/dist/hooks/useRequestDisplayMode.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/vite/{operation_manifest_plugin.d.ts → application_manifest_plugin.d.ts} +1 -1
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +8 -4
- package/package.json +2 -2
- package/src/hooks/useRequestDisplayMode.test.ts +17 -0
- package/src/hooks/useRequestDisplayMode.ts +1 -1
- package/src/vite/{operation_manifest_plugin.ts → application_manifest_plugin.ts} +5 -1
- package/src/vite/index.ts +1 -1
|
@@ -31,22 +31,22 @@ jobs:
|
|
|
31
31
|
shell: bash
|
|
32
32
|
run: npm run build
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
- name: Test
|
|
35
|
+
shell: bash
|
|
36
|
+
run: npm run test
|
|
37
|
+
|
|
38
|
+
- name: Configure Git
|
|
39
|
+
run: |
|
|
40
|
+
git config --global user.name GitHub Actions
|
|
41
|
+
git config user.email github-actions@github.com
|
|
42
|
+
|
|
43
|
+
- uses: knope-dev/action@v2.1.0
|
|
44
|
+
with:
|
|
45
|
+
version: 0.21.5
|
|
46
|
+
|
|
47
|
+
- run: knope release
|
|
48
|
+
env:
|
|
49
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
50
50
|
|
|
51
51
|
- name: Publish to npm
|
|
52
52
|
shell: bash
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,7 @@ var useSendFollowUpMessage = () => {
|
|
|
51
51
|
// src/hooks/useRequestDisplayMode.ts
|
|
52
52
|
var useRequestDisplayMode = () => {
|
|
53
53
|
return async (args) => {
|
|
54
|
-
await window.openai?.requestDisplayMode(args);
|
|
54
|
+
return await window.openai?.requestDisplayMode(args);
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TypeNode, type DocumentNode } from "graphql";
|
|
2
2
|
export declare function getTypeName(type: TypeNode): string;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const ApplicationManifestPlugin: () => {
|
|
4
4
|
name: string;
|
|
5
5
|
configResolved(resolvedConfig: any): Promise<void>;
|
|
6
6
|
buildStart(): Promise<void>;
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./application_manifest_plugin";
|
package/dist/vite/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/vite/
|
|
1
|
+
// src/vite/application_manifest_plugin.ts
|
|
2
2
|
import { readFileSync, writeFileSync } from "fs";
|
|
3
3
|
import { glob } from "glob";
|
|
4
4
|
import { gqlPluckFromCodeStringSync } from "@graphql-tools/graphql-tag-pluck";
|
|
@@ -35,7 +35,7 @@ function getTypeName(type) {
|
|
|
35
35
|
}
|
|
36
36
|
return t.name.value;
|
|
37
37
|
}
|
|
38
|
-
var
|
|
38
|
+
var ApplicationManifestPlugin = () => {
|
|
39
39
|
const cache = /* @__PURE__ */ new Map();
|
|
40
40
|
let packageJson = null;
|
|
41
41
|
let config = null;
|
|
@@ -127,7 +127,11 @@ var OperationManifestPlugin = () => {
|
|
|
127
127
|
description: packageJson.description,
|
|
128
128
|
hash: createHash("sha256").update(Date.now().toString()).digest("hex"),
|
|
129
129
|
operations: Array.from(cache.values()).flatMap((entry) => entry.operations),
|
|
130
|
-
resource
|
|
130
|
+
resource,
|
|
131
|
+
csp: {
|
|
132
|
+
connectDomains: packageJson.csp?.connectDomains ?? [],
|
|
133
|
+
resourceDomains: packageJson.csp?.resourceDomains ?? []
|
|
134
|
+
}
|
|
131
135
|
};
|
|
132
136
|
if (config.command === "build") {
|
|
133
137
|
const dest = path.resolve(root, config.build.outDir, ".application-manifest.json");
|
|
@@ -204,7 +208,7 @@ function removeClientDirective(doc) {
|
|
|
204
208
|
});
|
|
205
209
|
}
|
|
206
210
|
export {
|
|
207
|
-
|
|
211
|
+
ApplicationManifestPlugin,
|
|
208
212
|
getTypeName,
|
|
209
213
|
sortTopLevelDefinitions
|
|
210
214
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { expect, test, vi } from "vitest";
|
|
2
|
+
import { useRequestDisplayMode } from "./useRequestDisplayMode";
|
|
3
|
+
import { DisplayMode } from "../types/openai";
|
|
4
|
+
|
|
5
|
+
test("Should set display mode when returned function is called", async () => {
|
|
6
|
+
vi.stubGlobal("openai", {
|
|
7
|
+
requestDisplayMode: vi.fn(async (args: { mode: DisplayMode }) => {
|
|
8
|
+
return args;
|
|
9
|
+
}),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const requestDisplayMode = useRequestDisplayMode();
|
|
13
|
+
const result = await requestDisplayMode({ mode: "inline" });
|
|
14
|
+
|
|
15
|
+
expect(window.openai.requestDisplayMode).toBeCalledWith({ mode: "inline" });
|
|
16
|
+
expect(result).toEqual({ mode: "inline" });
|
|
17
|
+
});
|
|
@@ -46,7 +46,7 @@ export function getTypeName(type: TypeNode): string {
|
|
|
46
46
|
return (t as NamedTypeNode).name.value;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export const
|
|
49
|
+
export const ApplicationManifestPlugin = () => {
|
|
50
50
|
const cache = new Map();
|
|
51
51
|
let packageJson: any = null;
|
|
52
52
|
let config: any = null;
|
|
@@ -166,6 +166,10 @@ export const OperationManifestPlugin = () => {
|
|
|
166
166
|
hash: createHash("sha256").update(Date.now().toString()).digest("hex"),
|
|
167
167
|
operations: Array.from(cache.values()).flatMap((entry) => entry.operations),
|
|
168
168
|
resource,
|
|
169
|
+
csp: {
|
|
170
|
+
connectDomains: packageJson.csp?.connectDomains ?? [],
|
|
171
|
+
resourceDomains: packageJson.csp?.resourceDomains ?? [],
|
|
172
|
+
},
|
|
169
173
|
};
|
|
170
174
|
|
|
171
175
|
if (config.command === "build") {
|
package/src/vite/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./application_manifest_plugin";
|