@cumulus/db 21.3.1 → 21.3.2-testlerna.0

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 (59) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.js +3 -3
  3. package/dist/lib/granule.d.ts +4 -33
  4. package/dist/lib/granule.js +10 -61
  5. package/dist/models/granule.js +2 -2
  6. package/dist/s3search/AsyncOperationS3Search.d.ts +20 -0
  7. package/dist/s3search/AsyncOperationS3Search.js +29 -0
  8. package/dist/s3search/CollectionS3Search.d.ts +39 -0
  9. package/dist/s3search/CollectionS3Search.js +113 -0
  10. package/dist/s3search/DuckDBSearchExecutor.d.ts +36 -0
  11. package/dist/s3search/DuckDBSearchExecutor.js +57 -0
  12. package/dist/s3search/ExecutionS3Search.d.ts +20 -0
  13. package/dist/s3search/ExecutionS3Search.js +29 -0
  14. package/dist/s3search/GranuleS3Search.d.ts +31 -0
  15. package/dist/s3search/GranuleS3Search.js +100 -0
  16. package/dist/s3search/PdrS3Search.d.ts +20 -0
  17. package/dist/s3search/PdrS3Search.js +29 -0
  18. package/dist/s3search/ProviderS3Search.d.ts +20 -0
  19. package/dist/s3search/ProviderS3Search.js +29 -0
  20. package/dist/s3search/ReconciliationReportS3Search.d.ts +20 -0
  21. package/dist/s3search/ReconciliationReportS3Search.js +29 -0
  22. package/dist/s3search/RuleS3Search.d.ts +20 -0
  23. package/dist/s3search/RuleS3Search.js +29 -0
  24. package/dist/s3search/StatsS3Search.d.ts +25 -0
  25. package/dist/s3search/StatsS3Search.js +51 -0
  26. package/dist/s3search/duckdbHelpers.d.ts +43 -0
  27. package/dist/s3search/duckdbHelpers.js +83 -0
  28. package/dist/s3search/s3TableSchemas.d.ts +11 -0
  29. package/dist/s3search/s3TableSchemas.js +272 -0
  30. package/dist/search/BaseSearch.d.ts +46 -2
  31. package/dist/search/BaseSearch.js +84 -22
  32. package/dist/search/CollectionSearch.d.ts +6 -4
  33. package/dist/search/CollectionSearch.js +2 -3
  34. package/dist/search/ExecutionSearch.d.ts +1 -1
  35. package/dist/search/ExecutionSearch.js +3 -3
  36. package/dist/search/GranuleSearch.d.ts +2 -3
  37. package/dist/search/GranuleSearch.js +3 -3
  38. package/dist/search/PdrSearch.js +1 -1
  39. package/dist/search/ReconciliationReportSearch.js +1 -1
  40. package/dist/search/RuleSearch.js +4 -4
  41. package/dist/search/StatsSearch.d.ts +15 -4
  42. package/dist/search/StatsSearch.js +12 -6
  43. package/dist/search/field-mapping.d.ts +1 -3
  44. package/dist/search/field-mapping.js +40 -19
  45. package/dist/test-duckdb-utils.d.ts +31 -0
  46. package/dist/test-duckdb-utils.js +125 -0
  47. package/dist/test-utils.js +6 -0
  48. package/dist/translate/async_operations.js +7 -3
  49. package/dist/translate/collections.js +6 -6
  50. package/dist/translate/executions.js +7 -7
  51. package/dist/translate/granules.js +16 -11
  52. package/dist/translate/pdr.js +4 -4
  53. package/dist/translate/providers.js +2 -2
  54. package/dist/translate/reconciliation_reports.js +5 -4
  55. package/dist/translate/rules.d.ts +1 -1
  56. package/dist/translate/rules.js +6 -6
  57. package/dist/types/file.d.ts +2 -0
  58. package/dist/types/granule.d.ts +1 -1
  59. package/package.json +12 -11
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.translatePostgresReconReportToApiReconReport = exports.translateApiReconReportToPostgresReconReport = void 0;
4
- const { removeNilProperties } = require('@cumulus/common/util');
4
+ const { parseIfJson, removeNilProperties, returnNullOrUndefinedOrDate } = require('@cumulus/common/util');
5
5
  const pick = require('lodash/pick');
