@produtype/core 0.6.0 → 0.7.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.
|
@@ -83,19 +83,32 @@ async function detectAuth(ctx) {
|
|
|
83
83
|
/organizationId/i,
|
|
84
84
|
/tenantId/i,
|
|
85
85
|
/workspaceId/i,
|
|
86
|
-
/teamId/i,
|
|
87
86
|
], 20);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Words that only mean tenancy, and words that usually mean something else.
|
|
89
|
+
*
|
|
90
|
+
* `organizationId` and `tenantId` are not written by accident. `workspaceId` and
|
|
91
|
+
* `companyId` are common in SaaS and also in code that talks *about* somebody else's
|
|
92
|
+
* product, so they are corroborated across files before they count.
|
|
93
|
+
*
|
|
94
|
+
* `teamId` was a signal and is gone. In the JavaScript ecosystem it is overwhelmingly
|
|
95
|
+
* Apple's Developer Team ID: `usebruno/bruno`, a desktop API client with no accounts
|
|
96
|
+
* of any kind, was classified as a B2B SaaS with high confidence on the strength of
|
|
97
|
+
* `const teamId = 'W7LPPWA48L'` in its notarization script.
|
|
98
|
+
*/
|
|
99
|
+
const STRONG_TENANCY = [/organizationId/i, /organization_id/i, /tenantId/i, /tenant_id/i];
|
|
100
|
+
const WEAK_TENANCY = [/workspaceId/i, /workspace_id/i, /companyId/i];
|
|
101
|
+
const strongOrganization = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, STRONG_TENANCY, 25);
|
|
102
|
+
const weakOrganization = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, WEAK_TENANCY, 25);
|
|
103
|
+
// A weak word never stands on its own, however many files it appears in. Bruno says
|
|
104
|
+
// `workspaceId` in three — it has workspaces, and they are local folders, not
|
|
105
|
+
// customers. A tenant boundary is named somewhere by a word that means only that.
|
|
106
|
+
const organizationSignals = strongOrganization.length > 0
|
|
107
|
+
? [...strongOrganization, ...weakOrganization]
|
|
108
|
+
: [];
|
|
109
|
+
const strongMembership = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, [/memberId/i, ...STRONG_TENANCY], 25);
|
|
110
|
+
const weakMembership = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, WEAK_TENANCY, 25);
|
|
111
|
+
const membershipSignals = strongMembership.length > 0 ? [...strongMembership, ...weakMembership] : [];
|
|
99
112
|
const b2bSignals = await (0, textSearch_1.searchInFiles)(ctx.root, sourceFiles, [
|
|
100
113
|
/stripe/i,
|
|
101
114
|
/subscription/i,
|
|
@@ -12,7 +12,18 @@ async function detectBilling(ctx) {
|
|
|
12
12
|
if (hasStripeDep)
|
|
13
13
|
evidence.push({ type: 'dependency', value: 'stripe' });
|
|
14
14
|
const stripeContextHits = await (0, textSearch_1.searchInFiles)(ctx.root, ctx.files.source, [
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The bare word is not here, on purpose.
|
|
17
|
+
*
|
|
18
|
+
* `\bstripe\b` matched `'table-stripe': '#f3f3f3'`, a CSS colour token for
|
|
19
|
+
* zebra-striped tables, and `{['Stripe API', 'GitHub REST', …]}`, a list of API
|
|
20
|
+
* names in a design-system demo. Both are in `usebruno/bruno`, a desktop API
|
|
21
|
+
* client that takes no payments and was reported as a B2B SaaS.
|
|
22
|
+
*
|
|
23
|
+
* A project that actually charges people has the dependency, a STRIPE_ variable,
|
|
24
|
+
* a customer or subscription id, or a webhook path. One that only ever writes
|
|
25
|
+
* "Stripe" in prose is talking about Stripe, not billing through it.
|
|
26
|
+
*/
|
|
16
27
|
/STRIPE_[A-Z0-9_]+/,
|
|
17
28
|
/stripeCustomerId/i,
|
|
18
29
|
/stripeSubscriptionId/i,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@produtype/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Deterministic CLI and library that analyzes a web application repository and reports how far it is from production-ready for the kind of product it is meant to be.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|