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

release: fix SDKs interoperability #747

Closed
wants to merge 4 commits into from
Closed
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
1 change: 1 addition & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
"violet-ads-warn",
"violet-impalas-grab",
"yellow-cows-push",
"young-carrots-jump",
"young-jeans-reflect"
]
}
9 changes: 9 additions & 0 deletions .changeset/young-carrots-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@lens-protocol/storage": patch
"@lens-protocol/client": patch
"@lens-protocol/react": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
---

**fix:** `LensClient` and Lens React Hooks interoperability
9 changes: 9 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @lens-protocol/client

## 2.0.0-alpha.24

### Patch Changes

- f2010c008: **fix:** `LensClient` and Lens React Hooks interoperability
- Updated dependencies [f2010c008]
- @lens-protocol/[email protected]
- @lens-protocol/[email protected]

## 2.0.0-alpha.23

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lens-protocol/client",
"version": "2.0.0-alpha.23",
"version": "2.0.0-alpha.24",
"description": "Low level Lens API client",
"repository": {
"directory": "packages/client",
Expand Down
14 changes: 4 additions & 10 deletions packages/client/src/authentication/adapters/CredentialsStorage.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
import {
BaseStorageSchema,
CredentialsStorageSchema,
IStorage,
IStorageProvider,
PersistedCredentials,
Storage,
StorageSubscriber,
StorageSubscription,
} from '@lens-protocol/storage';
import { z } from 'zod';

import { Credentials } from './Credentials';

const AuthData = z.object({
refreshToken: z.string(),
});

type AuthData = z.infer<typeof AuthData>;

/**
* Stores auth credentials.
* Access token is kept in memory.
* Refresh token is persisted permanently.
*/
export class CredentialsStorage implements IStorage<Credentials> {
private refreshTokenStorage: IStorage<AuthData>;
private refreshTokenStorage: IStorage<PersistedCredentials>;
private accessToken: string | undefined;

constructor(storageProvider: IStorageProvider, namespace: string) {
const authStorageSchema = new BaseStorageSchema(`lens.${namespace}.credentials`, AuthData);
const authStorageSchema = new CredentialsStorageSchema(`lens.${namespace}.credentials`);
this.refreshTokenStorage = Storage.createForSchema(authStorageSchema, storageProvider);
}

Expand Down
7 changes: 7 additions & 0 deletions packages/gated-content/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @lens-protocol/gated-content

## 0.3.3-alpha.18

### Patch Changes

- Updated dependencies [f2010c008]
- @lens-protocol/[email protected]

## 0.3.3-alpha.17

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/gated-content/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lens-protocol/gated-content",
"version": "0.3.3-alpha.17",
"version": "0.3.3-alpha.18",
"description": "Token-gated content for the Lens Protocol",
"main": "dist/lens-protocol-gated-content.cjs.js",
"module": "dist/lens-protocol-gated-content.esm.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @lens-protocol/react-native

## 0.0.1-alpha.1

### Patch Changes

- f2010c008: **fix:** `LensClient` and Lens React Hooks interoperability
- Updated dependencies [f2010c008]
- @lens-protocol/[email protected]
- @lens-protocol/[email protected]

## 0.0.1-alpha.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lens-protocol/react-native",
"version": "0.0.1-alpha.0",
"version": "0.0.1-alpha.1",
"description": "Lens Protocol SDK for React Native",
"main": "dist/lens-protocol-react-native.cjs.js",
"module": "dist/lens-protocol-react-native.esm.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/react-web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @lens-protocol/react-web

## 2.0.0-alpha.24

### Patch Changes

- f2010c008: **fix:** `LensClient` and Lens React Hooks interoperability
- Updated dependencies [f2010c008]
- @lens-protocol/[email protected]
- @lens-protocol/[email protected]

## 2.0.0-alpha.23

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lens-protocol/react-web",
"version": "2.0.0-alpha.23",
"version": "2.0.0-alpha.24",
"description": "Lens Protocol SDK for React web applications",
"main": "dist/lens-protocol-react-web.cjs.js",
"module": "dist/lens-protocol-react-web.esm.js",
Expand Down
8 changes: 8 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @lens-protocol/react

## 2.0.0-alpha.24

### Patch Changes

- f2010c008: **fix:** `LensClient` and Lens React Hooks interoperability
- Updated dependencies [f2010c008]
- @lens-protocol/[email protected]

## 2.0.0-alpha.23

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lens-protocol/react",
"version": "2.0.0-alpha.23",
"version": "2.0.0-alpha.24",
"description": "Interacting with the Lens Protocol API using React.",
"main": "dist/lens-protocol-react.cjs.js",
"module": "dist/lens-protocol-react.esm.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import {
Storage,
StorageSubscriber,
StorageSubscription,
CredentialsStorageSchema,
PersistedCredentials,
} from '@lens-protocol/storage';

import { Credentials } from './Credentials';
import { AuthData, CredentialsStorageSchema } from './CredentialsStorageSchema';

/**
* Stores auth credentials.
* Access token is kept in memory.
* Refresh token is persisted permanently.
*/
export class CredentialsStorage implements IStorage<Credentials> {
refreshTokenStorage: IStorage<AuthData>;
refreshTokenStorage: IStorage<PersistedCredentials>;
accessToken: string | null = null;

constructor(storageProvider: IStorageProvider, namespace: string) {
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"module": "ESNext",
"outDir": "dist"
},
"include": ["./src"]
"include": ["./src", "../storage/src/CredentialsStorageSchema.ts"]
}
6 changes: 6 additions & 0 deletions packages/storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @lens-protocol/storage

## 0.7.5-alpha.7

### Patch Changes

- f2010c008: **fix:** `LensClient` and Lens React Hooks interoperability

## 0.7.5-alpha.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lens-protocol/storage",
"version": "0.7.5-alpha.6",
"version": "0.7.5-alpha.7",
"description": "Storage",
"repository": {
"directory": "packages/storage",
Expand Down
32 changes: 32 additions & 0 deletions packages/storage/src/CredentialsStorageSchema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { z } from 'zod';

import { BaseStorageSchema, IStorageItem } from './BaseStorageSchema';

const PersistedCredentialsSchema = z.object({
refreshToken: z.string(),
});

type PersistedCredentialsSchema = typeof PersistedCredentialsSchema;

export type PersistedCredentials = z.infer<PersistedCredentialsSchema>;

export class CredentialsStorageSchema extends BaseStorageSchema<PersistedCredentialsSchema> {
version = 2;

constructor(key: string) {
super(key, PersistedCredentialsSchema);
}

protected override migrate(
storageItem: IStorageItem<PersistedCredentials>,
): PersistedCredentials {
const storageVersion = storageItem.metadata.version;

if (this.version > storageVersion) {
return this.parseData({
refreshToken: '',
});
}
return this.parseData(storageItem.data);
}
}
1 change: 1 addition & 0 deletions packages/storage/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './BaseStorageSchema';
export * from './CredentialsStorageSchema';
export * from './IStorage';
export * from './Storage';
export * from './InMemoryStorageProvider';
7 changes: 7 additions & 0 deletions packages/wagmi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @lens-protocol/wagmi

## 3.0.0-alpha.21

### Patch Changes

- Updated dependencies [f2010c008]
- @lens-protocol/[email protected]

## 3.0.0-alpha.20

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/wagmi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lens-protocol/wagmi",
"version": "3.0.0-alpha.20",
"version": "3.0.0-alpha.21",
"description": "wagmi bindings for @lens-protocol/react",
"repository": {
"directory": "packages/wagmi",
Expand Down
Loading