@powersync/lib-services-framework 0.7.2 → 0.7.3

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.
package/LICENSE CHANGED
@@ -1,12 +1,12 @@
1
- # Functional Source License, Version 1.1, Apache 2.0 Future License
1
+ # Functional Source License, Version 1.1, ALv2 Future License
2
2
 
3
3
  ## Abbreviation
4
4
 
5
- FSL-1.1-Apache-2.0
5
+ FSL-1.1-ALv2
6
6
 
7
7
  ## Notice
8
8
 
9
- Copyright 2023-2024 Journey Mobile, Inc.
9
+ Copyright 2023-2025 Journey Mobile, Inc.
10
10
 
11
11
  ## Terms and Conditions
12
12
 
@@ -1,7 +1,8 @@
1
1
  import * as t from 'ts-codec';
2
2
  import * as bson from 'bson';
3
+ import { DateTimeValue } from '@powersync/service-sync-rules';
3
4
  export declare const buffer: t.Codec<Buffer<ArrayBufferLike>, string, string, t.CodecProps>;
4
- export declare const date: t.Codec<Date, string, string, t.CodecProps>;
5
+ export declare const date: t.Codec<Date, string | DateTimeValue, string, t.CodecProps>;
5
6
  export declare const ObjectId: t.Codec<bson.ObjectId, string, string, t.CodecProps>;
6
7
  export declare const ResourceId: t.Codec<{
7
8
  _id: bson.ObjectId;
@@ -9,16 +10,16 @@ export declare const ResourceId: t.Codec<{
9
10
  id: string;
10
11
  }, string, t.CodecProps>;
11
12
  export declare const Timestamps: t.ObjectCodec<{
12
- created_at: t.Codec<Date, string, string, t.CodecProps>;
13
- updated_at: t.Codec<Date, string, string, t.CodecProps>;
13
+ created_at: t.Codec<Date, string | DateTimeValue, string, t.CodecProps>;
14
+ updated_at: t.Codec<Date, string | DateTimeValue, string, t.CodecProps>;
14
15
  }>;
15
16
  export declare const Resource: t.Intersection<t.Codec<{
16
17
  _id: bson.ObjectId;
17
18
  }, {
18
19
  id: string;
19
20
  }, string, t.CodecProps>, t.ObjectCodec<{
20
- created_at: t.Codec<Date, string, string, t.CodecProps>;
21
- updated_at: t.Codec<Date, string, string, t.CodecProps>;
21
+ created_at: t.Codec<Date, string | DateTimeValue, string, t.CodecProps>;
22
+ updated_at: t.Codec<Date, string | DateTimeValue, string, t.CodecProps>;
22
23
  }>>;
23
24
  export declare const QueryFilter: t.ObjectCodec<{
24
25
  exists: t.IdentityCodec<t.CodecType.Boolean>;
@@ -1,5 +1,6 @@
1
1
  import * as t from 'ts-codec';
2
2
  import * as bson from 'bson';
3
+ import { DateTimeValue } from '@powersync/service-sync-rules';
3
4
  export const buffer = t.codec('Buffer', (buffer) => {
4
5
  if (!Buffer.isBuffer(buffer)) {
5
6
  throw new t.TransformError([`Expected buffer but got ${typeof buffer}`]);
@@ -12,7 +13,9 @@ export const date = t.codec('Date', (date) => {
12
13
  }
13
14
  return date.toISOString();
14
15
  }, (date) => {
15
- const parsed = new Date(date);
16
+ // In our jpgwire wrapper, we patch the row decoding logic to map timestamps into TimeValue instances, so we need to
17
+ // support those here.
18
+ const parsed = new Date(date instanceof DateTimeValue ? date.iso8601Representation : date);
16
19
  if (isNaN(parsed.getTime())) {
17
20
  throw new t.TransformError([`Invalid date`]);
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../src/codec/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAC3B,QAAQ,EACR,CAAC,MAAM,EAAE,EAAE;IACT,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,2BAA2B,OAAO,MAAM,EAAE,CAAC,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,EACD,CAAC,MAAM,EAAE,EAAE,CAAC,MAA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M,CAAC,IAAI,CAAC,GAAG,CAAC;KAC9B,CAAC;AACJ,CAAC,EACD,CAAC,IAAI,EAAE,EAAE;IACP,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAClC,OAAO;QACL,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,IAAI;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC,OAAO;CAClB,CAAC,CAAC"}
@@ -5,10 +5,10 @@ export declare const ResourceIdParser: t.Parser<string, t.Codec<{
5
5
  }, {
6
6
  id: string;
7
7
  }, string, t.CodecProps>>;
8
- export declare const DateParser: t.Parser<string, t.Codec<Date, string, string, t.CodecProps>>;
8
+ export declare const DateParser: t.Parser<string, t.Codec<Date, string | import("@powersync/service-sync-rules").DateTimeValue, string, t.CodecProps>>;
9
9
  export declare const BufferParser: t.Parser<string, t.Codec<Buffer<ArrayBufferLike>, string, string, t.CodecProps>>;
10
10
  export declare const parsers: (t.Parser<string, t.Codec<import("bson").ObjectId, string, string, t.CodecProps>> | t.Parser<string, t.Codec<{
11
11
  _id: import("bson").ObjectId;
12
12
  }, {
13
13
  id: string;
14
- }, string, t.CodecProps>> | t.Parser<string, t.Codec<Date, string, string, t.CodecProps>> | t.Parser<string, t.Codec<Buffer<ArrayBufferLike>, string, string, t.CodecProps>>)[];
14
+ }, string, t.CodecProps>> | t.Parser<string, t.Codec<Date, string | import("@powersync/service-sync-rules").DateTimeValue, string, t.CodecProps>> | t.Parser<string, t.Codec<Buffer<ArrayBufferLike>, string, string, t.CodecProps>>)[];
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@powersync/lib-services-framework",
3
3
  "repository": "https://github.com/powersync-ja/powersync-service",
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
8
- "license": "FSL-1.1-Apache-2.0",
8
+ "license": "FSL-1.1-ALv2",
9
9
  "files": [
10
10
  "dist/**/*"
11
11
  ],
@@ -24,7 +24,8 @@
24
24
  "uuid": "^11.1.0",
25
25
  "winston": "^3.13.0",
26
26
  "zod": "^3.23.8",
27
- "@powersync/service-errors": "0.3.3"
27
+ "@powersync/service-errors": "0.3.4",
28
+ "@powersync/service-sync-rules": "0.29.0"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/lodash": "^4.17.5",