@fedify/vocab-tools 2.0.30 → 2.0.31-dev.2273

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/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.0.30",
3
+ "version": "2.0.31-dev.2273+bf0ebffc",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./src/mod.ts"
package/dist/mod.cjs CHANGED
@@ -8,7 +8,7 @@ let yaml = require("yaml");
8
8
  let es_toolkit = require("es-toolkit");
9
9
  //#region deno.json
10
10
  var name = "@fedify/vocab-tools";
11
- var version = "2.0.30";
11
+ var version = "2.0.31-dev.2273+bf0ebffc";
12
12
  //#endregion
13
13
  //#region src/type.ts
14
14
  const HEURISTICS_CONTEXTS = [
@@ -1171,7 +1171,7 @@ async function* generateConstructor(typeUri, types) {
1171
1171
  if (Array.isArray(values.${property.pluralName}) &&
1172
1172
  values.${property.pluralName}.every(v => ${typeGuards})) {
1173
1173
  // @ts-ignore: type is checked above.
1174
- this.${fieldName} = values.${property.pluralName};
1174
+ this.${fieldName} = values.${property.pluralName}.slice();
1175
1175
  `;
1176
1176
  if (!allScalarTypes) yield `
1177
1177
  for (let i = 0; i < values.${property.pluralName}.length; i++) {
@@ -1198,7 +1198,8 @@ async function* generateCloner(typeUri, types) {
1198
1198
  * Clones this instance, optionally updating it with the given values.
1199
1199
  * @param values The values to update the clone with.
1200
1200
  * @param options The options to use for cloning.
1201
- * @returns The cloned instance.
1201
+ * @returns The cloned instance with its own property arrays. Nested objects
1202
+ * and URLs are shared with this instance.
1202
1203
  */
1203
1204
  ${emitOverride$1(typeUri, types)} clone(
1204
1205
  values:
@@ -1232,7 +1233,7 @@ async function* generateCloner(typeUri, types) {
1232
1233
  const fieldName = await getFieldName(property.uri);
1233
1234
  const trustFieldName = await getFieldName(property.uri, "#_trust");
1234
1235
  const allScalarTypes = areAllScalarTypes(property.range, types);
1235
- yield `clone.${fieldName} = this.${fieldName};`;
1236
+ yield `clone.${fieldName} = this.${fieldName}.slice();`;
1236
1237
  if (!allScalarTypes) yield `clone.${trustFieldName} = new Set(this.${trustFieldName});`;
1237
1238
  if (hasSingularAccessor(property)) {
1238
1239
  let typeGuards = getTypeGuards(property.range, types, `values.${property.singularName}`);
@@ -1283,7 +1284,7 @@ async function* generateCloner(typeUri, types) {
1283
1284
  if (Array.isArray(values.${property.pluralName}) &&
1284
1285
  values.${property.pluralName}.every(v => ${typeGuards})) {
1285
1286
  // @ts-ignore: type is checked above.
1286
- clone.${fieldName} = values.${property.pluralName};
1287
+ clone.${fieldName} = values.${property.pluralName}.slice();
1287
1288
  `;
1288
1289
  if (!allScalarTypes) yield `
1289
1290
  clone.${trustFieldName} = new Set();
package/dist/mod.js CHANGED
@@ -7,7 +7,7 @@ import { parse } from "yaml";
7
7
  import { pascalCase } from "es-toolkit";
8
8
  //#region deno.json
9
9
  var name = "@fedify/vocab-tools";
10
- var version = "2.0.30";
10
+ var version = "2.0.31-dev.2273+bf0ebffc";
11
11
  //#endregion
12
12
  //#region src/type.ts
13
13
  const HEURISTICS_CONTEXTS = [
@@ -1170,7 +1170,7 @@ async function* generateConstructor(typeUri, types) {
1170
1170
  if (Array.isArray(values.${property.pluralName}) &&
1171
1171
  values.${property.pluralName}.every(v => ${typeGuards})) {
1172
1172
  // @ts-ignore: type is checked above.
1173
- this.${fieldName} = values.${property.pluralName};
1173
+ this.${fieldName} = values.${property.pluralName}.slice();
1174
1174
  `;
1175
1175
  if (!allScalarTypes) yield `
1176
1176
  for (let i = 0; i < values.${property.pluralName}.length; i++) {
@@ -1197,7 +1197,8 @@ async function* generateCloner(typeUri, types) {
1197
1197
  * Clones this instance, optionally updating it with the given values.
1198
1198
  * @param values The values to update the clone with.
1199
1199
  * @param options The options to use for cloning.
1200
- * @returns The cloned instance.
1200
+ * @returns The cloned instance with its own property arrays. Nested objects
1201
+ * and URLs are shared with this instance.
1201
1202
  */
1202
1203
  ${emitOverride$1(typeUri, types)} clone(
1203
1204
  values:
@@ -1231,7 +1232,7 @@ async function* generateCloner(typeUri, types) {
1231
1232
  const fieldName = await getFieldName(property.uri);
1232
1233
  const trustFieldName = await getFieldName(property.uri, "#_trust");
1233
1234
  const allScalarTypes = areAllScalarTypes(property.range, types);
1234
- yield `clone.${fieldName} = this.${fieldName};`;
1235
+ yield `clone.${fieldName} = this.${fieldName}.slice();`;
1235
1236
  if (!allScalarTypes) yield `clone.${trustFieldName} = new Set(this.${trustFieldName});`;
1236
1237
  if (hasSingularAccessor(property)) {
1237
1238
  let typeGuards = getTypeGuards(property.range, types, `values.${property.singularName}`);
@@ -1282,7 +1283,7 @@ async function* generateCloner(typeUri, types) {
1282
1283
  if (Array.isArray(values.${property.pluralName}) &&
1283
1284
  values.${property.pluralName}.every(v => ${typeGuards})) {
1284
1285
  // @ts-ignore: type is checked above.
1285
- clone.${fieldName} = values.${property.pluralName};
1286
+ clone.${fieldName} = values.${property.pluralName}.slice();
1286
1287
  `;
1287
1288
  if (!allScalarTypes) yield `
1288
1289
  clone.${trustFieldName} = new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/vocab-tools",
3
- "version": "2.0.30",
3
+ "version": "2.0.31-dev.2273+bf0ebffc",
4
4
  "description": "Code generator for Activity Vocabulary APIs",
5
5
  "homepage": "https://fedify.dev/",
6
6
  "repository": {