6
6
  /**
7
7
  * Generate a PostgreSQL Reconciliation Report from an API record.
@@ -26,9 +26,10 @@ exports.translateApiReconReportToPostgresReconReport = translateApiReconReportTo
26
26
  */
27
27
  const translatePostgresReconReportToApiReconReport = (pgReconciliationReport) => {
28
28
  const apiReconciliationReport = removeNilProperties({
29
- ...pick(pgReconciliationReport, ['name', 'type', 'status', 'location', 'error']),
30
- createdAt: pgReconciliationReport.created_at?.getTime(),
31
- updatedAt: pgReconciliationReport.updated_at?.getTime(),
29
+ ...pick(pgReconciliationReport, ['name', 'type', 'status', 'location']),
30
+ error: parseIfJson(pgReconciliationReport.error),
31
+ createdAt: returnNullOrUndefinedOrDate(pgReconciliationReport.created_at)?.getTime(),
32
+ updatedAt: returnNullOrUndefinedOrDate(pgReconciliationReport.updated_at)?.getTime(),
32
33
  });
33
34
  return apiReconciliationReport;
34
35
  };
@@ -5,7 +5,7 @@ import { ProviderPgModel } from '../models/provider';
5
5
  import { PostgresRule, PostgresRuleRecord } from '../types/rule';
6
6
  import { PostgresProviderRecord } from '../types/provider';
7
7
  import { PostgresCollectionRecord } from '../types/collection';
8
- export declare const translatePostgresRuleToApiRuleWithoutDbQuery: (pgRule: PostgresRuleRecord, collectionPgRecord?: Pick<PostgresCollectionRecord, 'name' | 'version'>, providerPgRecord?: Partial<PostgresProviderRecord>) => Promise<RuleRecord>;
8
+ export declare const translatePostgresRuleToApiRuleWithoutDbQuery: (pgRule: PostgresRuleRecord, collectionPgRecord?: Pick<PostgresCollectionRecord, 'name' | 'version'>, providerPgRecord?: Partial<PostgresProviderRecord>) => RuleRecord;
9
9
  export declare const translatePostgresRuleToApiRule: (pgRule: PostgresRuleRecord, knex: Knex | Knex.Transaction, collectionPgModel?: CollectionPgModel, providerPgModel?: ProviderPgModel) => Promise<RuleRecord>;
