@patterkit/core 0.4.0 → 0.4.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/dist/index.cjs CHANGED
@@ -174,6 +174,7 @@ function validateProject(input) {
174
174
  }
175
175
  }
176
176
  };
177
+ const addressOf = (node) => (0, import_model2.effectiveGameId)({ gameId: node.gameId, name: typeof node.name === "string" ? node.name : "" });
177
178
  const seeId = (id, kind, where) => {
178
179
  if (typeof id !== "string" || id.length === 0) {
179
180
  issues.push({ code: "missing-id", message: `${kind} in ${where} has no id` });
@@ -198,7 +199,7 @@ function validateProject(input) {
198
199
  if (scene.gameId && !(0, import_model2.isValidGameId)(scene.gameId)) {
199
200
  issues.push({ code: "invalid-gameid", message: `${where} address '${scene.gameId}' is invalid (lowercase letters, digits, hyphens; no leading/trailing hyphen)`, id: scene.id });
200
201
  }
201
- const sgid = (0, import_model2.effectiveGameId)(scene);
202
+ const sgid = addressOf(scene);
202
203
  if (sgid) {
203
204
  const prev = sceneGameIds.get(sgid);
204
205
  if (prev && prev !== scene.id) issues.push({ code: "duplicate-gameid", message: `${where} address '${sgid}' is already used by scene '${prev}'`, id: scene.id });
@@ -233,7 +234,7 @@ function validateProject(input) {
233
234
  if (block.gameId && !(0, import_model2.isValidGameId)(block.gameId)) {
234
235
  issues.push({ code: "invalid-gameid", message: `block '${block.id}' address '${block.gameId}' is invalid (lowercase letters, digits, hyphens; no leading/trailing hyphen)`, id: block.id });
235
236
  }
236
- const bgid = (0, import_model2.effectiveGameId)(block);
237
+ const bgid = addressOf(block);
237
238
  if (bgid) {
238
239
  const prev = blockGameIds.get(bgid);
239
240
  if (prev && prev !== block.id) issues.push({ code: "duplicate-gameid", message: `block '${block.id}' address '${bgid}' is already used by block '${prev}' in ${where}`, id: block.id });
package/dist/index.js CHANGED
@@ -136,6 +136,7 @@ function validateProject(input) {
136
136
  }
137
137
  }
138
138
  };
139
+ const addressOf = (node) => effectiveGameId({ gameId: node.gameId, name: typeof node.name === "string" ? node.name : "" });
139
140
  const seeId = (id, kind, where) => {
140
141
  if (typeof id !== "string" || id.length === 0) {
141
142
  issues.push({ code: "missing-id", message: `${kind} in ${where} has no id` });
@@ -160,7 +161,7 @@ function validateProject(input) {
160
161
  if (scene.gameId && !isValidGameId(scene.gameId)) {
161
162
  issues.push({ code: "invalid-gameid", message: `${where} address '${scene.gameId}' is invalid (lowercase letters, digits, hyphens; no leading/trailing hyphen)`, id: scene.id });
162
163
  }
163
- const sgid = effectiveGameId(scene);
164
+ const sgid = addressOf(scene);
164
165
  if (sgid) {
165
166
  const prev = sceneGameIds.get(sgid);
166
167
  if (prev && prev !== scene.id) issues.push({ code: "duplicate-gameid", message: `${where} address '${sgid}' is already used by scene '${prev}'`, id: scene.id });
@@ -195,7 +196,7 @@ function validateProject(input) {
195
196
  if (block.gameId && !isValidGameId(block.gameId)) {
196
197
  issues.push({ code: "invalid-gameid", message: `block '${block.id}' address '${block.gameId}' is invalid (lowercase letters, digits, hyphens; no leading/trailing hyphen)`, id: block.id });
197
198
  }
198
- const bgid = effectiveGameId(block);
199
+ const bgid = addressOf(block);
199
200
  if (bgid) {
200
201
  const prev = blockGameIds.get(bgid);
201
202
  if (prev && prev !== block.id) issues.push({ code: "duplicate-gameid", message: `block '${block.id}' address '${bgid}' is already used by block '${prev}' in ${where}`, id: block.id });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Patter core: stable id generation, readable-handle computation, canonical (de)serialisation, and the structural validator.",
5
5
  "type": "module",
6
6
  "license": "MIT",