Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dependencies, reformat comments in objects #330

Merged
merged 28 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
78ddc83
[ui] Fix getHeadlineText return (#7631)
coreymartin Nov 20, 2023
ab52c6e
[ui] react-router-dom should be dependency (#7634)
coreymartin Nov 20, 2023
02d98e2
CI update lock file for PR
Nov 20, 2023
64a90f5
Update from public js-sdk main branch (#7633)
lightspark-ci-js-sdk[bot] Nov 20, 2023
c9dfca2
CI update lock file for PR
Nov 20, 2023
fbe7f5a
Create wicked-spoons-relate.md
coreymartin Nov 20, 2023
531138d
[js] Add start script with easier filtering (#7642)
coreymartin Nov 20, 2023
b9e4bcb
[jwt-server] Fix lint (#7641)
coreymartin Nov 20, 2023
0b18dac
CI update lock file for PR
Nov 20, 2023
a242399
[docs] add typography tokens for LS docs and adjust tokensizes
bsiaotickchong Nov 20, 2023
e8ca626
[docs] add full lightspark logo to navs
bsiaotickchong Nov 20, 2023
2667ead
[docs] add new nav designs and api schema type categories
bsiaotickchong Nov 20, 2023
4d8f690
[docs] update landing page to match new design
bsiaotickchong Nov 20, 2023
39fd81a
[docs] update api reference page typography and add links
bsiaotickchong Nov 20, 2023
4c0be9e
[docs] fix typography letter-spacing
bsiaotickchong Nov 20, 2023
14b1faf
[docs] minor design review updates (#7653)
bsiaotickchong Nov 20, 2023
5446660
Rerun the generator to pick up format changes (#7647)
jklein24 Nov 20, 2023
24e47ef
[js] Bump comment length (#7654)
coreymartin Nov 20, 2023
17e213e
Rerun sdk formatter again (#7664)
jklein24 Nov 21, 2023
a346d2c
[site] Use account.node_type in InitAccount. Add configure-keys route…
coreymartin Nov 21, 2023
2cfc72b
Fix typos in some js imports in code samples (#7703)
jklein24 Nov 22, 2023
821c593
update documentation links to new domain (towards LIG-3911) (#7690)
bsiaotickchong Nov 22, 2023
e91d252
[site] add external link to docs in nav and add support for external …
bsiaotickchong Nov 22, 2023
7fe5467
[site] Wrapper for Stripe errors and better logging (#7720)
coreymartin Nov 27, 2023
317c579
[ui] fix Link not accepting empty strings for `to` (#7724)
bsiaotickchong Nov 27, 2023
6751810
[js] Upgrade deps (#7721)
coreymartin Nov 27, 2023
4e99880
recreate lock; fix node setup
coreymartin Nov 28, 2023
ff7310b
Create selfish-crabs-pull.md
coreymartin Nov 28, 2023
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
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
Loading