@tenonhq/sincronia-core 0.0.66 → 0.0.67

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.
@@ -182,8 +182,10 @@ class MultiScopeWatcherManager {
182
182
  try {
183
183
  var { defaultClient, unwrapSNResponse } = await Promise.resolve().then(() => __importStar(require("./snClient")));
184
184
  var client = defaultClient();
185
- // Switch to the target scope before creating
185
+ // Switch to the target scope and resolve its sys_id for update set creation
186
186
  await client.changeScope(scopeName);
187
+ var scopeIdResult = await unwrapSNResponse(client.getScopeId(scopeName));
188
+ var scopeSysId = scopeIdResult.length > 0 ? scopeIdResult[0].sys_id : undefined;
187
189
  // Search for an existing update set matching this task in this scope
188
190
  var query = "application.scope=" + scopeName +
189
191
  "^nameLIKECU-" + taskId +
@@ -203,8 +205,8 @@ class MultiScopeWatcherManager {
203
205
  Logger_1.logger.info(`[${scopeName}] Found existing update set: ${updateSet.name}`);
204
206
  }
205
207
  else {
206
- // Create a new one (scope already switched above)
207
- var createResp = await unwrapSNResponse(client.createUpdateSet(updateSetName, undefined, description));
208
+ // Create a new one with explicit scope sys_id
209
+ var createResp = await unwrapSNResponse(client.createUpdateSet(updateSetName, scopeSysId, description));
208
210
  updateSet = { sys_id: createResp.sys_id, name: updateSetName };
209
211
  Logger_1.logger.info(`[${scopeName}] Auto-created update set: ${updateSet.name}`);
210
212
  }
package/dist/appUtils.js CHANGED
@@ -477,11 +477,19 @@ const swapServerScope = async (scopeId) => {
477
477
  /**
478
478
  * Creates a new update set and assigns it to the current user.
479
479
  * @param updateSetName - does not create update set if value is blank
480
+ * @param scope - optional scope name (e.g. x_cadso_work) to create the update set in
480
481
  */
481
- const createAndAssignUpdateSet = async (updateSetName = "") => {
482
- Logger_1.logger.info(`Update Set Name: ${updateSetName}`);
482
+ const createAndAssignUpdateSet = async (updateSetName = "", scope) => {
483
+ Logger_1.logger.info(`Update Set Name: ${updateSetName}` + (scope ? ` (scope: ${scope})` : ""));
483
484
  const client = (0, snClient_1.defaultClient)();
484
- const { sys_id: updateSetSysId } = await (0, snClient_1.unwrapSNResponse)(client.createUpdateSet(updateSetName));
485
+ var scopeSysId;
486
+ if (scope) {
487
+ var scopeResult = await (0, snClient_1.unwrapSNResponse)(client.getScopeId(scope));
488
+ if (scopeResult.length > 0) {
489
+ scopeSysId = scopeResult[0].sys_id;
490
+ }
491
+ }
492
+ const { sys_id: updateSetSysId } = await (0, snClient_1.unwrapSNResponse)(client.createUpdateSet(updateSetName, scopeSysId));
485
493
  const userSysId = await (0, snClient_1.unwrapTableAPIFirstItem)(client.getUserSysId(), "sys_id");
486
494
  const curUpdateSetUserPrefId = await (0, snClient_1.unwrapTableAPIFirstItem)(client.getCurrentUpdateSetUserPref(userSysId), "sys_id");
487
495
  if (curUpdateSetUserPrefId !== "") {
package/dist/commands.js CHANGED
@@ -151,6 +151,14 @@ async function pushCommand(args) {
151
151
  process.exit(1);
152
152
  }
153
153
  }
154
+ // Extract scope from file list for update set creation
155
+ var pushScope;
156
+ if (fileList.length > 0) {
157
+ var fieldKeys = Object.keys(fileList[0].fields);
158
+ if (fieldKeys.length > 0) {
159
+ pushScope = fileList[0].fields[fieldKeys[0]].scope;
160
+ }
161
+ }
154
162
  // Does not create update set if updateSetName is blank
155
163
  if (resolvedUpdateSet) {
156
164
  if (!skipPrompt) {
@@ -166,7 +174,7 @@ async function pushCommand(args) {
166
174
  process.exit(0);
167
175
  }
168
176
  }
169
- const newUpdateSet = await AppUtils.createAndAssignUpdateSet(resolvedUpdateSet);
177
+ const newUpdateSet = await AppUtils.createAndAssignUpdateSet(resolvedUpdateSet, pushScope);
170
178
  Logger_1.logger.debug(`New Update Set Created(${newUpdateSet.name}) sys_id:${newUpdateSet.id}`);
171
179
  }
172
180
  const pushResults = await AppUtils.pushFiles(fileList);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonhq/sincronia-core",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "description": "Next-gen file syncer",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./dist/index.js",
@@ -66,5 +66,5 @@
66
66
  "publishConfig": {
67
67
  "access": "public"
68
68
  },
69
- "gitHead": "570f821dbee04707b609906e90cf139de39ed00e"
69
+ "gitHead": "934d57f57cffa9b72585ac29b597432b5e427858"
70
70
  }