Skip to content

Commit d6c4371

Browse files
committed
Add a ChatGPT apps provider
- fetch the token using a hardcoded token tool we're expecting to exist server side - don't allow the api to run requests until the token has been returned
1 parent 1979f47 commit d6c4371

File tree

12 files changed

+697
-0
lines changed

12 files changed

+697
-0
lines changed

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ module.exports = {
77
"<rootDir>/packages/tiny-graphql-query-compiler/jest.config.js",
88
"<rootDir>/packages/shopify-extensions/jest.config.js",
99
"<rootDir>/packages/react-bigcommerce/jest.config.js",
10+
"<rootDir>/packages/react-chatgpt-apps/jest.config.js",
1011
],
1112
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# @gadgetinc/react-chatgpt-apps
Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
export default {
5+
displayName: "react-chatgpt-apps",
6+
// All imported modules in your tests should be mocked automatically
7+
// automock: false,
8+
9+
// Stop running tests after `n` failures
10+
// bail: 0,
11+
12+
// The directory where Jest should store its cached dependency information
13+
// cacheDirectory: process.env.LAYERCI ? "/tmp/jest-cache" : undefined,
14+
15+
// Automatically clear mock calls and instances between every test
16+
clearMocks: true,
17+
18+
// Indicates whether the coverage information should be collected while executing the test
19+
// collectCoverage: false,
20+
21+
// An array of glob patterns indicating a set of files for which coverage information should be collected
22+
// collectCoverageFrom: undefined,
23+
24+
// The directory where Jest should output its coverage files
25+
// coverageDirectory: undefined,
26+
27+
// An array of regexp pattern strings used to skip coverage collection
28+
// coveragePathIgnorePatterns: [
29+
// "/node_modules/"
30+
// ],
31+
32+
// A list of reporter names that Jest uses when writing coverage reports
33+
// coverageReporters: [
34+
// "json",
35+
// "text",
36+
// "lcov",
37+
// "clover"
38+
// ],
39+
40+
// An object that configures minimum threshold enforcement for coverage results
41+
// coverageThreshold: undefined,
42+
43+
// A path to a custom dependency extractor
44+
// dependencyExtractor: undefined,
45+
46+
// Make calling deprecated APIs throw helpful error messages
47+
// errorOnDeprecated: false,
48+
49+
extensionsToTreatAsEsm: [".ts", ".tsx"],
50+
51+
// Force coverage collection from ignored files using an array of glob patterns
52+
// forceCoverageMatch: [],
53+
54+
// A path to a module which exports an async function that is triggered once before all test suites
55+
// globalSetup: "<rootDir>/../api/spec/jest.globalsetup.ts",
56+
57+
// A path to a module which exports an async function that is triggered once after all test suites
58+
// globalTeardown: undefined,
59+
60+
// A set of global variables that need to be available in all test environments
61+
// globals: {},
62+
63+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
64+
// maxWorkers: "50%",
65+
66+
// An array of directory names to be searched recursively up from the requiring module's location
67+
// moduleDirectories: [
68+
// "node_modules"
69+
// ],
70+
71+
// An array of file extensions your modules use
72+
// moduleFileExtensions: [
73+
// "js",
74+
// "json",
75+
// "jsx",
76+
// "ts",
77+
// "tsx",
78+
// "node"
79+
// ],
80+
81+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
82+
moduleNameMapper: {
83+
"^(\\.{1,2}/.*)\\.js$": "$1",
84+
},
85+
86+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
87+
// modulePathIgnorePatterns: [],
88+
89+
// Activates notifications for test results
90+
// notify: false,
91+
92+
// An enum that specifies notification mode. Requires { notify: true }
93+
// notifyMode: "failure-change",
94+
95+
// A preset that is used as a base for Jest's configuration
96+
// preset: "ts-jest",
97+
98+
// Run tests from one or more projects
99+
// projects: undefined,
100+
101+
// Use this configuration option to add custom reporters to Jest
102+
// reporters: undefined,
103+
104+
// Automatically reset mock state between every test
105+
// resetMocks: false,
106+
107+
// Reset the module registry before running each individual test
108+
// resetModules: false,
109+
110+
// A path to a custom resolver
111+
// resolver: undefined,
112+
113+
// Automatically restore mock state between every test
114+
restoreMocks: true,
115+
116+
// The root directory that Jest should scan for tests and modules within
117+
// rootDir: undefined,
118+
119+
// A list of paths to directories that Jest should use to search for files in
120+
roots: ["<rootDir>"],
121+
122+
// Allows you to use a custom runner instead of Jest's default test runner
123+
// runner: "jest-runner",
124+
125+
// The paths to modules that run some code to configure or set up the testing environment before each test
126+
// setupFiles: ["./spec/setup.ts"],
127+
128+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
129+
// setupFilesAfterEnv: ["<rootDir>/spec/jest.setup.ts"],
130+
131+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
132+
// snapshotSerializers: [],
133+
134+
// The test environment that will be used for testing
135+
testEnvironment: "setup-polly-jest/jest-environment-jsdom",
136+
137+
// Options that will be passed to the testEnvironment
138+
// testEnvironmentOptions: {},
139+
140+
// Adds a location field to test results
141+
// testLocationInResults: false,
142+
143+
// The glob patterns Jest uses to detect test files
144+
// testMatch: [path.join(__dirname, "spec/(*.)+(spec|test).[tj]s?(x)")],
145+
146+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
147+
testPathIgnorePatterns: ["/node_modules/"],
148+
149+
// The regexp pattern or array of patterns that Jest uses to detect test files
150+
// testRegex: [],
151+
152+
// This option allows the use of a custom results processor
153+
// testResultsProcessor: undefined,
154+
155+
// This option allows use of a custom test runner
156+
// testRunner: "jasmine2",
157+
testRunner: "jest-circus/runner",
158+
159+
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
160+
// testURL: "http://localhost",
161+
162+
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
163+
// timers: "real",
164+
165+
// A map from regular expressions to paths to transformers
166+
// transform: undefined,
167+
transform: { "^.+\\.(t|j)sx?$": ["@swc/jest"] },
168+
169+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
170+
// transformIgnorePatterns: [
171+
// "/node_modules/"
172+
// ],
173+
// transformIgnorePatterns: ["/node_modules/(?!lodash)"],
174+
175+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
176+
// unmockedModulePathPatterns: undefined,
177+
178+
// Indicates whether each individual test should be reported during the run
179+
// verbose: undefined,
180+
181+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
182+
// watchPathIgnorePatterns: [],
183+
184+
// Whether to use watchman for file crawling
185+
// watchman: true,
186+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "@gadgetinc/react-chatgpt-apps",
3+
"version": "0.1.0",
4+
"files": [
5+
"README.md",
6+
"dist/**/*"
7+
],
8+
"license": "MIT",
9+
"repository": "github:gadget-inc/js-clients",
10+
"homepage": "https://github.com/gadget-inc/js-clients/tree/main/packages/react-chatgpt-apps",
11+
"type": "module",
12+
"exports": {
13+
".": {
14+
"import": "./dist/esm/index.js",
15+
"require": "./dist/cjs/index.js",
16+
"default": "./dist/esm/index.js"
17+
},
18+
"./package.json": "./package.json"
19+
},
20+
"source": "src/index.ts",
21+
"main": "dist/cjs/index.js",
22+
"scripts": {
23+
"typecheck": "tsc --noEmit",
24+
"build": "rm -rf dist && tsc -b tsconfig.cjs.json tsconfig.esm.json && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json && echo '{\"type\": \"module\"}' > dist/esm/package.json",
25+
"watch": "tsc --watch --preserveWatchOutput",
26+
"prepublishOnly": "pnpm build",
27+
"prerelease": "gitpkg publish"
28+
},
29+
"dependencies": {
30+
"@gadgetinc/api-client-core": "^0.15.46"
31+
},
32+
"devDependencies": {
33+
"@gadgetinc/api-client-core": "workspace:*",
34+
"@gadgetinc/react": "workspace:*",
35+
"@types/react": "^19.1.1",
36+
"@types/react-dom": "^19.1.1",
37+
"conditional-type-checks": "^1.0.6",
38+
"react": "^19.1.1",
39+
"react-dom": "^19.1.1"
40+
},
41+
"peerDependencies": {
42+
"react": "^19.0.0",
43+
"react-dom": "^19.0.0",
44+
"@gadgetinc/react": "^0.22.0"
45+
}
46+
}

0 commit comments

Comments
 (0)