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 +4 -4
- data/.github/workflows/test.yml +3 -3
- data/Gemfile +1 -1
- data/core/ArSyncModel.d.ts +9 -4
- data/core/ArSyncModel.js +2 -2
- data/core/ArSyncStore.d.ts +3 -1
- data/gemfiles/Gemfile-rails-6 +5 -0
- data/gemfiles/{Gemfile-rails-7-0 → Gemfile-rails-7} +1 -1
- data/gemfiles/{Gemfile-rails-7-1 → Gemfile-rails-8} +2 -2
- data/lib/ar_sync/config.rb +0 -1
- data/lib/ar_sync/rails.rb +2 -1
- data/lib/ar_sync/type_script.rb +7 -3
- data/lib/ar_sync/version.rb +1 -1
- data/package-lock.json +1828 -1463
- data/package.json +3 -3
- data/src/core/ArSyncModel.ts +11 -6
- metadata +5 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b01fdd94726978d9866a7a59e843ae0de35069511cdd1d3750b2d9e8ee34ef8
|
|
4
|
+
data.tar.gz: 983647b65a02802a66db74deb67efd236df83db3c9bcc5240db24446d7e8d3ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 255e20be32f56d9ada9127e5af2f1b5df7058daf4cb122e2c899fa36d1c1e3efc1d2b685bb731cbf136f76d6cba86f9d251051843510daaf1aaf7163359e8349
|
|
7
|
+
data.tar.gz: cdae634af22bb443c4696922964bb675886ef4b4d44040fd74ab4b93205b0196f148328647f6c3a22af7f16de541ef607f223df1b5d1716730c327251ca7c593
|
data/.github/workflows/test.yml
CHANGED
|
@@ -5,11 +5,11 @@ jobs:
|
|
|
5
5
|
strategy:
|
|
6
6
|
fail-fast: false
|
|
7
7
|
matrix:
|
|
8
|
-
ruby: [ '3.
|
|
8
|
+
ruby: [ '3.2', '3.3', '3.4' ]
|
|
9
9
|
gemfiles:
|
|
10
10
|
- gemfiles/Gemfile-rails-6
|
|
11
|
-
- gemfiles/Gemfile-rails-7
|
|
12
|
-
- gemfiles/Gemfile-rails-
|
|
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
data/core/ArSyncModel.d.ts
CHANGED
|
@@ -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
|
|
12
|
-
|
|
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:
|
|
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:
|
|
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 (
|
|
33
|
-
callback(
|
|
32
|
+
var subscription = this.subscribe(event, function (e) {
|
|
33
|
+
callback(e);
|
|
34
34
|
subscription.unsubscribe();
|
|
35
35
|
});
|
|
36
36
|
return subscription;
|
data/core/ArSyncStore.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ export declare type Request = {
|
|
|
2
2
|
api: string;
|
|
3
3
|
query: any;
|
|
4
4
|
params?: any;
|
|
5
|
-
id?:
|
|
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 {};
|
data/gemfiles/Gemfile-rails-6
CHANGED
|
@@ -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'
|
|
@@ -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'
|
|
9
|
-
gem 'activerecord', '~>
|
|
8
|
+
gem 'sqlite3'
|
|
9
|
+
gem 'activerecord', '~> 8.0'
|
|
10
10
|
gem 'ar_serializer', github: 'tompng/ar_serializer'
|
data/lib/ar_sync/config.rb
CHANGED
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
|
|
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)
|
data/lib/ar_sync/type_script.rb
CHANGED
|
@@ -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
|
-
|
|
57
|
-
|
|
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
|
|
63
|
+
export default ArSyncModel
|
|
60
64
|
CODE
|
|
61
65
|
end
|
|
62
66
|
|
data/lib/ar_sync/version.rb
CHANGED