@syncular/core 0.0.1-73 → 0.0.1-83

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/dist/index.d.ts CHANGED
@@ -18,4 +18,5 @@ export * from './schemas';
18
18
  export * from './scopes';
19
19
  export * from './transforms';
20
20
  export * from './types';
21
+ export * from './utils';
21
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,cAAc,SAAS,CAAC;AAExB,cAAc,YAAY,CAAC;AAE3B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,UAAU,CAAC;AAEzB,cAAc,SAAS,CAAC;AAExB,cAAc,WAAW,CAAC;AAE1B,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC;AAE7B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,cAAc,SAAS,CAAC;AAExB,cAAc,YAAY,CAAC;AAE3B,cAAc,oBAAoB,CAAC;AAEnC,cAAc,UAAU,CAAC;AAEzB,cAAc,SAAS,CAAC;AAExB,cAAc,WAAW,CAAC;AAE1B,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC;AAE7B,cAAc,SAAS,CAAC;AAExB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -10,21 +10,23 @@
10
10
  * - Zod schemas for runtime validation and OpenAPI
11
11
  */
12
12
  // Blob transport/storage types and utilities (protocol types come from ./schemas)
13
- export * from './blobs';
13
+ export * from './blobs.js';
14
14
  // Conflict detection utilities
15
- export * from './conflict';
15
+ export * from './conflict.js';
16
16
  // Kysely plugin utilities
17
- export * from './kysely-serialize';
17
+ export * from './kysely-serialize.js';
18
18
  // Logging utilities
19
- export * from './logger';
19
+ export * from './logger.js';
20
20
  // Proxy protocol types
21
- export * from './proxy';
21
+ export * from './proxy/index.js';
22
22
  // Schemas (Zod)
23
- export * from './schemas';
23
+ export * from './schemas/index.js';
24
24
  // Scope types, patterns, and utilities
25
- export * from './scopes';
25
+ export * from './scopes/index.js';
26
26
  // Data transformation hooks
27
- export * from './transforms';
27
+ export * from './transforms.js';
28
28
  // Transport and conflict types (protocol types come from ./schemas)
29
- export * from './types';
29
+ export * from './types.js';
30
+ // Shared runtime utilities
31
+ export * from './utils/index.js';
30
32
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,kFAAkF;AAClF,cAAc,SAAS,CAAC;AACxB,+BAA+B;AAC/B,cAAc,YAAY,CAAC;AAC3B,0BAA0B;AAC1B,cAAc,oBAAoB,CAAC;AACnC,oBAAoB;AACpB,cAAc,UAAU,CAAC;AACzB,uBAAuB;AACvB,cAAc,SAAS,CAAC;AACxB,gBAAgB;AAChB,cAAc,WAAW,CAAC;AAC1B,uCAAuC;AACvC,cAAc,UAAU,CAAC;AACzB,4BAA4B;AAC5B,cAAc,cAAc,CAAC;AAC7B,oEAAoE;AACpE,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,kFAAkF;AAClF,cAAc,SAAS,CAAC;AACxB,+BAA+B;AAC/B,cAAc,YAAY,CAAC;AAC3B,0BAA0B;AAC1B,cAAc,oBAAoB,CAAC;AACnC,oBAAoB;AACpB,cAAc,UAAU,CAAC;AACzB,uBAAuB;AACvB,cAAc,SAAS,CAAC;AACxB,gBAAgB;AAChB,cAAc,WAAW,CAAC;AAC1B,uCAAuC;AACvC,cAAc,UAAU,CAAC;AACzB,4BAA4B;AAC5B,cAAc,cAAc,CAAC;AAC7B,oEAAoE;AACpE,cAAc,SAAS,CAAC;AACxB,2BAA2B;AAC3B,cAAc,SAAS,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @syncular/core - Schema exports
3
3
  */
4
- export * from './blobs';
5
- export * from './common';
6
- export * from './sync';
4
+ export * from './blobs.js';
5
+ export * from './common.js';
6
+ export * from './sync.js';
7
7
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export declare function randomId(): string;
2
+ //# sourceMappingURL=id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../src/utils/id.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,IAAI,MAAM,CAMjC"}
@@ -0,0 +1,8 @@
1
+ export function randomId() {
2
+ const cryptoObj = globalThis.crypto;
3
+ if (cryptoObj && typeof cryptoObj.randomUUID === 'function') {
4
+ return cryptoObj.randomUUID();
5
+ }
6
+ return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
7
+ }
8
+ //# sourceMappingURL=id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.js","sourceRoot":"","sources":["../../src/utils/id.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,GAAW;IACjC,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC;IACpC,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QAC5D,OAAO,SAAS,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAAA,CAC/D"}
@@ -0,0 +1,3 @@
1
+ export * from './id';
2
+ export * from './object';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './id.js';
2
+ export * from './object.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
2
+ //# sourceMappingURL=object.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
@@ -0,0 +1,4 @@
1
+ export function isRecord(value) {
2
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
3
+ }
4
+ //# sourceMappingURL=object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.js","sourceRoot":"","sources":["../../src/utils/object.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAC,KAAc,EAAoC;IACzE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAAA,CAC7E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/core",
3
- "version": "0.0.1-73",
3
+ "version": "0.0.1-83",
4
4
  "description": "Core protocol types and shared utilities for the Syncular sync framework",
5
5
  "license": "MIT",
6
6
  "author": "Benjamin Kniffler",
@@ -0,0 +1,27 @@
1
+ import { describe, expect, it } from 'bun:test';
2
+ import { isRecord, randomId } from '../utils';
3
+
4
+ describe('isRecord', () => {
5
+ it('returns true for plain objects', () => {
6
+ expect(isRecord({ a: 1 })).toBe(true);
7
+ });
8
+
9
+ it('returns false for null and arrays', () => {
10
+ expect(isRecord(null)).toBe(false);
11
+ expect(isRecord([])).toBe(false);
12
+ });
13
+ });
14
+
15
+ describe('randomId', () => {
16
+ it('returns a non-empty string id', () => {
17
+ const id = randomId();
18
+ expect(typeof id).toBe('string');
19
+ expect(id.length > 0).toBe(true);
20
+ });
21
+
22
+ it('generates different ids across sequential calls', () => {
23
+ const first = randomId();
24
+ const second = randomId();
25
+ expect(first).not.toBe(second);
26
+ });
27
+ });
package/src/index.ts CHANGED
@@ -28,3 +28,5 @@ export * from './scopes';
28
28
  export * from './transforms';
29
29
  // Transport and conflict types (protocol types come from ./schemas)
30
30
  export * from './types';
31
+ // Shared runtime utilities
32
+ export * from './utils';
@@ -0,0 +1,7 @@
1
+ export function randomId(): string {
2
+ const cryptoObj = globalThis.crypto;
3
+ if (cryptoObj && typeof cryptoObj.randomUUID === 'function') {
4
+ return cryptoObj.randomUUID();
5
+ }
6
+ return `${Date.now()}-${Math.random().toString(16).slice(2)}`;
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from './id';
2
+ export * from './object';
@@ -0,0 +1,3 @@
1
+ export function isRecord(value: unknown): value is Record<string, unknown> {
2
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
3
+ }