@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.js CHANGED
@@ -9536,6 +9536,13 @@ var MutationProposeMolecule = class extends Mutation {
9536
9536
  molecule() {
9537
9537
  return this.$__molecule.toJSON ? this.$__molecule.toJSON() : this.$__molecule;
9538
9538
  }
9539
+ /**
9540
+ * Fills the molecule with specific mutation data.
9541
+ * Subclasses override to build domain-specific atoms.
9542
+ * Default implementation is a no-op for pre-assembled molecules.
9543
+ */
9544
+ fillMolecule(_params) {
9545
+ }
9539
9546
  };
9540
9547
 
9541
9548
  // src/response/ResponseCreateToken.ts
@@ -12092,15 +12099,30 @@ var KnishIOClient = class {
12092
12099
  async createPolicy({
12093
12100
  metaType,
12094
12101
  metaId,
12095
- policy = null
12102
+ policy = {}
12096
12103
  }) {
12097
12104
  this.log("info", `KnishIOClient::createPolicy() - Creating policy for ${metaType}:${metaId}...`);
12098
- return this.createMeta({
12105
+ const molecule = await this.createMolecule({});
12106
+ molecule.addPolicyAtom({
12099
12107
  metaType,
12100
12108
  metaId,
12101
- meta: null,
12102
- policy
12109
+ meta: {},
12110
+ policy: policy || {}
12111
+ });
12112
+ molecule.addContinuIdAtom();
12113
+ molecule.sign({
12114
+ bundle: this.getBundle()
12103
12115
  });
12116
+ molecule.check();
12117
+ const query = await this.createMoleculeMutation({
12118
+ mutationClass: MutationProposeMolecule,
12119
+ molecule
12120
+ });
12121
+ const response = await this.executeQuery(query);
12122
+ if (!response) {
12123
+ throw new CodeException("Policy creation failed");
12124
+ }
12125
+ return response;
12104
12126
  }
12105
12127
  /**
12106
12128
  * Create an identifier
@@ -12674,7 +12696,7 @@ function createDefaultSecretStorage(options = {}) {
12674
12696
  }
12675
12697
 
12676
12698
  // src/index.ts
12677
- var SDK_VERSION = "0.9.7";
12699
+ var SDK_VERSION = "0.9.8";
12678
12700
  var SDK_NAME = "KnishIO-Client-TS";
12679
12701
  var COMPATIBLE_SERVER_VERSIONS = [4, 5];
12680
12702
  var SDK_INFO = {