@rebasepro/inference 0.21.0 → 0.21.1
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 +6 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@ pnpm add @rebasepro/inference
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
ESM-only: `"type": "module"` with no CommonJS build, so it is loaded with
|
|
12
|
-
`import`.
|
|
13
|
-
`require(esm)
|
|
12
|
+
`import`. It needs Node `>=22.22.0` (its `engines` floor), where `require()`
|
|
13
|
+
of it resolves too: Node has supported `require(esm)` since 22.12.
|
|
14
14
|
|
|
15
15
|
## What This Package Does
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@ ESM-only: `"type": "module"` with no CommonJS build, so it is loaded with
|
|
|
22
22
|
|
|
23
23
|
| Export | Type | Description |
|
|
24
24
|
|---|---|---|
|
|
25
|
-
| `
|
|
25
|
+
| `buildEntityPropertiesFromData` | `(data: object[], getType: InferenceTypeBuilder) => Promise<Properties>` | Main entry — infer full property schema from data |
|
|
26
26
|
| `buildPropertyFromData` | `(data: unknown[], property: Property, getType: InferenceTypeBuilder) => Property` | Refine an existing property with new sample data |
|
|
27
27
|
| `buildPropertiesOrder` | `(properties: Properties, propertiesOrder?: string[], priorityKeys?: string[]) => string[]` | Sort property keys (title/name first, then images, then alphabetical) |
|
|
28
28
|
| `inferTypeFromValue` | `(value: unknown) => DataType` | Default type inference: string, number, boolean, array, map, vector |
|
|
@@ -32,7 +32,7 @@ ESM-only: `"type": "module"` with no CommonJS build, so it is loaded with
|
|
|
32
32
|
|
|
33
33
|
| Export | Description |
|
|
34
34
|
|---|---|
|
|
35
|
-
| `parseReferenceString` | Parse `"path/
|
|
35
|
+
| `parseReferenceString` | Parse `"path/entityId"` or `"db:::path/entityId"` format |
|
|
36
36
|
| `looksLikeReference` | Check if a string looks like a document reference |
|
|
37
37
|
| `findCommonInitialStringInPath` | Find shared collection path prefix in sample values |
|
|
38
38
|
| `removeInitialAndTrailingSlashes` | Path cleanup |
|
|
@@ -52,7 +52,7 @@ ESM-only: `"type": "module"` with no CommonJS build, so it is loaded with
|
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
54
|
import {
|
|
55
|
-
|
|
55
|
+
buildEntityPropertiesFromData,
|
|
56
56
|
inferTypeFromValue
|
|
57
57
|
} from "@rebasepro/inference";
|
|
58
58
|
|
|
@@ -62,7 +62,7 @@ const sampleData = [
|
|
|
62
62
|
{ name: "Carol", age: 28, active: true, role: "admin" },
|
|
63
63
|
];
|
|
64
64
|
|
|
65
|
-
const properties = await
|
|
65
|
+
const properties = await buildEntityPropertiesFromData(
|
|
66
66
|
sampleData,
|
|
67
67
|
inferTypeFromValue
|
|
68
68
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/inference",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"description": "Infer a Rebase collection schema from existing data.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rebase",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"module": "./dist/index.es.js",
|
|
30
30
|
"types": "dist/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@rebasepro/types": "0.21.
|
|
33
|
-
"@rebasepro/utils": "0.21.
|
|
32
|
+
"@rebasepro/types": "0.21.1",
|
|
33
|
+
"@rebasepro/utils": "0.21.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/jest": "^30.0.0",
|