@apollo/client-ai-apps 0.1.0 → 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 +29 -12
- 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 +7 -5
- 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
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
|
@@ -3,34 +3,51 @@ name: Release new Version
|
|
|
3
3
|
on:
|
|
4
4
|
workflow_dispatch:
|
|
5
5
|
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
id-token: write # Required for OIDC
|
|
9
|
+
|
|
6
10
|
jobs:
|
|
7
11
|
release:
|
|
8
12
|
name: Release
|
|
9
13
|
if: github.repository == 'apollographql/apollo-ai-apps-client'
|
|
10
14
|
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
contents: write # to create release (changesets/action)
|
|
13
|
-
issues: write # to post issue comments (changesets/action)
|
|
14
|
-
pull-requests: write # to create pull request (changesets/action)
|
|
15
|
-
id-token: write # to use OpenID Connect token for provenance (changesets/action)
|
|
16
15
|
steps:
|
|
17
16
|
- uses: actions/checkout@v4
|
|
18
17
|
|
|
19
18
|
- name: Setup Node.js 20.x
|
|
20
19
|
uses: actions/setup-node@v4
|
|
21
20
|
with:
|
|
22
|
-
node-version:
|
|
21
|
+
node-version: ">=23.6.0"
|
|
22
|
+
registry-url: "https://registry.npmjs.org/"
|
|
23
|
+
env:
|
|
24
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
23
25
|
|
|
24
26
|
- name: Install dependencies
|
|
25
27
|
shell: bash
|
|
26
28
|
run: npm ci
|
|
27
29
|
|
|
28
|
-
- name:
|
|
29
|
-
|
|
30
|
+
- name: Build
|
|
31
|
+
shell: bash
|
|
32
|
+
run: npm run build
|
|
33
|
+
|
|
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
|
|
30
44
|
with:
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
version: 0.21.5
|
|
46
|
+
|
|
47
|
+
- run: knope release
|
|
33
48
|
env:
|
|
34
49
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
|
|
51
|
+
- name: Publish to npm
|
|
52
|
+
shell: bash
|
|
53
|
+
run: npm publish --provenance --access public
|
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
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/client-ai-apps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/apollographql/apollo-ai-apps-client"
|
|
9
|
+
},
|
|
7
10
|
"type": "module",
|
|
8
11
|
"main": "dist/index.js",
|
|
9
12
|
"module": "dist/index.js",
|
|
@@ -17,10 +20,9 @@
|
|
|
17
20
|
"build": "npm run build:react && npm run build:vite",
|
|
18
21
|
"build:react": "node ./scripts/build.mjs && tsc src/index.ts --emitDeclarationOnly --declaration --outDir dist --skipLibCheck --lib ES2015,DOM --target ES2015 --moduleResolution bundler --jsx react",
|
|
19
22
|
"build:vite": "node ./scripts/build-vite.mjs && tsc src/vite/index.ts --emitDeclarationOnly --declaration --outDir dist/vite --skipLibCheck --lib ES2015,DOM --target ES2020 --module esnext --moduleResolution node --allowSyntheticDefaultImports",
|
|
20
|
-
"changeset:new": "npx @changesets/cli",
|
|
21
|
-
"changeset:version": "npx @changesets/cli version",
|
|
22
23
|
"test": "vitest run --coverage",
|
|
23
|
-
"test:watch": "vitest --coverage"
|
|
24
|
+
"test:watch": "vitest --coverage",
|
|
25
|
+
"changeset": "knope document-change"
|
|
24
26
|
},
|
|
25
27
|
"keywords": [],
|
|
26
28
|
"author": "",
|
|
@@ -50,4 +52,4 @@
|
|
|
50
52
|
"crypto-hash": "^4.0.0",
|
|
51
53
|
"glob": "^11.0.3"
|
|
52
54
|
}
|
|
53
|
-
}
|
|
55
|
+
}
|
|
@@ -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";
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "restricted",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|