@shdan/submesh 0.1.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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/contracts.d.ts +191 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +2 -0
- package/dist/contracts.js.map +1 -0
- package/dist/drizzle/catalog-mapping-repository.d.ts +280 -0
- package/dist/drizzle/catalog-mapping-repository.d.ts.map +1 -0
- package/dist/drizzle/catalog-mapping-repository.js +62 -0
- package/dist/drizzle/catalog-mapping-repository.js.map +1 -0
- package/dist/drizzle/ensure-schema.d.ts +3 -0
- package/dist/drizzle/ensure-schema.d.ts.map +1 -0
- package/dist/drizzle/ensure-schema.js +100 -0
- package/dist/drizzle/ensure-schema.js.map +1 -0
- package/dist/drizzle/inbound-event-repository.d.ts +960 -0
- package/dist/drizzle/inbound-event-repository.d.ts.map +1 -0
- package/dist/drizzle/inbound-event-repository.js +148 -0
- package/dist/drizzle/inbound-event-repository.js.map +1 -0
- package/dist/drizzle/index.d.ts +40 -0
- package/dist/drizzle/index.d.ts.map +1 -0
- package/dist/drizzle/index.js +57 -0
- package/dist/drizzle/index.js.map +1 -0
- package/dist/drizzle/migrate.d.ts +11 -0
- package/dist/drizzle/migrate.d.ts.map +1 -0
- package/dist/drizzle/migrate.js +22 -0
- package/dist/drizzle/migrate.js.map +1 -0
- package/dist/drizzle/plan-repository.d.ts +497 -0
- package/dist/drizzle/plan-repository.d.ts.map +1 -0
- package/dist/drizzle/plan-repository.js +70 -0
- package/dist/drizzle/plan-repository.js.map +1 -0
- package/dist/drizzle/plugin-installation-repository.d.ts +26 -0
- package/dist/drizzle/plugin-installation-repository.d.ts.map +1 -0
- package/dist/drizzle/plugin-installation-repository.js +71 -0
- package/dist/drizzle/plugin-installation-repository.js.map +1 -0
- package/dist/drizzle/repository-set.d.ts +4 -0
- package/dist/drizzle/repository-set.d.ts.map +1 -0
- package/dist/drizzle/repository-set.js +19 -0
- package/dist/drizzle/repository-set.js.map +1 -0
- package/dist/drizzle/schema.d.ts +2370 -0
- package/dist/drizzle/schema.d.ts.map +1 -0
- package/dist/drizzle/schema.js +103 -0
- package/dist/drizzle/schema.js.map +1 -0
- package/dist/drizzle/subject-repository.d.ts +295 -0
- package/dist/drizzle/subject-repository.d.ts.map +1 -0
- package/dist/drizzle/subject-repository.js +76 -0
- package/dist/drizzle/subject-repository.js.map +1 -0
- package/dist/drizzle/subscription-repository.d.ts +60 -0
- package/dist/drizzle/subscription-repository.d.ts.map +1 -0
- package/dist/drizzle/subscription-repository.js +128 -0
- package/dist/drizzle/subscription-repository.js.map +1 -0
- package/dist/drizzle/summary-repository.d.ts +9 -0
- package/dist/drizzle/summary-repository.d.ts.map +1 -0
- package/dist/drizzle/summary-repository.js +25 -0
- package/dist/drizzle/summary-repository.js.map +1 -0
- package/dist/drizzle/types.d.ts +4 -0
- package/dist/drizzle/types.d.ts.map +1 -0
- package/dist/drizzle/types.js +2 -0
- package/dist/drizzle/types.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/hooks.d.ts +24 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +2 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +16 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +8 -0
- package/dist/logger.js.map +1 -0
- package/dist/plugins/builtin-plugins.d.ts +3 -0
- package/dist/plugins/builtin-plugins.d.ts.map +1 -0
- package/dist/plugins/builtin-plugins.js +7 -0
- package/dist/plugins/builtin-plugins.js.map +1 -0
- package/dist/plugins/hash-payload.d.ts +2 -0
- package/dist/plugins/hash-payload.d.ts.map +1 -0
- package/dist/plugins/hash-payload.js +5 -0
- package/dist/plugins/hash-payload.js.map +1 -0
- package/dist/plugins/manual.d.ts +12 -0
- package/dist/plugins/manual.d.ts.map +1 -0
- package/dist/plugins/manual.js +87 -0
- package/dist/plugins/manual.js.map +1 -0
- package/dist/plugins/plan-provisioning.d.ts +18 -0
- package/dist/plugins/plan-provisioning.d.ts.map +1 -0
- package/dist/plugins/plan-provisioning.js +159 -0
- package/dist/plugins/plan-provisioning.js.map +1 -0
- package/dist/plugins/plugin-registry.d.ts +9 -0
- package/dist/plugins/plugin-registry.d.ts.map +1 -0
- package/dist/plugins/plugin-registry.js +18 -0
- package/dist/plugins/plugin-registry.js.map +1 -0
- package/dist/providers/apple/plugin/app-store-plan-sync.d.ts +4 -0
- package/dist/providers/apple/plugin/app-store-plan-sync.d.ts.map +1 -0
- package/dist/providers/apple/plugin/app-store-plan-sync.js +85 -0
- package/dist/providers/apple/plugin/app-store-plan-sync.js.map +1 -0
- package/dist/providers/apple/plugin/app-store.d.ts +20 -0
- package/dist/providers/apple/plugin/app-store.d.ts.map +1 -0
- package/dist/providers/apple/plugin/app-store.js +397 -0
- package/dist/providers/apple/plugin/app-store.js.map +1 -0
- package/dist/providers/apple/security/app-store-verification.d.ts +4 -0
- package/dist/providers/apple/security/app-store-verification.d.ts.map +1 -0
- package/dist/providers/apple/security/app-store-verification.js +100 -0
- package/dist/providers/apple/security/app-store-verification.js.map +1 -0
- package/dist/providers/apple/services/app-store-subscription-verification-service.d.ts +3 -0
- package/dist/providers/apple/services/app-store-subscription-verification-service.d.ts.map +1 -0
- package/dist/providers/apple/services/app-store-subscription-verification-service.js +155 -0
- package/dist/providers/apple/services/app-store-subscription-verification-service.js.map +1 -0
- package/dist/providers/google/plugin/play-plan-sync.d.ts +4 -0
- package/dist/providers/google/plugin/play-plan-sync.d.ts.map +1 -0
- package/dist/providers/google/plugin/play-plan-sync.js +270 -0
- package/dist/providers/google/plugin/play-plan-sync.js.map +1 -0
- package/dist/providers/google/plugin/play.d.ts +20 -0
- package/dist/providers/google/plugin/play.d.ts.map +1 -0
- package/dist/providers/google/plugin/play.js +460 -0
- package/dist/providers/google/plugin/play.js.map +1 -0
- package/dist/providers/google/security/oauth.d.ts +10 -0
- package/dist/providers/google/security/oauth.d.ts.map +1 -0
- package/dist/providers/google/security/oauth.js +116 -0
- package/dist/providers/google/security/oauth.js.map +1 -0
- package/dist/providers/google/security/pubsub-verification.d.ts +3 -0
- package/dist/providers/google/security/pubsub-verification.d.ts.map +1 -0
- package/dist/providers/google/security/pubsub-verification.js +229 -0
- package/dist/providers/google/security/pubsub-verification.js.map +1 -0
- package/dist/providers/google/services/play-subscription-verification-service.d.ts +3 -0
- package/dist/providers/google/services/play-subscription-verification-service.d.ts.map +1 -0
- package/dist/providers/google/services/play-subscription-verification-service.js +96 -0
- package/dist/providers/google/services/play-subscription-verification-service.js.map +1 -0
- package/dist/repositories/catalog-mapping-repository.d.ts +9 -0
- package/dist/repositories/catalog-mapping-repository.d.ts.map +1 -0
- package/dist/repositories/catalog-mapping-repository.js +2 -0
- package/dist/repositories/catalog-mapping-repository.js.map +1 -0
- package/dist/repositories/inbound-event-repository.d.ts +23 -0
- package/dist/repositories/inbound-event-repository.d.ts.map +1 -0
- package/dist/repositories/inbound-event-repository.js +2 -0
- package/dist/repositories/inbound-event-repository.js.map +1 -0
- package/dist/repositories/index.d.ts +30 -0
- package/dist/repositories/index.d.ts.map +1 -0
- package/dist/repositories/index.js +2 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/plan-repository.d.ts +10 -0
- package/dist/repositories/plan-repository.d.ts.map +1 -0
- package/dist/repositories/plan-repository.js +2 -0
- package/dist/repositories/plan-repository.js.map +1 -0
- package/dist/repositories/plugin-installation-repository.d.ts +13 -0
- package/dist/repositories/plugin-installation-repository.d.ts.map +1 -0
- package/dist/repositories/plugin-installation-repository.js +2 -0
- package/dist/repositories/plugin-installation-repository.js.map +1 -0
- package/dist/repositories/subject-repository.d.ts +10 -0
- package/dist/repositories/subject-repository.d.ts.map +1 -0
- package/dist/repositories/subject-repository.js +2 -0
- package/dist/repositories/subject-repository.js.map +1 -0
- package/dist/repositories/subscription-repository.d.ts +24 -0
- package/dist/repositories/subscription-repository.d.ts.map +1 -0
- package/dist/repositories/subscription-repository.js +2 -0
- package/dist/repositories/subscription-repository.js.map +1 -0
- package/dist/security/jwt.d.ts +22 -0
- package/dist/security/jwt.d.ts.map +1 -0
- package/dist/security/jwt.js +132 -0
- package/dist/security/jwt.js.map +1 -0
- package/dist/security/plugin-webhook-verification.d.ts +3 -0
- package/dist/security/plugin-webhook-verification.d.ts.map +1 -0
- package/dist/security/plugin-webhook-verification.js +44 -0
- package/dist/security/plugin-webhook-verification.js.map +1 -0
- package/dist/security/relay-signature.d.ts +12 -0
- package/dist/security/relay-signature.d.ts.map +1 -0
- package/dist/security/relay-signature.js +39 -0
- package/dist/security/relay-signature.js.map +1 -0
- package/dist/services/canonical-subscription-service.d.ts +4 -0
- package/dist/services/canonical-subscription-service.d.ts.map +1 -0
- package/dist/services/canonical-subscription-service.js +20 -0
- package/dist/services/canonical-subscription-service.js.map +1 -0
- package/dist/services/managed-subscription-service.d.ts +5 -0
- package/dist/services/managed-subscription-service.d.ts.map +1 -0
- package/dist/services/managed-subscription-service.js +24 -0
- package/dist/services/managed-subscription-service.js.map +1 -0
- package/dist/services/plan-provisioning-service.d.ts +5 -0
- package/dist/services/plan-provisioning-service.d.ts.map +1 -0
- package/dist/services/plan-provisioning-service.js +100 -0
- package/dist/services/plan-provisioning-service.js.map +1 -0
- package/dist/services/plan-resolution.d.ts +4 -0
- package/dist/services/plan-resolution.d.ts.map +1 -0
- package/dist/services/plan-resolution.js +33 -0
- package/dist/services/plan-resolution.js.map +1 -0
- package/dist/services/plugin-installation-service.d.ts +6 -0
- package/dist/services/plugin-installation-service.d.ts.map +1 -0
- package/dist/services/plugin-installation-service.js +19 -0
- package/dist/services/plugin-installation-service.js.map +1 -0
- package/dist/services/provider-subscription-sync-service.d.ts +4 -0
- package/dist/services/provider-subscription-sync-service.d.ts.map +1 -0
- package/dist/services/provider-subscription-sync-service.js +13 -0
- package/dist/services/provider-subscription-sync-service.js.map +1 -0
- package/dist/services/subject-resolution.d.ts +4 -0
- package/dist/services/subject-resolution.d.ts.map +1 -0
- package/dist/services/subject-resolution.js +48 -0
- package/dist/services/subject-resolution.js.map +1 -0
- package/dist/services/webhook-ingestion-service.d.ts +14 -0
- package/dist/services/webhook-ingestion-service.d.ts.map +1 -0
- package/dist/services/webhook-ingestion-service.js +149 -0
- package/dist/services/webhook-ingestion-service.js.map +1 -0
- package/dist/submesh.d.ts +265 -0
- package/dist/submesh.d.ts.map +1 -0
- package/dist/submesh.js +602 -0
- package/dist/submesh.js.map +1 -0
- package/dist/utils/canonical.d.ts +7 -0
- package/dist/utils/canonical.d.ts.map +1 -0
- package/dist/utils/canonical.js +8 -0
- package/dist/utils/canonical.js.map +1 -0
- package/dist/utils/parse.d.ts +42 -0
- package/dist/utils/parse.d.ts.map +1 -0
- package/dist/utils/parse.js +74 -0
- package/dist/utils/parse.js.map +1 -0
- package/dist/utils/records.d.ts +2 -0
- package/dist/utils/records.d.ts.map +1 -0
- package/dist/utils/records.js +7 -0
- package/dist/utils/records.js.map +1 -0
- package/dist/utils/time.d.ts +2 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +4 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/validation.d.ts +10 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +19 -0
- package/dist/utils/validation.js.map +1 -0
- package/drizzle/0000_cute_the_order.sql +94 -0
- package/drizzle/meta/0000_snapshot.json +559 -0
- package/drizzle/meta/_journal.json +13 -0
- package/package.json +54 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value as an object, or an empty object if the value is not a
|
|
3
|
+
* non-array object.
|
|
4
|
+
*/
|
|
5
|
+
export declare function asObject(value: unknown): Record<string, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Returns the value as an object, or throws if the value is not a non-array
|
|
8
|
+
* object.
|
|
9
|
+
*/
|
|
10
|
+
export declare function requireObject(value: unknown, message: string): Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the value as a non-empty string, or undefined.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getString(value: unknown): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the value as a boolean, or undefined.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getBoolean(value: unknown): boolean | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the value as a finite number, or undefined.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getNumber(value: unknown): number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the value as an array of non-null objects, filtering out
|
|
25
|
+
* non-object entries.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getObjectArray(value: unknown): Record<string, unknown>[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns the value as an array of non-empty strings, filtering out
|
|
30
|
+
* non-string entries.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getStringArray(value: unknown): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Returns the value as a Record<string, string>, filtering out non-string
|
|
35
|
+
* entries.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getStringRecord(value: unknown): Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* Returns true if the value is explicitly `true` or `"true"`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isExplicitlyEnabled(value: unknown): boolean;
|
|
42
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMtF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE5D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAE9D;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE5D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CASxE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAQvD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUtE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE3D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value as an object, or an empty object if the value is not a
|
|
3
|
+
* non-array object.
|
|
4
|
+
*/
|
|
5
|
+
export function asObject(value) {
|
|
6
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
7
|
+
? value
|
|
8
|
+
: {};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Returns the value as an object, or throws if the value is not a non-array
|
|
12
|
+
* object.
|
|
13
|
+
*/
|
|
14
|
+
export function requireObject(value, message) {
|
|
15
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
16
|
+
throw new Error(message);
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the value as a non-empty string, or undefined.
|
|
22
|
+
*/
|
|
23
|
+
export function getString(value) {
|
|
24
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns the value as a boolean, or undefined.
|
|
28
|
+
*/
|
|
29
|
+
export function getBoolean(value) {
|
|
30
|
+
return typeof value === "boolean" ? value : undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the value as a finite number, or undefined.
|
|
34
|
+
*/
|
|
35
|
+
export function getNumber(value) {
|
|
36
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the value as an array of non-null objects, filtering out
|
|
40
|
+
* non-object entries.
|
|
41
|
+
*/
|
|
42
|
+
export function getObjectArray(value) {
|
|
43
|
+
if (!Array.isArray(value)) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
return value.filter((entry) => Boolean(entry) && typeof entry === "object");
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns the value as an array of non-empty strings, filtering out
|
|
50
|
+
* non-string entries.
|
|
51
|
+
*/
|
|
52
|
+
export function getStringArray(value) {
|
|
53
|
+
if (!Array.isArray(value)) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
return value.filter((entry) => typeof entry === "string" && entry.length > 0);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the value as a Record<string, string>, filtering out non-string
|
|
60
|
+
* entries.
|
|
61
|
+
*/
|
|
62
|
+
export function getStringRecord(value) {
|
|
63
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "string"));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Returns true if the value is explicitly `true` or `"true"`.
|
|
70
|
+
*/
|
|
71
|
+
export function isExplicitlyEnabled(value) {
|
|
72
|
+
return value === true || value === "true";
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/utils/parse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAChE,CAAC,CAAE,KAAiC;QACpC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc,EAAE,OAAe;IAC3D,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACjF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,KAAK,EAAoC,EAAE,CAC1C,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,CAC9C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAC1E,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,MAAM,CACrD,CAAC,KAAK,EAA6B,EAAE,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CACnE,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,MAAM,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/utils/records.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/utils/records.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,KAAgC,CAAC;IAC1C,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA,wBAAgB,GAAG,IAAI,MAAM,CAE5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG;IACjB,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asserts that a string field is a non-empty string. Throws
|
|
3
|
+
* {@link ValidationError} when the value is falsy, empty, or not a string.
|
|
4
|
+
*/
|
|
5
|
+
export declare function requireString(value: unknown, fieldName: string): asserts value is string;
|
|
6
|
+
/**
|
|
7
|
+
* Asserts that a string field, if present, does not exceed the given length.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assertMaxLength(value: string | undefined | null, maxLength: number, fieldName: string): void;
|
|
10
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,KAAK,IAAI,MAAM,CAIzB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,EAChC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,IAAI,CAMN"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ValidationError } from "../errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* Asserts that a string field is a non-empty string. Throws
|
|
4
|
+
* {@link ValidationError} when the value is falsy, empty, or not a string.
|
|
5
|
+
*/
|
|
6
|
+
export function requireString(value, fieldName) {
|
|
7
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
8
|
+
throw new ValidationError(`${fieldName} is required and must be a non-empty string.`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Asserts that a string field, if present, does not exceed the given length.
|
|
13
|
+
*/
|
|
14
|
+
export function assertMaxLength(value, maxLength, fieldName) {
|
|
15
|
+
if (value != null && value.length > maxLength) {
|
|
16
|
+
throw new ValidationError(`${fieldName} must not exceed ${maxLength} characters (got ${value.length}).`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAc,EACd,SAAiB;IAEjB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,eAAe,CAAC,GAAG,SAAS,8CAA8C,CAAC,CAAC;IACxF,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAgC,EAChC,SAAiB,EACjB,SAAiB;IAEjB,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;QAC9C,MAAM,IAAI,eAAe,CACvB,GAAG,SAAS,oBAAoB,SAAS,oBAAoB,KAAK,CAAC,MAAM,IAAI,CAC9E,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
CREATE TABLE "catalog_mappings" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"plugin_key" text NOT NULL,
|
|
4
|
+
"external_product_id" text NOT NULL,
|
|
5
|
+
"plan_code" text NOT NULL,
|
|
6
|
+
"metadata" jsonb NOT NULL,
|
|
7
|
+
"created_at" text NOT NULL,
|
|
8
|
+
"updated_at" text NOT NULL,
|
|
9
|
+
CONSTRAINT "catalog_mappings_plugin_key_external_product_id_unique" UNIQUE("plugin_key","external_product_id")
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE TABLE "inbound_events" (
|
|
13
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
14
|
+
"plugin_key" text NOT NULL,
|
|
15
|
+
"event_key" text NOT NULL,
|
|
16
|
+
"event_type" text NOT NULL,
|
|
17
|
+
"source_ref" text,
|
|
18
|
+
"payload" jsonb NOT NULL,
|
|
19
|
+
"status" text NOT NULL,
|
|
20
|
+
"processed_count" integer NOT NULL,
|
|
21
|
+
"error_message" text,
|
|
22
|
+
"processed_at" text,
|
|
23
|
+
"created_at" text NOT NULL,
|
|
24
|
+
"updated_at" text NOT NULL,
|
|
25
|
+
CONSTRAINT "inbound_events_plugin_key_event_key_unique" UNIQUE("plugin_key","event_key")
|
|
26
|
+
);
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
CREATE TABLE "plans" (
|
|
29
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
30
|
+
"code" text NOT NULL,
|
|
31
|
+
"name" text NOT NULL,
|
|
32
|
+
"description" text,
|
|
33
|
+
"interval_unit" text NOT NULL,
|
|
34
|
+
"price_amount" integer NOT NULL,
|
|
35
|
+
"currency" text NOT NULL,
|
|
36
|
+
"entitlements" text[] NOT NULL,
|
|
37
|
+
"metadata" jsonb NOT NULL,
|
|
38
|
+
"created_at" text NOT NULL,
|
|
39
|
+
"updated_at" text NOT NULL,
|
|
40
|
+
CONSTRAINT "plans_code_unique" UNIQUE("code")
|
|
41
|
+
);
|
|
42
|
+
--> statement-breakpoint
|
|
43
|
+
CREATE TABLE "plugin_installations" (
|
|
44
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
45
|
+
"plugin_key" text NOT NULL,
|
|
46
|
+
"display_name" text NOT NULL,
|
|
47
|
+
"enabled" integer NOT NULL,
|
|
48
|
+
"config" jsonb NOT NULL,
|
|
49
|
+
"created_at" text NOT NULL,
|
|
50
|
+
"updated_at" text NOT NULL,
|
|
51
|
+
CONSTRAINT "plugin_installations_plugin_key_unique" UNIQUE("plugin_key")
|
|
52
|
+
);
|
|
53
|
+
--> statement-breakpoint
|
|
54
|
+
CREATE TABLE "subject_identities" (
|
|
55
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
56
|
+
"subject_id" text NOT NULL,
|
|
57
|
+
"provider" text NOT NULL,
|
|
58
|
+
"external_id" text NOT NULL,
|
|
59
|
+
"metadata" jsonb NOT NULL,
|
|
60
|
+
"created_at" text NOT NULL,
|
|
61
|
+
CONSTRAINT "subject_identities_provider_external_id_unique" UNIQUE("provider","external_id")
|
|
62
|
+
);
|
|
63
|
+
--> statement-breakpoint
|
|
64
|
+
CREATE TABLE "subjects" (
|
|
65
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
66
|
+
"email" text,
|
|
67
|
+
"name" text,
|
|
68
|
+
"external_ref" text,
|
|
69
|
+
"metadata" jsonb NOT NULL,
|
|
70
|
+
"created_at" text NOT NULL,
|
|
71
|
+
"updated_at" text NOT NULL
|
|
72
|
+
);
|
|
73
|
+
--> statement-breakpoint
|
|
74
|
+
CREATE TABLE "subscriptions" (
|
|
75
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
76
|
+
"subject_id" text NOT NULL,
|
|
77
|
+
"plan_id" text NOT NULL,
|
|
78
|
+
"plugin_key" text NOT NULL,
|
|
79
|
+
"source_type" text NOT NULL,
|
|
80
|
+
"source_ref" text NOT NULL,
|
|
81
|
+
"status" text NOT NULL,
|
|
82
|
+
"current_period_start" text,
|
|
83
|
+
"current_period_end" text,
|
|
84
|
+
"trial_end_at" text,
|
|
85
|
+
"cancel_at" text,
|
|
86
|
+
"metadata" jsonb NOT NULL,
|
|
87
|
+
"created_at" text NOT NULL,
|
|
88
|
+
"updated_at" text NOT NULL,
|
|
89
|
+
CONSTRAINT "subscriptions_plugin_key_source_ref_unique" UNIQUE("plugin_key","source_ref")
|
|
90
|
+
);
|
|
91
|
+
--> statement-breakpoint
|
|
92
|
+
ALTER TABLE "subject_identities" ADD CONSTRAINT "subject_identities_subject_id_subjects_id_fk" FOREIGN KEY ("subject_id") REFERENCES "public"."subjects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
93
|
+
ALTER TABLE "subscriptions" ADD CONSTRAINT "subscriptions_subject_id_subjects_id_fk" FOREIGN KEY ("subject_id") REFERENCES "public"."subjects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
94
|
+
ALTER TABLE "subscriptions" ADD CONSTRAINT "subscriptions_plan_id_plans_id_fk" FOREIGN KEY ("plan_id") REFERENCES "public"."plans"("id") ON DELETE restrict ON UPDATE no action;
|