Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions api/shapes/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ export const enum VaultWeaponGroupingStyle {
Inline,
}

export const enum OrnamentDisplay {
/** Always display the ornament's image. */
All,
/** Always display the base image. */
None,
}

export interface Settings {
/** Show item quality percentages */
readonly itemQuality: boolean;
Expand Down Expand Up @@ -166,6 +173,15 @@ export interface Settings {

/** The currently selected item popup tab. */
itemPopupTab: ItemPopupTab;

/** Whether to show vaulted items underneath equipped items in Desktop view. */
vaultBelow: boolean;

/** Different modes for how armor stats can be compared. */
armorCompare: 'current' | 'base' | 'baseMasterwork';

/** Whether to show the ornamented state of items. */
ornamentDisplay: OrnamentDisplay;
}

export const defaultSettings: Settings = {
Expand Down Expand Up @@ -259,4 +275,7 @@ export const defaultSettings: Settings = {
vaultWeaponGroupingStyle: VaultWeaponGroupingStyle.Lines,
vaultArmorGroupingStyle: VaultWeaponGroupingStyle.Inline,
itemPopupTab: ItemPopupTab.Overview,
vaultBelow: false,
armorCompare: 'baseMasterwork',
ornamentDisplay: OrnamentDisplay.All,
};
5 changes: 4 additions & 1 deletion api/stately/client.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { nodeTransport } from '@stately-cloud/client/node';
import { createClient } from './generated/index.js';

/**
* Our StatelyDB client, bound to our types and store.
*/
export const client = createClient(BigInt(process.env.STATELY_STORE_ID!), {
export const client = createClient({
storeId: BigInt(process.env.STATELY_STORE_ID!),
region: process.env.STATELY_REGION || 'us-west-2',
transport: nodeTransport,
});
4 changes: 2 additions & 2 deletions api/stately/generated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
This is an auto-generated README file to help you understand your schema!

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

### Key Path Layout

Expand Down
2 changes: 1 addition & 1 deletion api/stately/generated/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @generated by Stately. DO NOT EDIT.
/* eslint-disable */

export * from './stately_item_types.js';
export * from './stately_pb.js';
35 changes: 30 additions & 5 deletions api/stately/generated/stately_item_types.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// @generated by Stately. DO NOT EDIT.
/* eslint-disable */

import type {
ClientOptions,
DatabaseClient as GenericDatabaseClient,
StoreID,
Item,
ItemInit,
} from '@stately-cloud/client';
import type {
ApiApp,
Expand Down Expand Up @@ -89,8 +90,32 @@ export type AnyItem =
| Settings
| Triumph;

type TypeMap = typeof itemTypeToSchema;

// DatabaseClient is a database client that has been customized with your schema.
export type DatabaseClient = GenericDatabaseClient<typeof itemTypeToSchema, AllItemTypes>;
export type DatabaseClient = GenericDatabaseClient<TypeMap, AllItemTypes>;

/**
* Create a new DatabaseClient bound to your schema that allows operations against
* stores that use that schema.
* @example
* import { createClient } from "./my_schema";
* import { nodeTransport } from "@stately-cloud/client/node";
* const client = createClient({ storeId: 1221515n, transport: nodeTransport });
* const item = await client.get("Equipment", "/jedi-luke/equipment-lightsaber");
* @private this is used by the generated code and should not be called directly.
*/
export declare function createClient(options: ClientOptions): DatabaseClient;

// createClient creates a new database client with your schema.
export declare function createClient(storeId: StoreID, opts?: ClientOptions): DatabaseClient;
/**
* create builds a new item of the specified type. You *must* use this
* function to create items so that they have the proper metadata for the
* client to use them.
* @param typeName - One of the itemType or objectType names from your schema.
* @param init - The initial data for the item. Any values that aren't set
* here will be set to their zero value.
*/
export declare function create<T extends keyof TypeMap>(
typeName: T,
init?: ItemInit<TypeMap, T>,
): Item<TypeMap, T>;
20 changes: 14 additions & 6 deletions api/stately/generated/stately_item_types.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @generated by Stately. DO NOT EDIT.
/* eslint-disable */

import { createClient as createGenericClient } from '@stately-cloud/client';
import { createClient as createGenericClient, makeCreateFunction } from '@stately-cloud/client';
import {
ApiAppSchema,
ArtifactUnlocksSchema,
Expand Down Expand Up @@ -56,14 +56,22 @@ export const typeToSchema = {
};

/** The version of the schema that this client was generated for. */
const SCHEMA_VERSION_ID = 8;
const SCHEMA_ID = 8030842688320564;
export const SCHEMA_VERSION_ID = 9;
export const SCHEMA_ID = 8030842688320564;

export function createClient(storeId, opts) {
return createGenericClient(storeId, typeToSchema, SCHEMA_VERSION_ID, SCHEMA_ID, opts);
export function createClient({ storeId, transport, ...transportOptions }) {
return createGenericClient({
storeId,
itemTypeMap: typeToSchema,
schemaVersionID: SCHEMA_VERSION_ID,
schemaID: SCHEMA_ID,
clientFactory: transport(transportOptions),
});
}

if (createGenericClient.length < 4) {
export const create = makeCreateFunction(typeToSchema);

if (createGenericClient.length !== 1) {
throw new Error(
'Your version of @stately-cloud/client is too old. Please update to the latest version.',
);
Expand Down
Loading