teamplay 0.5.0-alpha.37 → 0.5.0-alpha.38

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/README.md CHANGED
@@ -13,16 +13,16 @@ Features:
13
13
 
14
14
  > __*__ deep signals -- with support for objects and arrays\
15
15
  > __**__ concurrent changes to the same data are auto-merged using [OT](https://en.wikipedia.org/wiki/Operational_transformation)\
16
- > __***__ similar to Firebase but with your own MongoDB-compatible database
16
+ > __***__ similar to Firebase but with your own MongoDB database
17
17
 
18
18
  ## Installation
19
19
 
20
20
  For installation and documentation see [teamplay.dev](https://teamplay.dev)
21
21
 
22
- ## ORM Compat Helpers
22
+ ## ORM Helpers
23
23
 
24
24
  For legacy Racer-style model mixins (for example versioning libraries which call
25
- `getAssociations()`), use ORM compat helpers from the `teamplay/orm` subpath:
25
+ `getAssociations()`), use ORM helpers from the `teamplay/orm` subpath:
26
26
 
27
27
  ```js
28
28
  import BaseModel, { hasMany, hasOne, belongsTo } from 'teamplay/orm'
@@ -1,4 +1,3 @@
1
- import SignalCompat from './Compat/SignalCompat.js';
2
1
  import type { SignalConstructor } from './types/signal.js';
3
2
  export type { FromJsonSchema, InferZodSchema, JsonSchema, JsonSchemaObject, ZodLikeSchema } from './types/jsonSchema.js';
4
3
  export type { ComputedQueryParamsInput, QueryParams, QueryParamsInput } from './types/query.js';
@@ -7,6 +6,5 @@ export type { AppendPath, JoinPath, PathSegment, SignalPath, WildcardPathSegment
7
6
  export type { AggregationSignal, AnySignal, ArraySignal, CollectionAggregationSignal, CollectionDocument, CollectionDocumentModel, CollectionQuerySignal, CollectionSignal, CollectionSignalFromSpec, CollectionSpec, DocumentSignal, JsonSchemaSpec, MaybePromise, MaybePromiseSubResult, PublicSignal, LocalSignalFactory, RegisteredAggregationInput, RuntimeSignalConstructor, RuntimeSignalInstance, QuerySignal, RootCollections, RootSignal, SignalBaseInstance, SignalChild, SignalChildren, SignalClass, SignalConstructor, SignalForKind, SignalKind, SignalInstance, SignalModelConstructor, PrivateSignalFromSpec, RootPrivateCollections, SubResult, TypedAggregationInput, TypedAggregationSignal, TypedSignal, ZodSchemaSpec } from './types/signal.js';
8
7
  export type { CollectionsFromManifest, ModelEntry, ModelManifest, PathModelsFromManifest, PrivateCollectionsFromManifest } from './types/modelManifest.js';
9
8
  export { Signal, SEGMENTS, ARRAY_METHOD, GET, GETTERS, DEFAULT_GETTERS, regularBindings, extremelyLateBindings, isPublicCollectionSignal, isPublicDocumentSignal, isPublicCollection, isPrivateCollection } from './SignalBase.js';
10
- export { SignalCompat };
11
9
  declare const DefaultSignal: SignalConstructor;
12
10
  export default DefaultSignal;
@@ -1,7 +1,4 @@
1
1
  import { Signal } from "./SignalBase.js";
2
- import SignalCompat from './Compat/SignalCompat.js';
3
- import { isCompatEnv } from './compatEnv.js';
4
2
  export { Signal, SEGMENTS, ARRAY_METHOD, GET, GETTERS, DEFAULT_GETTERS, regularBindings, extremelyLateBindings, isPublicCollectionSignal, isPublicDocumentSignal, isPublicCollection, isPrivateCollection } from "./SignalBase.js";
5
- export { SignalCompat };
6
- const DefaultSignal = (isCompatEnv() ? SignalCompat : Signal);
3
+ const DefaultSignal = Signal;
7
4
  export default DefaultSignal;
@@ -305,7 +305,7 @@ export async function setPublicDocReplace(segments, value) {
305
305
  }
306
306
  const relativePath = segments.slice(2);
307
307
  // json0 direct replace ops require every ancestor container to already exist.
308
- // Racer-like compat set, however, materializes missing/primitive parents while
308
+ // setPublicDoc() materializes missing/primitive parents while
309
309
  // descending into the path. Fall back to the older diff-based path when the
310
310
  // direct op would target a non-existent/non-object ancestor.
311
311
  if (!canApplyDirectReplaceOp(docState.snapshot || {}, relativePath)) {
@@ -36,7 +36,7 @@ function warnIfSchemaWasNotDefined(pattern, schema) {
36
36
  warnedUnwrappedSchemaPatterns.add(pattern);
37
37
  console.warn(`[teamplay] Schema for model "${pattern}" was loaded as a plain object. ` +
38
38
  'Wrap it with defineSchema(schema) to enable the conventional schema setup. ' +
39
- 'Plain schemas still work for backward compatibility.');
39
+ 'Plain schemas still work.');
40
40
  }
41
41
  function shouldWarnAboutUnwrappedSchemas() {
42
42
  const env = getProcessEnv();
@@ -157,7 +157,7 @@ function createImperativeQueryReadinessError($query, timeoutMs) {
157
157
  }
158
158
  }
159
159
  return Error(`
160
- Compat query did not fully materialize within ${timeoutMs}ms.
160
+ Query did not fully materialize within ${timeoutMs}ms.
161
161
  Collection: ${collection}
162
162
  Params: ${JSON.stringify(params)}
163
163
  Hash: ${hash}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "teamplay",
3
- "version": "0.5.0-alpha.37",
3
+ "version": "0.5.0-alpha.38",
4
4
  "description": "Full-stack signals ORM with multiplayer",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -57,16 +57,13 @@
57
57
  "scripts": {
58
58
  "build": "rm -rf dist && tsc -p tsconfig.build.json && rsync -a --include='*/' --include='*.d.ts' --include='*.cjs' --exclude='*' src/ dist/ && node ../../scripts/rewrite-dts-extensions.cjs dist",
59
59
  "prepublishOnly": "npm run build",
60
- "test": "npm run test-types && npm run test-types:external && npm run test-server && npm run test-client && npm run test-compat",
60
+ "test": "npm run test-types && npm run test-types:external && npm run test-server && npm run test-client",
61
61
  "test-types": "tsc -p tsconfig.type-tests.json",
62
62
  "test-types:external": "tsc -p tsconfig.external-consumer.json",
63
63
  "test-types:dist": "tsc -p tsconfig.external-consumer.dist.json",
64
64
  "test-server": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --expose-gc -C teamplay-ts\" mocha 'test/[!_]*.js'",
65
65
  "test-server-only": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --expose-gc -C teamplay-ts\" mocha --grep '@only' 'test/[!_]*.js'",
66
66
  "test-client": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --expose-gc --experimental-vm-modules -C teamplay-ts\" jest --runInBand",
67
- "test-compat": "npm run test-server-compat && npm run test-client-compat",
68
- "test-server-compat": "TEAMPLAY_COMPAT=1 NODE_OPTIONS=\"${NODE_OPTIONS:-} --expose-gc -C teamplay-ts\" mocha 'test/[!_]*.js'",
69
- "test-client-compat": "TEAMPLAY_COMPAT=1 NODE_OPTIONS=\"${NODE_OPTIONS:-} --expose-gc --experimental-vm-modules -C teamplay-ts\" jest --runInBand",
70
67
  "coverage-server": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --expose-gc -C teamplay-ts\" c8 --include 'src/orm/**' --include 'src/react/**' --include 'src/utils/**' mocha 'test/[!_]*.js'",
71
68
  "coverage-client": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --expose-gc --experimental-vm-modules -C teamplay-ts\" jest --coverage --coverageDirectory=coverage-client",
72
69
  "coverage": "npm run coverage-server && npm run coverage-client"
@@ -74,13 +71,13 @@
74
71
  "dependencies": {
75
72
  "@nx-js/observer-util": "^4.1.3",
76
73
  "@startupjs/sharedb-mingo-memory": "^4.0.0-2",
77
- "@teamplay/backend": "^0.5.0-alpha.13",
78
- "@teamplay/cache": "^0.5.0-alpha.7",
79
- "@teamplay/channel": "^0.5.0-alpha.10",
80
- "@teamplay/debug": "^0.5.0-alpha.7",
81
- "@teamplay/schema": "^0.5.0-alpha.13",
82
- "@teamplay/utils": "^0.5.0-alpha.7",
83
- "babel-plugin-teamplay": "^0.5.0-alpha.13",
74
+ "@teamplay/backend": "^0.5.0-alpha.38",
75
+ "@teamplay/cache": "^0.5.0-alpha.38",
76
+ "@teamplay/channel": "^0.5.0-alpha.38",
77
+ "@teamplay/debug": "^0.5.0-alpha.38",
78
+ "@teamplay/schema": "^0.5.0-alpha.38",
79
+ "@teamplay/utils": "^0.5.0-alpha.38",
80
+ "babel-plugin-teamplay": "^0.5.0-alpha.38",
84
81
  "diff-match-patch": "^1.0.5",
85
82
  "events": "^3.3.0",
86
83
  "json0-ot-diff": "^1.1.2",
@@ -139,5 +136,5 @@
139
136
  ]
140
137
  },
141
138
  "license": "MIT",
142
- "gitHead": "a42315c58db025a0ee725bbf5d633156c6e0f35a"
139
+ "gitHead": "bda8f3ddc879c9b9ac491b946e24b7a3e04adb65"
143
140
  }
