@xiashe/sdk 0.1.8 → 0.1.9

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.
Files changed (2) hide show
  1. package/index.mjs +31 -3
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -6,7 +6,7 @@ import path from 'node:path';
6
6
  import { ConvexHttpClient } from 'convex/browser';
7
7
  import { anyApi as api } from 'convex/server';
8
8
 
9
- export const VERSION = '0.1.7';
9
+ export const VERSION = '0.1.9';
10
10
 
11
11
  export const DEFAULTS = {
12
12
  cn: {
@@ -515,8 +515,36 @@ export class XiasheClient {
515
515
  return this.query(api.skillInstallJobs.listForConnection, this.authArgs({ connectionId, limit }));
516
516
  }
517
517
 
518
- async createSkillSubmissionDraft(draft = {}) {
519
- return this.mutation(api.skillsCatalog.createSkillSubmissionDraft, this.authArgs({ draft }));
518
+ async createSkillSubmissionDraft(draft = {}, options = {}) {
519
+ const registryPublicToken = options.registryPublicToken || draft.registryPublicToken || draft._registryPublicToken;
520
+ const cleanDraft = { ...draft };
521
+ delete cleanDraft.registryPublicToken;
522
+ delete cleanDraft._registryPublicToken;
523
+ try {
524
+ return await this.mutation(api.skillsCatalog.createSkillSubmissionDraft, this.authArgs({ draft: cleanDraft }));
525
+ } catch (error) {
526
+ if (error?.code !== 'AUTH_REQUIRED' || !registryPublicToken || (!cleanDraft.registryEntryId && !cleanDraft.registryPublicSkillId)) {
527
+ throw error;
528
+ }
529
+ return await this.createSkillSubmissionDraftFromRegistry({
530
+ registryEntryId: cleanDraft.registryEntryId,
531
+ registryPublicSkillId: cleanDraft.registryPublicSkillId,
532
+ publicToken: registryPublicToken,
533
+ draft: cleanDraft
534
+ });
535
+ }
536
+ }
537
+
538
+ async createSkillSubmissionDraftFromRegistry(options = {}) {
539
+ const draft = { ...(options.draft || {}) };
540
+ delete draft.registryPublicToken;
541
+ delete draft._registryPublicToken;
542
+ return this.mutation(api.skillsCatalog.createSkillSubmissionDraftFromRegistry, {
543
+ registryEntryId: options.registryEntryId || draft.registryEntryId || undefined,
544
+ registryPublicSkillId: options.registryPublicSkillId || draft.registryPublicSkillId || undefined,
545
+ publicToken: options.publicToken || options.registryPublicToken,
546
+ draft
547
+ });
520
548
  }
521
549
 
522
550
  async updateSkillSubmissionDraft(submissionId, patch = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiashe/sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "index.mjs",
6
6
  "exports": {