@accounter/server 0.0.9-alpha-20251210153039-1cfd8df346dd211c95a70c76c63465a29236849b → 0.0.9-alpha-20251210155614-e6e65aaecafef9e8fedd0b933f613ffcf478cecf
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/CHANGELOG.md +5 -27
- package/dist/green-invoice-graphql/src/mesh-artifacts/index.d.ts +1 -1
- package/dist/server/src/__tests__/factories/business.d.ts +2 -2
- package/dist/server/src/__tests__/factories/business.js +4 -5
- package/dist/server/src/__tests__/factories/business.js.map +1 -1
- package/dist/server/src/__tests__/factories/business.test.js +2 -2
- package/dist/server/src/__tests__/factories/business.test.js.map +1 -1
- package/dist/server/src/__tests__/factories/charge.d.ts +9 -9
- package/dist/server/src/__tests__/factories/charge.js +15 -15
- package/dist/server/src/__tests__/factories/charge.js.map +1 -1
- package/dist/server/src/__tests__/factories/charge.test.js +14 -14
- package/dist/server/src/__tests__/factories/charge.test.js.map +1 -1
- package/dist/server/src/__tests__/factories/document.d.ts +9 -9
- package/dist/server/src/__tests__/factories/document.js +11 -11
- package/dist/server/src/__tests__/factories/document.js.map +1 -1
- package/dist/server/src/__tests__/factories/document.test.js +38 -38
- package/dist/server/src/__tests__/factories/document.test.js.map +1 -1
- package/dist/server/src/__tests__/factories/financial-account.js +2 -2
- package/dist/server/src/__tests__/factories/financial-account.js.map +1 -1
- package/dist/server/src/__tests__/factories/financial-account.test.js +7 -7
- package/dist/server/src/__tests__/factories/financial-account.test.js.map +1 -1
- package/dist/server/src/__tests__/factories/ids.d.ts +22 -0
- package/dist/server/src/__tests__/factories/ids.js +46 -0
- package/dist/server/src/__tests__/factories/ids.js.map +1 -0
- package/dist/server/src/__tests__/factories/ids.test.js +71 -0
- package/dist/server/src/__tests__/factories/ids.test.js.map +1 -0
- package/dist/server/src/__tests__/factories/index.d.ts +2 -2
- package/dist/server/src/__tests__/factories/index.js +2 -2
- package/dist/server/src/__tests__/factories/index.js.map +1 -1
- package/dist/server/src/__tests__/factories/index.test.js +12 -12
- package/dist/server/src/__tests__/factories/index.test.js.map +1 -1
- package/dist/server/src/__tests__/factories/tax-category.d.ts +3 -3
- package/dist/server/src/__tests__/factories/tax-category.js +5 -6
- package/dist/server/src/__tests__/factories/tax-category.js.map +1 -1
- package/dist/server/src/__tests__/factories/tax-category.test.js +4 -4
- package/dist/server/src/__tests__/factories/tax-category.test.js.map +1 -1
- package/dist/server/src/__tests__/factories/transaction.d.ts +7 -7
- package/dist/server/src/__tests__/factories/transaction.js +11 -11
- package/dist/server/src/__tests__/factories/transaction.js.map +1 -1
- package/dist/server/src/__tests__/factories/transaction.test.js +27 -27
- package/dist/server/src/__tests__/factories/transaction.test.js.map +1 -1
- package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-a.js +20 -20
- package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-a.js.map +1 -1
- package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.js +20 -20
- package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.js.map +1 -1
- package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.test.js +8 -8
- package/dist/server/src/__tests__/fixtures/expenses/expense-scenario-b.test.js.map +1 -1
- package/dist/server/src/__tests__/helpers/fixture-loader.js +2 -2
- package/dist/server/src/__tests__/helpers/fixture-loader.js.map +1 -1
- package/dist/server/src/__tests__/helpers/fixture-loader.test.js +29 -32
- package/dist/server/src/__tests__/helpers/fixture-loader.test.js.map +1 -1
- package/dist/server/src/__tests__/helpers/fixture-validation.test.js +50 -50
- package/dist/server/src/__tests__/helpers/fixture-validation.test.js.map +1 -1
- package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.d.ts +2 -0
- package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.js +4 -0
- package/dist/server/src/modules/ledger/__tests__/helpers/ledger-assertions.js.map +1 -1
- package/dist/server/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.js +20 -20
- package/dist/server/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.js.map +1 -1
- package/dist/server/src/modules/ledger/__tests__/ledger-scenario-b.integration.test.js +21 -21
- package/dist/server/src/modules/ledger/__tests__/ledger-scenario-b.integration.test.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/factories/business.test.ts +3 -3
- package/src/__tests__/factories/business.ts +4 -5
- package/src/__tests__/factories/charge.test.ts +14 -14
- package/src/__tests__/factories/charge.ts +16 -16
- package/src/__tests__/factories/document.test.ts +38 -38
- package/src/__tests__/factories/document.ts +11 -11
- package/src/__tests__/factories/financial-account.test.ts +7 -7
- package/src/__tests__/factories/financial-account.ts +3 -3
- package/src/__tests__/factories/ids.test.ts +80 -0
- package/src/__tests__/factories/ids.ts +49 -0
- package/src/__tests__/factories/index.test.ts +12 -12
- package/src/__tests__/factories/index.ts +2 -2
- package/src/__tests__/factories/tax-category.test.ts +4 -4
- package/src/__tests__/factories/tax-category.ts +6 -7
- package/src/__tests__/factories/transaction.test.ts +27 -27
- package/src/__tests__/factories/transaction.ts +11 -11
- package/src/__tests__/fixtures/expenses/expense-scenario-a.ts +20 -20
- package/src/__tests__/fixtures/expenses/expense-scenario-b.test.ts +8 -8
- package/src/__tests__/fixtures/expenses/expense-scenario-b.ts +20 -20
- package/src/__tests__/helpers/fixture-loader.test.ts +29 -31
- package/src/__tests__/helpers/fixture-loader.ts +2 -2
- package/src/__tests__/helpers/fixture-validation.test.ts +50 -50
- package/src/modules/ledger/__tests__/helpers/ledger-assertions.ts +5 -0
- package/src/modules/ledger/__tests__/ledger-scenario-a.integration.test.ts +20 -20
- package/src/modules/ledger/__tests__/ledger-scenario-b.integration.test.ts +21 -21
- package/dist/server/src/demo-fixtures/__tests__/deterministic-uuid.test.js +0 -58
- package/dist/server/src/demo-fixtures/__tests__/deterministic-uuid.test.js.map +0 -1
- package/dist/server/src/demo-fixtures/helpers/deterministic-uuid.d.ts +0 -50
- package/dist/server/src/demo-fixtures/helpers/deterministic-uuid.js +0 -66
- package/dist/server/src/demo-fixtures/helpers/deterministic-uuid.js.map +0 -1
- package/src/demo-fixtures/__tests__/deterministic-uuid.test.ts +0 -75
- package/src/demo-fixtures/helpers/deterministic-uuid.ts +0 -68
- /package/dist/server/src/{demo-fixtures/__tests__/deterministic-uuid.test.d.ts → __tests__/factories/ids.test.d.ts} +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { v5 as uuidv5 } from 'uuid';
|
|
3
|
-
/**
|
|
4
|
-
* Fixed namespace for all demo data (regenerate on schema-breaking changes if needed).
|
|
5
|
-
* Using standard DNS namespace UUID as recommended by RFC 4122.
|
|
6
|
-
*/
|
|
7
|
-
const DEMO_NAMESPACE = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
8
|
-
/**
|
|
9
|
-
* Generate deterministic UUID v5 from semantic name.
|
|
10
|
-
*
|
|
11
|
-
* This function creates stable, reproducible UUIDs for demo/staging data entities.
|
|
12
|
-
* The same namespace + name combination will always produce the same UUID across
|
|
13
|
-
* deployments, making it safe to reference these IDs in documentation, screenshots,
|
|
14
|
-
* and external links.
|
|
15
|
-
*
|
|
16
|
-
* @param namespace - Entity type: 'business', 'charge', 'transaction', 'document', etc.
|
|
17
|
-
* @param name - Semantic identifier (kebab-case recommended)
|
|
18
|
-
* @returns UUID v5 string (e.g., '550e8400-e29b-41d4-a716-446655440000')
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* // Business entity
|
|
23
|
-
* makeUUID('business', 'acme-consulting-llc')
|
|
24
|
-
* // => Always produces same UUID
|
|
25
|
-
*
|
|
26
|
-
* // Charge entity
|
|
27
|
-
* makeUUID('charge', 'consulting-invoice-2024-11')
|
|
28
|
-
* // => Stable across deploys
|
|
29
|
-
*
|
|
30
|
-
* // Financial account
|
|
31
|
-
* makeUUID('financial-account', 'bank-usd-account')
|
|
32
|
-
* // => Different from makeUUID('business', 'bank-usd-account')
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @remarks
|
|
36
|
-
* **Naming Conventions:**
|
|
37
|
-
* - Use kebab-case for all semantic names
|
|
38
|
-
* - Combine entity type + descriptive name ensures no collisions
|
|
39
|
-
* - Never change a semantic name once deployed (breaks external links)
|
|
40
|
-
* - For updates to same entity, append version: `acme-consulting-llc-v2`
|
|
41
|
-
*
|
|
42
|
-
* **Stability Warning:**
|
|
43
|
-
* Once a UUID is generated and used in staging/production, the semantic name
|
|
44
|
-
* MUST NOT be changed. Doing so will generate a different UUID and break:
|
|
45
|
-
* - External documentation with embedded links
|
|
46
|
-
* - Screenshots with visible UUIDs
|
|
47
|
-
* - Any hardcoded references in client applications
|
|
48
|
-
*
|
|
49
|
-
* If you need to modify an entity, create a new semantic name with a version suffix.
|
|
50
|
-
*/
|
|
51
|
-
export function makeUUID(namespace, name) {
|
|
52
|
-
const composite = `${namespace}:${name}`;
|
|
53
|
-
return uuidv5(composite, DEMO_NAMESPACE);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Backward compatible adapter for legacy single-argument API.
|
|
57
|
-
* - When seed is provided, returns deterministic UUID v5 scoped under 'legacy' namespace
|
|
58
|
-
* - When seed omitted, returns a random UUID to preserve previous behavior
|
|
59
|
-
*/
|
|
60
|
-
export function makeUUIDLegacy(seed) {
|
|
61
|
-
if (seed === undefined || seed === null) {
|
|
62
|
-
return randomUUID();
|
|
63
|
-
}
|
|
64
|
-
return makeUUID('legacy', seed);
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=deterministic-uuid.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deterministic-uuid.js","sourceRoot":"","sources":["../../../../../src/demo-fixtures/helpers/deterministic-uuid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC;;;GAGG;AACH,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAiB,EAAE,IAAY;IACtD,MAAM,SAAS,GAAG,GAAG,SAAS,IAAI,IAAI,EAAE,CAAC;IACzC,OAAO,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC;IACD,OAAO,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { makeUUID } from '../helpers/deterministic-uuid.js';
|
|
3
|
-
|
|
4
|
-
describe('deterministic-uuid', () => {
|
|
5
|
-
describe('makeUUID', () => {
|
|
6
|
-
it('generates same UUID for same inputs', () => {
|
|
7
|
-
const uuid1 = makeUUID('business', 'acme-consulting-llc');
|
|
8
|
-
const uuid2 = makeUUID('business', 'acme-consulting-llc');
|
|
9
|
-
|
|
10
|
-
expect(uuid1).toBe(uuid2);
|
|
11
|
-
expect(uuid1).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('generates different UUIDs for different names', () => {
|
|
15
|
-
const uuid1 = makeUUID('business', 'acme-llc');
|
|
16
|
-
const uuid2 = makeUUID('business', 'acme-corp');
|
|
17
|
-
|
|
18
|
-
expect(uuid1).not.toBe(uuid2);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('generates different UUIDs for different namespaces', () => {
|
|
22
|
-
const businessUUID = makeUUID('business', 'acme');
|
|
23
|
-
const chargeUUID = makeUUID('charge', 'acme');
|
|
24
|
-
|
|
25
|
-
expect(businessUUID).not.toBe(chargeUUID);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('includes namespace in composite key', () => {
|
|
29
|
-
// Same name, different namespace types
|
|
30
|
-
const bizUUID = makeUUID('business', 'test-entity');
|
|
31
|
-
const transactionUUID = makeUUID('transaction', 'test-entity');
|
|
32
|
-
const documentUUID = makeUUID('document', 'test-entity');
|
|
33
|
-
|
|
34
|
-
expect(bizUUID).not.toBe(transactionUUID);
|
|
35
|
-
expect(bizUUID).not.toBe(documentUUID);
|
|
36
|
-
expect(transactionUUID).not.toBe(documentUUID);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('generates valid UUID v5 format', () => {
|
|
40
|
-
const uuid = makeUUID('charge', 'monthly-invoice-2024-11');
|
|
41
|
-
|
|
42
|
-
// UUID v5 format: xxxxxxxx-xxxx-5xxx-yxxx-xxxxxxxxxxxx
|
|
43
|
-
// where y is one of [8, 9, a, b]
|
|
44
|
-
expect(uuid).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('handles kebab-case names correctly', () => {
|
|
48
|
-
const uuid1 = makeUUID('business', 'us-supplier-acme-llc');
|
|
49
|
-
const uuid2 = makeUUID('business', 'us-supplier-acme-llc');
|
|
50
|
-
|
|
51
|
-
expect(uuid1).toBe(uuid2);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('handles numeric components in names', () => {
|
|
55
|
-
const uuid1 = makeUUID('charge', 'invoice-2024-11-15');
|
|
56
|
-
const uuid2 = makeUUID('charge', 'invoice-2024-11-15');
|
|
57
|
-
|
|
58
|
-
expect(uuid1).toBe(uuid2);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('is case-sensitive for names', () => {
|
|
62
|
-
const uuid1 = makeUUID('business', 'acme-llc');
|
|
63
|
-
const uuid2 = makeUUID('business', 'ACME-LLC');
|
|
64
|
-
|
|
65
|
-
expect(uuid1).not.toBe(uuid2);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('is case-sensitive for namespaces', () => {
|
|
69
|
-
const uuid1 = makeUUID('business', 'acme');
|
|
70
|
-
const uuid2 = makeUUID('Business', 'acme');
|
|
71
|
-
|
|
72
|
-
expect(uuid1).not.toBe(uuid2);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { v5 as uuidv5 } from 'uuid';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Fixed namespace for all demo data (regenerate on schema-breaking changes if needed).
|
|
6
|
-
* Using standard DNS namespace UUID as recommended by RFC 4122.
|
|
7
|
-
*/
|
|
8
|
-
const DEMO_NAMESPACE = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Generate deterministic UUID v5 from semantic name.
|
|
12
|
-
*
|
|
13
|
-
* This function creates stable, reproducible UUIDs for demo/staging data entities.
|
|
14
|
-
* The same namespace + name combination will always produce the same UUID across
|
|
15
|
-
* deployments, making it safe to reference these IDs in documentation, screenshots,
|
|
16
|
-
* and external links.
|
|
17
|
-
*
|
|
18
|
-
* @param namespace - Entity type: 'business', 'charge', 'transaction', 'document', etc.
|
|
19
|
-
* @param name - Semantic identifier (kebab-case recommended)
|
|
20
|
-
* @returns UUID v5 string (e.g., '550e8400-e29b-41d4-a716-446655440000')
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* // Business entity
|
|
25
|
-
* makeUUID('business', 'acme-consulting-llc')
|
|
26
|
-
* // => Always produces same UUID
|
|
27
|
-
*
|
|
28
|
-
* // Charge entity
|
|
29
|
-
* makeUUID('charge', 'consulting-invoice-2024-11')
|
|
30
|
-
* // => Stable across deploys
|
|
31
|
-
*
|
|
32
|
-
* // Financial account
|
|
33
|
-
* makeUUID('financial-account', 'bank-usd-account')
|
|
34
|
-
* // => Different from makeUUID('business', 'bank-usd-account')
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* **Naming Conventions:**
|
|
39
|
-
* - Use kebab-case for all semantic names
|
|
40
|
-
* - Combine entity type + descriptive name ensures no collisions
|
|
41
|
-
* - Never change a semantic name once deployed (breaks external links)
|
|
42
|
-
* - For updates to same entity, append version: `acme-consulting-llc-v2`
|
|
43
|
-
*
|
|
44
|
-
* **Stability Warning:**
|
|
45
|
-
* Once a UUID is generated and used in staging/production, the semantic name
|
|
46
|
-
* MUST NOT be changed. Doing so will generate a different UUID and break:
|
|
47
|
-
* - External documentation with embedded links
|
|
48
|
-
* - Screenshots with visible UUIDs
|
|
49
|
-
* - Any hardcoded references in client applications
|
|
50
|
-
*
|
|
51
|
-
* If you need to modify an entity, create a new semantic name with a version suffix.
|
|
52
|
-
*/
|
|
53
|
-
export function makeUUID(namespace: string, name: string): string {
|
|
54
|
-
const composite = `${namespace}:${name}`;
|
|
55
|
-
return uuidv5(composite, DEMO_NAMESPACE);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Backward compatible adapter for legacy single-argument API.
|
|
60
|
-
* - When seed is provided, returns deterministic UUID v5 scoped under 'legacy' namespace
|
|
61
|
-
* - When seed omitted, returns a random UUID to preserve previous behavior
|
|
62
|
-
*/
|
|
63
|
-
export function makeUUIDLegacy(seed?: string): string {
|
|
64
|
-
if (seed === undefined || seed === null) {
|
|
65
|
-
return randomUUID();
|
|
66
|
-
}
|
|
67
|
-
return makeUUID('legacy', seed);
|
|
68
|
-
}
|
|
File without changes
|