|
1 | 1 | // @generated by Stately. DO NOT EDIT. |
2 | | -/* eslint-disable */ |
| 2 | + |
3 | 3 |
|
4 | 4 | import type { |
5 | 5 | ClientOptions, |
6 | 6 | DatabaseClient as GenericDatabaseClient, |
7 | | - StoreID, |
| 7 | + Item, |
| 8 | + ItemInit, |
8 | 9 | } from '@stately-cloud/client'; |
9 | 10 | import type { |
10 | 11 | ApiApp, |
@@ -89,8 +90,32 @@ export type AnyItem = |
89 | 90 | | Settings |
90 | 91 | | Triumph; |
91 | 92 |
|
| 93 | +type TypeMap = typeof itemTypeToSchema; |
| 94 | + |
92 | 95 | // DatabaseClient is a database client that has been customized with your schema. |
93 | | -export type DatabaseClient = GenericDatabaseClient<typeof itemTypeToSchema, AllItemTypes>; |
| 96 | +export type DatabaseClient = GenericDatabaseClient<TypeMap, AllItemTypes>; |
| 97 | + |
| 98 | +/** |
| 99 | + * Create a new DatabaseClient bound to your schema that allows operations against |
| 100 | + * stores that use that schema. |
| 101 | + * @example |
| 102 | + * import { createClient } from "./my_schema"; |
| 103 | + * import { nodeTransport } from "@stately-cloud/client/node"; |
| 104 | + * const client = createClient({ storeId: 1221515n, transport: nodeTransport }); |
| 105 | + * const item = await client.get("Equipment", "/jedi-luke/equipment-lightsaber"); |
| 106 | + * @private this is used by the generated code and should not be called directly. |
| 107 | + */ |
| 108 | +export declare function createClient(options: ClientOptions): DatabaseClient; |
94 | 109 |
|
95 | | -// createClient creates a new database client with your schema. |
96 | | -export declare function createClient(storeId: StoreID, opts?: ClientOptions): DatabaseClient; |
| 110 | +/** |
| 111 | + * create builds a new item of the specified type. You *must* use this |
| 112 | + * function to create items so that they have the proper metadata for the |
| 113 | + * client to use them. |
| 114 | + * @param typeName - One of the itemType or objectType names from your schema. |
| 115 | + * @param init - The initial data for the item. Any values that aren't set |
| 116 | + * here will be set to their zero value. |
| 117 | + */ |
| 118 | +export declare function create<T extends keyof TypeMap>( |
| 119 | + typeName: T, |
| 120 | + init?: ItemInit<TypeMap, T>, |
| 121 | +): Item<TypeMap, T>; |
0 commit comments