@coasys/ad4m 0.10.1-rc9-dev → 0.10.1-release-candidate-2

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 (61) hide show
  1. package/lib/index.cjs +3179 -811
  2. package/lib/index.js +3171 -807
  3. package/lib/src/Literal.js +4 -1
  4. package/lib/src/ai/AIClient.d.ts +1 -1
  5. package/lib/src/ai/AIClient.js +6 -6
  6. package/lib/src/ai/AIResolver.d.ts +1 -1
  7. package/lib/src/ai/AIResolver.js +7 -4
  8. package/lib/src/index.d.ts +4 -3
  9. package/lib/src/index.js +4 -3
  10. package/lib/src/model/Ad4mModel.d.ts +609 -0
  11. package/lib/src/model/Ad4mModel.js +1048 -0
  12. package/lib/src/{subject → model}/Subject.d.ts +2 -2
  13. package/lib/src/{subject → model}/Subject.js +18 -18
  14. package/lib/src/model/decorators.d.ts +502 -0
  15. package/lib/src/model/decorators.js +683 -0
  16. package/lib/src/neighbourhood/NeighbourhoodClient.d.ts +2 -2
  17. package/lib/src/neighbourhood/NeighbourhoodClient.js +16 -10
  18. package/lib/src/neighbourhood/NeighbourhoodProxy.d.ts +2 -2
  19. package/lib/src/neighbourhood/NeighbourhoodProxy.js +4 -4
  20. package/lib/src/neighbourhood/NeighbourhoodProxy.test.d.ts +1 -0
  21. package/lib/src/neighbourhood/NeighbourhoodProxy.test.js +31 -0
  22. package/lib/src/neighbourhood/NeighbourhoodResolver.d.ts +2 -2
  23. package/lib/src/neighbourhood/NeighbourhoodResolver.js +6 -4
  24. package/lib/src/perspectives/PerspectiveClient.d.ts +18 -11
  25. package/lib/src/perspectives/PerspectiveClient.js +116 -49
  26. package/lib/src/perspectives/PerspectiveProxy.d.ts +471 -54
  27. package/lib/src/perspectives/PerspectiveProxy.js +579 -64
  28. package/lib/src/perspectives/PerspectiveResolver.d.ts +23 -9
  29. package/lib/src/perspectives/PerspectiveResolver.js +140 -46
  30. package/lib/src/runtime/RuntimeClient.d.ts +5 -1
  31. package/lib/src/runtime/RuntimeClient.js +48 -0
  32. package/lib/src/runtime/RuntimeResolver.d.ts +24 -0
  33. package/lib/src/runtime/RuntimeResolver.js +117 -0
  34. package/lib/src/schema.gql +25 -11
  35. package/lib/src/typeDefs.js +25 -11
  36. package/package.json +2 -1
  37. package/src/Literal.ts +4 -1
  38. package/src/ai/AIClient.ts +6 -6
  39. package/src/ai/AIResolver.ts +6 -3
  40. package/src/index.ts +4 -3
  41. package/src/model/Ad4mModel.ts +1206 -0
  42. package/src/{subject → model}/Subject.ts +16 -16
  43. package/src/{subject/SDNADecorators.ts → model/decorators.ts} +384 -50
  44. package/src/neighbourhood/NeighbourhoodClient.ts +16 -10
  45. package/src/neighbourhood/NeighbourhoodProxy.test.ts +45 -0
  46. package/src/neighbourhood/NeighbourhoodProxy.ts +4 -4
  47. package/src/neighbourhood/NeighbourhoodResolver.ts +2 -2
  48. package/src/perspectives/PerspectiveClient.ts +122 -51
  49. package/src/perspectives/PerspectiveProxy.ts +642 -77
  50. package/src/perspectives/PerspectiveResolver.ts +126 -23
  51. package/src/runtime/RuntimeClient.ts +52 -1
  52. package/src/runtime/RuntimeResolver.ts +77 -0
  53. package/lib/src/subject/SDNADecorators.d.ts +0 -188
  54. package/lib/src/subject/SDNADecorators.js +0 -360
  55. package/lib/src/subject/SubjectEntity.d.ts +0 -110
  56. package/lib/src/subject/SubjectEntity.js +0 -288
  57. package/src/subject/SubjectEntity.ts +0 -336
  58. package/yarn-error.log +0 -90
  59. /package/lib/src/{subject → model}/util.d.ts +0 -0
  60. /package/lib/src/{subject → model}/util.js +0 -0
  61. /package/src/{subject → model}/util.ts +0 -0
