@sprucelabs/data-stores 26.4.89 → 27.0.1

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 (66) hide show
  1. package/build/.spruce/errors/dataStores/databaseNotConnected.schema.js +5 -5
  2. package/build/.spruce/errors/dataStores/duplicateKey.schema.js +1 -1
  3. package/build/.spruce/errors/dataStores/duplicateRecord.schema.js +9 -9
  4. package/build/.spruce/errors/dataStores/failedToLoadStore.schema.js +3 -3
  5. package/build/.spruce/errors/dataStores/failedToLoadStores.schema.js +5 -3
  6. package/build/.spruce/errors/dataStores/indexExists.schema.js +5 -5
  7. package/build/.spruce/errors/dataStores/indexNotFound.schema.js +5 -5
  8. package/build/.spruce/errors/dataStores/invalidConnectionStringScheme.schema.js +3 -3
  9. package/build/.spruce/errors/dataStores/invalidDatabaseName.schema.js +3 -3
  10. package/build/.spruce/errors/dataStores/invalidDbConnectionString.schema.js +1 -1
  11. package/build/.spruce/errors/dataStores/invalidFakeQueryResponse.schema.js +5 -5
  12. package/build/.spruce/errors/dataStores/invalidStore.schema copy.js +5 -5
  13. package/build/.spruce/errors/dataStores/invalidStore.schema.js +1 -1
  14. package/build/.spruce/errors/dataStores/invalidStoreName.schema.js +5 -5
  15. package/build/.spruce/errors/dataStores/mongoIdMappingError.schema.js +1 -1
  16. package/build/.spruce/errors/dataStores/notImplemented.schema.js +1 -1
  17. package/build/.spruce/errors/dataStores/queryNotFaked.schema.js +5 -5
  18. package/build/.spruce/errors/dataStores/record-not-found-query.schema.js +1 -1
  19. package/build/.spruce/errors/dataStores/recordNotFound.schema.js +5 -5
  20. package/build/.spruce/errors/dataStores/scrambleNotConfigured.schema.js +1 -1
  21. package/build/.spruce/errors/dataStores/unableToConnectToDb.schema.js +1 -1
  22. package/build/.spruce/errors/dataStores/unknownDatabaseError.schema.js +3 -3
  23. package/build/.spruce/errors/dataStores/unknownError.schema.js +1 -1
  24. package/build/.spruce/errors/dataStores/unknownStoreError.schema.js +5 -5
  25. package/build/.spruce/errors/errors.types.d.ts +53 -56
  26. package/build/.spruce/errors/errors.types.js +0 -2
  27. package/build/.spruce/errors/options.types.d.ts +2 -2
  28. package/build/.spruce/schemas/fields/fields.types.d.ts +1 -1
  29. package/build/cursors/BatchArrayCursor.d.ts +2 -2
  30. package/build/databases/MongoDatabase.js +3 -1
  31. package/build/databases/NeDbDatabase.js +9 -3
  32. package/build/databases/mongo.types.d.ts +89 -135
  33. package/build/databases/mongo.types.js +0 -1
  34. package/build/errors/SpruceError.d.ts +1 -1
  35. package/build/errors/SpruceError.js +6 -2
  36. package/build/errors/failedToLoadStores.builder.js +1 -1
  37. package/build/errors/mongoIdMappingError.builder.js +0 -2
  38. package/build/errors/scrambleNotConfigured.builder.js +0 -2
  39. package/build/esm/.spruce/errors/errors.types.d.ts +53 -56
  40. package/build/esm/.spruce/errors/errors.types.js +0 -2
  41. package/build/esm/.spruce/errors/options.types.d.ts +2 -2
  42. package/build/esm/cursors/BatchArrayCursor.d.ts +2 -2
  43. package/build/esm/databases/MongoDatabase.js +3 -1
  44. package/build/esm/databases/NeDbDatabase.js +9 -3
  45. package/build/esm/databases/mongo.types.d.ts +89 -135
  46. package/build/esm/databases/mongo.types.js +0 -1
  47. package/build/esm/errors/SpruceError.d.ts +1 -1
  48. package/build/esm/errors/SpruceError.js +6 -2
  49. package/build/esm/errors/failedToLoadStores.builder.js +1 -1
  50. package/build/esm/errors/mongoIdMappingError.builder.js +0 -2
  51. package/build/esm/errors/scrambleNotConfigured.builder.js +0 -2
  52. package/build/esm/loaders/StoreLoader.d.ts +1 -1
  53. package/build/esm/plugins/DatabaseFieldMapperPlugin.js +3 -1
  54. package/build/esm/stores/AbstractStore.js +4 -2
  55. package/build/esm/tests/AbstractDatabaseTest.js +3 -1
  56. package/build/esm/tests/databaseAssertUtil.js +66 -20
  57. package/build/esm/types/query.types.d.ts +4 -4
  58. package/build/esm/types/query.types.js +0 -1
  59. package/build/loaders/StoreLoader.d.ts +1 -1
  60. package/build/plugins/DatabaseFieldMapperPlugin.js +3 -1
  61. package/build/stores/AbstractStore.js +4 -2
  62. package/build/tests/AbstractDatabaseTest.js +3 -1
  63. package/build/tests/databaseAssertUtil.js +66 -20
  64. package/build/types/query.types.d.ts +4 -4
  65. package/build/types/query.types.js +0 -1
  66. package/package.json +20 -32
