Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
apttap committed Aug 7, 2024
1 parent c3e3937 commit f4a8c47
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 291 deletions.
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The following versions are currently supported:

| Version | Supported |
| ------- | ------------------ |
| 0.1.1 | :white_check_mark: |
| 0.1.2 | :white_check_mark: |

## Reporting a Vulnerability

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "@tragedy-labs/sprite",
"version": "0.1.1",
"version": "0.1.2",
"description": "A TypeScript driver for ArcadeDB",
"main": "./dist/index.js",
"module": "./dist/index.js",
"type": "module",
"homepage": "https://sprite.tragedy.dev",
"repository": {
"type": "git",
"url": "https://github.com/tragedy-labs/sprite.git"
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"type": "module",
"scripts": {
"dev": "nodemon --watch ./ --ext ts --exec 'rimraf ./dist && tsc && node ./dist/index.js'",
"build": "rimraf ./dist && tsc -p ./tsconfig.build.json",
Expand Down
9 changes: 0 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import { CreateDocumentType, SpriteDatabase } from './api.js';

export { SpriteServer } from './server/SpriteServer.js';
export { SpriteDatabase } from './database/SpriteDatabase.js';

export * from './types/index.js';

const db = new SpriteDatabase({
address: 'localhost',
username: '',
password: '',
databaseName: 'test'
});
193 changes: 0 additions & 193 deletions src/types/database.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { ValidSuperTypeKey } from './type.js';

export type ArcadeSelectTimeoutStrategy = 'EXCEPTION' | 'RETURN';

/**
Expand All @@ -8,189 +6,6 @@ export type ArcadeSelectTimeoutStrategy = 'EXCEPTION' | 'RETURN';
*/
export type ArcadeRecordType = 'document' | 'edge' | 'vertex';

/**
* Options to create a new type with.
*/
export interface ISpriteCreateTypeOptions<S, N extends TypeNames<S>> {
/**
* When set to true, the type creation will be ignored if the
* type already exists (instead of failing with an error).
* @default false
*/
ifNotExists?: boolean;
/**
* Defines a super-type you want to extend with this type.
*/
extends?: ValidSuperTypeKey<S, N>;
/**
* A bucket-name, or an array of bucket-names you want this type to use.
*/
buckets?: string | Array<string>;
/**
* Defines the total number of buckets you want to create for this type. The
* @default 1
*/
totalBuckets?: number;
}

/**
* Options for a `deleteFrom` operation as executed
* via a `SpriteDatabase` repository.
*/
export interface ISpriteDeleteFromOptions<
S,
N extends TypeNames<S>,
P extends keyof WithRid<S, N>
> {
/**
* Designates conditions to filter the result-set.
*/
where: SpriteWhereClause<S, N, P>;
/**
* The duration of the timeout in milliseconds.
*/
timeout?: number;
/**
* Defines the maximum number of records in the result-set.
* @default undefined
*/
limit?: number;
/**
* Defines what is returned following the command: the count of the records before (`BEFORE`) or following deletion (`COUNT`).
* @default 'COUNT'
*/
return?: 'COUNT' | 'BEFORE';
}

/**
* Options for a database.dropType() command
*/
export interface ISpriteDropTypeOptions {
/**
* Prevent errors if the type does not exits when attempting to drop it.
* @default false;
*/
ifExists?: boolean;
/**
* Defines whether the command drops non-empty edge and vertex types. Note, this can
* disrupt data consistency. Be sure to create a backup before running it.
* @default: false
*/
unsafe?: boolean;
}

/** Options to insert a new record with */
export interface ISpriteInsertRecordOptions<T> {
/** The data to populate the newly created reacord with */
data?: OmitMeta<T> | OmitMeta<T>[];
/** The bucket to store the record in */
bucket?: string;
}

// TODO: have not checked these for compatibility with ArcadeDB
export declare const COMPARISON_OPERATORS: readonly [
'=',
'==',
'!=',
'<>',
'>',
'>=',
'<',
'<=',
'in',
'not in',
'is',
'is not',
'like',
'not like',
'match',
'ilike',
'not ilike',
'@>',
'<@',
'&&',
'?',
'?&',
'!<',
'!>',
'<=>',
'!~',
'~',
'~*',
'!~*',
'@@',
'@@@',
'!!',
'<->',
'regexp',
'is distinct from',
'is not distinct from'
];

/** Operators for a `WHERE` sql statement */
export type SpriteOperators = (typeof COMPARISON_OPERATORS)[number];

/**
* An array with three items used to describe a `where` statement.
* @example ['@rid', '==', '#0:0']
*/
export type SpriteWhereClause<
S,
N extends TypeNames<S>,
P extends keyof WithRid<S, N>
> = [P, SpriteOperators, WithRid<S, N>[P]];

/** Options for a `selectFrom` operation, as executed via a `SpriteDatabase` repository. */
export interface ISpriteSelectFromOptions<
S,
N extends keyof S,
P extends keyof WithRid<S, N>
> {
/**
* Designates conditions to filter the result-set.
*/
where?: SpriteWhereClause<S, N, P>;
/**
* Designates the field with which to order the result-set.
* Use the optional 'ASC' and 'DESC' operators to define the direction of the order.
*/
orderBy?: {
field: keyof S[N];
/**
* Defines the direction to sort the result (ASCending or DESCending).
* @default 'ASC'.
*/
direction?: 'ASC' | 'DESC';
};
/**
* Defines the number of records you want to skip from the start of the result-set.
* You mayfind this useful in Pagination, when using it in conjunction with the
* limit `option`.
*/
skip?: number;
/**
* Defines the maximum number of records in the result-set. You may find this useful in
* Pagination, when using it in conjunction with the `skip` option.
*/
limit?: number;
/**
* Defines the maximum time in milliseconds for the query, and optionally the
* exception strategy to use.
*/
timeout?: {
/**
* The duration of the timeout in milliseconds.
*/
duration: number;
/**
* The timeout strategy to use.\
* `RETURN` Truncates the result-set, returning the data collected up to the timeout.\
* `EXCEPTION` Raises an exception.
*/
strategy?: ArcadeSelectTimeoutStrategy;
};
}

/**
* The possible categories of a record in ArcadeDB,
* as they appear in the record's `@cat` property.
Expand Down Expand Up @@ -226,14 +41,6 @@ export type RecordMeta<C extends ArcadeRecordCategory = ArcadeRecordCategory> =

export type OmitMeta<T> = Omit<T, keyof RecordMeta | keyof EdgeRecordMeta>;

/** Options to insert a new record with */
export interface ISpriteInsertRecordOptions<T> {
/** The data to populate the newly created reacord with */
data?: OmitMeta<T> | OmitMeta<T>[];
/** The bucket to store the record in */
bucket?: string;
}

/**
* The TypeNames in a supplied schema.
*/
Expand Down
75 changes: 0 additions & 75 deletions src/types/edge.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './commands.js';
export * from './database.js';
export * from './edge.js';
export * from './operators.js';
export * from './queries.js';
export * from './type.js';
9 changes: 1 addition & 8 deletions test/unit/transaction/instance/crud.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
// Lib
import { Dialect } from '@/database/Database.js';
import { Routes } from '@/database/routes.js';
import { Rest } from '@/rest/Rest.js';
import { SpriteTransaction } from '@/transaction/SpriteTransaction.js';
import { Transaction } from '@/transaction/Transaction.js';

// Testing
import {
TestDatabaseSession as SESSION,
headersWithTransaction as headers,
variables
} from '@test/variables.js';

const ENDPOINT = `${variables.address}${variables.apiRoute}${Routes.COMMAND}/${variables.databaseName}`;
import { TestDatabaseSession as SESSION, variables } from '@test/variables.js';

describe('SpriteTransaction.crud()', () => {
it(`should call Transaction.crud with session, transaction, language, command, and parameters`, async () => {
Expand Down

0 comments on commit f4a8c47

Please sign in to comment.