@graffiti-garden/wrapper-vue 0.7.2 → 1.0.4

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 (70) hide show
  1. package/README.md +2 -3
  2. package/dist/browser/ajv-D_HICdxS.mjs +4447 -0
  3. package/dist/browser/ajv-D_HICdxS.mjs.map +1 -0
  4. package/dist/browser/plugin.mjs +1003 -943
  5. package/dist/browser/plugin.mjs.map +1 -1
  6. package/dist/node/components/ActorToHandle.vue.d.ts +23 -0
  7. package/dist/node/components/ActorToHandle.vue.d.ts.map +1 -0
  8. package/dist/node/{Discover.vue.d.ts → components/Discover.vue.d.ts} +4 -4
  9. package/dist/node/components/Discover.vue.d.ts.map +1 -0
  10. package/dist/node/{Get.vue.d.ts → components/Get.vue.d.ts} +2 -5
  11. package/dist/node/components/Get.vue.d.ts.map +1 -0
  12. package/dist/node/components/GetMedia.vue.d.ts +36 -0
  13. package/dist/node/components/GetMedia.vue.d.ts.map +1 -0
  14. package/dist/node/components/HandleToActor.vue.d.ts +23 -0
  15. package/dist/node/components/HandleToActor.vue.d.ts.map +1 -0
  16. package/dist/node/components/ObjectInfo.vue.d.ts +7 -0
  17. package/dist/node/components/ObjectInfo.vue.d.ts.map +1 -0
  18. package/dist/node/composables/actor-to-handle.d.ts +25 -0
  19. package/dist/node/composables/actor-to-handle.d.ts.map +1 -0
  20. package/dist/node/composables/discover.d.ts +38 -0
  21. package/dist/node/composables/discover.d.ts.map +1 -0
  22. package/dist/node/composables/get-media.d.ts +31 -0
  23. package/dist/node/composables/get-media.d.ts.map +1 -0
  24. package/dist/node/composables/get.d.ts +28 -0
  25. package/dist/node/composables/get.d.ts.map +1 -0
  26. package/dist/node/composables/handle-to-actor.d.ts +25 -0
  27. package/dist/node/composables/handle-to-actor.d.ts.map +1 -0
  28. package/dist/node/composables/resolve-string.d.ts +6 -0
  29. package/dist/node/composables/resolve-string.d.ts.map +1 -0
  30. package/dist/node/globals.d.ts +3 -5
  31. package/dist/node/globals.d.ts.map +1 -1
  32. package/dist/node/plugin.d.ts +174 -75
  33. package/dist/node/plugin.d.ts.map +1 -1
  34. package/dist/node/plugin.js +1 -1
  35. package/dist/node/plugin.js.map +1 -1
  36. package/dist/node/plugin.mjs +468 -333
  37. package/dist/node/plugin.mjs.map +1 -1
  38. package/package.json +15 -14
  39. package/src/components/ActorToHandle.vue +16 -0
  40. package/src/{Discover.vue → components/Discover.vue} +15 -9
  41. package/src/{Get.vue → components/Get.vue} +7 -11
  42. package/src/components/GetMedia.vue +75 -0
  43. package/src/components/HandleToActor.vue +16 -0
  44. package/src/components/ObjectInfo.vue +127 -0
  45. package/src/composables/actor-to-handle.ts +32 -0
  46. package/src/composables/discover.ts +202 -0
  47. package/src/composables/get-media.ts +116 -0
  48. package/src/composables/get.ts +109 -0
  49. package/src/composables/handle-to-actor.ts +32 -0
  50. package/src/composables/resolve-string.ts +46 -0
  51. package/src/globals.ts +24 -2
  52. package/src/plugin.ts +84 -29
  53. package/dist/browser/ajv-C30pimY5.mjs +0 -4400
  54. package/dist/browser/ajv-C30pimY5.mjs.map +0 -1
  55. package/dist/browser/index-CWfNKdDL.mjs +0 -424
  56. package/dist/browser/index-CWfNKdDL.mjs.map +0 -1
  57. package/dist/node/Discover.vue.d.ts.map +0 -1
  58. package/dist/node/Get.vue.d.ts.map +0 -1
  59. package/dist/node/RecoverOrphans.vue.d.ts +0 -31
  60. package/dist/node/RecoverOrphans.vue.d.ts.map +0 -1
  61. package/dist/node/composables.d.ts +0 -75
  62. package/dist/node/composables.d.ts.map +0 -1
  63. package/dist/node/pollers.d.ts +0 -28
  64. package/dist/node/pollers.d.ts.map +0 -1
  65. package/dist/node/reducers.d.ts +0 -37
  66. package/dist/node/reducers.d.ts.map +0 -1
  67. package/src/RecoverOrphans.vue +0 -37
  68. package/src/composables.ts +0 -347
  69. package/src/pollers.ts +0 -119
  70. package/src/reducers.ts +0 -124
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../src/globals.ts","../../node_modules/@graffiti-garden/api/dist/index.mjs","../../src/pollers.ts","../../src/reducers.ts","../../src/composables.ts","../../src/Discover.vue","../../src/Get.vue","../../src/RecoverOrphans.vue","../../src/plugin.ts"],"sourcesContent":["import type { Ref } from \"vue\";\nimport type { Graffiti, GraffitiSession } from \"@graffiti-garden/api\";\nimport type { GraffitiSynchronize } from \"@graffiti-garden/wrapper-synchronize\";\n\nexport const globals: {\n graffitiSynchronize?: GraffitiSynchronize;\n graffitiSession?: Ref<GraffitiSession | undefined | null>;\n} = {};\n\n/**\n * Returns the global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance\n * that has been wrapped by the {@link GraffitiPlugin} with the [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).\n * @throws If the {@link GraffitiPlugin} is not installed\n */\nexport function useGraffitiSynchronize() {\n const graffiti = globals.graffitiSynchronize;\n if (!graffiti) {\n throw new Error(\n \"No Graffiti instance provided, did you forget to install the plugin?\",\n );\n }\n return graffiti;\n}\n\n/**\n * Returns the global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance.\n *\n * In Vue templates and the [options API](https://vuejs.org/guide/introduction.html#options-api)\n * use the global variable {@link ComponentCustomProperties.$graffiti | $graffiti} instead.\n *\n * This is the same Graffiti registered with the {@link GraffitiPlugin}\n * via {@link GraffitiPluginOptions.graffiti}, only it has been wrapped\n * with [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).\n * Be sure to use the wrapped instance to enable reactivity.\n *\n * @throws If the {@link GraffitiPlugin} is not installed\n */\nexport function useGraffiti(): Graffiti {\n return useGraffitiSynchronize();\n}\n\n/**\n * Returns a global reactive [GraffitiSession](https://api.graffiti.garden/interfaces/GraffitiSession.html) instance\n * as a [Vue ref](https://vuejs.org/api/reactivity-core.html#ref).\n *\n * In Vue templates and the [options API](https://vuejs.org/guide/introduction.html#options-api)\n * use the global variable {@link ComponentCustomProperties.$graffitiSession | $graffitiSession} instead.\n *\n * While the application is loading and restoring any previous sessions,\n * the value will be `undefined`. If the user is not logged in,\n * the value will be `null`.\n *\n * This only keeps track of one session. If your app needs\n * to support multiple login sessions, you'll need to manage them\n * yourself using [`Graffiti.sessionEvents`](https://api.graffiti.garden/classes/Graffiti.html#sessionevents).\n * @throws If the {@link GraffitiPlugin} is not installed\n */\nexport function useGraffitiSession() {\n const session = globals.graffitiSession;\n if (!session) {\n throw new Error(\n \"No Graffiti session provided, did you forget to install the plugin?\",\n );\n }\n return session;\n}\n","var r=class{};var p={type:\"object\",properties:{value:{type:\"object\"},channels:{type:\"array\",items:{type:\"string\"}},allowed:{type:\"array\",items:{type:\"string\"},nullable:!0},url:{type:\"string\"},actor:{type:\"string\"},lastModified:{type:\"number\"}},additionalProperties:!1,required:[\"value\",\"channels\",\"actor\",\"url\",\"lastModified\"]},O={...p,required:[\"value\",\"channels\"]};var a=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorUnauthorized\",Object.setPrototypeOf(this,t.prototype)}},i=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorForbidden\",Object.setPrototypeOf(this,t.prototype)}},s=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorNotFound\",Object.setPrototypeOf(this,t.prototype)}},o=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorInvalidSchema\",Object.setPrototypeOf(this,t.prototype)}},n=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorSchemaMismatch\",Object.setPrototypeOf(this,t.prototype)}},c=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorPatchTestFailed\",Object.setPrototypeOf(this,t.prototype)}},f=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorPatchError\",Object.setPrototypeOf(this,t.prototype)}},m=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorInvalidUrl\",Object.setPrototypeOf(this,t.prototype)}},S=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorUnrecognizedUriScheme\",Object.setPrototypeOf(this,t.prototype)}};export{r as Graffiti,i as GraffitiErrorForbidden,o as GraffitiErrorInvalidSchema,m as GraffitiErrorInvalidUrl,s as GraffitiErrorNotFound,f as GraffitiErrorPatchError,c as GraffitiErrorPatchTestFailed,n as GraffitiErrorSchemaMismatch,a as GraffitiErrorUnauthorized,S as GraffitiErrorUnrecognizedUrlScheme,p as GraffitiObjectJSONSchema,O as GraffitiPutObjectJSONSchema};\n//# sourceMappingURL=index.mjs.map\n","import {\n type Graffiti,\n type JSONSchema,\n type GraffitiObject,\n type GraffitiObjectStreamReturn,\n type GraffitiObjectStreamContinueEntry,\n type GraffitiObjectStream,\n type GraffitiObjectStreamContinue,\n GraffitiErrorNotFound,\n} from \"@graffiti-garden/api\";\n\nexport abstract class Poller<Schema extends JSONSchema> {\n abstract poll(\n onEntry: (\n entry: GraffitiObjectStreamContinueEntry<Schema> | null | \"clear\",\n ) => void,\n ): Promise<void>;\n abstract clear(): void;\n}\n\n/**\n * Polls for a single object and calls onValue with the result.\n */\nexport class GetPoller<Schema extends JSONSchema> implements Poller<Schema> {\n constructor(readonly getter: () => Promise<GraffitiObject<Schema>>) {}\n\n poll: Poller<Schema>[\"poll\"] = async (onEntry) => {\n let object: GraffitiObject<Schema>;\n const myGetter = this.getter;\n try {\n object = await myGetter();\n } catch (e) {\n if (this.getter === myGetter) {\n onEntry(null);\n }\n return;\n }\n if (this.getter === myGetter) {\n onEntry({ object });\n }\n };\n\n clear() {}\n}\n\n/**\n * Polls for multiple objects and calls `onObject` with the result.\n * If `poll` is called multiple times, it doesn't poll the results\n * entirely from scratch, but instead only polls the new results.\n */\nexport class StreamPoller<Schema extends JSONSchema> implements Poller<Schema> {\n iterator: GraffitiObjectStreamContinue<Schema> | undefined;\n continue: (() => GraffitiObjectStreamContinue<Schema>) | undefined;\n\n constructor(readonly streamFactory: () => GraffitiObjectStream<Schema>) {}\n\n clear() {\n if (this.iterator) {\n const iterator = this.iterator;\n this.iterator.return({\n continue: () => iterator,\n cursor: \"\",\n });\n }\n this.iterator = undefined;\n this.continue = undefined;\n }\n\n poll: Poller<Schema>[\"poll\"] = async (onEntry) => {\n if (!this.iterator) {\n if (this.continue) {\n try {\n this.iterator = this.continue();\n } catch (e) {\n // The cursor has expired, we need to start from scratch.\n if (e instanceof GraffitiErrorNotFound) {\n onEntry(\"clear\");\n this.iterator = this.streamFactory();\n } else {\n throw e;\n }\n }\n } else {\n this.iterator = this.streamFactory();\n }\n }\n\n while (true) {\n // Check if the iterator has been cancelled.\n if (!this.iterator) {\n break;\n }\n\n const myIterator: GraffitiObjectStreamContinue<Schema> = this.iterator;\n\n const result = await myIterator.next();\n\n // Check again if it was cancelled.\n if (myIterator !== this.iterator) {\n continue;\n }\n\n if (result.done) {\n this.iterator = undefined;\n if (result.value) {\n this.continue = result.value.continue;\n }\n break;\n }\n\n if (result.value.error) {\n console.error(result.value.error);\n continue;\n }\n\n onEntry(result.value);\n }\n };\n}\n","import { computed, ref } from \"vue\";\nimport type { Ref } from \"vue\";\nimport type {\n GraffitiObject,\n Graffiti,\n JSONSchema,\n GraffitiObjectStreamContinueEntry,\n} from \"@graffiti-garden/api\";\n\nexport abstract class Reducer<Schema extends JSONSchema> {\n abstract clear(): void;\n abstract onEntry(\n entry: GraffitiObjectStreamContinueEntry<Schema> | null | \"clear\",\n ): void;\n}\n\nfunction isEntryNewer<Schema extends JSONSchema>(\n entry: GraffitiObjectStreamContinueEntry<Schema>,\n existing: GraffitiObjectStreamContinueEntry<Schema> | null | undefined,\n): boolean {\n return (\n !existing ||\n entry.object.lastModified > existing.object.lastModified ||\n (entry.object.lastModified === existing.object.lastModified &&\n !entry.tombstone &&\n !!existing.tombstone)\n );\n}\n\n/**\n * Retrieves multiple Graffiti objects and retains\n * the most recent one as the `result` property (a Vue ref).\n * Before any objects have been received, the result\n * is `undefined`. If the object has been deleted,\n * the result is `null`.\n */\nexport class SingletonReducer<Schema extends JSONSchema>\n implements Reducer<Schema>\n{\n readonly entry: Ref<\n GraffitiObjectStreamContinueEntry<Schema> | null | undefined\n > = ref();\n\n get result(): Ref<GraffitiObject<Schema> | null | undefined> {\n return computed(() => {\n const value = this.entry.value;\n if (!value) return value;\n if (value.tombstone) return null;\n return value.object;\n });\n }\n\n clear() {\n this.entry.value = undefined;\n }\n\n onEntry(entry: GraffitiObjectStreamContinueEntry<Schema> | null | \"clear\") {\n if (entry === \"clear\") {\n this.clear();\n return;\n }\n if (!entry || isEntryNewer<Schema>(entry, this.entry.value)) {\n this.entry.value = entry;\n }\n }\n}\n\n/**\n * Retrieves multiple Graffiti objects and retains\n * the most recent one per URI as the `results` property (a Vue ref).\n * If multiple objects are received concurrently,\n * they are processed in batches every `REFRESH_RATE` milliseconds\n * to avoid freezing the interface.\n */\nexport class ArrayReducer<Schema extends JSONSchema>\n implements Reducer<Schema>\n{\n readonly results: Ref<GraffitiObject<Schema>[]> = ref([]);\n readonly resultsRaw: Map<string, GraffitiObjectStreamContinueEntry<Schema>> =\n new Map();\n batchFlattenTimer: ReturnType<typeof setTimeout> | undefined;\n\n constructor(readonly graffiti: Graffiti) {}\n\n clear() {\n this.resultsRaw.clear();\n this.results.value = [];\n clearTimeout(this.batchFlattenTimer);\n this.batchFlattenTimer = undefined;\n }\n\n flattenResults() {\n this.results.value = Array.from(this.resultsRaw.values()).reduce<\n GraffitiObject<Schema>[]\n >((acc, entry) => {\n if (!entry.tombstone) {\n acc.push(entry.object);\n }\n return acc;\n }, []);\n }\n\n onEntry(entry: GraffitiObjectStreamContinueEntry<Schema> | null | \"clear\") {\n if (!entry) return;\n if (entry === \"clear\") {\n this.clear();\n return;\n }\n const existing = this.resultsRaw.get(entry.object.url);\n if (!isEntryNewer<Schema>(entry, existing)) return;\n this.resultsRaw.set(entry.object.url, entry);\n\n // Don't flatten the results all at once,\n // because we may get a lot of results\n // and we don't want the interface to\n // freeze up\n if (!this.batchFlattenTimer) {\n this.batchFlattenTimer = setTimeout(() => {\n this.flattenResults();\n this.batchFlattenTimer = undefined;\n }, 0);\n }\n }\n}\n","import { onScopeDispose, ref, toValue, watch } from \"vue\";\nimport type { Ref, MaybeRefOrGetter } from \"vue\";\nimport type {\n GraffitiObjectUrl,\n GraffitiObject,\n GraffitiSession,\n JSONSchema,\n GraffitiObjectStreamContinueEntry,\n} from \"@graffiti-garden/api\";\nimport { useGraffitiSynchronize, useGraffitiSession } from \"./globals\";\nimport { GetPoller, Poller, StreamPoller } from \"./pollers\";\nimport { ArrayReducer, Reducer, SingletonReducer } from \"./reducers\";\n\nfunction makeComposable<Schema extends JSONSchema>(\n reducer: Reducer<Schema>,\n poller: Poller<Schema>,\n synchronizeFactory: () => AsyncGenerator<\n GraffitiObjectStreamContinueEntry<Schema>\n >,\n toWatch: readonly (() => any)[],\n autopoll: MaybeRefOrGetter<boolean>,\n) {\n let synchronizeIterator:\n | AsyncGenerator<GraffitiObjectStreamContinueEntry<Schema>>\n | undefined;\n async function pollSynchronize() {\n synchronizeIterator = synchronizeFactory();\n for await (const result of synchronizeIterator) {\n if (result.error) {\n console.error(result.error);\n continue;\n }\n reducer.onEntry(result);\n }\n }\n\n let isAlreadyPolling = false;\n let innerPoll: (() => Promise<void>) | undefined;\n const poll = async () => {\n if (isAlreadyPolling) return;\n if (!innerPoll) return;\n const myPoll = innerPoll;\n isAlreadyPolling = true;\n try {\n await myPoll();\n } catch (e) {\n // If there is an error, wait a little bit so as not to\n // cause an infinite loop\n await new Promise((r) => setTimeout(r, 2000));\n } finally {\n if (myPoll !== innerPoll) return;\n isAlreadyPolling = false;\n if (toValue(autopoll)) {\n poll();\n }\n }\n };\n\n const isInitialPolling = ref(false);\n watch(\n toWatch,\n async (newValue, oldValue) => {\n // Catch unnecessary updates\n if (JSON.stringify(newValue) === JSON.stringify(oldValue)) {\n return;\n }\n\n synchronizeIterator?.return(null);\n reducer.clear();\n poller.clear();\n\n pollSynchronize();\n\n innerPoll = () => poller.poll(reducer.onEntry.bind(reducer));\n const myPoll = innerPoll;\n\n isAlreadyPolling = false;\n\n isInitialPolling.value = true;\n try {\n await poll();\n } finally {\n if (myPoll !== innerPoll) return;\n isInitialPolling.value = false;\n }\n },\n {\n immediate: true,\n },\n );\n onScopeDispose(() => {\n synchronizeIterator?.return(null);\n reducer.clear();\n poller.clear();\n innerPoll = undefined;\n });\n\n return { poll, isInitialPolling };\n}\n\nfunction toSessionGetter(\n sessionInjected: ReturnType<typeof useGraffitiSession>,\n session?: MaybeRefOrGetter<GraffitiSession | undefined | null>,\n) {\n return () => {\n const sessionValue = toValue(session);\n if (sessionValue === undefined) {\n return sessionInjected?.value;\n } else {\n return sessionValue;\n }\n };\n}\n\nfunction callGetters<T extends readonly (() => any)[]>(\n getters: T,\n): {\n [K in keyof T]: ReturnType<T[K]>;\n} {\n return getters.map((fn) => fn()) as any;\n}\n\n/**\n * The [Graffiti.discover](https://api.graffiti.garden/classes/Graffiti.html#discover)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiDiscover}.\n *\n * The arguments of this composable as the same as Graffiti.discover,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * As they change the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n */\nexport function useGraffitiDiscover<Schema extends JSONSchema>(\n channels: MaybeRefOrGetter<string[]>,\n schema: MaybeRefOrGetter<Schema>,\n /**\n * If the session is `undefined`, the global session,\n * {@link ComponentCustomProperties.$graffitiSession | $graffitiSession},\n * will be used. Otherwise, the provided value will be used.\n */\n session?: MaybeRefOrGetter<GraffitiSession | undefined | null>,\n autopoll: MaybeRefOrGetter<boolean> = false,\n): {\n objects: Ref<GraffitiObject<Schema>[]>;\n poll: () => Promise<void>;\n isInitialPolling: Ref<boolean>;\n} {\n const graffiti = useGraffitiSynchronize();\n const sessionInjected = useGraffitiSession();\n\n const channelsGetter = () => toValue(channels);\n const schemaGetter = () => toValue(schema);\n const sessionGetter = toSessionGetter(sessionInjected, session);\n const argGetters = [channelsGetter, schemaGetter, sessionGetter] as const;\n\n const synchronizeFactory = () =>\n graffiti.synchronizeDiscover(...callGetters(argGetters));\n const streamFactory = () => graffiti.discover(...callGetters(argGetters));\n\n const reducer = new ArrayReducer<Schema>(graffiti);\n const poller = new StreamPoller<Schema>(streamFactory);\n\n const { poll, isInitialPolling } = makeComposable<Schema>(\n reducer,\n poller,\n synchronizeFactory,\n argGetters,\n autopoll,\n );\n\n return {\n /**\n * A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * an array of Graffiti objects.\n */\n objects: reducer.results,\n /**\n * A method to poll for new results.\n */\n poll,\n /**\n * A boolean [ref](https://vuejs.org/api/reactivity-core.html#ref)\n * that indicates if the *first* poll is currently running.\n * Useful to show a loading spinner or disable a button.\n *\n * This also tracks new polls when the arguments have changed,\n * but it does not track ongoing polls from either calling\n * {@link poll} or using the `autopoll` argument.\n */\n isInitialPolling,\n };\n}\n\n/**\n * The [Graffiti.get](https://api.graffiti.garden/classes/Graffiti.html#get)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiGet}.\n *\n * The arguments of this composable as the same as Graffiti.get,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * As they change the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n */\nexport function useGraffitiGet<Schema extends JSONSchema>(\n locationOrUri: MaybeRefOrGetter<GraffitiObjectUrl | string>,\n schema: MaybeRefOrGetter<Schema>,\n /**\n * If the session is `undefined`, the global session,\n * {@link ComponentCustomProperties.$graffitiSession | $graffitiSession},\n * will be used. Otherwise, the provided value will be used.\n */\n session?: MaybeRefOrGetter<GraffitiSession | undefined | null>,\n autopoll: MaybeRefOrGetter<boolean> = false,\n): {\n object: Ref<GraffitiObject<Schema> | null | undefined>;\n poll: () => Promise<void>;\n isInitialPolling: Ref<boolean>;\n} {\n const graffiti = useGraffitiSynchronize();\n const sessionInjected = useGraffitiSession();\n\n const locationOrUriGetter = () => toValue(locationOrUri);\n const schemaGetter = () => toValue(schema);\n const sessionGetter = toSessionGetter(sessionInjected, session);\n const argGetters = [\n locationOrUriGetter,\n schemaGetter,\n sessionGetter,\n ] as const;\n\n const synchronizeFactory = () =>\n graffiti.synchronizeGet(...callGetters(argGetters));\n\n const reducer = new SingletonReducer<Schema>();\n const getter = () => graffiti.get<Schema>(...callGetters(argGetters));\n const poller = new GetPoller<Schema>(getter);\n\n const { poll, isInitialPolling } = makeComposable<Schema>(\n reducer,\n poller,\n synchronizeFactory,\n argGetters,\n autopoll,\n );\n\n return {\n /**\n * A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * the retrieved Graffiti object, if it exists. If the object has been deleted,\n * the result is `null`. If the object is still being fetched, the result is `undefined`.\n */\n object: reducer.result,\n /**\n * A method to poll for new results.\n */\n poll,\n /**\n * A boolean [ref](https://vuejs.org/api/reactivity-core.html#ref)\n * that indicates if the *first* poll is currently running.\n * Useful to show a loading spinner or disable a button.\n *\n * This also tracks new polls when the arguments have changed,\n * but it does not track ongoing polls from either calling\n * {@link poll} or using the `autopoll` argument.\n */\n isInitialPolling,\n };\n}\n\n/**\n * The [Graffiti.recoverOrphans](https://api.graffiti.garden/classes/Graffiti.html#recoverorphans)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiRecoverOrphans}.\n *\n * The arguments of this composable as the same as Graffiti.get,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * As they change the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n */\nexport function useGraffitiRecoverOrphans<Schema extends JSONSchema>(\n schema: MaybeRefOrGetter<Schema>,\n session: MaybeRefOrGetter<GraffitiSession>,\n autopoll: MaybeRefOrGetter<boolean> = false,\n): {\n objects: Ref<GraffitiObject<Schema>[]>;\n poll: () => Promise<void>;\n isInitialPolling: Ref<boolean>;\n} {\n const graffiti = useGraffitiSynchronize();\n\n const schemaGetter = () => toValue(schema);\n const sessionGetter = () => toValue(session);\n const argGetters = [schemaGetter, sessionGetter] as const;\n\n const synchronizeFactory = () =>\n graffiti.synchronizeRecoverOrphans(...callGetters(argGetters));\n\n const reducer = new ArrayReducer<Schema>(graffiti);\n const streamFactory = () =>\n graffiti.recoverOrphans<Schema>(...callGetters(argGetters));\n const poller = new StreamPoller<Schema>(streamFactory);\n\n const { poll, isInitialPolling } = makeComposable<Schema>(\n reducer,\n poller,\n synchronizeFactory,\n argGetters,\n autopoll,\n );\n\n return {\n /**\n * A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * an array of Graffiti objects.\n */\n objects: reducer.results,\n /**\n * A method to poll for new results.\n */\n poll,\n /**\n * A boolean [ref](https://vuejs.org/api/reactivity-core.html#ref)\n * that indicates if the *first* poll is currently running.\n * Useful to show a loading spinner or disable a button.\n *\n * This also tracks new polls when the arguments have changed,\n * but it does not track ongoing polls from either calling\n * {@link poll} or using the `autopoll` argument.\n */\n isInitialPolling,\n };\n}\n","<script setup lang=\"ts\" generic=\"Schema extends JSONSchema\">\nimport { toRef } from \"vue\";\nimport type {\n GraffitiSession,\n JSONSchema,\n GraffitiObject,\n} from \"@graffiti-garden/api\";\nimport { useGraffitiDiscover } from \"./composables\";\n\nconst props = defineProps<{\n channels: string[];\n schema: Schema;\n session?: GraffitiSession | null;\n autopoll?: boolean;\n}>();\n\ndefineSlots<{\n default?(props: {\n objects: GraffitiObject<Schema>[];\n poll: () => void;\n isInitialPolling: boolean;\n }): any;\n}>();\n\nconst { objects, poll, isInitialPolling } = useGraffitiDiscover<Schema>(\n toRef(props, \"channels\"),\n toRef(props, \"schema\"),\n toRef(props, \"session\"),\n toRef(props, \"autopoll\"),\n);\n</script>\n\n<template>\n <slot\n :objects=\"objects\"\n :poll=\"poll\"\n :isInitialPolling=\"isInitialPolling\"\n ></slot>\n</template>\n","<script setup lang=\"ts\" generic=\"Schema extends JSONSchema\">\nimport { toRef } from \"vue\";\nimport type {\n GraffitiObjectUrl,\n GraffitiObject,\n GraffitiSession,\n JSONSchema,\n} from \"@graffiti-garden/api\";\nimport { useGraffitiGet } from \"./composables\";\n\nconst props = defineProps<{\n url: string | GraffitiObjectUrl;\n schema: Schema;\n session?: GraffitiSession | null;\n autopoll?: boolean;\n}>();\n\ndefineSlots<{\n default?(props: {\n object: GraffitiObject<Schema> | undefined | null;\n poll: () => void;\n isInitialPolling: boolean;\n }): any;\n}>();\n\nconst { object, poll, isInitialPolling } = useGraffitiGet<Schema>(\n toRef(props, \"url\"),\n toRef(props, \"schema\"),\n toRef(props, \"session\"),\n toRef(props, \"autopoll\"),\n);\n</script>\n\n<template>\n <slot\n :object=\"object\"\n :poll=\"poll\"\n :isInitialPolling=\"isInitialPolling\"\n ></slot>\n</template>\n","<script setup lang=\"ts\" generic=\"Schema extends JSONSchema\">\nimport { toRef } from \"vue\";\nimport type {\n GraffitiSession,\n JSONSchema,\n GraffitiObject,\n} from \"@graffiti-garden/api\";\nimport { useGraffitiRecoverOrphans } from \"./composables\";\n\nconst props = defineProps<{\n schema: Schema;\n session: GraffitiSession;\n autopoll?: boolean;\n}>();\n\ndefineSlots<{\n default?(props: {\n objects: GraffitiObject<Schema>[];\n poll: () => void;\n isInitialPolling: boolean;\n }): any;\n}>();\n\nconst { objects, poll, isInitialPolling } = useGraffitiRecoverOrphans<Schema>(\n toRef(props, \"schema\"),\n toRef(props, \"session\"),\n toRef(props, \"autopoll\"),\n);\n</script>\n\n<template>\n <slot\n :objects=\"objects\"\n :poll=\"poll\"\n :isInitialPolling=\"isInitialPolling\"\n ></slot>\n</template>\n","import type { App, Plugin, Ref } from \"vue\";\nimport { ref } from \"vue\";\nimport Discover from \"./Discover.vue\";\nimport Get from \"./Get.vue\";\nimport RecoverOrphans from \"./RecoverOrphans.vue\";\nimport type {\n Graffiti,\n GraffitiSession,\n GraffitiLoginEvent,\n GraffitiLogoutEvent,\n GraffitiSessionInitializedEvent,\n} from \"@graffiti-garden/api\";\nimport { globals } from \"./globals\";\nimport type { Router } from \"vue-router\";\nimport { GraffitiSynchronize } from \"@graffiti-garden/wrapper-synchronize\";\n\ndeclare module \"vue\" {\n export interface ComponentCustomProperties {\n /**\n * Global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance.\n *\n * In the [composition API](https://vuejs.org/guide/introduction.html#composition-api)\n * use {@link useGraffiti} instead.\n *\n * This is the same Graffiti registered with the {@link GraffitiPlugin}\n * via {@link GraffitiPluginOptions.graffiti}, only it has been wrapped\n * with [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).\n * Be sure to use the wrapped instance to enable reactivity.\n */\n $graffiti: Graffiti;\n /**\n * Global reactive [GraffitiSession](https://api.graffiti.garden/classes/GraffitiSession.html) instance\n * as a [Vue ref](https://vuejs.org/api/reactivity-core.html#ref).\n *\n * In the [composition API](https://vuejs.org/guide/introduction.html#composition-api)\n * use {@link useGraffitiSession} instead.\n *\n * While the application is loading and restoring any previous sessions,\n * the value will be `undefined`. If the user is not logged in,\n * the value will be `null`.\n *\n * This only keeps track of one session. If your app needs\n * to support multiple login sessions, you'll need to manage them\n * yourself using [`Graffiti.sessionEvents`](https://api.graffiti.garden/classes/Graffiti.html#sessionevents).\n */\n $graffitiSession: Ref<GraffitiSession | undefined | null>;\n }\n\n export interface GlobalComponents {\n GraffitiDiscover: typeof Discover;\n GraffitiGet: typeof Get;\n GraffitiRecoverOrphans: typeof RecoverOrphans;\n }\n}\nexport type { ComponentCustomProperties } from \"vue\";\n\n/**\n * Options for the {@link GraffitiPlugin}.\n */\nexport interface GraffitiPluginOptions {\n /**\n * An instance of the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)\n * for the Vue.js plugin to use.\n * This instance, wrapped with [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html),\n * will be exposed in Vue templates as {@link ComponentCustomProperties.$graffiti | $graffiti}\n * and in setup functions as {@link useGraffiti}.\n * You must interact with Graffiti through these wrapped instances\n * to enable reactivity.\n *\n * You'll likely want to use the [federated implementation](https://github.com/graffiti-garden/implementation-federated).\n * However, you could also use the [local implementation](https://github.com/graffiti-garden/implementation-local)\n * for testing. Other implementations may be available in the future.\n */\n graffiti: Graffiti;\n}\n\n/**\n * A [Vue.js](https://vuejs.org/) plugin that wraps around\n * the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)\n * to provide [reactive](https://en.wikipedia.org/wiki/Reactive_programming) versions\n * of various Graffiti API methods.\n *\n * These reactive methods are available as both\n * [renderless components](https://vuejs.org/guide/components/slots#renderless-components),\n * which make it possible to create a whole Graffiti app in an HTML template,\n * and [composables](https://vuejs.org/guide/reusability/composables.html),\n * which can be used in the programmatic [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * | [API](https://api.graffiti.garden/classes/Graffiti.html) method | [Composable](https://vuejs.org/guide/reusability/composables.html) | [Component](https://vuejs.org/guide/components/slots#renderless-components) |\n * | --- | --- | --- |\n * | [discover](https://api.graffiti.garden/classes/Graffiti.html#discover) | {@link useGraffitiDiscover} | {@link GraffitiDiscover} |\n * | [get](https://api.graffiti.garden/classes/Graffiti.html#get) | {@link useGraffitiGet} | {@link GraffitiGet} |\n * | [recoverOrphans](https://api.graffiti.garden/classes/Graffiti.html#recoverorphans) | {@link useGraffitiRecoverOrphans} | {@link GraffitiRecoverOrphans} |\n *\n * The plugin also exposes a global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance\n * and keeps track of the global [GraffitiSession](https://api.graffiti.garden/interfaces/GraffitiSession.html)\n * state as a reactive variable.\n * They are available in templates as global variables or in setup functions as\n * composable functions.\n *\n * | Global variabale | [Composable](https://vuejs.org/guide/reusability/composables.html) |\n * | --- | --- |\n * | {@link ComponentCustomProperties.$graffiti | $graffiti } | {@link useGraffiti} |\n * | {@link ComponentCustomProperties.$graffitiSession | $graffitiSession } | {@link useGraffitiSession} |\n *\n * [See the README for installation instructions](/).\n *\n * You can [try out live examples](/examples/), but basic usage looks like this:\n *\n * ```ts\n * import { createApp } from \"vue\";\n * import { GraffitiPlugin } from \"@graffiti-garden/vue\";\n * import { GraffitiLocal } from \"@graffiti-garden/implementation-local\";\n * import App from \"./App.vue\";\n *\n * createApp(App)\n * .use(GraffitiPlugin, {\n * graffiti: new GraffitiLocal(),\n * })\n * ```\n *\n * ```vue\n * <!-- App.vue -->\n * <template>\n * <button\n * v-if=\"$graffitiSession.value\"\n * @click=\"$graffiti.put({\n * value: { content: 'Hello, world!' },\n * channels: [ 'my-channel' ]\n * }, $graffitiSession.value)\"\n * >\n * Say Hello\n * </button>\n * <button v-else @click=\"$graffiti.login()\">\n * Log In to Say Hello\n * </button>\n *\n * <GraffitiDiscover\n * v-slot=\"{ results }\"\n * :channels=\"[ 'my-channel' ]\"\n * :schema=\"{\n * properties: {\n * value: {\n * required: ['content'],\n * properties: {\n * content: { type: 'string' }\n * }\n * }\n * }\n * }\"\n * >\n * <ul>\n * <li\n * v-for=\"result in results\"\n * :key=\"$graffiti.objectToUri(result)\"\n * >\n * {{ result.value.content }}\n * </li>\n * </ul>\n * </GraffitiDiscover>\n * </template>\n * ```\n */\nexport const GraffitiPlugin: Plugin<GraffitiPluginOptions> = {\n install(app: App, options: GraffitiPluginOptions) {\n const graffitiBase = options.graffiti;\n const graffiti = new GraffitiSynchronize(graffitiBase);\n\n const graffitiSession = ref<GraffitiSession | undefined | null>(undefined);\n graffiti.sessionEvents.addEventListener(\"initialized\", async (evt) => {\n const detail = (evt as GraffitiSessionInitializedEvent).detail;\n\n if (detail && detail.error) {\n console.error(detail.error);\n }\n\n if (detail && detail.href) {\n // If we're using Vue Router, redirect to the URL after login\n const router = app.config.globalProperties.$router as\n | Router\n | undefined;\n if (router) {\n const base = router.options.history.base;\n const url = new URL(detail.href);\n if (url.pathname.startsWith(base)) {\n url.pathname = url.pathname.slice(base.length);\n }\n await router.replace(url.pathname + url.search + url.hash);\n }\n }\n\n // Set the session to \"null\" if the user is not logged in\n if (!graffitiSession.value) {\n graffitiSession.value = null;\n }\n });\n graffiti.sessionEvents.addEventListener(\"login\", (evt) => {\n const detail = (evt as GraffitiLoginEvent).detail;\n if (detail.error) {\n console.error(\"Error logging in:\");\n console.error(detail.error);\n return;\n } else {\n graffitiSession.value = detail.session;\n }\n });\n graffiti.sessionEvents.addEventListener(\"logout\", (evt) => {\n const detail = (evt as GraffitiLogoutEvent).detail;\n if (detail.error) {\n console.error(\"Error logging out:\");\n console.error(detail.error);\n } else {\n graffitiSession.value = null;\n }\n });\n\n globals.graffitiSynchronize = graffiti;\n globals.graffitiSession = graffitiSession;\n\n app.component(\"GraffitiDiscover\", Discover);\n app.component(\"GraffitiGet\", Get);\n app.component(\"GraffitiRecoverOrphans\", RecoverOrphans);\n app.config.globalProperties.$graffiti = graffiti;\n app.config.globalProperties.$graffitiSession = graffitiSession;\n },\n};\n\nexport * from \"./composables\";\nexport {\n useGraffiti,\n useGraffitiSynchronize,\n useGraffitiSession,\n} from \"./globals\";\n\n/**\n * The [Graffiti.discover](https://api.graffiti.garden/classes/Graffiti.html#discover)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and slots are identical to the arguments and return values of\n * the composable {@link useGraffitiDiscover}.\n */\nexport const GraffitiDiscover = Discover;\n/**\n * The [Graffiti.get](https://api.graffiti.garden/classes/Graffiti.html#get)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and slots are identical to the arguments and return values of\n * the composable {@link useGraffitiGet}.\n */\nexport const GraffitiGet = Get;\n/**\n * The [Graffiti.recoverOrphans](https://api.graffiti.garden/classes/Graffiti.html#recoverorphans)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and slots are identical to the arguments and return values of\n * the composable {@link useGraffitiRecoverOrphans}.\n */\nexport const GraffitiRecoverOrphans = RecoverOrphans;\n"],"names":["globals","useGraffitiSynchronize","graffiti","useGraffiti","useGraffitiSession","session","s","t","e","GetPoller","getter","__publicField","onEntry","object","myGetter","StreamPoller","streamFactory","GraffitiErrorNotFound","myIterator","result","iterator","isEntryNewer","entry","existing","SingletonReducer","ref","computed","value","ArrayReducer","acc","makeComposable","reducer","poller","synchronizeFactory","toWatch","autopoll","synchronizeIterator","pollSynchronize","isAlreadyPolling","innerPoll","poll","myPoll","r","toValue","isInitialPolling","watch","newValue","oldValue","onScopeDispose","toSessionGetter","sessionInjected","sessionValue","callGetters","getters","fn","useGraffitiDiscover","channels","schema","channelsGetter","schemaGetter","sessionGetter","argGetters","useGraffitiGet","locationOrUri","locationOrUriGetter","useGraffitiRecoverOrphans","props","__props","objects","toRef","GraffitiPlugin","app","options","graffitiBase","GraffitiSynchronize","graffitiSession","evt","detail","router","base","url","Discover","Get","RecoverOrphans","GraffitiDiscover","GraffitiGet","GraffitiRecoverOrphans"],"mappings":"6TAIaA,EAGT,CAAC,EAOE,SAASC,GAAyB,CACvC,MAAMC,EAAWF,EAAQ,oBACzB,GAAI,CAACE,EACH,MAAM,IAAI,MACR,sEACF,EAEK,OAAAA,CACT,CAeO,SAASC,GAAwB,CACtC,OAAOF,EAAuB,CAChC,CAkBO,SAASG,GAAqB,CACnC,MAAMC,EAAUL,EAAQ,gBACxB,GAAI,CAACK,EACH,MAAM,IAAI,MACR,qEACF,EAEK,OAA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,EAC1B,MAAA,MAEAF,EAAgB,MAAQE,EAAO,OACjC,CACD,EACD3E,EAAS,cAAc,iBAAiB,SAAW0E,GAAQ,CACzD,MAAMC,EAAUD,EAA4B,OACxCC,EAAO,OACT,QAAQ,MAAM,oBAAoB,EAC1B,QAAA,MAAMA,EAAO,KAAK,GAE1BF,EAAgB,MAAQ,IAC1B,CACD,EAED3E,EAAQ,oBAAsBE,EAC9BF,EAAQ,gBAAkB2E,EAEtBJ,EAAA,UAAU,mBAAoBU,CAAQ,EACtCV,EAAA,UAAU,cAAeW,CAAG,EAC5BX,EAAA,UAAU,yBAA0BY,CAAc,EAClDZ,EAAA,OAAO,iBAAiB,UAAYrE,EACpCqE,EAAA,OAAO,iBAAiB,iBAAmBI,CAAA,CAEnD,EAiBaS,EAAmBH,EASnBI,EAAcH,EASdI,EAAyBH","x_google_ignoreList":[1]}
1
+ {"version":3,"file":"plugin.js","sources":["../../node_modules/@graffiti-garden/api/dist/index.mjs","../../src/globals.ts","../../src/composables/discover.ts","../../src/composables/resolve-string.ts","../../src/composables/actor-to-handle.ts","../../src/components/ActorToHandle.vue","../../src/components/ObjectInfo.vue","../../src/components/Discover.vue","../../src/composables/get.ts","../../src/components/Get.vue","../../src/composables/get-media.ts","../../src/components/GetMedia.vue","../../src/composables/handle-to-actor.ts","../../src/components/HandleToActor.vue","../../src/plugin.ts"],"sourcesContent":["var n=class{};var u={type:\"object\",properties:{value:{type:\"object\"},channels:{type:\"array\",items:{type:\"string\"}},allowed:{type:\"array\",items:{type:\"string\"},nullable:!0},url:{type:\"string\"},actor:{type:\"string\"}},additionalProperties:!1,required:[\"value\",\"channels\",\"actor\",\"url\"]},b={...u,required:[\"value\",\"channels\"]};var c=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorForbidden\",Object.setPrototypeOf(this,t.prototype)}},f=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorNotFound\",Object.setPrototypeOf(this,t.prototype)}},m=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorInvalidSchema\",Object.setPrototypeOf(this,t.prototype)}},p=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorSchemaMismatch\",Object.setPrototypeOf(this,t.prototype)}},l=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorTooLarge\",Object.setPrototypeOf(this,t.prototype)}},S=class t extends Error{constructor(e){super(e),this.name=\"GraffitiErrorNotAcceptable\",Object.setPrototypeOf(this,t.prototype)}};function h(t){return typeof t==\"string\"?t:t.url}function y(t,e){return!Array.isArray(t.allowed)||typeof e?.actor==\"string\"&&(t.actor===e.actor||t.allowed.includes(e.actor))}function j(t,e,r){if(r===t.actor)return t;let a=t.allowed&&r?[r]:void 0,s=t.channels.filter(i=>e.includes(i));return{...t,allowed:a,channels:s}}function x(t,e){let[r,a]=t.toLowerCase().split(\";\")[0].split(\"/\");return!r||!a?!1:e.some(s=>{let[i,o]=s.toLowerCase().split(\";\")[0].split(\"/\");return!i||!o?!1:(i===r||i===\"*\")&&(o===a||o===\"*\")})}export{n as Graffiti,c as GraffitiErrorForbidden,m as GraffitiErrorInvalidSchema,S as GraffitiErrorNotAcceptable,f as GraffitiErrorNotFound,p as GraffitiErrorSchemaMismatch,l as GraffitiErrorTooLarge,u as GraffitiObjectJSONSchema,b as GraffitiPostObjectJSONSchema,y as isActorAllowedGraffitiObject,x as isMediaAcceptable,j as maskGraffitiObject,h as unpackObjectUrl};\n//# sourceMappingURL=index.mjs.map\n","import type { Ref } from \"vue\";\nimport type { Graffiti, GraffitiSession } from \"@graffiti-garden/api\";\nimport type { GraffitiSynchronize } from \"@graffiti-garden/wrapper-synchronize\";\n\nconst globals: {\n graffitiSynchronize?: GraffitiSynchronize;\n graffitiSession?: Ref<GraffitiSession | undefined | null>;\n} = {};\n\nexport function setGraffitiSession(\n session: Ref<GraffitiSession | undefined | null>,\n) {\n if (!globals.graffitiSession) {\n globals.graffitiSession = session;\n } else {\n throw new Error(\n \"Graffiti session already set - plugin installed multiple times?\",\n );\n }\n}\n\nexport function setGraffitiSynchronize(synchronize: GraffitiSynchronize) {\n if (!globals.graffitiSynchronize) {\n globals.graffitiSynchronize = synchronize;\n } else {\n throw new Error(\n \"Graffiti synchronize already set - plugin installed multiple times?\",\n );\n }\n}\n\n/**\n * Returns the global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance\n * that has been wrapped by the {@link GraffitiPlugin} with the [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).\n * @throws If the {@link GraffitiPlugin} is not installed\n */\nexport function useGraffitiSynchronize() {\n const graffiti = globals.graffitiSynchronize;\n if (!graffiti) {\n throw new Error(\n \"No Graffiti instance provided, did you forget to install the plugin?\",\n );\n }\n return graffiti;\n}\n\n/**\n * Returns the global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance.\n *\n * In Vue templates and the [options API](https://vuejs.org/guide/introduction.html#options-api)\n * use may use the global variable {@link ComponentCustomProperties.$graffiti | $graffiti} instead.\n *\n * This is the same Graffiti registered with the {@link GraffitiPlugin}\n * via {@link GraffitiPluginOptions.graffiti}, only it has been wrapped\n * with [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).\n * Be sure to use the wrapped instance to enable reactivity.\n *\n * @throws If the {@link GraffitiPlugin} is not installed\n */\nexport function useGraffiti(): Graffiti {\n return useGraffitiSynchronize();\n}\n\n/**\n * Returns a global reactive [GraffitiSession](https://api.graffiti.garden/interfaces/GraffitiSession.html) instance\n * as a [Vue ref](https://vuejs.org/api/reactivity-core.html#ref).\n *\n * In Vue templates and the [options API](https://vuejs.org/guide/introduction.html#options-api)\n * use the global variable {@link ComponentCustomProperties.$graffitiSession | $graffitiSession} instead.\n *\n * While the application is loading and restoring any previous sessions,\n * the value will be `undefined`. If the user is not logged in,\n * the value will be `null`.\n *\n * This only keeps track of one session. If your app needs\n * to support multiple login sessions, you'll need to manage them\n * yourself using [`Graffiti.sessionEvents`](https://api.graffiti.garden/classes/Graffiti.html#sessionevents).\n * @throws If the {@link GraffitiPlugin} is not installed\n */\nexport function useGraffitiSession() {\n const session = globals.graffitiSession;\n if (!session) {\n throw new Error(\n \"No Graffiti session provided, did you forget to install the plugin?\",\n );\n }\n return session;\n}\n","import type {\n GraffitiObject,\n GraffitiObjectStreamContinue,\n GraffitiObjectStreamContinueEntry,\n GraffitiObjectStreamError,\n GraffitiObjectStreamReturn,\n GraffitiSession,\n JSONSchema,\n} from \"@graffiti-garden/api\";\nimport { GraffitiErrorNotFound } from \"@graffiti-garden/api\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport { ref, toValue, watch, onScopeDispose } from \"vue\";\nimport { useGraffitiSynchronize } from \"../globals\";\n\n/**\n * The [Graffiti.discover](https://api.graffiti.garden/classes/Graffiti.html#discover)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiDiscover}.\n *\n * The arguments of this composable are largely the same as Graffiti.discover,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * There is one additional optional argument `autopoll`, which when `true`,\n * will automatically poll for new objects.\n * As they change the arguments change, the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n *\n * @returns\n * - `objects`: A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * an array of Graffiti objects.\n * - `poll`: A function that can be called to manually check for objects.\n * - `isFirstPoll`: A boolean [ref](https://vuejs.org/api/reactivity-core.html#ref)\n * that indicates if the *first* poll after a change of arguments is currently running.\n * It may be used to show a loading spinner or disable a button, or it can be watched\n * to know when the `objects` array is ready to use.\n */\nexport function useGraffitiDiscover<Schema extends JSONSchema>(\n channels: MaybeRefOrGetter<string[]>,\n schema: MaybeRefOrGetter<Schema>,\n session?: MaybeRefOrGetter<GraffitiSession | undefined | null>,\n /**\n * Whether to automatically poll for new objects.\n */\n autopoll: MaybeRefOrGetter<boolean> = false,\n) {\n const graffiti = useGraffitiSynchronize();\n\n // Output\n const objectsRaw: Map<string, GraffitiObject<Schema>> = new Map();\n const objects: Ref<GraffitiObject<Schema>[]> = ref([]);\n let poll_ = async () => {};\n const poll = async () => poll_();\n const isFirstPoll = ref(true);\n\n // Maintain iterators for disposal\n let syncIterator: AsyncGenerator<GraffitiObjectStreamContinueEntry<Schema>>;\n let discoverIterator: GraffitiObjectStreamContinue<Schema>;\n onScopeDispose(() => {\n syncIterator?.return(null);\n discoverIterator?.return({\n continue: () => discoverIterator,\n cursor: \"\",\n });\n });\n\n const refresh = ref(0);\n function restartWatch(timeout = 0) {\n setTimeout(() => {\n refresh.value++;\n }, timeout);\n }\n watch(\n () => ({\n args: [toValue(channels), toValue(schema), toValue(session)] as const,\n refresh: refresh.value,\n }),\n ({ args }, _prev, onInvalidate) => {\n // Reset the output\n objectsRaw.clear();\n objects.value = [];\n isFirstPoll.value = true;\n\n // Initialize new iterators\n const mySyncIterator = graffiti.synchronizeDiscover<Schema>(...args);\n syncIterator = mySyncIterator;\n let myDiscoverIterator: GraffitiObjectStreamContinue<Schema>;\n\n // Set up automatic iterator cleanup\n let active = true;\n onInvalidate(() => {\n active = false;\n mySyncIterator.return(null);\n myDiscoverIterator?.return({\n continue: () => discoverIterator,\n cursor: \"\",\n });\n });\n\n // Start to synchronize in the background\n // (all polling results will go through here)\n let batchFlattenPromise: Promise<void> | undefined = undefined;\n (async () => {\n for await (const result of mySyncIterator) {\n if (!active) break;\n if (result.tombstone) {\n objectsRaw.delete(result.object.url);\n } else {\n objectsRaw.set(result.object.url, result.object);\n }\n // Flatten objects in batches to prevent\n // excessive re-rendering\n if (!batchFlattenPromise) {\n batchFlattenPromise = new Promise<void>((resolve) => {\n setTimeout(() => {\n if (active) {\n objects.value = Array.from(objectsRaw.values());\n }\n batchFlattenPromise = undefined;\n resolve();\n }, 50);\n });\n }\n }\n })();\n\n // Then set up a polling function\n let polling = false;\n let continueFn: GraffitiObjectStreamReturn<Schema>[\"continue\"] = () =>\n graffiti.discover<Schema>(...args);\n poll_ = async () => {\n if (polling || !active) return;\n polling = true;\n\n // Try to start the iterator\n try {\n myDiscoverIterator = continueFn(args[2]);\n } catch (e) {\n // Discovery is lazy so this should not happen,\n // wait a bit before retrying\n return restartWatch(5000);\n }\n if (!active) return;\n discoverIterator = myDiscoverIterator;\n\n while (true) {\n let result: IteratorResult<\n | GraffitiObjectStreamContinueEntry<Schema>\n | GraffitiObjectStreamError,\n GraffitiObjectStreamReturn<Schema>\n >;\n try {\n result = await myDiscoverIterator.next();\n } catch (e) {\n if (e instanceof GraffitiErrorNotFound) {\n // The cursor has expired, we need to start from scratch.\n return restartWatch();\n } else {\n // If something else went wrong, wait a bit before retrying\n return restartWatch(5000);\n }\n }\n if (!active) return;\n if (result.done) {\n continueFn = result.value.continue;\n break;\n } else if (result.value.error) {\n // Non-fatal errors do not stop the stream\n console.error(result.value.error);\n }\n }\n\n // Wait for sync to receive updates\n await new Promise((resolve) => setTimeout(resolve, 0));\n // And wait for pending results to be flattened\n if (batchFlattenPromise) await batchFlattenPromise;\n\n if (!active) return;\n polling = false;\n isFirstPoll.value = false;\n if (toValue(autopoll)) poll();\n };\n poll();\n },\n { immediate: true },\n );\n\n // Start polling if autopoll turns true\n watch(\n () => toValue(autopoll),\n (value) => value && poll(),\n );\n\n return {\n objects,\n poll,\n isFirstPoll,\n };\n}\n","import { GraffitiErrorNotFound } from \"@graffiti-garden/api\";\nimport type { MaybeRefOrGetter } from \"vue\";\nimport { ref, toValue, watch } from \"vue\";\n\nexport function useResolveString(\n input: MaybeRefOrGetter<string>,\n resolve: (input: string) => Promise<string>,\n) {\n const output = ref<string | null | undefined>(undefined);\n\n watch(\n () => toValue(input),\n async (input, _prev, onInvalidate) => {\n let active = true;\n onInvalidate(() => {\n active = false;\n });\n\n output.value = undefined;\n\n try {\n const resolved = await resolve(input);\n if (active) output.value = resolved;\n } catch (err) {\n if (!active) return;\n\n if (err instanceof GraffitiErrorNotFound) {\n output.value = null;\n } else {\n console.error(err);\n }\n }\n },\n { immediate: true },\n );\n\n return {\n output,\n };\n}\n\nexport function displayOutput(output: string | null | undefined) {\n if (output === undefined) return \"Loading...\";\n if (output === null) return \"Not found\";\n return output;\n}\n","import type { MaybeRefOrGetter } from \"vue\";\nimport { useGraffiti } from \"../globals\";\nimport { useResolveString } from \"./resolve-string\";\n\n/**\n * The [Graffiti.actorToHandle](https://api.graffiti.garden/classes/Graffiti.html#actortohandle)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiActorToHandle}.\n *\n * The arguments of this composable are the same as Graffiti.actorToHandle,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * As they change the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n *\n * @returns\n * - `handle`: A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * the retrieved handle, if it exists. If the handle cannot be found, the result\n * is `null`. If the handle is still being fetched, the result is `undefined`.\n */\nexport function useGraffitiActorToHandle(actor: MaybeRefOrGetter<string>) {\n const graffiti = useGraffiti();\n const { output } = useResolveString(\n actor,\n graffiti.actorToHandle.bind(graffiti),\n );\n return { handle: output };\n}\n","<script setup lang=\"ts\">\nimport { toRef } from \"vue\";\nimport { displayOutput } from \"../composables/resolve-string\";\nimport { useGraffitiActorToHandle } from \"../composables/actor-to-handle\";\n\nconst props = defineProps<{ actor: string }>();\nconst actor = toRef(props, \"actor\");\n\nconst { handle } = useGraffitiActorToHandle(actor);\n</script>\n\n<template>\n <slot :handle=\"handle\">\n <span> {{ displayOutput(handle) }} </span>\n </slot>\n</template>\n","<script setup lang=\"ts\">\nimport type { GraffitiObjectBase, GraffitiSession } from \"@graffiti-garden/api\";\nimport ActorToHandle from \"./ActorToHandle.vue\";\nimport { useGraffiti } from \"../globals\";\nimport { ref } from \"vue\";\n\ndefineProps<{\n object: GraffitiObjectBase | null | undefined;\n}>();\n\nconst graffiti = useGraffiti();\nconst deleting = ref(false);\nasync function deleteObject(\n object: GraffitiObjectBase,\n session: GraffitiSession,\n) {\n deleting.value = true;\n await new Promise((resolve) => setTimeout(resolve, 0));\n if (\n confirm(\n \"Are you sure you want to delete this object? It cannot be undone.\",\n )\n ) {\n await graffiti.delete(object, session);\n }\n deleting.value = false;\n}\n</script>\n\n<template>\n <article v-if=\"object\" :data-url=\"object.url\">\n <header>\n <h2>Graffiti Object</h2>\n\n <dl>\n <dt>Object URL</dt>\n <dd>\n <code>{{ object.url }}</code>\n </dd>\n\n <dt>Actor</dt>\n <dd>\n <code>{{ object.actor }}</code>\n </dd>\n\n <dt>Handle</dt>\n <dd>\n <ActorToHandle :actor=\"object.actor\" />\n </dd>\n </dl>\n </header>\n\n <section>\n <h3>Content</h3>\n <pre>{{ object.value }}</pre>\n </section>\n\n <section>\n <h3>Allowed Actors</h3>\n\n <p v-if=\"!Array.isArray(object.allowed)\">\n <em>Public</em>\n </p>\n <p v-else-if=\"object.allowed.length === 0\">\n <em>Noone</em>\n </p>\n <ul>\n <li v-for=\"actor in object.allowed\" :key=\"actor\">\n <dl>\n <dt>Actor</dt>\n <dd>\n <code>{{ actor }}</code>\n </dd>\n <dt>Handle</dt>\n <dd>\n <ActorToHandle :actor=\"actor\" />\n </dd>\n </dl>\n </li>\n </ul>\n </section>\n\n <section>\n <h3>Channels</h3>\n\n <ul v-if=\"object.channels?.length\">\n <li v-for=\"channel in object.channels\" :key=\"channel\">\n <code>{{ channel }}</code>\n </li>\n </ul>\n <p v-else>\n <em>No channels</em>\n </p>\n </section>\n\n <footer>\n <nav>\n <ul>\n <li v-if=\"$graffitiSession.value?.actor === object.actor\">\n <button\n :disabled=\"deleting\"\n @click=\"\n deleteObject(object, $graffitiSession.value)\n \"\n >\n {{ deleting ? \"Deleting...\" : \"Delete\" }}\n </button>\n </li>\n </ul>\n </nav>\n </footer>\n </article>\n\n <article v-else-if=\"object === null\">\n <header>\n <h2>Graffiti Object</h2>\n </header>\n <p><em>Object not found</em></p>\n </article>\n\n <article v-else>\n <header>\n <h2>Graffiti Object</h2>\n </header>\n <p><em>Loading...</em></p>\n </article>\n</template>\n","<script setup lang=\"ts\" generic=\"Schema extends JSONSchema\">\nimport { toRef } from \"vue\";\nimport type {\n GraffitiSession,\n JSONSchema,\n GraffitiObject,\n} from \"@graffiti-garden/api\";\nimport { useGraffitiDiscover } from \"../composables/discover\";\nimport ObjectInfo from \"./ObjectInfo.vue\";\n\nconst props = defineProps<{\n channels: string[];\n schema: Schema;\n session?: GraffitiSession | null;\n autopoll?: boolean;\n}>();\n\ndefineSlots<{\n default?(props: {\n objects: GraffitiObject<Schema>[];\n poll: () => Promise<void>;\n isFirstPoll: boolean;\n }): any;\n}>();\n\nconst { objects, poll, isFirstPoll } = useGraffitiDiscover<Schema>(\n toRef(props, \"channels\"),\n toRef(props, \"schema\"),\n toRef(props, \"session\"),\n toRef(props, \"autopoll\"),\n);\n</script>\n\n<template>\n <slot :objects=\"objects\" :poll=\"poll\" :isFirstPoll=\"isFirstPoll\">\n <ul v-if=\"!isFirstPoll\">\n <li v-for=\"object in objects\" :key=\"object.url\">\n <ObjectInfo :object=\"object\" />\n </li>\n </ul>\n <p v-else>\n <em> Loading... </em>\n </p>\n </slot>\n</template>\n","import type {\n GraffitiObject,\n GraffitiObjectUrl,\n GraffitiObjectStreamContinueEntry,\n GraffitiSession,\n JSONSchema,\n} from \"@graffiti-garden/api\";\nimport { GraffitiErrorNotFound } from \"@graffiti-garden/api\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport { ref, toValue, watch, onScopeDispose } from \"vue\";\nimport { useGraffitiSynchronize } from \"../globals\";\n\n/**\n * The [Graffiti.get](https://api.graffiti.garden/classes/Graffiti.html#get)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiGet}.\n *\n * The arguments of this composable are the same as Graffiti.get,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * As they change the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n *\n * @returns\n * - `object`: A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * the retrieved Graffiti object, if it exists. If the object cannot be found,\n * the result is `null`. If the object is still being fetched, the result is `undefined`.\n * - `poll`: A function that can be called to manually check if the object has changed.\n */\nexport function useGraffitiGet<Schema extends JSONSchema>(\n url: MaybeRefOrGetter<GraffitiObjectUrl | string>,\n schema: MaybeRefOrGetter<Schema>,\n session?: MaybeRefOrGetter<GraffitiSession | undefined | null>,\n): {\n object: Ref<GraffitiObject<Schema> | null | undefined>;\n poll: () => Promise<void>;\n} {\n const graffiti = useGraffitiSynchronize();\n\n const object: Ref<GraffitiObject<Schema> | null | undefined> = ref(undefined);\n let poll_ = async () => {};\n const poll = async () => poll_();\n\n let iterator: AsyncGenerator<GraffitiObjectStreamContinueEntry<Schema>>;\n onScopeDispose(() => {\n iterator?.return(null);\n });\n\n watch(\n () => [toValue(url), toValue(schema), toValue(session)] as const,\n (args, _prev, onInvalidate) => {\n // Reset the object value (undefined = \"loading\")\n object.value = undefined;\n\n // Initialize a new iterator\n const myIterator = graffiti.synchronizeGet<Schema>(...args);\n iterator = myIterator;\n\n // Make sure to dispose of the iterator when invalidated\n let active = true;\n onInvalidate(() => {\n active = false;\n myIterator.return(null);\n });\n\n // Listen to the iterator in the background,\n // it will receive results from polling below\n (async () => {\n for await (const result of myIterator) {\n if (!active) return;\n if (result.tombstone) {\n object.value = null;\n } else {\n object.value = result.object;\n }\n }\n })();\n\n // Then set up a polling function\n let polling = false;\n poll_ = async () => {\n if (polling || !active) return;\n polling = true;\n try {\n await graffiti.get<Schema>(...args);\n } catch (e) {\n if (!(e instanceof GraffitiErrorNotFound)) {\n console.error(e);\n }\n }\n\n // Wait for sync to receive the update\n await new Promise((resolve) => setTimeout(resolve, 0));\n polling = false;\n };\n poll();\n },\n { immediate: true },\n );\n\n return {\n object,\n poll,\n };\n}\n","<script setup lang=\"ts\" generic=\"Schema extends JSONSchema\">\nimport { toRef } from \"vue\";\nimport type {\n GraffitiObjectUrl,\n GraffitiObject,\n GraffitiSession,\n JSONSchema,\n} from \"@graffiti-garden/api\";\nimport { useGraffitiGet } from \"../composables/get\";\nimport ObjectInfo from \"./ObjectInfo.vue\";\n\nconst props = defineProps<{\n url: string | GraffitiObjectUrl;\n schema: Schema;\n session?: GraffitiSession | null;\n}>();\n\ndefineSlots<{\n default?(props: {\n object: GraffitiObject<Schema> | undefined | null;\n poll: () => Promise<void>;\n }): any;\n}>();\n\nconst { object, poll } = useGraffitiGet<Schema>(\n toRef(props, \"url\"),\n toRef(props, \"schema\"),\n toRef(props, \"session\"),\n);\n</script>\n\n<template>\n <slot :object=\"object\" :poll=\"poll\">\n <ObjectInfo :object=\"object\" />\n </slot>\n</template>\n","import type {\n GraffitiMedia,\n GraffitiMediaAccept,\n GraffitiSession,\n} from \"@graffiti-garden/api\";\nimport { GraffitiErrorNotFound } from \"@graffiti-garden/api\";\nimport type { MaybeRefOrGetter, Ref } from \"vue\";\nimport { ref, toValue, watch, onScopeDispose } from \"vue\";\nimport { useGraffitiSynchronize } from \"../globals\";\n\n/**\n * The [Graffiti.getMedia](https://api.graffiti.garden/classes/Graffiti.html#getMedia)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiGetMedia}.\n *\n * The arguments of this composable are the same as Graffiti.getMedia,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * As they change the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n *\n * @returns\n * - `media`: A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * the retrieved Graffiti media, if it exists. The media will include a `dataUrl` property\n * that can be used to directly display the media in a template. If the media has been deleted,\n * the result is `null`. If the media is still being fetched, the result is `undefined`.\n * - `poll`: A function that can be called to manually check if the media has changed.\n */\nexport function useGraffitiGetMedia(\n url: MaybeRefOrGetter<string>,\n accept: MaybeRefOrGetter<GraffitiMediaAccept>,\n session?: MaybeRefOrGetter<GraffitiSession | undefined | null>,\n): {\n media: Ref<(GraffitiMedia & { dataUrl: string }) | null | undefined>;\n poll: () => Promise<void>;\n} {\n const graffiti = useGraffitiSynchronize();\n const media = ref<(GraffitiMedia & { dataUrl: string }) | null | undefined>(\n undefined,\n );\n\n // The \"poll counter\" is a hack to get\n // watch to refresh\n const pollCounter = ref(0);\n let pollPromise: Promise<void> | null = null;\n let resolvePoll = () => {};\n function poll() {\n if (pollPromise) return pollPromise;\n pollCounter.value++;\n // Wait until the watch finishes and calls\n // \"pollResolve\" to finish the poll\n pollPromise = new Promise<void>((resolve) => {\n resolvePoll = () => {\n pollPromise = null;\n resolve();\n };\n });\n return pollPromise;\n }\n watch(\n () => ({\n args: [toValue(url), toValue(accept), toValue(session)] as const,\n pollCounter: pollCounter.value,\n }),\n async ({ args }, _prev, onInvalidate) => {\n // Revoke the data URL to prevent a memory leak\n if (media.value?.dataUrl) {\n URL.revokeObjectURL(media.value.dataUrl);\n }\n media.value = undefined;\n\n let active = true;\n onInvalidate(() => {\n active = false;\n });\n\n try {\n const { data, actor, allowed } = await graffiti.getMedia(...args);\n if (!active) return;\n const dataUrl = URL.createObjectURL(data);\n media.value = {\n data,\n dataUrl,\n actor,\n allowed,\n };\n } catch (e) {\n if (!active) return;\n if (e instanceof GraffitiErrorNotFound) {\n media.value = null;\n } else {\n console.error(e);\n }\n } finally {\n resolvePoll();\n }\n },\n { immediate: true },\n );\n\n onScopeDispose(() => {\n resolvePoll();\n if (media.value?.dataUrl) {\n URL.revokeObjectURL(media.value.dataUrl);\n }\n });\n\n return {\n media,\n poll,\n };\n}\n","<script setup lang=\"ts\">\nimport { toRef } from \"vue\";\nimport type {\n GraffitiSession,\n GraffitiMediaAccept,\n GraffitiMedia,\n} from \"@graffiti-garden/api\";\nimport { useGraffitiGetMedia } from \"../composables/get-media\";\n\nconst props = defineProps<{\n url: string;\n accept: GraffitiMediaAccept;\n session?: GraffitiSession | null;\n}>();\n\ndefineSlots<{\n default?(props: {\n media: (GraffitiMedia & { dataUrl: string }) | null | undefined;\n poll: () => Promise<void>;\n }): any;\n}>();\n\nconst { media, poll } = useGraffitiGetMedia(\n toRef(props, \"url\"),\n toRef(props, \"accept\"),\n toRef(props, \"session\"),\n);\n\nfunction downloadMedia() {\n if (media.value) {\n window.location.href = media.value.dataUrl;\n }\n}\n</script>\n\n<template>\n <slot :media=\"media\" :poll=\"poll\">\n <img\n v-if=\"media?.data.type.startsWith('image/')\"\n :src=\"media.dataUrl\"\n :alt=\"`An image by ${media.actor}`\"\n />\n <video\n v-else-if=\"media?.data.type.startsWith('video/')\"\n controls\n :src=\"media.dataUrl\"\n :alt=\"`A video by ${media.actor}`\"\n />\n <audio\n v-else-if=\"media?.data.type.startsWith('audio/')\"\n controls\n :src=\"media.dataUrl\"\n :alt=\"`Audio by ${media.actor}`\"\n />\n <iframe\n v-else-if=\"media?.data.type === 'text/html'\"\n :src=\"media.dataUrl\"\n :alt=\"`HTML by ${media.actor}`\"\n sandbox=\"\"\n />\n <object\n v-else-if=\"media?.data.type.startsWith('application/pdf')\"\n :data=\"media.dataUrl\"\n type=\"application/pdf\"\n :alt=\"`PDF by ${media.actor}`\"\n />\n <button v-else-if=\"media\" @click=\"downloadMedia\">Download</button>\n <p v-else-if=\"media === null\">\n <em>Media not found</em>\n </p>\n <p v-else>\n <em> Loading... </em>\n </p>\n </slot>\n</template>\n","import type { MaybeRefOrGetter } from \"vue\";\nimport { useGraffiti } from \"../globals\";\nimport { useResolveString } from \"./resolve-string\";\n\n/**\n * The [Graffiti.handleToActor](https://api.graffiti.garden/classes/Graffiti.html#handletoactor)\n * method as a reactive [composable](https://vuejs.org/guide/reusability/composables.html)\n * for use in the Vue [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * Its corresponding renderless component is {@link GraffitiHandleToActor}.\n *\n * The arguments of this composable are the same as Graffiti.handleToActor,\n * only they can also be [Refs](https://vuejs.org/api/reactivity-core.html#ref)\n * or [getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get#description).\n * As they change the output will automatically update.\n * Reactivity only triggers when the root array or object changes,\n * not when the elements or properties change.\n * If you need deep reactivity, wrap your argument in a getter.\n *\n * @returns\n * - `actor`: A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains\n * the retrieved actor, if it exists. If the actor cannot be found, the result\n * is `null`. If the actor is still being fetched, the result is `undefined`.\n */\nexport function useGraffitiHandleToActor(handle: MaybeRefOrGetter<string>) {\n const graffiti = useGraffiti();\n const { output } = useResolveString(\n handle,\n graffiti.handleToActor.bind(graffiti),\n );\n return { actor: output };\n}\n","<script setup lang=\"ts\">\nimport { toRef } from \"vue\";\nimport { displayOutput } from \"../composables/resolve-string\";\nimport { useGraffitiHandleToActor } from \"../composables/handle-to-actor\";\n\nconst props = defineProps<{ handle: string }>();\nconst handle = toRef(props, \"handle\");\n\nconst { actor } = useGraffitiHandleToActor(handle);\n</script>\n\n<template>\n <slot :actor=\"actor\">\n <span> {{ displayOutput(actor) }} </span>\n </slot>\n</template>\n","import type { App, Plugin, Ref } from \"vue\";\nimport { ref } from \"vue\";\nimport Discover from \"./components/Discover.vue\";\nimport Get from \"./components/Get.vue\";\nimport GetMedia from \"./components/GetMedia.vue\";\nimport ActorToHandle from \"./components/ActorToHandle.vue\";\nimport HandleToActor from \"./components/HandleToActor.vue\";\nimport ObjectInfo from \"./components/ObjectInfo.vue\";\nimport type {\n Graffiti,\n GraffitiSession,\n GraffitiLoginEvent,\n GraffitiLogoutEvent,\n GraffitiSessionInitializedEvent,\n} from \"@graffiti-garden/api\";\nimport { setGraffitiSession, setGraffitiSynchronize } from \"./globals\";\nimport type { Router } from \"vue-router\";\nimport { GraffitiSynchronize } from \"@graffiti-garden/wrapper-synchronize\";\n\ndeclare module \"vue\" {\n export interface ComponentCustomProperties {\n /**\n * Global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance.\n *\n * In the [composition API](https://vuejs.org/guide/introduction.html#composition-api)\n * use {@link useGraffiti} instead.\n *\n * This is the same Graffiti registered with the {@link GraffitiPlugin}\n * via {@link GraffitiPluginOptions.graffiti}, only it has been wrapped\n * with [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html).\n * Be sure to use the wrapped instance to enable reactivity.\n */\n $graffiti: Graffiti;\n /**\n * Global reactive [GraffitiSession](https://api.graffiti.garden/classes/GraffitiSession.html) instance\n * as a [Vue ref](https://vuejs.org/api/reactivity-core.html#ref).\n *\n * In the [composition API](https://vuejs.org/guide/introduction.html#composition-api)\n * use {@link useGraffitiSession} instead.\n *\n * While the application is loading and restoring any previous sessions,\n * the value will be `undefined`. If the user is not logged in,\n * the value will be `null`.\n *\n * This only keeps track of one session. If your app needs\n * to support multiple login sessions, you'll need to manage them\n * yourself using [`Graffiti.sessionEvents`](https://api.graffiti.garden/classes/Graffiti.html#sessionevents).\n */\n $graffitiSession: Ref<GraffitiSession | undefined | null>;\n }\n\n export interface GlobalComponents {\n GraffitiDiscover: typeof Discover;\n GraffitiGet: typeof Get;\n GraffitiGetMedia: typeof GetMedia;\n GraffitiActorToHandle: typeof ActorToHandle;\n GraffitiHandleToActor: typeof HandleToActor;\n GraffitiObjectInfo: typeof ObjectInfo;\n }\n}\nexport type { ComponentCustomProperties } from \"vue\";\n\n/**\n * Options for the {@link GraffitiPlugin}.\n */\nexport interface GraffitiPluginOptions {\n /**\n * An instance of the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)\n * for the Vue.js plugin to use.\n * This instance, wrapped with [GraffitiSynchronize](https://sync.graffiti.garden/classes/GraffitiSynchronize.html),\n * will be exposed in Vue templates as {@link ComponentCustomProperties.$graffiti | $graffiti}\n * and in setup functions as {@link useGraffiti}.\n * You must interact with Graffiti through these wrapped instances\n * to enable reactivity.\n */\n graffiti: Graffiti;\n}\n\n/**\n * A [Vue.js](https://vuejs.org/) plugin that wraps around\n * the [Graffiti API](https://api.graffiti.garden/classes/Graffiti.html)\n * to provide [reactive](https://en.wikipedia.org/wiki/Reactive_programming) versions\n * of various Graffiti API methods.\n *\n * These reactive methods are available as both\n * [renderless components](https://vuejs.org/guide/components/slots#renderless-components),\n * which make it possible to create a whole Graffiti app in an HTML template,\n * and [composables](https://vuejs.org/guide/reusability/composables.html),\n * which can be used in the programmatic [composition API](https://vuejs.org/guide/introduction.html#composition-api).\n *\n * | [API](https://api.graffiti.garden/classes/Graffiti.html) method | [Composable](https://vuejs.org/guide/reusability/composables.html) | [Component](https://vuejs.org/guide/components/slots#renderless-components) |\n * | --- | --- | --- |\n * | [discover](https://api.graffiti.garden/classes/Graffiti.html#discover) | {@link useGraffitiDiscover} | {@link GraffitiDiscover} |\n * | [get](https://api.graffiti.garden/classes/Graffiti.html#get) | {@link useGraffitiGet} | {@link GraffitiGet} |\n * | [getMedia](https://api.graffiti.garden/classes/Graffiti.html#getmedia) | {@link useGraffitiGetMedia} | {@link GraffitiGetMedia} |\n * | [actorToHandle](https://api.graffiti.garden/classes/Graffiti.html#actortohandle) | {@link useGraffitiActorToHandle} | {@link GraffitiActorToHandle} |\n * | [handleToActor](https://api.graffiti.garden/classes/Graffiti.html#handletoactor) | {@link useGraffitiHandleToActor} | {@link GraffitiHandleToActor} |\n *\n * The plugin also exposes a global [Graffiti](https://api.graffiti.garden/classes/Graffiti.html) instance\n * and keeps track of the global [GraffitiSession](https://api.graffiti.garden/interfaces/GraffitiSession.html)\n * state as a reactive variable.\n * They are available in templates as global variables or in setup functions as\n * getter functions.\n *\n * | Global variabale | Getter |\n * | --- | --- |\n * | {@link ComponentCustomProperties.$graffiti | $graffiti } | {@link useGraffiti} |\n * | {@link ComponentCustomProperties.$graffitiSession | $graffitiSession } | {@link useGraffitiSession} |\n *\n * Finally, the plugin exposes an additional component, {@link GraffitiObjectInfo}\n * that can be use to generically display a Graffiti object for debugging purposes.\n * {@link GraffitiDiscover} and {@link GraffitiGet} show this output as\n * [fallback content](https://vuejs.org/guide/components/slots.html#fallback-content)\n * if no template is provided\n *\n * [See the README for installation instructions](/).\n *\n * You can [try out live examples](/examples/), but basic usage looks like this:\n *\n * ```ts\n * import { createApp } from \"vue\";\n * import { GraffitiPlugin } from \"@graffiti-garden/vue\";\n * import { GraffitiLocal } from \"@graffiti-garden/implementation-local\";\n * import App from \"./App.vue\";\n *\n * createApp(App)\n * .use(GraffitiPlugin, {\n * graffiti: new GraffitiLocal(),\n * })\n * ```\n *\n * ```vue\n * <!-- App.vue -->\n * <template>\n * <button\n * v-if=\"$graffitiSession.value\"\n * @click=\"$graffiti.post({\n * value: { content: 'Hello, world!' },\n * channels: [ 'my-channel' ]\n * }, $graffitiSession.value)\"\n * >\n * Say Hello\n * </button>\n * <button v-else @click=\"$graffiti.login()\">\n * Log In to Say Hello\n * </button>\n *\n * <GraffitiDiscover\n * v-slot=\"{ objects }\"\n * :channels=\"[ 'my-channel' ]\"\n * :schema=\"{\n * properties: {\n * value: {\n * required: ['content'],\n * properties: {\n * content: { type: 'string' }\n * }\n * }\n * }\n * }\"\n * >\n * <ul>\n * <li\n * v-for=\"object in objects\"\n * :key=\"object.url\"\n * >\n * {{ object.value.content }}\n * </li>\n * </ul>\n * </GraffitiDiscover>\n * </template>\n * ```\n */\nexport const GraffitiPlugin: Plugin<GraffitiPluginOptions> = {\n install(app: App, options: GraffitiPluginOptions) {\n const graffitiBase = options.graffiti;\n const graffiti = new GraffitiSynchronize(graffitiBase);\n\n const graffitiSession = ref<GraffitiSession | undefined | null>(undefined);\n graffiti.sessionEvents.addEventListener(\"initialized\", async (evt) => {\n const detail = (evt as GraffitiSessionInitializedEvent).detail;\n\n if (detail && detail.error) {\n console.error(detail.error);\n }\n\n if (detail && detail.href) {\n // If we're using Vue Router, redirect to the URL after login\n const router = app.config.globalProperties.$router as\n | Router\n | undefined;\n if (router) {\n const base = router.options.history.base;\n const url = new URL(detail.href);\n if (url.pathname.startsWith(base)) {\n url.pathname = url.pathname.slice(base.length);\n }\n await router.replace(url.pathname + url.search + url.hash);\n }\n }\n\n // Set the session to \"null\" if the user is not logged in\n if (!graffitiSession.value) {\n graffitiSession.value = null;\n }\n });\n graffiti.sessionEvents.addEventListener(\"login\", (evt) => {\n const detail = (evt as GraffitiLoginEvent).detail;\n if (detail.error) {\n console.error(\"Error logging in:\");\n console.error(detail.error);\n return;\n } else {\n graffitiSession.value = detail.session;\n }\n });\n graffiti.sessionEvents.addEventListener(\"logout\", (evt) => {\n const detail = (evt as GraffitiLogoutEvent).detail;\n if (detail.error) {\n console.error(\"Error logging out:\");\n console.error(detail.error);\n } else {\n graffitiSession.value = null;\n }\n });\n\n setGraffitiSynchronize(graffiti);\n setGraffitiSession(graffitiSession);\n\n app.component(\"GraffitiDiscover\", Discover);\n app.component(\"GraffitiGet\", Get);\n app.component(\"GraffitiGetMedia\", GetMedia);\n app.component(\"GraffitiActorToHandle\", ActorToHandle);\n app.component(\"GraffitiHandleToActor\", HandleToActor);\n app.component(\"GraffitiObjectInfo\", ObjectInfo);\n app.config.globalProperties.$graffiti = graffiti;\n app.config.globalProperties.$graffitiSession = graffitiSession;\n },\n};\n\nexport { useGraffitiActorToHandle } from \"./composables/actor-to-handle\";\nexport { useGraffitiHandleToActor } from \"./composables/handle-to-actor\";\nexport { useGraffitiDiscover } from \"./composables/discover\";\nexport { useGraffitiGet } from \"./composables/get\";\nexport { useGraffitiGetMedia } from \"./composables/get-media\";\nexport {\n useGraffiti,\n useGraffitiSynchronize,\n useGraffitiSession,\n} from \"./globals\";\n\n/**\n * The [Graffiti.discover](https://api.graffiti.garden/classes/Graffiti.html#discover)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and [slots props](https://vuejs.org/guide/components/slots.html#scoped-slots)\n * are identical to the arguments and return values of\n * the composable {@link useGraffitiDiscover}. If no template is provided to\n * the default slot, [fallback content](https://vuejs.org/guide/components/slots.html#fallback-content)\n * will display the objects using {@link GraffitiObjectInfo} for debugging.\n */\nexport const GraffitiDiscover = Discover;\n/**\n * The [Graffiti.get](https://api.graffiti.garden/classes/Graffiti.html#get)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and [slots props](https://vuejs.org/guide/components/slots.html#scoped-slots)\n * are identical to the arguments and return values of\n * the composable {@link useGraffitiGet}. If no template is provided to\n * the default slot, [fallback content](https://vuejs.org/guide/components/slots.html#fallback-content)\n * will display the object using {@link GraffitiObjectInfo} for debugging.\n */\nexport const GraffitiGet = Get;\n/**\n * The [Graffiti.getMedia](https://api.graffiti.garden/classes/Graffiti.html#getmedia)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and [slots props](https://vuejs.org/guide/components/slots.html#scoped-slots)\n * are identical to the arguments and return values of\n * the composable {@link useGraffitiGetMedia}. If no template is provided to\n * the default slot, [fallback content](https://vuejs.org/guide/components/slots.html#fallback-content)\n * will display the media in an appropriate container based on its media type.\n */\nexport const GraffitiGetMedia = GetMedia;\n/**\n * The [Graffiti.actorToHandle](https://api.graffiti.garden/classes/Graffiti.html#actortohandle)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and [slots props](https://vuejs.org/guide/components/slots.html#scoped-slots)\n * are identical to the arguments and return values of\n * the composable {@link useGraffitiActorToHandle}. If no template is provided to\n * the default slot, [fallback content](https://vuejs.org/guide/components/slots.html#fallback-content)\n * will display the actor's handle.\n */\nexport const GraffitiActorToHandle = ActorToHandle;\n/**\n * The [Graffiti.handleToActor](https://api.graffiti.garden/classes/Graffiti.html#handletoactor)\n * method as a reactive [renderless component](https://vuejs.org/guide/components/slots#renderless-components)\n * for use in Vue templates.\n *\n * Its props and [slots props](https://vuejs.org/guide/components/slots.html#scoped-slots)\n * are identical to the arguments and return values of\n * the composable {@link useGraffitiHandleToActor}. If no template is provided to\n * the default slot, [fallback content](https://vuejs.org/guide/components/slots.html#fallback-content)\n * will display the actor DID.\n */\nexport const GraffitiHandleToActor = HandleToActor;\n/**\n * Displays a Graffiti object and all of its properties for\n * debugging purposes.\n */\nexport const GraffitiObjectInfo = ObjectInfo;\n"],"names":["f","t","e","globals","setGraffitiSession","session","setGraffitiSynchronize","synchronize","useGraffitiSynchronize","graffiti","useGraffiti","useGraffitiSession","useGraffitiDiscover","channels","schema","autopoll","objectsRaw","objects","ref","poll_","poll","isFirstPoll","syncIterator","discoverIterator","onScopeDispose","refresh","restartWatch","timeout","watch","toValue","args","_prev","onInvalidate","mySyncIterator","myDiscoverIterator","active","batchFlattenPromise","result","resolve","polling","continueFn","GraffitiErrorNotFound","value","useResolveString","input","output","resolved","err","displayOutput","useGraffitiActorToHandle","actor","props","__props","toRef","handle","_renderSlot","_ctx","_unref","_createElementVNode","_toDisplayString","deleting","deleteObject","object","_createElementBlock","_cache","_createVNode","ActorToHandle","_hoisted_3","_hoisted_2","_openBlock","_Fragment","_renderList","_hoisted_4","channel","_hoisted_5","$graffitiSession","_hoisted_6","$event","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_1","ObjectInfo","useGraffitiGet","url","iterator","myIterator","useGraffitiGetMedia","accept","media","pollCounter","pollPromise","resolvePoll","data","allowed","dataUrl","downloadMedia","useGraffitiHandleToActor","GraffitiPlugin","app","options","graffitiBase","GraffitiSynchronize","graffitiSession","evt","detail","router","base","Discover","Get","GetMedia","HandleToActor","GraffitiDiscover","GraffitiGet","GraffitiGetMedia","GraffitiActorToHandle","GraffitiHandleToActor","GraffitiObjectInfo"],"mappings":"yJAAsU,IAA8HA,EAAE,MAAMC,UAAU,KAAK,CAAC,YAAYC,EAAE,CAAC,MAAMA,CAAC,EAAE,KAAK,KAAK,wBAAwB,OAAO,eAAe,KAAKD,EAAE,SAAS,CAAC,CAAC,ECI9jB,MAAME,EAGF,CAAA,EAEG,SAASC,EACdC,EACA,CACA,GAAI,CAACF,EAAQ,gBACXA,EAAQ,gBAAkBE,MAE1B,OAAM,IAAI,MACR,iEAAA,CAGN,CAEO,SAASC,EAAuBC,EAAkC,CACvE,GAAI,CAACJ,EAAQ,oBACXA,EAAQ,oBAAsBI,MAE9B,OAAM,IAAI,MACR,qEAAA,CAGN,CAOO,SAASC,GAAyB,CACvC,MAAMC,EAAWN,EAAQ,oBACzB,GAAI,CAACM,EACH,MAAM,IAAI,MACR,sEAAA,EAGJ,OAAOA,CACT,CAeO,SAASC,GAAwB,CACtC,OAAOF,EAAA,CACT,CAkBO,SAASG,GAAqB,CACnC,MAAMN,EAAUF,EAAQ,gBACxB,GAAI,CAACE,EACH,MAAM,IAAI,MACR,qEAAA,EAGJ,OAAOA,CACT,CC/CO,SAASO,EACdC,EACAC,EACAT,EAIAU,EAAsC,GACtC,CACA,MAAMN,EAAWD,EAAA,EAGXQ,MAAsD,IACtDC,EAAyCC,EAAAA,IAAI,EAAE,EACrD,IAAIC,EAAQ,SAAY,CAAC,EACzB,MAAMC,EAAO,SAAYD,EAAA,EACnBE,EAAcH,EAAAA,IAAI,EAAI,EAG5B,IAAII,EACAC,EACJC,EAAAA,eAAe,IAAM,CACnBF,GAAc,OAAO,IAAI,EACzBC,GAAkB,OAAO,CACvB,SAAU,I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