ar_sync 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '096573e72fb5d4dc465e79c9bf8b39617fb423d7d779534f4ce30768dda2b5b1'
4
- data.tar.gz: c590f23a76420db7e056733ca895e56991cdcca8cfbd9908a503dc5ce57ab2f7
3
+ metadata.gz: 2b01fdd94726978d9866a7a59e843ae0de35069511cdd1d3750b2d9e8ee34ef8
4
+ data.tar.gz: 983647b65a02802a66db74deb67efd236df83db3c9bcc5240db24446d7e8d3ef
5
5
  SHA512:
6
- metadata.gz: 47d42249688cfef025fd2b9ea927d81962a786eded059a694ac5d069e7a0b0a48ca9bcc0d59a8d198bc4bb701cd86d4b98acc5c2c3de5b3018ac78f4b9487566
7
- data.tar.gz: 88e61169ef8968905d8e9f341108f2c926ac23436ce30ad5e8f2ca7872a6e4e2644f24ff44769c5561589ba1954367325001675c2014b838053ccb6b1848ace9
6
+ metadata.gz: 255e20be32f56d9ada9127e5af2f1b5df7058daf4cb122e2c899fa36d1c1e3efc1d2b685bb731cbf136f76d6cba86f9d251051843510daaf1aaf7163359e8349
7
+ data.tar.gz: cdae634af22bb443c4696922964bb675886ef4b4d44040fd74ab4b93205b0196f148328647f6c3a22af7f16de541ef607f223df1b5d1716730c327251ca7c593
@@ -5,11 +5,11 @@ jobs:
5
5
  strategy:
6
6
  fail-fast: false
7
7
  matrix:
8
- ruby: [ '3.1', '3.2', '3.3' ]
8
+ ruby: [ '3.2', '3.3', '3.4' ]
9
9
  gemfiles:
10
10
  - gemfiles/Gemfile-rails-6
11
- - gemfiles/Gemfile-rails-7-0
12
- - gemfiles/Gemfile-rails-7-1
11
+ - gemfiles/Gemfile-rails-7
12
+ - gemfiles/Gemfile-rails-8
13
13
  runs-on: ubuntu-latest
14
14
  steps:
15
15
  - uses: actions/checkout@v4
data/Gemfile CHANGED
@@ -4,5 +4,5 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in ar_sync.gemspec
6
6
  gemspec
7
- gem 'sqlite3', '~> 1.4'
7
+ gem 'sqlite3'
8
8
  gem 'ar_serializer'
