@supernova-studio/model 0.53.3 → 0.53.5
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.mts +29 -28
- package/dist/index.d.ts +29 -28
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -4
- package/src/dsm/elements/data/documentation-block-v1.ts +2 -3
- package/src/utils/common.ts +22 -0
- package/src/workspace/workspace-role.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supernova-studio/model",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.5",
|
|
4
4
|
"description": "Supernova Data Models",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,11 +32,9 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@sindresorhus/slugify": "1.1.2",
|
|
34
34
|
"ip-cidr": "3.1.0",
|
|
35
|
-
"zod": "3.23.6"
|
|
36
|
-
"deep-equal": "2.2.3"
|
|
35
|
+
"zod": "3.23.6"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
|
-
"@types/deep-equal": "1.0.4",
|
|
40
38
|
"fs": "0.0.1-security",
|
|
41
39
|
"tsup": "8.0.2",
|
|
42
40
|
"typescript": "5.0.4"
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import deepEqual from "deep-equal";
|
|
2
1
|
import { z } from "zod";
|
|
3
2
|
import { nullishToOptional } from "../../../helpers";
|
|
4
|
-
import { mapByUnique } from "../../../utils";
|
|
3
|
+
import { areShallowObjectsEqual, mapByUnique } from "../../../utils";
|
|
5
4
|
import { ColorTokenInlineData } from "../../properties";
|
|
6
5
|
import { Size } from "../primitives";
|
|
7
6
|
import { DesignTokenType } from "../raw-element";
|
|
@@ -416,7 +415,7 @@ function areAttributesEqual(lhs: PageBlockTextSpanAttribute[], rhs: PageBlockTex
|
|
|
416
415
|
const lhsMap = mapByUnique(lhs, i => i.type);
|
|
417
416
|
for (const rhsAttribute of rhs) {
|
|
418
417
|
const lhsAttribute = lhsMap.get(rhsAttribute.type);
|
|
419
|
-
if (!
|
|
418
|
+
if (!areShallowObjectsEqual(lhsAttribute, rhsAttribute)) return false;
|
|
420
419
|
}
|
|
421
420
|
|
|
422
421
|
return true;
|
package/src/utils/common.ts
CHANGED
|
@@ -124,6 +124,28 @@ export function uniqueBy<K, V>(items: V[], prop: (v: V) => K): V[] {
|
|
|
124
124
|
return Array.from(mapByUnique(items, prop).values());
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
export function areShallowObjectsEqual<T extends object>(lhs: T | undefined, rhs: T | undefined) {
|
|
128
|
+
if ((lhs === undefined) !== (rhs === undefined)) return false;
|
|
129
|
+
if (lhs === undefined || rhs === undefined) return true;
|
|
130
|
+
|
|
131
|
+
if ((lhs === null) !== (rhs === null)) return false;
|
|
132
|
+
if (lhs === null || rhs === null) return true;
|
|
133
|
+
|
|
134
|
+
for (const key in lhs) {
|
|
135
|
+
if (!(key in rhs) || lhs[key] !== rhs[key]) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
for (const key in rhs) {
|
|
141
|
+
if (!(key in lhs)) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
|
|
127
149
|
export type Pagination = {
|
|
128
150
|
skip?: number;
|
|
129
151
|
take?: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
export const WorkspaceRoleSchema = z.enum(["Owner", "Admin", "Creator", "Viewer", "Billing", "Guest"]);
|
|
3
|
+
export const WorkspaceRoleSchema = z.enum(["Owner", "Admin", "Creator", "Viewer", "Billing", "Guest", "Contributor"]);
|
|
4
4
|
|
|
5
5
|
export type WorkspaceRole = z.infer<typeof WorkspaceRoleSchema>;
|
|
6
6
|
export const WorkspaceRole = WorkspaceRoleSchema.enum;
|