@powerhousedao/reactor-api 1.10.2 → 1.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
- ## 1.10.2 (2024-12-11)
1
+ ## 1.10.3 (2024-12-12)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **document-model:** export generateId method ([71d945b2](https://github.com/powerhouse-inc/powerhouse/commit/71d945b2))
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - **reactor-api:** import AnalyticsPath from reactor-api ([90bb1a4d](https://github.com/powerhouse-inc/powerhouse/commit/90bb1a4d))
2
10
 
3
11
  ### 🧱 Updated Dependencies
4
12
 
5
- - Updated document-model-libs to 1.121.2
6
- - Updated document-drive to 1.10.1
7
- - Updated document-model to 2.12.0
13
+ - Updated document-model-libs to 1.122.0
14
+ - Updated document-drive to 1.11.0
15
+ - Updated document-model to 2.13.0
16
+
17
+ ### ❤️ Thank You
18
+
19
+ - acaldas @acaldas
8
20
 
9
21
  ## 1.2.0 (2024-10-29)
10
22
 
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import express, { Express } from 'express';
6
6
  import { Pool } from 'pg';
7
7
  import { IncomingHttpHeaders } from 'http';
8
8
  import { IAnalyticsStore } from '@powerhousedao/analytics-engine-core';
9
+ export * from '@powerhousedao/analytics-engine-core';
9
10
  import * as graphql from 'graphql';
10
11
  import { GraphQLResolverMap } from '@apollo/subgraph/dist/schema-helper';
11
12
 
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as analytics_engine_core_star from '@powerhousedao/analytics-engine-core';
1
2
  import { AnalyticsQueryEngine, AnalyticsPath, AnalyticsGranularity } from '@powerhousedao/analytics-engine-core';
2
3
  import { KnexAnalyticsStore, KnexQueryExecutor } from '@powerhousedao/analytics-engine-knex';
3
4
  import express2, { Router } from 'express';
@@ -7,13 +8,12 @@ import { ApolloServerPluginInlineTraceDisabled } from '@apollo/server/plugin/dis
7
8
  import bodyParser from 'body-parser';
8
9
  import cors from 'cors';
9
10
  import { actions } from 'document-model-libs/document-drive';
10
- import crypto$1 from 'crypto';
11
- import fs from 'fs';
12
- import https from 'https';
13
- import { join } from 'path';
11
+ import crypto from 'node:crypto';
12
+ import fs from 'node:fs';
13
+ import https from 'node:https';
14
+ import { join } from 'node:path';
14
15
  import 'graphql-request';
15
16
  import 'nanoevents';
16
- import { v4 as v4$1 } from 'uuid';
17
17
  import { parse as parse$1 } from 'graphql';
18
18
  import { buildSubgraphSchema } from '@apollo/subgraph';
19
19
  import pkg from 'knex';
@@ -46,6 +46,7 @@ var __copyProps = (to, from, except, desc) => {
46
46
  }
47
47
  return to;
48
48
  };
49
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
49
50
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
50
51
  // If the importer is in node compatibility mode or this is not an ESM
51
52
  // file that has been converted to a CommonJS file using a Babel-
@@ -9821,6 +9822,19 @@ var require_lib4 = __commonJS({
9821
9822
  }
9822
9823
  });
9823
9824
 
9825
+ // src/index.ts
9826
+ var src_exports = {};
9827
+ __export(src_exports, {
9828
+ AnalyticsProcessor: () => AnalyticsProcessor,
9829
+ BaseProcessor: () => BaseProcessor,
9830
+ Processor: () => Processor,
9831
+ ReactorRouterManager: () => ReactorRouterManager,
9832
+ createSchema: () => createSchema2,
9833
+ getDocumentModelTypeDefs: () => getDocumentModelTypeDefs,
9834
+ isProcessorClass: () => isProcessorClass,
9835
+ startAPI: () => startAPI
9836
+ });
9837
+
9824
9838
  // ../../node_modules/.pnpm/@powerhousedao+analytics-engine-graphql@0.2.0/node_modules/@powerhousedao/analytics-engine-graphql/dist/AnalyticsResolvers.js
