@wishknish/knishio-client-ts 0.9.7 → 0.9.8

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
@@ -9542,6 +9542,13 @@ var MutationProposeMolecule = class extends Mutation {
9542
9542
  molecule() {
9543
9543
  return this.$__molecule.toJSON ? this.$__molecule.toJSON() : this.$__molecule;
9544
9544
  }
9545
+ /**
9546
+ * Fills the molecule with specific mutation data.
9547
+ * Subclasses override to build domain-specific atoms.
9548
+ * Default implementation is a no-op for pre-assembled molecules.
9549
+ */
9550
+ fillMolecule(_params) {
9551
+ }
9545
9552
  };
9546
9553
 
9547
9554
  // src/response/ResponseCreateToken.ts
@@ -12098,15 +12105,30 @@ var KnishIOClient = class {
12098
12105
  async createPolicy({
12099
12106
  metaType,
12100
12107
  metaId,
12101
- policy = null
12108
+ policy = {}
12102
12109
  }) {
12103
12110
  this.log("info", `KnishIOClient::createPolicy() - Creating policy for ${metaType}:${metaId}...`);
12104
- return this.createMeta({
12111
+ const molecule = await this.createMolecule({});
12112
+ molecule.addPolicyAtom({
12105
12113
  metaType,
12106
12114
  metaId,
12107
- meta: null,
12108
- policy
12115
+ meta: {},
12116
+ policy: policy || {}
12117
+ });
12118
+ molecule.addContinuIdAtom();
12119
+ molecule.sign({
12120
+ bundle: this.getBundle()
12109
12121
  });
12122
+ molecule.check();
12123
+ const query = await this.createMoleculeMutation({
12124
+ mutationClass: MutationProposeMolecule,
12125
+ molecule
12126
+ });
12127
+ const response = await this.executeQuery(query);
12128
+ if (!response) {
12129
+ throw new CodeException("Policy creation failed");
12130
+ }
12131
+ return response;
12110
12132
  }
12111
12133
  /**
12112
12134
  * Create an identifier
@@ -12680,7 +12702,7 @@ function createDefaultSecretStorage(options = {}) {
12680
12702
  }
12681
12703
 
12682
12704
  // src/index.ts
12683
- var SDK_VERSION = "0.9.7";
12705
+ var SDK_VERSION = "0.9.8";
12684
12706
  var SDK_NAME = "KnishIO-Client-TS";
12685
12707
  var COMPATIBLE_SERVER_VERSIONS = [4, 5];
12686
12708
  var SDK_INFO = {