dexie-cloud-common
Advanced tools
Comparing version 1.0.25 to 1.0.26
@@ -1,2 +0,2 @@ | ||
export declare type DBKeyMutation = DBKeyUpsert | DBKeyUpdate | DBKeyDelete; | ||
export type DBKeyMutation = DBKeyUpsert | DBKeyUpdate | DBKeyDelete; | ||
export interface DBKeyUpsert { | ||
@@ -3,0 +3,0 @@ type: "ups"; |
import { DBKeyMutation } from "./DBKeyMutation.js"; | ||
export declare type DBKeyMutationSet = { | ||
export type DBKeyMutationSet = { | ||
[tableName: string]: { | ||
@@ -4,0 +4,0 @@ [key: string]: DBKeyMutation; |
@@ -9,3 +9,3 @@ import { DBOperationsSet } from "../DBOperationsSet.js"; | ||
*/ | ||
export declare function toDBOperationSet(inSet: DBKeyMutationSet): DBOperationsSet<string>; | ||
export declare function toDBOperationSet(inSet: DBKeyMutationSet, txid?: string): DBOperationsSet<string>; | ||
//# sourceMappingURL=toDBOperationSet.d.ts.map |
@@ -8,5 +8,6 @@ import { randomString } from "../utils.js"; | ||
*/ | ||
export function toDBOperationSet(inSet) { | ||
export function toDBOperationSet(inSet, txid = "") { | ||
// Fictive transaction: | ||
const txid = randomString(16); | ||
if (!txid) | ||
txid = randomString(16); | ||
// Convert data into a temporary map to collect mutations of same table and type | ||
@@ -13,0 +14,0 @@ const map = {}; |
@@ -1,2 +0,2 @@ | ||
export declare type DBOpPrimaryKey = string | (string | number)[]; | ||
export type DBOpPrimaryKey = string | (string | number)[]; | ||
declare const enum DBCoreRangeType { | ||
@@ -19,3 +19,3 @@ Equal = 1, | ||
} | ||
export declare type DBOperation<PK = DBOpPrimaryKey> = DBInsertOperation<PK> | DBUpsertOperation<PK> | DBUpdateOperation<PK> | DBModifyOperation<PK> | DBDeleteOperation<PK>; | ||
export type DBOperation<PK = DBOpPrimaryKey> = DBInsertOperation<PK> | DBUpsertOperation<PK> | DBUpdateOperation<PK> | DBModifyOperation<PK> | DBDeleteOperation<PK>; | ||
export interface DBOperationCommon<PK = DBOpPrimaryKey> { | ||
@@ -22,0 +22,0 @@ rev?: number; |
import { DBOperation, DBOpPrimaryKey } from "./DBOperation.js"; | ||
export declare type DBOperationsSet<PK = DBOpPrimaryKey> = Array<{ | ||
export type DBOperationsSet<PK = DBOpPrimaryKey> = Array<{ | ||
table: string; | ||
@@ -4,0 +4,0 @@ muts: DBOperation<PK>[]; |
@@ -1,2 +0,2 @@ | ||
export declare type DexieCloudSchema = { | ||
export type DexieCloudSchema = { | ||
[tableName: string]: { | ||
@@ -3,0 +3,0 @@ generatedGlobalId?: boolean; |
@@ -1,2 +0,2 @@ | ||
export declare type TokenRequest = OTPTokenRequest | ClientCredentialsTokenRequest | RefreshTokenRequest | DemoTokenRequest; | ||
export type TokenRequest = OTPTokenRequest | ClientCredentialsTokenRequest | RefreshTokenRequest | DemoTokenRequest; | ||
export interface OTPTokenRequest { | ||
@@ -73,3 +73,3 @@ grant_type: 'otp'; | ||
} | ||
export declare type TokenResponse = TokenFinalResponse | TokenOtpSentResponse | TokenResponseInvalidTimestamp; | ||
export type TokenResponse = TokenFinalResponse | TokenOtpSentResponse | TokenResponseInvalidTimestamp; | ||
export interface CreateDbResponse { | ||
@@ -84,4 +84,4 @@ url: string; | ||
} | ||
export declare type WhitelistResponse = number | string[]; | ||
export declare type ClientsResponse = DXCClient[]; | ||
export type WhitelistResponse = number | string[]; | ||
export type ClientsResponse = DXCClient[]; | ||
export interface DXCClient { | ||
@@ -88,0 +88,0 @@ id: string; |
export declare function assert(b: boolean): asserts b is true; | ||
export declare function hasOwn(obj: any, prop: any): boolean; | ||
declare type SetByKeyPathTarget = { | ||
type SetByKeyPathTarget = { | ||
[keyPath: string]: SetByKeyPathTarget; | ||
} | SetByKeyPathTarget[]; | ||
export declare function setByKeyPath(obj: SetByKeyPathTarget, keyPath: string | ArrayLike<string>, value: any): void; | ||
export declare const randomString: (bytes: number) => string; | ||
export declare const randomString: (bytes: number, randomFill?: (buf: Uint8Array) => void) => string; | ||
export {}; | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -1,2 +0,1 @@ | ||
import { randomFillSync } from "universal-imports"; | ||
export function assert(b) { | ||
@@ -62,12 +61,17 @@ if (!b) | ||
} | ||
export const randomString = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes) => { | ||
export const randomString = typeof self !== 'undefined' && typeof crypto !== 'undefined' ? (bytes, randomFill = crypto.getRandomValues.bind(crypto)) => { | ||
// Web | ||
const buf = new Uint8Array(bytes); | ||
crypto.getRandomValues(buf); | ||
return btoa(String.fromCharCode.apply(null, buf)); | ||
} : typeof Buffer !== 'undefined' ? (bytes) => { | ||
randomFill(buf); | ||
return self.btoa(String.fromCharCode.apply(null, buf)); | ||
} : typeof Buffer !== 'undefined' ? (bytes, randomFill = simpleRandomFill) => { | ||
// Node | ||
const buf = Buffer.alloc(bytes); | ||
randomFillSync(buf); | ||
randomFill(buf); | ||
return buf.toString("base64"); | ||
} : () => { throw new Error("No implementation of randomString was found"); }; | ||
function simpleRandomFill(buf) { | ||
for (let i = 0; i < buf.length; ++i) { | ||
buf[i] = Math.floor(Math.random() * 256); | ||
} | ||
} |
{ | ||
"name": "dexie-cloud-common", | ||
"version": "1.0.25", | ||
"packageManager": "^pnpm@7.9.5", | ||
"version": "1.0.26", | ||
"description": "Library for shared code between dexie-cloud-addon, dexie-cloud (CLI) and dexie-cloud-server", | ||
@@ -12,7 +11,5 @@ "type": "module", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"universal-imports": "^1.0.4" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.7.14" | ||
"@types/node": "^18.11.18", | ||
"typescript": "4.9.4" | ||
}, | ||
@@ -19,0 +16,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
75870
0
685
2
- Removeduniversal-imports@^1.0.4
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removeduniversal-imports@1.0.4(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)