Skip to content

Commit

Permalink
Upgrade dependencies, reformat comments in objects (#330)
Browse files Browse the repository at this point in the history
* [ui] Fix getHeadlineText return (#7631)

GitOrigin-RevId: 2941209768a8c93798b34a5fa3820f493ea6c9c1

* [ui] react-router-dom should be dependency (#7634)

GitOrigin-RevId: ab025c3833197eea35ba992c3f84010394bd71e3

* CI update lock file for PR

* Update from public js-sdk main branch (#7633)

Update public `js` sources with the latest code from the [public
repository](https://github.com/lightsparkdev/js-sdk) main branch.

This typically happens when new versions of the SDK are released and
version updates need to be synced. The PR should be merged as soon as
possible to avoid updates to webdev overwriting the changes in the
js-sdk develop branch.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Corey Martin <[email protected]>
GitOrigin-RevId: d061ad8151fa40ef1e14d3b6ee35b9a742255ae9

* CI update lock file for PR

* Create wicked-spoons-relate.md

* [js] Add start script with easier filtering (#7642)

GitOrigin-RevId: 70ef700815ce6d1cee3ac7e9ce28db905e0a36fd

* [jwt-server] Fix lint (#7641)

GitOrigin-RevId: d4a71ba947c7aa082c6bf716ef1d715c778e5bb3

* CI update lock file for PR

* [docs] add typography tokens for LS docs and adjust tokensizes

GitOrigin-RevId: 7f35def25cde9e78d2f35f0021cf534165a2869f

* [docs] add full lightspark logo to navs

GitOrigin-RevId: eeb36ae695b432d9de2e2ee48ea8ddae7e85b0ab

* [docs] add new nav designs and api schema type categories

GitOrigin-RevId: 5f73e86a251efb65aba852bc347308f21a08c6ed

* [docs] update landing page to match new design

GitOrigin-RevId: b1ab668fd1eb8b179d6c264f692f7173ce6b409d

* [docs] update api reference page typography and add links

GitOrigin-RevId: 2c52c41872fcb362ce57e5a4efe318810233af2e

* [docs] fix typography letter-spacing

GitOrigin-RevId: b61923ae8ca1a8507d0caed5a3301b4ef6a2257d

* [docs] minor design review updates (#7653)

- [x]  sidenav border should be lighter,
- [x]  use label moderate for "view docs" in sdk cards,
- [x]  button cta should be color black and hover to gray20,
- [x]  inline links should be 16px,
- [x]  search non-hovered state border should match other borders
- [x] content nav highlight color should be black

GitOrigin-RevId: 5dd3ee09faa57f92c0e4b25177eed259ce0073de

* Rerun the generator to pick up format changes (#7647)

GitOrigin-RevId: f7a3b51d58742cef71bc0b37f966f6548af5b4ab

* [js] Bump comment length (#7654)

GitOrigin-RevId: 1047c23758a4770f433ca51eda25593678ce6a54

* Rerun sdk formatter again (#7664)

GitOrigin-RevId: 33716b3d92c00f64ab7d459e4b331962fbc7457b

* [site] Use account.node_type in InitAccount. Add configure-keys route behind GK (#7525)

GitOrigin-RevId: 27a7cf7d551ac4345856393a7db355f295980c3e

* Fix typos in some js imports in code samples (#7703)

GitOrigin-RevId: acd3d0eeafb3fccadeae53d371d27b728a2bca41

* update documentation links to new domain (towards LIG-3911) (#7690)

GitOrigin-RevId: be393e7acb0dcd8df5e064ff31b80d746841e809

* [site] add external link to docs in nav and add support for external links (#7691)

GitOrigin-RevId: c809b789ac40d51910c0edb6f6ef5da66c010003

* [site] Wrapper for Stripe errors and better logging (#7720)

GitOrigin-RevId: 112d124e7d2c8947d8d91c309fa5f2ae40639a1f

* [ui] fix Link not accepting empty strings for `to` (#7724)

GitOrigin-RevId: 237726780dae9c5de9f0c66316a4fce11567844b

* [js] Upgrade deps (#7721)

GitOrigin-RevId: 41866e57df7b67b97c34e4771f3d2974dbaf86bf

* recreate lock; fix node setup

* Create selfish-crabs-pull.md

---------

Co-authored-by: Corey Martin <[email protected]>
Co-authored-by: Lightspark Eng <[email protected]>
Co-authored-by: lightspark-ci-js-sdk[bot] <134011073+lightspark-ci-js-sdk[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Brian Siao Tick Chong <[email protected]>
Co-authored-by: Jeremy Klein <[email protected]>
  • Loading branch information
7 people authored Nov 28, 2023
1 parent 90bf035 commit 35513da
Show file tree
Hide file tree
Showing 178 changed files with 2,609 additions and 2,699 deletions.
13 changes: 13 additions & 0 deletions .changeset/selfish-crabs-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@lightsparkdev/lightspark-cli": patch
"@lightsparkdev/lightspark-sdk": patch
"@lightsparkdev/react-native": patch
"@lightsparkdev/react-wallet": patch
"@lightsparkdev/wallet-cli": patch
"@lightsparkdev/wallet-sdk": patch
"@lightsparkdev/oauth": patch
"@lightsparkdev/core": patch
"@lightsparkdev/ui": patch
---

Upgrade dependencies
5 changes: 5 additions & 0 deletions .changeset/wicked-spoons-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@lightsparkdev/ui": patch
---

[ui] Fix getHeadlineText return
10 changes: 10 additions & 0 deletions .github/workflows/test-release-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:

- name: "Setup Node"
uses: "actions/setup-node@v3"
env:
SKIP_YARN_COREPACK_CHECK: true
with:
node-version-file: ".nvmrc"

Expand Down Expand Up @@ -76,6 +78,8 @@ jobs:

- name: "Setup Node v${{ matrix.node-version }}"
uses: "actions/setup-node@v3"
env:
SKIP_YARN_COREPACK_CHECK: true
with:
node-version: ${{ matrix.node-version }}

Expand Down Expand Up @@ -122,6 +126,8 @@ jobs:

- name: "Setup Node"
uses: "actions/setup-node@v3"
env:
SKIP_YARN_COREPACK_CHECK: true
with:
node-version-file: ".nvmrc"

Expand Down Expand Up @@ -163,6 +169,8 @@ jobs:

- name: "Setup Node v${{ matrix.node-version }}"
uses: "actions/setup-node@v3"
env:
SKIP_YARN_COREPACK_CHECK: true
with:
node-version: ${{ matrix.node-version }}

Expand Down Expand Up @@ -197,6 +205,8 @@ jobs:

- name: "Setup Node"
uses: "actions/setup-node@v3"
env:
SKIP_YARN_COREPACK_CHECK: true
with:
node-version-file: ".nvmrc"

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Or to build all packages and run all examples simply do:
yarn start
```

Please see the README files in the [examples directory](./apps/examples) for instructions on running the examples. Please note that some packages such as @lightspark/ui are for building the examples only and not necessary for your implementation of our [published SDK packages](https://www.npmjs.com/search?q=%40lightsparkdev).
Please see the README files in the [examples directory](./apps/examples) for instructions on running the examples. Please note that some packages such as @lightsparkdev/ui are for building the examples only and not necessary for your implementation of our [published SDK packages](https://www.npmjs.com/search?q=%40lightsparkdev).
27 changes: 4 additions & 23 deletions apps/examples/jwt-server/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"google",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json", "tsconfig.dev.json"],
sourceType: "module",
},
ignorePatterns: [
"/lib/**/*", // Ignore built files.
],
extends: ["@lightsparkdev/eslint-config/base", "google"],
plugins: ["@typescript-eslint", "import"],
rules: {
"quotes": ["error", "double"],
quotes: ["error", "double"],
"import/no-unresolved": 0,
"indent": ["error", 2],
indent: ["error", 2],
"max-len": ["error", { code: 120 }],
"object-curly-spacing": ["error", "always"],
"quote-props": ["off"],
},
};
4 changes: 3 additions & 1 deletion apps/examples/jwt-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@
"engines": {
"node": "18"
},
"main": "lib/index.js",
"main": "dist/index.js",
"dependencies": {
"@lightsparkdev/lightspark-sdk": "^1.2.0",
"firebase-admin": "^11.9.0",
"firebase-functions": "^4.4.1",
"jsonwebtoken": "^9.0.1"
},
"devDependencies": {
"@lightsparkdev/eslint-config": "*",
"@types/zen-observable": "^0.8.5",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.3.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.26.0",
"eslint-watch": "^8.0.0",
"firebase-functions-test": "^3.0.0",
"typescript": "^5.0.0"
},
Expand Down
27 changes: 14 additions & 13 deletions apps/examples/jwt-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const getJwt = onRequest(
.status(500)
.send(
"Missing account config. Please add account_id and " +
"private_signing_key to the firebase config.",
"private_signing_key to the firebase config."
);
return;
}
Expand All @@ -62,7 +62,7 @@ export const getJwt = onRequest(

logger.info("Generating JWT for a user", { userId, accountId });
response.send({ token, accountId });
},
}
);

export const handleWebhook = onRequest(
Expand All @@ -73,23 +73,24 @@ export const handleWebhook = onRequest(
const event = await verifyAndParseWebhook(
bodyData,
hexdigest,
webhookSecretParam.value(),
webhookSecretParam.value()
);
console.log(`Received webhook event: ${event.event_type}`);
console.log(`Event data: ${JSON.stringify(event)}`);

// From here, you could take some action based on the event type. For example:
// if (event.event_type === WebhookEventType.WALLET_INCOMING_PAYMENT_FINISHED) {
// const payment = await lightsparkClient.executeRawQuery(
// IncomingPayment.getIncomingPaymentQuery(event.entity_id)
// );
// console.log(`Incoming payment: ${JSON.stringify(payment)}`);
// const wallet = await lightsparkClient.executeRawQuery(Wallet.getWalletQuery(payment.wallet_id));
// await sendPaymentReceivedNotification(wallet.thirdPartyIdentifier, payment.amount);
// }
// From here, you could take some action based on the event type. For
// example: if (event.event_type ===
// WebhookEventType.WALLET_INCOMING_PAYMENT_FINISHED) { const payment =
// await lightsparkClient.executeRawQuery(
// IncomingPayment.getIncomingPaymentQuery(event.entity_id) );
// console.log(`Incoming payment: ${JSON.stringify(payment)}`);
// const wallet = await
// lightsparkClient.executeRawQuery(Wallet.getWalletQuery(payment.wallet_id));
// await sendPaymentReceivedNotification(wallet.thirdPartyIdentifier,
// payment.amount); }

response.send("ok");
},
}
);

const checkOrCreateUser = async (userId: string, password: string) => {
Expand Down
3 changes: 0 additions & 3 deletions apps/examples/jwt-server/tsconfig.dev.json

This file was deleted.

2 changes: 1 addition & 1 deletion apps/examples/jwt-server/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"moduleResolution": "node",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"outDir": "dist",
"sourceMap": true,
"strict": true,
"target": "es2017",
Expand Down
6 changes: 2 additions & 4 deletions apps/examples/ls-react-native-crypto-app/app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"expo": {
"name": "ls-react-native-crypto-example",
"name": "@lightsparkdev/ls-react-native-crypto-example",
"slug": "ls-react-native-crypto-example",
"version": "1.0.0",
"orientation": "portrait",
Expand All @@ -11,9 +11,7 @@
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": [
"**/*"
],
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.lightspark.sdk.rn.crypto.example"
Expand Down
2 changes: 1 addition & 1 deletion apps/examples/remote-signing-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "@lightsparkdev/tsconfig/ts-node-app.json"
"extends": "../../../packages/tsconfig/ts-node-app.json"
}
2 changes: 1 addition & 1 deletion apps/examples/uma-vasp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@lightsparkdev/tsconfig/ts-node-app.json",
"extends": "../../../packages/tsconfig/ts-node-app.json",
"compilerOptions": {
"types": ["node", "jest"]
}
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"release": "turbo build && changeset publish",
"start:check": "turbo run build && turbo run build:watch start types:watch lint:watch --parallel --concurrency 200",
"start": "turbo run build && turbo run build:watch start --concurrency 200",
"start": "./start.sh",
"test": "turbo run test",
"test:hermetic-integration": "turbo run test:hermetic-integration",
"test:integration": "turbo run test:integration",
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/constants/localStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ export const ConfigKeys = {
export type ConfigKeys = (typeof ConfigKeys)[keyof typeof ConfigKeys];

export const getLocalStorageConfigItem = (key: ConfigKeys) => {
return getLocalStorageBoolean(key);
};

export const getLocalStorageBoolean = (key: string) => {
/* localStorage is not available in all contexts, use try/catch: */
try {
return localStorage.getItem(key) === "1";
} catch (e) {
Expand Down
16 changes: 16 additions & 0 deletions packages/core/src/utils/errors.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { type JSONType } from "./types.js";

export const isError = (e: unknown): e is Error => {
return Boolean(
typeof e === "object" &&
Expand Down Expand Up @@ -34,3 +36,17 @@ export const isErrorMsg = (e: unknown, msg: string) => {
}
return false;
};

export function errorToJSON(err: unknown) {
if (
typeof err === "object" &&
err !== null &&
"toJSON" in err &&
typeof err.toJSON === "function"
) {
return err.toJSON() as JSONType;
}
return JSON.parse(
JSON.stringify(err, Object.getOwnPropertyNames(err)),
) as JSONType;
}
4 changes: 4 additions & 0 deletions packages/core/src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ export type DeepPartial<T> = T extends object
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;

export type JSONLiteral = string | number | boolean | null;
export type JSONType = JSONLiteral | JSONType[] | { [key: string]: JSONType };
export type JSONObject = { [key: string]: JSONType };
2 changes: 1 addition & 1 deletion packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@lightsparkdev/tsconfig/base.json",
"extends": "../tsconfig/base.json",
"include": ["src", "src/crypto/types.ts"],
"exclude": ["**/tests", "node_modules", "dist"]
}
2 changes: 1 addition & 1 deletion packages/eslint-config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const path = require("path");

const commentOptions = {
mode: "overflow-only",
maxLength: 80,
maxLength: 100,
logicalWrap: true,
ignoreUrls: true,
ignoreCommentsWithCode: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/react-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
importNames: ["Link", "Navigate", "useNavigate"],
message:
"Please use typesafe imports from components/router instead.",
name: "@lightsparkdev/ui/src/router",
name: "@lightsparkdev/ui/router",
},
{
importNames: ["default", "QRCodeSVG"],
Expand Down
2 changes: 1 addition & 1 deletion packages/lightspark-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The `lightspark` script is a wrapper around the `lightspark-sdk` which can simpl

The first command you'll need to run get set up is init-env.

You'll need to provide your API token's client ID and client secret. You can set this up from the [Lightspark API config page](https://app.lightspark.com/api-config). For more info on API authentication, see the [Lightspark API Authentication docs](https://app.lightspark.com/docs/api/authentication).
You'll need to provide your API token's client ID and client secret. You can set this up from the [Lightspark API config page](https://app.lightspark.com/api-config). For more info on API authentication, see the [Lightspark API Authentication docs](https://docs.lightspark.com/lightspark-sdk/authentication?language=Typescript).

If you run it without any arguments, it will prompt you for your API token's client ID and client secret:

Expand Down
2 changes: 1 addition & 1 deletion packages/lightspark-cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@lightsparkdev/tsconfig/ts-node-app.json",
"extends": "../tsconfig/ts-node-app.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
Expand Down
4 changes: 2 additions & 2 deletions packages/lightspark-sdk/src/objects/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import type TransactionType from "./TransactionType.js";

/**
* This is an object representing the connected Lightspark account.
* You can retrieve this object to see your account information and objects
* tied to your account. *
* You can retrieve this object to see your account information and objects tied to your account.
* *
*/
class Account implements LightsparkNodeOwner, Entity {
constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
interface AccountToApiTokensConnection {
/**
* The total count of objects in this connection, using the current filters.
* It is different from the number of objects returned in the current page
* (in the `entities` field).
* It is different from the number of objects returned in the current page (in the `entities`
* field).
**/
count: number;

/**
* An object that holds pagination information about the objects in this
* connection. *
*/
/** An object that holds pagination information about the objects in this connection. **/
pageInfo: PageInfo;

/** The API tokens for the current page of this connection. **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { ChannelFromJson } from "./Channel.js";
class AccountToChannelsConnection {
constructor(
/**
* The total count of objects in this connection, using the current
* filters. It is different from the number of objects returned in the
* current page (in the `entities` field).
* The total count of objects in this connection, using the current filters.
* It is different from the number of objects returned in the current page (in the `entities`
* field).
**/
public readonly count: number,
/** The channels for the current page of this connection. **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ import { PageInfoFromJson, PageInfoToJson } from "./PageInfo.js";
interface AccountToNodesConnection {
/**
* The total count of objects in this connection, using the current filters.
* It is different from the number of objects returned in the current page
* (in the `entities` field).
* It is different from the number of objects returned in the current page (in the `entities`
* field).
**/
count: number;

/**
* An object that holds pagination information about the objects in this
* connection. *
*/
/** An object that holds pagination information about the objects in this connection. **/
pageInfo: PageInfo;

/** The nodes for the current page of this connection. **/
Expand Down
Loading

0 comments on commit 35513da

Please sign in to comment.