@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
@@ -34,7 +34,7 @@ export class Literal {
34
34
  toUrl() {
35
35
  if (__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
36
36
  return __classPrivateFieldGet(this, _Literal_url, "f");
37
- if (!__classPrivateFieldGet(this, _Literal_url, "f") && !__classPrivateFieldGet(this, _Literal_literal, "f"))
37
+ if (!__classPrivateFieldGet(this, _Literal_url, "f") && (__classPrivateFieldGet(this, _Literal_literal, "f") === undefined || __classPrivateFieldGet(this, _Literal_literal, "f") === "" || __classPrivateFieldGet(this, _Literal_literal, "f") === null))
38
38
  throw new Error("Can't turn empty Literal into URL");
39
39
  let encoded;
40
40
  switch (typeof __classPrivateFieldGet(this, _Literal_literal, "f")) {
@@ -44,6 +44,9 @@ export class Literal {
44
44
  case 'number':
45
45
  encoded = `number:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
46
46
  break;
47
+ case 'boolean':
48
+ encoded = `boolean:${encodeRFC3986URIComponent(__classPrivateFieldGet(this, _Literal_literal, "f"))}`;
49
+ break;
47
50
  case 'object':
48
51
  encoded = `json:${encodeRFC3986URIComponent(JSON.stringify(__classPrivateFieldGet(this, _Literal_literal, "f")))}`;
49
52
  break;
@@ -28,5 +28,5 @@ export declare class AIClient {
28
28
  timeBeforeSpeech?: number;
29
29
  }): Promise<string>;
30
30
  closeTranscriptionStream(streamId: string): Promise<void>;
31
- feedTranscriptionStream(streamId: string, audio: Float32Array): Promise<void>;
31
+ feedTranscriptionStream(streamIds: string | string[], audio: Float32Array): Promise<void>;
32
32
  }
@@ -324,19 +324,19 @@ export class AIClient {
324
324
  }
325
325
  return aiCloseTranscriptionStream;
326
326
  }
327
- async feedTranscriptionStream(streamId, audio) {
328
- const { feedTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
327
+ async feedTranscriptionStream(streamIds, audio) {
328
+ const { aiFeedTranscriptionStream } = unwrapApolloResult(await __classPrivateFieldGet(this, _AIClient_apolloClient, "f").mutate({
329
329
  mutation: gql `
330
- mutation AiFeedTranscriptionStream($streamId: String!, $audio: [Float!]!) {
331
- aiFeedTranscriptionStream(streamId: $streamId, audio: $audio)
330
+ mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
331
+ aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
332
332
  }
333
333
  `,
334
334
  variables: {
335
- streamId,
335
+ streamIds: Array.isArray(streamIds) ? streamIds : [streamIds],
336
336
  audio: audio
337
337
  }
338
338
  }));
339
- return feedTranscriptionStream;
339
+ return aiFeedTranscriptionStream;
340
340
  }
341
341
  }
342
342
  _AIClient_apolloClient = new WeakMap(), _AIClient_transcriptionSubscriptions = new WeakMap();
@@ -70,6 +70,6 @@ export default class AIResolver {
70
70
  aiEmbed(modelId: string, text: string): string;
71
71
  aiOpenTranscriptionStream(modelId: string, params?: VoiceActivityParamsInput): string;
72
72
  aiCloseTranscriptionStream(streamId: string): boolean;
73
- aiFeedTranscriptionStream(streamId: string, audio: number[], pubSub: any): boolean;
73
+ aiFeedTranscriptionStream(streamIds: string[], audio: number[], pubSub: any): boolean;
74
74
  aiTranscriptionText(streamId: string): string;
75
75
  }
@@ -313,8 +313,11 @@ let AIResolver = class AIResolver {
313
313
  aiCloseTranscriptionStream(streamId) {
314
314
  return true;
315
315
  }
316
- aiFeedTranscriptionStream(streamId, audio, pubSub) {
317
- pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
316
+ aiFeedTranscriptionStream(streamIds, audio, pubSub) {
317
+ // Publish for each stream ID
318
+ for (const streamId of streamIds) {
319
+ pubSub.publish(AI_TRANSCRIPTION_TEXT_TOPIC, { streamId });
320
+ }
318
321
  return true;
319
322
  }
320
323
  aiTranscriptionText(streamId) {
@@ -432,11 +435,11 @@ __decorate([
432
435
  ], AIResolver.prototype, "aiCloseTranscriptionStream", null);
433
436
  __decorate([
434
437
  Mutation(() => String),
435
- __param(0, Arg("streamId")),
438
+ __param(0, Arg("streamIds", type => [String])),
436
439
  __param(1, Arg("audio", () => [Float])),
437
440
  __param(2, PubSub()),
438
441
  __metadata("design:type", Function),
439
- __metadata("design:paramtypes", [String, Array, Object]),
442
+ __metadata("design:paramtypes", [Array, Array, Object]),
440
443
  __metadata("design:returntype", Boolean)
441
444
  ], AIResolver.prototype, "aiFeedTranscriptionStream", null);
442
445
  __decorate([
@@ -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';
package/lib/src/index.js 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';