10
10
  /**
11
11
  * Generate a Postgres rule record from a DynamoDB record.
@@ -4,7 +4,7 @@ exports.translateApiRuleToPostgresRule = exports.translateApiRuleToPostgresRuleR
4
4
  const util_1 = require("@cumulus/common/util");
5
5
  const collection_1 = require("../models/collection");
6
6
  const provider_1 = require("../models/provider");
7
- const translatePostgresRuleToApiRuleWithoutDbQuery = async (pgRule, collectionPgRecord, providerPgRecord) => {
7
+ const translatePostgresRuleToApiRuleWithoutDbQuery = (pgRule, collectionPgRecord, providerPgRecord) => {
8
8
  const apiRule = {
9
9
  name: pgRule.name,
10
10
  workflow: pgRule.workflow,
@@ -20,13 +20,13 @@ const translatePostgresRuleToApiRuleWithoutDbQuery = async (pgRule, collectionPg
20
20
  value: pgRule.value,
21
21
  }),
22
22
  state: pgRule.enabled ? 'ENABLED' : 'DISABLED',
23
- meta: pgRule.meta,
24
- payload: pgRule.payload,
23
+ meta: (0, util_1.parseIfJson)(pgRule.meta),
24
+ payload: (0, util_1.parseIfJson)(pgRule.payload),
25
25
  executionNamePrefix: pgRule.execution_name_prefix,
26
26
  queueUrl: pgRule.queue_url,
27
- tags: pgRule.tags,
28
- createdAt: pgRule.created_at.getTime(),
29
- updatedAt: pgRule.updated_at.getTime(),
27
+ tags: (0, util_1.parseIfJson)(pgRule.tags),
28
+ createdAt: new Date(pgRule.created_at).getTime(),
29
+ updatedAt: new Date(pgRule.updated_at).getTime(),
30
30
  };
31
31
  return (0, util_1.removeNilProperties)(apiRule);
32
32
  };
@@ -4,11 +4,13 @@ export interface PostgresFile {
4
4
  granule_cumulus_id: number;
5
5
  checksum_type?: string;
6
6
  checksum_value?: string;
7
+ created_at?: Date | null;
7
8
  file_name?: string;
8
9
  file_size?: number;
9
10
  path?: string;
10
11
  source?: string;
11
12
  type?: string;
13
+ updated_at?: Date | null;
12
14
  }
13
15
  export interface PostgresFileRecord extends Omit<PostgresFile, 'file_size'> {
14
16
  bucket: string;
@@ -1,10 +1,10 @@
1
1
  export declare type GranuleStatus = 'completed' | 'failed' | 'running' | 'queued';
2
2
  export interface PostgresGranuleUniqueColumns {
3
3
  granule_id: string;
4
- collection_cumulus_id: number;
5
4
  }
6
5
  export interface PostgresGranule extends PostgresGranuleUniqueColumns {
7
6
  archived: boolean;
7
+ collection_cumulus_id: number;
8
8
  producer_granule_id: string;
9
9
  status?: GranuleStatus;
10
10
  cmr_link?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cumulus/db",
3
- "version": "21.3.1",
3
+ "version": "21.3.2-testlerna.0",
4
4
  "description": "Utilities for working with the Cumulus DB",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./dist/index.js",
@@ -11,7 +11,7 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "clean": "rm -rf dist",
14
- "prepare": "npm run tsc",
14
+ "build": "npm run tsc",
15
15
  "tsc": "../../node_modules/.bin/tsc",
16
16
  "tsc:listEmittedFiles": "../../node_modules/.bin/tsc --listEmittedFiles",
17
17
  "test": "../../node_modules/.bin/ava",
@@ -32,23 +32,24 @@
32
32
  "node": ">=22.21.1"
33
33
  },
34
34
  "dependencies": {
35
- "@aws-sdk/client-secrets-manager": "^3.621.0",
36
- "@cumulus/aws-client": "21.3.1",
37
- "@cumulus/common": "21.3.1",
38
- "@cumulus/errors": "21.3.1",
39
- "@cumulus/logger": "21.3.1",
40
- "@cumulus/message": "21.3.1",
41
- "@cumulus/types": "21.3.1",
35
+ "@aws-sdk/client-secrets-manager": "^3.993.0",
36
+ "@cumulus/aws-client": "21.3.2-testlerna.0",
37
+ "@cumulus/common": "21.3.2-testlerna.0",
38
+ "@cumulus/errors": "21.3.2-testlerna.0",
39
+ "@cumulus/logger": "21.3.2-testlerna.0",
40
+ "@cumulus/message": "21.3.2-testlerna.0",
41
+ "@cumulus/types": "21.3.2-testlerna.0",
42
+ "@duckdb/node-api": "^1.4.4-r.1",
42
43
  "crypto-random-string": "^3.2.0",
43
44
  "is-valid-hostname": "1.0.2",
44
45
  "knex": "2.4.1",
45
46
  "lodash": "^4.17.21",
46
47
  "pg": "~8.13",
47
48
  "snake-camel": "^1.0.6",
48
- "uuid": "8.3.2"
49
+ "uuid": "^8.2.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/uuid": "^8.0.0"
52
53
  },
53
- "gitHead": "ba5c9b04fa1181fecbb97149fb4c01a92000ebb4"
54
+ "gitHead": "ef6577b6caec96a20df8ccff293a9436db32a482"
54
55
  }