@shaxpir/duiduidui-models 1.4.0 → 1.4.2
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/dist/models/Billing.d.ts +1 -1
- package/dist/models/Billing.js +2 -4
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/package.json +2 -3
- package/decs.d.ts +0 -112
package/dist/models/Billing.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface BillingBody extends ContentBody {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class Billing extends Content {
|
|
12
12
|
static makeBillingId(userId: ContentId): ContentId;
|
|
13
|
-
static create(userId: ContentId): Billing;
|
|
13
|
+
static create(userId: ContentId, payload: BillingPayload): Billing;
|
|
14
14
|
constructor(doc: Doc, shouldAcquire: boolean, shareSync: ShareSync);
|
|
15
15
|
get payload(): BillingPayload;
|
|
16
16
|
}
|
package/dist/models/Billing.js
CHANGED
|
@@ -9,7 +9,7 @@ class Billing extends Content_1.Content {
|
|
|
9
9
|
static makeBillingId(userId) {
|
|
10
10
|
return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.BILLING);
|
|
11
11
|
}
|
|
12
|
-
static create(userId) {
|
|
12
|
+
static create(userId, payload) {
|
|
13
13
|
const now = shaxpir_common_1.MultiClock.now();
|
|
14
14
|
const billingId = Billing.makeBillingId(userId);
|
|
15
15
|
return repo_1.ShareSyncFactory.get().createContent({
|
|
@@ -21,9 +21,7 @@ class Billing extends Content_1.Content {
|
|
|
21
21
|
created_at: now,
|
|
22
22
|
updated_at: now
|
|
23
23
|
},
|
|
24
|
-
payload
|
|
25
|
-
stripe_customer_id: null // Initially null, set when the user subscribes
|
|
26
|
-
}
|
|
24
|
+
payload
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
27
|
constructor(doc, shouldAcquire, shareSync) {
|
package/dist/models/index.d.ts
CHANGED
package/dist/models/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
__exportStar(require("./ArrayView"), exports);
|
|
19
19
|
__exportStar(require("./BayesianScore"), exports);
|
|
20
|
+
__exportStar(require("./Billing"), exports);
|
|
20
21
|
__exportStar(require("./ChangeModel"), exports);
|
|
21
22
|
__exportStar(require("./Content"), exports);
|
|
22
23
|
__exportStar(require("./ContentKind"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shaxpir/duiduidui-models",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/shaxpir/duiduidui-models"
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
"main": "dist/index.js",
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
15
|
"files": [
|
|
16
|
-
"dist/"
|
|
17
|
-
"decs.d.ts"
|
|
16
|
+
"dist/"
|
|
18
17
|
],
|
|
19
18
|
"dependencies": {
|
|
20
19
|
"@shaxpir/sharedb": "^5.3.0",
|
package/decs.d.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
declare module '@shaxpir/sharedb/lib/client' {
|
|
2
|
-
import { Presence } from '@shaxpir/sharedb/lib/client/presence/Presence';
|
|
3
|
-
interface Error {
|
|
4
|
-
code: number;
|
|
5
|
-
message: string;
|
|
6
|
-
stack: string;
|
|
7
|
-
}
|
|
8
|
-
interface Types {
|
|
9
|
-
register: (type: any) => void;
|
|
10
|
-
map: { [key: string]: any };
|
|
11
|
-
}
|
|
12
|
-
const types: Types;
|
|
13
|
-
class Agent<TCustom = any> {
|
|
14
|
-
backend: any;
|
|
15
|
-
stream: any;
|
|
16
|
-
custom: any;
|
|
17
|
-
send(message: any): void;
|
|
18
|
-
}
|
|
19
|
-
class Connection {
|
|
20
|
-
constructor(ws: any, options?:any);
|
|
21
|
-
|
|
22
|
-
// This direct reference from connection to agent is not used internal to
|
|
23
|
-
// ShareDB, but it is handy for server-side only user code that may cache
|
|
24
|
-
// state on the agent and read it in middleware
|
|
25
|
-
agent: Agent | null;
|
|
26
|
-
|
|
27
|
-
collections: Record<string, Record<string, Doc>>;
|
|
28
|
-
queries: Record<string, any>;
|
|
29
|
-
|
|
30
|
-
seq: number;
|
|
31
|
-
id: string | null; // Equals agent.src on the server
|
|
32
|
-
nextQueryId: number;
|
|
33
|
-
nextSnapshotRequestId: number;
|
|
34
|
-
|
|
35
|
-
state: string;
|
|
36
|
-
debug: boolean;
|
|
37
|
-
|
|
38
|
-
ping():void;
|
|
39
|
-
close(): void;
|
|
40
|
-
get(collectionName: string, documentID: string): Doc;
|
|
41
|
-
isDocInInventory(collection: string, id: string, minVersion?: string|number):boolean;
|
|
42
|
-
forEachPendingDocCollectionId(callback:(collection: string, id: string) => void):void;
|
|
43
|
-
createFetchQuery<T = any>(collectionName: string, query: any, options?: {results?: Array<Doc<T>>} | null, callback?: (err: Error, results: Array<Doc<T>>) => void): any;
|
|
44
|
-
createSubscribeQuery<T = any>(collectionName: string, query: any, options?: {results?: Array<Doc<T>>} | null, callback?: (err: Error, results: Array<Doc<T>>) => void): any;
|
|
45
|
-
fetchSnapshot(collection: string, id: string, version: number, callback: (error: Error, snapshot: any) => void): void;
|
|
46
|
-
fetchSnapshotByTimestamp(collection: string, id: string, timestamp: number, callback: (error: Error, snapshot: any) => void): void;
|
|
47
|
-
getPresence(channel: string): Presence;
|
|
48
|
-
getDocPresence(collection: string, id: string): Presence;
|
|
49
|
-
on(eventName: string, listener: (error: Error) => void): void;
|
|
50
|
-
off(eventName: string, listener: (error: Error) => void): void;
|
|
51
|
-
}
|
|
52
|
-
class Doc<T = any> {
|
|
53
|
-
connection: Connection;
|
|
54
|
-
type: any;
|
|
55
|
-
id: string;
|
|
56
|
-
collection: string;
|
|
57
|
-
data: T;
|
|
58
|
-
version: any;
|
|
59
|
-
subscribed: boolean;
|
|
60
|
-
preventCompose: boolean;
|
|
61
|
-
paused: boolean;
|
|
62
|
-
submitSource: boolean;
|
|
63
|
-
|
|
64
|
-
on: (eventName:string, callback:any) => void;
|
|
65
|
-
off: (eventName:string, callback:any) => void;
|
|
66
|
-
|
|
67
|
-
fetch: (callback?: (err: Error) => void) => void;
|
|
68
|
-
subscribe: (callback?: (err: Error) => void) => void;
|
|
69
|
-
unsubscribe: (callback?: (err: Error) => void) => void;
|
|
70
|
-
|
|
71
|
-
ingestSnapshot(snapshot: any, callback?: any): void;
|
|
72
|
-
destroy(callback?: any): void;
|
|
73
|
-
create(data: any, callback?: any): void;
|
|
74
|
-
create(data: any, type?: any, callback?: any): void;
|
|
75
|
-
create(data: any, type?: any, options?: any, callback?: any): void;
|
|
76
|
-
submitOp(data: any, options?: any, callback?: any): void;
|
|
77
|
-
del(options: any, callback?: (err: Error) => void): void;
|
|
78
|
-
whenNothingPending(callback: () => void): void;
|
|
79
|
-
hasPending(): boolean;
|
|
80
|
-
hasWritePending(): boolean;
|
|
81
|
-
pause(): void;
|
|
82
|
-
resume(): void;
|
|
83
|
-
flush(): void;
|
|
84
|
-
|
|
85
|
-
ensureDocHasData(callback?: any): void;
|
|
86
|
-
ensureDocHasRecentData(minVersion:string|number, callback?: any): void;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
declare module '@shaxpir/sharedb/lib/client/presence/Presence' {
|
|
91
|
-
import { LocalPresence } from '@shaxpir/sharedb/lib/client/presence/LocalPresence';
|
|
92
|
-
class Presence {
|
|
93
|
-
remotePresences: any;
|
|
94
|
-
localPresences: any;
|
|
95
|
-
|
|
96
|
-
on: (eventName:string, callback: any) => void;
|
|
97
|
-
off: (eventName:string, callback: any) => void;
|
|
98
|
-
|
|
99
|
-
create(id: string): LocalPresence;
|
|
100
|
-
destroy(callback?: any): void;
|
|
101
|
-
subscribe(callback?: any): void;
|
|
102
|
-
unsubscribe(callback?: any): void;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
declare module '@shaxpir/sharedb/lib/client/presence/LocalPresence' {
|
|
107
|
-
class LocalPresence {
|
|
108
|
-
submit(presence: any, callback?: any): void;
|
|
109
|
-
send(callback?: any): void;
|
|
110
|
-
destroy(callback?: any): void;
|
|
111
|
-
}
|
|
112
|
-
}
|