@@ -8,8 +8,13 @@ interface Change {
8
8
  declare type ChangeCallback = (change: Change) => void;
9
9
  declare type LoadCallback = () => void;
10
10
  declare type ConnectionCallback = (status: boolean) => void;
11
- declare type SubscriptionType = 'load' | 'change' | 'connection' | 'destroy';
12
- declare type SubscriptionCallback = ChangeCallback | LoadCallback | ConnectionCallback;
11
+ declare type SubscriptionCallbackMap = {
12
+ load: LoadCallback;
13
+ change: ChangeCallback;
14
+ connection: ConnectionCallback;
15
+ destroy: LoadCallback;
16
+ };
17
+ declare type SubscriptionType = keyof SubscriptionCallbackMap;
13
18
  declare type ArSyncModelRef = {
14
19
  key: string;
15
20
  count: number;
@@ -44,12 +49,12 @@ export default class ArSyncModel<T> {
44
49
  immutable: boolean;
45
50
  });
46
51
  onload(callback: LoadCallback): void;
47
- subscribeOnce(event: SubscriptionType, callback: SubscriptionCallback): {
52
+ subscribeOnce<T extends SubscriptionType>(event: T, callback: SubscriptionCallbackMap[T]): {
48
53
  unsubscribe: () => void;
49
54
  };
50
55
  dig<P extends Path>(path: P): DigResult<T, P> | null;
51
56
  static digData<Data, P extends Path>(data: Data, path: P): DigResult<Data, P>;
52
- subscribe(event: SubscriptionType, callback: SubscriptionCallback): {
57
+ subscribe<T extends SubscriptionType>(event: T, callback: SubscriptionCallbackMap[T]): {
53
58
  unsubscribe: () => void;
54
59
  };
55
60
  release(): void;
data/core/ArSyncModel.js CHANGED
@@ -29,8 +29,8 @@ var ArSyncModel = /** @class */ (function () {
29
29
  this.subscribeOnce('load', callback);
30
30
  };
31
31
  ArSyncModel.prototype.subscribeOnce = function (event, callback) {
32
- var subscription = this.subscribe(event, function (arg) {
33
- callback(arg);
32
+ var subscription = this.subscribe(event, function (e) {
33
+ callback(e);
34
34
  subscription.unsubscribe();
35
35
  });
36
36
  return subscription;
@@ -2,8 +2,9 @@ export declare type Request = {
2
2
  api: string;
3
3
  query: any;
4
4
  params?: any;
5
- id?: any;
5
+ id?: IDType;
6
6
  };
7
+ declare type IDType = number | string;
7
8
  export declare class ArSyncStore {
8
9
  immutable: boolean;
9
10
  markedForFreezeObjects: any[];
@@ -34,3 +35,4 @@ export declare class ArSyncStore {
34
35
  freezeMarked(): void;
35
36
  release(): void;
36
37
  }
38
+ export {};
@@ -5,6 +5,11 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in ar_sync.gemspec
6
6
  gemspec path: '..'
7
7
 
8
+ gem 'bigdecimal'
9
+ gem 'base64'
10
+ gem 'mutex_m'
11
+ gem 'logger'
12
+ gem 'concurrent-ruby', '1.3.4'
8
13
  gem 'sqlite3', '~> 1.4'
9
14
  gem 'activerecord', '~> 6.0'
10
15
  gem 'ar_serializer', github: 'tompng/ar_serializer'
@@ -6,5 +6,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
6
  gemspec path: '..'
7
7
 
8
8
  gem 'sqlite3', '~> 1.4'
9
- gem 'activerecord', '~> 7.0.0'
9
+ gem 'activerecord', '~> 7.0'
10
10
  gem 'ar_serializer', github: 'tompng/ar_serializer'
@@ -5,6 +5,6 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in ar_sync.gemspec
6
6
  gemspec path: '..'
7
7
 
8
- gem 'sqlite3', '~> 1.4'
9
- gem 'activerecord', '~> 7.1.0'
8
+ gem 'sqlite3'
9
+ gem 'activerecord', '~> 8.0'
10
10
  gem 'ar_serializer', github: 'tompng/ar_serializer'
@@ -1,4 +1,3 @@
1
- require 'ostruct'
2
1
  module ArSync
3
2
  config_keys = %i[
4
3
  current_user_method
data/lib/ar_sync/rails.rb CHANGED
@@ -116,7 +116,8 @@ module ArSync
116
116
  end
117
117
 
118
118
  def log_internal_exception(exception)
119
- ActiveSupport::Deprecation.silence do
119
+ deprecator = ::Rails.version >= Gem::Version.new('7.1.0') ? ::Rails.application.deprecators : ActiveSupport::Deprecation
120
+ deprecator.silence do
120
121
  logger.fatal ' '
121
122
  logger.fatal "#{exception.class} (#{exception.message}):"
122
123
  log_internal_exception_trace exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
@@ -53,10 +53,14 @@ module ArSync::TypeScript
53
53
  import { TypeRequest } from './types'
54
54
  import DataTypeFromRequest from './DataTypeFromRequest'
55
55
  import { default as ArSyncModelBase } from 'ar_sync/core/ArSyncModel'
56
- declare class ArSyncModel<R extends TypeRequest> extends ArSyncModelBase<DataTypeFromRequest<R>> {
57
- constructor(r: R, option?: { immutable: boolean })
56
+ import ConnectionAdapter from 'ar_sync/core/ConnectionAdapter'
57
+
58
+ type ArSyncModel<R extends TypeRequest> = ArSyncModelBase<DataTypeFromRequest<R>>
59
+ const ArSyncModel = ArSyncModelBase as unknown as {
60
+ new <R extends TypeRequest>(r: R, option?: { immutable: boolean }): ArSyncModel<R>
61
+ setConnectionAdapter(adapter: ConnectionAdapter): void
58
62
  }
59
- export default ArSyncModelBase as typeof ArSyncModel
63
+ export default ArSyncModel
60
64
  CODE
61
65
  end
62
66
 
@@ -1,3 +1,3 @@
1
1
  module ArSync
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.4'
3
3
  end