convex 1.16.2 → 1.16.3
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 +16 -0
- package/dist/cjs/server/components/index.js.map +2 -2
- package/dist/cjs/server/index.js +2 -1
- package/dist/cjs/server/index.js.map +3 -3
- package/dist/cjs-types/server/components/index.d.ts +2 -2
- package/dist/cjs-types/server/components/index.d.ts.map +1 -1
- package/dist/cjs-types/server/index.d.ts +1 -1
- package/dist/cjs-types/server/index.d.ts.map +1 -1
- package/dist/esm/server/components/index.js.map +2 -2
- package/dist/esm/server/index.js +1 -1
- package/dist/esm/server/index.js.map +2 -2
- package/dist/esm-types/server/components/index.d.ts +2 -2
- package/dist/esm-types/server/components/index.d.ts.map +1 -1
- package/dist/esm-types/server/index.d.ts +1 -1
- package/dist/esm-types/server/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/server/components/index.ts +5 -10
- package/src/server/index.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.16.3
|
|
4
|
+
|
|
5
|
+
- Fix some library typecheck errors introduced in 1.16.1. Workaround for
|
|
6
|
+
previous versions is to add `"skipLibCheck": true` to the tsconfig.json in the
|
|
7
|
+
convex directory.
|
|
8
|
+
|
|
9
|
+
## 1.16.2
|
|
10
|
+
|
|
11
|
+
- Change some language around componets beta.
|
|
12
|
+
|
|
13
|
+
## 1.16.1
|
|
14
|
+
|
|
15
|
+
- Release components, a feature in beta. These codepaths should not be active
|
|
16
|
+
unless a convex directory contains a file named `convex.config.ts`. Components
|
|
17
|
+
aren't documented yet and may change significantly before general release.
|
|
18
|
+
|
|
3
19
|
## 1.16.0
|
|
4
20
|
|
|
5
21
|
- Added support for a new validator, `v.record`. This is a typed key-value
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/server/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { PropertyValidators, convexToJson } from \"../../values/index.js\";\nimport {\n AnyFunctionReference,\n FunctionReference,\n FunctionType,\n} from \"../api.js\";\nimport { getFunctionAddress } from \"../impl/actions_impl.js\";\nimport { performAsyncSyscall } from \"../impl/syscall.js\";\nimport { DefaultFunctionArgs } from \"../registration.js\";\nimport {\n AppDefinitionAnalysis,\n ComponentDefinitionAnalysis,\n ComponentDefinitionType,\n} from \"./definition.js\";\nimport { setReferencePath, toReferencePath } from \"./paths.js\";\n\n/**\n * A serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type FunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs = any,\n ReturnType = any,\n> = string & FunctionReference<Type, \"internal\", Args, ReturnType>;\n\n/**\n * Create a serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport async function createFunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs,\n ReturnType,\n>(\n functionReference: FunctionReference<\n Type,\n \"public\" | \"internal\",\n Args,\n ReturnType\n >,\n): Promise<FunctionHandle<Type, Args, ReturnType>> {\n const address = getFunctionAddress(functionReference);\n return await performAsyncSyscall(\"1.0/createFunctionHandle\", { ...address });\n}\n\ninterface ComponentExports {\n [key: string]: FunctionReference<any, any, any, any> | ComponentExports;\n}\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component definition directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ComponentDefinition<Exports extends ComponentExports = any> = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n\n /**\n * @internal\n */\n __exports: Exports;\n};\n\ntype ComponentDefinitionExports<T extends ComponentDefinition<any>> =\n T[\"__exports\"];\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component-aware convex directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type AppDefinition = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ninterface ExportTree {\n // Tree with serialized `Reference`s as leaves.\n [key: string]: string | ExportTree;\n}\n\ntype CommonDefinitionData = {\n _isRoot: boolean;\n _childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][];\n _exportTree: ExportTree;\n};\n\ntype ComponentDefinitionData = CommonDefinitionData & {\n _args: PropertyValidators;\n _name: string;\n _onInitCallbacks: Record<string, (argsStr: string) => string>;\n};\ntype AppDefinitionData = CommonDefinitionData;\n\n/**\n * Used to refer to an already-installed component.\n */\nclass InstalledComponent<Definition extends ComponentDefinition<any>> {\n /**\n * @internal\n */\n _definition: Definition;\n\n /**\n * @internal\n */\n _name: string;\n\n constructor(definition: Definition, name: string) {\n this._definition = definition;\n this._name = name;\n setReferencePath(this, `_reference/childComponent/${name}`);\n }\n\n get exports(): ComponentDefinitionExports<Definition> {\n return createExports(this._name, []);\n }\n}\n\nfunction createExports(name: string, pathParts: string[]): any {\n const handler: ProxyHandler<any> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createExports(name, newParts);\n } else if (prop === toReferencePath) {\n let reference = `_reference/childComponent/${name}`;\n for (const part of pathParts) {\n reference += `/${part}`;\n }\n return reference;\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nfunction use<Definition extends ComponentDefinition<any>>(\n this: CommonDefinitionData,\n definition: Definition,\n options?: {\n name?: string;\n },\n): InstalledComponent<Definition> {\n // At runtime an imported component will have this shape.\n const importedComponentDefinition =\n definition as unknown as ImportedComponentDefinition;\n if (typeof importedComponentDefinition.componentDefinitionPath !== \"string\") {\n throw new Error(\n \"Component definition does not have the required componentDefinitionPath property. This code only works in Convex runtime.\",\n );\n }\n const name =\n options?.name ||\n // added recently\n importedComponentDefinition.defaultName ||\n // can be removed once backend is out\n importedComponentDefinition.componentDefinitionPath.split(\"/\").pop()!;\n this._childComponents.push([name, importedComponentDefinition, {}]);\n return new InstalledComponent(definition, name);\n}\n\n/**\n * The runtime type of a ComponentDefinition. TypeScript will claim\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ImportedComponentDefinition = {\n componentDefinitionPath: string;\n defaultName: string;\n};\n\nfunction exportAppForAnalysis(\n this: ComponentDefinition<any> & AppDefinitionData,\n): AppDefinitionAnalysis {\n const definitionType = { type: \"app\" as const };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\nfunction serializeExportTree(tree: ExportTree): any {\n const branch: any[] = [];\n for (const [key, child] of Object.entries(tree)) {\n let node;\n if (typeof child === \"string\") {\n node = { type: \"leaf\", leaf: child };\n } else {\n node = serializeExportTree(child);\n }\n branch.push([key, node]);\n }\n return { type: \"branch\", branch };\n}\n\nfunction serializeChildComponents(\n childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][],\n): {\n name: string;\n path: string;\n args: [string, { type: \"value\"; value: string }][] | null;\n}[] {\n return childComponents.map(([name, definition, p]) => {\n let args: [string, { type: \"value\"; value: string }][] | null = null;\n if (p !== null) {\n args = [];\n for (const [name, value] of Object.entries(p)) {\n if (value !== undefined) {\n args.push([\n name,\n { type: \"value\", value: JSON.stringify(convexToJson(value)) },\n ]);\n }\n }\n }\n // we know that components carry this extra information\n const path = definition.componentDefinitionPath;\n if (!path)\n throw new Error(\n \"no .componentPath for component definition \" +\n JSON.stringify(definition, null, 2),\n );\n\n return {\n name: name!,\n path: path!,\n args,\n };\n });\n}\n\nfunction exportComponentForAnalysis(\n this: ComponentDefinition<any> & ComponentDefinitionData,\n): ComponentDefinitionAnalysis {\n const args: [string, { type: \"value\"; value: string }][] = Object.entries(\n this._args,\n ).map(([name, validator]) => [\n name,\n {\n type: \"value\",\n value: JSON.stringify(validator.json),\n },\n ]);\n const definitionType: ComponentDefinitionType = {\n type: \"childComponent\" as const,\n name: this._name,\n args,\n };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n name: this._name,\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\n// This is what is actually contained in a ComponentDefinition.\ntype RuntimeComponentDefinition = Omit<ComponentDefinition<any>, \"__exports\"> &\n ComponentDefinitionData & {\n export: () => ComponentDefinitionAnalysis;\n };\ntype RuntimeAppDefinition = AppDefinition &\n AppDefinitionData & {\n export: () => AppDefinitionAnalysis;\n };\n\n/**\n * Define a component, a piece of a Convex deployment with namespaced resources.\n *\n * The default\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * @param name Name must be alphanumeric plus underscores. Typically these are\n * lowercase with underscores like `\"onboarding_flow_tracker\"`.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineComponent<Exports extends ComponentExports = any>(\n name: string,\n): ComponentDefinition<Exports> {\n const ret: RuntimeComponentDefinition = {\n _isRoot: false,\n _name: name,\n _args: {},\n _childComponents: [],\n _exportTree: {},\n _onInitCallbacks: {},\n\n export: exportComponentForAnalysis,\n use,\n\n // pretend to conform to ComponentDefinition, which temporarily expects __args\n ...({} as { __args: any; __exports: any }),\n };\n return ret as any as ComponentDefinition<Exports>;\n}\n\n/**\n * Attach components, reuseable pieces of a Convex deployment, to this Convex app.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineApp(): AppDefinition {\n const ret: RuntimeAppDefinition = {\n _isRoot: true,\n _childComponents: [],\n _exportTree: {},\n\n export: exportAppForAnalysis,\n use,\n };\n return ret as AppDefinition;\n}\n\ntype AnyInterfaceType = {\n [key: string]: AnyInterfaceType;\n} & AnyFunctionReference;\nexport type AnyComponentReference = Record<string, AnyInterfaceType>;\n\ntype AnyChildComponents = Record<string, AnyComponentReference>;\n\n/**\n * @internal\n */\nexport function currentSystemUdfInComponent(\n componentId: string,\n): AnyComponentReference {\n return {\n [toReferencePath]: `_reference/currentSystemUdfInComponent/${componentId}`,\n };\n}\n\nfunction createChildComponents(\n root: string,\n pathParts: string[],\n): AnyChildComponents {\n const handler: ProxyHandler<object> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createChildComponents(root, newParts);\n } else if (prop === toReferencePath) {\n if (pathParts.length < 1) {\n const found = [root, ...pathParts].join(\".\");\n throw new Error(\n `API path is expected to be of the form \\`${root}.childComponent.functionName\\`. Found: \\`${found}\\``,\n );\n }\n return `_reference/childComponent/` + pathParts.join(\"/\");\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nexport const componentsGeneric = () => createChildComponents(\"components\", []);\n\nexport type AnyComponents = AnyChildComponents;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiD;AAMjD,0BAAmC;AACnC,qBAAoC;AAOpC,mBAAkD;AAkClD,eAAsB,qBAKpB,mBAMiD;AACjD,QAAM,cAAU,wCAAmB,iBAAiB;AACpD,SAAO,UAAM,oCAAoB,4BAA4B,EAAE,GAAG,QAAQ,CAAC;AAC7E;
|
|
4
|
+
"sourcesContent": ["import { PropertyValidators, convexToJson } from \"../../values/index.js\";\nimport {\n AnyFunctionReference,\n FunctionReference,\n FunctionType,\n} from \"../api.js\";\nimport { getFunctionAddress } from \"../impl/actions_impl.js\";\nimport { performAsyncSyscall } from \"../impl/syscall.js\";\nimport { DefaultFunctionArgs } from \"../registration.js\";\nimport {\n AppDefinitionAnalysis,\n ComponentDefinitionAnalysis,\n ComponentDefinitionType,\n} from \"./definition.js\";\nimport { setReferencePath, toReferencePath } from \"./paths.js\";\n\n/**\n * A serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type FunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs = any,\n ReturnType = any,\n> = string & FunctionReference<Type, \"internal\", Args, ReturnType>;\n\n/**\n * Create a serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport async function createFunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs,\n ReturnType,\n>(\n functionReference: FunctionReference<\n Type,\n \"public\" | \"internal\",\n Args,\n ReturnType\n >,\n): Promise<FunctionHandle<Type, Args, ReturnType>> {\n const address = getFunctionAddress(functionReference);\n return await performAsyncSyscall(\"1.0/createFunctionHandle\", { ...address });\n}\n\ninterface ComponentExports {\n [key: string]: FunctionReference<any, any, any, any> | ComponentExports;\n}\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component definition directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ComponentDefinition<_Exports extends ComponentExports = any> = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ntype ComponentDefinitionExports<T> =\n T extends ComponentDefinition<infer Exports> ? Exports : never;\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component-aware convex directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type AppDefinition = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ninterface ExportTree {\n // Tree with serialized `Reference`s as leaves.\n [key: string]: string | ExportTree;\n}\n\ntype CommonDefinitionData = {\n _isRoot: boolean;\n _childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][];\n _exportTree: ExportTree;\n};\n\ntype ComponentDefinitionData = CommonDefinitionData & {\n _args: PropertyValidators;\n _name: string;\n _onInitCallbacks: Record<string, (argsStr: string) => string>;\n};\ntype AppDefinitionData = CommonDefinitionData;\n\n/**\n * Used to refer to an already-installed component.\n */\nclass InstalledComponent<Definition extends ComponentDefinition<any>> {\n /**\n * @internal\n */\n _definition: Definition;\n\n /**\n * @internal\n */\n _name: string;\n\n constructor(definition: Definition, name: string) {\n this._definition = definition;\n this._name = name;\n setReferencePath(this, `_reference/childComponent/${name}`);\n }\n\n get exports(): ComponentDefinitionExports<Definition> {\n return createExports(this._name, []);\n }\n}\n\nfunction createExports(name: string, pathParts: string[]): any {\n const handler: ProxyHandler<any> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createExports(name, newParts);\n } else if (prop === toReferencePath) {\n let reference = `_reference/childComponent/${name}`;\n for (const part of pathParts) {\n reference += `/${part}`;\n }\n return reference;\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nfunction use<Definition extends ComponentDefinition<any>>(\n this: CommonDefinitionData,\n definition: Definition,\n options?: {\n name?: string;\n },\n): InstalledComponent<Definition> {\n // At runtime an imported component will have this shape.\n const importedComponentDefinition =\n definition as unknown as ImportedComponentDefinition;\n if (typeof importedComponentDefinition.componentDefinitionPath !== \"string\") {\n throw new Error(\n \"Component definition does not have the required componentDefinitionPath property. This code only works in Convex runtime.\",\n );\n }\n const name =\n options?.name ||\n // added recently\n importedComponentDefinition.defaultName ||\n // can be removed once backend is out\n importedComponentDefinition.componentDefinitionPath.split(\"/\").pop()!;\n this._childComponents.push([name, importedComponentDefinition, {}]);\n return new InstalledComponent(definition, name);\n}\n\n/**\n * The runtime type of a ComponentDefinition. TypeScript will claim\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ImportedComponentDefinition = {\n componentDefinitionPath: string;\n defaultName: string;\n};\n\nfunction exportAppForAnalysis(\n this: ComponentDefinition<any> & AppDefinitionData,\n): AppDefinitionAnalysis {\n const definitionType = { type: \"app\" as const };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\nfunction serializeExportTree(tree: ExportTree): any {\n const branch: any[] = [];\n for (const [key, child] of Object.entries(tree)) {\n let node;\n if (typeof child === \"string\") {\n node = { type: \"leaf\", leaf: child };\n } else {\n node = serializeExportTree(child);\n }\n branch.push([key, node]);\n }\n return { type: \"branch\", branch };\n}\n\nfunction serializeChildComponents(\n childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][],\n): {\n name: string;\n path: string;\n args: [string, { type: \"value\"; value: string }][] | null;\n}[] {\n return childComponents.map(([name, definition, p]) => {\n let args: [string, { type: \"value\"; value: string }][] | null = null;\n if (p !== null) {\n args = [];\n for (const [name, value] of Object.entries(p)) {\n if (value !== undefined) {\n args.push([\n name,\n { type: \"value\", value: JSON.stringify(convexToJson(value)) },\n ]);\n }\n }\n }\n // we know that components carry this extra information\n const path = definition.componentDefinitionPath;\n if (!path)\n throw new Error(\n \"no .componentPath for component definition \" +\n JSON.stringify(definition, null, 2),\n );\n\n return {\n name: name!,\n path: path!,\n args,\n };\n });\n}\n\nfunction exportComponentForAnalysis(\n this: ComponentDefinition<any> & ComponentDefinitionData,\n): ComponentDefinitionAnalysis {\n const args: [string, { type: \"value\"; value: string }][] = Object.entries(\n this._args,\n ).map(([name, validator]) => [\n name,\n {\n type: \"value\",\n value: JSON.stringify(validator.json),\n },\n ]);\n const definitionType: ComponentDefinitionType = {\n type: \"childComponent\" as const,\n name: this._name,\n args,\n };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n name: this._name,\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\n// This is what is actually contained in a ComponentDefinition.\ntype RuntimeComponentDefinition = ComponentDefinition<any> &\n ComponentDefinitionData & {\n export: () => ComponentDefinitionAnalysis;\n };\ntype RuntimeAppDefinition = AppDefinition &\n AppDefinitionData & {\n export: () => AppDefinitionAnalysis;\n };\n\n/**\n * Define a component, a piece of a Convex deployment with namespaced resources.\n *\n * The default\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * @param name Name must be alphanumeric plus underscores. Typically these are\n * lowercase with underscores like `\"onboarding_flow_tracker\"`.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineComponent<Exports extends ComponentExports = any>(\n name: string,\n): ComponentDefinition<Exports> {\n const ret: RuntimeComponentDefinition = {\n _isRoot: false,\n _name: name,\n _args: {},\n _childComponents: [],\n _exportTree: {},\n _onInitCallbacks: {},\n\n export: exportComponentForAnalysis,\n use,\n\n // pretend to conform to ComponentDefinition, which temporarily expects __args\n ...({} as { __args: any }),\n };\n return ret as any as ComponentDefinition<Exports>;\n}\n\n/**\n * Attach components, reuseable pieces of a Convex deployment, to this Convex app.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineApp(): AppDefinition {\n const ret: RuntimeAppDefinition = {\n _isRoot: true,\n _childComponents: [],\n _exportTree: {},\n\n export: exportAppForAnalysis,\n use,\n };\n return ret as AppDefinition;\n}\n\ntype AnyInterfaceType = {\n [key: string]: AnyInterfaceType;\n} & AnyFunctionReference;\nexport type AnyComponentReference = Record<string, AnyInterfaceType>;\n\ntype AnyChildComponents = Record<string, AnyComponentReference>;\n\n/**\n * @internal\n */\nexport function currentSystemUdfInComponent(\n componentId: string,\n): AnyComponentReference {\n return {\n [toReferencePath]: `_reference/currentSystemUdfInComponent/${componentId}`,\n };\n}\n\nfunction createChildComponents(\n root: string,\n pathParts: string[],\n): AnyChildComponents {\n const handler: ProxyHandler<object> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createChildComponents(root, newParts);\n } else if (prop === toReferencePath) {\n if (pathParts.length < 1) {\n const found = [root, ...pathParts].join(\".\");\n throw new Error(\n `API path is expected to be of the form \\`${root}.childComponent.functionName\\`. Found: \\`${found}\\``,\n );\n }\n return `_reference/childComponent/` + pathParts.join(\"/\");\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nexport const componentsGeneric = () => createChildComponents(\"components\", []);\n\nexport type AnyComponents = AnyChildComponents;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiD;AAMjD,0BAAmC;AACnC,qBAAoC;AAOpC,mBAAkD;AAkClD,eAAsB,qBAKpB,mBAMiD;AACjD,QAAM,cAAU,wCAAmB,iBAAiB;AACpD,SAAO,UAAM,oCAAoB,4BAA4B,EAAE,GAAG,QAAQ,CAAC;AAC7E;AAkFA,MAAM,mBAAgE;AAAA,EAWpE,YAAY,YAAwB,MAAc;AAPlD;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAGE,SAAK,cAAc;AACnB,SAAK,QAAQ;AACb,uCAAiB,MAAM,6BAA6B,IAAI,EAAE;AAAA,EAC5D;AAAA,EAEA,IAAI,UAAkD;AACpD,WAAO,cAAc,KAAK,OAAO,CAAC,CAAC;AAAA,EACrC;AACF;AAEA,SAAS,cAAc,MAAc,WAA0B;AAC7D,QAAM,UAA6B;AAAA,IACjC,IAAI,GAAG,MAAuB;AAC5B,UAAI,OAAO,SAAS,UAAU;AAC5B,cAAM,WAAW,CAAC,GAAG,WAAW,IAAI;AACpC,eAAO,cAAc,MAAM,QAAQ;AAAA,MACrC,WAAW,SAAS,8BAAiB;AACnC,YAAI,YAAY,6BAA6B,IAA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QAAM,MAA4B;AAAA,IAChC,SAAS;AAAA,IACT,kBAAkB,CAAC;AAAA,IACnB,aAAa,CAAC;AAAA,IAEd,QAAQ;AAAA,IACR;AAAA,EACF;AACA,SAAO;AACT;AAYO,SAAS,4BACd,aACuB;AACvB,SAAO;AAAA,IACL,CAAC,4BAAe,GAAG,0CAA0C,WAAW;AAAA,EAC1E;AACF;AAEA,SAAS,sBACP,MACA,WACoB;AACpB,QAAM,UAAgC;AAAA,IACpC,IAAI,GAAG,MAAuB;AAC5B,UAAI,OAAO,SAAS,UAAU;AAC5B,cAAM,WAAW,CAAC,GAAG,WAAW,IAAI;AACpC,eAAO,sBAAsB,MAAM,QAAQ;AAAA,MAC7C,WAAW,SAAS,8BAAiB;AACnC,YAAI,UAAU,SAAS,GAAG;AACxB,gBAAM,QAAQ,CAAC,MAAM,GAAG,SAAS,EAAE,KAAK,GAAG;AAC3C,gBAAM,IAAI;AAAA,YACR,4CAA4C,IAAI,4CAA4C,KAAK;AAAA,UACnG;AAAA,QACF;AACA,eAAO,+BAA+B,UAAU,KAAK,GAAG;AAAA,MAC1D,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO,IAAI,MAAM,CAAC,GAAG,OAAO;AAC9B;AAEO,MAAM,oBAAoB,MAAM,sBAAsB,cAAc,CAAC,CAAC;",
|
|
6
6
|
"names": ["name"]
|
|
7
7
|
}
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -26,7 +26,7 @@ __export(server_exports, {
|
|
|
26
26
|
componentsGeneric: () => import_components.componentsGeneric,
|
|
27
27
|
createFunctionHandle: () => import_components.createFunctionHandle,
|
|
28
28
|
cronJobs: () => import_cron.cronJobs,
|
|
29
|
-
currentSystemUdfInComponent: () =>
|
|
29
|
+
currentSystemUdfInComponent: () => import_components2.currentSystemUdfInComponent,
|
|
30
30
|
defineApp: () => import_components.defineApp,
|
|
31
31
|
defineComponent: () => import_components.defineComponent,
|
|
32
32
|
defineSchema: () => import_schema.defineSchema,
|
|
@@ -52,5 +52,6 @@ var import_cron = require("./cron.js");
|
|
|
52
52
|
var import_router = require("./router.js");
|
|
53
53
|
var import_api = require("./api.js");
|
|
54
54
|
var import_components = require("./components/index.js");
|
|
55
|
+
var import_components2 = require("./components/index.js");
|
|
55
56
|
var import_schema = require("./schema.js");
|
|
56
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Utilities for implementing server-side Convex query and mutation functions.\n *\n * ## Usage\n *\n * ### Code Generation\n *\n * This module is typically used alongside generated server code.\n *\n * To generate the server code, run `npx convex dev` in your Convex project.\n * This will create a `convex/_generated/server.js` file with the following\n * functions, typed for your schema:\n * - [query](https://docs.convex.dev/generated-api/server#query)\n * - [mutation](https://docs.convex.dev/generated-api/server#mutation)\n *\n * If you aren't using TypeScript and code generation, you can use these untyped\n * functions instead:\n * - {@link queryGeneric}\n * - {@link mutationGeneric}\n *\n * ### Example\n *\n * Convex functions are defined by using either the `query` or\n * `mutation` wrappers.\n *\n * Queries receive a `db` that implements the {@link GenericDatabaseReader} interface.\n *\n * ```js\n * import { query } from \"./_generated/server\";\n *\n * export default query(async ({ db }, { arg1, arg2 }) => {\n * // Your (read-only) code here!\n * });\n * ```\n *\n * If your function needs to write to the database, such as inserting, updating,\n * or deleting documents, use `mutation` instead which provides a `db` that\n * implements the {@link GenericDatabaseWriter} interface.\n *\n * ```js\n * import { mutation } from \"./_generated/server\";\n *\n * export default mutation(async ({ db }, { arg1, arg2 }) => {\n * // Your mutation code here!\n * });\n * ```\n * @module\n */\n\nexport type {\n Auth,\n UserIdentity,\n UserIdentityAttributes,\n} from \"./authentication.js\";\nexport * from \"./database.js\";\nexport type {\n GenericDocument,\n GenericFieldPaths,\n GenericIndexFields,\n GenericTableIndexes,\n GenericSearchIndexConfig,\n GenericTableSearchIndexes,\n GenericVectorIndexConfig,\n GenericTableVectorIndexes,\n FieldTypeFromFieldPath,\n GenericTableInfo,\n DocumentByInfo,\n FieldPaths,\n Indexes,\n IndexNames,\n NamedIndex,\n SearchIndexes,\n SearchIndexNames,\n NamedSearchIndex,\n VectorIndexes,\n VectorIndexNames,\n NamedVectorIndex,\n GenericDataModel,\n AnyDataModel,\n TableNamesInDataModel,\n NamedTableInfo,\n DocumentByName,\n} from \"./data_model.js\";\n\nexport type {\n Expression,\n ExpressionOrValue,\n FilterBuilder,\n} from \"./filter_builder.js\";\nexport {\n actionGeneric,\n httpActionGeneric,\n mutationGeneric,\n queryGeneric,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n} from \"./impl/registration_impl.js\";\nexport type { IndexRange, IndexRangeBuilder } from \"./index_range_builder.js\";\nexport * from \"./pagination.js\";\nexport type { OrderedQuery, Query, QueryInitializer } from \"./query.js\";\nexport type {\n ArgsArray,\n DefaultFunctionArgs,\n FunctionVisibility,\n ActionBuilder,\n MutationBuilder,\n MutationBuilderWithTable,\n QueryBuilder,\n QueryBuilderWithTable,\n HttpActionBuilder,\n GenericActionCtx,\n GenericMutationCtx,\n GenericMutationCtxWithTable,\n GenericQueryCtx,\n GenericQueryCtxWithTable,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n PublicHttpAction,\n UnvalidatedFunction,\n ValidatedFunction,\n ReturnValueForOptionalValidator,\n ArgsArrayForOptionalValidator,\n ArgsArrayToObject,\n DefaultArgsForOptionalValidator,\n} from \"./registration.js\";\nexport * from \"./search_filter_builder.js\";\nexport * from \"./storage.js\";\nexport type { Scheduler, SchedulableFunctionReference } from \"./scheduler.js\";\nexport { cronJobs } from \"./cron.js\";\nexport type { CronJob, Crons } from \"./cron.js\";\nexport type {\n SystemFields,\n IdField,\n WithoutSystemFields,\n WithOptionalSystemFields,\n SystemIndexes,\n IndexTiebreakerField,\n} from \"./system_fields.js\";\nexport { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from \"./router.js\";\nexport type {\n RoutableMethod,\n RouteSpec,\n RouteSpecWithPath,\n RouteSpecWithPathPrefix,\n} from \"./router.js\";\nexport {\n anyApi,\n getFunctionName,\n makeFunctionReference,\n filterApi,\n} from \"./api.js\";\nexport type {\n ApiFromModules,\n AnyApi,\n FilterApi,\n FunctionType,\n FunctionReference,\n FunctionArgs,\n OptionalRestArgs,\n PartialApi,\n ArgsAndOptions,\n FunctionReturnType,\n} from \"./api.js\";\nexport {\n defineApp,\n defineComponent,\n componentsGeneric,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDA,2BAAc,0BAtDd;AAyFA,+BAQO;AAEP,2BAAc,4BAnGd;AA+HA,2BAAc,uCA/Hd;AAgIA,2BAAc,yBAhId;AAkIA,kBAAyB;AAUzB,oBAA8D;AAO9D,iBAKO;AAaP,
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/**\n * Utilities for implementing server-side Convex query and mutation functions.\n *\n * ## Usage\n *\n * ### Code Generation\n *\n * This module is typically used alongside generated server code.\n *\n * To generate the server code, run `npx convex dev` in your Convex project.\n * This will create a `convex/_generated/server.js` file with the following\n * functions, typed for your schema:\n * - [query](https://docs.convex.dev/generated-api/server#query)\n * - [mutation](https://docs.convex.dev/generated-api/server#mutation)\n *\n * If you aren't using TypeScript and code generation, you can use these untyped\n * functions instead:\n * - {@link queryGeneric}\n * - {@link mutationGeneric}\n *\n * ### Example\n *\n * Convex functions are defined by using either the `query` or\n * `mutation` wrappers.\n *\n * Queries receive a `db` that implements the {@link GenericDatabaseReader} interface.\n *\n * ```js\n * import { query } from \"./_generated/server\";\n *\n * export default query(async ({ db }, { arg1, arg2 }) => {\n * // Your (read-only) code here!\n * });\n * ```\n *\n * If your function needs to write to the database, such as inserting, updating,\n * or deleting documents, use `mutation` instead which provides a `db` that\n * implements the {@link GenericDatabaseWriter} interface.\n *\n * ```js\n * import { mutation } from \"./_generated/server\";\n *\n * export default mutation(async ({ db }, { arg1, arg2 }) => {\n * // Your mutation code here!\n * });\n * ```\n * @module\n */\n\nexport type {\n Auth,\n UserIdentity,\n UserIdentityAttributes,\n} from \"./authentication.js\";\nexport * from \"./database.js\";\nexport type {\n GenericDocument,\n GenericFieldPaths,\n GenericIndexFields,\n GenericTableIndexes,\n GenericSearchIndexConfig,\n GenericTableSearchIndexes,\n GenericVectorIndexConfig,\n GenericTableVectorIndexes,\n FieldTypeFromFieldPath,\n GenericTableInfo,\n DocumentByInfo,\n FieldPaths,\n Indexes,\n IndexNames,\n NamedIndex,\n SearchIndexes,\n SearchIndexNames,\n NamedSearchIndex,\n VectorIndexes,\n VectorIndexNames,\n NamedVectorIndex,\n GenericDataModel,\n AnyDataModel,\n TableNamesInDataModel,\n NamedTableInfo,\n DocumentByName,\n} from \"./data_model.js\";\n\nexport type {\n Expression,\n ExpressionOrValue,\n FilterBuilder,\n} from \"./filter_builder.js\";\nexport {\n actionGeneric,\n httpActionGeneric,\n mutationGeneric,\n queryGeneric,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n} from \"./impl/registration_impl.js\";\nexport type { IndexRange, IndexRangeBuilder } from \"./index_range_builder.js\";\nexport * from \"./pagination.js\";\nexport type { OrderedQuery, Query, QueryInitializer } from \"./query.js\";\nexport type {\n ArgsArray,\n DefaultFunctionArgs,\n FunctionVisibility,\n ActionBuilder,\n MutationBuilder,\n MutationBuilderWithTable,\n QueryBuilder,\n QueryBuilderWithTable,\n HttpActionBuilder,\n GenericActionCtx,\n GenericMutationCtx,\n GenericMutationCtxWithTable,\n GenericQueryCtx,\n GenericQueryCtxWithTable,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n PublicHttpAction,\n UnvalidatedFunction,\n ValidatedFunction,\n ReturnValueForOptionalValidator,\n ArgsArrayForOptionalValidator,\n ArgsArrayToObject,\n DefaultArgsForOptionalValidator,\n} from \"./registration.js\";\nexport * from \"./search_filter_builder.js\";\nexport * from \"./storage.js\";\nexport type { Scheduler, SchedulableFunctionReference } from \"./scheduler.js\";\nexport { cronJobs } from \"./cron.js\";\nexport type { CronJob, Crons } from \"./cron.js\";\nexport type {\n SystemFields,\n IdField,\n WithoutSystemFields,\n WithOptionalSystemFields,\n SystemIndexes,\n IndexTiebreakerField,\n} from \"./system_fields.js\";\nexport { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from \"./router.js\";\nexport type {\n RoutableMethod,\n RouteSpec,\n RouteSpecWithPath,\n RouteSpecWithPathPrefix,\n} from \"./router.js\";\nexport {\n anyApi,\n getFunctionName,\n makeFunctionReference,\n filterApi,\n} from \"./api.js\";\nexport type {\n ApiFromModules,\n AnyApi,\n FilterApi,\n FunctionType,\n FunctionReference,\n FunctionArgs,\n OptionalRestArgs,\n PartialApi,\n ArgsAndOptions,\n FunctionReturnType,\n} from \"./api.js\";\nexport {\n defineApp,\n defineComponent,\n componentsGeneric,\n createFunctionHandle,\n} from \"./components/index.js\";\n/**\n * @internal\n */\nexport { currentSystemUdfInComponent } from \"./components/index.js\";\nexport type {\n ComponentDefinition,\n AnyComponents,\n FunctionHandle,\n} from \"./components/index.js\";\n\n/**\n * @internal\n */\nexport type { Index, SearchIndex, VectorIndex } from \"./schema.js\";\n\nexport type {\n SearchIndexConfig,\n VectorIndexConfig,\n TableDefinition,\n SchemaDefinition,\n DefineSchemaOptions,\n GenericSchema,\n DataModelFromSchemaDefinition,\n SystemDataModel,\n SystemTableNames,\n} from \"./schema.js\";\nexport { defineTable, defineSchema } from \"./schema.js\";\n\nexport type {\n VectorSearch,\n VectorSearchQuery,\n VectorFilterBuilder,\n FilterExpression,\n} from \"./vector_search.js\";\n\n/**\n * @public\n */\nexport type { BetterOmit, Expand } from \"../type_utils.js\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDA,2BAAc,0BAtDd;AAyFA,+BAQO;AAEP,2BAAc,4BAnGd;AA+HA,2BAAc,uCA/Hd;AAgIA,2BAAc,yBAhId;AAkIA,kBAAyB;AAUzB,oBAA8D;AAO9D,iBAKO;AAaP,wBAKO;AAIP,IAAAA,qBAA4C;AAuB5C,oBAA0C;",
|
|
6
|
+
"names": ["import_components"]
|
|
7
7
|
}
|
|
@@ -38,7 +38,7 @@ interface ComponentExports {
|
|
|
38
38
|
* This is a feature of components, which are in beta.
|
|
39
39
|
* This API is unstable and may change in subsequent releases.
|
|
40
40
|
*/
|
|
41
|
-
export type ComponentDefinition<
|
|
41
|
+
export type ComponentDefinition<_Exports extends ComponentExports = any> = {
|
|
42
42
|
/**
|
|
43
43
|
* Install a component with the given definition in this component definition.
|
|
44
44
|
*
|
|
@@ -51,7 +51,7 @@ export type ComponentDefinition<Exports extends ComponentExports = any> = {
|
|
|
51
51
|
name?: string;
|
|
52
52
|
}): InstalledComponent<Definition>;
|
|
53
53
|
};
|
|
54
|
-
type ComponentDefinitionExports<T extends ComponentDefinition<
|
|
54
|
+
type ComponentDefinitionExports<T> = T extends ComponentDefinition<infer Exports> ? Exports : never;
|
|
55
55
|
/**
|
|
56
56
|
* An object of this type should be the default export of a
|
|
57
57
|
* convex.config.ts file in a component-aware convex directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACb,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,mBAAmB,EAAE,M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QG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,uBAAuB,EAAE,MAAM,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA0GF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAS,gBAAgB,GAAG,GAAG,EACpE,IAAI,EAAE,MAAM,GACX,mBAAmB,CAAC,OAAO,CAAC,CAgB9B;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,aAAa,CAUzC;AAED,KAAK,gBAAgB,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACjC,GAAG,oBAAoB,CAAC;AACzB,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAErE,KAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAsChE,eAAO,MAAM,iBAAiB,0BAAgD,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC"}
|
|
@@ -65,7 +65,7 @@ export { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from "./router.js";
|
|
|
65
65
|
export type { RoutableMethod, RouteSpec, RouteSpecWithPath, RouteSpecWithPathPrefix, } from "./router.js";
|
|
66
66
|
export { anyApi, getFunctionName, makeFunctionReference, filterApi, } from "./api.js";
|
|
67
67
|
export type { ApiFromModules, AnyApi, FilterApi, FunctionType, FunctionReference, FunctionArgs, OptionalRestArgs, PartialApi, ArgsAndOptions, FunctionReturnType, } from "./api.js";
|
|
68
|
-
export { defineApp, defineComponent, componentsGeneric,
|
|
68
|
+
export { defineApp, defineComponent, componentsGeneric, createFunctionHandle, } from "./components/index.js";
|
|
69
69
|
export type { ComponentDefinition, AnyComponents, FunctionHandle, } from "./components/index.js";
|
|
70
70
|
export type { SearchIndexConfig, VectorIndexConfig, TableDefinition, SchemaDefinition, DefineSchemaOptions, GenericSchema, DataModelFromSchemaDefinition, SystemDataModel, SystemTableNames, } from "./schema.js";
|
|
71
71
|
export { defineTable, defineSchema } from "./schema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,cAAc,iBAAiB,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACxE,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,+BAA+B,EAC/B,6BAA6B,EAC7B,iBAAiB,EACjB,+BAA+B,GAChC,MAAM,mBAAmB,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,YAAY,EAAE,SAAS,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,sBAAsB,GACvB,MAAM,qB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7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/server/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { PropertyValidators, convexToJson } from \"../../values/index.js\";\nimport {\n AnyFunctionReference,\n FunctionReference,\n FunctionType,\n} from \"../api.js\";\nimport { getFunctionAddress } from \"../impl/actions_impl.js\";\nimport { performAsyncSyscall } from \"../impl/syscall.js\";\nimport { DefaultFunctionArgs } from \"../registration.js\";\nimport {\n AppDefinitionAnalysis,\n ComponentDefinitionAnalysis,\n ComponentDefinitionType,\n} from \"./definition.js\";\nimport { setReferencePath, toReferencePath } from \"./paths.js\";\n\n/**\n * A serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type FunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs = any,\n ReturnType = any,\n> = string & FunctionReference<Type, \"internal\", Args, ReturnType>;\n\n/**\n * Create a serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport async function createFunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs,\n ReturnType,\n>(\n functionReference: FunctionReference<\n Type,\n \"public\" | \"internal\",\n Args,\n ReturnType\n >,\n): Promise<FunctionHandle<Type, Args, ReturnType>> {\n const address = getFunctionAddress(functionReference);\n return await performAsyncSyscall(\"1.0/createFunctionHandle\", { ...address });\n}\n\ninterface ComponentExports {\n [key: string]: FunctionReference<any, any, any, any> | ComponentExports;\n}\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component definition directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ComponentDefinition<Exports extends ComponentExports = any> = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n\n /**\n * @internal\n */\n __exports: Exports;\n};\n\ntype ComponentDefinitionExports<T extends ComponentDefinition<any>> =\n T[\"__exports\"];\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component-aware convex directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type AppDefinition = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ninterface ExportTree {\n // Tree with serialized `Reference`s as leaves.\n [key: string]: string | ExportTree;\n}\n\ntype CommonDefinitionData = {\n _isRoot: boolean;\n _childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][];\n _exportTree: ExportTree;\n};\n\ntype ComponentDefinitionData = CommonDefinitionData & {\n _args: PropertyValidators;\n _name: string;\n _onInitCallbacks: Record<string, (argsStr: string) => string>;\n};\ntype AppDefinitionData = CommonDefinitionData;\n\n/**\n * Used to refer to an already-installed component.\n */\nclass InstalledComponent<Definition extends ComponentDefinition<any>> {\n /**\n * @internal\n */\n _definition: Definition;\n\n /**\n * @internal\n */\n _name: string;\n\n constructor(definition: Definition, name: string) {\n this._definition = definition;\n this._name = name;\n setReferencePath(this, `_reference/childComponent/${name}`);\n }\n\n get exports(): ComponentDefinitionExports<Definition> {\n return createExports(this._name, []);\n }\n}\n\nfunction createExports(name: string, pathParts: string[]): any {\n const handler: ProxyHandler<any> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createExports(name, newParts);\n } else if (prop === toReferencePath) {\n let reference = `_reference/childComponent/${name}`;\n for (const part of pathParts) {\n reference += `/${part}`;\n }\n return reference;\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nfunction use<Definition extends ComponentDefinition<any>>(\n this: CommonDefinitionData,\n definition: Definition,\n options?: {\n name?: string;\n },\n): InstalledComponent<Definition> {\n // At runtime an imported component will have this shape.\n const importedComponentDefinition =\n definition as unknown as ImportedComponentDefinition;\n if (typeof importedComponentDefinition.componentDefinitionPath !== \"string\") {\n throw new Error(\n \"Component definition does not have the required componentDefinitionPath property. This code only works in Convex runtime.\",\n );\n }\n const name =\n options?.name ||\n // added recently\n importedComponentDefinition.defaultName ||\n // can be removed once backend is out\n importedComponentDefinition.componentDefinitionPath.split(\"/\").pop()!;\n this._childComponents.push([name, importedComponentDefinition, {}]);\n return new InstalledComponent(definition, name);\n}\n\n/**\n * The runtime type of a ComponentDefinition. TypeScript will claim\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ImportedComponentDefinition = {\n componentDefinitionPath: string;\n defaultName: string;\n};\n\nfunction exportAppForAnalysis(\n this: ComponentDefinition<any> & AppDefinitionData,\n): AppDefinitionAnalysis {\n const definitionType = { type: \"app\" as const };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\nfunction serializeExportTree(tree: ExportTree): any {\n const branch: any[] = [];\n for (const [key, child] of Object.entries(tree)) {\n let node;\n if (typeof child === \"string\") {\n node = { type: \"leaf\", leaf: child };\n } else {\n node = serializeExportTree(child);\n }\n branch.push([key, node]);\n }\n return { type: \"branch\", branch };\n}\n\nfunction serializeChildComponents(\n childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][],\n): {\n name: string;\n path: string;\n args: [string, { type: \"value\"; value: string }][] | null;\n}[] {\n return childComponents.map(([name, definition, p]) => {\n let args: [string, { type: \"value\"; value: string }][] | null = null;\n if (p !== null) {\n args = [];\n for (const [name, value] of Object.entries(p)) {\n if (value !== undefined) {\n args.push([\n name,\n { type: \"value\", value: JSON.stringify(convexToJson(value)) },\n ]);\n }\n }\n }\n // we know that components carry this extra information\n const path = definition.componentDefinitionPath;\n if (!path)\n throw new Error(\n \"no .componentPath for component definition \" +\n JSON.stringify(definition, null, 2),\n );\n\n return {\n name: name!,\n path: path!,\n args,\n };\n });\n}\n\nfunction exportComponentForAnalysis(\n this: ComponentDefinition<any> & ComponentDefinitionData,\n): ComponentDefinitionAnalysis {\n const args: [string, { type: \"value\"; value: string }][] = Object.entries(\n this._args,\n ).map(([name, validator]) => [\n name,\n {\n type: \"value\",\n value: JSON.stringify(validator.json),\n },\n ]);\n const definitionType: ComponentDefinitionType = {\n type: \"childComponent\" as const,\n name: this._name,\n args,\n };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n name: this._name,\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\n// This is what is actually contained in a ComponentDefinition.\ntype RuntimeComponentDefinition = Omit<ComponentDefinition<any>, \"__exports\"> &\n ComponentDefinitionData & {\n export: () => ComponentDefinitionAnalysis;\n };\ntype RuntimeAppDefinition = AppDefinition &\n AppDefinitionData & {\n export: () => AppDefinitionAnalysis;\n };\n\n/**\n * Define a component, a piece of a Convex deployment with namespaced resources.\n *\n * The default\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * @param name Name must be alphanumeric plus underscores. Typically these are\n * lowercase with underscores like `\"onboarding_flow_tracker\"`.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineComponent<Exports extends ComponentExports = any>(\n name: string,\n): ComponentDefinition<Exports> {\n const ret: RuntimeComponentDefinition = {\n _isRoot: false,\n _name: name,\n _args: {},\n _childComponents: [],\n _exportTree: {},\n _onInitCallbacks: {},\n\n export: exportComponentForAnalysis,\n use,\n\n // pretend to conform to ComponentDefinition, which temporarily expects __args\n ...({} as { __args: any; __exports: any }),\n };\n return ret as any as ComponentDefinition<Exports>;\n}\n\n/**\n * Attach components, reuseable pieces of a Convex deployment, to this Convex app.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineApp(): AppDefinition {\n const ret: RuntimeAppDefinition = {\n _isRoot: true,\n _childComponents: [],\n _exportTree: {},\n\n export: exportAppForAnalysis,\n use,\n };\n return ret as AppDefinition;\n}\n\ntype AnyInterfaceType = {\n [key: string]: AnyInterfaceType;\n} & AnyFunctionReference;\nexport type AnyComponentReference = Record<string, AnyInterfaceType>;\n\ntype AnyChildComponents = Record<string, AnyComponentReference>;\n\n/**\n * @internal\n */\nexport function currentSystemUdfInComponent(\n componentId: string,\n): AnyComponentReference {\n return {\n [toReferencePath]: `_reference/currentSystemUdfInComponent/${componentId}`,\n };\n}\n\nfunction createChildComponents(\n root: string,\n pathParts: string[],\n): AnyChildComponents {\n const handler: ProxyHandler<object> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createChildComponents(root, newParts);\n } else if (prop === toReferencePath) {\n if (pathParts.length < 1) {\n const found = [root, ...pathParts].join(\".\");\n throw new Error(\n `API path is expected to be of the form \\`${root}.childComponent.functionName\\`. Found: \\`${found}\\``,\n );\n }\n return `_reference/childComponent/` + pathParts.join(\"/\");\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nexport const componentsGeneric = () => createChildComponents(\"components\", []);\n\nexport type AnyComponents = AnyChildComponents;\n"],
|
|
5
|
-
"mappings": ";;;;AAAA,SAA6B,oBAAoB;AAMjD,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AAOpC,SAAS,kBAAkB,uBAAuB;AAkClD,sBAAsB,qBAKpB,mBAMiD;AACjD,QAAM,UAAU,mBAAmB,iBAAiB;AACpD,SAAO,MAAM,oBAAoB,4BAA4B,EAAE,GAAG,QAAQ,CAAC;AAC7E;
|
|
4
|
+
"sourcesContent": ["import { PropertyValidators, convexToJson } from \"../../values/index.js\";\nimport {\n AnyFunctionReference,\n FunctionReference,\n FunctionType,\n} from \"../api.js\";\nimport { getFunctionAddress } from \"../impl/actions_impl.js\";\nimport { performAsyncSyscall } from \"../impl/syscall.js\";\nimport { DefaultFunctionArgs } from \"../registration.js\";\nimport {\n AppDefinitionAnalysis,\n ComponentDefinitionAnalysis,\n ComponentDefinitionType,\n} from \"./definition.js\";\nimport { setReferencePath, toReferencePath } from \"./paths.js\";\n\n/**\n * A serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type FunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs = any,\n ReturnType = any,\n> = string & FunctionReference<Type, \"internal\", Args, ReturnType>;\n\n/**\n * Create a serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport async function createFunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs,\n ReturnType,\n>(\n functionReference: FunctionReference<\n Type,\n \"public\" | \"internal\",\n Args,\n ReturnType\n >,\n): Promise<FunctionHandle<Type, Args, ReturnType>> {\n const address = getFunctionAddress(functionReference);\n return await performAsyncSyscall(\"1.0/createFunctionHandle\", { ...address });\n}\n\ninterface ComponentExports {\n [key: string]: FunctionReference<any, any, any, any> | ComponentExports;\n}\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component definition directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ComponentDefinition<_Exports extends ComponentExports = any> = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ntype ComponentDefinitionExports<T> =\n T extends ComponentDefinition<infer Exports> ? Exports : never;\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component-aware convex directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type AppDefinition = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ninterface ExportTree {\n // Tree with serialized `Reference`s as leaves.\n [key: string]: string | ExportTree;\n}\n\ntype CommonDefinitionData = {\n _isRoot: boolean;\n _childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][];\n _exportTree: ExportTree;\n};\n\ntype ComponentDefinitionData = CommonDefinitionData & {\n _args: PropertyValidators;\n _name: string;\n _onInitCallbacks: Record<string, (argsStr: string) => string>;\n};\ntype AppDefinitionData = CommonDefinitionData;\n\n/**\n * Used to refer to an already-installed component.\n */\nclass InstalledComponent<Definition extends ComponentDefinition<any>> {\n /**\n * @internal\n */\n _definition: Definition;\n\n /**\n * @internal\n */\n _name: string;\n\n constructor(definition: Definition, name: string) {\n this._definition = definition;\n this._name = name;\n setReferencePath(this, `_reference/childComponent/${name}`);\n }\n\n get exports(): ComponentDefinitionExports<Definition> {\n return createExports(this._name, []);\n }\n}\n\nfunction createExports(name: string, pathParts: string[]): any {\n const handler: ProxyHandler<any> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createExports(name, newParts);\n } else if (prop === toReferencePath) {\n let reference = `_reference/childComponent/${name}`;\n for (const part of pathParts) {\n reference += `/${part}`;\n }\n return reference;\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nfunction use<Definition extends ComponentDefinition<any>>(\n this: CommonDefinitionData,\n definition: Definition,\n options?: {\n name?: string;\n },\n): InstalledComponent<Definition> {\n // At runtime an imported component will have this shape.\n const importedComponentDefinition =\n definition as unknown as ImportedComponentDefinition;\n if (typeof importedComponentDefinition.componentDefinitionPath !== \"string\") {\n throw new Error(\n \"Component definition does not have the required componentDefinitionPath property. This code only works in Convex runtime.\",\n );\n }\n const name =\n options?.name ||\n // added recently\n importedComponentDefinition.defaultName ||\n // can be removed once backend is out\n importedComponentDefinition.componentDefinitionPath.split(\"/\").pop()!;\n this._childComponents.push([name, importedComponentDefinition, {}]);\n return new InstalledComponent(definition, name);\n}\n\n/**\n * The runtime type of a ComponentDefinition. TypeScript will claim\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ImportedComponentDefinition = {\n componentDefinitionPath: string;\n defaultName: string;\n};\n\nfunction exportAppForAnalysis(\n this: ComponentDefinition<any> & AppDefinitionData,\n): AppDefinitionAnalysis {\n const definitionType = { type: \"app\" as const };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\nfunction serializeExportTree(tree: ExportTree): any {\n const branch: any[] = [];\n for (const [key, child] of Object.entries(tree)) {\n let node;\n if (typeof child === \"string\") {\n node = { type: \"leaf\", leaf: child };\n } else {\n node = serializeExportTree(child);\n }\n branch.push([key, node]);\n }\n return { type: \"branch\", branch };\n}\n\nfunction serializeChildComponents(\n childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][],\n): {\n name: string;\n path: string;\n args: [string, { type: \"value\"; value: string }][] | null;\n}[] {\n return childComponents.map(([name, definition, p]) => {\n let args: [string, { type: \"value\"; value: string }][] | null = null;\n if (p !== null) {\n args = [];\n for (const [name, value] of Object.entries(p)) {\n if (value !== undefined) {\n args.push([\n name,\n { type: \"value\", value: JSON.stringify(convexToJson(value)) },\n ]);\n }\n }\n }\n // we know that components carry this extra information\n const path = definition.componentDefinitionPath;\n if (!path)\n throw new Error(\n \"no .componentPath for component definition \" +\n JSON.stringify(definition, null, 2),\n );\n\n return {\n name: name!,\n path: path!,\n args,\n };\n });\n}\n\nfunction exportComponentForAnalysis(\n this: ComponentDefinition<any> & ComponentDefinitionData,\n): ComponentDefinitionAnalysis {\n const args: [string, { type: \"value\"; value: string }][] = Object.entries(\n this._args,\n ).map(([name, validator]) => [\n name,\n {\n type: \"value\",\n value: JSON.stringify(validator.json),\n },\n ]);\n const definitionType: ComponentDefinitionType = {\n type: \"childComponent\" as const,\n name: this._name,\n args,\n };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n name: this._name,\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\n// This is what is actually contained in a ComponentDefinition.\ntype RuntimeComponentDefinition = ComponentDefinition<any> &\n ComponentDefinitionData & {\n export: () => ComponentDefinitionAnalysis;\n };\ntype RuntimeAppDefinition = AppDefinition &\n AppDefinitionData & {\n export: () => AppDefinitionAnalysis;\n };\n\n/**\n * Define a component, a piece of a Convex deployment with namespaced resources.\n *\n * The default\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * @param name Name must be alphanumeric plus underscores. Typically these are\n * lowercase with underscores like `\"onboarding_flow_tracker\"`.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineComponent<Exports extends ComponentExports = any>(\n name: string,\n): ComponentDefinition<Exports> {\n const ret: RuntimeComponentDefinition = {\n _isRoot: false,\n _name: name,\n _args: {},\n _childComponents: [],\n _exportTree: {},\n _onInitCallbacks: {},\n\n export: exportComponentForAnalysis,\n use,\n\n // pretend to conform to ComponentDefinition, which temporarily expects __args\n ...({} as { __args: any }),\n };\n return ret as any as ComponentDefinition<Exports>;\n}\n\n/**\n * Attach components, reuseable pieces of a Convex deployment, to this Convex app.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineApp(): AppDefinition {\n const ret: RuntimeAppDefinition = {\n _isRoot: true,\n _childComponents: [],\n _exportTree: {},\n\n export: exportAppForAnalysis,\n use,\n };\n return ret as AppDefinition;\n}\n\ntype AnyInterfaceType = {\n [key: string]: AnyInterfaceType;\n} & AnyFunctionReference;\nexport type AnyComponentReference = Record<string, AnyInterfaceType>;\n\ntype AnyChildComponents = Record<string, AnyComponentReference>;\n\n/**\n * @internal\n */\nexport function currentSystemUdfInComponent(\n componentId: string,\n): AnyComponentReference {\n return {\n [toReferencePath]: `_reference/currentSystemUdfInComponent/${componentId}`,\n };\n}\n\nfunction createChildComponents(\n root: string,\n pathParts: string[],\n): AnyChildComponents {\n const handler: ProxyHandler<object> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createChildComponents(root, newParts);\n } else if (prop === toReferencePath) {\n if (pathParts.length < 1) {\n const found = [root, ...pathParts].join(\".\");\n throw new Error(\n `API path is expected to be of the form \\`${root}.childComponent.functionName\\`. Found: \\`${found}\\``,\n );\n }\n return `_reference/childComponent/` + pathParts.join(\"/\");\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nexport const componentsGeneric = () => createChildComponents(\"components\", []);\n\nexport type AnyComponents = AnyChildComponents;\n"],
|
|
5
|
+
"mappings": ";;;;AAAA,SAA6B,oBAAoB;AAMjD,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AAOpC,SAAS,kBAAkB,uBAAuB;AAkClD,sBAAsB,qBAKpB,mBAMiD;AACjD,QAAM,UAAU,mBAAmB,iBAAiB;AACpD,SAAO,MAAM,oBAAoB,4BAA4B,EAAE,GAAG,QAAQ,CAAC;AAC7E;AAkFA,MAAM,mBAAgE;AAAA,EAWpE,YAAY,YAAwB,MAAc;AAPlD;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAGE,SAAK,cAAc;AACnB,SAAK,QAAQ;AACb,qBAAiB,MAAM,6BAA6B,IAAI,EAAE;AAAA,EAC5D;AAAA,EAEA,IAAI,UAAkD;AACpD,WAAO,cAAc,KAAK,OAAO,CAAC,CAAC;AAAA,EACrC;AACF;AAEA,SAAS,cAAc,MAAc,WAA0B;AAC7D,QAAM,UAA6B;AAAA,IACjC,IAAI,GAAG,MAAuB;AAC5B,UAAI,OAAO,SAAS,UAAU;AAC5B,cAAM,WAAW,CAAC,GAAG,WAAW,IAAI;AACpC,eAAO,cAAc,MAAM,QAAQ;AAAA,MACrC,WAAW,SAAS,iBAAiB;AACnC,YAAI,YAAY,6BAA6B,IAAI;AACjD,mBAAW,QAA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,IAChC,SAAS;AAAA,IACT,kBAAkB,CAAC;AAAA,IACnB,aAAa,CAAC;AAAA,IAEd,QAAQ;AAAA,IACR;AAAA,EACF;AACA,SAAO;AACT;AAYO,gBAAS,4BACd,aACuB;AACvB,SAAO;AAAA,IACL,CAAC,eAAe,GAAG,0CAA0C,WAAW;AAAA,EAC1E;AACF;AAEA,SAAS,sBACP,MACA,WACoB;AACpB,QAAM,UAAgC;AAAA,IACpC,IAAI,GAAG,MAAuB;AAC5B,UAAI,OAAO,SAAS,UAAU;AAC5B,cAAM,WAAW,CAAC,GAAG,WAAW,IAAI;AACpC,eAAO,sBAAsB,MAAM,QAAQ;AAAA,MAC7C,WAAW,SAAS,iBAAiB;AACnC,YAAI,UAAU,SAAS,GAAG;AACxB,gBAAM,QAAQ,CAAC,MAAM,GAAG,SAAS,EAAE,KAAK,GAAG;AAC3C,gBAAM,IAAI;AAAA,YACR,4CAA4C,IAAI,4CAA4C,KAAK;AAAA,UACnG;AAAA,QACF;AACA,eAAO,+BAA+B,UAAU,KAAK,GAAG;AAAA,MAC1D,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO,IAAI,MAAM,CAAC,GAAG,OAAO;AAC9B;AAEO,aAAM,oBAAoB,MAAM,sBAAsB,cAAc,CAAC,CAAC;",
|
|
6
6
|
"names": ["name"]
|
|
7
7
|
}
|
package/dist/esm/server/index.js
CHANGED
|
@@ -24,8 +24,8 @@ export {
|
|
|
24
24
|
defineApp,
|
|
25
25
|
defineComponent,
|
|
26
26
|
componentsGeneric,
|
|
27
|
-
currentSystemUdfInComponent,
|
|
28
27
|
createFunctionHandle
|
|
29
28
|
} from "./components/index.js";
|
|
29
|
+
export { currentSystemUdfInComponent } from "./components/index.js";
|
|
30
30
|
export { defineTable, defineSchema } from "./schema.js";
|
|
31
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Utilities for implementing server-side Convex query and mutation functions.\n *\n * ## Usage\n *\n * ### Code Generation\n *\n * This module is typically used alongside generated server code.\n *\n * To generate the server code, run `npx convex dev` in your Convex project.\n * This will create a `convex/_generated/server.js` file with the following\n * functions, typed for your schema:\n * - [query](https://docs.convex.dev/generated-api/server#query)\n * - [mutation](https://docs.convex.dev/generated-api/server#mutation)\n *\n * If you aren't using TypeScript and code generation, you can use these untyped\n * functions instead:\n * - {@link queryGeneric}\n * - {@link mutationGeneric}\n *\n * ### Example\n *\n * Convex functions are defined by using either the `query` or\n * `mutation` wrappers.\n *\n * Queries receive a `db` that implements the {@link GenericDatabaseReader} interface.\n *\n * ```js\n * import { query } from \"./_generated/server\";\n *\n * export default query(async ({ db }, { arg1, arg2 }) => {\n * // Your (read-only) code here!\n * });\n * ```\n *\n * If your function needs to write to the database, such as inserting, updating,\n * or deleting documents, use `mutation` instead which provides a `db` that\n * implements the {@link GenericDatabaseWriter} interface.\n *\n * ```js\n * import { mutation } from \"./_generated/server\";\n *\n * export default mutation(async ({ db }, { arg1, arg2 }) => {\n * // Your mutation code here!\n * });\n * ```\n * @module\n */\n\nexport type {\n Auth,\n UserIdentity,\n UserIdentityAttributes,\n} from \"./authentication.js\";\nexport * from \"./database.js\";\nexport type {\n GenericDocument,\n GenericFieldPaths,\n GenericIndexFields,\n GenericTableIndexes,\n GenericSearchIndexConfig,\n GenericTableSearchIndexes,\n GenericVectorIndexConfig,\n GenericTableVectorIndexes,\n FieldTypeFromFieldPath,\n GenericTableInfo,\n DocumentByInfo,\n FieldPaths,\n Indexes,\n IndexNames,\n NamedIndex,\n SearchIndexes,\n SearchIndexNames,\n NamedSearchIndex,\n VectorIndexes,\n VectorIndexNames,\n NamedVectorIndex,\n GenericDataModel,\n AnyDataModel,\n TableNamesInDataModel,\n NamedTableInfo,\n DocumentByName,\n} from \"./data_model.js\";\n\nexport type {\n Expression,\n ExpressionOrValue,\n FilterBuilder,\n} from \"./filter_builder.js\";\nexport {\n actionGeneric,\n httpActionGeneric,\n mutationGeneric,\n queryGeneric,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n} from \"./impl/registration_impl.js\";\nexport type { IndexRange, IndexRangeBuilder } from \"./index_range_builder.js\";\nexport * from \"./pagination.js\";\nexport type { OrderedQuery, Query, QueryInitializer } from \"./query.js\";\nexport type {\n ArgsArray,\n DefaultFunctionArgs,\n FunctionVisibility,\n ActionBuilder,\n MutationBuilder,\n MutationBuilderWithTable,\n QueryBuilder,\n QueryBuilderWithTable,\n HttpActionBuilder,\n GenericActionCtx,\n GenericMutationCtx,\n GenericMutationCtxWithTable,\n GenericQueryCtx,\n GenericQueryCtxWithTable,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n PublicHttpAction,\n UnvalidatedFunction,\n ValidatedFunction,\n ReturnValueForOptionalValidator,\n ArgsArrayForOptionalValidator,\n ArgsArrayToObject,\n DefaultArgsForOptionalValidator,\n} from \"./registration.js\";\nexport * from \"./search_filter_builder.js\";\nexport * from \"./storage.js\";\nexport type { Scheduler, SchedulableFunctionReference } from \"./scheduler.js\";\nexport { cronJobs } from \"./cron.js\";\nexport type { CronJob, Crons } from \"./cron.js\";\nexport type {\n SystemFields,\n IdField,\n WithoutSystemFields,\n WithOptionalSystemFields,\n SystemIndexes,\n IndexTiebreakerField,\n} from \"./system_fields.js\";\nexport { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from \"./router.js\";\nexport type {\n RoutableMethod,\n RouteSpec,\n RouteSpecWithPath,\n RouteSpecWithPathPrefix,\n} from \"./router.js\";\nexport {\n anyApi,\n getFunctionName,\n makeFunctionReference,\n filterApi,\n} from \"./api.js\";\nexport type {\n ApiFromModules,\n AnyApi,\n FilterApi,\n FunctionType,\n FunctionReference,\n FunctionArgs,\n OptionalRestArgs,\n PartialApi,\n ArgsAndOptions,\n FunctionReturnType,\n} from \"./api.js\";\nexport {\n defineApp,\n defineComponent,\n componentsGeneric,\n
|
|
5
|
-
"mappings": ";AAsDA,cAAc;AAmCd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,cAAc;AA4Bd,cAAc;AACd,cAAc;AAEd,SAAS,gBAAgB;AAUzB,SAAS,YAAY,YAAY,6BAA6B;AAO9D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * Utilities for implementing server-side Convex query and mutation functions.\n *\n * ## Usage\n *\n * ### Code Generation\n *\n * This module is typically used alongside generated server code.\n *\n * To generate the server code, run `npx convex dev` in your Convex project.\n * This will create a `convex/_generated/server.js` file with the following\n * functions, typed for your schema:\n * - [query](https://docs.convex.dev/generated-api/server#query)\n * - [mutation](https://docs.convex.dev/generated-api/server#mutation)\n *\n * If you aren't using TypeScript and code generation, you can use these untyped\n * functions instead:\n * - {@link queryGeneric}\n * - {@link mutationGeneric}\n *\n * ### Example\n *\n * Convex functions are defined by using either the `query` or\n * `mutation` wrappers.\n *\n * Queries receive a `db` that implements the {@link GenericDatabaseReader} interface.\n *\n * ```js\n * import { query } from \"./_generated/server\";\n *\n * export default query(async ({ db }, { arg1, arg2 }) => {\n * // Your (read-only) code here!\n * });\n * ```\n *\n * If your function needs to write to the database, such as inserting, updating,\n * or deleting documents, use `mutation` instead which provides a `db` that\n * implements the {@link GenericDatabaseWriter} interface.\n *\n * ```js\n * import { mutation } from \"./_generated/server\";\n *\n * export default mutation(async ({ db }, { arg1, arg2 }) => {\n * // Your mutation code here!\n * });\n * ```\n * @module\n */\n\nexport type {\n Auth,\n UserIdentity,\n UserIdentityAttributes,\n} from \"./authentication.js\";\nexport * from \"./database.js\";\nexport type {\n GenericDocument,\n GenericFieldPaths,\n GenericIndexFields,\n GenericTableIndexes,\n GenericSearchIndexConfig,\n GenericTableSearchIndexes,\n GenericVectorIndexConfig,\n GenericTableVectorIndexes,\n FieldTypeFromFieldPath,\n GenericTableInfo,\n DocumentByInfo,\n FieldPaths,\n Indexes,\n IndexNames,\n NamedIndex,\n SearchIndexes,\n SearchIndexNames,\n NamedSearchIndex,\n VectorIndexes,\n VectorIndexNames,\n NamedVectorIndex,\n GenericDataModel,\n AnyDataModel,\n TableNamesInDataModel,\n NamedTableInfo,\n DocumentByName,\n} from \"./data_model.js\";\n\nexport type {\n Expression,\n ExpressionOrValue,\n FilterBuilder,\n} from \"./filter_builder.js\";\nexport {\n actionGeneric,\n httpActionGeneric,\n mutationGeneric,\n queryGeneric,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n} from \"./impl/registration_impl.js\";\nexport type { IndexRange, IndexRangeBuilder } from \"./index_range_builder.js\";\nexport * from \"./pagination.js\";\nexport type { OrderedQuery, Query, QueryInitializer } from \"./query.js\";\nexport type {\n ArgsArray,\n DefaultFunctionArgs,\n FunctionVisibility,\n ActionBuilder,\n MutationBuilder,\n MutationBuilderWithTable,\n QueryBuilder,\n QueryBuilderWithTable,\n HttpActionBuilder,\n GenericActionCtx,\n GenericMutationCtx,\n GenericMutationCtxWithTable,\n GenericQueryCtx,\n GenericQueryCtxWithTable,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n PublicHttpAction,\n UnvalidatedFunction,\n ValidatedFunction,\n ReturnValueForOptionalValidator,\n ArgsArrayForOptionalValidator,\n ArgsArrayToObject,\n DefaultArgsForOptionalValidator,\n} from \"./registration.js\";\nexport * from \"./search_filter_builder.js\";\nexport * from \"./storage.js\";\nexport type { Scheduler, SchedulableFunctionReference } from \"./scheduler.js\";\nexport { cronJobs } from \"./cron.js\";\nexport type { CronJob, Crons } from \"./cron.js\";\nexport type {\n SystemFields,\n IdField,\n WithoutSystemFields,\n WithOptionalSystemFields,\n SystemIndexes,\n IndexTiebreakerField,\n} from \"./system_fields.js\";\nexport { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from \"./router.js\";\nexport type {\n RoutableMethod,\n RouteSpec,\n RouteSpecWithPath,\n RouteSpecWithPathPrefix,\n} from \"./router.js\";\nexport {\n anyApi,\n getFunctionName,\n makeFunctionReference,\n filterApi,\n} from \"./api.js\";\nexport type {\n ApiFromModules,\n AnyApi,\n FilterApi,\n FunctionType,\n FunctionReference,\n FunctionArgs,\n OptionalRestArgs,\n PartialApi,\n ArgsAndOptions,\n FunctionReturnType,\n} from \"./api.js\";\nexport {\n defineApp,\n defineComponent,\n componentsGeneric,\n createFunctionHandle,\n} from \"./components/index.js\";\n/**\n * @internal\n */\nexport { currentSystemUdfInComponent } from \"./components/index.js\";\nexport type {\n ComponentDefinition,\n AnyComponents,\n FunctionHandle,\n} from \"./components/index.js\";\n\n/**\n * @internal\n */\nexport type { Index, SearchIndex, VectorIndex } from \"./schema.js\";\n\nexport type {\n SearchIndexConfig,\n VectorIndexConfig,\n TableDefinition,\n SchemaDefinition,\n DefineSchemaOptions,\n GenericSchema,\n DataModelFromSchemaDefinition,\n SystemDataModel,\n SystemTableNames,\n} from \"./schema.js\";\nexport { defineTable, defineSchema } from \"./schema.js\";\n\nexport type {\n VectorSearch,\n VectorSearchQuery,\n VectorFilterBuilder,\n FilterExpression,\n} from \"./vector_search.js\";\n\n/**\n * @public\n */\nexport type { BetterOmit, Expand } from \"../type_utils.js\";\n"],
|
|
5
|
+
"mappings": ";AAsDA,cAAc;AAmCd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,cAAc;AA4Bd,cAAc;AACd,cAAc;AAEd,SAAS,gBAAgB;AAUzB,SAAS,YAAY,YAAY,6BAA6B;AAO9D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,mCAAmC;AAuB5C,SAAS,aAAa,oBAAoB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -38,7 +38,7 @@ interface ComponentExports {
|
|
|
38
38
|
* This is a feature of components, which are in beta.
|
|
39
39
|
* This API is unstable and may change in subsequent releases.
|
|
40
40
|
*/
|
|
41
|
-
export type ComponentDefinition<
|
|
41
|
+
export type ComponentDefinition<_Exports extends ComponentExports = any> = {
|
|
42
42
|
/**
|
|
43
43
|
* Install a component with the given definition in this component definition.
|
|
44
44
|
*
|
|
@@ -51,7 +51,7 @@ export type ComponentDefinition<Exports extends ComponentExports = any> = {
|
|
|
51
51
|
name?: string;
|
|
52
52
|
}): InstalledComponent<Definition>;
|
|
53
53
|
};
|
|
54
|
-
type ComponentDefinitionExports<T extends ComponentDefinition<
|
|
54
|
+
type ComponentDefinitionExports<T> = T extends ComponentDefinition<infer Exports> ? Exports : never;
|
|
55
55
|
/**
|
|
56
56
|
* An object of this type should be the default export of a
|
|
57
57
|
* convex.config.ts file in a component-aware convex directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,EACb,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAQzD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,CACxB,IAAI,SAAS,YAAY,EACzB,IAAI,SAAS,mBAAmB,GAAG,GAAG,EACtC,UAAU,GAAG,GAAG,IACd,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;AAEnE;;;;;;;;;;;;GAYG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,SAAS,YAAY,EACzB,IAAI,SAAS,mBAAmB,EAChC,UAAU,EAEV,iBAA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MAAM,GAAG,gBAAgB,CAAC;CACjC,GAAG,oBAAoB,CAAC;AACzB,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;AAErE,KAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;AAsChE,eAAO,MAAM,iBAAiB,0BAAgD,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG,kBAAkB,CAAC"}
|
|
@@ -65,7 +65,7 @@ export { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from "./router.js";
|
|
|
65
65
|
export type { RoutableMethod, RouteSpec, RouteSpecWithPath, RouteSpecWithPathPrefix, } from "./router.js";
|
|
66
66
|
export { anyApi, getFunctionName, makeFunctionReference, filterApi, } from "./api.js";
|
|
67
67
|
export type { ApiFromModules, AnyApi, FilterApi, FunctionType, FunctionReference, FunctionArgs, OptionalRestArgs, PartialApi, ArgsAndOptions, FunctionReturnType, } from "./api.js";
|
|
68
|
-
export { defineApp, defineComponent, componentsGeneric,
|
|
68
|
+
export { defineApp, defineComponent, componentsGeneric, createFunctionHandle, } from "./components/index.js";
|
|
69
69
|
export type { ComponentDefinition, AnyComponents, FunctionHandle, } from "./components/index.js";
|
|
70
70
|
export type { SearchIndexConfig, VectorIndexConfig, TableDefinition, SchemaDefinition, DefineSchemaOptions, GenericSchema, DataModelFromSchemaDefinition, SystemDataModel, SystemTableNames, } from "./schema.js";
|
|
71
71
|
export { defineTable, defineSchema } from "./schema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EACV,eA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QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC5E,YAAY,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,YAAY,EACV,IAAI,EACJ,YAAY,EACZ,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,EACV,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,qBAAq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,EACd,SAAS,EACT,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,MAAM,EACN,eAAe,EACf,qBAAqB,EACrB,SAAS,GACV,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,cAAc,EACd,MAAM,EACN,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAK/B,YAAY,EACV,mBAAmB,EACnB,aAAa,EACb,cAAc,GACf,MAAM,uBAAuB,CAAC;AAO/B,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,6BAA6B,EAC7B,eAAe,EACf,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,YAAY,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "convex",
|
|
3
3
|
"description": "Client for the Convex Cloud",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.3",
|
|
5
5
|
"author": "Convex, Inc. <no-reply@convex.dev>",
|
|
6
6
|
"homepage": "https://convex.dev",
|
|
7
7
|
"repository": {
|
|
@@ -223,6 +223,7 @@
|
|
|
223
223
|
"jsdom": "~24.1.0",
|
|
224
224
|
"jwt-encode": "~1.0.1",
|
|
225
225
|
"knip": "~5.30.2",
|
|
226
|
+
"napi-wasm": "1.1.3",
|
|
226
227
|
"open": "^8.3.0",
|
|
227
228
|
"openid-client": "^5.3.1",
|
|
228
229
|
"ora": "^6.1.0",
|
|
@@ -73,7 +73,7 @@ interface ComponentExports {
|
|
|
73
73
|
* This is a feature of components, which are in beta.
|
|
74
74
|
* This API is unstable and may change in subsequent releases.
|
|
75
75
|
*/
|
|
76
|
-
export type ComponentDefinition<
|
|
76
|
+
export type ComponentDefinition<_Exports extends ComponentExports = any> = {
|
|
77
77
|
/**
|
|
78
78
|
* Install a component with the given definition in this component definition.
|
|
79
79
|
*
|
|
@@ -88,15 +88,10 @@ export type ComponentDefinition<Exports extends ComponentExports = any> = {
|
|
|
88
88
|
name?: string;
|
|
89
89
|
},
|
|
90
90
|
): InstalledComponent<Definition>;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @internal
|
|
94
|
-
*/
|
|
95
|
-
__exports: Exports;
|
|
96
91
|
};
|
|
97
92
|
|
|
98
|
-
type ComponentDefinitionExports<T
|
|
99
|
-
T
|
|
93
|
+
type ComponentDefinitionExports<T> =
|
|
94
|
+
T extends ComponentDefinition<infer Exports> ? Exports : never;
|
|
100
95
|
|
|
101
96
|
/**
|
|
102
97
|
* An object of this type should be the default export of a
|
|
@@ -323,7 +318,7 @@ function exportComponentForAnalysis(
|
|
|
323
318
|
}
|
|
324
319
|
|
|
325
320
|
// This is what is actually contained in a ComponentDefinition.
|
|
326
|
-
type RuntimeComponentDefinition =
|
|
321
|
+
type RuntimeComponentDefinition = ComponentDefinition<any> &
|
|
327
322
|
ComponentDefinitionData & {
|
|
328
323
|
export: () => ComponentDefinitionAnalysis;
|
|
329
324
|
};
|
|
@@ -361,7 +356,7 @@ export function defineComponent<Exports extends ComponentExports = any>(
|
|
|
361
356
|
use,
|
|
362
357
|
|
|
363
358
|
// pretend to conform to ComponentDefinition, which temporarily expects __args
|
|
364
|
-
...({} as { __args: any
|
|
359
|
+
...({} as { __args: any }),
|
|
365
360
|
};
|
|
366
361
|
return ret as any as ComponentDefinition<Exports>;
|
|
367
362
|
}
|
package/src/server/index.ts
CHANGED
|
@@ -167,9 +167,12 @@ export {
|
|
|
167
167
|
defineApp,
|
|
168
168
|
defineComponent,
|
|
169
169
|
componentsGeneric,
|
|
170
|
-
currentSystemUdfInComponent,
|
|
171
170
|
createFunctionHandle,
|
|
172
171
|
} from "./components/index.js";
|
|
172
|
+
/**
|
|
173
|
+
* @internal
|
|
174
|
+
*/
|
|
175
|
+
export { currentSystemUdfInComponent } from "./components/index.js";
|
|
173
176
|
export type {
|
|
174
177
|
ComponentDefinition,
|
|
175
178
|
AnyComponents,
|