9825
9839
  var AnalyticsResolvers = {
9826
9840
  Query: {
@@ -16721,7 +16735,7 @@ type Sync {
16721
16735
  }
16722
16736
  `;
16723
16737
 
16724
- // ../document-model/dist/node/es/internal/creators-Cb-W0me8.js
16738
+ // ../document-model/dist/node/es/internal/creators-B6tCK8Ir.js
16725
16739
  var import_jszip = __toESM(require_lib3());
16726
16740
 
16727
16741
  // ../../node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs
@@ -22592,37 +22606,8 @@ ${originalIndentation}`;
22592
22606
  var safeStableStringifyExports = requireSafeStableStringify();
22593
22607
  var cjsModule = /* @__PURE__ */ getDefaultExportFromCjs(safeStableStringifyExports);
22594
22608
  cjsModule.configure;
22595
- var getRandomValues;
22596
- var rnds8 = new Uint8Array(16);
22597
- function rng() {
22598
- if (!getRandomValues) {
22599
- getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
22600
- if (!getRandomValues) {
22601
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
22602
- }
22603
- }
22604
- return getRandomValues(rnds8);
22605
- }
22606
- var byteToHex = [];
22607
- for (let i = 0; i < 256; ++i) {
22608
- byteToHex.push((i + 256).toString(16).slice(1));
22609
- }
22610
- function unsafeStringify(arr, offset2 = 0) {
22611
- return byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]];
22612
- }
22613
- var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
22614
- var native = {
22615
- randomUUID
22616
- };
22617
- function v4(options, buf, offset2) {
22618
- if (native.randomUUID && !buf && !options) {
22619
- return native.randomUUID();
22620
- }
22621
- options = options || {};
22622
- const rnds = options.random || (options.rng || rng)();
22623
- rnds[6] = rnds[6] & 15 | 64;
22624
- rnds[8] = rnds[8] & 63 | 128;
22625
- return unsafeStringify(rnds);
22609
+ function generateUUID(options) {
22610
+ return crypto.randomUUID(options);
22626
22611
  }
22627
22612
  function writeFile(path, name, data) {
22628
22613
  const filePath = join(path, name);
@@ -22664,8 +22649,16 @@ var getFile = async (file) => {
22664
22649
  return readFile(file);
22665
22650
  };
22666
22651
  var hash = (data, algorithm = "sha1") => {
22667
- return crypto$1.createHash(algorithm).update(data).digest("base64");
22652
+ return crypto.createHash(algorithm).update(data).digest("base64");
22668
22653
  };
22654
+ function generateId(method) {
22655
+ if (method && method.toString() !== "UUIDv4") {
22656
+ throw new Error(
22657
+ `Id generation method not supported: "${method.toString()}"`
22658
+ );
22659
+ }
22660
+ return generateUUID();
22661
+ }
22669
22662
  function getUnixTimestamp(date) {
22670
22663
  return (new Date(date).getTime() / 1e3).toFixed(0);
22671
22664
  }
@@ -23537,7 +23530,7 @@ function updateOperations(document, action, skip = 0, reuseLastOperationIndex =
23537
23530
  operationId = action.id;
23538
23531
  timestamp = action.timestamp;
23539
23532
  } else {
23540
- operationId = "id" in action ? action.id : v4();
23533
+ operationId = "id" in action ? action.id : generateId();
23541
23534
  }
23542
23535
  operations.push({
23543
23536
  ...action,
@@ -24108,7 +24101,7 @@ var loadState = (state, operations) => createAction(
24108
24101
  );
24109
24102
  var noop = (scope = "global") => createAction("NOOP", {}, void 0, void 0, scope);
24110
24103
 
24111
- // ../document-model/dist/node/es/internal/index-DaOQbHFb.js
24104
+ // ../document-model/dist/node/es/internal/index-CJxdcyKO.js
24112
24105
  var index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
24113
24106
  __proto__: null,
24114
24107
  InvalidActionInputError,
@@ -24125,6 +24118,7 @@ var index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
24125
24118
  createUnsafeReducer,
24126
24119
  createZip,
24127
24120
  documentHelpers,
24121
+ generateId,
24128
24122
  getDocumentLastModified,
24129
24123
  getLocalFile,
24130
24124
  getRemoteFile,
@@ -24283,8 +24277,8 @@ var RunAsap;
24283
24277
  // ../document-drive/src/utils/index.ts
24284
24278
  RunAsap.runAsap;
24285
24279
  RunAsap.runAsapAsync;
24286
- function generateUUID() {
24287
- return v4$1();
24280
+ function generateUUID2() {
24281
+ return generateId();
24288
24282
  }
24289
24283
 
24290
24284
  // ../document-drive/src/utils/document-helpers.ts
@@ -24342,7 +24336,7 @@ var resolvers2 = {
24342
24336
  Mutation: {
24343
24337
  registerPullResponderListener: async (_, { filter }, ctx) => {
24344
24338
  if (!ctx.driveId) throw new Error("Drive ID is required");
24345
- const uuid = generateUUID();
24339
+ const uuid = generateUUID2();
24346
24340
  const listener = {
24347
24341
  block: false,
24348
24342
  callInfo: {
@@ -29200,6 +29194,21 @@ function getKnexClient(connectionString) {
29200
29194
  });
29201
29195
  }
29202
29196
 
29197
+ // src/processors/index.ts
29198
+ var processors_exports = {};
29199
+ __export(processors_exports, {
29200
+ AnalyticsProcessor: () => AnalyticsProcessor,
29201
+ BaseProcessor: () => BaseProcessor,
29202
+ Processor: () => Processor,
29203
+ isProcessorClass: () => isProcessorClass
29204
+ });
29205
+
29206
+ // src/processors/analytics-processor.ts
29207
+ var analytics_processor_exports = {};
29208
+ __export(analytics_processor_exports, {
29209
+ AnalyticsProcessor: () => AnalyticsProcessor
29210
+ });
29211
+
29203
29212
  // src/processors/processor.ts
29204
29213
  var Processor = class {
29205
29214
  reactor;
@@ -29246,6 +29255,7 @@ function isProcessorClass(candidate) {
29246
29255
  }
29247
29256
 
29248
29257
  // src/processors/analytics-processor.ts
29258
+ __reExport(analytics_processor_exports, analytics_engine_core_star);
29249
29259
  var AnalyticsProcessor = class extends Processor {
29250
29260
  analyticsStore;
29251
29261
  constructor(args, options) {
@@ -29258,6 +29268,9 @@ var AnalyticsProcessor = class extends Processor {
29258
29268
  }
29259
29269
  };
29260
29270
 
29271
+ // src/processors/index.ts
29272
+ __reExport(processors_exports, analytics_processor_exports);
29273
+
29261
29274
  // src/processor-manager.ts
29262
29275
  var ProcessorManager = class {
29263
29276
  constructor(driveServer, analyticsStore) {
@@ -29337,6 +29350,9 @@ async function startAPI(reactor, options) {
29337
29350
  return { app, reactorRouterManager, processorManager };
29338
29351
  }
29339
29352
 
29353
+ // src/index.ts
29354
+ __reExport(src_exports, processors_exports);
29355
+
29340
29356
  export { AnalyticsProcessor, BaseProcessor, Processor, ReactorRouterManager, createSchema2 as createSchema, getDocumentModelTypeDefs, isProcessorClass, startAPI };
29341
29357
  //# sourceMappingURL=index.js.map
29342
29358
  //# sourceMappingURL=index.js.map