@remoteoss/remote-json-schema-form-kit 0.0.10
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/CHANGELOG.md +61 -0
- package/README.md +56 -0
- package/dist/dateUtils.d.ts +11 -0
- package/dist/dateUtils.d.ts.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +43 -0
- package/dist/index.mjs.map +1 -0
- package/dist/json-logic-operators/dateAddDays.d.ts +8 -0
- package/dist/json-logic-operators/dateAddDays.d.ts.map +1 -0
- package/dist/json-logic-operators/dateAddMonths.d.ts +8 -0
- package/dist/json-logic-operators/dateAddMonths.d.ts.map +1 -0
- package/dist/json-logic-operators/dateDifferenceInDays.d.ts +8 -0
- package/dist/json-logic-operators/dateDifferenceInDays.d.ts.map +1 -0
- package/dist/json-logic-operators/dateDifferenceInMonths.d.ts +8 -0
- package/dist/json-logic-operators/dateDifferenceInMonths.d.ts.map +1 -0
- package/dist/json-logic-operators/dateDifferenceInWeeks.d.ts +8 -0
- package/dist/json-logic-operators/dateDifferenceInWeeks.d.ts.map +1 -0
- package/dist/json-logic-operators/dateFormat.d.ts +8 -0
- package/dist/json-logic-operators/dateFormat.d.ts.map +1 -0
- package/dist/json-logic-operators/index.d.ts +15 -0
- package/dist/json-logic-operators/index.d.ts.map +1 -0
- package/package.json +60 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#### 0.0.10 (2026-03-19)
|
|
2
|
+
|
|
3
|
+
#### New features
|
|
4
|
+
|
|
5
|
+
- bump `@remoteoss/json-schema-form` to 1.2.11
|
|
6
|
+
|
|
7
|
+
#### 0.0.9 (2026-03-10)
|
|
8
|
+
|
|
9
|
+
#### Bug fixes
|
|
10
|
+
|
|
11
|
+
- Fixes `modify` calls not working correctly with `nextVersion` option
|
|
12
|
+
|
|
13
|
+
#### 0.0.8 (2026-03-09)
|
|
14
|
+
|
|
15
|
+
#### New features
|
|
16
|
+
|
|
17
|
+
- Adds new `date_difference_in_weeks` json-logic operator
|
|
18
|
+
- Adds `dateWithoutTimezoneOffset` util and all date related json-logic operators now use it. This guarantees that server-side validations match client side validations by removing timezone offsets from dates
|
|
19
|
+
- Adds tests
|
|
20
|
+
|
|
21
|
+
#### 0.0.7 (2026-02-19)
|
|
22
|
+
|
|
23
|
+
#### New features
|
|
24
|
+
|
|
25
|
+
- Add `date_format` json-logic operator [5449a70cf09132b02ba63ff5cf872e2fb993de20](https://github.com/remoteoss/remote-json-schema-form-kit/commit/5449a70cf09132b02ba63ff5cf872e2fb993de20)
|
|
26
|
+
|
|
27
|
+
#### 0.0.6 (2026-02-12)
|
|
28
|
+
|
|
29
|
+
#### New features
|
|
30
|
+
|
|
31
|
+
- Add `date_add_months` json-logic operator [3f16cc2d8aa28578c75f0bcd2661f1f3eae12ab1](https://github.com/remoteoss/remote-json-schema-form-kit/commit/3f16cc2d8aa28578c75f0bcd2661f1f3eae12ab1)
|
|
32
|
+
|
|
33
|
+
#### 0.0.5 (2026-01-21)
|
|
34
|
+
|
|
35
|
+
#### New features
|
|
36
|
+
|
|
37
|
+
- Export `ModifyConfig`, `ValidationResult` and `FormErrors` types [44a70c3cdb9f6ca4d2f6bcffe99d345d70bab2eb](https://github.com/remoteoss/remote-json-schema-form-kit/commit/44a70c3cdb9f6ca4d2f6bcffe99d345d70bab2eb)
|
|
38
|
+
|
|
39
|
+
#### 0.0.4 (2026-01-20)
|
|
40
|
+
|
|
41
|
+
#### New features
|
|
42
|
+
|
|
43
|
+
- bump `@remoteoss/json-schema-form` to 1.2.9 [15d767a57589d82c8f2fb80df9324e0827ea6acf](https://github.com/remoteoss/remote-json-schema-form-kit/commit/5683e829f4c6acb7ab04b21d2fd49c89f5a18c2c)
|
|
44
|
+
|
|
45
|
+
#### 0.0.3
|
|
46
|
+
|
|
47
|
+
#### New features
|
|
48
|
+
|
|
49
|
+
- bump `@remoteoss/json-schema-form` to 1.2.8 [b8ba9bf8b9ae8ad5d9d81ce1f8160d5cba3e1f5c](https://github.com/remoteoss/remote-json-schema-form-kit/commit/b8ba9bf8b9ae8ad5d9d81ce1f8160d5cba3e1f5c)
|
|
50
|
+
|
|
51
|
+
#### 0.0.2 (2025-11-21)
|
|
52
|
+
|
|
53
|
+
#### New features
|
|
54
|
+
|
|
55
|
+
- Add types definition ([5683e829f4c6acb7ab04b21d2fd49c89f5a18c2c](https://github.com/remoteoss/remote-json-schema-form-kit/commit/5683e829f4c6acb7ab04b21d2fd49c89f5a18c2c))
|
|
56
|
+
|
|
57
|
+
#### 0.0.1 (2025-11-14)
|
|
58
|
+
|
|
59
|
+
##### New features
|
|
60
|
+
|
|
61
|
+
- release package ([98b069a1285ac5c809aac5747cf5de34b426be62](https://github.com/remoteoss/remote-json-schema-form-kit/commit/98b069a1285ac5c809aac5747cf5de34b426be62))
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# remote-json-schema-form-kit
|
|
2
|
+
|
|
3
|
+
Remote's wrapper around [`@remoteoss/json-schema-form`](https://github.com/remoteoss/json-schema-form) (JSF) with added JSON logic operators.
|
|
4
|
+
|
|
5
|
+
This package exposes the two JSF versions v0 (legacy) and v1 (new).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @remoteoss/remote-json-schema-form-kit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createHeadlessForm, modify } from '@remoteoss/remote-json-schema-form-kit';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## How version routing works
|
|
20
|
+
|
|
21
|
+
This package exposes the two JSF versions we use:
|
|
22
|
+
|
|
23
|
+
- **v0 (legacy)** — `@remoteoss/json-schema-form@0.x`
|
|
24
|
+
- **v1** — `@remoteoss/json-schema-form@1.x`
|
|
25
|
+
|
|
26
|
+
When you call `createHeadlessForm(schema, options)` or `modify(schema, options)`, the kit checks:
|
|
27
|
+
|
|
28
|
+
1. `schema["x-rmt-meta"].jsfVersion === "1"` (schema-level marker set when consuming schemas via API)
|
|
29
|
+
2. `options.nextVersion === true` (explicit caller override)
|
|
30
|
+
|
|
31
|
+
If either condition is true, the call is forwarded to the **v1** implementation. Otherwise it falls back to the **v0** implementation.
|
|
32
|
+
|
|
33
|
+
**For v1**, the kit also injects:
|
|
34
|
+
|
|
35
|
+
- **Custom JSON Logic operators** via `customJsonLogicOps`
|
|
36
|
+
- **Legacy compatibility options** (`treatNullAsUndefined`, `allowForbiddenValues`)
|
|
37
|
+
|
|
38
|
+
**⚠️** In the next major version of this kit, the default JSF will be `v1`, unless callers opt out explicitly.
|
|
39
|
+
|
|
40
|
+
### TypeScript types (v0 vs v1)
|
|
41
|
+
|
|
42
|
+
The kit already disambiguates some overlapping concepts. All types are v1 by default. Some types for `v0` has a `*Legacy` suffix, for example `ModifyConfigLegacy`, `FieldLegacy`, etc.
|
|
43
|
+
|
|
44
|
+
## CONTRIBUTING
|
|
45
|
+
|
|
46
|
+
This project was previously [in Github](https://github.com/remoteoss/remote-json-schema-form-kit), but it has moved to our internal private monorepo to improve the DX when updating JSF. We might consider doing a new mirror on Github for transparency. If you need it, let us know!
|
|
47
|
+
|
|
48
|
+
### Adding a new custom JSON Logic operator
|
|
49
|
+
|
|
50
|
+
1. Create a new file in `src/json-logic-operators/` and write tests (follow the existing pattern, e.g. `dateAddDays.ts`)
|
|
51
|
+
2. Export it from `src/json-logic-operators/index.ts` in the `operators` object
|
|
52
|
+
3. The key in the `operators` object is the operator name used in JSON Schemas (e.g. `date_add_days`)
|
|
53
|
+
|
|
54
|
+
### Deploy
|
|
55
|
+
|
|
56
|
+
Read [README_internal.md](./README_internal.md) for more info.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function parseISODate(date: unknown): Date;
|
|
2
|
+
/**
|
|
3
|
+
* Formats a local-noon Date (as produced by parseISODate + date-fns arithmetic)
|
|
4
|
+
* back to a "YYYY-MM-DD" string using local calendar parts.
|
|
5
|
+
*
|
|
6
|
+
* Uses getFullYear/getMonth/getDate (local getters) rather than date-fns format
|
|
7
|
+
* to avoid pulling in an extra dependency for a trivial operation and to make the
|
|
8
|
+
* local-noon ↔ local-getter pairing explicit.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatISODate(date: Date): string;
|
|
11
|
+
//# sourceMappingURL=dateUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateUtils.d.ts","sourceRoot":"","sources":["../src/dateUtils.ts"],"names":[],"mappings":"AA8FA,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAUhD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAKhD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createHeadlessForm as createHeadlessFormNext, modify as modifyNext } from '@remoteoss/json-schema-form';
|
|
2
|
+
import { type Field as FieldNext, type CreateHeadlessFormOptions, type FormErrors as FormErrorsNext } from '@remoteoss/json-schema-form';
|
|
3
|
+
import { createHeadlessForm as createHeadlessFormV0, modify as modifyV0 } from '@remoteoss/json-schema-form-v0-deprecated';
|
|
4
|
+
export { buildCompleteYupSchema, pickXKey } from '@remoteoss/json-schema-form-v0-deprecated';
|
|
5
|
+
/**
|
|
6
|
+
* Re-exported from v0 today. When `@remoteoss/json-schema-form` (v1) publishes the same names
|
|
7
|
+
* (`Fields`, `FieldAttrs`, `JSONSchemaObjectType`, `HeadlessFormOutput`, …), there will be a name clash.
|
|
8
|
+
* We'll rename v0 types with `*Legacy` aliases, eg FieldsLegacy. We already do that with ModifyConfigLegacy.
|
|
9
|
+
*/
|
|
10
|
+
export type { Fields, FieldAttrs, JSONSchemaObjectType, HeadlessFormOutput, } from '@remoteoss/json-schema-form-v0-deprecated';
|
|
11
|
+
type FormSchemaNext = Parameters<typeof createHeadlessFormNext>[0];
|
|
12
|
+
type FormSchemaLegacy = Parameters<typeof createHeadlessFormV0>[0];
|
|
13
|
+
type FormSchema = FormSchemaNext | FormSchemaLegacy;
|
|
14
|
+
type FormResultNext = ReturnType<typeof createHeadlessFormNext>;
|
|
15
|
+
type FormResultLegacy = ReturnType<typeof createHeadlessFormV0>;
|
|
16
|
+
type FormResultForVersion<TNextVersion extends boolean> = TNextVersion extends true ? FormResultNext : FormResultLegacy;
|
|
17
|
+
type ModifyResultNext = ReturnType<typeof modifyNext>;
|
|
18
|
+
type ModifyResultLegacy = ReturnType<typeof modifyV0>;
|
|
19
|
+
type ModifyResultForVersion<TNextVersion extends boolean> = TNextVersion extends true ? ModifyResultNext : ModifyResultLegacy;
|
|
20
|
+
export type ModifyConfig = Parameters<typeof modifyNext>[1];
|
|
21
|
+
export type ModifyConfigLegacy = Parameters<typeof modifyV0>[1];
|
|
22
|
+
type ModifyConfigForVersion<TNextVersion extends boolean> = TNextVersion extends true ? ModifyConfig & {
|
|
23
|
+
nextVersion?: TNextVersion;
|
|
24
|
+
} : ModifyConfigLegacy & {
|
|
25
|
+
nextVersion?: TNextVersion;
|
|
26
|
+
};
|
|
27
|
+
export type FormErrors = FormErrorsNext;
|
|
28
|
+
export type FormErrorsLegacy = ReturnType<typeof createHeadlessFormV0>['handleValidation'];
|
|
29
|
+
export type Field = FieldNext;
|
|
30
|
+
export type FieldLegacy = FormResultLegacy['fields'];
|
|
31
|
+
export type { CreateHeadlessFormOptions } from '@remoteoss/json-schema-form';
|
|
32
|
+
/**
|
|
33
|
+
* Wrapper around @remoteoss/json-schema-form that does 2 things:
|
|
34
|
+
* - Decides to load v0 or v1 of JSF.
|
|
35
|
+
* - Includes addon for json-logic operators
|
|
36
|
+
*/
|
|
37
|
+
export declare function createHeadlessForm<TNextVersion extends boolean = false>(formSchema: FormSchema, jsfOptions?: CreateHeadlessFormOptions & {
|
|
38
|
+
nextVersion?: TNextVersion;
|
|
39
|
+
}): FormResultForVersion<TNextVersion>;
|
|
40
|
+
export declare function modify<TNextVersion extends boolean = false>(formSchema: FormSchema, options?: ModifyConfigForVersion<TNextVersion>): ModifyResultForVersion<TNextVersion>;
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,IAAI,sBAAsB,EAC5C,MAAM,IAAI,UAAU,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,KAAK,IAAI,SAAS,EACvB,KAAK,yBAAyB,EAC9B,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kBAAkB,IAAI,oBAAoB,EAC1C,MAAM,IAAI,QAAQ,EACnB,MAAM,2CAA2C,CAAC;AAInD,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAE7F;;;;GAIG;AACH,YAAY,EACV,MAAM,EACN,UAAU,EACV,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,2CAA2C,CAAC;AAEnD,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;AAGnE,KAAK,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAEpD,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAChE,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEhE,KAAK,oBAAoB,CAAC,YAAY,SAAS,OAAO,IAAI,YAAY,SAAS,IAAI,GAC/E,cAAc,GACd,gBAAgB,CAAC;AAErB,KAAK,gBAAgB,GAAG,UAAU,C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