@@ -313,7 +313,7 @@ type Mutation {
313
313
  aiAddTask(task: AITaskInput!): AITask!
314
314
  aiCloseTranscriptionStream(streamId: String!): String!
315
315
  aiEmbed(modelId: String!, text: String!): String!
316
- aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
316
+ aiFeedTranscriptionStream(audio: [Float!]!, streamIds: [String!]!): String!
317
317
  aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
318
318
  aiPrompt(prompt: String!, taskId: String!): String!
319
319
  aiRemoveModel(modelId: String!): Boolean!
@@ -330,32 +330,40 @@ type Mutation {
330
330
  languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
331
331
  neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
332
332
  neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
333
- neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
334
- neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
333
+ neighbourhoodSendBroadcast(loopback: Boolean, payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
334
+ neighbourhoodSendBroadcastU(loopback: Boolean, payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
335
335
  neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
336
336
  neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
337
337
  neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
338
338
  neighbourhoodSetOnlineStatusU(perspectiveUUID: String!, status: PerspectiveUnsignedInput!): Boolean!
339
339
  perspectiveAdd(name: String!): PerspectiveHandle!
340
- perspectiveAddLink(link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
341
- perspectiveAddLinkExpression(link: LinkExpressionInput!, status: String, uuid: String!): LinkExpression!
342
- perspectiveAddLinks(links: [LinkInput!]!, status: String, uuid: String!): [LinkExpression!]!
340
+ perspectiveAddLink(batchId: String, link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
341
+ perspectiveAddLinkExpression(batchId: String, link: LinkExpressionInput!, status: String = "shared", uuid: String!): LinkExpression!
342
+ perspectiveAddLinks(batchId: String, links: [LinkInput!]!, status: String = "shared", uuid: String!): [LinkExpression!]!
343
343
  perspectiveAddSdna(name: String!, sdnaCode: String!, sdnaType: String!, uuid: String!): Boolean!
344
- perspectiveCreateSubject(expressionAddress: String!, subjectClass: String!, uuid: String!): Boolean!
345
- perspectiveExecuteCommands(commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
344
+ perspectiveCommitBatch(batchId: String!, uuid: String!): LinkExpressionMutations!
345
+ perspectiveCreateBatch(uuid: String!): String!
346
+ perspectiveCreateSubject(batchId: String, expressionAddress: String!, initialValues: String, subjectClass: String!, uuid: String!): Boolean!
347
+ perspectiveExecuteCommands(batchId: String, commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
346
348
  perspectiveGetSubjectData(expressionAddress: String!, subjectClass: String!, uuid: String!): String!
349
+ perspectiveKeepAliveQuery(subscriptionId: String!, uuid: String!): Boolean!
347
350
  perspectiveLinkMutations(mutations: LinkMutations!, status: String, uuid: String!): LinkExpressionMutations!
348
351
  perspectivePublishSnapshot(uuid: String!): String
349
352
  perspectiveRemove(uuid: String!): Boolean!
350
- perspectiveRemoveLink(link: LinkExpressionInput!, uuid: String!): Boolean!
351
- perspectiveRemoveLinks(links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
353
+ perspectiveRemoveLink(batchId: String, link: LinkExpressionInput!, uuid: String!): Boolean!
354
+ perspectiveRemoveLinks(batchId: String, links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
355
+ perspectiveSubscribeQuery(query: String!, uuid: String!): QuerySubscription!
352
356
  perspectiveUpdate(name: String!, uuid: String!): PerspectiveHandle
353
- perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
357
+ perspectiveUpdateLink(batchId: String, newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
354
358
  runtimeAddFriends(dids: [String!]!): [String!]!
355
359
  runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
360
+ runtimeExportDb(filePath: String!): Boolean!
361
+ runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
356
362
  runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
357
363
  runtimeGrantNotification(id: String!): Boolean!
358
364
  runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
365
+ runtimeImportDb(filePath: String!): Boolean!
366
+ runtimeImportPerspective(filePath: String!): Boolean!
359
367
  runtimeOpenLink(url: String!): Boolean!
360
368
  runtimeQuit: Boolean!
361
369
  runtimeRemoveFriends(dids: [String!]!): [String!]!
@@ -473,6 +481,11 @@ type Query {
473
481
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
474
482
  }
475
483
 
484
+ type QuerySubscription {
485
+ result: String!
486
+ subscriptionId: String!
487
+ }
488
+
476
489
  type Resource {
477
490
  domain: String!
478
491
  pointers: [String!]!
@@ -505,6 +518,7 @@ type Subscription {
505
518
  perspectiveLinkAdded(uuid: String!): LinkExpression
506
519
  perspectiveLinkRemoved(uuid: String!): LinkExpression
507
520
  perspectiveLinkUpdated(uuid: String!): LinkExpressionUpdated
521
+ perspectiveQuerySubscription(subscriptionId: String!): String!
508
522
  perspectiveRemoved: String
509
523
  perspectiveSyncStateChange(uuid: String!): String!
510
524
  perspectiveUpdated: PerspectiveHandle
@@ -309,7 +309,7 @@ type Mutation {
309
309
  aiAddTask(task: AITaskInput!): AITask!
310
310
  aiCloseTranscriptionStream(streamId: String!): String!
311
311
  aiEmbed(modelId: String!, text: String!): String!
312
- aiFeedTranscriptionStream(audio: [Float!]!, streamId: String!): String!
312
+ aiFeedTranscriptionStream(audio: [Float!]!, streamIds: [String!]!): String!
313
313
  aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
314
314
  aiPrompt(prompt: String!, taskId: String!): String!
315
315
  aiRemoveModel(modelId: String!): Boolean!
@@ -326,32 +326,40 @@ type Mutation {
326
326
  languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
327
327
  neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
328
328
  neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
329
- neighbourhoodSendBroadcast(payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
330
- neighbourhoodSendBroadcastU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
329
+ neighbourhoodSendBroadcast(loopback: Boolean, payload: PerspectiveInput!, perspectiveUUID: String!): Boolean!
330
+ neighbourhoodSendBroadcastU(loopback: Boolean, payload: PerspectiveUnsignedInput!, perspectiveUUID: String!): Boolean!
331
331
  neighbourhoodSendSignal(payload: PerspectiveInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
332
332
  neighbourhoodSendSignalU(payload: PerspectiveUnsignedInput!, perspectiveUUID: String!, remoteAgentDid: String!): Boolean!
333
333
  neighbourhoodSetOnlineStatus(perspectiveUUID: String!, status: PerspectiveInput!): Boolean!
334
334
  neighbourhoodSetOnlineStatusU(perspectiveUUID: String!, status: PerspectiveUnsignedInput!): Boolean!
335
335
  perspectiveAdd(name: String!): PerspectiveHandle!
336
- perspectiveAddLink(link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
337
- perspectiveAddLinkExpression(link: LinkExpressionInput!, status: String, uuid: String!): LinkExpression!
338
- perspectiveAddLinks(links: [LinkInput!]!, status: String, uuid: String!): [LinkExpression!]!
336
+ perspectiveAddLink(batchId: String, link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
337
+ perspectiveAddLinkExpression(batchId: String, link: LinkExpressionInput!, status: String = "shared", uuid: String!): LinkExpression!
338
+ perspectiveAddLinks(batchId: String, links: [LinkInput!]!, status: String = "shared", uuid: String!): [LinkExpression!]!
339
339
  perspectiveAddSdna(name: String!, sdnaCode: String!, sdnaType: String!, uuid: String!): Boolean!
340
- perspectiveCreateSubject(expressionAddress: String!, subjectClass: String!, uuid: String!): Boolean!
341
- perspectiveExecuteCommands(commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
340
+ perspectiveCommitBatch(batchId: String!, uuid: String!): LinkExpressionMutations!
341
+ perspectiveCreateBatch(uuid: String!): String!
342
+ perspectiveCreateSubject(batchId: String, expressionAddress: String!, initialValues: String, subjectClass: String!, uuid: String!): Boolean!
343
+ perspectiveExecuteCommands(batchId: String, commands: String!, expression: String!, parameters: String, uuid: String!): Boolean!
342
344
  perspectiveGetSubjectData(expressionAddress: String!, subjectClass: String!, uuid: String!): String!
345
+ perspectiveKeepAliveQuery(subscriptionId: String!, uuid: String!): Boolean!
343
346
  perspectiveLinkMutations(mutations: LinkMutations!, status: String, uuid: String!): LinkExpressionMutations!
344
347
  perspectivePublishSnapshot(uuid: String!): String
345
348
  perspectiveRemove(uuid: String!): Boolean!
346
- perspectiveRemoveLink(link: LinkExpressionInput!, uuid: String!): Boolean!
347
- perspectiveRemoveLinks(links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
349
+ perspectiveRemoveLink(batchId: String, link: LinkExpressionInput!, uuid: String!): Boolean!
350
+ perspectiveRemoveLinks(batchId: String, links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
351
+ perspectiveSubscribeQuery(query: String!, uuid: String!): QuerySubscription!
348
352
  perspectiveUpdate(name: String!, uuid: String!): PerspectiveHandle
349
- perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
353
+ perspectiveUpdateLink(batchId: String, newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
350
354
  runtimeAddFriends(dids: [String!]!): [String!]!
351
355
  runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
356
+ runtimeExportDb(filePath: String!): Boolean!
357
+ runtimeExportPerspective(filePath: String!, perspectiveUuid: String!): Boolean!
352
358
  runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
353
359
  runtimeGrantNotification(id: String!): Boolean!
354
360
  runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
361
+ runtimeImportDb(filePath: String!): Boolean!
362
+ runtimeImportPerspective(filePath: String!): Boolean!
355
363
  runtimeOpenLink(url: String!): Boolean!
356
364
  runtimeQuit: Boolean!
357
365
  runtimeRemoveFriends(dids: [String!]!): [String!]!
@@ -469,6 +477,11 @@ type Query {
469
477
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
470
478
  }
471
479
 
480
+ type QuerySubscription {
481
+ result: String!
482
+ subscriptionId: String!
483
+ }
484
+
472
485
  type Resource {
473
486
  domain: String!
474
487
  pointers: [String!]!
@@ -501,6 +514,7 @@ type Subscription {
501
514
  perspectiveLinkAdded(uuid: String!): LinkExpression
502
515
  perspectiveLinkRemoved(uuid: String!): LinkExpression
503
516
  perspectiveLinkUpdated(uuid: String!): LinkExpressionUpdated
517
+ perspectiveQuerySubscription(subscriptionId: String!): String!
504
518
  perspectiveRemoved: String
505
519
  perspectiveSyncStateChange(uuid: String!): String!
506
520
  perspectiveUpdated: PerspectiveHandle
package/package.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "module": "lib/index.js",
6
6
  "types": "lib/src/index.d.ts",
7
7
  "type": "module",
8
+ "private": false,
8
9
  "scripts": {
9
10
  "build": "patch-package && tsc && pnpm run buildSchema && pnpm run bundle",
10
11
  "buildSchema": "node --es-module-specifier-resolution=node lib/src/buildSchema.js",
@@ -68,5 +69,5 @@
68
69
  "graphql@15.7.2": "patches/graphql@15.7.2.patch"
69
70
  }
70
71
  },
71
- "version": "0.10.1-rc9-dev"
72
+ "version": "0.10.1-release-candidate-2"
72
73
  }
package/src/Literal.ts CHANGED
@@ -27,7 +27,7 @@ export class Literal {
27
27
  toUrl(): string {
28
28
  if(this.#url && !this.#literal)
29
29
  return this.#url
30
- if(!this.#url && !this.#literal)
30
+ if(!this.#url && (this.#literal === undefined || this.#literal === "" || this.#literal === null))
31
31
  throw new Error("Can't turn empty Literal into URL")
32
32
 
33
33
  let encoded
@@ -38,6 +38,9 @@ export class Literal {
38
38
  case 'number':
39
39
  encoded = `number:${encodeRFC3986URIComponent(this.#literal)}`
40
40
  break;
41
+ case 'boolean':
42
+ encoded = `boolean:${encodeRFC3986URIComponent(this.#literal)}`
43
+ break;
41
44
  case 'object':
42
45
  encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(this.#literal))}`
43
46
  break;
@@ -357,19 +357,19 @@ export class AIClient {
357
357
  return aiCloseTranscriptionStream;
358
358
  }
359
359
 
360
- async feedTranscriptionStream(streamId: string, audio: Float32Array): Promise<void> {
361
- const { feedTranscriptionStream } = unwrapApolloResult(await this.#apolloClient.mutate({
360
+ async feedTranscriptionStream(streamIds: string | string[], audio: Float32Array): Promise<void> {
361
+ const { aiFeedTranscriptionStream } = unwrapApolloResult(await this.#apolloClient.mutate({
362
362
  mutation: gql`
363
- mutation AiFeedTranscriptionStream($streamId: String!, $audio: [Float!]!) {
364
- aiFeedTranscriptionStream(streamId: $streamId, audio: $audio)
363
+ mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
364
+ aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
365
365
  }
366
366
  `,
367
367
  variables: {
368
- streamId,
368
+ streamIds: Array.isArray(streamIds) ? streamIds : [streamIds],
369
369
  audio: audio
370
370
  }
371
371
  }));
372
372
 
373
- return feedTranscriptionStream;
373
+ return aiFeedTranscriptionStream;
374
374
  }
375
375
  }
@@ -352,12 +352,15 @@ export default class AIResolver {
352
352
 
353
353
  @Mutation(() => String)
354
354
  aiFeedTranscriptionStream(
355
- @Arg("streamId") streamId: string,
355
+ @Arg("streamIds", type => [String]) streamIds: string[],
356
356
  @Arg("audio", () => [Float]) audio: number[],
357
357
  @PubSub() pubSub: any
358
358
  ): boolean {
359
- pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
360
- return true
359
+ // Publish for each stream ID
360
+ for (const streamId of streamIds) {
361
+ pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
362
+ }
363
+ return true;
361
364
  }
362
365
 
363
366
  @Subscription({ topics: AI_TRANSCRIPTION_TEXT_TOPIC, nullable: false })
package/src/index.ts CHANGED
@@ -19,14 +19,15 @@ export * from "./perspectives/PerspectiveProxy";
19
19
  export * from "./perspectives/PerspectiveDiff";
20
20
  export * from "./perspectives/LinkQuery";
21
21
  export * from "./SmartLiteral";
22
- export * from "./subject/SDNADecorators";
23
- export * from "./subject/Subject";
22
+ export * from "./model/decorators";
23
+ export * from "./model/Subject";
24
24
  export * from "./neighbourhood/Neighbourhood";
25
25
  export * from "./neighbourhood/NeighbourhoodProxy";
26
26
  export * from "./typeDefs";
27
27
  export * from "./DID";
28
28
  export * from "./utils";
29
- export * from './subject/SubjectEntity'
30
29
  export * from "./agent/AgentClient";
31
30
  export * from "./ai/AIClient"
32
31
  export * from "./ai/Tasks"
32
+ export * from "./runtime/RuntimeResolver"
33
+ export * from './model/Ad4mModel'