Correctly serialize baseurl/FooResource references

This PR fixes #659.
The cause was found to be in the parsing of reference values as IdDt or IdType objects. Given an example reference value of 'http://my.org/Foo', 'my.org' was treated as the resource type while 'Foo' was treated as the resource id, which I believe is wrong.
setValue() was hence modified such that when it encounters an url of the aforementioned form, it'll treat 'Foo' as the resource type rather than the id. It also sets a number of internal variables such that a call to getValue() will give the correct output.

Coverage increased (+0.02%) to 76.931% when pulling 11aa1c5a9e66c3855f50100d8c804f0f6eb2fadd on CarthageKing:bugfix-issue659 into f917977081fd67706359d1d9660c86e8afd1f95e on jamesagnew:master.

Thanks for the PR! Merging now


Update rspamd to 3.1 and add lewo as co-maintainer

Motivation for this change
I added myself as rspamd comaintainer because I'm maintaining nixos-mailserver which relies on rpsamd.
Things done

Built on platform(s)

[ ] x86_64-linux
[ ] aarch64-linux
[ ] x86_64-darwin
[ ] aarch64-darwin

[ ] For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
[ ] Tested, as applicable:

NixOS test(s) (look inside nixos/tests)
and/or package tests
or, for functions and "core" functionality, tests in lib/tests or pkgs/test
made sure NixOS tests are linked to the relevant packages

[ ] Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
[ ] Tested basic functionality of all binary files (usually in ./result/bin/)
21.11 Release Notes (or backporting 21.05 Release notes)

[ ] (Package updates) Added a release notes entry if the change is major or breaking
[ ] (Module updates) Added a release notes entry if the change is significant
[ ] (Module addition) Added a release notes entry if adding a new NixOS module

[ ] Fits CONTRIBUTING.md.

@GrahamcOfBorg test rspamd


gtklock-userinfo-module: 2.0.0 -> 2.1.0

Automatic update generated by nixpkgs-update tools. This update was made based on information from https://github.com/jovanlanik/gtklock-userinfo-module/releases.
meta.description for gtklock-userinfo-module is: Gtklock module adding user info to the lockscreen
meta.homepage for gtklock-userinfo-module is: https://github.com/jovanlanik/gtklock-userinfo-module
Updates performed

Version update

To inspect upstream changes

Release on GitHub

Compare changes on GitHub

Impact

Checks done (click to expand)

built on NixOS
The tests defined in passthru.tests, if any, passed
found 2.1.0 in filename of file in /nix/store/99z7sn3h8ibw0w0348cb983g7gi9780j-gtklock-userinfo-module-2.1.0

Rebuild report (if merged into master) (click to expand)

1 total rebuild path(s)

1 package rebuild(s)

First fifty rebuilds by attrpath
gtklock-userinfo-module

Instructions to test this update (click to expand)

Either download from Cachix:
nix-store -r /nix/store/99z7sn3h8ibw0w0348cb983g7gi9780j-gtklock-userinfo-module-2.1.0 \
  --option binary-caches 'https://cache.nixos.org/ https://nix-community.cachix.org/' \
  --option trusted-public-keys '
  nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
  cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
  '

(The Cachix cache is only trusted for this store-path realization.)
For the Cachix download to work, your user must be in the trusted-users list or you can use sudo since root is effectively trusted.
Or, build yourself:
nix-build -A gtklock-userinfo-module https://github.com/r-ryantm/nixpkgs/archive/13fcd1f2e58f4e883a90ee36c6b9189ec264230b.tar.gz

After you've downloaded or built it, look at the files and if there are any, run the binaries:
ls -la /nix/store/99z7sn3h8ibw0w0348cb983g7gi9780j-gtklock-userinfo-module-2.1.0
ls -la /nix/store/99z7sn3h8ibw0w0348cb983g7gi9780j-gtklock-userinfo-module-2.1.0/bin

Pre-merge build results
We have automatically built all packages that will get rebuilt due to
this change.
This gives evidence on whether the upgrade will break dependent packages.
Note sometimes packages show up as failed to build independent of the
change, simply because they are already broken on the target branch.
Result of nixpkgs-review run on x86_64-linux 1

1 package built:

gtklock-userinfo-module

Maintainer pings
cc @Aleksanaa for testing.

@ofborg build gtklock-userinfo-module gtklock-userinfo-module.passthru.tests


Update externally-managed-infrastructure docs

What this PR does / why we need it:
Added a callout and link to more documentation with more networking
examples to better help users locate the more in-depth docs.
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #121

This adds the call out in a nice info box


Feature/6266 add organizations from file

Is this PR redundant now?

Is this PR redundant now?

Yes, I'll remove it. Thx:)


[continuelist addon] Increment numbers when item is added to the middle

Per #5030, when adding new items to the middle of a Markdown list, the remaining list numbers should automatically increment.

Looks good. Merged as 97290a68


spl: init at 0.3.2

Description of changes
Added SPL, a stack-based scripting language. Some SPL code can be found at https://git.tudbut.de/TudbuT/mkfunction/src/branch/main/mkpolynomial.spl . Repository is at https://git.tudbut.de/tudbut/spl .
Things done

Built on platform(s)

[x] x86_64-linux
[x] aarch64-linux
[ ] x86_64-darwin
[ ] aarch64-darwin

For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)

[ ] sandbox = relaxed
[ ] sandbox = true

[ ] Tested, as applicable:

NixOS test(s) (look inside nixos/tests)
and/or package tests
or, for functions and "core" functionality, tests in lib/tests or pkgs/test
made sure NixOS tests are linked to the relevant packages

[x] Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
[x] Tested basic functionality of all binary files (usually in ./result/bin/)
24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)

[ ] (Package updates) Added a release notes entry if the change is major or breaking
[ ] (Module updates) Added a release notes entry if the change is significant
[ ] (Module addition) Added a release notes entry if adding a new NixOS module

[x] Fits CONTRIBUTING.md.

Add a :+1: reaction to pull requests you find important.

Waiting for darwin build

Is it normal for that darwin build to take this long?

Oh sorry, at least x86_64-darwin seems okay, less unlikely to cause a build failure


[tool_crash] ProcessException: Process exited abnormally:Command line invocation:    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -listxcodebuild: error: Could not resolve package dependencies:  Packages are not supported when using legacy build locations, but the current project has them enabled. Command: xcrun, OS error code: 74

Command
flutter build ios

Steps to Reproduce

...
...
...

Logs
ProcessException: Process exited abnormally:
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -list
xcodebuild: error: Could not resolve package dependencies:
Packages are not supported when using legacy build locations, but the current project has them enabled. Command: xcrun, OS error code: 74
#0      RunResult.throwException (package:flutter_tools/src/base/process.dart:171:5)
#1      _DefaultProcessUtils.run (package:flutter_tools/src/base/process.dart:323:19)
<asynchronous suspension>
#2      XcodeProjectInterpreter.getInfo (package:flutter_tools/src/ios/xcodeproj.dart:416:30)
<asynchronous suspension>
#3      IosProject.projectInfo (package:flutter_tools/src/project.dart:565:29)
<asynchronous suspension>
#4      IosProject.buildSettingsForBuildInfo (package:flutter_tools/src/project.dart:547:35)
<asynchronous suspension>
#5      IosProject._parseProductBundleIdentifier (package:flutter_tools/src/project.dart:489:50)
<asynchronous suspension>
#6      IosProject.productBundleIdentifier (package:flutter_tools/src/project.dart:466:41)
<asynchronous suspension>
#7      BuildableIOSApp.fromProject (package:flutter_tools/src/application_package.dart:423:36)
<asynchronous suspension>
#8      ApplicationPackageFactory.getPackageForPlatform (package:flutter_tools/src/application_package.dart:88:15)
<asynchronous suspension>
#9      _BuildIOSSubCommand.buildableIOSApp (package:flutter_tools/src/commands/build_ios.dart:200:26)
<asynchronous suspension>
#10     _BuildIOSSubCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:230:33)
<asynchronous suspension>
#11     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1120:12)
<asynchronous suspension>
#12     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:975:27)
<asynchronous suspension>