@@ -7,17 +7,17 @@ const databaseNotConnectedSchema = {
7
7
  name: 'Database not connected',
8
8
  fields: {
9
9
  /** . */
10
- 'operationAttempted': {
10
+ operationAttempted: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
15
  /** . */
16
- 'collectionName': {
16
+ collectionName: {
17
17
  type: 'text',
18
- options: undefined
18
+ options: undefined,
19
19
  },
20
- }
20
+ },
21
21
  };
22
22
  schema_1.SchemaRegistry.getInstance().trackSchema(databaseNotConnectedSchema);
23
23
  exports.default = databaseNotConnectedSchema;
@@ -5,7 +5,7 @@ const duplicateKeySchema = {
5
5
  id: 'duplicateKey',
6
6
  namespace: 'DataStores',
7
7
  name: 'Duplicate Key',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(duplicateKeySchema);
11
11
  exports.default = duplicateKeySchema;
@@ -7,34 +7,34 @@ const duplicateRecordSchema = {
7
7
  name: 'Duplicate record',
8
8
  fields: {
9
9
  /** . */
10
- 'duplicateFields': {
10
+ duplicateFields: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
13
  isArray: true,
14
- options: undefined
14
+ options: undefined,
15
15
  },
16
16
  /** . */
17
- 'duplicateValues': {
17
+ duplicateValues: {
18
18
  type: 'text',
19
19
  isRequired: true,
20
20
  isArray: true,
21
- options: undefined
21
+ options: undefined,
22
22
  },
23
23
  /** . */
24
- 'collectionName': {
24
+ collectionName: {
25
25
  type: 'text',
26
26
  isRequired: true,
27
- options: undefined
27
+ options: undefined,
28
28
  },
29
29
  /** Action. e.g. create, update, etc. */
30
- 'action': {
30
+ action: {
31
31
  label: 'Action',
32
32
  type: 'text',
33
33
  isRequired: true,
34
34
  hint: 'e.g. create, update, etc.',
35
- options: undefined
35
+ options: undefined,
36
36
  },
37
- }
37
+ },
38
38
  };
39
39
  schema_1.SchemaRegistry.getInstance().trackSchema(duplicateRecordSchema);
40
40
  exports.default = duplicateRecordSchema;
@@ -7,12 +7,12 @@ const failedToLoadStoreSchema = {
7
7
  name: 'Failed to load store',
8
8
  fields: {
9
9
  /** . */
10
- 'name': {
10
+ name: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
- }
15
+ },
16
16
  };
17
17
  schema_1.SchemaRegistry.getInstance().trackSchema(failedToLoadStoreSchema);
18
18
  exports.default = failedToLoadStoreSchema;
@@ -7,13 +7,15 @@ const failedToLoadStoresSchema = {
7
7
  name: 'failed to load stores',
8
8
  fields: {
9
9
  /** . */
10
- 'errors': {
10
+ errors: {
11
11
  type: 'raw',
12
12
  isRequired: true,
13
13
  isArray: true,
14
- options: { valueType: `AbstractSpruceError<FailedToLoadStoreErrorOptions>`, }
14
+ options: {
15
+ valueType: `AbstractSpruceError<FailedToLoadStoreErrorOptions>`,
16
+ },
15
17
  },
16
- }
18
+ },
17
19
  };
18
20
  schema_1.SchemaRegistry.getInstance().trackSchema(failedToLoadStoresSchema);
19
21
  exports.default = failedToLoadStoresSchema;
@@ -7,20 +7,20 @@ const indexExistsSchema = {
7
7
  name: 'Index Exists',
8
8
  fields: {
9
9
  /** Index Exists. */
10
- 'index': {
10
+ index: {
11
11
  label: 'Index Exists',
12
12
  type: 'text',
13
13
  isRequired: true,
14
14
  isArray: true,
15
- options: undefined
15
+ options: undefined,
16
16
  },
17
17
  /** . */
18
- 'collectionName': {
18
+ collectionName: {
19
19
  type: 'text',
20
20
  isRequired: true,
21
- options: undefined
21
+ options: undefined,
22
22
  },
23
- }
23
+ },
24
24
  };
25
25
  schema_1.SchemaRegistry.getInstance().trackSchema(indexExistsSchema);
26
26
  exports.default = indexExistsSchema;
@@ -7,20 +7,20 @@ const indexNotFoundSchema = {
7
7
  name: 'Index not found',
8
8
  fields: {
9
9
  /** Missing Index. */
10
- 'missingIndex': {
10
+ missingIndex: {
11
11
  label: 'Missing Index',
12
12
  type: 'text',
13
13
  isRequired: true,
14
14
  isArray: true,
15
- options: undefined
15
+ options: undefined,
16
16
  },
17
17
  /** . */
18
- 'collectionName': {
18
+ collectionName: {
19
19
  type: 'text',
20
20
  isRequired: true,
21
- options: undefined
21
+ options: undefined,
22
22
  },
23
- }
23
+ },
24
24
  };
25
25
  schema_1.SchemaRegistry.getInstance().trackSchema(indexNotFoundSchema);
26
26
  exports.default = indexNotFoundSchema;
@@ -7,12 +7,12 @@ const invalidConnectionStringSchemeSchema = {
7
7
  name: 'Invalid connection string scheme',
8
8
  fields: {
9
9
  /** . */
10
- 'connectionString': {
10
+ connectionString: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
- }
15
+ },
16
16
  };
17
17
  schema_1.SchemaRegistry.getInstance().trackSchema(invalidConnectionStringSchemeSchema);
18
18
  exports.default = invalidConnectionStringSchemeSchema;
@@ -7,12 +7,12 @@ const invalidDatabaseNameSchema = {
7
7
  name: 'Invalid database name',
8
8
  fields: {
9
9
  /** . */
10
- 'suppliedName': {
10
+ suppliedName: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
- }
15
+ },
16
16
  };
17
17
  schema_1.SchemaRegistry.getInstance().trackSchema(invalidDatabaseNameSchema);
18
18
  exports.default = invalidDatabaseNameSchema;
@@ -5,7 +5,7 @@ const invalidDbConnectionStringSchema = {
5
5
  id: 'invalidDbConnectionString',
6
6
  namespace: 'DataStores',
7
7
  name: 'Invalid db connection string',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(invalidDbConnectionStringSchema);
11
11
  exports.default = invalidDbConnectionStringSchema;
@@ -7,18 +7,18 @@ const invalidFakeQueryResponseSchema = {
7
7
  name: 'Invalid fake query response',
8
8
  fields: {
9
9
  /** . */
10
- 'query': {
10
+ query: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
15
  /** . */
16
- 'response': {
16
+ response: {
17
17
  type: 'raw',
18
18
  isRequired: true,
19
- options: { valueType: `any`, }
19
+ options: { valueType: `any` },
20
20
  },
21
- }
21
+ },
22
22
  };
23
23
  schema_1.SchemaRegistry.getInstance().trackSchema(invalidFakeQueryResponseSchema);
24
24
  exports.default = invalidFakeQueryResponseSchema;
@@ -7,19 +7,19 @@ const invalidStoreSchema = {
7
7
  name: 'Invalid store',
8
8
  fields: {
9
9
  /** . */
10
- 'suppliedName': {
10
+ suppliedName: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
15
  /** . */
16
- 'validNames': {
16
+ validNames: {
17
17
  type: 'text',
18
18
  isRequired: true,
19
19
  isArray: true,
20
- options: undefined
20
+ options: undefined,
21
21
  },
22
- }
22
+ },
23
23
  };
24
24
  schema_1.SchemaRegistry.getInstance().trackSchema(invalidStoreSchema);
25
25
  exports.default = invalidStoreSchema;
@@ -5,7 +5,7 @@ const invalidStoreSchema = {
5
5
  id: 'invalidStore',
6
6
  namespace: 'DataStores',
7
7
  name: 'Invalid store',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(invalidStoreSchema);
11
11
  exports.default = invalidStoreSchema;
@@ -7,19 +7,19 @@ const invalidStoreNameSchema = {
7
7
  name: 'Invalid store',
8
8
  fields: {
9
9
  /** . */
10
- 'suppliedName': {
10
+ suppliedName: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
15
  /** . */
16
- 'validNames': {
16
+ validNames: {
17
17
  type: 'text',
18
18
  isRequired: true,
19
19
  isArray: true,
20
- options: undefined
20
+ options: undefined,
21
21
  },
22
- }
22
+ },
23
23
  };
24
24
  schema_1.SchemaRegistry.getInstance().trackSchema(invalidStoreNameSchema);
25
25
  exports.default = invalidStoreNameSchema;
@@ -5,7 +5,7 @@ const mongoIdMappingErrorSchema = {
5
5
  id: 'mongoIdMappingError',
6
6
  namespace: 'DataStores',
7
7
  name: 'Mongo id mapping error',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(mongoIdMappingErrorSchema);
11
11
  exports.default = mongoIdMappingErrorSchema;
@@ -5,7 +5,7 @@ const notImplementedSchema = {
5
5
  id: 'notImplemented',
6
6
  namespace: 'DataStores',
7
7
  name: 'Not implemented',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(notImplementedSchema);
11
11
  exports.default = notImplementedSchema;
@@ -7,17 +7,17 @@ const queryNotFakedSchema = {
7
7
  name: 'Query not faked',
8
8
  fields: {
9
9
  /** . */
10
- 'query': {
10
+ query: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
15
  /** . */
16
- 'params': {
16
+ params: {
17
17
  type: 'raw',
18
- options: { valueType: `Record<string, any>`, }
18
+ options: { valueType: `Record<string, any>` },
19
19
  },
20
- }
20
+ },
21
21
  };
22
22
  schema_1.SchemaRegistry.getInstance().trackSchema(queryNotFakedSchema);
23
23
  exports.default = queryNotFakedSchema;
@@ -8,7 +8,7 @@ const recordNotFoundQuerySchema = {
8
8
  dynamicFieldSignature: {
9
9
  type: 'raw',
10
10
  keyName: 'field',
11
- options: { valueType: `any`, }
11
+ options: { valueType: `any` },
12
12
  },
13
13
  };
14
14
  schema_1.SchemaRegistry.getInstance().trackSchema(recordNotFoundQuerySchema);
@@ -11,20 +11,20 @@ const recordNotFoundSchema = {
11
11
  name: 'Record not found',
12
12
  fields: {
13
13
  /** Store name. */
14
- 'storeName': {
14
+ storeName: {
15
15
  label: 'Store name',
16
16
  type: 'text',
17
17
  isRequired: true,
18
- options: undefined
18
+ options: undefined,
19
19
  },
20
20
  /** Query. */
21
- 'query': {
21
+ query: {
22
22
  label: 'Query',
23
23
  type: 'schema',
24
24
  isRequired: true,
25
- options: { schema: record_not_found_query_schema_1.default, }
25
+ options: { schema: record_not_found_query_schema_1.default },
26
26
  },
27
- }
27
+ },
28
28
  };
29
29
  schema_1.SchemaRegistry.getInstance().trackSchema(recordNotFoundSchema);
30
30
  exports.default = recordNotFoundSchema;
@@ -5,7 +5,7 @@ const scrambleNotConfiguredSchema = {
5
5
  id: 'scrambleNotConfigured',
6
6
  namespace: 'DataStores',
7
7
  name: 'Scramble not configured',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(scrambleNotConfiguredSchema);
11
11
  exports.default = scrambleNotConfiguredSchema;
@@ -5,7 +5,7 @@ const unableToConnectToDbSchema = {
5
5
  id: 'unableToConnectToDb',
6
6
  namespace: 'DataStores',
7
7
  name: 'Unable to connect to db',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(unableToConnectToDbSchema);
11
11
  exports.default = unableToConnectToDbSchema;
@@ -7,12 +7,12 @@ const unknownDatabaseErrorSchema = {
7
7
  name: 'unknown database error',
8
8
  fields: {
9
9
  /** . */
10
- 'databaseErrorMessage': {
10
+ databaseErrorMessage: {
11
11
  type: 'text',
12
12
  isRequired: true,
13
- options: undefined
13
+ options: undefined,
14
14
  },
15
- }
15
+ },
16
16
  };
17
17
  schema_1.SchemaRegistry.getInstance().trackSchema(unknownDatabaseErrorSchema);
18
18
  exports.default = unknownDatabaseErrorSchema;
@@ -5,7 +5,7 @@ const unknownErrorSchema = {
5
5
  id: 'unknownError',
6
6
  namespace: 'DataStores',
7
7
  name: 'Unknown Error',
8
- fields: {}
8
+ fields: {},
9
9
  };
10
10
  schema_1.SchemaRegistry.getInstance().trackSchema(unknownErrorSchema);
11
11
  exports.default = unknownErrorSchema;
@@ -7,21 +7,21 @@ const unknownStoreErrorSchema = {
7
7
  name: 'Unknown store error',
8
8
  fields: {
9
9
  /** Action. e.g. createPerson, updateLocation, etc */
10
- 'action': {
10
+ action: {
11
11
  label: 'Action',
12
12
  type: 'text',
13
13
  isRequired: true,
14
14
  hint: 'e.g. createPerson, updateLocation, etc',
15
- options: undefined
15
+ options: undefined,
16
16
  },
17
17
  /** Store name. */
18
- 'storeName': {
18
+ storeName: {
19
19
  label: 'Store name',
20
20
  type: 'text',
21
21
  isRequired: true,
22
- options: undefined
22
+ options: undefined,
23
23
  },
24
- }
24
+ },
25
25
  };
26
26
  schema_1.SchemaRegistry.getInstance().trackSchema(unknownStoreErrorSchema);
27
27
  exports.default = unknownStoreErrorSchema;