Skip to content

Commit 856e862

Browse files
authored
Add new settings (#286)
* Add new settings * Upgrade client signature * OK
1 parent 11cb22a commit 856e862

13 files changed

Lines changed: 2056 additions & 1756 deletions

api/shapes/settings.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ export const enum VaultWeaponGroupingStyle {
2222
Inline,
2323
}
2424

25+
export const enum OrnamentDisplay {
26+
/** Always display the ornament's image. */
27+
All,
28+
/** Always display the base image. */
29+
None,
30+
}
31+
2532
export interface Settings {
2633
/** Show item quality percentages */
2734
readonly itemQuality: boolean;
@@ -166,6 +173,15 @@ export interface Settings {
166173

167174
/** The currently selected item popup tab. */
168175
itemPopupTab: ItemPopupTab;
176+
177+
/** Whether to show vaulted items underneath equipped items in Desktop view. */
178+
vaultBelow: boolean;
179+
180+
/** Different modes for how armor stats can be compared. */
181+
armorCompare: 'current' | 'base' | 'baseMasterwork';
182+
183+
/** Whether to show the ornamented state of items. */
184+
ornamentDisplay: OrnamentDisplay;
169185
}
170186

171187
export const defaultSettings: Settings = {
@@ -259,4 +275,7 @@ export const defaultSettings: Settings = {
259275
vaultWeaponGroupingStyle: VaultWeaponGroupingStyle.Lines,
260276
vaultArmorGroupingStyle: VaultWeaponGroupingStyle.Inline,
261277
itemPopupTab: ItemPopupTab.Overview,
278+
vaultBelow: false,
279+
armorCompare: 'baseMasterwork',
280+
ornamentDisplay: OrnamentDisplay.All,
262281
};

api/stately/client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import { nodeTransport } from '@stately-cloud/client/node';
12
import { createClient } from './generated/index.js';
23

34
/**
45
* Our StatelyDB client, bound to our types and store.
56
*/
6-
export const client = createClient(BigInt(process.env.STATELY_STORE_ID!), {
7+
export const client = createClient({
8+
storeId: BigInt(process.env.STATELY_STORE_ID!),
79
region: process.env.STATELY_REGION || 'us-west-2',
10+
transport: nodeTransport,
811
});

api/stately/generated/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
This is an auto-generated README file to help you understand your schema!
44

55
* SchemaID => `8030842688320564`
6-
* Schema Version => `8`
7-
* See schema on the [Stately Console](https://console.stately.cloud/1org/schemas/8030842688320564).
6+
* Schema Version => `9`
7+
* See schema on the [Stately Console](https://console.stately.cloud/6529794557127699/schemas/?schemaVersion=9).
88

99
### Key Path Layout
1010

api/stately/generated/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @generated by Stately. DO NOT EDIT.
2-
/* eslint-disable */
2+
33

44
export * from './stately_item_types.js';
55
export * from './stately_pb.js';

api/stately/generated/stately_item_types.d.ts

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// @generated by Stately. DO NOT EDIT.
2-
/* eslint-disable */
2+
33

44
import type {
55
ClientOptions,
66
DatabaseClient as GenericDatabaseClient,
7-
StoreID,
7+
Item,
8+
ItemInit,
89
} from '@stately-cloud/client';
910
import type {
1011
ApiApp,
@@ -89,8 +90,32 @@ export type AnyItem =
8990
| Settings
9091
| Triumph;
9192

93+
type TypeMap = typeof itemTypeToSchema;
94+
9295
// 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;
94109

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>;

api/stately/generated/stately_item_types.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @generated by Stately. DO NOT EDIT.
22
/* eslint-disable */
33

4-
import { createClient as createGenericClient } from '@stately-cloud/client';
4+
import { createClient as createGenericClient, makeCreateFunction } from '@stately-cloud/client';
55
import {
66
ApiAppSchema,
77
ArtifactUnlocksSchema,
@@ -56,14 +56,22 @@ export const typeToSchema = {
5656
};
5757

5858
/** The version of the schema that this client was generated for. */
59-
const SCHEMA_VERSION_ID = 8;
60-
const SCHEMA_ID = 8030842688320564;
59+
export const SCHEMA_VERSION_ID = 9;
60+
export const SCHEMA_ID = 8030842688320564;
6161

62-
export function createClient(storeId, opts) {
63-
return createGenericClient(storeId, typeToSchema, SCHEMA_VERSION_ID, SCHEMA_ID, opts);
62+
export function createClient({ storeId, transport, ...transportOptions }) {
63+
return createGenericClient({
64+
storeId,
65+
itemTypeMap: typeToSchema,
66+
schemaVersionID: SCHEMA_VERSION_ID,
67+
schemaID: SCHEMA_ID,
68+
clientFactory: transport(transportOptions),
69+
});
6470
}
6571

66-
if (createGenericClient.length < 4) {
72+
export const create = makeCreateFunction(typeToSchema);
73+
74+
if (createGenericClient.length !== 1) {
6775
throw new Error(
6876
'Your version of @stately-cloud/client is too old. Please update to the latest version.',
6977
);

0 commit comments

Comments
 (0)