create-feathersdev 0.11.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/CHANGELOG.md +107 -0
- package/README.md +3 -0
- package/bin/feathersdev +9 -0
- package/esm/actions/app.js +51 -0
- package/esm/actions/integrate.js +80 -0
- package/esm/actions/login.js +8 -0
- package/esm/actions/logout.js +12 -0
- package/esm/actions/server.js +52 -0
- package/esm/base.js +40 -0
- package/esm/flows/check-login.js +70 -0
- package/esm/flows/with-application.js +81 -0
- package/esm/flows/with-organization.js +74 -0
- package/esm/index.js +55 -0
- package/esm/package.json +1 -0
- package/examples/frontend/auth.ts +39 -0
- package/examples/frontend/react/.eslintrc.cjs +18 -0
- package/examples/frontend/react/README.md +30 -0
- package/examples/frontend/react/index.html +13 -0
- package/examples/frontend/react/package.json +29 -0
- package/examples/frontend/react/public/vite.svg +1 -0
- package/examples/frontend/react/src/App.css +42 -0
- package/examples/frontend/react/src/App.tsx +37 -0
- package/examples/frontend/react/src/assets/react.svg +1 -0
- package/examples/frontend/react/src/auth.ts +39 -0
- package/examples/frontend/react/src/automerge.ts +16 -0
- package/examples/frontend/react/src/index.css +68 -0
- package/examples/frontend/react/src/main.tsx +10 -0
- package/examples/frontend/react/src/vite-env.d.ts +1 -0
- package/examples/frontend/react/tsconfig.app.json +27 -0
- package/examples/frontend/react/tsconfig.json +11 -0
- package/examples/frontend/react/tsconfig.node.json +13 -0
- package/examples/frontend/react/vite.config.ts +7 -0
- package/examples/frontend/svelte/.vscode/extensions.json +3 -0
- package/examples/frontend/svelte/README.md +47 -0
- package/examples/frontend/svelte/index.html +13 -0
- package/examples/frontend/svelte/package.json +24 -0
- package/examples/frontend/svelte/public/vite.svg +1 -0
- package/examples/frontend/svelte/src/App.svelte +30 -0
- package/examples/frontend/svelte/src/app.css +79 -0
- package/examples/frontend/svelte/src/assets/svelte.svg +1 -0
- package/examples/frontend/svelte/src/auth.ts +33 -0
- package/examples/frontend/svelte/src/main.ts +9 -0
- package/examples/frontend/svelte/src/vite-env.d.ts +2 -0
- package/examples/frontend/svelte/svelte.config.js +7 -0
- package/examples/frontend/svelte/tsconfig.json +21 -0
- package/examples/frontend/svelte/tsconfig.node.json +12 -0
- package/examples/frontend/svelte/vite.config.ts +8 -0
- package/examples/frontend/vanilla/index.html +13 -0
- package/examples/frontend/vanilla/package.json +16 -0
- package/examples/frontend/vanilla/public/vite.svg +1 -0
- package/examples/frontend/vanilla/src/auth.ts +39 -0
- package/examples/frontend/vanilla/src/automerge.ts +16 -0
- package/examples/frontend/vanilla/src/main.ts +23 -0
- package/examples/frontend/vanilla/src/style.css +96 -0
- package/examples/frontend/vanilla/src/vite-env.d.ts +1 -0
- package/examples/frontend/vanilla/tsconfig.json +23 -0
- package/examples/frontend/vanilla/vite.config.ts +8 -0
- package/examples/frontend/vue/.vscode/extensions.json +3 -0
- package/examples/frontend/vue/README.md +33 -0
- package/examples/frontend/vue/env.d.ts +1 -0
- package/examples/frontend/vue/index.html +13 -0
- package/examples/frontend/vue/package.json +29 -0
- package/examples/frontend/vue/public/favicon.ico +0 -0
- package/examples/frontend/vue/src/App.vue +30 -0
- package/examples/frontend/vue/src/assets/base.css +86 -0
- package/examples/frontend/vue/src/assets/logo.svg +1 -0
- package/examples/frontend/vue/src/assets/main.css +35 -0
- package/examples/frontend/vue/src/auth.ts +39 -0
- package/examples/frontend/vue/src/automerge.ts +16 -0
- package/examples/frontend/vue/src/main.ts +6 -0
- package/examples/frontend/vue/tsconfig.app.json +14 -0
- package/examples/frontend/vue/tsconfig.json +11 -0
- package/examples/frontend/vue/tsconfig.node.json +19 -0
- package/examples/frontend/vue/vite.config.ts +18 -0
- package/examples/server/bun/README.md +15 -0
- package/examples/server/bun/bun.lockb +0 -0
- package/examples/server/bun/package.json +17 -0
- package/examples/server/bun/src/authenticate.ts +17 -0
- package/examples/server/bun/src/index.ts +54 -0
- package/examples/server/bun/tsconfig.json +27 -0
- package/examples/server/cloudflare/.editorconfig +12 -0
- package/examples/server/cloudflare/.prettierrc +6 -0
- package/examples/server/cloudflare/package.json +22 -0
- package/examples/server/cloudflare/src/authenticate.ts +17 -0
- package/examples/server/cloudflare/src/index.ts +50 -0
- package/examples/server/cloudflare/test/index.spec.ts +25 -0
- package/examples/server/cloudflare/test/tsconfig.json +8 -0
- package/examples/server/cloudflare/tsconfig.json +105 -0
- package/examples/server/cloudflare/vitest.config.mts +11 -0
- package/examples/server/cloudflare/worker-configuration.d.ts +4 -0
- package/examples/server/cloudflare/wrangler.toml +108 -0
- package/examples/server/deno/deno.lock +79 -0
- package/examples/server/deno/package.json +13 -0
- package/examples/server/deno/src/authenticate.ts +17 -0
- package/examples/server/deno/src/server.ts +51 -0
- package/examples/server/express/package.json +24 -0
- package/examples/server/express/src/app.ts +26 -0
- package/examples/server/express/src/authenticate.ts +51 -0
- package/examples/server/express/tsconfig.json +108 -0
- package/examples/server/nodejs/package.json +20 -0
- package/examples/server/nodejs/src/authenticate.ts +28 -0
- package/examples/server/nodejs/src/server.ts +38 -0
- package/examples/server/nodejs/tsconfig.json +108 -0
- package/package.json +67 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
6
|
+
|
|
7
|
+
"baseUrl": ".",
|
|
8
|
+
"paths": {
|
|
9
|
+
"@/*": ["./src/*"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
|
13
|
+
"exclude": ["src/**/__tests__/*"]
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@tsconfig/node20/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
6
|
+
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"moduleResolution": "Bundler",
|
|
9
|
+
"types": ["node"],
|
|
10
|
+
"noEmit": true
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"vite.config.*",
|
|
14
|
+
"vitest.config.*",
|
|
15
|
+
"cypress.config.*",
|
|
16
|
+
"nightwatch.conf.*",
|
|
17
|
+
"playwright.config.*"
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import wasm from 'vite-plugin-wasm'
|
|
5
|
+
import { defineConfig } from 'vite'
|
|
6
|
+
|
|
7
|
+
// https://vitejs.dev/config/
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
plugins: [
|
|
10
|
+
wasm(),
|
|
11
|
+
vue(),
|
|
12
|
+
],
|
|
13
|
+
resolve: {
|
|
14
|
+
alias: {
|
|
15
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
})
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bun-server",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"module": "index.ts",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "bun src/index.ts"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"typescript": "^5.0.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@feathersdev/auth": "^0.11.0"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/bun": "latest"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createVerifier } from '@feathersdev/auth'
|
|
2
|
+
|
|
3
|
+
const appId = '<your-app-id>'
|
|
4
|
+
const verifier = createVerifier({ appId })
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Verify authentication for a web standard request object.
|
|
8
|
+
* Will throw an error if verification was not successful.
|
|
9
|
+
*
|
|
10
|
+
* @param request The request object
|
|
11
|
+
* @returns The authentication information like `user` and `token`
|
|
12
|
+
*/
|
|
13
|
+
export async function authenticateRequest(request: Request) {
|
|
14
|
+
const header = request.headers.get('Authorization')
|
|
15
|
+
|
|
16
|
+
return verifier.verifyHeader(header!)
|
|
17
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { authenticateRequest } from "./authenticate.ts"
|
|
2
|
+
|
|
3
|
+
// Headers for handling CORS
|
|
4
|
+
const headers = {
|
|
5
|
+
'Content-Type': 'application/json',
|
|
6
|
+
'Access-Control-Allow-Headers': '*',
|
|
7
|
+
'Access-Control-Allow-Methods': 'GET',
|
|
8
|
+
'Access-Control-Allow-Origin': '*',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const server = Bun.serve({
|
|
12
|
+
port: 3030,
|
|
13
|
+
async fetch(request) {
|
|
14
|
+
// Get the path from the request object
|
|
15
|
+
const url = new URL(request.url);
|
|
16
|
+
const path = url.pathname;
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
// Handle CORS preflight request
|
|
20
|
+
if (request.method === 'OPTIONS') {
|
|
21
|
+
return new Response(null, {
|
|
22
|
+
status: 200,
|
|
23
|
+
headers,
|
|
24
|
+
})
|
|
25
|
+
} else if (path === '/message') {
|
|
26
|
+
// Verify the Authorization header and get the user information
|
|
27
|
+
const { user } = await authenticateRequest(request)
|
|
28
|
+
|
|
29
|
+
if (!user) {
|
|
30
|
+
throw new Error('Cloud auth user not found')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const body = {
|
|
34
|
+
message: `Hello ${user.email} from BunJS!`,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return Response.json(body, {
|
|
38
|
+
status: 200,
|
|
39
|
+
headers,
|
|
40
|
+
})
|
|
41
|
+
} else {
|
|
42
|
+
throw new Error(`Not found ${path}`)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
return Response.json({ error: (error as any).message }, {
|
|
47
|
+
status: 400,
|
|
48
|
+
headers,
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
console.log(`BunJS application listening on http://localhost:${server.port}`)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
// Enable latest features
|
|
6
|
+
"lib": ["ESNext", "DOM"],
|
|
7
|
+
"moduleDetection": "force",
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
|
|
10
|
+
// Bundler mode
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"allowJs": true,
|
|
14
|
+
|
|
15
|
+
// Best practices
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
|
|
19
|
+
"noPropertyAccessFromIndexSignature": false,
|
|
20
|
+
// Some stricter flags (disabled by default)
|
|
21
|
+
"noUnusedLocals": false,
|
|
22
|
+
"noUnusedParameters": false,
|
|
23
|
+
"noEmit": true,
|
|
24
|
+
"verbatimModuleSyntax": true,
|
|
25
|
+
"skipLibCheck": true
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cloudflare-server",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"deploy": "wrangler deploy",
|
|
7
|
+
"dev": "wrangler dev --port 3030",
|
|
8
|
+
"start": "wrangler dev --port 3030",
|
|
9
|
+
"test": "vitest",
|
|
10
|
+
"cf-typegen": "wrangler types"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@feathersdev/auth": "^0.11.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@cloudflare/vitest-pool-workers": "^0.5.28",
|
|
17
|
+
"@cloudflare/workers-types": "^4.20241112.0",
|
|
18
|
+
"typescript": "^5.6.3",
|
|
19
|
+
"vitest": "2.1.5",
|
|
20
|
+
"wrangler": "^3.87.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createVerifier } from '@feathersdev/auth'
|
|
2
|
+
|
|
3
|
+
const appId = '<your-app-id>'
|
|
4
|
+
const verifier = createVerifier({ appId })
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Verify authentication for a web standard request object.
|
|
8
|
+
* Will throw an error if verification was not successful.
|
|
9
|
+
*
|
|
10
|
+
* @param request The request object
|
|
11
|
+
* @returns The authentication information like `user` and `token`
|
|
12
|
+
*/
|
|
13
|
+
export async function authenticateRequest(request: Request) {
|
|
14
|
+
const header = request.headers.get('Authorization')
|
|
15
|
+
|
|
16
|
+
return verifier.verifyHeader(header!)
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { authenticateRequest } from './authenticate'
|
|
2
|
+
|
|
3
|
+
// Headers for handling CORS
|
|
4
|
+
const headers = {
|
|
5
|
+
'Content-Type': 'application/json',
|
|
6
|
+
'Access-Control-Allow-Headers': '*',
|
|
7
|
+
'Access-Control-Allow-Methods': 'GET',
|
|
8
|
+
'Access-Control-Allow-Origin': '*',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
async fetch(request, _env, _ctx): Promise<Response> {
|
|
13
|
+
// Get the path from the request object
|
|
14
|
+
const url = new URL(request.url);
|
|
15
|
+
const path = url.pathname;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
// Handle CORS preflight request
|
|
19
|
+
if (request.method === 'OPTIONS') {
|
|
20
|
+
return new Response(null, {
|
|
21
|
+
status: 200,
|
|
22
|
+
headers,
|
|
23
|
+
})
|
|
24
|
+
} else if (path === '/message') {
|
|
25
|
+
const { user } = await authenticateRequest(request)
|
|
26
|
+
|
|
27
|
+
if (!user) {
|
|
28
|
+
throw new Error('Cloud auth user not found')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const body = {
|
|
32
|
+
message: `Hello ${user.email} from Cloudflare Worker!`,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return Response.json(body, {
|
|
36
|
+
status: 200,
|
|
37
|
+
headers,
|
|
38
|
+
})
|
|
39
|
+
} else {
|
|
40
|
+
throw new Error(`Not found ${path}`)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return Response.json({ error: (error as any).message }, {
|
|
45
|
+
status: 400,
|
|
46
|
+
headers,
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
} satisfies ExportedHandler<Env>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// test/index.spec.ts
|
|
2
|
+
import { createExecutionContext, env, SELF, waitOnExecutionContext } from 'cloudflare:test'
|
|
3
|
+
import { describe, expect, it } from 'vitest'
|
|
4
|
+
import worker from '../src/index'
|
|
5
|
+
|
|
6
|
+
// For now, you'll need to do something like this to get a correctly-typed
|
|
7
|
+
// `Request` to pass to `worker.fetch()`.
|
|
8
|
+
const IncomingRequest = Request<unknown, IncomingRequestCfProperties>
|
|
9
|
+
|
|
10
|
+
describe('hello World worker', () => {
|
|
11
|
+
it('responds with Hello World! (unit style)', async () => {
|
|
12
|
+
const request = new IncomingRequest('http://example.com')
|
|
13
|
+
// Create an empty context to pass to `worker.fetch()`.
|
|
14
|
+
const ctx = createExecutionContext()
|
|
15
|
+
const response = await worker.fetch(request, env, ctx)
|
|
16
|
+
// Wait for all `Promise`s passed to `ctx.waitUntil()` to settle before running test assertions
|
|
17
|
+
await waitOnExecutionContext(ctx)
|
|
18
|
+
expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('responds with Hello World! (integration style)', async () => {
|
|
22
|
+
const response = await SELF.fetch('https://example.com')
|
|
23
|
+
expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`)
|
|
24
|
+
})
|
|
25
|
+
})
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Projects */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
+
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
|
9
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
|
10
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
+
|
|
13
|
+
/* Language and Environment */
|
|
14
|
+
"target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
+
"jsx": "react-jsx" /* Specify what JSX code is generated. */,
|
|
16
|
+
"lib": ["es2021"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
|
17
|
+
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
18
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
|
20
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
|
22
|
+
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
|
23
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
+
|
|
26
|
+
/* Modules */
|
|
27
|
+
"module": "es2022" /* Specify what module code is generated. */,
|
|
28
|
+
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
29
|
+
"moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
30
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
31
|
+
"resolveJsonModule": true /* Enable importing .json files */,
|
|
32
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
33
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
34
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
35
|
+
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
|
36
|
+
"types": [
|
|
37
|
+
"@cloudflare/workers-types/2023-07-01"
|
|
38
|
+
] /* Specify type package names to be included without being referenced in a source file. */,
|
|
39
|
+
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
|
40
|
+
|
|
41
|
+
/* JavaScript Support */
|
|
42
|
+
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */,
|
|
43
|
+
"checkJs": false /* Enable error reporting in type-checked JavaScript files. */,
|
|
44
|
+
|
|
45
|
+
/* Type Checking */
|
|
46
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
47
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
|
48
|
+
|
|
49
|
+
/* Emit */
|
|
50
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
51
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
52
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
53
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
54
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
|
55
|
+
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
56
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
57
|
+
"noEmit": true /* Disable emitting files from a compilation. */,
|
|
58
|
+
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
|
|
59
|
+
// "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
|
|
60
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
61
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
62
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
63
|
+
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
|
64
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
65
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
66
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
67
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
68
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
69
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
70
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
71
|
+
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
|
72
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
|
73
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
74
|
+
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
|
75
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
76
|
+
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
77
|
+
|
|
78
|
+
/* Interop Constraints */
|
|
79
|
+
"isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
|
|
80
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
|
81
|
+
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
|
82
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
83
|
+
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
|
84
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
85
|
+
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
|
86
|
+
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
|
87
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
88
|
+
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
|
89
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
|
90
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
91
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
92
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
93
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
94
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
95
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
|
96
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
97
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
98
|
+
|
|
99
|
+
/* Completeness */
|
|
100
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
101
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
|
+
},
|
|
103
|
+
"include": ["worker-configuration.d.ts", "src/**/*.ts"],
|
|
104
|
+
"exclude": ["test"]
|
|
105
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# :schema node_modules/wrangler/config-schema.json
|
|
2
|
+
name = "cloudflare"
|
|
3
|
+
main = "src/index.ts"
|
|
4
|
+
compatibility_date = "2024-07-29"
|
|
5
|
+
compatibility_flags = [ "nodejs_compat" ]
|
|
6
|
+
|
|
7
|
+
# Automatically place your workloads in an optimal location to minimize latency.
|
|
8
|
+
# If you are running back-end logic in a Worker, running it closer to your back-end infrastructure
|
|
9
|
+
# rather than the end user may result in better performance.
|
|
10
|
+
# Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
|
|
11
|
+
# [placement]
|
|
12
|
+
# mode = "smart"
|
|
13
|
+
|
|
14
|
+
# Variable bindings. These are arbitrary, plaintext strings (similar to environment variables)
|
|
15
|
+
# Docs:
|
|
16
|
+
# - https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
|
17
|
+
# Note: Use secrets to store sensitive data.
|
|
18
|
+
# - https://developers.cloudflare.com/workers/configuration/secrets/
|
|
19
|
+
# [vars]
|
|
20
|
+
# MY_VARIABLE = "production_value"
|
|
21
|
+
|
|
22
|
+
# Bind the Workers AI model catalog. Run machine learning models, powered by serverless GPUs, on Cloudflare’s global network
|
|
23
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#workers-ai
|
|
24
|
+
# [ai]
|
|
25
|
+
# binding = "AI"
|
|
26
|
+
|
|
27
|
+
# Bind an Analytics Engine dataset. Use Analytics Engine to write analytics within your Pages Function.
|
|
28
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#analytics-engine-datasets
|
|
29
|
+
# [[analytics_engine_datasets]]
|
|
30
|
+
# binding = "MY_DATASET"
|
|
31
|
+
|
|
32
|
+
# Bind a headless browser instance running on Cloudflare's global network.
|
|
33
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#browser-rendering
|
|
34
|
+
# [browser]
|
|
35
|
+
# binding = "MY_BROWSER"
|
|
36
|
+
|
|
37
|
+
# Bind a D1 database. D1 is Cloudflare’s native serverless SQL database.
|
|
38
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#d1-databases
|
|
39
|
+
# [[d1_databases]]
|
|
40
|
+
# binding = "MY_DB"
|
|
41
|
+
# database_name = "my-database"
|
|
42
|
+
# database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
43
|
+
|
|
44
|
+
# Bind a dispatch namespace. Use Workers for Platforms to deploy serverless functions programmatically on behalf of your customers.
|
|
45
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#dispatch-namespace-bindings-workers-for-platforms
|
|
46
|
+
# [[dispatch_namespaces]]
|
|
47
|
+
# binding = "MY_DISPATCHER"
|
|
48
|
+
# namespace = "my-namespace"
|
|
49
|
+
|
|
50
|
+
# Bind a Durable Object. Durable objects are a scale-to-zero compute primitive based on the actor model.
|
|
51
|
+
# Durable Objects can live for as long as needed. Use these when you need a long-running "server", such as in realtime apps.
|
|
52
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
|
|
53
|
+
# [[durable_objects.bindings]]
|
|
54
|
+
# name = "MY_DURABLE_OBJECT"
|
|
55
|
+
# class_name = "MyDurableObject"
|
|
56
|
+
|
|
57
|
+
# Durable Object migrations.
|
|
58
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#migrations
|
|
59
|
+
# [[migrations]]
|
|
60
|
+
# tag = "v1"
|
|
61
|
+
# new_classes = ["MyDurableObject"]
|
|
62
|
+
|
|
63
|
+
# Bind a Hyperdrive configuration. Use to accelerate access to your existing databases from Cloudflare Workers.
|
|
64
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#hyperdrive
|
|
65
|
+
# [[hyperdrive]]
|
|
66
|
+
# binding = "MY_HYPERDRIVE"
|
|
67
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
68
|
+
|
|
69
|
+
# Bind a KV Namespace. Use KV as persistent storage for small key-value pairs.
|
|
70
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#kv-namespaces
|
|
71
|
+
# [[kv_namespaces]]
|
|
72
|
+
# binding = "MY_KV_NAMESPACE"
|
|
73
|
+
# id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
74
|
+
|
|
75
|
+
# Bind an mTLS certificate. Use to present a client certificate when communicating with another service.
|
|
76
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#mtls-certificates
|
|
77
|
+
# [[mtls_certificates]]
|
|
78
|
+
# binding = "MY_CERTIFICATE"
|
|
79
|
+
# certificate_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
|
|
80
|
+
|
|
81
|
+
# Bind a Queue producer. Use this binding to schedule an arbitrary task that may be processed later by a Queue consumer.
|
|
82
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
83
|
+
# [[queues.producers]]
|
|
84
|
+
# binding = "MY_QUEUE"
|
|
85
|
+
# queue = "my-queue"
|
|
86
|
+
|
|
87
|
+
# Bind a Queue consumer. Queue Consumers can retrieve tasks scheduled by Producers to act on them.
|
|
88
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#queues
|
|
89
|
+
# [[queues.consumers]]
|
|
90
|
+
# queue = "my-queue"
|
|
91
|
+
|
|
92
|
+
# Bind an R2 Bucket. Use R2 to store arbitrarily large blobs of data, such as files.
|
|
93
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#r2-buckets
|
|
94
|
+
# [[r2_buckets]]
|
|
95
|
+
# binding = "MY_BUCKET"
|
|
96
|
+
# bucket_name = "my-bucket"
|
|
97
|
+
|
|
98
|
+
# Bind another Worker service. Use this binding to call another Worker without network overhead.
|
|
99
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
|
100
|
+
# [[services]]
|
|
101
|
+
# binding = "MY_SERVICE"
|
|
102
|
+
# service = "my-service"
|
|
103
|
+
|
|
104
|
+
# Bind a Vectorize index. Use to store and query vector embeddings for semantic search, classification and other vector search use-cases.
|
|
105
|
+
# Docs: https://developers.cloudflare.com/workers/wrangler/configuration/#vectorize-indexes
|
|
106
|
+
# [[vectorize]]
|
|
107
|
+
# binding = "MY_INDEX"
|
|
108
|
+
# index_name = "my-index"
|