@invisi-labs/vue 1.1.5 → 1.1.7

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/useOperation.ts"],"sourcesContent":["export { useOperation } from \"./useOperation\";\nexport type { UseOperationResult } from \"./useOperation\";\n","import { shallowRef, shallowReadonly, getCurrentScope, onScopeDispose } from \"vue\";\nimport type { Operation, RegistrationOperation } from \"@invisi-labs/sdk\";\ntype Handle = Operation | RegistrationOperation;\n/** Opaque SDK objects stay unproxied; cancel does not revoke transactions or release input locks. */\nexport function useOperation() {\n const operation = shallowRef<Handle | null>(null),\n status = shallowRef<Handle[\"status\"] | \"idle\" | \"running\" | \"error\">(\"idle\"),\n error = shallowRef<Error | null>(null);\n let active: AbortController | null = null,\n disposed = false;\n if (getCurrentScope())\n onScopeDispose(() => {\n disposed = true;\n active?.abort();\n });\n async function run<T extends Handle>(action: (signal: AbortSignal) => Promise<T>): Promise<T> {\n if (active) throw new Error(\"An operation stage is already running\");\n const controller = new AbortController();\n active = controller;\n error.value = null;\n status.value = \"running\";\n try {\n const result = await action(controller.signal);\n if (!disposed) {\n operation.value = result;\n status.value = result.status;\n }\n return result;\n } catch {\n const failure = new Error(\n \"Operation did not complete; recover its persisted state before retrying\"\n );\n if (!disposed) {\n error.value = failure;\n status.value = \"error\";\n }\n throw failure;\n } finally {\n if (active === controller) active = null;\n }\n }\n // Readonly shallow refs preserve native private-field receivers.\n return {\n operation: shallowReadonly(operation),\n status: shallowReadonly(status),\n error: shallowReadonly(error),\n run,\n cancel: () => active?.abort(),\n };\n}\nexport type UseOperationResult = ReturnType<typeof useOperation>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAA6E;AAItE,SAAS,eAAe;AAC3B,QAAM,gBAAY,uBAA0B,IAAI,GAC5C,aAAS,uBAA4D,MAAM,GAC3E,YAAQ,uBAAyB,IAAI;AACzC,MAAI,SAAiC,MACjC,WAAW;AACf,UAAI,4BAAgB;AAChB,mCAAe,MAAM;AACjB,iBAAW;AACX,cAAQ,MAAM;AAAA,IAClB,CAAC;AACL,iBAAe,IAAsB,QAAyD;AAC1F,QAAI,OAAQ,OAAM,IAAI,MAAM,uCAAuC;AACnE,UAAM,aAAa,IAAI,gBAAgB;AACvC,aAAS;AACT,UAAM,QAAQ;AACd,WAAO,QAAQ;AACf,QAAI;AACA,YAAM,SAAS,MAAM,OAAO,WAAW,MAAM;AAC7C,UAAI,CAAC,UAAU;AACX,kBAAU,QAAQ;AAClB,eAAO,QAAQ,OAAO;AAAA,MAC1B;AACA,aAAO;AAAA,IACX,QAAQ;AACJ,YAAM,UAAU,IAAI;AAAA,QAChB;AAAA,MACJ;AACA,UAAI,CAAC,UAAU;AACX,cAAM,QAAQ;AACd,eAAO,QAAQ;AAAA,MACnB;AACA,YAAM;AAAA,IACV,UAAE;AACE,UAAI,WAAW,WAAY,UAAS;AAAA,IACxC;AAAA,EACJ;AAEA,SAAO;AAAA,IACH,eAAW,4BAAgB,SAAS;AAAA,IACpC,YAAQ,4BAAgB,MAAM;AAAA,IAC9B,WAAO,4BAAgB,KAAK;AAAA,IAC5B;AAAA,IACA,QAAQ,MAAM,QAAQ,MAAM;AAAA,EAChC;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/useOperation.ts"],"sourcesContent":["export { useOperation } from \"./useOperation\";\nexport type { UseOperationResult } from \"./useOperation\";\n","import { shallowRef, shallowReadonly, getCurrentScope, onScopeDispose } from \"vue\";\nimport type { PreparedTransaction, RegistrationOperation } from \"@invisi-labs/sdk\";\nimport type { Operation } from \"@invisi-labs/session\";\ntype Handle = PreparedTransaction | Operation | RegistrationOperation;\n/** Opaque SDK objects stay unproxied; cancel does not revoke transactions or release input locks. */\nexport function useOperation() {\n const operation = shallowRef<Handle | null>(null),\n status = shallowRef<Handle[\"status\"] | \"idle\" | \"running\" | \"error\">(\"idle\"),\n error = shallowRef<Error | null>(null);\n let active: AbortController | null = null,\n disposed = false;\n if (getCurrentScope())\n onScopeDispose(() => {\n disposed = true;\n active?.abort();\n });\n async function run<T extends Handle>(action: (signal: AbortSignal) => Promise<T>): Promise<T> {\n if (active) throw new Error(\"An operation stage is already running\");\n const controller = new AbortController();\n active = controller;\n error.value = null;\n status.value = \"running\";\n try {\n const result = await action(controller.signal);\n if (!disposed) {\n operation.value = result;\n status.value = result.status;\n }\n return result;\n } catch {\n const failure = new Error(\n \"Operation did not complete; recover its persisted state before retrying\"\n );\n if (!disposed) {\n error.value = failure;\n status.value = \"error\";\n }\n throw failure;\n } finally {\n if (active === controller) active = null;\n }\n }\n // Readonly shallow refs preserve native private-field receivers.\n return {\n operation: shallowReadonly(operation),\n status: shallowReadonly(status),\n error: shallowReadonly(error),\n run,\n cancel: () => active?.abort(),\n };\n}\nexport type UseOperationResult = ReturnType<typeof useOperation>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAA6E;AAKtE,SAAS,eAAe;AAC3B,QAAM,gBAAY,uBAA0B,IAAI,GAC5C,aAAS,uBAA4D,MAAM,GAC3E,YAAQ,uBAAyB,IAAI;AACzC,MAAI,SAAiC,MACjC,WAAW;AACf,UAAI,4BAAgB;AAChB,mCAAe,MAAM;AACjB,iBAAW;AACX,cAAQ,MAAM;AAAA,IAClB,CAAC;AACL,iBAAe,IAAsB,QAAyD;AAC1F,QAAI,OAAQ,OAAM,IAAI,MAAM,uCAAuC;AACnE,UAAM,aAAa,IAAI,gBAAgB;AACvC,aAAS;AACT,UAAM,QAAQ;AACd,WAAO,QAAQ;AACf,QAAI;AACA,YAAM,SAAS,MAAM,OAAO,WAAW,MAAM;AAC7C,UAAI,CAAC,UAAU;AACX,kBAAU,QAAQ;AAClB,eAAO,QAAQ,OAAO;AAAA,MAC1B;AACA,aAAO;AAAA,IACX,QAAQ;AACJ,YAAM,UAAU,IAAI;AAAA,QAChB;AAAA,MACJ;AACA,UAAI,CAAC,UAAU;AACX,cAAM,QAAQ;AACd,eAAO,QAAQ;AAAA,MACnB;AACA,YAAM;AAAA,IACV,UAAE;AACE,UAAI,WAAW,WAAY,UAAS;AAAA,IACxC;AAAA,EACJ;AAEA,SAAO;AAAA,IACH,eAAW,4BAAgB,SAAS;AAAA,IACpC,YAAQ,4BAAgB,MAAM;AAAA,IAC9B,WAAO,4BAAgB,KAAK;AAAA,IAC5B;AAAA,IACA,QAAQ,MAAM,QAAQ,MAAM;AAAA,EAChC;AACJ;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as vue from 'vue';
2
- import { Operation, RegistrationOperation } from '@invisi-labs/sdk';
2
+ import { PreparedTransaction, RegistrationOperation } from '@invisi-labs/sdk';
3
+ import { Operation } from '@invisi-labs/session';
3
4
 
4
- type Handle = Operation | RegistrationOperation;
5
+ type Handle = PreparedTransaction | Operation | RegistrationOperation;
5
6
  /** Opaque SDK objects stay unproxied; cancel does not revoke transactions or release input locks. */
6
7
  declare function useOperation(): {
7
8
  operation: Readonly<vue.ShallowRef<Handle | null, Handle | null>>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as vue from 'vue';
2
- import { Operation, RegistrationOperation } from '@invisi-labs/sdk';
2
+ import { PreparedTransaction, RegistrationOperation } from '@invisi-labs/sdk';
3
+ import { Operation } from '@invisi-labs/session';
3
4
 
4
- type Handle = Operation | RegistrationOperation;
5
+ type Handle = PreparedTransaction | Operation | RegistrationOperation;
5
6
  /** Opaque SDK objects stay unproxied; cancel does not revoke transactions or release input locks. */
6
7
  declare function useOperation(): {
7
8
  operation: Readonly<vue.ShallowRef<Handle | null, Handle | null>>;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useOperation.ts"],"sourcesContent":["import { shallowRef, shallowReadonly, getCurrentScope, onScopeDispose } from \"vue\";\nimport type { Operation, RegistrationOperation } from \"@invisi-labs/sdk\";\ntype Handle = Operation | RegistrationOperation;\n/** Opaque SDK objects stay unproxied; cancel does not revoke transactions or release input locks. */\nexport function useOperation() {\n const operation = shallowRef<Handle | null>(null),\n status = shallowRef<Handle[\"status\"] | \"idle\" | \"running\" | \"error\">(\"idle\"),\n error = shallowRef<Error | null>(null);\n let active: AbortController | null = null,\n disposed = false;\n if (getCurrentScope())\n onScopeDispose(() => {\n disposed = true;\n active?.abort();\n });\n async function run<T extends Handle>(action: (signal: AbortSignal) => Promise<T>): Promise<T> {\n if (active) throw new Error(\"An operation stage is already running\");\n const controller = new AbortController();\n active = controller;\n error.value = null;\n status.value = \"running\";\n try {\n const result = await action(controller.signal);\n if (!disposed) {\n operation.value = result;\n status.value = result.status;\n }\n return result;\n } catch {\n const failure = new Error(\n \"Operation did not complete; recover its persisted state before retrying\"\n );\n if (!disposed) {\n error.value = failure;\n status.value = \"error\";\n }\n throw failure;\n } finally {\n if (active === controller) active = null;\n }\n }\n // Readonly shallow refs preserve native private-field receivers.\n return {\n operation: shallowReadonly(operation),\n status: shallowReadonly(status),\n error: shallowReadonly(error),\n run,\n cancel: () => active?.abort(),\n };\n}\nexport type UseOperationResult = ReturnType<typeof useOperation>;\n"],"mappings":";AAAA,SAAS,YAAY,iBAAiB,iBAAiB,sBAAsB;AAItE,SAAS,eAAe;AAC3B,QAAM,YAAY,WAA0B,IAAI,GAC5C,SAAS,WAA4D,MAAM,GAC3E,QAAQ,WAAyB,IAAI;AACzC,MAAI,SAAiC,MACjC,WAAW;AACf,MAAI,gBAAgB;AAChB,mBAAe,MAAM;AACjB,iBAAW;AACX,cAAQ,MAAM;AAAA,IAClB,CAAC;AACL,iBAAe,IAAsB,QAAyD;AAC1F,QAAI,OAAQ,OAAM,IAAI,MAAM,uCAAuC;AACnE,UAAM,aAAa,IAAI,gBAAgB;AACvC,aAAS;AACT,UAAM,QAAQ;AACd,WAAO,QAAQ;AACf,QAAI;AACA,YAAM,SAAS,MAAM,OAAO,WAAW,MAAM;AAC7C,UAAI,CAAC,UAAU;AACX,kBAAU,QAAQ;AAClB,eAAO,QAAQ,OAAO;AAAA,MAC1B;AACA,aAAO;AAAA,IACX,QAAQ;AACJ,YAAM,UAAU,IAAI;AAAA,QAChB;AAAA,MACJ;AACA,UAAI,CAAC,UAAU;AACX,cAAM,QAAQ;AACd,eAAO,QAAQ;AAAA,MACnB;AACA,YAAM;AAAA,IACV,UAAE;AACE,UAAI,WAAW,WAAY,UAAS;AAAA,IACxC;AAAA,EACJ;AAEA,SAAO;AAAA,IACH,WAAW,gBAAgB,SAAS;AAAA,IACpC,QAAQ,gBAAgB,MAAM;AAAA,IAC9B,OAAO,gBAAgB,KAAK;AAAA,IAC5B;AAAA,IACA,QAAQ,MAAM,QAAQ,MAAM;AAAA,EAChC;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/useOperation.ts"],"sourcesContent":["import { shallowRef, shallowReadonly, getCurrentScope, onScopeDispose } from \"vue\";\nimport type { PreparedTransaction, RegistrationOperation } from \"@invisi-labs/sdk\";\nimport type { Operation } from \"@invisi-labs/session\";\ntype Handle = PreparedTransaction | Operation | RegistrationOperation;\n/** Opaque SDK objects stay unproxied; cancel does not revoke transactions or release input locks. */\nexport function useOperation() {\n const operation = shallowRef<Handle | null>(null),\n status = shallowRef<Handle[\"status\"] | \"idle\" | \"running\" | \"error\">(\"idle\"),\n error = shallowRef<Error | null>(null);\n let active: AbortController | null = null,\n disposed = false;\n if (getCurrentScope())\n onScopeDispose(() => {\n disposed = true;\n active?.abort();\n });\n async function run<T extends Handle>(action: (signal: AbortSignal) => Promise<T>): Promise<T> {\n if (active) throw new Error(\"An operation stage is already running\");\n const controller = new AbortController();\n active = controller;\n error.value = null;\n status.value = \"running\";\n try {\n const result = await action(controller.signal);\n if (!disposed) {\n operation.value = result;\n status.value = result.status;\n }\n return result;\n } catch {\n const failure = new Error(\n \"Operation did not complete; recover its persisted state before retrying\"\n );\n if (!disposed) {\n error.value = failure;\n status.value = \"error\";\n }\n throw failure;\n } finally {\n if (active === controller) active = null;\n }\n }\n // Readonly shallow refs preserve native private-field receivers.\n return {\n operation: shallowReadonly(operation),\n status: shallowReadonly(status),\n error: shallowReadonly(error),\n run,\n cancel: () => active?.abort(),\n };\n}\nexport type UseOperationResult = ReturnType<typeof useOperation>;\n"],"mappings":";AAAA,SAAS,YAAY,iBAAiB,iBAAiB,sBAAsB;AAKtE,SAAS,eAAe;AAC3B,QAAM,YAAY,WAA0B,IAAI,GAC5C,SAAS,WAA4D,MAAM,GAC3E,QAAQ,WAAyB,IAAI;AACzC,MAAI,SAAiC,MACjC,WAAW;AACf,MAAI,gBAAgB;AAChB,mBAAe,MAAM;AACjB,iBAAW;AACX,cAAQ,MAAM;AAAA,IAClB,CAAC;AACL,iBAAe,IAAsB,QAAyD;AAC1F,QAAI,OAAQ,OAAM,IAAI,MAAM,uCAAuC;AACnE,UAAM,aAAa,IAAI,gBAAgB;AACvC,aAAS;AACT,UAAM,QAAQ;AACd,WAAO,QAAQ;AACf,QAAI;AACA,YAAM,SAAS,MAAM,OAAO,WAAW,MAAM;AAC7C,UAAI,CAAC,UAAU;AACX,kBAAU,QAAQ;AAClB,eAAO,QAAQ,OAAO;AAAA,MAC1B;AACA,aAAO;AAAA,IACX,QAAQ;AACJ,YAAM,UAAU,IAAI;AAAA,QAChB;AAAA,MACJ;AACA,UAAI,CAAC,UAAU;AACX,cAAM,QAAQ;AACd,eAAO,QAAQ;AAAA,MACnB;AACA,YAAM;AAAA,IACV,UAAE;AACE,UAAI,WAAW,WAAY,UAAS;AAAA,IACxC;AAAA,EACJ;AAEA,SAAO;AAAA,IACH,WAAW,gBAAgB,SAAS;AAAA,IACpC,QAAQ,gBAAgB,MAAM;AAAA,IAC9B,OAAO,gBAAgB,KAAK;AAAA,IAC5B;AAAA,IACA,QAAQ,MAAM,QAAQ,MAAM;AAAA,EAChC;AACJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invisi-labs/vue",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "Invisi Protocol Vue composables",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -14,7 +14,8 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@invisi-labs/sdk": "1.1.5"
17
+ "@invisi-labs/sdk": "1.1.7",
18
+ "@invisi-labs/session": "1.1.7"
18
19
  },
19
20
  "peerDependencies": {
20
21
  "vue": ">=3.4.0"