@@ -1,3 +0,0 @@
1
- import { Signal } from '../SignalBase.js'
2
-
3
- export default class SignalCompat<TValue = unknown> extends Signal<TValue> {}
@@ -1,41 +0,0 @@
1
- import { Signal, SEGMENTS, isPublicCollection } from "../SignalBase.js";
2
- import { getRoot, ROOT_ID } from "../Root.js";
3
- import { getIdFieldsForSegments, isIdFieldPath } from "../idFields.js";
4
- import { incrementPublic as _incrementPublic } from '../dataTree.js';
5
- import { setReplacePrivateData } from '../privateData.js';
6
- class SignalCompat extends Signal {
7
- async increment(byNumber) {
8
- if (arguments.length > 1)
9
- throw Error('Signal.increment() expects a single argument');
10
- return incrementOnSignal(this, byNumber);
11
- }
12
- }
13
- async function incrementOnSignal($signal, byNumber) {
14
- const segments = $signal[SEGMENTS];
15
- if (segments.length === 0)
16
- throw Error('Can\'t increment the root signal data');
17
- const idFields = getIdFieldsForSegments(segments);
18
- if (isIdFieldPath(segments, idFields))
19
- return $signal.get();
20
- if (byNumber === undefined)
21
- byNumber = 1;
22
- if (typeof byNumber !== 'number')
23
- throw Error('Signal.increment() expects a number argument');
24
- let currentValue = $signal.get();
25
- if (currentValue === undefined)
26
- currentValue = 0;
27
- if (typeof currentValue !== 'number')
28
- throw Error('Signal.increment() tried to increment a non-number value');
29
- if (isPublicCollection(segments[0])) {
30
- await _incrementPublic(segments, byNumber);
31
- return currentValue + byNumber;
32
- }
33
- setReplacePrivateData(getOwningRootId($signal), segments, currentValue + byNumber);
34
- return currentValue + byNumber;
35
- }
36
- function getOwningRootId($signal) {
37
- const $root = getRoot($signal) || $signal;
38
- return $root?.[ROOT_ID];
39
- }
40
- export { SignalCompat };
41
- export default SignalCompat;
@@ -1 +0,0 @@
1
- export function isCompatEnv (): boolean
@@ -1,4 +0,0 @@
1
- export function isCompatEnv() {
2
- return globalThis?.teamplayCompatibilityMode ??
3
- (typeof process !== 'undefined' && process?.env?.TEAMPLAY_COMPAT === '1');
4
- }