[✓] Flutter (Channel master, 1.24.0-8.0.pre.287, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-ID)
    • Flutter version 1.24.0-8.0.pre.287 at /Users/1980media/flutter
    • Framework revision 94ca7b4ad2 (5 hours ago), 2020-11-18 10:14:38 +0800
    • Engine revision 94e217bcf6
    • Dart version 2.12.0 (build 2.12.0-50.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/1980media/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0, Build version 12A8189n
    • CocoaPods version 1.10.0

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 49.0.1
    • Dart plugin version 192.8052
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.

Flutter Application Metadata
Type: app
Version: 3.0.0+3
Material: true
Android X: false
Module: false
Plugin: false
Android package: null
iOS bundle identifier: null
Creation channel: unknown
Creation framework version: 27321ebbad34b0a3fafe99fac037102196d655ff
Plugins
cloud_firestore-0.13.7
cloud_firestore_web-0.1.1+2
file_picker-1.13.3
firebase_auth-0.16.1
firebase_auth_web-0.1.3+1
firebase_core-0.4.5
firebase_core_web-0.1.1+2
flutter_facebook_login-3.0.0
flutter_keyboard_visibility-2.0.0
flutter_plugin_android_lifecycle-1.0.8
google_sign_in-4.5.1
google_sign_in_web-0.9.1+1
jitsi_meet-0.1.9
path_provider_linux-0.0.1+2
permission_handler-3.3.0
share-0.6.4+3
shared_preferences-0.5.8
shared_preferences_linux-0.0.2+1
shared_preferences_macos-0.0.1+10
shared_preferences_web-0.1.2+7
url_launcher-5.5.0
url_launcher_linux-0.0.1+1
url_launcher_macos-0.0.1+7
url_launcher_web-0.1.2

@aldyarviansyah
There's similar open issue describing your case, 57083.
Please follow-up there for updates. Also check this to see if this workaround works for you.
Closing this as duplicate.


How to split store in different files? And the limits of object type inference

Hello,
I would simply like to split a store in different files and especially to make my different store parts (state, getter, actions) able to inherit from interface, abstract classes, etc..
Furthermore, splitting parts of a Pinia store seems to break the this usage.
As Pinia seems to not really be typed (cause it is only based on object type inference), we just can't split the different parts of a store.
I really wonder why  Pinia didn't do like vuex-smart-module allowing to have strong typing through classes usage and to use directly the type of each parts of a store without creating redundant Interface types.
People easily say, "oh classes usage like in vuex-smart-module is more verbose cause you have to specify generics", but when you have to use State, Getter or Action TYPE,  you clearly don't want to write/specify n interfaces with k methods for each part a store.
It is common for a lot of projects with strong architecture to have for requirement the need of an abstraction between different parts of different stores.
Example two instances of store like:
ProjectResourceStore and HomeResourceStore having each one Action inheriting from the same abstract class AResourceActions.
What is really useful is that AResourceActions allows having default implementations and specifying a "contract".
ProjectResourceAction and HomeResourceAction will be obligated to implement all non-implemented AResourceActions methods.
What I say above seems to be clearly impossible with Pinia as it has only object type inference.
It's also important to understand  that with classes if I want to have a Type of a store part (State, Getter, Action), I don't have to manually specify all the properties/methods in a redundant Interface that will be used as a way to have non-infered type.
Indeed, with classes, I can directly use the class as a Type.
This problem has already been mentioned here: #343, but my issue just try to expose the problem with other related issues and limitations of Pinia type system.
Also, no satisfying code example in the original issue has been provided.

It would be nice to document how to split the store into multiple files or functions when needed but the problem has always been mentioned without code samples. It is crucial that real-world examples are provided to better understand what kind of splitting is needed.
So far I identified these possibilities:

Splitting actions or getters into functions that receive everything needed as parameters (Store type or ReturnType<typeof useStore> could be useful)
Splitting a store into smaller stores
Using a setup store to split the store into smaller functions that are composables

Regarding the class types, that's a completely different paradigm and, like vuex-smart-module, it should exist in a separate package. I don't use vuex-smart-module but you seem to like it very much, you should write a similar plugin for pinia!

It would be nice to document how to split the store into multiple files

This is a considerably prevalent design pattern (using Vuex 4 currently) for my team, and we'd like to continue using it.

So far I identified these possibilities:

Splitting actions or getters into functions that receive everything needed as parameters (Store type or ReturnType<typeof useStore> could be useful)
Splitting a store into smaller stores
Using a setup store to split the store into smaller functions that are composables

@posva Have you had the chance to try any of these options you've listed? I'm just curious if anyone has figured out a clean way to implement this before I deep dive this weekend. I'd be happy to (attempt to) contribute if supporting this pattern is indeed a direction you'd like to go in with Pinia.
In any case, I'm super impressed with Pinia and look forward to adopting it across our projects over the next year!

Maybe I'll put something, that will be usefull to this discussion. So far I came across with this example that is working well for me with pinia store.

It is crucial that real-world examples are provided to better understand what kind of splitting is needed.

And according to this, I provided a real-world example. I have some common CRUD getters and actions that I want to use in multiple stores.
baseCrud.ts file:
import axios from 'axios';

export interface CrudState {
  loading: boolean;
  items: any[];
  apiUrl: string;
}

export function crudState(apiCollectionUrl: string) {
  return (): CrudState => ({
    loading: false,
    items: [],
    apiUrl: `http://localhost:8080/api/${apiCollectionUrl}`,
  });
}

export function crudGetters() {
  return {
    allItems: (state:CrudState) => state.items,
    getById():any {
      return (id) => this.allItems.find((x) => x.id === id);
    },
  };
}

export function crudActions() {
  return {
    async initStore() {
      this.loading = true;
      const { data } = await axios.get(this.apiUrl);
      this.items = data;
      this.loading = false;
    },
    async clearAndInitStore() {
      this.items = [];
      await this.initStore();
    },
  };
}

taskStore.ts file in same directory:
import { defineStore } from 'pinia';
import { crudState, crudGetters, crudActions } from './baseCrud';

export default defineStore('tasks', {
  state: crudState('tasks/'),
  getters: {
    ...crudGetters(),
    // Your additional getters
    activeTasks: (state) => state.items.filter((task) => !task.done),
    allItemsCount(): number {
      return this.allItems.length;
    },
  },
  actions: {
    ...crudActions(),
    // Your additional actions
  },
});

using taskStore in main.ts file in same directory:
import useTaskStore from './taskStore';

// Autocompletion works fine here
const taskStore = useTaskStore();
taskStore.initStore();
const count = taskStore.allItemsCount;
const task = taskStore.getById(1);

This was added to https://github.com/vuejs/pinia/issues/829

Just a followup on this. The example provided by @rzym-on may run, but it fails under strict type checking. After a massive amount of sleuthing into the pinia types, I finally figured out how to split up a store into multiple files and preserve complete type checking. Here we go!
First you need to add this utility somewhere in your project. Let's assume it's in @store/:
extractStore.ts
import type {
  PiniaCustomStateProperties,
  StoreActions,
  StoreGeneric,
  StoreGetters,
  StoreState
} from 'pinia'
import type { ToRefs } from 'vue'
import { isReactive, isRef, toRaw, toRef } from 'vue'

type Extracted<SS> = ToRefs<
  StoreState<SS> & StoreGetters<SS> & PiniaCustomStateProperties<StoreState<SS>>
> &
  StoreActions<SS>

/**
 * Creates an object of references with all the state, getters, actions
 * and plugin-added state properties of the store.
 *
 * @param store - store to extract the refs from
 */
export function extractStore<SS extends StoreGeneric>(store: SS): Extracted<SS> {
  const rawStore = toRaw(store)
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
  const refs = {} as Extracted<SS>

  for (const key of Object.keys(rawStore)) {
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    const value = rawStore[key]

    if (isRef(value) || isReactive(value)) {
      // @ts-expect-error: the key is state or getter
      refs[key] = toRef(store, key)
    } else if (typeof value === 'function') {
      // @ts-expect-error: the key is state or getter
      // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
      refs[key] = value
    }
  }

  return refs
}

Now create a directory for the store. Let's assume it's @store/foo. These files go in the directory:
state.ts
export interface State {
  foo: string
  bar: number
}

export const useState = defineStore({
  id: 'repo.state',

  state: (): State => {
    return {
      foo: 'bar',
      bar: 7
    }
  }
})

getters.ts
import { computed } from 'vue'
import { useState } from './state'

export const useGetters = defineStore('repo.getters', () => {
  const state = useState()

  const foobar = computed((): string => {
    return `foo-${state.foo}`
  })

  const doubleBar = computed((): string => {
    return state.bar * 2
  })

  return {
    foobar,
    doubleBar
  }
})

actions.ts
import { useState } from './state'

export const useActions = defineStore('repo.actions', () => {
  const state = useState()

  function alertFoo(): void {
    alert(state.foo)
  }

  function incrementBar(amount = 1) {
    state.bar += amount
  }

  // Note you are free to define as many internal functions as you want.
  // You only expose the functions that are returned.
  return {
    alerttFoo,
    incrementBar
  }
})

Now you can bring all of the pieces together like this:
import { extractStore } from '@store/extractStore'
import { defineStore } from 'pinia'
import { useActions } from './actions'
import { useGetters } from './getters'
import { useState } from './state'

export const useFooStore = defineStore('foo', () => {
  return {
    ...extractStore(useState()),
    ...extractStore(useGetters()),
    ...extractStore(useActions())
  }
})

Boom! Completely typed and nicely factored. You would then import it like this:
import { useFooStore } from '@store/foo'

const store = useFooStore()
let foo = store.foo // 'bar'
foo = store.foobar // 'foo-bar'
let bar = store.doubleBar // 14
store.incrementBar(3) // store.bar === 10
bar = store.doubleBar // 20

Enjoy! 😁

Just a followup on this. The example provided by @rzym-on may run, but it fails under strict type checking. After a massive amount of sleuthing into the pinia types, I finally figured out how to split up a store into multiple files and preserve complete type checking. Here we go!
First you need to add this utility somewhere in your project. Let's assume it's in @store/:
extractStore.ts
import type {
  PiniaCustomStateProperties,
  StoreActions,
  StoreGeneric,
  StoreGetters,
  StoreState
} from 'pinia'
import type { ToRefs } from 'vue'
import { isReactive, isRef, toRaw, toRef } from 'vue'

type Extracted<SS> = ToRefs<
  StoreState<SS> & StoreGetters<SS> & PiniaCustomStateProperties<StoreState<SS>>
> &
  StoreActions<SS>

/**
 * Creates an object of references with all the state, getters, actions
 * and plugin-added state properties of the store.
 *
 * @param store - store to extract the refs from
 */
export function extractStore<SS extends StoreGeneric>(store: SS): Extracted<SS> {
  const rawStore = toRaw(store)
  const refs: Record<string, unknown> = {}

  for (const key of Object.keys(rawStore)) {
    const value: unknown = rawStore[key]

    if (isRef(value) || isReactive(value)) {
      refs[key] = toRef(store, key)
    } else if (typeof value === 'function') {
      refs[key] = value
    }
  }

  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
  return refs as Extracted<SS>
}

Now create a directory for the store. Let's assume it's @store/foo. These files go in the directory:
state.ts
export interface State {
  foo: string
  bar: number
}

export const useState = defineStore({
  id: 'repo.state',

  state: (): State => {
    return {
      foo: 'bar',
      bar: 7
    }
  }
})

getters.ts
import { computed } from 'vue'
import { useState } from './state'

export const useGetters = defineStore('repo.getters', () => {
  const state = useState()

  const foobar = computed((): string => {
    return `foo-${state.foo}`
  })

  const doubleBar = computed((): string => {
    return state.bar * 2
  })

  return {
    foobar,
    doubleBar
  }
})

actions.ts
import { useState } from './state'

export const useActions = defineStore('repo.actions', () => {
  const state = useState()

  function alertFoo(): void {
    alert(state.foo)
  }

  function incrementBar(amount = 1) {
    state.bar += amount
  }

  // Note you are free to define as many internal functions as you want.
  // You only expose the functions that are returned.
  return {
    alerttFoo,
    incrementBar
  }
})

Now you can bring all of the pieces together like this:
import { extractStore } from '@store/extractStore'
import { defineStore } from 'pinia'
import { useActions } from './actions'
import { useGetters } from './getters'
import { useState } from './state'

export const useFooStore = defineStore('foo', () => {
  return {
    ...extractStore(useState()),
    ...extractStore(useGetters()),
    ...extractStore(useActions())
  }
})

Boom! Completely typed and nicely factored. You would then import it like this:
import { useFooStore } from '@store/foo'

const store = useFooStore()
let foo = store.foo // 'bar'
foo = store.foobar // 'foo-bar'
let bar = store.doubleBar // 14
store.incrementBar(3) // store.bar === 10
bar = store.doubleBar // 20

Enjoy! 😁

@aparajita thank you! but how to access getters inside of actions?

@Grawl the getters are just a regular store with access to your state.
actions.ts
import { useGetters } from './getters'
import { useState } from ['./state']()

export const useActions = defineStore('repo.actions', () => {
  const state = useState()
  const getters = useGetters()

  function alertFoo(): void {
    alert(getters.doubleBar)
  }
}

@aparajita It sounds like an anti-pattern to define different stores for state, actions and getters.

Yes @mahmoudsaeed, I think the same it is really hacky and a bad pattern, hope there will be a real fix.

@mahmoudsaeed Thanks for stating the obvious. Feel free to find a more elegant workaround.

@mahmoudsaeed and @nicolidin, I should add that I was actually following @posva's earlier suggestion to split up a store into smaller stores, so if it's an anti-pattern you can blame him! I was unable to get his other suggestions to work with strict type checking — it requires some serious TypeScript ninja skills because of the way pinia infers types.
Obviously it would be nice if we had an easier way to split up stores.

@aparajita I think @posva meant to say splitting up a store into smaller single file stores.

As I said before, if you can figure out a way to split up a store that is completely type safe and retains type inference, please do. Since you have the time to criticize others, maybe you would be kind enough to spend the time and effort to come up with a better solution.

@mahmoudsaeed I am just as eager as you to have an official solution that is not a hack.

@aparajita I'm with you. I am thinking of migrating to Pinia but would rather not until there is an official way to break a store into modules and keep good type safety.

@fgarit-te Then bug @posva to show us how — or make whatever changes are necessary to make it possible.
Note that my technique, though a bit of a hack, is quite clean and maintains complete type safety. The benefits of using Pinia are worth it.

Re: well actually, this is pretty typesafe
import { defineStore, Store } from 'pinia';

type State = {
    someNumber: number;
};

type Getters = {
    someNumberPlusOne: number;
    someNumberPlusOneTimesTwo: number;
};

type Actions = {
    setSomeNumber: (newNumber: number) => Promise<void>;
    wrappedSetSomeNumber: (newNumber: number) => Promise<void>;
};

type SomeNumberStore = Store<'someNumber', State, Getters, Actions>;

const getters: PiniaGetterAdaptor<Getters, SomeNumberStore> = {
    someNumberPlusOne(state) {
        return state.someNumber + 1;
    },
    someNumberPlusOneTimesTwo() {
        return this.someNumberPlusOne * 2;
    },
};

const actions: PiniaActionAdaptor<Actions, SomeNumberStore> = {
    async setSomeNumber(newNumber: number) {
        this.someNumber = newNumber;
    },
    async wrappedSetSomeNumber(newNumber: number) {
        this.setSomeNumber(newNumber);
    },
};

export default defineStore('someNumber', {
    state: (): State => ({
        someNumber: 12,
    }),
    getters,
    actions,
});

type PiniaActionAdaptor<
    Type extends Record<string, (...args: any) => any>,
    StoreType extends Store,
> = {
    [Key in keyof Type]: (this: StoreType, ...p: Parameters<Type[Key]>) => ReturnType<Type[Key]>;
};

type PiniaGetterAdaptor<GettersType, StoreType extends Store> = {
    [Key in keyof GettersType]: (this: StoreType, state: StoreType['$state']) => GettersType[Key];
};

And a sample component:
<template>

someNumberPlusOnTimesTwoDividedByThree: {{ someNumberPlusOnTimesTwoDividedByThree }}

        <button @click="setRandomNumber">setRandomNumber</button>

</template>

@fgarit Brilliant! I knew it was just a matter of finding someone who was better at TypeScript than me. 😁
It's almost working for me. I successfully split the state, getters and actions into separate files, but I'm getting an error in const actions: PiniaActionAdaptor<Actions, SomeStore>. TS is complaining about Actions:
TS2344: Type 'Actions' does not satisfy the constraint 'Record<string, (...args: any) => any>'.
Index signature for type 'string' is missing in type 'Actions'.

Are you not getting that error? If not, it may be a difference in our tsconfig. Here's the relevant part of mine:
{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "declaration": false,
    "declarationMap": false,
    "esModuleInterop": true,
    "exactOptionalPropertyTypes": true,
    "importsNotUsedAsValues": "error",
    "module": "esnext",
    "moduleResolution": "node",
    "noFallthroughCasesInSwitch": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noPropertyAccessFromIndexSignature": false,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": false,
    "noUnusedParameters": true,
    "pretty": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "strict": true,
    "target": "esnext",
    "types": [
      "node"
    ],
    "useDefineForClassFields": true,
    "useUnknownInCatchVariables": true,
    "lib": ["esnext", "dom"],
}

@aparajita I tested with your tsconfig and it's fine but judging from the error you get, it's the way your Actions type is setup, it should be something like:
type Actions = {
    someActionName: (params: any) => any;
}

@aparajita I tested with your tsconfig and it's fine but judging from the error you get, it's the way your Actions type is setup, it should be something like:
type Actions = {
    someActionName: (params: any) => any;
}

@fgarit Okay, the issue was my @typescript-eslint rules change object type declarations into interfaces. Changing it back to a type removed the Actions error.
This is a very interesting behavior of TypeScript; apparently TS requires an interface which extends Record<string, any> to have a [string: any] index signature, but does NOT for the equivalent type.
However, I'm now getting a very deep TS error with my code, which is a much more complex example. I'm not going to ask you to debug it, so unfortunately I'll have to abandon your approach.

If doesn't exist an official solution for this, why this issue is closed ?
I'm trying to port a big frontend application and the first thing is to split the huge state/actions modules and is a disappointment to see a poor doc for the new official state management of Vue community.
Coming from other libs and communities, I see Vue (and its libraries) is lacking behind in the documentation. Just recently the docs was revamped for Vue 3.
Back to the problem, I have solution to splitting problem, but the typing isn't 100% accurate, because my types like:
filterGroups: FilterGroupModel[] in a splitted state file is now infereced into an actions file, for example: FilterState.filterGroups: {id: number, groupName: string, groupTag: string, etc... when it should see the FilterGroupModel type there

If doesn't exist an official solution for this, why this issue is closed ?
I'm trying to port a big frontend application and the first thing is to split the huge state/actions modules and is a disappointment to see a poor doc for the new official state management of Vue community.
Coming from other libs and communities, I see Vue (and its libraries) is lacking behind in the documentation. Just recently the docs was revamped for Vue 3.
Back to the problem, I have solution to splitting problem, but the typing isn't 100% accurate, because my types like:
filterGroups: FilterGroupModel[] in a splitted state file is now infereced into an actions file, for example: FilterState.filterGroups: {id: number, groupName: string, groupTag: string, etc... when it should see the FilterGroupModel type there

What solution did you use for typing? I have had the same issue btw with types loosing their original reference.

I envy your communication environment, thanks again, I got some ideas for writing code from the comments.

@fgarit @aislanmaia If it's the problem I think you're talking about, this is a known problem. For reference:
https://github.com/vuejs/pinia/issues/491
https://github.com/vuejs/pinia/issues/871

@fgarit @aislanmaia If it's the problem I think you're talking about, this is a known problem. For reference:
#491 #871

In other words I need, for now, to force typing by casting for every state usage?

In other words I need, for now, to force typing by casting for every state usage?

Not if you use my technique.

Just a followup on this. The example provided by @rzym-on may run, but it fails under strict type checking. After a massive amount of sleuthing into the pinia types, I finally figured out how to split up a store into multiple files and preserve complete type checking. Here we go!
First you need to add this utility somewhere in your project. Let's assume it's in @store/:
extractStore.ts
import type {
  PiniaCustomStateProperties,
  StoreActions,
  StoreGeneric,
  StoreGetters,
  StoreState
} from 'pinia'
import type { ToRefs } from 'vue'
import { isReactive, isRef, toRaw, toRef } from 'vue'

type Extracted<SS> = ToRefs<
  StoreState<SS> & StoreGetters<SS> & PiniaCustomStateProperties<StoreState<SS>>
> &
  StoreActions<SS>

/**
 * Creates an object of references with all the state, getters, actions
 * and plugin-added state properties of the store.
 *
 * @param store - store to extract the refs from
 */
export function extractStore<SS extends StoreGeneric>(store: SS): Extracted<SS> {
  const rawStore = toRaw(store)
  const refs: Record<string, unknown> = {}

  for (const [key, value] of Object.entries(rawStore)) {
    if (isRef(value) || isReactive(value)) {
      refs[key] = toRef(store, key)
    } else if (typeof value === 'function') {
      refs[key] = value
    }
  }

  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
  return refs as Extracted<SS>
}

Now create a directory for the store. Let's assume it's @store/foo. These files go in the directory:
state.ts
export interface State {
  foo: string
  bar: number
}

export const useState = defineStore({
  id: 'repo.state',

  state: (): State => {
    return {
      foo: 'bar',
      bar: 7
    }
  }
})

getters.ts
import { computed } from 'vue'
import { useState } from './state'

export const useGetters = defineStore('repo.getters', () => {
  const state = useState()

  const foobar = computed((): string => {
    return `foo-${state.foo}`
  })

  const doubleBar = computed((): string => {
    return state.bar * 2
  })

  return {
    foobar,
    doubleBar
  }
})

actions.ts
import { useState } from './state'

export const useActions = defineStore('repo.actions', () => {
  const state = useState()

  function alertFoo(): void {
    alert(state.foo)
  }

  function incrementBar(amount = 1) {
    state.bar += amount
  }

  // Note you are free to define as many internal functions as you want.
  // You only expose the functions that are returned.
  return {
    alerttFoo,
    incrementBar
  }
})

Now you can bring all of the pieces together like this:
import { extractStore } from '@store/extractStore'
import { defineStore } from 'pinia'
import { useActions } from './actions'
import { useGetters } from './getters'
import { useState } from './state'

export const useFooStore = defineStore('foo', () => {
  return {
    ...extractStore(useState()),
    ...extractStore(useGetters()),
    ...extractStore(useActions())
  }
})

Boom! Completely typed and nicely factored. You would then import it like this:
import { useFooStore } from '@store/foo'

const store = useFooStore()
let foo = store.foo // 'bar'
foo = store.foobar // 'foo-bar'
let bar = store.doubleBar // 14
store.incrementBar(3) // store.bar === 10
bar = store.doubleBar // 20

Enjoy! 😁

best solution

Thanks for the tips above. Here is how I've separated each actions, getters, state in files while keeping types:
A single file exporting all my stores (I prefer it this way when importing stores in components):
Folder /stores
File /index.ts
export const useUIStore = defineStore('ui', {
  state: () => uiStoreState,
  actions: uiStoreActions,
})

export const useAuthStore = defineStore('auth', {
  state: () => authStoreState,
  getters: authStoreGetters,
  actions: authStoreActions,
})

File /types.ts
export type PiniaActionAdaptor<
  Type extends Record<string, (...args: any) => any>,
  StoreType extends Store,
> = {
  [Key in keyof Type]: (
    this: StoreType,
    ...p: Parameters<Type[Key]>
  ) => ReturnType<Type[Key]>
}

Folder /auth
File /types.ts
import { Store } from 'pinia'

export interface AuthStoreState {
  isAuthenticated: boolean
  errorMessage: null | string
}

export type AuthStoreActions = {
  signIn: (credentials: Credentials) => Promise<void>
  resetErrorMessage: () => void
  logout: () => Promise<void>
}

export type AuthStoreGetters = {}

export type AuthStore = Store<
  'auth',
  AuthStoreState,
  AuthStoreGetters,
  AuthStoreActions
>

File /state.ts
import { AuthStoreState } from './types'

export const authStoreState: AuthStoreState = {
  isAuthenticated: false,
  errorMessage: null,
}

File /actions.ts
export const authStoreActions: PiniaActionAdaptor<AuthStoreActions, AuthStore> =
  {
    signIn,
    logout,
    resetErrorMessage() {
      this.errorMessage = null
    },
  }

In a dedicated folder called /actions I put all my actions in separate files:
File /logout.ts
import { useUserStore } from '@/stores'
import { AuthStore } from '../types'

export async function logout(this: AuthStore) {
  this.isAuthenticated = false
  useUserStore().setUser(null)
  router.push({ name: RoutesNames.Home })
}

hi @alexisjamet
I have seen your code snippets, but I still don't know how to use actions in state ? and using getters, can you share clearer code snippets? thanks

@tunngtv you can create a plugin call it helper or whatever
take note of app.use(createPinia()); &   app.config.globalProperties.$auth = helper;  you can formulate yours using below after creating your store

import { Helper, Erre, Freg, $Logi } from '../components/models/model';
import { Notify } from 'quasar';
import { axiosInstance } from './axios';
import { boot } from 'quasar/wrappers';
import { createPinia } from 'pinia';
import { useAuthStore } from '../store/auth';

declare module '@vue/runtime-core' {
  interface ComponentCustomProperties {
    $auth: Helper;
  }
}

export default boot(({ app, router, store }) => {
  app.use(createPinia());

  const storeX = useAuthStore(store);
  axiosInstance.interceptors.response.use(
    (response) => {
      return response;
    },
    async (e) => {
      const error: Erre = <Erre>e;
      if (!error.response) {
        Notify.create({
          message: 'Internet connection error',
          color: 'red',
        });
        return { data: { status: 0 } };
      } else if (error.response && error.response.status === 500) {
        Notify.create({
          color: 'negative',
          textColor: 'white',
          message:
            'Something went wrong refresh and try again or contact admin',
        });
        return { data: { status: 0 } };
      } else if (
        error?.response?.data &&
        (error?.response?.data?.message === 'Unauthenticated.' ||
          error?.response?.status === 401 ||
          error?.response?.status === 419)
      ) {
        const logout = <boolean>await storeX.applogout();
        if (logout) {
          window.location.reload();
        }
      } else if (error?.response?.status === 404) {
        return { data: error?.response?.data };
      }
      return { data: { status: 446 } };
    }
  );

  router.beforeEach(async (to, _from, next) => {
    await fetcher();
    const isLogin = loggedIn();
    const autPath = [
      '/login',
      '/register',
      '/password',
      '/forget-password',
    ].includes(to.path);
    if (to.meta.auth && !isLogin) {
      next('/login');
    } else if (autPath && isLogin) {
      next('/welcome');
    } else {
      next();
    }
  });

  const helper = <Helper>{
    register: {},
    loggedIn: {},
    check: {},
    login: {},
    logout: {},
    passwordForgot: {},
    passwordReset: {},
    updateuser: {},
    firstlogin: {},
    newfetch: {},
    fetch: {},
    user: {},
    userUpdate: {},
  };

  function loggedIn() {
    const loggedIn = storeX.loggedIn;
    return loggedIn;
  }

  function logoutF() {
    const lof = storeX.logout();
    return lof;
  }

  async function fetcher() {
    const fet: boolean = <boolean>storeX.fetch();
    return fet;
  }

  function user() {
    const usr = storeX.user;
    return usr;
  }

  function check(roles: string | string[]) {
    const chk = storeX.check(roles);
    return chk;
  }

  helper.register = async (data) => {
    const reg: number | string | Freg = <number | string | Freg>(
      await storeX.register(data)
    );
    return reg;
  };

  helper.loggedIn = loggedIn;
  helper.check = check;
  helper.logout = logoutF;
  helper.login = async (data) => {
    return <boolean | $Logi>await storeX.login(data);
  };
  helper.updateuser = async (data) => {
    return storeX.updateuser(data);
  };

  helper.firstlogin = async (data) => {
    return <boolean>storeX.firstlogin(data);
  };

  helper.userUpdate = async (data) => {
    return <boolean>storeX.userUpdate(data);
  };
  helper.fetch = fetcher;
  helper.user = user;
  app.config.globalProperties.$auth = helper;
});

@diadal
thanks for your answer, but i want to separate the state, action, getters parts in separate files and will import them into the index file, with Vuex it will be easy to do that, i just learned Pinia and everything is fine, I followed the above instructions by @alexisjamet, but I can't seem to access the action, below is my code using
ProfilePage.vue
`

`
constants.ts file
`import { Store } from 'pinia';
export type PiniaActionAdaptor<
Type extends Record<string, (...args: any) => any>,
StoreType extends Store,

= {
[Key in keyof Type]: (
this: StoreType,
...p: Parameters<Type[Key]>
) => ReturnType<Type[Key]>;
};

export interface AuthStoreState {
isAuthenticated: boolean;
errorMessage: null | string;
}
export type AuthStoreActions = {
changeMessage: () => void;
};
export type AuthStoreGetters = Record<string, unknown>;
export type AuthStore = Store<'auth', AuthStoreState, AuthStoreGetters, AuthStoreActions>;
`
Folder Store: state.ts file
`import { AuthStoreState } from '../constants';
export const authStoreState: AuthStoreState = {
isAuthenticated: false,
errorMessage: 'aa',
};`
Folder Store: actions.ts file
`import { AuthStore } from './constants';
export async function logout(this: AuthStore) {
this.isAuthenticated = !this.isAuthenticated;
}`
Folder Store: index.ts file
`import { defineStore } from 'pinia';
import { authStoreState } from './state';
import { authStoreActions } from './actions';
export const useAuthStore = defineStore('auth', {
state: () => authStoreState,
getters: {},
actions: {
...authStoreActions,
},
});`
i tried creating an actions file outside the store folder, and importing it into SFC vue used to change the state everything seems fine but i don't know how to use actions ?
actions.ts
`import { AuthStore } from './constants';
export async function logout(this: AuthStore) {
this.isAuthenticated = !this.isAuthenticated;
}
`

@diadal
thanks for your answer, but i want to separate the state, action, getters parts in separate files and will import them into the index file, with Vuex it will be easy to do that, i just learned Pinia and everything is fine, I followed the above instructions by @alexisjamet, but I can't seem to access the action, below is my code using
ProfilePage.vue
<template>

Profile Page

        Error Message: {{ getErrorMessage }}

        isAuthenticated: {{ isAuthenticated }}
        <button @click="changeMessageToStore">Change Message</button>

</template>

constants.ts file
import { Store } from 'pinia';

export type PiniaActionAdaptor<
    Type extends Record<string, (...args: any) => any>,
    StoreType extends Store,
> = {
    [Key in keyof Type]: (
        this: StoreType,
        ...p: Parameters<Type[Key]>
    ) => ReturnType<Type[Key]>;
};

export interface AuthStoreState {
    isAuthenticated: boolean;
    errorMessage: null | string;
}

export type AuthStoreActions = {
    changeMessage: () => void;
};

export type AuthStoreGetters = Record<string, unknown>;

export type AuthStore = Store<'auth', AuthStoreState, AuthStoreGetters, AuthStoreActions>;

Folder Store: state.ts file
import { AuthStoreState } from '../constants';

export const authStoreState: AuthStoreState = {
    isAuthenticated: false,
    errorMessage: 'aa',
};

Folder Store: actions.ts file
import { PiniaActionAdaptor, AuthStoreActions, AuthStore } from '../constants';

export const authStoreActions: PiniaActionAdaptor<AuthStoreActions, AuthStore> = {
    changeMessage() {
        this.errorMessage = 'hhh';
    },
};

Folder Store: index.ts file
import { defineStore } from 'pinia';
import { authStoreState } from './state';
import { authStoreActions } from './actions';

export const useAuthStore = defineStore('auth', {
    state: () => authStoreState,
    getters: {},
    actions: {
        ...authStoreActions,
    },
});

i tried creating an actions file outside the store folder, and importing it into SFC vue used to change the state everything seems fine but i don't know how to use actions ?
actions.ts
import { AuthStore } from './constants';

export async function logout(this: AuthStore) {
    this.isAuthenticated = !this.isAuthenticated;
}

you can separate it simple

actions.ts
import { axiosInstance, appClient } from '../../boot/axios';
import { Regs, Sget, User, UserKey } from '../../components/models/model';
import { UserDat } from '../../components/models/acclist';
import { RepUser } from '../../components/models/StoreInterFace';

import { useState } from './state';
import { defineStore } from 'pinia';

const REGISTER_ROUTE = '/register';
const LOGIN_ROUTE = '/login';
const AUTH_LOGOUT = '/logout';

const empty = UserDat;

export const useActions = defineStore('auth.actions', () => {
  const state = useState();

  async function register(data: Regs) {
    try {
      const r = await axiosInstance.post(REGISTER_ROUTE, data);
      return r.data;
    } catch (error) {

      return false;
    }
  }

  async function login(data: Regs) {
    try {
      const response: {
        data: { status: boolean; data: { user: User; data: string } };
      } = await axiosInstance.post(LOGIN_ROUTE, data);
      const mainData = response?.data?.data;
      const user = mainData?.user;
      if (user) {
        state.user = user;
        const to: string = mainData.data;
        axiosInstance.defaults.headers.common = {
          'content-type': 'application/json',
          'X-Requested-With': 'XMLHttpRequest',
          'M-Version': process.env.APP_VERSION,
          'M-Client': appClient,
          Authorization: `Bearer ${to}`,
        };
        return <RepUser>{ status: true };
      }
      const rep = <RepUser>(
        (response?.data?.data ? response?.data?.data : response?.data)
      );
      return rep;
    } catch (ee) {
      return false;
    }
  }

  function firstlogin(data: { user: User; data: string }) {
    if (data?.user) {
      const newdata = data.user;
      state.user = newdata;
      const to: string = data.data;
      axiosInstance.defaults.headers.common = {
        'content-type': 'application/json',
        'X-Requested-With': 'XMLHttpRequest',
        Authorization: `Bearer ${to}`,
      };
      return true;
    }
  }

  function updateuser(data: { tok: string; user: User }) {
    const newdata = data.user;
    state.user = newdata;
    return true;
  }

  function userUpdate(data: { id: string; value: boolean | string }) {
    const updateSate = <UserKey>(<unknown>state.user);
    updateSate[data.id] = data.value;
    return true;
  }

  function fetch() {

  }

  async function applogout() {

  }

  async function logout() {

  }
  return {
    register,
    login,
    updateuser,
    userUpdate,
    firstlogin,
    fetch,
    applogout,
    logout,
  };
});

getters.ts
import { defineStore } from 'pinia';
import { computed } from 'vue';
import { User } from '../../components/models/model';
import { useState } from './state';

export const useGetters = defineStore('auth.getters', () => {
  const state = useState();

  const user = computed((): User => {
    return state.user;
  });

  const loggedIn = computed((): boolean => {
    return state.user.login;
  });

  const check = (roles: string | string[]) => {
    const user = state.user;
    if (user && user.roleNames.length > 0) {
      if (Array.isArray(roles) && roles.length) {
        for (const role of roles) {
          if (!user.roleNames.includes(String(role))) {
            return false;
          }
        }
      } else if (roles) {
        const nrole: string = <string>roles;
        if (!user.roleNames.includes(nrole)) {
          return false;
        }
      }
      return true;
    }
    return false;
  };

  return {
    user,
    loggedIn,
    check,
  };
});

index.ts
import { extractStore } from '../extractStore';
import { defineStore } from 'pinia';
import { useActions } from './actions';
import { useGetters } from './getters';
import { useState } from './state';

export const useAuthStore = defineStore('auth', () => {
  return {
    ...extractStore(useState()),
    ...extractStore(useGetters()),
    ...extractStore(useActions()),
  };
});

state.ts
import { defineStore } from 'pinia';
import { UserDat } from '../../components/models/acclist';
import { State } from '../../components/models/StoreInterFace';

export const useState = defineStore({
  id: 'auth.state',
  state: (): State => {
    return {
      user: UserDat,
    };
  },
});

extractStore.ts
import type {
  PiniaCustomStateProperties,
  StoreActions,
  StoreGeneric,
  StoreGetters,
  StoreState,
} from 'pinia';
import type { ToRefs } from 'vue';
import { isReactive, isRef, toRaw, toRef } from 'vue';

type Extracted<SS> = ToRefs<
  StoreState<SS> & StoreGetters<SS> & PiniaCustomStateProperties<StoreState<SS>>
> &
  StoreActions<SS>;

/**
 * Creates an object of references with all the state, getters, actions
 * and plugin-added state properties of the store.
 *
 * @param store - store to extract the refs from
 */
export function extractStore<SS extends StoreGeneric>(
  store: SS
): Extracted<SS> {
  const rawStore = toRaw(store);
  const refs: Record<string, unknown> = {};

  for (const [key, value] of Object.entries(rawStore)) {
    if (isRef(value) || isReactive(value)) {
      refs[key] = toRef(store, key);
    } else if (typeof value === 'function') {
      refs[key] = value;
    }
  }

  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
  return refs as Extracted<SS>;
}

StoreInterFace.ts
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Store } from 'pinia';
import { Freg, Regs, User } from './model';

export type PiniaActionAdaptor<
  Type extends Record<string, (...args: any) => any>,
  StoreType extends Store
> = {
  [Key in keyof Type]: (
    this: StoreType,
    ...p: Parameters<Type[Key]>
  ) => ReturnType<Type[Key]>;
};

export type PiniaGetterAdaptor<GettersType, StoreType extends Store> = {
  [Key in keyof GettersType]: (
    this: StoreType,
    state: StoreType['$state']
  ) => GettersType[Key];
};

export type State = {
  user: User;
};

export type Getters = {
  user: User;
  loggedIn: boolean;
  check: (roles: string | string[]) => boolean;
};

export interface RepUser {
  status: boolean;
  data: { user: User; data: string };
}

export type Actions = {
  register?: (data: Regs) => Promise<number | string | Freg> | boolean;
  loggedIn?: () => boolean;
  check?: (roles: string | string[]) => boolean;
  login?: (data: Regs) => Promise<false | RepUser>;
  logout?: () => Promise<boolean>;
  applogout?: () => boolean;
  passwordForgot?: (data: string[]) => Promise<boolean | Freg>;
  passwordReset?: (data: string[]) => Promise<boolean | Freg>;
  updateuser?: (data: { id: string; user: User }) => boolean;
  userUpdate?: (data: { id: string; value: boolean | string }) => boolean;
  firstlogin?: (data: { user: User; data: string }) => boolean;
  newfetch?: () => Promise<boolean | string | User>;
  fetch?: () => boolean;
  user?: () => User;
};

export type AuthStore = Store<'auth', State, Getters, Actions>;

@diadal thanks for your answer, but i want to separate the state, action, getters parts in separate files and will import them into the index file, with Vuex it will be easy to do that, i just learned Pinia and everything is fine, I followed the above instructions by @alexisjamet, but I can't seem to access the action, below is my code using
ProfilePage.vue
<template>

Profile Page

        Error Message: {{ getErrorMessage }}

        isAuthenticated: {{ isAuthenticated }}
        <button @click="changeMessageToStore">Change Message</button>

</template>

constants.ts file
import { Store } from 'pinia';

export type PiniaActionAdaptor<
    Type extends Record<string, (...args: any) => any>,
    StoreType extends Store,
> = {
    [Key in keyof Type]: (
        this: StoreType,
        ...p: Parameters<Type[Key]>
    ) => ReturnType<Type[Key]>;
};

export interface AuthStoreState {
    isAuthenticated: boolean;
    errorMessage: null | string;
}

export type AuthStoreActions = {
    changeMessage: () => void;
};

export type AuthStoreGetters = Record<string, unknown>;

export type AuthStore = Store<'auth', AuthStoreState, AuthStoreGetters, AuthStoreActions>;

Folder Store: state.ts file
import { AuthStoreState } from '../constants';

export const authStoreState: AuthStoreState = {
    isAuthenticated: false,
    errorMessage: 'aa',
};

Folder Store: actions.ts file
import { PiniaActionAdaptor, AuthStoreActions, AuthStore } from '../constants';

export const authStoreActions: PiniaActionAdaptor<AuthStoreActions, AuthStore> = {
    changeMessage() {
        this.errorMessage = 'hhh';
    },
};

Folder Store: index.ts file
import { defineStore } from 'pinia';
import { authStoreState } from './state';
import { authStoreActions } from './actions';

export const useAuthStore = defineStore('auth', {
    state: () => authStoreState,
    getters: {},
    actions: {
        ...authStoreActions,
    },
});

i tried creating an actions file outside the store folder, and importing it into SFC vue used to change the state everything seems fine but i don't know how to use actions ?
actions.ts
import { AuthStore } from './constants';

export async function logout(this: AuthStore) {
    this.isAuthenticated = !this.isAuthenticated;
}

you need this app.use(createPinia())

@diadal thanks for your answer, but i want to separate the state, action, getters parts in separate files and will import them into the index file, with Vuex it will be easy to do that, i just learned Pinia and everything is fine, I followed the above instructions by @alexisjamet, but I can't seem to access the action, below is my code using
ProfilePage.vue
<template>

Profile Page

        Error Message: {{ getErrorMessage }}

        isAuthenticated: {{ isAuthenticated }}
        <button @click="changeMessageToStore">Change Message</button>

</template>

constants.ts file
import { Store } from 'pinia';

export type PiniaActionAdaptor<
    Type extends Record<string, (...args: any) => any>,
    StoreType extends Store,
> = {
    [Key in keyof Type]: (
        this: StoreType,
        ...p: Parameters<Type[Key]>
    ) => ReturnType<Type[Key]>;
};

export interface AuthStoreState {
    isAuthenticated: boolean;
    errorMessage: null | string;
}

export type AuthStoreActions = {
    changeMessage: () => void;
};

export type AuthStoreGetters = Record<string, unknown>;

export type AuthStore = Store<'auth', AuthStoreState, AuthStoreGetters, AuthStoreActions>;

Folder Store: state.ts file
import { AuthStoreState } from '../constants';

export const authStoreState: AuthStoreState = {
    isAuthenticated: false,
    errorMessage: 'aa',
};

Folder Store: actions.ts file
import { PiniaActionAdaptor, AuthStoreActions, AuthStore } from '../constants';

export const authStoreActions: PiniaActionAdaptor<AuthStoreActions, AuthStore> = {
    changeMessage() {
        this.errorMessage = 'hhh';
    },
};

Folder Store: index.ts file
import { defineStore } from 'pinia';
import { authStoreState } from './state';
import { authStoreActions } from './actions';

export const useAuthStore = defineStore('auth', {
    state: () => authStoreState,
    getters: {},
    actions: {
        ...authStoreActions,
    },
});

i tried creating an actions file outside the store folder, and importing it into SFC vue used to change the state everything seems fine but i don't know how to use actions ?
actions.ts
import { AuthStore } from './constants';

export async function logout(this: AuthStore) {
    this.isAuthenticated = !this.isAuthenticated;
}

you need this app.use(createPinia())

yes i know that, and i added it in main.ts

you can separate it simple

actions.ts
import { axiosInstance, appClient } from '../../boot/axios';
import { Regs, Sget, User, UserKey } from '../../components/models/model';
import { UserDat } from '../../components/models/acclist';
import { RepUser } from '../../components/models/StoreInterFace';

import { useState } from './state';
import { defineStore } from 'pinia';

const REGISTER_ROUTE = '/register';
const LOGIN_ROUTE = '/login';
const AUTH_LOGOUT = '/logout';

const empty = UserDat;

export const useActions = defineStore('auth.actions', () => {
  const state = useState();

  async function register(data: Regs) {
    try {
      const r = await axiosInstance.post(REGISTER_ROUTE, data);
      return r.data;
    } catch (error) {

      return false;
    }
  }

  async function login(data: Regs) {
    try {
      const response: {
        data: { status: boolean; data: { user: User; data: string } };
      } = await axiosInstance.post(LOGIN_ROUTE, data);
      const mainData = response?.data?.data;
      const user = mainData?.user;
      if (user) {
        state.user = user;
        const to: string = mainData.data;
        axiosInstance.defaults.headers.common = {
          'content-type': 'application/json',
          'X-Requested-With': 'XMLHttpRequest',
          'M-Version': process.env.APP_VERSION,
          'M-Client': appClient,
          Authorization: `Bearer ${to}`,
        };
        return <RepUser>{ status: true };
      }
      const rep = <RepUser>(
        (response?.data?.data ? response?.data?.data : response?.data)
      );
      return rep;
    } catch (ee) {
      return false;
    }
  }

  function firstlogin(data: { user: User; data: string }) {
    if (data?.user) {
      const newdata = data.user;
      state.user = newdata;
      const to: string = data.data;
      axiosInstance.defaults.headers.common = {
        'content-type': 'application/json',
        'X-Requested-With': 'XMLHttpRequest',
        Authorization: `Bearer ${to}`,
      };
      return true;
    }
  }

  function updateuser(data: { tok: string; user: User }) {
    const newdata = data.user;
    state.user = newdata;
    return true;
  }

  function userUpdate(data: { id: string; value: boolean | string }) {
    const updateSate = <UserKey>(<unknown>state.user);
    updateSate[data.id] = data.value;
    return true;
  }

  function fetch() {

  }

  async function applogout() {

  }

  async function logout() {

  }
  return {
    register,
    login,
    updateuser,
    userUpdate,
    firstlogin,
    fetch,
    applogout,
    logout,
  };
});

getters.ts
import { defineStore } from 'pinia';
import { computed } from 'vue';
import { User } from '../../components/models/model';
import { useState } from './state';

export const useGetters = defineStore('auth.getters', () => {
  const state = useState();

  const user = computed((): User => {
    return state.user;
  });

  const loggedIn = computed((): boolean => {
    return state.user.login;
  });

  const check = (roles: string | string[]) => {
    const user = state.user;
    if (user && user.roleNames.length > 0) {
      if (Array.isArray(roles) && roles.length) {
        for (const role of roles) {
          if (!user.roleNames.includes(String(role))) {
            return false;
          }
        }
      } else if (roles) {
        const nrole: string = <string>roles;
        if (!user.roleNames.includes(nrole)) {
          return false;
        }
      }
      return true;
    }
    return false;
  };

  return {
    user,
    loggedIn,
    check,
  };
});

index.ts
import { extractStore } from '../extractStore';
import { defineStore } from 'pinia';
import { useActions } from './actions';
import { useGetters } from './getters';
import { useState } from './state';

export const useAuthStore = defineStore('auth', () => {
  return {
    ...extractStore(useState()),
    ...extractStore(useGetters()),
    ...extractStore(useActions()),
  };
});

state.ts
import { defineStore } from 'pinia';
import { UserDat } from '../../components/models/acclist';
import { State } from '../../components/models/StoreInterFace';

export const useState = defineStore({
  id: 'auth.state',
  state: (): State => {
    return {
      user: UserDat,
    };
  },
});

extractStore.ts
import type {
  PiniaCustomStateProperties,
  StoreActions,
  StoreGeneric,
  StoreGetters,
  StoreState,
} from 'pinia';
import type { ToRefs } from 'vue';
import { isReactive, isRef, toRaw, toRef } from 'vue';

type Extracted<SS> = ToRefs<
  StoreState<SS> & StoreGetters<SS> & PiniaCustomStateProperties<StoreState<SS>>
> &
  StoreActions<SS>;

/**
 * Creates an object of references with all the state, getters, actions
 * and plugin-added state properties of the store.
 *
 * @param store - store to extract the refs from
 */
export function extractStore<SS extends StoreGeneric>(
  store: SS
): Extracted<SS> {
  const rawStore = toRaw(store);
  const refs: Record<string, unknown> = {};

  for (const [key, value] of Object.entries(rawStore)) {
    if (isRef(value) || isReactive(value)) {
      refs[key] = toRef(store, key);
    } else if (typeof value === 'function') {
      refs[key] = value;
    }
  }

  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
  return refs as Extracted<SS>;
}

StoreInterFace.ts
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Store } from 'pinia';
import { Freg, Regs, User } from './model';

export type PiniaActionAdaptor<
  Type extends Record<string, (...args: any) => any>,
  StoreType extends Store
> = {
  [Key in keyof Type]: (
    this: StoreType,
    ...p: Parameters<Type[Key]>
  ) => ReturnType<Type[Key]>;
};

export type PiniaGetterAdaptor<GettersType, StoreType extends Store> = {
  [Key in keyof GettersType]: (
    this: StoreType,
    state: StoreType['$state']
  ) => GettersType[Key];
};

export type State = {
  user: User;
};

export type Getters = {
  user: User;
  loggedIn: boolean;
  check: (roles: string | string[]) => boolean;
};

export interface RepUser {
  status: boolean;
  data: { user: User; data: string };
}

export type Actions = {
  register?: (data: Regs) => Promise<number | string | Freg> | boolean;
  loggedIn?: () => boolean;
  check?: (roles: string | string[]) => boolean;
  login?: (data: Regs) => Promise<false | RepUser>;
  logout?: () => Promise<boolean>;
  applogout?: () => boolean;
  passwordForgot?: (data: string[]) => Promise<boolean | Freg>;
  passwordReset?: (data: string[]) => Promise<boolean | Freg>;
  updateuser?: (data: { id: string; user: User }) => boolean;
  userUpdate?: (data: { id: string; value: boolean | string }) => boolean;
  firstlogin?: (data: { user: User; data: string }) => boolean;
  newfetch?: () => Promise<boolean | string | User>;
  fetch?: () => boolean;
  user?: () => User;
};

export type AuthStore = Store<'auth', State, Getters, Actions>;

@diadal I tried it this afternoon, but it looks like we are defining more stores, everything is fine, but looking at vue devtools it's weird :D, anyway thank you very much

you need to clean up. the code to your need also creates your interface based on what you need, if you need to access your store from all your components  simply create the plugin helper https://github.com/vuejs/pinia/issues/802#issuecomment-1100196675
app.config.globalProperties.$auth = helper;

I refactored it a bit, here is my suggestion:
Folders and Files structure:

Folder /stores
File /types.ts
import { Store } from 'pinia'

export type PiniaActionTree<
  Actions extends Record<string, (...args: any) => any>,
  StoreUsed,
> = {
  [Key in keyof Actions]: (
    this: StoreUsed,
    ...p: Parameters<Actions[Key]>
  ) => ReturnType<Actions[Key]>
}

export type PiniaGetterTree<Getters, StoreUsed extends Store> = {
  [Key in keyof Getters]: (
    this: StoreUsed,
    state: StoreUsed['$state'],
  ) => Getters[Key]
}

File /index.ts
A single file exporting all my stores (I prefer it this way when importing stores in components):
import { agentStore } from './agent'
import { authStore } from './auth'
import { uiStore } from './ui'
import { userStore } from './user'

export const useAuthStore = authStore
export const useAgentStore = agentStore
export const useUserStore = userStore
export const useUIStore = uiStore

Folder /auth
File /index.ts
import { defineStore } from 'pinia'
import { state } from './state'
import { getters } from './getters'
import { actions } from './actions'

export const authStore = defineStore('auth', {
  state: () => state,
  getters,
  actions,
})

File /types.ts
import { Store } from 'pinia'
import { Actions } from './actions/types'
import { Getters } from './getters/types'

export interface State {
  isAuthenticated: boolean
  errorMessage: null | string
}

export type AuthStore = Store<'auth', State, Getters, Actions>

File /state.ts
import { State } from './types'

export const state: State = {
  isAuthenticated: false,
  errorMessage: null,
}

Folder /actions
File /types.ts
import { PiniaActionTree } from '@/stores/types'
import { AuthStore } from '../types'

enum ActionNames {
  CheckReferralCode = 'checkReferralCode',
  Logout = 'logout',
  ResetErrorMessage = 'resetErrorMessage',
}

export type Actions = {
  [ActionNames.CheckReferralCode]: (code: string) => Promise<void>
  [ActionNames.Logout]: () => Promise<void>
  [ActionNames.ResetErrorMessage]: () => void
}

export type AuthActions = PiniaActionTree<Actions, AuthStore>

File /index.ts
import { logout } from './logout'
import { resetErrorMessage } from './reset-error-message'

export const actions: AuthActions = {
  checkReferralCode,
  resetErrorMessage,
  logout,
}

File /logout.ts
import router from '@/router'
import { RoutesNames } from '@/router/routes/types'
import Services from '@/services'
import { useUserStore } from '@/stores'
import { AuthActions } from './types'

export const logout: AuthActions['logout'] = async function () {
  await Services.getInstance().authentication.signOut()
  this.isAuthenticated = false
  useUserStore().setUser(null)
  router.push({ name: RoutesNames.Home })
}

Folder /getters
File /types.ts
import { PiniaGetterTree } from '@/stores/types'
import { AuthStore } from '../types'

export enum GetterNames {
  DeepLink = 'deepLink',
}

export type Getters = {
  [GetterNames.DeepLink]: string
}

export type AuthGetters = PiniaGetterTree<Getters, AuthStore>

File /index.ts
import { AuthGetters } from './types'
import { deepLink } from './deep-link'

export const getters: AuthGetters = {
  deepLink,
}

File /deep-link.ts
import { API_URL } from '@/external/api/config'
import { AuthGetters } from './types'

export const deepLink: AuthGetters['deepLink'] = function (state) {
  return API_URL + '/deeplink/' + state.referralCode
}

Example of using my Pinia stores (actions, state, getters) in components:

<template>

You are authenticated

Here is the result of my getter: {{ deepLink }}

<button @click="logout">Logout</button>
</template>

For me this works out quite nicely also with inheritance.
import { defineStore } from 'pinia'

type PiniaStateFactory<TState extends Record<string, any>> = () => TState

type PiniaGetterOptions<
    TState extends Record<string, any>,
    TGetters extends Record<string, any> = Record<string, never>,
    TActions extends Record<string, any> = Record<string, never>
> = {
    [Key in keyof TGetters]: (this: PiniaStore<TState, TGetters, TActions>, state: TState) => TGetters[Key];
};

type PiniaActionOptions<
    TState extends Record<string, any>,
    TGetters extends Record<string, any> = Record<string, never>,
    TActions extends Record<string, any> = Record<string, never>
> = {
    [Key in keyof TActions]: (this: PiniaStore<TState, TGetters, TActions>, ...p: Parameters<TActions[Key]>) => ReturnType<TActions[Key]>;
};

type PiniaStoreOptions<
  TState extends Record<string, any>,
  TGetters extends Record<string, any> = Record<string, never>,
  TActions extends Record<string, any> = Record<string, never>
> = {
  state: PiniaStateFactory<TState>,
  getters?: PiniaGetterOptions<TState, TGetters, TActions>,
  actions?: PiniaActionOptions<TState, TGetters, TActions>
}

type PiniaStore<
  TState extends Record<string, any>,
  TGetters extends Record<string, any> = Record<string, never>,
  TActions extends Record<string, any> = Record<string, never>
> = TState & TGetters & TActions

// Counter store
interface CounterState {
  count: number
}

interface CounterGetters {
  doubleCount: number,
  offsetCount: (offset: number) => number
  offsetDoubleCount: (offset: number) => number
}

interface CounterActions {
  increment(amount: number):void
}

const counterStateFactory : PiniaStateFactory<CounterState> = () => ({ count: 0 })

const counterGetterOptions : PiniaGetterOptions<CounterState, CounterGetters, CounterActions> = {
  doubleCount(state) {
    return state.count * 2
  },
  offsetCount(state) {
    return (amount) => state.count + amount
  },
  offsetDoubleCount() {
    return (amount) => this.doubleCount + amount
  }
}

const counterActionOptions : PiniaActionOptions<CounterState, CounterGetters, CounterActions> = {
  increment(amount) {
    this.count += amount
  }
}

const counterStoreOptions : PiniaStoreOptions<CounterState, CounterGetters, CounterActions> = {
  state: counterStateFactory,
  getters: counterGetterOptions,
  actions: counterActionOptions
}

const useCounterStore = defineStore('counterStore', counterStoreOptions)
const counterStore = useCounterStore()

// Inherit CounterStore and add additional getters
interface ExtendedCounterState extends CounterState {
  currencySymbol: string
}

interface ExtendedCounterGetters extends CounterGetters {
  countWithCurrency: string
}

const extendedCounterStateFactory : PiniaStateFactory<ExtendedCounterState> = () => ({ ...counterStateFactory(), currencySymbol: '$'})
const extendedGetterOptions : PiniaGetterOptions<ExtendedCounterState, ExtendedCounterGetters, CounterActions> = {
  ...counterGetterOptions,
  countWithCurrency(state){
    return `${state.count} ${state.currencySymbol}`;
  }
}

const extendedCounterStoreOptions : PiniaStoreOptions<ExtendedCounterState, ExtendedCounterGetters, CounterActions> = {
  state: extendedCounterStateFactory,
  getters: extendedGetterOptions,
  actions: counterActionOptions
}

const useExtendedCounterStore = defineStore('extendedCounterStore', extendedCounterStoreOptions)
const extendedCounterStore = useExtendedCounterStore()

If someone is interested. I came up with this.
Minimal setup, full type inferance, allows inheritance.
Type Definitions:
piniaTypes.ts:
import { StateTree, Store} from 'pinia'

export type PiniaStateTree = StateTree
export type PiniaGetterTree = Record<string, any>
export type PiniaActionTree = Record<string, (...p: any) => any>

export type PickState<TStore extends Store> = TStore extends Store<string, infer TState, PiniaGetterTree, PiniaActionTree> ? TState : PiniaStateTree
export type PickActions<TStore extends Store> = TStore extends Store<string, PiniaStateTree, PiniaGetterTree, infer TActions> ? TActions : never
export type PickGetters<TStore extends Store> = TStore extends Store<string, PiniaStateTree, infer TGetters, PiniaActionTree> ? TGetters : never

export type CompatiblePiniaState<TState> = () => TState
export type CompatiblePiniaGetter<TGetter, TStore extends Store> = (this: CompatibleStore<TStore>, state: PickState<TStore>) => TGetter
export type CompatiblePiniaGetters<TGetter extends PiniaGetterTree, TStore extends Store> = {
  [Key in keyof TGetter]: CompatiblePiniaGetter<TGetter[Key], CompatibleStore<TStore>>;
}

export type CompatiblePiniaAction<TAction extends (...p: any) => any, TStore extends Store> =  (this: TStore, ...p: Parameters<TAction>) => ReturnType<TAction>
export type CompatiblePiniaActions<TActions extends PiniaActionTree, TStore extends Store> = {
  [Key in keyof TActions]: CompatiblePiniaAction<TActions[Key], CompatibleStore<TStore>>;
}

export type CompatibleStore<TStore extends Store> = TStore extends Store<string, infer TState, infer TGetters, infer TActions> ? Store<string, TState, TGetters, TActions> : never

export type PiniaState<TStore extends Store> = CompatiblePiniaState<PickState<TStore>>;
export type PiniaGetters<TStore extends Store> = CompatiblePiniaGetters<PickGetters<TStore>, TStore>;
export type PiniaActions<TStore extends Store> = CompatiblePiniaActions<PickActions<TStore>, TStore>;
export type PiniaStore<TStore extends Store = Store> = {
   state: PiniaState<TStore>,
   getters: PiniaGetters<TStore>,
   actions: PiniaActions<TStore>
}

Counter Store:
actions.ts:
import { PiniaActions } from '@common/piniaTypes';
import { CounterStore } from '@common/counter';

export interface CounterActions {
  increment(amount: number): void;
}

export const actions: PiniaActions<CounterStore> = {
  increment(amount) {
    this.count += amount;
  },
};

getters.ts
import { PiniaGetters } from '@common/piniaTypes';
import { CounterStore } from '@common/counter';

export interface CounterGetters {
  doubleCount: number;
  offsetCount: (offset: number) => number;
  offsetDoubleCount: (offset: number) => number;
}

export const getters: PiniaGetters<CounterStore> = {
  doubleCount(state) {
    return state.count * 2;
  },
  offsetCount(state) {
    return (amount) => state.count + amount;
  },
  offsetDoubleCount() {
    return (amount) => this.doubleCount + amount;
  },
};

state.ts
import { PiniaState } from '@common/piniaTypes';
import { CounterStore } from '@common/counter';

export interface CounterState {
    count: number
}

export const state : PiniaState<CounterStore> = () => ({ count: 0 })

import { defineStore, Store, StoreDefinition } from 'pinia'
import { CounterState, state} from '@common/counter/state'
import { CounterActions, actions } from '@common/counter/actions'
import { CounterGetters, getters } from '@common/counter/getters'

export type CounterStore = Store<'counter', CounterState, CounterGetters, CounterActions>
export type CounterStoreDefinition = StoreDefinition<'counter', CounterState, CounterGetters, CounterActions>

export const useStore: CounterStoreDefinition = defineStore('counter', { state, getters, actions })

Inherited Counter Store
extendedCounter.ts
import { defineStore, Store, StoreDefinition } from 'pinia';
import { PiniaStore } from '@common/piniaTypes';
import { CounterState, state } from '@common/counter/state';
import { CounterGetters, getters } from '@common/counter/getters';
import { CounterActions, actions } from '@common/counter/actions';

interface ExtendedCounterState extends CounterState {
  currencySymbol: string;
}

interface ExtendedCounterGetters extends CounterGetters {
  countWithCurrency: string;
}

type ExtendedCounterStore = Store<'extendedCounterStore', ExtendedCounterState, ExtendedCounterGetters, CounterActions>;
type ExtendedCounterStoreDefinition = StoreDefinition<'extendedCounterStore', ExtendedCounterState, ExtendedCounterGetters, CounterActions>;

const extendedStore: PiniaStore<ExtendedCounterStore> = {
  state: () => ({ ...state(), currencySymbol: '$' }),
  getters: {
    ...getters,
    countWithCurrency(state) {
      return `${state.count} ${state.currencySymbol}`;
    },
  },
  actions: {
    ...actions,
  },
};

export const useExtendedCounter: ExtendedCounterStoreDefinition = defineStore('extendedCounterStore', extendedStore);

Have fun :)

@dotlogix thank you for your proposal but you said Minimal setup but in my point of view it isn't minimal because it requires writing lots of types. My suggestion above is in my opinion more minimalist because fewer types to write and therefore easier to use in a large project. But perhaps I don't understand all the added value of your proposal...

Hi everyone!
Thought a lot on this issue after migrating a large project from Vuex to Pinia and figured out an idea how it can be done. So I ended up with a plugin in attempt to solve it: https://github.com/iamresp/pinia-extract
The whole setup currently looks like this:
import {IPiniaExtractProperties, withExtract} from "pinia-extract";

const pinia = withExtract();

declare module "pinia" {
    export interface PiniaCustomProperties extends IPiniaExtractProperties {}
}

Plugin adds two methods to each store instance: defineAction and defineGetter:
const store = useSomeStore();

export const requestGetCar = store.defineAction(
    async function (id: string) {
        const car = await fetch(`/api/cars/${id}`);
        this.car = await car.json();
    }
);

export const getCar = store.defineGetter(
    (state) => state.car,
);

Externally defined actions can be used as independent functions, for using getters there is a special API:
import {useGetter} from "pinia-extract";
import {getCar} from "./store";

const car = useGetter(getCar);

this in actions points to store instance like in native actions. Getters have state as an argument in a simplest scenario, but, in addition, I made it possible for them to work like selectors in Reselect (it seemed to me that composition it provides fits really nicely here):
export const getCustomerCar = defineGetter(
    getCustomerJobTitle, // first getter
    getCustomerName, // second getter
    getCarModel, // third getter
    getCarType, // fourth getter
    (
        jobTitle: string, // first getter return value
        name: string, // second getter return value
        model: string, // third getter return value
        carType: string, // fourth getter return value
        // ...instead of whole state
    ): string => `${jobTitle} ${name} drives ${model} ${type}`;
);

There are some more features in addition — I tried to describe most of things in readme.
Hope someone will find it helpful.
Thanks.

@aparajita I like your solution, does your solution work with mapState & mapActions ?

@aparajita I like your solution, does your solution work with mapState & mapActions ?

Haven't tried. I don't see why not, it is easy enough to do a simple test yourself.

hi I am newbie dont know to much stuff but i made it work like this
NewUser.ts
`import { defineStore } from 'pinia';
import {state} from 'stores/newuser/state';
import {getters} from 'stores/newuser/getters';
import {actions} from 'stores/newuser/actions';
export const useNewUser = defineStore('NewUser', {
state,
getters,
actions
});
**actions.ts**import axios from 'axios';
import {useNewUser} from 'stores/newuser/NewUser';
export const actions= {
async getU() {
await axios.get('https://www.mecallapi.com/api/users').then((res)=>{
const state = useNewUser()
state.users = res.data
})

},
}
**state.ts**export const state = () => {
return {
users:[]
}
};
**getters.ts**export  const getters = {
// user(state){
//     return  state.users
//   }
user: (state :any) =>  state.users
}
`


[Enhancement] Flush persistent index in advance to reduce memory usage during data load of primary key

What type of PR is this：

[ ] BugFix
[ ] Feature
[x] Enhancement
[ ] Refactor
[ ] UT
[ ] Doc
[ ] Tool

Which issues of this PR fixes ：

Fixes #
Problem Summary(Required) ：

StarRocks supports real-time scenarios with PrimaryKey table, but the primary index of PrimaryKey table maybe cost a lot of memory, so we developed persistent index. PrimaryKey with persistent index will not use a lot of memory even if the data of table is very large. However, persistent index may alloc a large memory first if the load is very large which maybe cause apply failed.
This pr aims to resolve the large memory need during a large load of PrimaryKey table with persistent index.  If the memory usage of persistent index is too large, we will flush it to a tmp_l1 and clear the memory until all data is written into persistent index and we will merge all the tmp_l1 to a new l1 at last.
In my test env, one BE with one HDD, using BrokerLoad, create a table with 7 columns, 20 buckets:
CREATE TABLE `batch_flush_test` (
  `col_1` bigint(20) NOT NULL COMMENT "",
  `col_2` bigint(20) NOT NULL COMMENT "",
  `col_3` bigint(20) NOT NULL COMMENT "",
  `col_4` bigint(20) NOT NULL COMMENT "",
  `col_5` bigint(20) NOT NULL COMMENT "",
  `col_6` varchar(150) NULL COMMENT "",
  `col_7` varchar(150) NULL COMMENT ""
) ENGINE=OLAP
PRIMARY KEY(`col_1`, `col_2`, `col_3`, `col_4`, `col_5`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`col_1`, `col_2`) BUCKETS 20
PROPERTIES (
"replication_num" = "1",
"in_memory" = "false",
"storage_format" = "V2",
"enable_persistent_index" = "true",
"compression" = "LZ4"
);

PrimaryKey Length
RowNum
BucketNum
Column Num
Load time(s)
Apply time(ms)
Peak UpdateMemory usage
Note

40 Bytes
1Billion
20
7
3514
566379
63.3G
branch-main

40 Bytes
1Billion
20
7
3334
585724
2.06G
branch-opt

Checklist:

[x] I have added test cases for my bug fix or my new feature
[ ] This pr will affect users' behaviors
[ ] This pr needs user documentation (for new or modified features or behaviors)

[ ] I have added documentation for my new feature or new function

Bugfix cherry-pick branch check:

[x] I have checked the version labels which the pr will be auto backported to target branch

[x] 2.5
[ ] 2.4
[ ] 2.3
[ ] 2.2

run starrocks_fe_unittest

run starrocks_fe_unittest

run starrocks_fe_unittest

[FE PR Coverage Check]
:heart_eyes: pass : 0 / 0 (0%)

run starrocks_fe_unittest

run starrocks_fe_unittest

run starrocks_fe_unittest

run starrocks_fe_unittest

[FE PR Coverage Check]
:heart_eyes: pass : 0 / 0 (0%)

run SonarCloud Code Analysis

[FE PR Coverage Check]
:heart_eyes: pass : 0 / 0 (0%)

[FE PR Coverage Check]
:heart_eyes: pass : 0 / 0 (0%)

@chaoyli @decster PTAL

run starrocks_admit_test

@mergify backport branch-2.5


Mapping field names between database and object

Hello everyone,
For some reason, the names of fields in the source code and my database are different. Is there anyway to map them as @map() in Prisma?
I have tried kysely-mapper but face an error about 'Kysely cannot be assigned to Kysely', it come from a #private property of Kysely
If you have experienced any of the above problems, please help me.
Thanks

Hey 👋
This needs more info.
e.g. dependencies used, how you instantiate your Kysely instance, etc.
If it is related to prisma-kysely, you should ask there or on our discord.


For every component there should be a documented loggable value equivalent to the default

Many of our components such as Radii and Label currently have the property that there is no way to explicitly log a value that mimics the behavior of the viewer when no value is logged. This can be frustrating for users when they want to explicitly log data but still get behavior that matches the defaults.

One trivial case that could be easily changed, for example: if a Text label component is the empty string, then it could be discarded rather than rendered as a background with no text.
Perhaps numeric data could have a rule that NaN = absent? (For cases like Boxes3D's radii.)


Note does not appear in swagger-ui

I'm writing something like the following:
desc 'Create/update a set controller variables', {
    notes: 'this is a note for the api to create/update controller variables'
}

Unfortunately I cannot see the note appearing in swagger-ui
Gem versions:
Rails 5.0.2
grape 1.0.1
grape-entity 0.6.1
grape-swagger 0.27.1
grape-swagger-entity 0.2.0

see #specify-endpoint-details

what about this #example-code


Intellisense vs JavaScript Modules - lack of ".js" in completion

We have written the needed data into you
Issue Type: Bug
[How do I find out which extension is causing this?]
Convert a project to a module (via package.json). Start an import and let it fill in the module name.  The result is an import without ".js" which was correct until the introduction of modules that now require a .js.
While minor, it can cause a lot of confusion since the error messages about the module errors are not clear about the origin.
 Please paste.

VS Code has settings that allow to force extension in your case:
typescript.preferences.importModuleSpecifierEnding and javascript.preferences.importModuleSpecifierEnding.
In TS it's also valid to specify .js extension in imports of .ts file.
Have you tried these settings?

Thanks. I assume those will work but suggest that auto be updated to take into account the "module" setting as per node 16.
This seems to be different than the node: issue though part of the same challenge in tracking to shift to ES6 modules.

For improvements related to auto behavior and other code completions and support for node specific behavior it make sense to create request in TypeScript repository.
There is already some work planed for Node modules so it's better to start from https://github.com/microsoft/TypeScript/issues/44442 and linked https://gist.github.com/weswigham/22a064ffa961d5921077132ae2f8da78


New Architecture

Until Famo.us is finally ready / stable...it seems logical to use a framework that offers a virtual dom.
Choices:

React
Riot
Mithril
Marionette
Ampersand

For the time being, we may simply use React or Riot in to handle issues #22 , #21 , #13

Rebuilding with React. Closing Issue


WSS protocol not working

Hi,
When it try to connect wss protocol it gives me Exception: 'NoneType' object has no attribute 'host'. WSS implementation would be good in terms of security. Any help would be appreciated. Thanks

So, bettter place for this issue is 'https://github.com/Vovaman/micropython_async_websocket_client'.
It is not enough to change 'ws' to 'wss' for security.

It is preferable to keep both modes: secure and not secure
correct implementation for security includes work with certificates and it adds additional load for controller
And this is why I've planned realize it later.

Still I prefer wss:// over ws://

I'll rebase this issue to https://github.com/Vovaman/micropython_async_websocket_client and will include it to next release.

@pluzmedia , you know, I think again and it's really makes sense to realize wss as a first step to normal security. thanx for idea.
will make it in a days.

@Vovaman it's great

@Vovaman Do consider to pass custom headers during handshake. I did following to pass custom header
headers = [["device_id", 1]]
ws.handshake("wss://host:port", headers)
in ws.py
async def handshake(self, uri, headers):
for key, value in headers:
            print(key)
            print(value)
            send_header(b'%s: %s', key, value)

@Vovaman need to send header value like api key to authenticate during handshake also I have implemented ssl wrapper. If you like It I am ready to make a pull request.

Ok.

Not yet. Will make it till end of august.

Well, here it seems to be supported, and messages get loaded much faster, but is not async.
You can check it out if it helps in development.


Not displayed on the bottom the forum

Hello, after installation, it is not displayed at the bottom of my forum.

And I find no setting ADMIN in my PC, my version IPB: 4.0.11


Add NPY_FR_GENERIC enumeration

This exists in numpy/ndarraytypes.h
https://github.com/numpy/numpy/blob/67539a40cb13bad56a650809bf10a49e905a250d/numpy/core/include/numpy/ndarraytypes.h#L258

We're no longer actively maintaining the Numpy wrappers. Instead Numpy are providing their own version which Cython should use in preference. So please submit this change to them instead.

Ah got it - thanks for the context

It's probably getting close to the time when we should delete our copy. It was originally kept around to keep working with older versions of Numpy, but I think plenty of time has passed now

Yea that probably makes sense; I wasn't even aware of that transition
Do you know roughly how long back that started? I guess the nuance for us downstream in pandas is that Cython has always been a build dependency, so we could be aggressive in setting a minimum version. We have a much longer support window for NumPy, so small changes like this would take a much longer time to make their way into our codebase.
This might also have some impacts on how we think about build isolation (which today we don't use). cc @jbrockmendel and @lithomas1

We can build against the latest numpy for pandas, but we'd need build isolation, which would break editable installs.

Looks like about 4 years ago https://github.com/numpy/numpy/commit/2b250b0d619c5e99a6435acb73817ec5cc9ab344

Wow I am way out of the loop...cool thanks for the info


Gist: GitHub returned error 404: Not Found

Why I always get Gist: GitHub returned error 404: Not Found in my gist?

It looks like it was some problems with github api during that time. You can try again and it should work fine.


Add callback version of HG_Bulk API

Reported by jsoumagne on 1 Jan 1970 00:23 UTC
Switch mercury_bulk.h to callback model.

Modified by jsoumagne on 1 Jan 1970 00:23 UTC

Modified by jsoumagne on 1 Jan 1970 00:23 UTC

Modified by jsoumagne on 1 Jan 1970 00:23 UTC


Fix broken link in alerting/rules.md to querying/rules.md

There was a typo in content/docs/alerting/rules.md resulting in a broken link. I think this is probably what you guys meant?
@brian-brazil

The current link works for me

Please note that the markdown links are interpreted in the context of the generated website, they don't work in Github. The link on https://prometheus.io/docs/alerting/rules/ is correct.


pass options from parent to association blueprent?

I'm trying to do something like this:
class DriverBlueprint < Blueprinter::Base
  identifier :uuid
  view :normal do
    fields :first_name, :last_name
    association :vehicles, blueprint: vehicle_blueprint, options: { trim: options[:trim] }
  end
end

DriverBlueprint.render(drivers, trim: 'xl')

is this possible somehow? Right now we get undefined local variable or method 'options' it would be nice if at the instance level of the blueprint class we had access to options or at least the object itself.
EDIT:
I have found a workaround:
class DriverBlueprint < Blueprinter::Base
  identifier :uuid
  view :normal do
    fields :first_name, :last_name
    field :vehicles, do |driver, options|
      VehicleBlueprint.render_as_hash(driver.vehicles, trim: options[:trim])
    end
  end
end

DriverBlueprint.render(drivers, trim: 'xl')

Hey @waynehoover,
The options passed in via render are implicitly passed down to the association and are available to the association blueprint.
For example
driver_hash = { :first_name => "Michael", :last_name => "Clayton", :vehicles => [{ :uuid => 1, :make => 'Toyota', :model => 'Corolla' }, { :make => 'Honda', :model => 'Civic' }] }

class VehicleBlueprint < Blueprinter::Base
  field :full_name do |vehicle, options|
    "#{options[:color]} #{vehicle[:make]} #{vehicle[:model]} #{options[:trim]}"
  end
end

class DriverBlueprint < Blueprinter::Base
  view :normal do
    fields :first_name
    association :vehicles, blueprint: VehicleBlueprint, options: { trim: 'LX' }
  end
end

DriverBlueprint.render(driver_hash, view: :normal, color: 'Red')

Would render:
{"first_name":"Michael","vehicles":[{"full_name":"Red Toyota Corolla LX"},{"full_name":"Red Honda Civic LX"}]}

Is that what you wanted/answer your question?

@waynehoover, since you found a workaround, and there's a supported explanation above as well, I'm going to go ahead and close this -- but please reach out if this issue is not resolved.


Multi project types

Fixes #1199
Include js and dotnet
-t js -t dotnet

Exclude js and include the rest
--exclude-type js

Known limitations

[ ] Only one type is supported by evinse at a time

To be tested

[ ] Passing multiple project and exclude types via server mode

@ajmalab fyi. If this happens to get merged first, I will help you with rebasing or redoing your PR.

@heubeck @setchy Could you kindly test your sample apps with this PR?

@heubeck @setchy Could you kindly test your sample apps with this PR?

thx @prabhu .
one multi module test failed with missing components.
will provide the sample asap

@heubeck, oops sorry didn't see your comment. Please share the sample app so can test it.

ok, @prabhu, here's the sample.
test project: https://github.com/MediaMarktSaturn/technolinator/tree/main/src/test/resources/repo/multi-gradle-module
sboms created using cdxgen --spec-version 1.5 -o sbom.json -r:

cdxgen of master branch:
sbom-10.8.0.formatted.json

cdxgen version 10.7.1:
sbom-10.7.1.formatted.json

in the latest version it seems that only the parent projects components are listed, the submodules are missing.

@heubeck Please test with this fix PR

Hey @prabhu, this commit has broken something. I installed the version from this commit (and mine, added after this one), and I'm unable to generate SBOMs with it. Seems gradle properties is not run at all when generating SBOMs from this commit.
Verified by installing from #1204, and everything's working as expected from there.

How is the master branch looking? Please have some test workflows against them.

@prabhu seems to be working as expected from the master branch as well. When is the next release planned btw?

Thanks @ajmalab for testing. Currently blocked by this PR. The dependency tree reported for python includes pipenv and blint etc. Banging my head since the morning to fix it.

@ajmalab could you kindly retest with the latest master? I would also appreciate it if you could test both gradle and python (including poetry).


Error when installing on alpine or slim docker images

This isn't strictly an issue with io-event itself, but I'm not sure where to start investigating.
When installing this gem in the docker container ruby:3.1-bullseye, it works fine. In the ruby:3.1-alpine and ruby:3.1-slim-bullseye images, however, it fails to build:
$ docker run --rm -it ruby:3.1.2-slim-bullseye sh
...
# gem install io-event
Fetching io-event-1.0.9.gem
Building native extensions. This could take a while...
ERROR:  Error installing io-event:
	ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/io-event-1.0.9/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/3.1.0 -r ./siteconf20221009-2-lecj4o.rb extconf.rb
checking for rb_ext_ractor_safe()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/local/bin/$(RUBY_BASE_NAME)
/usr/local/lib/ruby/3.1.0/mkmf.rb:498:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:591:in `try_link0'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:609:in `try_link'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:830:in `try_func'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:1119:in `block in have_func'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:1007:in `block in checking_for'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:362:in `block (2 levels) in postpone'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:332:in `open'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:362:in `block in postpone'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:332:in `open'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:358:in `postpone'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:1006:in `checking_for'
	from /usr/local/lib/ruby/3.1.0/mkmf.rb:1118:in `have_func'
	from extconf.rb:36:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/bundle/extensions/x86_64-linux/3.1.0/io-event-1.0.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/io-event-1.0.9 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux/3.1.0/io-event-1.0.9/gem_make.out

# cat /usr/local/bundle/extensions/x86_64-linux/3.1.0/io-event-1.0.9/mkmf.log
LD_LIBRARY_PATH=.:/usr/local/lib "gcc -o conftest -I/usr/local/include/ruby-3.1.0/x86_64-linux -I/usr/local/include/ruby-3.1.0/ruby/backward -I/usr/local/include/ruby-3.1.0 -I.    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -Wundef  -fPIC -Wall -std=c99 conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,--no-as-needed     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm  -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

I don't know much about building Ruby, Is rb_ext_ractor_safe really the issue, or is something else missing needed to compile gems? Or is it a dependency I can install later so this gem will compile?

Turns out its not just io-event, its any compiled gem, because alpine is missing a compiler at all. Here's what it took to install the gem, in case anyone else comes across this:
RUN apk add --update gcc make libc-dev

I have also done this before and wondered wtf is going wrong with my environment only to realise it's missing a compiler.