ofsync-bridge-ofcoop 0.1.0-alpha.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.
- package/README.md +37 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.esm.js +1 -0
- package/dist/index.js +16 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ofsync-bridge-ofcoop
|
|
2
|
+
|
|
3
|
+
Bridge sinkronisasi domain **ofcoop** untuk runtime `ofsync-shared-core`.
|
|
4
|
+
|
|
5
|
+
Package ini menyediakan registrar bridge domain agar host app dapat menghubungkan perubahan lokal/remote domain `ofcoop` ke pipeline sinkronisasi host-side secara konsisten.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install ofsync-bridge-ofcoop
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { registerSyncBridge } from 'ofsync-bridge-ofcoop';
|
|
17
|
+
|
|
18
|
+
registerSyncBridge(runtime, {
|
|
19
|
+
async collectSyncChanges(scope) {
|
|
20
|
+
return [];
|
|
21
|
+
},
|
|
22
|
+
async applySyncChanges(changes, scope) {
|
|
23
|
+
// map ke use-case domain ofcoop
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Development
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --no-audit --no-fund
|
|
32
|
+
npm run ci:check
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Documentation
|
|
36
|
+
|
|
37
|
+
- Internal docs hub: `docs/00-DOCUMENTATION-HUB.md`
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SyncScope {
|
|
2
|
+
tenantId?: string;
|
|
3
|
+
branchId?: string;
|
|
4
|
+
deviceId?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SyncChange {
|
|
7
|
+
id: string;
|
|
8
|
+
domain: string;
|
|
9
|
+
entity: string;
|
|
10
|
+
type: 'CREATE' | 'UPDATE' | 'DELETE';
|
|
11
|
+
recordId: string;
|
|
12
|
+
payload: Record<string, unknown>;
|
|
13
|
+
occurredAt: string;
|
|
14
|
+
scope?: SyncScope;
|
|
15
|
+
}
|
|
16
|
+
export interface DomainBridge {
|
|
17
|
+
domain: string;
|
|
18
|
+
collectLocalChanges?: (scope: SyncScope) => Promise<SyncChange[]>;
|
|
19
|
+
applyRemoteChanges?: (changes: SyncChange[], scope: SyncScope) => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export interface SyncRuntimeLike {
|
|
22
|
+
registerDomainBridge: (bridge: DomainBridge) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const BRIDGE_DOMAIN = "ofcoop";
|
|
25
|
+
export interface DomainSyncBridgePort {
|
|
26
|
+
collectSyncChanges?: (scope: SyncScope) => Promise<SyncChange[]>;
|
|
27
|
+
applySyncChanges?: (changes: SyncChange[], scope: SyncScope) => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare function createSyncBridge(port: DomainSyncBridgePort): DomainBridge;
|
|
30
|
+
export declare function registerSyncBridge(runtime: SyncRuntimeLike, port: DomainSyncBridgePort): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c="ofcoop";function o(e){return{domain:c,collectLocalChanges:e.collectSyncChanges,applyRemoteChanges:e.applySyncChanges}}function i(e,n){e.registerDomainBridge(o(n))}export{c as BRIDGE_DOMAIN,o as createSyncBridge,i as registerSyncBridge};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BRIDGE_DOMAIN = void 0;
|
|
4
|
+
exports.createSyncBridge = createSyncBridge;
|
|
5
|
+
exports.registerSyncBridge = registerSyncBridge;
|
|
6
|
+
exports.BRIDGE_DOMAIN = 'ofcoop';
|
|
7
|
+
function createSyncBridge(port) {
|
|
8
|
+
return {
|
|
9
|
+
domain: exports.BRIDGE_DOMAIN,
|
|
10
|
+
collectLocalChanges: port.collectSyncChanges,
|
|
11
|
+
applyRemoteChanges: port.applySyncChanges,
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function registerSyncBridge(runtime, port) {
|
|
15
|
+
runtime.registerDomainBridge(createSyncBridge(port));
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ofsync-bridge-ofcoop",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Sync bridge adapter for wiring ofcoop domain changes into ofsync-shared-core runtime.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Agus Made",
|
|
8
|
+
"email": "krisnaparta@gmail.com"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"module": "dist/index.esm.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.esm.js",
|
|
17
|
+
"require": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
25
|
+
"build": "npm run clean && tsc -p tsconfig.build.json && node esbuild.config.js",
|
|
26
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
|
+
"test": "npm run build && node --test ./tests/*.test.js",
|
|
28
|
+
"verify:surface": "node ./scripts/verify-surface.js",
|
|
29
|
+
"verify:boundary": "node ./scripts/verify-boundary-imports.js",
|
|
30
|
+
"ci:check": "npm run typecheck && npm run verify:surface && npm run verify:boundary && npm run test",
|
|
31
|
+
"prepublishOnly": "npm run ci:check",
|
|
32
|
+
"prepack": "npm run build"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"esbuild": "^0.25.11",
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"@types/node": "^20.19.0"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"ofsync-shared-core": ">=0.1.0-alpha.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"ofsync-shared-core": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|