@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 +27 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.iife.js +27 -5
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/KnishIOClient.ts +22 -5
- package/src/index.ts +1 -1
- package/src/mutation/MutationProposeMolecule.ts +7 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wishknish/knishio-client-ts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8",
|
|
4
4
|
"productName": "Knish.IO TypeScript SDK Client",
|
|
5
5
|
"description": "TypeScript implementation of the Knish.IO SDK to consume Knish.IO GraphQL APIs with enhanced type safety.",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
package/src/KnishIOClient.ts
CHANGED
|
@@ -2195,7 +2195,7 @@ export default class KnishIOClient {
|
|
|
2195
2195
|
async createPolicy({
|
|
2196
2196
|
metaType,
|
|
2197
2197
|
metaId,
|
|
2198
|
-
policy =
|
|
2198
|
+
policy = {}
|
|
2199
2199
|
}: {
|
|
2200
2200
|
metaType: MetaType | string
|
|
2201
2201
|
metaId: MetaId | string
|
|
@@ -2203,13 +2203,30 @@ export default class KnishIOClient {
|
|
|
2203
2203
|
}): Promise<Response> {
|
|
2204
2204
|
this.log('info', `KnishIOClient::createPolicy() - Creating policy for ${metaType}:${metaId}...`)
|
|
2205
2205
|
|
|
2206
|
-
|
|
2207
|
-
|
|
2206
|
+
const molecule = await this.createMolecule({})
|
|
2207
|
+
molecule.addPolicyAtom({
|
|
2208
2208
|
metaType,
|
|
2209
2209
|
metaId,
|
|
2210
|
-
meta:
|
|
2211
|
-
policy
|
|
2210
|
+
meta: {},
|
|
2211
|
+
policy: policy || {}
|
|
2212
|
+
})
|
|
2213
|
+
molecule.addContinuIdAtom()
|
|
2214
|
+
molecule.sign({
|
|
2215
|
+
bundle: this.getBundle()
|
|
2216
|
+
})
|
|
2217
|
+
molecule.check()
|
|
2218
|
+
|
|
2219
|
+
const query = await this.createMoleculeMutation({
|
|
2220
|
+
mutationClass: MutationProposeMolecule,
|
|
2221
|
+
molecule
|
|
2212
2222
|
})
|
|
2223
|
+
const response = await this.executeQuery(query)
|
|
2224
|
+
|
|
2225
|
+
if (!response) {
|
|
2226
|
+
throw new CodeException('Policy creation failed')
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
return response
|
|
2213
2230
|
}
|
|
2214
2231
|
|
|
2215
2232
|
/**
|
package/src/index.ts
CHANGED
|
@@ -389,7 +389,7 @@ export {
|
|
|
389
389
|
// MUST equal package.json's "version". The CI `version consistency` job enforces this via
|
|
390
390
|
// .github/scripts/check-version.sh, which parses this exact line — keep the literal form
|
|
391
391
|
// `export const SDK_VERSION = '<semver>'` intact so the gate can read it.
|
|
392
|
-
export const SDK_VERSION = '0.9.
|
|
392
|
+
export const SDK_VERSION = '0.9.8'
|
|
393
393
|
export const SDK_NAME = 'KnishIO-Client-TS'
|
|
394
394
|
export const COMPATIBLE_SERVER_VERSIONS = [4, 5]
|
|
395
395
|
|
|
@@ -57,7 +57,7 @@ import type Molecule from '../core/Molecule'
|
|
|
57
57
|
* MutationProposeMolecule - Foundation for all molecular proposals
|
|
58
58
|
* Matches JavaScript SDK MutationProposeMolecule implementation exactly
|
|
59
59
|
*/
|
|
60
|
-
export default
|
|
60
|
+
export default class MutationProposeMolecule extends Mutation {
|
|
61
61
|
protected $__molecule: Molecule
|
|
62
62
|
protected $__remainderWallet: any | null = null
|
|
63
63
|
|
|
@@ -141,8 +141,11 @@ export default abstract class MutationProposeMolecule extends Mutation {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
144
|
+
* Fills the molecule with specific mutation data.
|
|
145
|
+
* Subclasses override to build domain-specific atoms.
|
|
146
|
+
* Default implementation is a no-op for pre-assembled molecules.
|
|
146
147
|
*/
|
|
147
|
-
|
|
148
|
+
fillMolecule(_params?: any): void {
|
|
149
|
+
// Intentionally empty for pre-assembled molecules proposed directly
|
|
150
|
+
}
|
|
148
151
|
}
|